80 EF = 1: TEXT : HOME :D$ = CHR$(4): POKE 230,32: CALL -3086: POKE 49236,0: POKE 49234,0: POKE 49239,0: POKE 49232,0: ONERR GOTO 490
90 HX$ = "0123456789ABCDEF":BE = -198:CS = -958
100 INVERSE : VTAB 1: FOR I = 1 TO 40: HTAB I: PRINT " ";: NEXT
110 FOR V = 2 TO 23: VTAB V: HTAB 1: PRINT " ";: HTAB 40: PRINT " ";: HTAB 1: NEXT : VTAB 24: HTAB 1: PRINT " ";
120 POKE 34,2: POKE 32,1: POKE 33,38: POKE 35,23
130 VTAB 24: FOR I = 1 TO 40: HTAB I: PRINT " ";: NEXT
140 VTAB 2: HTAB 13: PRINT "DATA WRITER": NORMAL : PRINT " COPYRIGHT 1986 BY MICROSPARC, INC."
150 VTAB 5: HTAB 5: PRINT "THIS PROGRAM WILL CONVERT A": PRINT : PRINT " MACHINE LANGUAGE PROGRAM IN MEMORY": PRINT : PRINT " INTO A BASIC SUBROUTINE AND STORE": PRINT : PRINT " IT AS A TEXT FILE."
160 PRINT : PRINT : PRINT : PRINT " THE FILE MAY THEN BE ADDED TO A": PRINT : PRINT " BASIC PROGRAM VIA THE 'EXEC' COMMAND.": POKE 49233,0
170 VTAB 23: HTAB 10: PRINT "PRESS <RETURN> FOR MORE";: GET YN$
180 HOME : VTAB 5: PRINT " ENTER THE STARTING ADDRESS OF THE": PRINT " MACHINE LANGUAGE PROGRAM. ": PRINT " PRECEDE HEX VALUES WITH A '$'": INPUT " <RETURN> ALONE ENDS PROGRAM: ";SA$: IF LEN(SA$) >5 THEN CALL BE: GOTO 180
190 IF LEN(SA$) = 0 THEN TEXT : HOME : END
200 IF LEFT$(SA$,1) = "$" THEN GOSUB 410: IF DE = -1 THEN 180
210 SA = DE: IF LEFT$(SA$,1) < >"$" THEN SA = VAL(SA$): IF SA <10 ^( LEN(SA$) -1) THEN CALL BE: GOTO 180
220 IF SA <0 OR SA >65535 THEN CALL BE: GOTO 180
230 VTAB 10: PRINT " ENTER THE LENGTH OF THE PROGRAM": INPUT " ('$' BEFORE HEX VALUES): ";LE$: IF LEN(LE$) = 0 OR LEN(LE$) >5 THEN VTAB 10: HTAB 1: CALL BE: CALL CS: GOTO 230
240 IF LEFT$(LE$,1) = "$" THEN SA$ = LE$: GOSUB 410: IF DE = -1 THEN VTAB 10: HTAB 1: CALL CS: GOTO 230
250 LE = DE -1: IF LEFT$(LE$,1) < >"$" THEN LE = VAL(LE$): IF LE <10 ^( LEN(LE$) -1) THEN CALL BE: VTAB 10: HTAB 1: CALL CS: GOTO 230
260 IF LE <1 OR LE >65535 THEN CALL BE: VTAB 10: HTAB 1: CALL CS: GOTO 230
270 VTAB 14: PRINT " ENTER THE STARTING LINE NUMBER ": INPUT " OF THE BASIC SUBROUTINE: ";LN$: IF LEN(LN$) = 0 OR LEN(LN$) >5 THEN CALL BE: VTAB 14: HTAB 1: CALL CS: GOTO 270
280 LN = VAL(LN$): IF LN <0 OR LN >63900 THEN CALL BE: VTAB 14: HTAB 1: CALL CS: GOTO 270
290 EF = 2: VTAB 18: PRINT " ENTER THE NAME OF THE SUBROUTINE ": INPUT " DISK FILE: ";NA$: IF LEN(NA$) = 0 THEN CALL BE: VTAB 18: HTAB 1: CALL CS: GOTO 290
300 IF ASC( LEFT$(NA$,1)) <65 THEN CALL BE: VTAB 18: HTAB 1: CALL CS: GOTO 290
310 IF ASC( LEFT$(NA$,1)) >154 THEN CALL BE: VTAB 18: HTAB 1: CALL CS: GOTO 290
320 PRINT D$"OPEN";NA$: PRINT D$"WRITE";NA$
330 LN$ = STR$(LN) +" FOR I = " + STR$(SA) +" TO " + STR$(SA +LE) +" : READ K : POKE I,K : NEXT : RETURN" + CHR$(13)
340 PRINT LN$: FOR I = SA TO SA +LE STEP 50:LN = LN +10:LN$ = STR$(LN) +" DATA ":DA$ = "":X = FRE(0)
350 FOR J = 0 TO 49: IF I +J >(SA +LE) THEN J = 50: GOTO 370
360 DA$ = DA$ + STR$( PEEK(I +J)): IF J <49 AND (I +J) <(SA +LE) THEN DA$ = DA$ +","
370 NEXT :LN$ = LN$ +DA$ + CHR$(13): PRINT LN$: NEXT : PRINT D$"CLOSE";NA$: VTAB 23: HTAB 10: PRINT "PRESS <RETURN> FOR MORE";: GET YN$: HOME
380 VTAB 5: PRINT " THE CODE HAS BEEN SAVED IN FILE ": PRINT : PRINT " ";NA$;" ."
390 VTAB 9: PRINT " TO MERGE THE CODE INTO A BASIC": PRINT : PRINT " PROGRAM : ": PRINT : PRINT TAB( 5);"(1) LOAD THE BASIC PROGRAM"
400 PRINT : PRINT TAB( 5);"(2) EXEC ";NA$: VTAB 23: HTAB 30: PRINT "(END)";: GET YN$: TEXT : HOME : END
410 REM *** HEX TO DECIMAL ***
420 A = LEN(SA$) +1:DE = 0:DA = 0
430 FOR I = 2 TO LEN(SA$):B = ASC( MID$ (SA$,I,1)): IF B <48 OR B >70 THEN DE = -1
440 IF B >57 AND B <65 THEN DE = -1
450 NEXT : IF DE = -1 THEN CALL BE: RETURN
460 FOR I = LEN(SA$) TO 1 STEP -1: FOR J = 1 TO LEN(HX$)
470 IF MID$ (SA$,A -I,1) = MID$ (HX$,J,1) THEN DA = (J -1) *16 ^(I -1):DE = DE +DA:DA = 0:J = J + LEN(HX$)
480 NEXT : NEXT : RETURN
490 E = PEEK(222):EL = PEEK(218) +256 * PEEK(219)
500 HOME : VTAB 12: PRINT "ERROR "E" IN LINE "EL"."
510 VTAB 22: HTAB 1: PRINT "PRESS <RETURN> TO CONTINUE";: GET Z$: PRINT