A subroutine that stores up to 277 characters of messages in memory above 55224 and prints any one of them back with a short machine-code routine (CALL 4656 to open the channel, then RST 16 for each character). Part 1 POKEs the routine to 55501; part 3 asks for each message and stores it with an end marker; part 2 prints messages 1 to z, one per key press, on the bottom line (POKE 55502,2 prints at the top instead). The text and code can then be saved with SAVE “mssg” CODE 55224,350.
Part 1 POKEs the routine, part 3 stores the text and part 2 recalls it. As printed, the loader stops one byte short (55533), so the routine’s final RET is never POKEd and recalling a message crashes the computer.
Published in Sinc-Link May-June 1991 (Entering and Recalling Text in Machine Code).
Source Code
Part 1: machine code loader
10 FOR x=55501 TO 55533
20 READ z: POKE x,z
30 NEXT x
40 DATA 62,0,205,48,18,225,70,35,229,33,183,215,126,35,254,128,56,250,16,248,126,35,254,128,200,215,24,248,201,205,205,216,1,201
Parts 2 and 3: recall and enter text
10 FOR x=1 TO z
20 POKE 55533,x
30 RANDOMIZE USR 55530
40 PAUSE 0
50 NEXT x
60 STOP
100 LET z=1: LET j=55224: LET a$=""
110 PRINT "Input text (limit 32 characters if you want to print text on the 24th line only). Press enter when finished with text."
120 PRINT
130 GO SUB 300
140 INPUT a$
150 IF LEN a$>=55500-j THEN PRINT AT 0,0;"Text too long. Input text.": CLS : LET j=j-LEN a$: LET z=z-1: GO TO 110
160 FOR i=1 TO LEN a$
170 POKE j,CODE a$(i)
180 IF j<55500 AND i=LEN a$ THEN POKE j+1,128
190 IF j<55500 AND i=LEN a$ THEN LET j=j+1
200 IF j<55500 THEN LET j=j+1
210 NEXT i
220 LET z=z+1
230 GO SUB 400
240 LET z=z-1
250 STOP
300 PRINT "TEXT #";z;" ";277-LEN a$;" characters remaining."
310 RETURN
400 PRINT
410 PRINT "More text? (y/n)"
420 PAUSE 0
430 IF INKEY$="y" OR INKEY$="Y" THEN CLS : GO TO 110
440 RETURN
Part 4: op codes
55501 LD A,0
55503 CALL 4656
55506 POP HL
55507 LD B,(HL)
55508 INC HL
55509 PUSH HL
55510 LD HL,55223
55513 LD A,(HL)
55514 INC HL
55515 CP 128
55517 JR C,55513
55519 DJNZ B,55513
55521 LD A,(HL)
55522 INC HL
55523 CP 128
55525 RET Z
55526 RST 16
55527 JR 55521
55529 RET
55530 CALL 55501
55533 01
55534 RETNote: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

