This month we’re listing an assembly for the 4K ROM’s LOAD routine, next page. LOAD begins in ROM location 0206H, or 518d. As usual, we’ve left the designers’ comments alone.
We initialized the system variable E-LINE (listed as E8LINE) at 400AH and subroutines ENDBYT and LS8, which occur between LOAD and SAVE (see May 81, pp. 5-6). Our computer won’t assemble LOAD until we define all subroutines outside LOAD, so remember that none of the EQU statements listed are actually in the ROM.
LOAD depends on what SAVE has done, so if you’ve modified SAVE for your own use, you may have to change memory addresses or timing. If you modify LOAD, you’ll also have to check SAVE.
To get the entire 4K ROM listing at once, see page 1.
ROM contents © Sinclair Research Ltd., 1980. Reprinted by permission. Both Sinclair and Syntax ZX80 Inc. own copyright interests in this material.
ANNOTATED 4K ROM LISTING–LOAD ROUTINE
0205 00100 ORG 0205H
0203 00110 LS8 EQU 0203H
4000 00115 Y EQU 4000H 400A 00120 E8LINE EQU 400AH 01F8 00130 ENDBYT EQU 01F8H
0205 00 00140 LOAD NOP ;READ TAPE WRITTEN BY SAVE
0206 D1 00150 POP DE
207 111257 00160 LL1 LD DE,22290 020A 3E7F 00170 LL2 LD A,7FH ;LOOK FOR LEAD-IN,THEN 020C DBFE 00180 IN A,(0FEH) ;READ EVERY 15.1 MSEC 020E 1F 00190 RRA ;IF 1'S, 21.5: IF 0'S, GET 0'S 020F 30F2 00200 JR NC,LS8 ;FOR 480 MSEC,TO NEWLINE IF
0211 17 00210 RLA ;BREAK PRESSED
0212 17 00220 RLA
0213 38F2 00230 JR C,LL1
0215 1B 00240 DEC DE
0216 7A 00250 LD A,D
0217 B3 00260 OR E
218 20F0 00270 JR NZ,LL2 021A FD340B 00280 INC (IY+E8LINE+1-Y) ;IN CASE IS 40H NOW 021D 210040 00290 LD HL,4000H ;NOW START READING DATA
0220 1E08 00300 LL27 LD E,8
0222 3E7F 00310 LL3 LD A,7FH
0224 DBFE 00320 IN A,(0FEH)
0226 1F 00330 RRA
0227 3024 00340 JR NC,LL7
229 17 00350 RLA 022A 17 00360 RLA 022B 30F5 00370 JR NC,LL3 ;READ EVERY 16 MSEC UNTIL '1' 022D 0E94 00380 LD C,148 022F 061A 00390 LL4 LD B,26 ;REQ 408 MSEC TRAILER AFTER TONE
0231 0D 00400 LL5 DEC C ;COUNT 15.4 MSEC IF 1, 15.2 IF 0
0232 DBFE 00410 IN A,(0FEH) ;NB C DECREMENTED AT
0234 17 00420 RLA ;LEAST 26 TIMES
0235 CB79 00430 BIT 7,C
0237 79 00440 LD A,C
238 38F5 00450 JR C,LL4 023A 10F5 00460 DJNZ LL5 ;AT END OF TRAILER, CLEAR CARRY 023C 2004 00470 JR NZ,LL6 ;IF > ABOUT 2.3 MSEC, IS A '1' 023E FE56 00480 CP 86
0240 30E0 00490 JR NC,LL3 ;IF < ABOUT 0.8 MSEC, IS NOISE
0242 3F 00500 LL6 CCF ;CARRY SET IF 0, CLEAR IF 1
0243 CB16 00510 RL (HL)
0245 1D 00520 DEC E
0246 20DA 00530 JR NZ,LL3 ;GO GET NEXT BIT
248 CDF801 00540 CALL ENDBYT ;AFTER 8 BITS 024B 18D3 00550 JR LL27 024D 15 00560 LL7 DEC D 024E F20000 00570 JP P,0 ;IF HAVE BEEN THROUGH ENDBYT
0251 FD350B 00580 DEC (IY+E8LINE+1-Y) ;ELSE RESTORE E8LINE
0254 18AD 00590 JR LS8