DATA CREATOR

by Bill McIntosh

from ZX Computing Feb/Mar.1986



Good things come in small packages they say,

and Bill McIntosh's useful program proves it!





This program takes code from memory between two specified

addresses and creates DATA statements which contain the code

in string form using hex notation. Obviously this can save

much time and effort, especially in preparing programs for

submission to magazines.



The code has been deliberately kept inside string quotes in

order to keep the amount of memory that the statements take

up to an absolute minimum.



To use the program, first of all CLEAR RAMTOP to some value

below 65000. Type in the HEX loader followed by the DATA

lines. When you're happy that all is correct then type RUN

and wait until the message 'Out of data' appears. The

program code will then have been placed into memory at 65000

and is about 220 bytes long. [It's 216 bytes. JimG.] When

you have done this, SAVE the program code with:



SAVE "DATACREATE" CODE 65000,220



The start address of the code that you wish to convert

should be POKE-ed into 65000 and 65001 and the address of

the last byte should be POKE-ed into 65002 and 65003 using

the method in Figure 1 as an example.



Type and RUN and then NEW. Before running the machine code

there must be one program line in BASIC numbered 9999. This

can contain anything that you like. It may be of more use

though to use 9999 as a REM statement to make notes about

the listing. The data line numbers start from some number,

depending on the amount of code, increase in single steps,

and always end at 9998.



Type in RAND USR 65004. When the operation is complete you

will find that the data statements containing your code have

been inserted. The listing can now be SAVED or PRINTED in

the normal way.



To POKE the code back into memory simply change X in line 5

of the HEX LOADER to the start address of your code and run.





Figure 1.



10 LET x=30000: REM start address

20 POKE 65000,x-256*INT (x/256)

30 POKE 65001,INT (x/256)

40 LET x=30234: REM end address

50 POKE 65002,x-256*INT (x/256)

60 POKE 65003,INT (x/256)





-- end of file --

