From 3ff72ed7c229ec2edf663f89eb2b7a9e47af36b9 Mon Sep 17 00:00:00 2001 From: Leo C Date: Thu, 4 Apr 2019 23:04:02 +0200 Subject: Some cosmetic changes and minor optimizations --- ddt180.z80 | 116 ++++++++++++++++++++++++++++--------------------------------- 1 file changed, 54 insertions(+), 62 deletions(-) diff --git a/ddt180.z80 b/ddt180.z80 index 220c074..60c588a 100644 --- a/ddt180.z80 +++ b/ddt180.z80 @@ -146,9 +146,7 @@ conbuf: ld sp,stack exx ld de,ddtz_base - or a - sbc hl,de - add hl,de + call cp_hl_de jr c,l0079h ex de,hl l0079h: @@ -214,6 +212,11 @@ CMDTAB: dw cmd_Y ;examine [and substitute] Y variables dw cmd_Z ;Zap (fill) memory with a byte string +ERROR: + ld hl,(error_func) +exe_hl: + call CALL_HL + ;fall thru mainloop: ld sp,stack ld hl,p_msg_error @@ -223,6 +226,7 @@ mainloop: call bp_clr_temporary ld hl,(cmd_rpt) ld de,mainloop + ld (cmd_rpt),de call cp_hl_de ld a,'>' call outchar @@ -231,8 +235,6 @@ mainloop: call get_line call skipbl jr z,exe_hl - ld hl,mainloop - ld (cmd_rpt),hl inc de sub '@' jr c,ERROR @@ -247,12 +249,6 @@ mainloop: ld l,a jr exe_hl -ERROR: - ld hl,(error_func) -exe_hl: - call CALL_HL - jr mainloop - ;------------------------------------------------------------------------------- p_msg_error: @@ -261,7 +257,7 @@ p_msg_error: ;fall thru crlf: call pstr_inl - db CR,LF+80h + dc CR,LF call inchar ld a,0 ld (con_col),a @@ -431,7 +427,6 @@ pstr: and a ret z call outchar - and a ret m jr pstr @@ -470,11 +465,11 @@ inchar: ld c,BDOS_CSTAT call ddtz_bdos and a - jr z,l0284h + jr z,inch1 ld c,BDOS_CIN call ddtz_bdos scf -l0284h: +inch1: pop bc pop de pop hl @@ -531,12 +526,13 @@ skipbl: or a ret +;------------------------------------------------------------------------------- + next_arg: call skipbl cp ',' ret nz - inc de - call skipbl + call skipbl0 cp a ret @@ -580,8 +576,8 @@ sub_hl_a1: sub_hl_a: push bc ld c,a - ld b,0 - or a + xor a + ld b,a sbc hl,bc pop bc ret @@ -693,7 +689,7 @@ l030ch: sub_0318h: push bc res 7,b - defb 03eh ;ld a,nn + defb 03eh ;ld a,nn: swallow push bc sub_031ch: push bc push de @@ -1096,6 +1092,7 @@ do_factor: ret nc inc de ld hl,(BDOS+1) + dec hl cp 'T' ret z ld hl,(high_load) @@ -2137,11 +2134,11 @@ cmd_X: jp nc,p_cpustat0 call assert_eol ld a,b - cp 01eh + cp 30 jr z,l0c5fh - cp 01fh + cp 31 jr z,l0c4fh - cp 01dh + cp 29 jp z,ERROR ex de,hl ld hl,t_reg_names @@ -2258,38 +2255,38 @@ sub_0caeh: ret t_reg_names: - DC 'BC''' - DC 'DE''' - DC 'HL''' - DC 'BC' - DC 'DE' - DC 'HL' - DC 'A''' - DC 'B''' - DC 'C''' - DC 'D''' - DC 'E''' - DC 'H''' - DC 'L''' - DC 'A' - DC 'B' - DC 'C' - DC 'D' - DC 'E' - DC 'H' - DC 'L' - DC 'IX' - DC 'IY' - DC 'SP' - DC 'PC' - DC 'X' - DC 'Y' - DC 'S' - DC 'P' - DC 'I' - DC 'IP' - DC 'F''' - DC 'F' + DC 'BC''' ;0 + DC 'DE''' ;1 + DC 'HL''' ;2 + DC 'BC' ;3 + DC 'DE' ;4 + DC 'HL' ;5 + DC 'A''' ;6 + DC 'B''' ;7 + DC 'C''' ;8 + DC 'D''' ;9 + DC 'E''' ;10 + DC 'H''' ;11 + DC 'L''' ;12 + DC 'A' ;13 + DC 'B' ;14 + DC 'C' ;15 + DC 'D' ;16 + DC 'E' ;17 + DC 'H' ;18 + DC 'L' ;19 + DC 'IX' ;20 + DC 'IY' ;21 + DC 'SP' ;22 + DC 'PC' ;23 + DC 'X' ;24 + DC 'Y' ;25 + DC 'S' ;26 + DC 'P' ;27 + DC 'I' ;28 + DC 'IP' ;29 + DC 'F''' ;30 + DC 'F' ;31 DB 0 b_0cfa_start: @@ -2417,7 +2414,6 @@ msg_@: ; Input a byte from port cmd_I: - ld hl,cmd_I ld (cmd_rpt),hl ld hl,(last_I) call get_lastarg_def @@ -2437,7 +2433,6 @@ cmd_I: ; Output a byte to a port cmd_O: - ld hl,cmd_O ld (cmd_rpt),hl ld hl,(last_O_val) call get_arg_def @@ -2646,7 +2641,7 @@ l0e96h: add hl,bc l0ea7h: ld bc,16 - and a + and a ;clear carry call sub_0f58h pop hl pop bc @@ -2783,7 +2778,6 @@ l0f42h: ; Display memory in hex and ASCII cmd_D: - ld hl,cmd_D ld (cmd_rpt),hl ld hl,(last_D) ld bc,128 @@ -3379,6 +3373,7 @@ p_max_high: call pstr_inl DC ' Top = ' ld hl,(BDOS+1) + dec hl call out_hl jp crlf @@ -4619,7 +4614,6 @@ test_paren_close: ; List disassembled code cmd_L: - ld hl,cmd_L ld (cmd_rpt),hl call expr jr nc,l18dbh @@ -5890,7 +5884,6 @@ l2113h: ; trace over Calls [No list] [Jumps only] /.While./.Until. cmd_C: - ld hl,cmd_C ld a,1 jr cmd_tc @@ -5902,7 +5895,6 @@ cmd_C: cmd_T: xor a - ld hl,cmd_T cmd_tc: ld (cmd_rpt),hl ld (trace_call_flag),a -- cgit v1.2.3