Program Organisation
This should be written with HEXLD3D (chapter11-hexld3d.p)
which has its machine code located between 4A82 and 4B77
(RAMTOP should be set to 4A00). As LENSLIST2 is basically
HEXLD3D+LENSLIST2 you could use that instead as it's
better for checking code and tracking down errors.
This should be written to a line 1 REM statement of size
151 characters, although I always add a few more just in
case a key press doesn't register properly.
I've placed a few spares bytes in the initial type check
so that you can JP to the bottom and add your own types
if you feel adventurous.
Program Listing
4082: 0000 ADDRESS DEFB 00 00
4084: 00 DUMPTYPE DEFB 00
4085: F5 HPRINT PUSH AF
E6F0 AND F0
1F RRA
1F RRA
1F RRA
1F RRA
C61C ADD A,1C
D7 RST 10
F1 POP AF
E60F AND 0F
C61C ADD A,1C
D7 RST 10
C9 RET
20 bytes.
4096: 2A8240 DUMP LD HL,(ADDRESS)
7C LD A,H
CD8540 CALL HPRINT
7D LD A,L
CD8540 CALL HPRINT
AF XOR A
D7 RST 10
3A8440 LD A,(DUMPTYPE)
FE00 CP 00
2814 JR Z,DUMPTYPE0
40AA: FE03 CP 03
281D JR Z,DUMPTYPE1
40AE: FEF5 CP F5
282F JR Z,DUMPTYPE2
40B2: FEF6 CP F6
2847 JR Z,DUMPTYPE3
40B6: 00 * 8 NOPS DEFB 00 * 8 Spare.
40 bytes.
40BE: 0608 DUMPTYPE0 LD B,08
7E DT0LOOP LD A,(HL)
CD8540 CALL HPRINT
AF XOR A
D7 RST 10
23 INC HL
10F7 DJNZ DT0LOOP
40C9: 180D JR END
13 bytes.
40CB: 0618 DUMPTYPE1 LD B,18
7E DT1LOOP LD A,(HL)
CB77 BIT 6,A
2802 JR Z,PRINTABLE
3E1B LD A,1B
D7 PRINTABLE RST 10
23 INC HL
10F5 DJNZ DT1LOOP
13 bytes.
40D8: 3E75 END LD A,75
3C INC A
D7 RST 10
228240 LD (ADDRESS),HL
18B5 JR DUMP
9 bytes.
40E1: 0606 DUMPTYPE2 LD B,06
C5 PUSH BC
E5 PUSH HL
7E DT2LOOP1 LD A,(HL)
CD8540 CALL HPRINT
AF XOR A
D7 RST 10
23 INC HL
10F7 DJNZ DT2LOOP1
E1 POP HL
C1 POP BC
40F0: 7E DT2LOOP2 LD A,(HL)
CB77 BIT 6,A
2802 JR Z,PRINTABLE
3E1B LD A,1B
D7 PRINTABLE RST 10
23 INC HL
10F5 DJNZ DT2LOOP2
40FB: 18DB JR END
28 bytes.
40FD: 0608 DUMPTYPE3 LD B,08
C5 PUSH BC
E5 PUSH HL
7E DT3LOOP1 LD A,(HL)
CD8540 CALL HPRINT
23 INC HL
10F9 DJNZ DT3LOOP1
AF XOR A
D7 RST 10
E1 POP HL
C1 POP BC
410C: 7E DT3LOOP2 LD A,(HL)
CB77 BIT 6,A
2802 JR Z,PRINTABLE
3E1B LD A,1B
D7 PRINTABLE RST 10
23 INC HL
10F5 DJNZ DT3LOOP2
4117: 18BF JR END
28 bytes.
Total 151 bytes.
The BASIC Part
Once you've finished entering the machine code above,
delete all the BASIC lines except the line 1 REM
statement and then add these lines:
10 CLS
20 PRINT "TYPE M/P/B/C AND AN ADDRESS E.G."
30 PRINT "M407D. Q QUITS, CONT CONTINUES."
40 INPUT A$
50 IF A$(1)="M" OR A$(1)="P" OR A$(1)="B"
OR A$(1)="C" THEN GOTO 70
60 STOP
70 POKE 16516,(CODE A$(1))-50
80 POKE 16515,16*CODE A$(2)+CODE A$(3)-476
90 POKE 16514,16*CODE A$(4)+CODE A$(5)-476
100 RAND USR 16534
Don't forget to manually type SAVE "DUMP" as there's
no fancy save option anymore.
Operating Instructions
Type RUN and follow the instructions within the program.
|