# A HEX loader

This document describes various methods to poke a binary program into RAM using a BASIC program.

    10 addr=&4000
    20 read a$
    30 if a$="*" then goto 70
    40 poke addr,val("&"+a$)
    50 addr=addr+1
    60 goto 20
    70 call &4000
    80 data 3e,3a,cd,5a,bb,c9,*

Line 10 defines the start address (&4000) to poke the data to. Line 20 reads a string from the current data position. Line 30 tests to see if the string is the end of data marker Line 40 converts the string to a hexidecimal value which is poked into the memory address referenced by the "addr" variable. Line 50 increments the "addr" variable, so that the next byte is poked after the previous byte. Line 60 loops back to continue reading data. Line 70 executes the program Line 80 contains the data of the program

    10 for addr=&4000 to &4006
    20 read a%
    30 poke addr,a%
    40 next
    50 call &4000
    60 data &3e,&3a,&cd,&5a,&bb,&c9

Line 10 defines a loop for the entire range of the binary data. Line 20 reads a number from the current data position. Line 30 pokes the number to the destination RAM address. Line 50 executes the program Line 60 contains the data of the program.