MC To DATA

See all articles from QZX v4 n10
Author(s): D. C. Alford; Bill McIntosh
Publication: QZX
Pub Details: QZX v4 n10 (Volume 4, Issue 10)
Date: September 1986
Pages: 4

Here is a program which appeared in the June issue of the newsletter of the Hampton Roads T/S Users Group which takes a machine code program from the T/S 2068 and converts it into DATA statements for easy manipulation.

I have converted a Spectrum program by Bill McIntosh which appeared in the Feb/Mar 1986 issue of ZX COMPUTING to work on the 2068. This program will take your machine code program from memory and put it into the basic program area complete with line numbers as DATA statements ready for printing, saving, or editing.

The program starts by taking the end address you specify and transfers the data into lines starting with line 9998 and working backwards until it reaches the start address you specified. The program accomplishes this by using an LDIR so do not try to run the code from its old location without first repoking it back into that location. The data can be repoked into its old location by changing the 65000 in line 5 of the HEX LOADER to your start address.

After typing in the main program, RUN it and wait for the OUT OF DATA message. SAVE the program CODE with SAVE “datacreate” CODE 65000,216.

Load in your machine code program and the “datacreate” CODE saved above. The start address of the code you wish to convert should be POKED into 65000 and 65001 and the end address of the last byte should be POKED into 65002 and 65003 using program 2 below.

   1 REM datacreate
5 LET X=65000:LET A=10:LET B=11:LET C=12
6 LET D=13:LET E=14:LET F=15
10 READ A$
20 FOR N=1 TO 15 STEP 2
30 LET W=VAL A$(N)
40 LET W=W*16:LET W=W+VAL A$(N+1)
50 POKE X,W:LET X=X+1
60 NEXT N
70 GO TO 10
80 STOP
9972 DATA "00000000210E2722"
9973 DATA "9FFE2AEAFDED5BE8"
9974 DATA "FDB7ED527DE60728"
9975 DATA "0E2AEAFD7DE6F86F"
9976 DATA "1108001922EAFD2A"
9977 DATA "EAFD2822EAFDED5B"
9978 DATA "E8FDB7ED5222A1FE"
9979 DATA "21BCFE22A5FE3E08"
9980 DATA "32A3FE2AEAFD2B22"
9981 DATA "EAFD237E219EFE77"
9982 DATA "AFED6F47ED6F4FED"
9983 DATA "6F79FE0A3803C607"
9984 DATA "4F78FE0A3803C607"
9985 DATA "472AA5FE79C63077"
9986 DATA "2B78C630772B22A5"
9987 DATA "FE21A3FE3520C421"
9988 DATA "5668011800CDBB12"
9989 DATA "2A9FFE2B229FFE23"
9990 DATA "EB21A7FE7223732B"
9991 DATA "115668011800EDB0"
9992 DATA "2AA1FE110800B7ED"
9993 DATA "52D21DFE21C80011"
9994 DATA "C800CDF303C90000"
9995 DATA "0000000000000000"
9996 DATA "001400E422000000"
9997 DATA "0000000000000000"
9998 DATA "0000000000220D00"
9999 REM RANDOMIZE USR 65004
   1 LOAD ""CODE 65000,220
5 INPUT "START ADDRESS",X
20 POKE 65000,X-256*INT (X/256)
30 POKE 65001,INT (X/256)
31 CLEAR X-1
35 INPUT "END ADDRESS",Y
50 POKE 65002,Y-256*INT (Y/256)
60 POKE 65003,INT (Y/256)
65 PRINT #1;"NOW HIT ENTER,RUN&ENTER;
66 PAUSE 0
70 DELETE 1,80
9999 RANDOMIZE USR 65004