
'program:
'       SetPin pgc,8
'       SetPin pgd,8
'       SetPin pgm,8
'       SetPin vpp,8
'hexfile$ = "hexfile.hex"
'hexfilenum = 1
'
'Open hexfile$ For input As #hexfilenum
'Cls
'file_addr = 0: mem_addr = 0: nbytes = 0: byte_count = 0
'Do
'  Do
'    Line Input #hexfilenum, hexline$
'    nBytes = hextodec(Mid$(hexline$,2,2))
'    file_addr = hextodec(Mid$(hexline$,4,4))/2
'    dataline$ = Mid$(hexline$,10,Len(hexline$)-11)
'  Loop Until nbytes > 0
'
'  Do While file_addr > mem_addr
'    outcommand(load_mem_data$): outdata(&H3fff)
'    mem_addr = mem_addr + 1 : byte_count = byte_count + 1
'    If byte_count = 4 Then
'      byte_count = 0
'      outcommand(begin_prog_only_cycle$): outcommand(end_pgm$)
'    EndIf
'    outcommand(inc_addr$)
'  Loop
'
'  If mem_addr = file_addr Then
'    For x = 1 To Len(dataline$) Step 4
'      a$ = swap_byte$(Mid$(dataline$,x,4))
'      outcommand(load_mem_data$): outdata(hextobin$(a$))
'      mem_addr = mem_addr + 1 : byte_count = byte_count + 1
'      If byte_count = 4 Then
'        byte_count = 0
'        outcommand(begin_prog_only_cycle$): outcommand(end_pgm$)
'      EndIf
'      outcommand(inc_addr$)
'    Next x
'  EndIf
'Loop
'GoTo menu


'Sub outdata(d$)
'Local x
'  Pin(pgd)=0
'  Pulse pgc, 0.1
'  For x = 16 To 3 Step -1
'    Pin(pgd) = Val(Mid$(d$,x,1))
'    Pulse pgc,0.1
'    Next x
'  Pin(pgd)=0
'  Pulse pgc,0.1
'End Sub

test:
'readhexfile()
'? Hex$(memdata(0))
'goTo test
Input "integer ", a
integertobin(a)

For x = 0 To 13
? bin(x);
Next x
?
GoTo test

For s = 13 To 0 Step - 1
? bin(s);
Next s
?
GoTo test

5 Edit
