From 9bed91b315cf7a768074ab3eb525594bb3649447 Mon Sep 17 00:00:00 2001 From: Leo C Date: Tue, 9 Aug 2016 22:30:45 +0200 Subject: [PATCH] Move most data sections to program end. --- ddt180.z80 | 1037 ++++++++++++++++++++++++++-------------------------- 1 file changed, 522 insertions(+), 515 deletions(-) diff --git a/ddt180.z80 b/ddt180.z80 index 623c553..ec59e03 100644 --- a/ddt180.z80 +++ b/ddt180.z80 @@ -90,39 +90,39 @@ current_cseg defl $ stack: -reg.l2: db 000h ;0046 00 . -reg.h2: db 000h ;0047 00 . -reg.e2: db 000h ;0048 00 . -reg.d2: db 000h ;0049 00 . -reg.c2: db 000h ;004a 00 . -reg.b2: db 000h ;004b 00 . -reg.f2: db 000h ;004c 00 . -reg.a2: db 000h ;004d 00 . -l004eh: db 000h ;004e 00 . -reg.i: db 000h ;004f 00 . -reg.iy: dw 0000h ;0050 00 . -reg.ix: dw 0000h ;0052 00 . -reg.f: db 000h ;0054 00 . -reg.a: db 000h ;0055 00 . -reg.c: db 000h ;0056 00 . -reg.b: db 000h ;0057 00 . -reg.e: db 000h ;0058 00 . -reg.d: db 000h ;0059 00 . -reg.l: db 000h ;005a 00 . -reg.h: db 000h ;005b 00 . -reg_sp: dw TPA ;005c 00 01 . +reg.l2: db 000h +reg.h2: db 000h +reg.e2: db 000h +reg.d2: db 000h +reg.c2: db 000h +reg.b2: db 000h +reg.f2: db 000h +reg.a2: db 000h +l004eh: db 000h +reg.i: db 000h +reg.iy: dw 0000h +reg.ix: dw 0000h +reg.f: db 000h +reg.a: db 000h +reg.c: db 000h +reg.b: db 000h +reg.e: db 000h +reg.d: db 000h +reg.l: db 000h +reg.h: db 000h +reg_sp: dw TPA reg.iff: - db 0f3h ;005e f3 . - db 0c3h ;005f c3 . -REG.PC: dw TPA ;0060 00 01 . -l0062h: dw 0000h ;0062 00 00 . -offs.@: dw 0 ;0064 00 00 . + db 0f3h + db 0c3h +REG.PC: dw TPA +l0062h: dw 0000h +offs.@: dw 0 -CMD_ERR:dw l0146h ;0066 46 01 F . -cmd_rpt:dw mainloop ;0068 bd 00 . . +CMD_ERR:dw l0146h +cmd_rpt:dw mainloop conbuf: - db CONBUF_SIZE ;006a 50 P + db CONBUF_SIZE ld sp,stack ;006b 31 46 00 1 F . exx ;006e d9 . @@ -202,33 +202,33 @@ exe_hl: jr mainloop ;010d 18 ae . . CMDTAB: - defw cmd_@ ;0110 92 0d . . - defw cmd_A ;0112 fe 11 . . - defw cmd_B ;0114 6d 07 m . - defw cmd_C ;0116 17 21 . ! - defw cmd_D ;0118 48 0f H . - defw ERROR ;011a 07 01 . . - defw cmd_F ;011c af 0f . . - defw cmd_G ;011e 31 07 1 . - defw cmd_H ;0120 3d 0e = . - defw cmd_I ;0122 a3 0d . . - defw ERROR ;0124 07 01 . . - defw ERROR ;0126 07 01 . . - defw cmd_L ;0128 cd 18 . . - defw cmd_M ;012a 19 0e . . - defw ERROR ;012c 07 01 . . - defw cmd_O ;012e c7 0d . . - defw ERROR ;0130 07 01 . . - defw cmd_Q ;0132 84 0e . . - defw cmd_R ;0134 62 10 b . - defw cmd_S ;0136 5a 0d Z . - defw cmd_T ;0138 1e 21 . ! - defw ERROR ;013a 07 01 . . - defw cmd_V ;013c ea 0d . . - defw cmd_W ;013e a0 11 . . - defw cmd_X ;0140 f1 0b . . - defw cmd_Y ;0142 b2 0b . . - defw cmd_Z ;0144 ba 0e . . + dw cmd_@ ;0110 92 0d . . + dw cmd_A ;0112 fe 11 . . + dw cmd_B ;0114 6d 07 m . + dw cmd_C ;0116 17 21 . ! + dw cmd_D ;0118 48 0f H . + dw ERROR ;011a 07 01 . . + dw cmd_F ;011c af 0f . . + dw cmd_G ;011e 31 07 1 . + dw cmd_H ;0120 3d 0e = . + dw cmd_I ;0122 a3 0d . . + dw ERROR ;0124 07 01 . . + dw ERROR ;0126 07 01 . . + dw cmd_L ;0128 cd 18 . . + dw cmd_M ;012a 19 0e . . + dw ERROR ;012c 07 01 . . + dw cmd_O ;012e c7 0d . . + dw ERROR ;0130 07 01 . . + dw cmd_Q ;0132 84 0e . . + dw cmd_R ;0134 62 10 b . + dw cmd_S ;0136 5a 0d Z . + dw cmd_T ;0138 1e 21 . ! + dw ERROR ;013a 07 01 . . + dw cmd_V ;013c ea 0d . . + dw cmd_W ;013e a0 11 . . + dw cmd_X ;0140 f1 0b . . + dw cmd_Y ;0142 b2 0b . . + dw cmd_Z ;0144 ba 0e . . l0146h: ld a,'?' ;0146 3e 3f > ? @@ -445,8 +445,7 @@ outchar: pop de ;026f d1 . pop hl ;0270 e1 . ret ;0271 c9 . -con_col: - db 0 ;0272 00 . + inchar: push hl ;0273 e5 . push de ;0274 d5 . @@ -806,12 +805,12 @@ tab_eq_le_ge: db '=<>',0 tab_func_eqlege: - defw do_op_eq ;0423 da 03 . . - defw do_op_lt ;0425 e4 03 . . - defw do_op_gt ;0427 e8 03 . . - defw do_op_le ;0429 e2 03 . . - defw do_op_ge ;042b ea 03 . . - defw do_op_ne ;042d de 03 . . + dw do_op_eq ;0423 da 03 . . + dw do_op_lt ;0425 e4 03 . . + dw do_op_gt ;0427 e8 03 . . + dw do_op_le ;0429 e2 03 . . + dw do_op_ge ;042b ea 03 . . + dw do_op_ne ;042d de 03 . . do_subexpr: call do_factor ;042f cd e4 04 . . . @@ -966,15 +965,15 @@ tab_op_a: DB '+-*/%&!#',0 tblf_opa: - defw doop_add ;04cb 4c 04 L . - defw doop_sub ;04cd 50 04 P . - defw doop_mlt ;04cf 55 04 U . - defw doop_div ;04d1 6a 04 j . - defw doop_mod ;04d3 6f 04 o . - defw doop_and ;04d5 96 04 . . - defw doop_or ;04d7 9e 04 . . - defw doop_xor ;04d9 a6 04 . . - defw 0 ;04db 00 00 . . + dw doop_add ;04cb 4c 04 L . + dw doop_sub ;04cd 50 04 P . + dw doop_mlt ;04cf 55 04 U . + dw doop_div ;04d1 6a 04 j . + dw doop_mod ;04d3 6f 04 o . + dw doop_and ;04d5 96 04 . . + dw doop_or ;04d7 9e 04 . . + dw doop_xor ;04d9 a6 04 . . + dw 0 ;04db 00 00 . . fact_factor: call do_factor ;04dd cd e4 04 . . . @@ -1351,33 +1350,33 @@ b_06e9_start: DB 0 b_0709_start: - defw reg.a ;0709 55 00 U . - defb 000h ;070b 00 . - defw reg.c ;070c 56 00 V . - defb 001h ;070e 01 . - defw reg.e ;070f 58 00 X . - defb 001h ;0711 01 . - defw reg.l ;0712 5a 00 Z . - defb 001h ;0714 01 . - defw reg_sp ;0715 5c 00 \ . - defb 001h ;0717 01 . - defw REG.PC ;0718 60 00 ` . - defb 002h ;071a 02 . - defw reg.a2 ;071b 4d 00 M . - defb 000h ;071d 00 . - defw reg.c2 ;071e 4a 00 J . - defb 001h ;0720 01 . - defw reg.e2 ;0721 48 00 H . - defb 001h ;0723 01 . - defw reg.l2 ;0724 46 00 F . - defb 001h ;0726 01 . - defw reg.ix ;0727 52 00 R . - defb 001h ;0729 01 . - defw reg.iy ;072a 50 00 P . - defb 001h ;072c 01 . - defw reg.i ;072d 4f 00 O . - defb 000h ;072f 00 . - defb 000h ;0730 00 . + dw reg.a ;0709 55 00 U . + db 000h ;070b 00 . + dw reg.c ;070c 56 00 V . + db 001h ;070e 01 . + dw reg.e ;070f 58 00 X . + db 001h ;0711 01 . + dw reg.l ;0712 5a 00 Z . + db 001h ;0714 01 . + dw reg_sp ;0715 5c 00 \ . + db 001h ;0717 01 . + dw REG.PC ;0718 60 00 ` . + db 002h ;071a 02 . + dw reg.a2 ;071b 4d 00 M . + db 000h ;071d 00 . + dw reg.c2 ;071e 4a 00 J . + db 001h ;0720 01 . + dw reg.e2 ;0721 48 00 H . + db 001h ;0723 01 . + dw reg.l2 ;0724 46 00 F . + db 001h ;0726 01 . + dw reg.ix ;0727 52 00 R . + db 001h ;0729 01 . + dw reg.iy ;072a 50 00 P . + db 001h ;072c 01 . + dw reg.i ;072d 4f 00 O . + db 000h ;072f 00 . + db 000h ;0730 00 . cmd_G: sub a ;0731 97 . @@ -1664,9 +1663,6 @@ l0938h: ex af,af' ;093f 08 . ret ;0940 c9 . -l0941h: - db 0 ;0941 00 . - sub_0942h: ex af,af' ;0942 08 . res 7,a ;0943 cb bf . . @@ -1872,110 +1868,6 @@ l0ab0h: ld (iy+007h),d ;0ab4 fd 72 07 . r . ret ;0ab7 c9 . -bp_tab: - rept BP_CNT - rept BP_SIZE - db 0 - endm - endm - -expr_p1: - defw expr_buf ;0b18 1c 0b . . -expr_p2: - defw expr_buf ;0b1a 1c 0b . . - -expr_buf: -current_cseg defl $ - current_cseg - .phase current_phase + current_cseg - -start: - LD SP,ldr_end+(stack-ddtz_base) - LD DE,signon ;ldr_end+(expr_buf-ddtz_base) - LD C,BDOS_PSTR - CALL BDOS - - xor a - dec a - jp po,reloc - ld de,msgz80 - LD C,BDOS_PSTR - CALL BDOS - jp 0 - -reloc: - LD HL,ldr_end+ddtz_size ;start of reloc bitmap - ld bc,0108h ;init bit counter - - EXX - LD HL,(BDOS+1) - LD (ldr_end+1),HL - LD BC,ddtz_size-1 - LD D,B - LD E,0FFH - INC DE ;size rounded up to next page boundary - INC BC ;ddtz_size - OR A - SBC HL,DE ;BDOS - size - LD (BDOS+1),HL ;-> new BDOS entry - - push hl - PUSH BC - ld de,ldr_end - sbc hl,de - EX DE,HL ;-> DE - LD HL,ldr_size - add hl,bc - ld b,h - ld c,l - LD HL,TPA -reloc_lp: - EXX - djnz reloc_nl - ld b,c ;reload bit counter - LD e,(HL) ;get next 8 relocation bits - INC HL -reloc_nl: - sla e - EXX - JR NC,reloc_next - DEC HL - LD A,(HL) - ADD A,E - LD (HL),A - INC HL - LD A,(HL) - ADC A,D - LD (HL),A -reloc_next: - cpi - jp pe,reloc_lp - dec hl - - POP BC - pop de - EX DE,HL - ADD HL,BC - EX DE,HL - DEC DE - LDDR - LD HL,conbuf+2-ddtz_base - ADD HL,DE - JP (HL) - -current_phase defl $ - .dephase -current_cseg defl $ - - ds EXPR_BUF_SIZE - ($ - expr_buf) -expr_bufe: - -msg_Y: - dc 'Yn' ;0b9c 59 ee Y n. -reg_Y: - rept YREG_CNT - dw 0 - endm - cmd_Y: call get.decdigit ;0bb2 cd 1d 06 . . . jr c,l0bc3h ;0bb5 38 0c 8 . @@ -2178,70 +2070,70 @@ b_0cc3_start: DB 0 b_0cfa_start: - defb 003h ;0cfa 03 . - defw reg.c2 ;0cfb 4a 00 J . - defb 003h ;0cfd 03 . - defw reg.e2 ;0cfe 48 00 H . - defb 003h ;0d00 03 . - defw reg.l2 ;0d01 46 00 F . - defb 003h ;0d03 03 . - defw reg.c ;0d04 56 00 V . - defb 003h ;0d06 03 . - defw reg.e ;0d07 58 00 X . - defb 003h ;0d09 03 . - defw reg.l ;0d0a 5a 00 Z . - defb 000h ;0d0c 00 . - defw reg.a2 ;0d0d 4d 00 M . - defb 000h ;0d0f 00 . - defw reg.b2 ;0d10 4b 00 K . - defb 000h ;0d12 00 . - defw reg.c2 ;0d13 4a 00 J . - defb 000h ;0d15 00 . - defw reg.d2 ;0d16 49 00 I . - defb 000h ;0d18 00 . - defw reg.e2 ;0d19 48 00 H . - defb 000h ;0d1b 00 . - defw reg.h2 ;0d1c 47 00 G . - defb 000h ;0d1e 00 . - defw reg.l2 ;0d1f 46 00 F . - defb 000h ;0d21 00 . - defw reg.a ;0d22 55 00 U . - defb 000h ;0d24 00 . - defw reg.b ;0d25 57 00 W . - defb 000h ;0d27 00 . - defw reg.c ;0d28 56 00 V . - defb 000h ;0d2a 00 . - defw reg.d ;0d2b 59 00 Y . - defb 000h ;0d2d 00 . - defw reg.e ;0d2e 58 00 X . - defb 000h ;0d30 00 . - defw reg.h ;0d31 5b 00 [ . - defb 000h ;0d33 00 . - defw reg.l ;0d34 5a 00 Z . - defb 003h ;0d36 03 . - defw reg.ix ;0d37 52 00 R . - defb 003h ;0d39 03 . - defw reg.iy ;0d3a 50 00 P . - defb 003h ;0d3c 03 . - defw reg_sp ;0d3d 5c 00 \ . - defb 003h ;0d3f 03 . - defw REG.PC ;0d40 60 00 ` . - defb 003h ;0d42 03 . - defw reg.ix ;0d43 52 00 R . - defb 003h ;0d45 03 . - defw reg.iy ;0d46 50 00 P . - defb 003h ;0d48 03 . - defw reg_sp ;0d49 5c 00 \ . - defb 003h ;0d4b 03 . - defw REG.PC ;0d4c 60 00 ` . - defb 000h ;0d4e 00 . - defw reg.i ;0d4f 4f 00 O . - defb 003h ;0d51 03 . - defw l004eh ;0d52 4e 00 N . - defb 000h ;0d54 00 . - defw reg.f2 ;0d55 4c 00 L . - defb 000h ;0d57 00 . - defw reg.f ;0d58 54 00 T . + db 003h ;0cfa 03 . + dw reg.c2 ;0cfb 4a 00 J . + db 003h ;0cfd 03 . + dw reg.e2 ;0cfe 48 00 H . + db 003h ;0d00 03 . + dw reg.l2 ;0d01 46 00 F . + db 003h ;0d03 03 . + dw reg.c ;0d04 56 00 V . + db 003h ;0d06 03 . + dw reg.e ;0d07 58 00 X . + db 003h ;0d09 03 . + dw reg.l ;0d0a 5a 00 Z . + db 000h ;0d0c 00 . + dw reg.a2 ;0d0d 4d 00 M . + db 000h ;0d0f 00 . + dw reg.b2 ;0d10 4b 00 K . + db 000h ;0d12 00 . + dw reg.c2 ;0d13 4a 00 J . + db 000h ;0d15 00 . + dw reg.d2 ;0d16 49 00 I . + db 000h ;0d18 00 . + dw reg.e2 ;0d19 48 00 H . + db 000h ;0d1b 00 . + dw reg.h2 ;0d1c 47 00 G . + db 000h ;0d1e 00 . + dw reg.l2 ;0d1f 46 00 F . + db 000h ;0d21 00 . + dw reg.a ;0d22 55 00 U . + db 000h ;0d24 00 . + dw reg.b ;0d25 57 00 W . + db 000h ;0d27 00 . + dw reg.c ;0d28 56 00 V . + db 000h ;0d2a 00 . + dw reg.d ;0d2b 59 00 Y . + db 000h ;0d2d 00 . + dw reg.e ;0d2e 58 00 X . + db 000h ;0d30 00 . + dw reg.h ;0d31 5b 00 [ . + db 000h ;0d33 00 . + dw reg.l ;0d34 5a 00 Z . + db 003h ;0d36 03 . + dw reg.ix ;0d37 52 00 R . + db 003h ;0d39 03 . + dw reg.iy ;0d3a 50 00 P . + db 003h ;0d3c 03 . + dw reg_sp ;0d3d 5c 00 \ . + db 003h ;0d3f 03 . + dw REG.PC ;0d40 60 00 ` . + db 003h ;0d42 03 . + dw reg.ix ;0d43 52 00 R . + db 003h ;0d45 03 . + dw reg.iy ;0d46 50 00 P . + db 003h ;0d48 03 . + dw reg_sp ;0d49 5c 00 \ . + db 003h ;0d4b 03 . + dw REG.PC ;0d4c 60 00 ` . + db 000h ;0d4e 00 . + dw reg.i ;0d4f 4f 00 O . + db 003h ;0d51 03 . + dw l004eh ;0d52 4e 00 N . + db 000h ;0d54 00 . + dw reg.f2 ;0d55 4c 00 L . + db 000h ;0d57 00 . + dw reg.f ;0d58 54 00 T . cmd_S: ld hl,(last_S) ;0d5a 2a 90 0d * . . @@ -2273,8 +2165,6 @@ l0d8ah: call sub_0ef8h ;0d8b cd f8 0e . . . jr l0d60h ;0d8e 18 d0 . . -last_S: - defw TPA ;0d90 00 01 . . cmd_@: call assert_eol ;0d92 cd d6 02 . . . ld hl,msg_offset ;0d95 21 a0 0d ! . . @@ -2285,8 +2175,6 @@ cmd_@: msg_offset: dc '@' ;0da0 c0 . -last_I: - defw 0 ;0da1 00 00 . . cmd_I: ld hl,cmd_I ;0da3 21 a3 0d ! . . ld (cmd_rpt),hl ;0da6 22 68 00 " h . @@ -2303,10 +2191,6 @@ cmd_I: call out.bin.b ;0dbe cd c7 01 . . . jp crlf ;0dc1 c3 a3 02 . . . -last_O_addr: - dw 0 ;0dc4 00 . -last_O_val: - db 0 ;0dc6 00 . cmd_O: ld hl,cmd_O ;0dc7 21 c7 0d ! . . ld (cmd_rpt),hl ;0dca 22 68 00 " h . @@ -2419,9 +2303,6 @@ l0e5eh: call out.ascii ;0e7d cd 34 02 . 4 . jp crlf ;0e80 c3 a3 02 . . . -cmd_Q_jopt: - db -1 ;0e83 ff . - cmd_Q: ld a,(de) ;0e84 1a . sub 'J' ;0e85 d6 4a . J @@ -2483,9 +2364,6 @@ l0ed3h: pop hl ;0ed3 e1 . ret ;0ed4 c9 . -last_D: - dw TPA - sub_0ed7h: push hl ;0ed7 e5 d5 . . push de @@ -2897,9 +2775,6 @@ l1111h: cp 01ah ;111d fe 1a . . ret ;111f c9 . -cmdR_rindex: - db 0 ;1120 00 . - read_sector: push hl ;1121 e5 . push de ;1122 d5 . @@ -2967,11 +2842,6 @@ msg_high: msg_max: DC ' Max = ' -high_load: - defw TPA ;119c 00 01 . . -max_load: - defw TPA ;119e 00 01 . . - cmd_W: call get_arg_range ;11a0 cd 7d 03 . } . call assert_eol ;11a3 cd d6 02 . . . @@ -3082,13 +2952,6 @@ l1259h: ld sp,(l1262h) ;125c ed 7b 62 12 . { b . jr l1211h ;1260 18 af . . -l1262h: - dw 0 ;1262 00 00 . -last_A: - dw TPA ;1264 00 01 . -cmd_A_prev: - dw TPA ;1266 00 01 . . - sub_1268h: call skipbl ;1268 cd bf 02 . . . ld hl,t_MNEMONICS ;126b 21 c6 1e ! . . @@ -3113,161 +2976,161 @@ CALL_HL: jp (hl) ;1288 e9 . b_1289_start: - defw as.ADC_SBC ;ADC 1289 51 15 Q . - defb 088h ; 128b 88 . - defw as.ADD ;ADD 128c 71 15 q . - defb 080h ; 128e 80 . - defw as.AND_CP_OR_SUB_XOR ;AND 128f a8 15 . . - defb 0a0h ; 1291 a0 . - defw as.BITOP ;BIT 1292 09 16 . . - defb 040h ; 1294 40 @ - defw as.CALL ;CALL 1295 2d 16 - . - defb 0c4h ; 1297 c4 . - defw as.opc.noarg ;CCF 1298 3b 15 ; . - defb 03fh ; 129a 3f ? - defw as.AND_CP_OR_SUB_XOR ;CP 129b a8 15 . . - defb 0b8h ; 129d b8 . - defw gen.opc.ED2 ;CPD 129e 44 15 D . - defb 0a9h ; 12a0 a9 . - defw gen.opc.ED2 ;CPDR 12a1 44 15 D . - defb 0b9h ; 12a3 b9 . - defw gen.opc.ED2 ;CPI 12a4 44 15 D . - defb 0a1h ; 12a6 a1 . - defw gen.opc.ED2 ;CPIR 12a7 44 15 D . - defb 0b1h ; 12a9 b1 . - defw as.opc.noarg ;CPL 12aa 3b 15 ; . - defb 02fh ; 12ac 2f / - defw as.opc.noarg ;DAA 12ad 3b 15 ; . - defb 027h ; 12af 27 ' - defw as.DEC_INC ;DEC 12b0 98 17 . . - defb 005h ; 12b2 05 . - defw as.opc.noarg ;DI 12b3 3b 15 ; . - defb 0f3h ; 12b5 f3 . - defw as.DJNZ ;DJNZ 12b6 99 16 . . - defb 010h ; 12b8 10 . - defw as.opc.noarg ;EI 12b9 3b 15 ; . - defb 0fbh ; 12bb fb . - defw as.EX ;EX 12bc 49 17 I . - defb 0e3h ; 12be e3 . - defw as.opc.noarg ;EXX 12bf 3b 15 ; . - defb 0d9h ; 12c1 d9 . - defw as.opc.noarg ;HALT 12c2 3b 15 ; . - defb 076h ; 12c4 76 v - defw as.IM ;IM 12c5 b4 16 . . - defb 046h ; 12c7 46 F - defw as.IN ;IN 12c8 ed 16 . . - defb 040h ; 12ca 40 @ - defw as.DEC_INC ;INC 12cb 98 17 . . - defb 004h ; 12cd 04 . - defw gen.opc.ED2 ;IND 12ce 44 15 D . - defb 0aah ; 12d0 aa . - defw gen.opc.ED2 ;INDR 12d1 44 15 D . - defb 0bah ; 12d3 ba . - defw gen.opc.ED2 ;INI 12d4 44 15 D . - defb 0a2h ; 12d6 a2 . - defw gen.opc.ED2 ;INIR 12d7 44 15 D . - defb 0b2h ; 12d9 b2 . - defw as.JP ;JP 12da 53 16 S . - defb 0c2h ; 12dc c2 . - defw as.JR ;JR 12dd a0 16 . . - defb 020h ; 12df 20 - defw as.LD ;LD 12e0 52 13 R . - defb 040h ; 12e2 40 @ - defw gen.opc.ED2 ;LDD 12e3 44 15 D . - defb 0a8h ; 12e5 a8 . - defw gen.opc.ED2 ;LDDR 12e6 44 15 D . - defb 0b8h ; 12e8 b8 . - defw gen.opc.ED2 ;LDI 12e9 44 15 D . - defb 0a0h ; 12eb a0 . - defw gen.opc.ED2 ;LDIR 12ec 44 15 D . - defb 0b0h ; 12ee b0 . - defw gen.opc.ED2 ;NEG 12ef 44 15 D . - defb 044h ; 12f1 44 D - defw as.opc.noarg ;NOP 12f2 3b 15 ; . - defb 000h ; 12f4 00 . - defw as.AND_CP_OR_SUB_XOR ;OR 12f5 a8 15 . . - defb 0b0h ; 12f7 b0 . - defw gen.opc.ED2 ;OTDR 12f8 44 15 D . - defb 0bbh ; 12fa bb . - defw gen.opc.ED2 ;OTIR 12fb 44 15 D . - defb 0b3h ; 12fd b3 . - defw as.OUT ;OUT 12fe 21 17 ! . - defb 041h ; 1300 41 A - defw gen.opc.ED2 ;OUTD 1301 44 15 D . - defb 0abh ; 1303 ab . - defw gen.opc.ED2 ;OUTI 1304 44 15 D . - defb 0a3h ; 1306 a3 . - defw as.POP_PUSH ;POP 1307 d9 16 . . - defb 0c1h ; 1309 c1 . - defw as.POP_PUSH ;PUSH 130a d9 16 . . - defb 0c5h ; 130c c5 . - defw as.BITOP ;RES 130d 09 16 . . - defb 080h ; 130f 80 . - defw as.RET ;RET 1310 45 16 E . - defb 0c0h ; 1312 c0 . - defw gen.opc.ED2 ;RETI 1313 44 15 D . - defb 04dh ; 1315 4d M - defw gen.opc.ED2 ;RETN 1316 44 15 D . - defb 045h ; 1318 45 E - defw as.SHIFTOP ;RL 1319 d5 15 . . - defb 010h ; 131b 10 . - defw as.opc.noarg ;RLA 131c 3b 15 ; . - defb 017h ; 131e 17 . - defw as.SHIFTOP ;RLC 131f d5 15 . . - defb 000h ; 1321 00 . - defw as.opc.noarg ;RLCA 1322 3b 15 ; . - defb 007h ; 1324 07 . - defw gen.opc.ED2 ;RLD 1325 44 15 D . - defb 06fh ; 1327 6f o - defw as.SHIFTOP ;RR 1328 d5 15 . . - defb 018h ; 132a 18 . - defw as.opc.noarg ;RRA 132b 3b 15 ; . - defb 01fh ; 132d 1f . - defw as.SHIFTOP ;RRC 132e d5 15 . . - defb 008h ; 1330 08 . - defw as.opc.noarg ;RRCA 1331 3b 15 ; . - defb 00fh ; 1333 0f . - defw gen.opc.ED2 ;RRD 1334 44 15 D . - defb 067h ; 1336 67 g - defw as.RST ;RST 1337 ca 16 . . - defb 0c7h ; 1339 c7 . - defw as.ADC_SBC ;SBC 133a 51 15 Q . - defb 098h ; 133c 98 . - defw as.opc.noarg ;SCF 133d 3b 15 ; . - defb 037h ; 133f 37 7 - defw as.BITOP ;SET 1340 09 16 . . - defb 0c0h ; 1342 c0 . - defw as.SHIFTOP ;SLA 1343 d5 15 . . - defb 020h ; 1345 20 - defw as.SHIFTOP ;SRA 1346 d5 15 . . - defb 028h ; 1348 28 ( - defw as.SHIFTOP ;SRL 1349 d5 15 . . - defb 038h ; 134b 38 8 - defw as.AND_CP_OR_SUB_XOR ;SUB 134c a8 15 . . - defb 090h ; 134e 90 . - defw as.AND_CP_OR_SUB_XOR ;XOR 134f a8 15 . . - defb 0a8h ; 1351 a8 . - - defw as.IN0 ;IN0 - defb 000h ; - defw as.MLT ;MLT - defb 04ch ; - defw gen.opc.ED2 ;OTDM - defb 08bh ; - defw gen.opc.ED2 ;OTDMR - defb 09bh ; - defw gen.opc.ED2 ;OTIM - defb 083h ; - defw gen.opc.ED2 ;OTIMR - defb 093h ; - defw as.OUTO ;OUT0 - defb 001h ; - defw gen.opc.ED2 ;SLP - defb 076h ; - defw as.TST ;TST - defb 004h ; - defw as.TSTIO ;TSTIO - defb 074h ; + dw as.ADC_SBC ;ADC 1289 51 15 Q . + db 088h ; 128b 88 . + dw as.ADD ;ADD 128c 71 15 q . + db 080h ; 128e 80 . + dw as.AND_CP_OR_SUB_XOR ;AND 128f a8 15 . . + db 0a0h ; 1291 a0 . + dw as.BITOP ;BIT 1292 09 16 . . + db 040h ; 1294 40 @ + dw as.CALL ;CALL 1295 2d 16 - . + db 0c4h ; 1297 c4 . + dw as.opc.noarg ;CCF 1298 3b 15 ; . + db 03fh ; 129a 3f ? + dw as.AND_CP_OR_SUB_XOR ;CP 129b a8 15 . . + db 0b8h ; 129d b8 . + dw gen.opc.ED2 ;CPD 129e 44 15 D . + db 0a9h ; 12a0 a9 . + dw gen.opc.ED2 ;CPDR 12a1 44 15 D . + db 0b9h ; 12a3 b9 . + dw gen.opc.ED2 ;CPI 12a4 44 15 D . + db 0a1h ; 12a6 a1 . + dw gen.opc.ED2 ;CPIR 12a7 44 15 D . + db 0b1h ; 12a9 b1 . + dw as.opc.noarg ;CPL 12aa 3b 15 ; . + db 02fh ; 12ac 2f / + dw as.opc.noarg ;DAA 12ad 3b 15 ; . + db 027h ; 12af 27 ' + dw as.DEC_INC ;DEC 12b0 98 17 . . + db 005h ; 12b2 05 . + dw as.opc.noarg ;DI 12b3 3b 15 ; . + db 0f3h ; 12b5 f3 . + dw as.DJNZ ;DJNZ 12b6 99 16 . . + db 010h ; 12b8 10 . + dw as.opc.noarg ;EI 12b9 3b 15 ; . + db 0fbh ; 12bb fb . + dw as.EX ;EX 12bc 49 17 I . + db 0e3h ; 12be e3 . + dw as.opc.noarg ;EXX 12bf 3b 15 ; . + db 0d9h ; 12c1 d9 . + dw as.opc.noarg ;HALT 12c2 3b 15 ; . + db 076h ; 12c4 76 v + dw as.IM ;IM 12c5 b4 16 . . + db 046h ; 12c7 46 F + dw as.IN ;IN 12c8 ed 16 . . + db 040h ; 12ca 40 @ + dw as.DEC_INC ;INC 12cb 98 17 . . + db 004h ; 12cd 04 . + dw gen.opc.ED2 ;IND 12ce 44 15 D . + db 0aah ; 12d0 aa . + dw gen.opc.ED2 ;INDR 12d1 44 15 D . + db 0bah ; 12d3 ba . + dw gen.opc.ED2 ;INI 12d4 44 15 D . + db 0a2h ; 12d6 a2 . + dw gen.opc.ED2 ;INIR 12d7 44 15 D . + db 0b2h ; 12d9 b2 . + dw as.JP ;JP 12da 53 16 S . + db 0c2h ; 12dc c2 . + dw as.JR ;JR 12dd a0 16 . . + db 020h ; 12df 20 + dw as.LD ;LD 12e0 52 13 R . + db 040h ; 12e2 40 @ + dw gen.opc.ED2 ;LDD 12e3 44 15 D . + db 0a8h ; 12e5 a8 . + dw gen.opc.ED2 ;LDDR 12e6 44 15 D . + db 0b8h ; 12e8 b8 . + dw gen.opc.ED2 ;LDI 12e9 44 15 D . + db 0a0h ; 12eb a0 . + dw gen.opc.ED2 ;LDIR 12ec 44 15 D . + db 0b0h ; 12ee b0 . + dw gen.opc.ED2 ;NEG 12ef 44 15 D . + db 044h ; 12f1 44 D + dw as.opc.noarg ;NOP 12f2 3b 15 ; . + db 000h ; 12f4 00 . + dw as.AND_CP_OR_SUB_XOR ;OR 12f5 a8 15 . . + db 0b0h ; 12f7 b0 . + dw gen.opc.ED2 ;OTDR 12f8 44 15 D . + db 0bbh ; 12fa bb . + dw gen.opc.ED2 ;OTIR 12fb 44 15 D . + db 0b3h ; 12fd b3 . + dw as.OUT ;OUT 12fe 21 17 ! . + db 041h ; 1300 41 A + dw gen.opc.ED2 ;OUTD 1301 44 15 D . + db 0abh ; 1303 ab . + dw gen.opc.ED2 ;OUTI 1304 44 15 D . + db 0a3h ; 1306 a3 . + dw as.POP_PUSH ;POP 1307 d9 16 . . + db 0c1h ; 1309 c1 . + dw as.POP_PUSH ;PUSH 130a d9 16 . . + db 0c5h ; 130c c5 . + dw as.BITOP ;RES 130d 09 16 . . + db 080h ; 130f 80 . + dw as.RET ;RET 1310 45 16 E . + db 0c0h ; 1312 c0 . + dw gen.opc.ED2 ;RETI 1313 44 15 D . + db 04dh ; 1315 4d M + dw gen.opc.ED2 ;RETN 1316 44 15 D . + db 045h ; 1318 45 E + dw as.SHIFTOP ;RL 1319 d5 15 . . + db 010h ; 131b 10 . + dw as.opc.noarg ;RLA 131c 3b 15 ; . + db 017h ; 131e 17 . + dw as.SHIFTOP ;RLC 131f d5 15 . . + db 000h ; 1321 00 . + dw as.opc.noarg ;RLCA 1322 3b 15 ; . + db 007h ; 1324 07 . + dw gen.opc.ED2 ;RLD 1325 44 15 D . + db 06fh ; 1327 6f o + dw as.SHIFTOP ;RR 1328 d5 15 . . + db 018h ; 132a 18 . + dw as.opc.noarg ;RRA 132b 3b 15 ; . + db 01fh ; 132d 1f . + dw as.SHIFTOP ;RRC 132e d5 15 . . + db 008h ; 1330 08 . + dw as.opc.noarg ;RRCA 1331 3b 15 ; . + db 00fh ; 1333 0f . + dw gen.opc.ED2 ;RRD 1334 44 15 D . + db 067h ; 1336 67 g + dw as.RST ;RST 1337 ca 16 . . + db 0c7h ; 1339 c7 . + dw as.ADC_SBC ;SBC 133a 51 15 Q . + db 098h ; 133c 98 . + dw as.opc.noarg ;SCF 133d 3b 15 ; . + db 037h ; 133f 37 7 + dw as.BITOP ;SET 1340 09 16 . . + db 0c0h ; 1342 c0 . + dw as.SHIFTOP ;SLA 1343 d5 15 . . + db 020h ; 1345 20 + dw as.SHIFTOP ;SRA 1346 d5 15 . . + db 028h ; 1348 28 ( + dw as.SHIFTOP ;SRL 1349 d5 15 . . + db 038h ; 134b 38 8 + dw as.AND_CP_OR_SUB_XOR ;SUB 134c a8 15 . . + db 090h ; 134e 90 . + dw as.AND_CP_OR_SUB_XOR ;XOR 134f a8 15 . . + db 0a8h ; 1351 a8 . + + dw as.IN0 ;IN0 + db 000h ; + dw as.MLT ;MLT + db 04ch ; + dw gen.opc.ED2 ;OTDM + db 08bh ; + dw gen.opc.ED2 ;OTDMR + db 09bh ; + dw gen.opc.ED2 ;OTIM + db 083h ; + dw gen.opc.ED2 ;OTIMR + db 093h ; + dw as.OUTO ;OUT0 + db 001h ; + dw gen.opc.ED2 ;SLP + db 076h ; + dw as.TST ;TST + db 004h ; + dw as.TSTIO ;TSTIO + db 074h ; as.TST: call arg.r_HL_A ; @@ -3409,7 +3272,7 @@ l13d4h: jp z,ERROR ;13e9 ca 07 01 . . . l13ech: ld b,a ;13ec 47 G - jp as.opc.noarg ;13ed c3 3b 15 . ; . + jp as.opc.noarg ;13ed c3 3b 15 . ; . l13f0h: call arg.IDX_displcmnt ;13f0 cd 55 18 . U . jr nc,l1413h ;13f3 30 1e 0 . @@ -4182,9 +4045,6 @@ test_paren_close: inc de ;18ca 13 . ret ;18cb c9 . -prefix_ixiy: - db 0 ;18cc 00 . - cmd_L: ld hl,cmd_L ;18cd 21 cd 18 ! . . ld (cmd_rpt),hl ;18d0 22 68 00 " h . @@ -4355,50 +4215,50 @@ l19edh: ; DD/FD 3 byte (ix+d)/(iy+d) b_19ef_start: - defb 034h ;19ef 34 4 - defb 035h ;19f0 35 5 - defb 036h ;19f1 36 6 - defb 046h ;19f2 46 F - defb 04eh ;19f3 4e N - defb 056h ;19f4 56 V - defb 05eh ;19f5 5e ^ - defb 066h ;19f6 66 f - defb 06eh ;19f7 6e n - defb 070h ;19f8 70 p - defb 071h ;19f9 71 q - defb 072h ;19fa 72 r - defb 073h ;19fb 73 s - defb 074h ;19fc 74 t - defb 075h ;19fd 75 u - defb 077h ;19ff 77 w - defb 07eh ;1a00 7e ~ - defb 086h ;1a01 86 . - defb 08eh ;1a02 8e . - defb 096h ;1a03 96 . - defb 09eh ;1a04 9e . - defb 0a6h ;1a05 a6 . - defb 0aeh ;1a06 ae . - defb 0b6h ;1a07 b6 . - defb 0beh ;1a08 be . - defb 0 ;1a09 00 . + db 034h ;19ef 34 4 + db 035h ;19f0 35 5 + db 036h ;19f1 36 6 + db 046h ;19f2 46 F + db 04eh ;19f3 4e N + db 056h ;19f4 56 V + db 05eh ;19f5 5e ^ + db 066h ;19f6 66 f + db 06eh ;19f7 6e n + db 070h ;19f8 70 p + db 071h ;19f9 71 q + db 072h ;19fa 72 r + db 073h ;19fb 73 s + db 074h ;19fc 74 t + db 075h ;19fd 75 u + db 077h ;19ff 77 w + db 07eh ;1a00 7e ~ + db 086h ;1a01 86 . + db 08eh ;1a02 8e . + db 096h ;1a03 96 . + db 09eh ;1a04 9e . + db 0a6h ;1a05 a6 . + db 0aeh ;1a06 ae . + db 0b6h ;1a07 b6 . + db 0beh ;1a08 be . + db 0 ;1a09 00 . ; DD/FD 2 byte l1a0ah: - defb 009h ;1a0a 09 . - defb 019h ;1a0b 19 . - defb 021h ;1a0c 21 ! - defb 022h ;1a0d 22 " - defb 023h ;1a0e 23 # - defb 029h ;1a0f 29 ) - defb 02ah ;1a10 2a * - defb 02bh ;1a11 2b + - defb 039h ;1a12 39 9 - defb 0e1h ;1a13 e1 . - defb 0e3h ;1a14 e3 . - defb 0e5h ;1a15 e5 . - defb 0e9h ;1a16 e9 . - defb 0f9h ;1a17 f9 . - defb 0 ;1a18 00 . + db 009h ;1a0a 09 . + db 019h ;1a0b 19 . + db 021h ;1a0c 21 ! + db 022h ;1a0d 22 " + db 023h ;1a0e 23 # + db 029h ;1a0f 29 ) + db 02ah ;1a10 2a * + db 02bh ;1a11 2b + + db 039h ;1a12 39 9 + db 0e1h ;1a13 e1 . + db 0e3h ;1a14 e3 . + db 0e5h ;1a15 e5 . + db 0e9h ;1a16 e9 . + db 0f9h ;1a17 f9 . + db 0 ;1a18 00 . disas_pfx.ED: inc iy ;1a19 fd 23 . # @@ -5265,15 +5125,6 @@ t__C_: DC '(C)' DB 0 -isprefix_ixiy: - db 0 ;1ff8 00 . -last_L: - dw TPA ;1ff9 00 01 . -l1ffbh: - dw 0 ;1ffb 00 00 . -l1ffdh: - db 0 ;1ffd 00 . - sub_1ffeh: ld hl,(REG.PC) ;1ffe 2a 60 00 * ` . ld a,h ;2001 7c | @@ -5561,17 +5412,173 @@ l21dah: ret ;21e1 c9 . b_21e2_start: - db 0 ;21e2 00 . + db 0 trace_call_flag: - db 0 ;1=call, 0=trace 21e3 00 . + db 0 ;1=call, 0=trace trace_UW_flag: - db 0 ;0 or 'U' or 'W' 21e4 00 . + db 0 ;0 or 'U' or 'W' trace_count: - dw 0 ;21e5 00 00 . + dw 0 trace_N_flag: - db 0 ;0 if 'N' 21e7 00 . + db 0 ;0 if 'N' trace_J_flag: - db 0 ;0 if 'J' 21e8 00 . + db 0 ;0 if 'J' + +;------------------------------------------------------------------------------- + +con_col: + db 0 + +l0941h: + db 0 + +bp_tab: + rept BP_CNT + rept BP_SIZE + db 0 + endm + endm + +expr_p1: + dw expr_buf +expr_p2: + dw expr_buf + +expr_buf: +current_cseg defl $ - current_cseg + .phase current_phase + current_cseg + +start: + LD SP,ldr_end+(stack-ddtz_base) + LD DE,signon ;ldr_end+(expr_buf-ddtz_base) + LD C,BDOS_PSTR + CALL BDOS + + xor a + dec a + jp po,reloc + ld de,msgz80 + LD C,BDOS_PSTR + CALL BDOS + jp 0 + +reloc: + LD HL,ldr_end+ddtz_size ;start of reloc bitmap + ld bc,0108h ;init bit counter + + EXX + LD HL,(BDOS+1) + LD (ldr_end+1),HL + LD BC,ddtz_size-1 + LD D,B + LD E,0FFH + INC DE ;size rounded up to next page boundary + INC BC ;ddtz_size + OR A + SBC HL,DE ;BDOS - size + LD (BDOS+1),HL ;-> new BDOS entry + + push hl + PUSH BC + ld de,ldr_end + sbc hl,de + EX DE,HL ;-> DE + LD HL,ldr_size + add hl,bc + ld b,h + ld c,l + LD HL,TPA +reloc_lp: + EXX + djnz reloc_nl + ld b,c ;reload bit counter + LD e,(HL) ;get next 8 relocation bits + INC HL +reloc_nl: + sla e + EXX + JR NC,reloc_next + DEC HL + LD A,(HL) + ADD A,E + LD (HL),A + INC HL + LD A,(HL) + ADC A,D + LD (HL),A +reloc_next: + cpi + jp pe,reloc_lp + dec hl + + POP BC + pop de + EX DE,HL + ADD HL,BC + EX DE,HL + DEC DE + LDDR + LD HL,conbuf+2-ddtz_base + ADD HL,DE + JP (HL) + +current_phase defl $ + .dephase +current_cseg defl $ + + ds EXPR_BUF_SIZE - ($ - expr_buf) +expr_bufe: + +msg_Y: + dc 'Yn' +reg_Y: + rept YREG_CNT + dw 0 + endm + +last_S: + dw TPA + +last_I: + dw 0 + +last_O_addr: + dw 0 +last_O_val: + db 0 + +cmd_Q_jopt: + db -1 + +last_D: + dw TPA + +cmdR_rindex: + db 0 + +high_load: + dw TPA +max_load: + dw TPA + +l1262h: + dw 0 +last_A: + dw TPA +cmd_A_prev: + dw TPA + +prefix_ixiy: + db 0 + +isprefix_ixiy: + db 0 +last_L: + dw TPA +l1ffbh: + dw 0 +l1ffdh: + db 0 ddtz_size equ $-ddtz_base ddtz_end: -- 2.39.2