2012/2/24 9:42 ftest3dm.txt
END=8218
; BDOS TEST3 DUMP MEMORY
;
ORG $8100
FCALL=$8005
;
8100 2600 TOP:LD H,00
8102 E5 LOOP:PUSH HL
8103 1E3F LD E,3F;?
8105 0E02 LD C,02
8107 CD0580 CALL FCALL
810A 0E01 LD C,01
810C CD0580 CALL FCALL
810F FE1A CP 1A;^z?
8111 E1 POP HL
8112 C8 RET Z
8113 FE0D CP 0D;[enter]?
8115 CA3581 JP Z,NEXT
8118 CDD381 CALL HTOB1
811B DA8681 JP C,WHATDP
811E 07 RLCA
811F 07 RLCA
8120 07 RLCA
8121 07 RLCA
8122 67 LD H,A
8123 E5 PUSH HL
8124 0E01 LD C,01
8126 CD0580 CALL FCALL
8129 FE1A CP 1A;^z?
812B E1 POP HL
812C C8 RET Z
812D CDD381 CALL HTOB1
8130 DA8681 JP C,WHATDP
8133 B4 OR H
8134 67 LD H,A
8135 2E00 NEXT:LD L,00
; memory dump
8137 CD9D81 CALL CRLF
813A 0610 LD B,10;=16
813C CDEF81 LOOP1:CALL HEX4DP;address disp
813F E5 PUSH HL;for ascii dump
8140 0E08 LD C,08
8142 CDA781 LOOP2:CALL SPDP;space disp
8145 7E LD A,(HL)
8146 CD0082 CALL B2HEXDP;data disp
8149 23 INC HL
814A 0D DEC C
814B C24281 JP NZ,LOOP2
814E 3E2D LD A,2D;"-"
8150 CDA981 CALL ADP
8153 0E08 LD C,08
8155 7E LOOP3:LD A,(HL)
8156 CD0082 CALL B2HEXDP
8159 CDA781 CALL SPDP
815C 23 INC HL
815D 0D DEC C
815E C25581 JP NZ,LOOP3
;ascii dump
8161 E1 POP HL
8162 0E10 LD C,10;=16
8164 7E ASCII:LD A,(HL)
8165 FE20 CP 20
8167 DA6F81 JP C,ASCII1
816A FE80 CP 80
816C DA7181 JP C,ASCII2
816F 3E2E ASCII1:LD A,2E;"."
8171 CDA981 ASCII2:CALL ADP
8174 23 INC HL
8175 0D DEC C
8176 C26481 JP NZ,ASCII
;
8179 CD9D81 CALL CRLF
817C 05 DEC B
817D C23C81 JP NZ,LOOP1
8180 CD9D81 CALL CRLF
8183 C30281 JP LOOP
8186 CD9D81 WHATDP:CALL CRLF
8189 119781 LD DE,WHATT
818C 0E09 LD C,09
818E CD0580 CALL FCALL
8191 CD9D81 CALL CRLF
8194 C30081 JP TOP
8197 77686174 WHATT:"what"
819B 3F DB 3F;?
819C 24 DB 24;$
;
;CL & LF
819D 3E0D CRLF:LD A,0D
819F CDA981 CALL ADP
81A2 3E0A LD A,0A
81A4 C3A981 JP ADP
;space disp
81A7 3E20 SPDP:LD A,20
;A disp
81A9 C5 ADP:PUSH BC
81AA E5 PUSH HL
81AB 5F LD E,A
81AC 0E02 LD C,02
81AE CD0580 CALL FCALL
81B1 E1 POP HL
81B2 C1 POP BC
81B3 C9 RET
;binary to hex, 2bytes data to ascii 4charactors,HL to HL,DE
81B4 7C B2HEX4:LD A,H
81B5 CDBA81 CALL B2HEX2
81B8 EB EX DE,HL
81B9 7B LD A,E
;binary to hex, 1byte data to ascii 2charactors,A to DE
81BA F5 B2HEX2:PUSH AF
81BB 0F RRCA
81BC 0F RRCA
81BD 0F RRCA
81BE 0F RRCA
81BF CDC981 CALL B2HEX1
81C2 57 LD D,A
81C3 F1 POP AF
81C4 CDC981 CALL B2HEX1
81C7 5F LD E,A
81C8 C9 RET
;binary to hex, low 4bit to ascii 1charactor
81C9 E60F B2HEX1:AND 0F
81CB C630 ADD A,30
81CD FE3A CP 3A
81CF D8 RET C;0-9
81D0 C607 ADD A,07;A-F
81D2 C9 RET
;hex to binary, ascii 1charactor to low 4bit
81D3 FE30 HTOB1:CP 30;>="0"?
81D5 D8 RET C;no
81D6 FE3A CP 3A;<="9"?
81D8 DAEC81 JP C,HTOB1_2;yes,"0" to "9"
81DB FE41 CP 41;>="A" ?
81DD D8 RET C;no
81DE FE47 CP 47;<="F"?
81E0 DAEA81 JP C,HTOB1_1
81E3 FE61 CP 61;>="a"?
81E5 D8 RET C;no
81E6 FE67 CP 67;<="f"?
81E8 3F CCF
81E9 D8 RET C;no
81EA C609 HTOB1_1:ADD A,09;41 to 46 -> 4A to 4F,or 61 to 67 -> 6A to 6F
81EC E60F HTOB1_2:AND 0F
81EE C9 RET
;HL(bynary 2bytes) to asckii 4bytes & disp
81EF C5 HEX4DP:PUSH BC
81F0 E5 PUSH HL
81F1 CDB481 CALL B2HEX4;binary 2 bytes to ascii HEX 4bytes
81F4 D5 PUSH DE
81F5 EB EX DE,HL
81F6 CD0B82 CALL DEDP
81F9 D1 POP DE
81FA CD0B82 CALL DEDP
81FD E1 POP HL
81FE C1 POP BC
81FF C9 RET
;A(binary) to asckii 2bytes HEX & disp
8200 C5 B2HEXDP:PUSH BC
8201 E5 PUSH HL
8202 CDBA81 CALL B2HEX2
8205 CD0B82 CALL DEDP
8208 E1 POP HL
8209 C1 POP BC
820A C9 RET
;
;DE(asckii 2bytes) disp
820B D5 DEDP:PUSH DE
820C 5A LD E,D
820D 0E02 LD C,02
820F CD0580 CALL FCALL
8212 D1 POP DE
8213 0E02 LD C,02
8215 CD0580 CALL FCALL
8218 C9 RET
;
ADP =81A9 ASCII =8164 ASCII1 =816F
ASCII2 =8171 B2HEX1 =81C9 B2HEX2 =81BA
B2HEX4 =81B4 B2HEXDP =8200 CRLF =819D
DEDP =820B FCALL =8005 HEX4DP =81EF
HTOB1 =81D3 HTOB1_1 =81EA HTOB1_2 =81EC
LOOP =8102 LOOP1 =813C LOOP2 =8142
LOOP3 =8155 NEXT =8135 SPDP =81A7
TOP =8100 WHATDP =8186 WHATT =8197
|