SCREENER is a short utility program written in machine code and BASIC that will let you print an entire screen almost instantaneously. It allows you to compose and test screens in ordinary BASIC print statements (lines 100 to 121). Once you’re satisfied with your display, running lines 200 to 370 will place it up in the first REM statement, preceded by a 40-byte machine code PRINT SCREEN subroutine. You can then delete all the remaining lines and use this line in any BASIC program in which you need to rapidly print this particular display. This routine can be used to great advantage, even by those who know nothing about machine code programming.
To enter SCREENER you should first type in the loader routine shown in Listing 2. (Don’t forget the two semi-colons in line 50 — and be certain there are at least 40 characters after 1 REM). Proofread carefully and then run. You’ll be prompted to enter the first byte of the machine code for the PRINT SCREEN routine shown in Listing 3. Type in the 40 numbers, left to right, e.g. 33 ENTER, 33 ENTER, 117 ENTER, etcetera. If all 40 bytes have been accurately put in then the CHECKSUM will equal 4220. If not, you’ll have to run it and try again. Once you’ve successfully entered the code, you’ll see that it’s been moved into the first REM statement; delete lines 10 through 80 and save to tape.
This machine code subroutine has been written in such a way that it will rapidly and sequentially print any characters placed after it until it comes to E3h (STOP), and will begin a new line whenever it comes to 76h(=118). It can also be edited without “self-destructing”. (See Listing 4).
Bring down line 1 and move the cursor all the way to the end of the line. Now type in 23 Xs followed by eight rows of periods as shown in Listing 1 to make space for your text. (You’ll need to adjust the number of periods for longer screens; one line of periods will hold one full line of characters; shorter lines take correspondingly less.)
Finally, carefully type in and proofread BASIC lines 100 to 1000 shown in Listing 1 and save this tape as SCREENER.
To use this program simply carry out the following steps:
1. Load SCREENER.
2. Edit whatever text or graphics characters you want into lines 100 to 121, up to 32 characters per line. Line 100 goes to row 0; line 121 goes to row 21. (You’ll need to put quotation marks after the PRINT and at the end of the string of characters.)
3. Press RUN, ENTER to see what your screen will look like; make any changes or corrections needed.
4. Adjust the number of periods in line 1 so there is at least one for each character and space in each non-empty PRINT line. (Extra periods won’t hurt, but too few will result in a nasty crash!)
5. Use RUN 200 to compile your text.
6. You can now execute this machine code with RAND USR 16514 or LET L = USR 16514. If you do this in the SLOW mode you will appreciate how quickly this subroutine prints your display.
7. If you want to make further changes simply go back to Step 2.
8. Once you’re satisfied with your screen, delete all lines after 1 and save to tape for use in future programs.
If you list line 1 you’ll see that all the characters after the first newline byte (76h) are misinterpreted. This makes the listing look strange but doesn’t interfere with execution. You will have trouble listing and working on subsequent lines after listing line 1, but RUN 999 will fix this. SCREENER generated subroutines work in either the FAST or SLOW mode.
This program can be used to produce a full screen, but you’ll need to remember to add additional periods to the first line. The screens you create with SCREENER can be used in any BASIC program you write which needs an “instant” full screen display. I find these especially useful for games and in data display routines. I would appreciate hearing about any interesting applications you might develop.
Listing 1. SCREENER
1 REM 55?8▒▒RND GOSUB ?£RND<S
TR$ ▒ RETURN STOP 4▒SGN TAN ▒4£S
GN FAST A FOR ; FOR LPRINT STR$
▒/ REM >▒</ FAST XXXXXXXXXXXXXX
XXXXXXXXX.......................
................................
................................
................................
................................
................................
................................
................................
.........
100 PRINT
101 PRINT
102 PRINT
103 PRINT
104 PRINT
105 PRINT
106 PRINT
107 PRINT
108 PRINT
109 PRINT
110 PRINT
111 PRINT
112 PRINT
113 PRINT
114 PRINT
115 PRINT
116 PRINT
117 PRINT
118 PRINT
119 PRINT
120 PRINT
121 PRINT
122 STOP
200 FAST
210 LET P=16554
220 LET D=P
230 LET P=P+1
240 IF NOT (PEEK P=118 AND PEEK (P+5)=245) THEN GOTO 230
250 LET P=P+5
260 IF PEEK P<>245 THEN GOTO 370
270 LET P=P+1
280 IF PEEK P=118 THEN GOTO 340
290 LET P=P+1
300 IF PEEK P=11 THEN GOTO 270
310 POKE D,PEEK P
320 LET D=D+1
330 GOTO 290
340 POKE D,PEEK P
350 LET D=D+1
360 GOTO 250
370 POKE D,227
999 POKE 16419,100
1000 LIST 100
Listing 2. LOADER
1 REM .......................
.........34567890
10 LET S=0
20 FOR I=0 TO 39
30 INPUT X
40 POKE 16514+I,X
50 PRINT TAB 4*I;X;
60 LET S=S+X
70 NEXT I
80 PRINT ,,,"CHECKSUM= ";S
Listing 3. Code for PRINT SCREEN
33 33 117 36 1 170 64 237
91 12 64 19 213 10 254 227
32 2 209 201 188 32 12 209
229 38 0 235 25 235 225 213
3 24 234 18 3 19 24 229
CHECKSUM= 4220
Listing 4. Disassembly of PRINT SCREEN Routine.
ADDR HEXCODE LABEL MNEMONIC
--------------------------------
4082 212175 BEGN LD HL,7521
4085 24 INC H
4086 01AA40 LD BC,40AA
4089 ED5B0C40 LD DE,(DFILE)
408D 13 INC DE
408E D5 PUSH DE
408F 0A END? LD A,(BC)
4090 FEE3 CP E3
4092 2002 JR NZ,NEWL
4094 D1 POP DE
4095 C9 RET
4096 BC NEWL CP H
4097 200C JR NZ,PRNT
4099 D1 POP DE
409A E5 PUSH HL
409B 2600 LD H,00
409D EB EX DE,HL
409E 19 ADD HL,DE
409F EB EX DE,HL
40A0 E1 POP HL
40A1 D5 PUSH DE
40A2 03 INC BC
40A3 18EA JR END?
40A5 12 PRNT LD(DE),A
40A6 03 INC BC
40A7 13 INC DE
40A8 18E5 JR END?
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.