X-Git-Url: http://cloudbase.mooo.com/gitweb/ddt180.git/blobdiff_plain/4210c8a16472bf2891614bdde109dd5d7edb713e..d0ff7c76b85c1d1f7e76672462c0ba85861ab9b3:/ddt180.z80 diff --git a/ddt180.z80 b/ddt180.z80 index 45e63d4..da5cfe6 100644 --- a/ddt180.z80 +++ b/ddt180.z80 @@ -63,11 +63,6 @@ CONBUF_SIZE equ 80 ;Size of console input buffer EXPR_BUF_SIZE equ 128 ;expressen buffer for conditional breakpoints BP_CNT equ 12 ;Number of breakpoints BP_SIZE equ 8 ;Size of a breakpoint record -YREG_CNT equ 10 ;Number of Y registers (0..9) - -SYMCASE_SENS equ 0 ;Symbols are case sensitive -SYMCASE_CONV equ 1 ;Convert case when symbols are loaded -SYMCASE_LOWER equ 2 ;Convert to lower case if set, else to upper case ;------------------------------------------------------------------------------- @@ -80,12 +75,6 @@ di_or_ei: ret ddtz_bdos: jp 0 -screen_width: - db 80 - -symattrib: - db 0 - current_cseg defl $ - current_cseg .phase current_phase + current_cseg @@ -131,9 +120,7 @@ reg.iff: db 0c3h reg.pc: dw TPA var.$: dw 0000h -var.@: dw 0 -error_func:dw p_msg_error cmd_rpt:dw mainloop ;------------------------------------------------------------------------------- @@ -144,9 +131,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: @@ -183,7 +168,7 @@ l0093h: ;------------------------------------------------------------------------------- CMDTAB: - dw cmd_@ ;examine/substitute the displacement register @ + dw ERROR ;cmd_@ ;examine/substitute the displacement register @ dw ERROR ;cmd_A ;Assemble dw cmd_B ;Breakpoints display/set/clear dw cmd_C ;trace over Calls @@ -201,25 +186,29 @@ CMDTAB: dw cmd_O ;Output a byte to port dw ERROR ; dw cmd_Q ;Qery memory for byte string - dw cmd_R ;Read binary or hex file and/or symbol file + dw cmd_R ;Read binary or hex file dw cmd_S ;Substitute memory dw cmd_T ;Trace dw ERROR ; dw cmd_V ;Verify (compare) two memory areas dw cmd_W ;Write a file to disk dw cmd_X ;eXamine [and substitute] registers - dw cmd_Y ;examine [and substitute] Y variables + dw ERROR ;cmd_Y ;examine [and substitute] Y variables dw cmd_Z ;Zap (fill) memory with a byte string +ERROR: +p_msg_error: + call pstr_inl + dc '?',CR,LF + ;fall thru mainloop: ld sp,stack - ld hl,p_msg_error - ld (error_func),hl ld hl,(reg.pc) ld (var.$),hl call bp_clr_temporary ld hl,(cmd_rpt) ld de,mainloop + push de call cp_hl_de ld a,'>' call outchar @@ -228,7 +217,8 @@ mainloop: call get_line call skipbl jr z,exe_hl - ld hl,mainloop + pop hl + push hl ld (cmd_rpt),hl inc de sub '@' @@ -242,48 +232,21 @@ mainloop: inc hl ld h,(hl) ld l,a - jr exe_hl -ERROR: - ld hl,(error_func) exe_hl: - call CALL_HL - jr mainloop + jp (hl) ;------------------------------------------------------------------------------- -p_msg_error: - call pstr_inl - dc '?' - ;fall thru crlf: call pstr_inl - db CR,LF+80h + dc CR,LF call inchar ld a,0 ld (con_col),a jr c,mainloop ret -out.hl.@: - call out_hl - push de - push hl - ld de,(var.@) - ld a,d - or e - jr z,l01bfh - call outbl - call pstr_inl - dc '@' - and a - sbc hl,de - call out_hl -l01bfh: - pop hl - pop de - ret - sub_01d9h: call pstr_inl dc '-' @@ -438,17 +401,6 @@ pstr_inl: ex (sp),hl ret -p_align_@_sym: - push de - ld de,(var.@) - ld a,d - or e - pop de - ld a,(symlen_cur) - jr z,$+4 - add a,6 - add a,c - ld c,a p_goto_col: ld a,(con_col) cp c @@ -562,86 +514,6 @@ cp_hl_de: sbc hl,de add hl,de ret - -sub_hl_a1: - dec hl -sub_hl_a: - push bc - ld c,a - ld b,0 - or a - sbc hl,bc - pop bc - ret - -;------------------------------------------------------------------------------- - -sym_getname: - push de - push hl - ld hl,ddtz_base+2 -sgn_l: - ld d,(hl) - dec hl - ld e,(hl) - dec hl - ld a,(hl) - cp 0c3h - jr z,sgn_e - - ex (sp),hl - call cp_hl_de - jr z,sgn_e - ex (sp),hl - call sub_hl_a1 - jr sgn_l -sgn_e: - sub 0c3h - pop hl - pop de - ret - -p_symstr: - push bc - ld b,(hl) -pss_l: - dec hl - ld a,(hl) - call outchar - djnz pss_l - dec hl - pop bc - ret - -p_symbol: - if 0 - ld a,(dash_flag) - or a - ret nz - endif - push hl - call sym_getname - call nz,p_symstr - pop hl - ret - -p_label: - if 0 - ld a,(dash_flag) - or a - ret nz - endif - push hl - call sym_getname - jr z,pl_e - call p_symstr - call pstr_inl - dc ':' - call crlf -pl_e: - pop hl - ret - ;------------------------------------------------------------------------------- lookupch: @@ -664,10 +536,6 @@ l0300h: sub_0303h: ld hl,t_reg_names ld b,07fh - jr l030ch - -sub_030ah: - ld b,0ffh l030ch: inc b ld a,(hl) @@ -678,10 +546,6 @@ l030ch: res 7,b ret -sub_0318h: - push bc - res 7,b - defb 03eh ;ld a,nn sub_031ch: push bc push de @@ -1095,9 +959,6 @@ do_factor: ld hl,TPA cp 'L' ret z - ld hl,(var.@) - cp '@' - ret z ld hl,(var.$) cp '$' ret z @@ -1112,37 +973,18 @@ do_factor: jr z,fact_factor cp '^' jr z,fact_reg.CPU - cp 'Y' - jr z,fact_reg.Y cp '(' jr z,fact_mem cp '[' jr z,expr_brckt cp '''' jr z,fact_factstring - cp '.' - jr z,fact_symbol dec de scf ret ;------------------------------------------------------------------------------- -fact_reg.Y: - call get.decdigit - jr c,error1 - inc de -get_y_val: - add a,a - ld hl,reg_Y - call add_hl_a - ld a,(hl) - inc hl - ld h,(hl) - ld l,a - and a - ret - fact_factstring: ld hl,0 l054bh: @@ -1227,59 +1069,6 @@ expr_brckt: error1: jp ERROR -fact_symbol: - push bc - ld hl,ddtz_base ;symtbl start - ld a,(symattrib) - ld c,07fh - rra - jr c,fs_nxtsym - res 5,c - -fs_nxtsym: - ld a,(hl) ;symlen - cp 0c3h - jr z,error1 - ld b,a ;symlen - inc b - push hl ;symtbl ptr - push de ;inpsym ptr -fs_nxtchar: - ld a,(de) - djnz fs_3 - call test_sym_char - jr z,fs_cont - pop hl ;inpsym ptr (discard) - inc de - cp a,':' - jr z,fs_cont_1 - dec de - - pop hl ;symtbl ptr - inc hl - ld a,(hl) ;symval h - inc hl - ld h,(hl) ;symval l - ld l,a - or a ;clear carry - pop bc - ret - -fs_3: - inc de - dec hl - xor (hl) - and c - jr z,fs_nxtchar -fs_cont: ;start over - pop de ;inpsym ptr -fs_cont_1: - pop hl ;symtbl ptr - ld a,(hl) - add a,3 - call sub_hl_a - jr fs_nxtsym - ;------------------------------------------------------------------------------- get.number: @@ -1401,6 +1190,7 @@ p_cpustat: l063eh: call p_regs djnz l063eh + call outbl6 push hl push de ld iy,(reg.pc) @@ -1417,8 +1207,6 @@ l065bh: djnz l065bh pop af pop hl - call nz,outbl6 - call nz,p_offset jp crlf p_f: @@ -1475,12 +1263,6 @@ p_regs: inc hl ld d,(hl) ex de,hl - dec a - jr z,l06d9h - call out.hl.@ - call z,outbl6 - jr l06e2h -l06d9h: call out_hl jr l06e2h l06deh: @@ -1661,13 +1443,9 @@ l07cdh: call outbl ld l,(ix+002h) ld h,(ix+003h) - call out.hl.@ - call outbl - call p_symbol - ld c,9 - call p_align_@_sym + call out_hl call pstr_inl - dc ':' + dc ' :' ld l,(ix+004h) ld h,(ix+005h) call out_hl @@ -2063,53 +1841,6 @@ l0ab0h: ; > Y[0..9] ; examine (and substitute) an Y variable -cmd_Y: - call get.decdigit - jr c,l0bc3h - inc de - push af - call assert_eol - pop af - call sub_0bdch - jp l0c15h -l0bc3h: - call assert_eol - xor a -l0bc7h: - push af - call sub_0bdch - call outbl - pop af - push af - call get_y_val - call p_symbol - pop af - inc a - push af - rra - push af - ld c,11 - call c,p_align_@_sym - pop af - call nc,crlf - pop af - cp YREG_CNT - jr c,l0bc7h - ret - -sub_0bdch: - ld c,a - ld b,0 - add a,'0'+080h - ld de,msg_Y+1 - ld (de),a - dec de - ld hl,reg_Y - add hl,bc - add hl,bc - ex de,hl - ld c,003h - jp l0c33h ;------------------------------------------------------------------------------- ; > X @@ -2136,7 +1867,7 @@ cmd_X: call sel_dc_string l0c12h: call l0c33h -l0c15h: + call outbl push de push bc @@ -2170,9 +1901,7 @@ l0c33h: ld a,(de) dec de ld h,a - bit 1,c - jp z,out_hl - jp out.hl.@ + jp out_hl l0c4fh: call p_f @@ -2355,7 +2084,7 @@ cmd_S: call get_lastarg_def l0d60h: ld (last_S),hl - call out.hl.@ + call out_hl call outbl ld a,(hl) call out_hex @@ -2390,22 +2119,13 @@ l0d8ah: ; > @ ; examine (substitute) displacement register @ -cmd_@: - call assert_eol - ld hl,msg_@ - ld de,var.@ - ld c,001h - jp l0c12h - -msg_@: - dc '@' +;cmd_@: ;------------------------------------------------------------------------------- ; >>I [port] ; Input a byte from port cmd_I: - ld hl,cmd_I ld (cmd_rpt),hl ld hl,(last_I) call get_lastarg_def @@ -2425,7 +2145,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 @@ -2455,7 +2174,7 @@ l0dedh: cp b jr z,l0e10h ld c,a - call out.hl.@ + call out_hl call outbl ld a,b call out_hex @@ -2464,7 +2183,7 @@ l0dedh: call out_hex call outbl ex de,hl - call out.hl.@ + call out_hl ex de,hl call crlf l0e10h: @@ -2515,38 +2234,13 @@ cmdm_up: ; > H ; display Highest load address of last filed loaded, Maximum "High" ; off all loaded files, and Top address of available memory -; > HS -; display symbol list ; > H expression ; evaluate expression and display result in hex, decimal and other formats -; > H expression expression -; display sum und difference of expressions cmd_H: - call get_char_upper - cp 'S' - jr z,p_sym_list - call expr jp c,p_max_high0 - call next_arg - push hl - call expr - push af call assert_eol - pop af - ex de,hl - pop hl - jr c,l0e5eh - push hl - push de - add hl,de - call l0e5eh - pop de - pop hl - and a - sbc hl,de -l0e5eh: call out_hl call outbl2 call out_hl_neg @@ -2556,56 +2250,11 @@ l0e5eh: call out_hl_dec_neg call outbl4 call out.bin.w - call outbl + call outbl2 ld a,l call out.ascii - call outbl2 - call p_symbol jp crlf -p_sym_list: - inc de - call assert_eol - ld a,(symlen_cur) - add a,7 - ld b,a - ld c,0 - ld hl,ddtz_base+2 -psym_nxtsym: - ld d,(hl) - dec hl - ld e,(hl) - dec hl - ld a,(hl) - cp 0c3h - jr z,psym_e - - call p_goto_col - ex de,hl - call out_hl - call outbl - ex de,hl - call p_symstr - - ld a,c - add b - ld c,a - ld a,(screen_width) - sub b - cp c - jr nc,psym_nxtsym - - call crlf - ld c,0 - jr psym_nxtsym - -psym_e: - ld a,c - or a - ret z - jp crlf - - ;------------------------------------------------------------------------------- ; > Q[J] startaddr endaddr bytes ; Query memory for a byte string [Justified] @@ -2771,7 +2420,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 @@ -2783,7 +2431,7 @@ sub_0f58h: push hl push af l0f5ch: - call out.hl.@ + call out_hl call z,outbl2 call outbl ld de,0 @@ -3166,50 +2814,6 @@ rdhex_done: pop hl jp p_max_high - -; test for valid character for symbols -; return z if valid - -test_sym_char: - cp '$' - ret z - cp '%' - ret z - cp '.' - ret z - cp '_' - ret z - call test_alphanum - ret c ; cy == 1 --> z == 0 - cp a ; return z - ret - - -; check if char is in [0..9,?,@,A..Z,a..z] -; return cy if invalid -; return nc if valid alfanumeric char - -test_alphanum: - cp 'z' - ret z - ccf - ret c - cp 'a' - ret nc - cp 'Z' - ret z - ccf - ret c - cp '?' - ret nc -test_numeral: - cp '9' - ret z - ccf - ret c - cp '0' - ret - test_whitespace: cp ' ' ret z @@ -3329,7 +2933,6 @@ l1773h: ; List disassembled code cmd_L: - ld hl,cmd_L ld (cmd_rpt),hl call expr jr nc,l18dbh @@ -3375,9 +2978,8 @@ cmdl_p_line: ret p_disas_line: - call p_label call outbl2 - call out.hl.@ + call out_hl call z,outbl call outbl sub a @@ -3389,24 +2991,9 @@ p_disas_line: ld c,15 call p_goto_col - call p_offset - call outbl - jp p_symbol - + ; fall thru ;------------------------------------------------------------------------------- - -p_offset: - ld de,(var.@) - ld a,d - or e - ret z - call pstr_inl - dc '(@' - and a - sbc hl,de - call out_hl - add hl,de - jp out_rparen + ret ;------------------------------------------------------------------------------- @@ -4578,7 +4165,6 @@ l2113h: ; trace over Calls [No list] [Jumps only] /.While./.Until. cmd_C: - ld hl,cmd_C ld a,1 jr cmd_tc @@ -4590,7 +4176,6 @@ cmd_C: cmd_T: xor a - ld hl,cmd_T cmd_tc: ld (cmd_rpt),hl ld (trace_call_flag),a @@ -4822,13 +4407,6 @@ expr_bufe: ;------------------------------------------------------------------------------- -msg_Y: - dc 'Yn' -reg_Y: - rept YREG_CNT - dw 0 - endm - last_S: dw TPA @@ -4866,8 +4444,6 @@ disas_argtype: pbl_loop_adr: dw 0 -symlen_cur: ;max length of symbols read so far - db 0 cur_fcb: dw 0