From 85b57f2af28ed5ff67bed5f8a8f3959c7a3fb675 Mon Sep 17 00:00:00 2001 From: Leo C Date: Thu, 18 Aug 2016 14:39:09 +0200 Subject: [PATCH] Command A,L: Reorg (HL instead of IY). Save/restore IX/IY around BDOS calls. --- ddt180.z80 | 152 +++++++++++++++++++++++++++-------------------------- 1 file changed, 77 insertions(+), 75 deletions(-) diff --git a/ddt180.z80 b/ddt180.z80 index 5b531f6..4f12b0a 100644 --- a/ddt180.z80 +++ b/ddt180.z80 @@ -392,6 +392,8 @@ p_char_lparen: outquote: ld a,'''' outchar: + push ix + push iy push hl push de push bc @@ -406,6 +408,8 @@ outchar: pop bc pop de pop hl + pop iy + pop ix ret pstr: @@ -535,7 +539,7 @@ assert_eol: to_error: jp ERROR -chk_sp: +chk_stack: push hl push de ld hl,0 @@ -824,14 +828,14 @@ get_range: inc de l03a2h: push hl - push af + push af ;'S' flag call expr jr c,l03b8h ld b,h ld c,l pop af pop hl - jr z,l03b6h + jr z,l03b6h ;'S'? ld a,c sub l ld c,a @@ -845,7 +849,7 @@ l03b6h: l03b8h: pop af pop hl - jr z,error0 + jr z,error0 ;'S', but no expression following scf ret @@ -1103,7 +1107,7 @@ fact_factor: jp ERROR do_factor: - call chk_sp + call chk_stack call get.number ret nc inc de @@ -2317,6 +2321,12 @@ l0d60h: dec hl inc de cp '.' + jr nz,cmds_dash + ld a,(de) + or a + jr nz,l0d8ah + ret +cmds_dash: jp z,assert_eol cp '-' jr nz,l0d8ah @@ -3310,52 +3320,56 @@ close_file: cmd_A: ld hl,(last_A) call get_lastarg_def - push hl - pop iy - ld hl,l1259h + ld (last_A),hl + ld (cmd_A_prev),hl + ld hl,cmda_restart ld (error_func),hl ld (l1262h),sp -l1211h: - push iy - pop hl - ld (last_A),hl +cmda_loop: + ld hl,(last_A) ld (var.$),hl push hl call p_disas_line - pop iy ld de,(var.@) ld a,d or e - ld c,17 + ld c,19 jr z,l122dh - ld c,25 + ld c,19+7 l122dh: call p_fill_space ld c,b push bc call get_line pop bc + pop hl call skipbl cp '.' ret z cp '-' jr nz,l124bh - ld iy,(cmd_A_prev) - jr l1211h + ld hl,(cmd_A_prev) + jr cmda_lpend l124bh: + push hl + pop iy + push hl and a - call nz,sub_1268h - ld (cmd_A_prev),iy + call nz,asemble_line ld b,0 - add iy,bc - jr l1211h + pop hl + ld (cmd_A_prev),hl + add hl,bc +cmda_lpend: + ld (last_A),hl + jr cmda_loop -l1259h: +cmda_restart: call l0146h ld sp,(l1262h) - jr l1211h + jr cmda_loop -sub_1268h: +asemble_line: call skipbl ld hl,t_MNEMONICS call sub_030ah @@ -4455,8 +4469,6 @@ cmd_L: jr nc,l18dbh ld hl,(last_L) l18dbh: - push hl - pop iy call next_arg call get_range jr nc,l1905h @@ -4464,45 +4476,35 @@ l18dbh: ld b,16 l18ebh: push bc - push iy - pop hl - push hl - call p_disas_line - call crlf - pop iy - ld c,b - ld b,0 - add iy,bc - ld (last_L),iy + call cmdl_p_line pop bc djnz l18ebh ret + l1905h: call assert_eol - ld h,b - ld l,c - ld a,b - or c - jr nz,l190fh - dec hl + ld d,h + ld e,l + add hl,bc + ex de,hl l190fh: - push hl - push iy - pop hl - push hl - call p_disas_line - call crlf - pop iy - ld e,b - ld d,000h - add iy,de - ld (last_L),iy - pop hl - and a - sbc hl,de - ret z - ret c - jr l190fh + push de + call cmdl_p_line + pop de + call cp_hl_de + jr c,l190fh + ret + +cmdl_p_line: + push hl + call p_disas_line + call crlf + pop hl + ld c,b + ld b,0 + add hl,bc + ld (last_L),hl + ret p_disas_line: call p_label @@ -4512,6 +4514,8 @@ p_disas_line: call outbl sub a ld (con_col),a + push hl + pop iy call p_disas_instr and a ret z @@ -4540,20 +4544,24 @@ p_disas_instr: ld (l1ffdh),a call disas_get_instrlen jr nc,l197fh - push bc - call p_mnemonic + push bc + ld a,(con_col) + add a,5 + ld c,a + call pstr + call p_fill_space ex de,hl call call_hl pop bc ld a,(l1ffdh) - ld hl,(l1ffbh) + ld hl,(disas_arg_16) scf ret l197fh: call pstr_inl DC '???' - ld b,001h + ld b,1 sub a ret @@ -5140,9 +5148,9 @@ l1d4eh: ld a,002h sub_1d50h: ld (l1ffdh),a - ld (l1ffbh),hl - call out_hl - ret + ld (disas_arg_16),hl + jp out_hl + p_arg_ww_mn: call p_arg_ww call p_char_comma @@ -5152,6 +5160,7 @@ p_arg_addr_hl: call sub_1e13h call p_char_comma jp p_arg_hlixiy + p_arg_hl_addr: call p_arg_hlixiy call p_char_comma @@ -5357,13 +5366,6 @@ p_arg: call sel_dc_string jp pstr -p_mnemonic: - ld a,(con_col) - add a,5 - ld c,a - call pstr - jp p_fill_space - t_MNEMONICS: DC 'ADC' DC 'ADD' @@ -5529,7 +5531,7 @@ sub_1ffeh: call disas_get_instrlen jp nc,ERROR ld c,b - ld b,000h + ld b,0 ld hl,(reg.pc) add hl,bc call sub_09cah @@ -5965,7 +5967,7 @@ isprefix_ixiy: db 0 last_L: dw TPA -l1ffbh: +disas_arg_16: dw 0 l1ffdh: db 0 -- 2.39.2