From 646e8b0556dc2228f2cd55408ae99d2d2833ef01 Mon Sep 17 00:00:00 2001 From: Leo C Date: Wed, 3 Aug 2016 23:03:25 +0200 Subject: [PATCH] Edit, remove 'jr $+0', rmove 2x 'jp (hl)' --- ddtz.z80 | 141 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 72 insertions(+), 69 deletions(-) diff --git a/ddtz.z80 b/ddtz.z80 index f964dc3..b92164a 100644 --- a/ddtz.z80 +++ b/ddtz.z80 @@ -247,8 +247,6 @@ ERROR: exe_hl: call CALL_HL ;010a cd 0f 01 . . . jr mainloop ;010d 18 ae . . -CALL_HL: - jp (hl) ;010f e9 . CMDTAB: defw cmd_@ ;0110 92 0d . . @@ -292,7 +290,7 @@ get_line: ld de,conbuf+1 ;015a 11 6b 00 . k . ld a,(de) ;015d 1a . ld b,a ;015e 47 G - ld c,000h ;015f 0e 00 . . + ld c,0 ;015f 0e 00 . . inc b ;0161 04 . l0162h: inc de ;0162 13 . @@ -471,6 +469,7 @@ l0242h: ex af,af' ;0257 08 . jr c,l022dh ;0258 38 d3 8 . ret ;025a c9 . + outquote: ld a,'''' ;025b 3e 27 > ' outchar: @@ -508,7 +507,7 @@ l0284h: pop hl ;0286 e1 . ret ;0287 c9 . pstr: - ld c,000h ;0288 0e 00 . . + ld c,0 ;0288 0e 00 . . l028ah: ld a,(hl) ;028a 7e ~ and a ;028b a7 . @@ -655,13 +654,15 @@ l0339h: and a ;033a a7 . pop bc ;033b c1 . ret ;033c c9 . -sub_033dh: + +sel_dc_string: inc b ;033d 04 . l033eh: dec b ;033e 05 . ret z ;033f c8 . call sub_0345h ;0340 cd 45 03 . E . jr l033eh ;0343 18 f9 . . + sub_0345h: ld a,(hl) ;0345 7e ~ and a ;0346 a7 . @@ -672,6 +673,7 @@ l0348h: and a ;034a a7 . ret m ;034b f8 . jr l0348h ;034c 18 fa . . + sub_034eh: call get_arg_range ;034e cd 7d 03 . } . push hl ;0351 e5 . @@ -863,8 +865,8 @@ l0433h: push bc ;0437 c5 . call do_factor ;0438 cd e4 04 . . . pop bc ;043b c1 . - ex de,hl ;043c eb . - ex (sp),hl ;043d e3 . + ex de,hl ;043c eb . + ex (sp),hl ;043d e3 . jr nc,l0447h ;043e 30 07 0 . pop de ;0440 d1 . ld a,b ;0441 78 x @@ -1992,7 +1994,7 @@ cmd_X: jp z,ERROR ;0c08 ca 07 01 . . . ex de,hl ;0c0b eb . ld hl,b_0cc3_start ;0c0c 21 c3 0c ! . . - call sub_033dh ;0c0f cd 3d 03 . = . + call sel_dc_string ;0c0f cd 3d 03 . = . l0c12h: call l0c33h ;0c12 cd 33 0c . 3 . l0c15h: @@ -3070,6 +3072,8 @@ sub_1268h: ld b,(hl) ;1285 46 F ex de,hl ;1286 eb . pop de ;1287 d1 . + +CALL_HL: jp (hl) ;1288 e9 . b_1289_start: @@ -4289,9 +4293,6 @@ l19b1h: scf ;19bf 37 7 ret ;19c0 c9 . -; TODO: - nop ;jp (hl) ;19c1 e9 . - disas_pfx.DDFD: inc iy ;19c2 fd 23 . # ld hl,b_19ef_start ;19c4 21 ef 19 ! . . @@ -4516,15 +4517,15 @@ b_1ad1_start: db 0f8h,0b8h,013h ; dw l1e30h db 0c7h,0c0h,08bh ;ret cc - dw l1e9dh + dw prnt_arg_cc db 0c7h,0c7h,0b4h ;rst dw l1c98h db 0ffh,0c9h,08bh ;ret dw l1c97h db 0cfh,0c1h,081h ;pop rr - dw l1e86h + dw prnt_arg_zz db 0cfh,0c5h,084h ;push rr - dw l1e86h + dw prnt_arg_zz db 0ffh,0e3h,034h ;ex (sp),hl dw l1ca0h db 0ffh,0e9h,052h ;jp (hl) @@ -4534,9 +4535,9 @@ b_1ad1_start: db 0ffh,0f9h,056h ;ld sp,hl dw l1cc1h db 0cfh,003h,041h ;inc rr - dw l1e8bh + dw prnt_arg_ww db 0cfh,00bh,029h ;dec rr - dw l1e8bh + dw prnt_arg_ww db 0c7h,004h,041h ;inc r dw l1e28h db 0c7h,005h,029h ;dec r @@ -4637,15 +4638,15 @@ b_1bc9_start: db 0ffh ; b_1bf4_start: - db 0e7h,040h,03fh ;in r,(c) ;r=bcde + db 0e7h,040h,03fh ;in r,(c) ;r=b,c,d,e dw l1db3h ; - db 0f7h,060h,03fh ;in r,(c) ;r=hl + db 0f7h,060h,03fh ;in r,(c) ;r=h,l dw l1db3h ; db 0ffh,078h,03fh ;in r,(c) ;r=a dw l1db3h ; - db 0e7h,041h,076h ;out (c),r ;r=bcde + db 0e7h,041h,076h ;out (c),r ;r=b,c,d,e dw l1dbfh ; - db 0f7h,061h,076h ;out (c),r ;r=hl + db 0f7h,061h,076h ;out (c),r ;r=h,l dw l1dbfh ; db 0ffh,079h,076h ;out (c),r ;r=a dw l1dbfh ; @@ -4668,21 +4669,21 @@ b_1bf4_start: db 0ffh,05fh,056h ;ld a,r dw l1da1h db 0cfh,04ch,0d2h ;mlt rr - dw l1e8bh + dw prnt_arg_ww db 0c7h,004h,0eeh ;tst r dw l1e28h db 0 l228bh: - db 0e7h,000h,0cfh ; + db 0e7h,000h,0cfh ;in0 r,(m) ;r=b,c,d,e dw l230ch - db 0f7h,020h,0cfh ; + db 0f7h,020h,0cfh ;in0 r,(m) ;r=h,l dw l230ch db 0ffh,038h,0cfh ;in0 a,(m) dw l230ch - db 0e7h,001h,0e7h ; + db 0e7h,001h,0e7h ;out0 (m),r ;r=b,c,d,e dw l2315h - db 0f7h,021h,0e7h ; + db 0f7h,021h,0e7h ;out0 (m),r ;r=h,l dw l2315h db 0ffh,039h,0e7h ;out0 (m),a dw l2315h @@ -4755,14 +4756,14 @@ l1c98h: l1ca0h: ld hl,b_1ca9_start ;1ca0 21 a9 1c ! . . call pstr ;1ca3 cd 88 02 . . . - jp l1e7eh ;1ca6 c3 7e 1e . ~ . + jp prnt_arg_hlixiy ;1ca6 c3 7e 1e . ~ . b_1ca9_start: DC '(SP),' l1caeh: ld a,'(' ;1cae 3e 28 > ( call outchar ;1cb0 cd 5d 02 . ] . - call l1e7eh ;1cb3 cd 7e 1e . ~ . + call prnt_arg_hlixiy ;1cb3 cd 7e 1e . ~ . ld a,')' ;1cb6 3e 29 > ) jp outchar ;1cb8 c3 5d 02 . ] . l1cbbh: @@ -4771,7 +4772,7 @@ l1cbbh: l1cc1h: ld hl,b_1cca_start ;1cc1 21 ca 1c ! . . call pstr ;1cc4 cd 88 02 . . . - jp l1e7eh ;1cc7 c3 7e 1e . ~ . + jp prnt_arg_hlixiy ;1cc7 c3 7e 1e . ~ . b_1cca_start: DC 'SP,' @@ -4779,9 +4780,9 @@ l1ccdh: ld hl,b_176d_start ;1ccd 21 6d 17 ! m . jp pstr ;1cd0 c3 88 02 . . . l1cd3h: - call l1e7eh ;1cd3 cd 7e 1e . ~ . + call prnt_arg_hlixiy ;1cd3 cd 7e 1e . ~ . call prnt_char_comma ;1cd6 cd b4 1e . . . - jp l1e8bh ;1cd9 c3 8b 1e . . . + jp prnt_arg_ww ;1cd9 c3 8b 1e . . . l1cdch: call sub_1ce8h ;1cdc cd e8 1c . . . call prnt_char_comma ;1cdf cd b4 1e . . . @@ -4792,7 +4793,7 @@ l1ce5h: sub_1ce8h: ld a,'(' ;1ce8 3e 28 > ( call outchar ;1cea cd 5d 02 . ] . - call l1e8bh ;1ced cd 8b 1e . . . + call prnt_arg_ww ;1ced cd 8b 1e . . . ld a,')' ;1cf0 3e 29 > ) jp outchar ;1cf2 c3 5d 02 . ] . l1cf5h: @@ -4813,7 +4814,7 @@ l1d0ch: l1d0fh: ld a,(iy+000h) ;1d0f fd 7e 00 . ~ . and 018h ;1d12 e6 18 . . - call sub_1ea0h ;1d14 cd a0 1e . . . + call prnt_arg_cc0 ;1d14 cd a0 1e . . . call prnt_char_comma ;1d17 cd b4 1e . . . l1d1ah: ld c,(iy+001h) ;1d1a fd 4e 01 . N . @@ -4842,7 +4843,7 @@ prnt_char_A: jp outchar ;1d3f c3 5d 02 . ] . l1d42h: - call l1e9dh ;1d42 cd 9d 1e . . . + call prnt_arg_cc ;1d42 cd 9d 1e . . . call prnt_char_comma ;1d45 cd b4 1e . . . l1d48h: ld l,(iy+001h) ;1d48 fd 6e 01 . n . @@ -4855,15 +4856,15 @@ sub_1d50h: call out_hl ;1d56 cd 13 02 . . . ret ;1d59 c9 . l1d5ah: - call l1e8bh ;1d5a cd 8b 1e . . . + call prnt_arg_ww ;1d5a cd 8b 1e . . . call prnt_char_comma ;1d5d cd b4 1e . . . jr l1d48h ;1d60 18 e6 . . l1d62h: call sub_1e13h ;1d62 cd 13 1e . . . call prnt_char_comma ;1d65 cd b4 1e . . . - jp l1e7eh ;1d68 c3 7e 1e . ~ . + jp prnt_arg_hlixiy ;1d68 c3 7e 1e . ~ . l1d6bh: - call l1e7eh ;1d6b cd 7e 1e . ~ . + call prnt_arg_hlixiy ;1d6b cd 7e 1e . ~ . call prnt_char_comma ;1d6e cd b4 1e . . . jp sub_1e13h ;1d71 c3 13 1e . . . l1d74h: @@ -4918,15 +4919,15 @@ l1dbfh: call prnt_char_comma ;1dc5 cd b4 1e . . . jr l1e28h ;1dc8 18 5e . ^ l1dcah: - call l1e7eh ;1dca cd 7e 1e . ~ . + call prnt_arg_hlixiy ;1dca cd 7e 1e . ~ . call prnt_char_comma ;1dcd cd b4 1e . . . - jp l1e8bh ;1dd0 c3 8b 1e . . . + jp prnt_arg_ww ;1dd0 c3 8b 1e . . . l1dd3h: call sub_1e13h ;1dd3 cd 13 1e . . . call prnt_char_comma ;1dd6 cd b4 1e . . . - jp l1e8bh ;1dd9 c3 8b 1e . . . + jp prnt_arg_ww ;1dd9 c3 8b 1e . . . l1ddch: - call l1e8bh ;1ddc cd 8b 1e . . . + call prnt_arg_ww ;1ddc cd 8b 1e . . . call prnt_char_comma ;1ddf cd b4 1e . . . jr sub_1e13h ;1de2 18 2f . / l1de4h: @@ -4978,11 +4979,11 @@ l1e30h: l1e33h: and 007h ;1e33 e6 07 . . cp 006h ;1e35 fe 06 . . - jr nz,l1e73h ;1e37 20 3a : + jr nz,prnt_arg_r ;1e37 20 3a : ld a,(isprefix_ixiy) ;1e39 3a f8 1f : . . and a ;1e3c a7 . ld a,006h ;1e3d 3e 06 > . - jr z,l1e73h ;1e3f 28 32 ( 2 + jr z,prnt_arg_r ;1e3f 28 32 ( 2 ld hl,b_1e78_start ;1e41 21 78 1e ! x . ld a,(isprefix_ixiy) ;1e44 3a f8 1f : . . dec a ;1e47 3d = @@ -5006,22 +5007,24 @@ l1e6bh: call out_hex ;1e6b cd 18 02 . . . ld a,')' ;1e6e 3e 29 > ) jp outchar ;1e70 c3 5d 02 . ] . -l1e73h: + +prnt_arg_r: ld hl,t_BCDEHL_HL_A ;1e73 21 96 1f ! . . - jr l1eaah ;1e76 18 32 . 2 + jr prnt_arg ;1e76 18 32 . 2 b_1e78_start: DC '(IX' l1e7bh: DC '(IY' -l1e7eh: + +prnt_arg_hlixiy: ld a,(isprefix_ixiy) ;1e7e 3a f8 1f : . . ld hl,t_HL.IX.IY ;1e81 21 c6 1f ! . . - jr l1eaah ;1e84 18 24 . $ -l1e86h: + jr prnt_arg ;1e84 18 24 . $ +prnt_arg_zz: ld hl,t_BC.DE.HL.AF ;1e86 21 ab 1f ! . . jr l1e8eh ;1e89 18 03 . . -l1e8bh: +prnt_arg_ww: ld hl,t_BC.DE.HL.SP ;1e8b 21 a2 1f ! . . l1e8eh: ld a,(iy+000h) ;1e8e fd 7e 00 . ~ . @@ -5031,20 +5034,20 @@ l1e8eh: rra ;1e94 1f . and 003h ;1e95 e6 03 . . cp 002h ;1e97 fe 02 . . - jr z,l1e7eh ;1e99 28 e3 ( . - jr l1eaah ;1e9b 18 0d . . -l1e9dh: + jr z,prnt_arg_hlixiy ;1e99 28 e3 ( . + jr prnt_arg ;1e9b 18 0d . . + +prnt_arg_cc: ld a,(iy+000h) ;1e9d fd 7e 00 . ~ . -sub_1ea0h: +prnt_arg_cc0: rra ;1ea0 1f . rra ;1ea1 1f . rra ;1ea2 1f . and 007h ;1ea3 e6 07 . . ld hl,t_tstfl_ZCPS ;1ea5 21 dc 1f ! . . - jr l1eaah ;1ea8 18 00 . . -l1eaah: +prnt_arg: ld b,a ;1eaa 47 G - call sub_033dh ;1eab cd 3d 03 . = . + call sel_dc_string ;1eab cd 3d 03 . = . jp pstr ;1eae c3 88 02 . . . prnt_A_comma: @@ -5255,35 +5258,35 @@ l2037h: ret ;2038 c9 . b_2039_start: - db 0ffh,0ddh,000h + db 0ffh,0ddh,000h ;Prefix DD dw l20a7h - db 0ffh,0fdh,000h + db 0ffh,0fdh,000h ;Prefix FD dw l20ach - db 0ffh,0edh,000h + db 0ffh,0edh,000h ;Prefix ED dw l20b8h b_2048_start: - db 0ffh,0cdh,000h + db 0ffh,0cdh,000h ;call mn dw l2080h - db 0ffh,0c3h,000h + db 0ffh,0c3h,000h ;jp mn dw l208bh - db 0ffh,0e9h,000h + db 0ffh,0e9h,000h ;jp () dw l20a2h - db 0ffh,0c9h,000h + db 0ffh,0c9h,000h ;ret dw l20dch - db 0ffh,0cfh,000h + db 0ffh,0cfh,000h ;rst 8 dw l2115h - db 0c7h,0c7h,000h + db 0c7h,0c7h,000h ; dw l20f9h - db 0c7h,0c4h,000h + db 0c7h,0c4h,000h ; dw l2080h - db 0f7h,010h,000h + db 0f7h,010h,000h ; dw l2093h - db 0e7h,020h,000h + db 0e7h,020h,000h ; dw l2093h - db 0c7h,0c2h,000h + db 0c7h,0c2h,000h ; dw l208bh - db 0c7h,0c0h,000h + db 0c7h,0c0h,000h ; dw l20c5h db 0 -- 2.39.2