X-Git-Url: http://cloudbase.mooo.com/gitweb/ddt180.git/blobdiff_plain/1d3941c8ac130b6dcf7951cb13c0b8c8e46a8e11..HEAD:/ddt180.z80 diff --git a/ddt180.z80 b/ddt180.z80 index 8e3ad31..c1a394b 100644 --- a/ddt180.z80 +++ b/ddt180.z80 @@ -7,31 +7,11 @@ ; - Cut the .PRL header (first 256 byte) end rename the result to DDTZ.COM. ;------------------------------------------------------------------------------- -; Relocation loader -; -TPA equ 0100h - cseg - .phase TPA - - jp start - ds 3 - -ldr_end: -ldr_size equ $ - TPA -current_phase defl $ - - .dephase -current_cseg defl $ - -;------------------------------------------------------------------------------- -; DDT/Z core -; - ; Some greneral definitions -TAB equ 9 -LF equ 10 -CR equ 13 +TAB equ 09h +CR equ 0dh +LF equ 0ah ; CP/M memory layout @@ -58,7 +38,7 @@ BDOS_SETDMA equ 26 ;Set DMA Address ; ddtz specific definitions -STACK_SIZE equ 64 ;ddtz internal stack +STACK_SIZE equ 80 ;ddtz internal stack 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 @@ -70,12 +50,32 @@ SYMCASE_CONV equ 1 ;Convert case when symbols are loaded SYMCASE_LOWER equ 2 ;Convert to lower case if set, else to upper case ;------------------------------------------------------------------------------- +; Relocation loader +; +TPA equ 0100h + cseg + .phase TPA + + jp start + ds 3 + +ldr_end: +ldr_size equ $ - TPA +current_phase defl $ + + .dephase +current_cseg defl $ + +;------------------------------------------------------------------------------- +; DDT/Z core +; + ddtz_base: jp ddtz_bdos l0003h: - rst 30h -sub_0004h: + rst 30h ;rst used by ddtz +di_or_ei: ;ints enabled/disabled while ddtz is running nop ret ddtz_bdos: @@ -135,18 +135,18 @@ reg.pc: dw TPA var.$: dw 0000h var.@: dw 0 -error_func:dw l0146h +error_func:dw p_msg_error cmd_rpt:dw mainloop +;------------------------------------------------------------------------------- + conbuf: db CONBUF_SIZE 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: @@ -168,7 +168,7 @@ l007ch: ld a,0fbh l0093h: ld (reg.iff),a - call sub_0004h + call di_or_ei ld hl,ddtz_base ld l,000h ld (reg_sp),hl @@ -181,6 +181,8 @@ l0093h: ds CONBUF_SIZE + 3 - ($ - conbuf) +;------------------------------------------------------------------------------- + CMDTAB: dw cmd_@ ;examine/substitute the displacement register @ dw cmd_A ;Assemble @@ -210,15 +212,21 @@ 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,l0146h + 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 + ld (cmd_rpt),de call cp_hl_de ld a,'>' call outchar @@ -227,38 +235,31 @@ mainloop: call get_line call skipbl jr z,exe_hl - ld hl,mainloop - ld (cmd_rpt),hl inc de sub '@' jr c,ERROR cp 'Z'+1-'@' jr nc,ERROR - add a,a ld hl,CMDTAB - call add_hl_a + call add_hl_a2 ld a,(hl) inc hl ld h,(hl) ld l,a jr exe_hl -ERROR: - ld hl,(error_func) -exe_hl: - call CALL_HL - jr mainloop +;------------------------------------------------------------------------------- -l0146h: +p_msg_error: call pstr_inl dc '?' ;fall thru crlf: call pstr_inl - db CR,LF+80h - call inchar - ld a,0 + dc CR,LF + xor a ld (con_col),a + call inchar jr c,mainloop ret @@ -284,13 +285,12 @@ l01bfh: sub_01d9h: call pstr_inl dc '-' - dec hl - jp cpl.hl + jp neg.hl out_hl_dec_neg: push hl call sub_01d9h - defb 03eh + defb 03eh ;ld a,.. swallow push hl out.hl.dec: push hl ld b,006h @@ -337,12 +337,10 @@ out_hex: pop af out_dgt: - and 0fh - cp 10 - jr c,l0229h - add a,007h -l0229h: - add a,'0' + or 0f0h + daa + add a,0a0h + adc a,040h jr outchar out.bin.w: @@ -352,11 +350,10 @@ out.bin.w: out.bin.b: ld b,8 l01c9h: - add a,a - push af - ld a,00 - adc a,a - call out_dgt + rlca + push af + and 1 + call out_dgt pop af djnz l01c9h ld a,'"' @@ -369,7 +366,8 @@ out.ascii: cp ' ' push af call nc,outbl - call outquote + call pstr_inl + dc '''' pop af jr nc,l0242h sub 0c0h @@ -381,7 +379,8 @@ l0242h: call outchar cp '''' call z,outchar - call outquote + call pstr_inl + dc '''' sla c pop bc ret nc @@ -396,14 +395,6 @@ outbl2: call outbl outbl: ld a,' ' - jr outchar - -p_char_lparen: - ld a,'(' - jr outchar - -outquote: - ld a,'''' outchar: push ix push iy @@ -425,22 +416,6 @@ outchar: pop ix ret -pstr: - ld a,(hl) - inc hl - and a - ret z - call outchar - and a - ret m - jr pstr - -pstr_inl: - ex (sp),hl - call pstr - ex (sp),hl - ret - p_align_@_sym: push de ld de,(var.@) @@ -460,7 +435,7 @@ p_goto_col: call outbl jr p_goto_col - +;------------------------------------------------------------------------------- inchar: push ix @@ -470,11 +445,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 @@ -498,6 +473,8 @@ get_line: pop hl ret +;------------------------------------------------------------------------------- + get_char_upper: ld a,(de) toupper: @@ -518,6 +495,8 @@ tolower: or 020h ret +;------------------------------------------------------------------------------- + skipbl0: inc de skipbl: @@ -527,12 +506,13 @@ skipbl: or a ret +;------------------------------------------------------------------------------- + next_arg: call skipbl cp ',' ret nz - inc de - call skipbl + call skipbl0 cp a ret @@ -542,18 +522,24 @@ assert_eol: to_error: jp ERROR +;------------------------------------------------------------------------------- + chk_stack: push hl push de ld hl,0 add hl,sp - ld de,stack-40 + ld de,stack-(STACK_SIZE-28) call cp_hl_de pop de pop hl jr c,to_error ret +;------------------------------------------------------------------------------- + +add_hl_a2: + add a,a add_hl_a: add a,l ld l,a @@ -572,12 +558,14 @@ 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 +;------------------------------------------------------------------------------- + sym_getname: push de push hl @@ -644,6 +632,8 @@ pl_e: pop hl ret +;------------------------------------------------------------------------------- + lookupch: ld b,0 l02f5h: @@ -662,7 +652,7 @@ l0300h: ret sub_0303h: - ld hl,b_0cc3_start + ld hl,t_reg_names ld b,07fh jr l030ch @@ -681,7 +671,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 @@ -703,22 +693,23 @@ l031eh: pop bc ret l0336h: - call sub_0345h + call str_sel_next l0339h: pop de and a pop bc ret -sel_dc_string: +str_sel: inc b -l033eh: - dec b - ret z - call sub_0345h - jr l033eh + jr str_sel2 +str_sel1: + call str_sel_next +str_sel2: + djnz str_sel1 + ret -sub_0345h: +str_sel_next: ld a,(hl) and a ret z @@ -729,12 +720,12 @@ l0348h: ret m jr l0348h -sub_034eh: +get_arg_range_target: call get_arg_range push hl push bc call next_arg - call sub_0363h + call get_arg_final ex de,hl pop bc pop hl @@ -745,7 +736,7 @@ sub_035dh: jr c,error0 ret -sub_0363h: +get_arg_final: call sub_035dh l0366h: jp assert_eol @@ -768,7 +759,7 @@ sub_0377h: jr l0366h b_037c_start: - defb 0e6h + defb 0e6h ;and a,.. clear carry get_arg_range: scf ex af,af' @@ -780,7 +771,7 @@ get_arg_range: jr c,error0 ex af,af' pop hl - defb 03eh + defb 03eh ;ld a,.. swallow pop af l038ch: pop af call get_range @@ -826,6 +817,8 @@ l03b8h: scf ret +;------------------------------------------------------------------------------- + expr: call skipbl expr1: @@ -845,6 +838,8 @@ expr1: pop de ret +;------------------------------------------------------------------------------- + do_op_eq: jr z,l03edh jr l03ech @@ -890,8 +885,7 @@ l0406h: l0411h: ld hl,tab_func_eqlege ld a,b - add a,a - call add_hl_a + call add_hl_a2 ld c,(hl) inc hl ld b,(hl) @@ -983,40 +977,33 @@ doop_mod: ; de: r (x%y) div_hl_de: - push bc - ex de,hl - ld b,h - ld c,l - ld hl,0 - ld a,16 + push bc + ex de,hl ;de: x + ld b,h ;bc: y + ld c,l + ld hl,0 ;hl: r + ld a,16 ; de: x (x shifted out, q shifted in) ; bc: y ; hl: r (initially 0) -l047eh: - push af - add hl,hl - ex de,hl - xor a - add hl,hl - ex de,hl - adc a,l - sub c - ld l,a - ld a,h - sbc a,b - ld h,a - inc de - jr nc,l048fh - add hl,bc - dec de -l048fh: - pop af - dec a - jr nz,l047eh - ex de,hl - pop bc +div_lp: + ex de,hl + add hl,hl ;x <<= 1 + ex de,hl + adc hl,hl ;r <<= 1 + inc de + or a + sbc hl,bc + jr nc,div_norestore + dec de + add hl,bc +div_norestore: + dec a + jr nz,div_lp + ex de,hl + pop bc ret doop_and: @@ -1052,8 +1039,7 @@ do_binary_op: call lookupch ld a,b ld hl,tblf_opa - add a,a - call add_hl_a + call add_hl_a2 ld c,(hl) inc hl ld b,(hl) @@ -1074,6 +1060,8 @@ tblf_opa: dw doop_xor dw 0 +;------------------------------------------------------------------------------- + fact_factor: call do_factor ret nc @@ -1085,6 +1073,7 @@ do_factor: ret nc inc de ld hl,(BDOS+1) + dec hl cp 'T' ret z ld hl,(high_load) @@ -1127,14 +1116,15 @@ do_factor: 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 + call add_hl_a2 ld a,(hl) inc hl ld h,(hl) @@ -1174,14 +1164,19 @@ fact_reg.CPU: inc hl ld h,(hl) ld l,a - and a + xor a ;clr cy, a=0 bit 0,c ret nz - ld h,000h + ld h,a ret +fact_factinv: + call fact_factor + jr cpl.hl + fact_factneg: call fact_factor +neg.hl: dec hl cpl.hl: ld a,h @@ -1192,10 +1187,6 @@ cpl.hl: ld l,a ret -fact_factinv: - call fact_factor - jr cpl.hl - fact_mem: call expr1 jr c,error1 @@ -1243,12 +1234,17 @@ fs_nxtsym: inc b push hl ;symtbl ptr push de ;inpsym ptr -fs_2: +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 @@ -1258,20 +1254,24 @@ fs_2: or a ;clear carry pop bc ret + fs_3: inc de dec hl xor (hl) and c - jr z,fs_2 + 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: call get.hexdigit ret c @@ -1315,7 +1315,7 @@ l05dbh: jr next_bindigit l05e4h: cp '"' - jp nz,ERROR + jr nz,error11 call get.bindigit jr nc,l05dbh or a @@ -1340,11 +1340,12 @@ next_decdigit: decnum_done: cp '.' ret z +error11: jp ERROR sub_060ch: call get_char_upper - cp '[' + cp 'Z'+1 jr l0614h get.hexdigit: @@ -1377,6 +1378,8 @@ l0625h: sub '0' ret +;------------------------------------------------------------------------------- + p_cpustat0: call assert_eol p_cpustat: @@ -1413,33 +1416,34 @@ p_f: call p_flags ld a,(reg.iff) cp 0f3h - jp z,outbl + jr z,outbl_1 ld a,'E' jp outchar p_f2: ld a,(reg.f2) call p_flags - jp outbl + jr outbl_1 p_flags: - ld b,a - ld a,'S' - call sub_06aah - ld a,'Z' - call sub_06aah - rl b - ld a,'H' - call sub_06aah - rl b - ld a,'V' - call sub_06aah - ld a,'N' - call sub_06aah - ld a,'C' -sub_06aah: - rl b - jp c,outchar - jp outbl + push hl + ld hl,t_flag_names+7 + ld c,a + ld b,8 +fl_loop: + ld a,' ' + cp (hl) + ld a,c + rlca + ld c,a + jr z,fl_skip + ld a,(hl) + call c,outchar + call nc,outbl +fl_skip: + dec hl + djnz fl_loop + pop hl + ret p_regs: push de @@ -1473,10 +1477,10 @@ l06deh: ld a,(de) call out_hex l06e2h: - call outbl pop de pop hl - ret +outbl_1: + jp outbl b_06e9_start: DC 'A ' @@ -1523,36 +1527,75 @@ b_0709_start: db 000h db 000h +;------------------------------------------------------------------------------- +; > G [startaddr] [;breakp..] +; Go [to start] [with temporary breakpoints] + cmd_G: sub a ld (trace_call_flag),a - ld (l0941h),a + ld (bp_p_cpu_flag),a call expr jr c,l0740h ld (reg.pc),hl l0740h: call skipbl - jp z,user_go + jr z,user_go0 cp ';' jp nz,ERROR inc de ld a,002h call bp_enter +user_go0: jp user_go +;------------------------------------------------------------------------------- + +bpl_init: + ld b,BP_CNT + ld ix,bp_tab + ex (sp),hl + ld (pbl_loop_adr),hl + ex (sp),hl + ret + +bpl_next: + ld de,BP_SIZE + push af + add ix,de + pop af + dec b + ret z + + ex (sp),hl + ld hl,(pbl_loop_adr) + ex (sp),hl + ret + bp_clr_temporary: - ld b,BP_CNT - ld ix,bp_tab -l075ah: + call bpl_init + ld a,(ix+000h) and 0f1h ld (ix+000h),a call bp_clr_condition - ld de,BP_SIZE - add ix,de - djnz l075ah + + call bpl_next ret +;------------------------------------------------------------------------------- +; > B +; display all breakpoints +; > B breakp [breakp..] +; set breakpoints +; > BX +; clear all breakpoints +; > BX address [address..] +; clear breakpoints +; +; where breakp is: +; [R] expression [I condition] + cmd_B: call skipbl jr z,bp_print @@ -1562,6 +1605,7 @@ cmd_B: dec de ld a,001h jp bp_enter + bp_clr0: call skipbl jr z,bp_clr_all @@ -1577,9 +1621,8 @@ bp_clr_next: bp_clr_all: scf bp_clr: - ld b,BP_CNT - ld ix,bp_tab -l0799h: + call bpl_init + push af jr c,l07a7h ld e,(ix+002h) @@ -1590,16 +1633,13 @@ l07a7h: ld (ix+000h),000h call bp_clr_condition l07aeh: - ld de,BP_SIZE - add ix,de pop af - djnz l0799h + call bpl_next ret bp_print: - ld b,BP_CNT - ld ix,bp_tab -bp_pr_l: + call bpl_init + bit 0,(ix+000h) jr z,bp_pr_cont ld a,'R' @@ -1633,11 +1673,10 @@ l07cdh: l0805h: call crlf bp_pr_cont: - ld de,BP_SIZE - add ix,de - djnz bp_pr_l + call bpl_next ret +;------------------------------------------------------------------------------- ; Add break points to list ; A = 1 Permanent (B command) ; A = 2 Temporary (G command) @@ -1653,7 +1692,7 @@ bp_enter: bp_e_1: push bc call expr - jp c,ERROR + jr c,error12 pop bc bit 0,b push bc @@ -1678,17 +1717,14 @@ bp_e_1: jr bp_enter bp_get_freeslot: - ld b,BP_CNT - ld ix,bp_tab -bp_gf_l: + call bpl_init + ld a,(ix+000h) and 00fh ret z - push bc - ld bc,BP_SIZE - add ix,bc - pop bc - djnz bp_gf_l + + call bpl_next +error12 jp ERROR bp_get_count: @@ -1698,7 +1734,7 @@ bp_get_count: ret nz inc de call expr - jp c,ERROR + jr c,error12 ret bp_get_condition: @@ -1710,7 +1746,7 @@ bp_get_condition: call skipbl push de call expr - jp c,ERROR + jr c,error12 ex de,hl pop de push de @@ -1722,20 +1758,21 @@ bp_get_condition: add hl,bc ld de,expr_bufe call cp_hl_de - jp nc,ERROR - pop hl - ld (expr_p2),hl - pop de - ex de,hl + jr nc,error12 + pop de + pop hl + push de ldir - xor a - ld (de),a - inc de ex de,hl + ld (hl),c ; trailing 0 + inc hl ld (expr_p1),hl - ld hl,(expr_p2) + pop hl ret +;------------------------------------------------------------------------------- +; Breakpoint handling routine. + bpddtz: ld (reg.l),hl pop hl @@ -1749,13 +1786,13 @@ bpddtz: push ix push iy ld a,i - call sub_0004h + call di_or_ei ld h,a ld l,000h push hl - ld a,0f3h + ld a,0f3h ; EI jp po,l08dfh - ld a,0fbh + ld a,0fbh ; DI l08dfh: ld (reg.iff),a ex af,af' @@ -1764,18 +1801,18 @@ l08dfh: push bc push de push hl - call sub_097ah + call bp_restore_mem ld a,(b_21e2_start) dec a jr z,l090bh - call inchar - jr c,l0902h + call inchar ;Keyboard hit? + jr c,do_break ;yes call sub_0913h and a jp z,user_go and 083h jp z,l2151h -l0902h: +do_break: call bp_clr_temporary call p_cpustat jp mainloop @@ -1789,10 +1826,9 @@ sub_0913h: ld a,080h ex af,af' sub a - ld (l0941h),a - ld b,BP_CNT - ld ix,bp_tab -l0920h: + ld (bp_p_cpu_flag),a + call bpl_init + ld a,(ix+000h) and 007h jr z,l0938h @@ -1804,9 +1840,8 @@ l0920h: call z,sub_0942h pop bc l0938h: - ld de,BP_SIZE - add ix,de - djnz l0920h + + call bpl_next ex af,af' ret @@ -1835,7 +1870,7 @@ l0969h: bit 4,(ix+000h) ret z ld a,001h - ld (l0941h),a + ld (bp_p_cpu_flag),a ret l0974h: ex af,af' @@ -1843,10 +1878,9 @@ l0974h: ex af,af' ret -sub_097ah: - ld b,BP_CNT - ld ix,bp_tab -l0980h: +bp_restore_mem: + call bpl_init + bit 5,(ix+000h) res 5,(ix+000h) jr z,l099ah @@ -1859,32 +1893,28 @@ l0980h: ld (hl),a l099ah: res 3,(ix+000h) - ld de,BP_SIZE - add ix,de - djnz l0980h + + call bpl_next ret -sub_09a6h: - ld b,BP_CNT - ld ix,bp_tab -l09ach: +bp_tst_@pc: + call bpl_init + ld a,(ix+000h) - and 003h - jr z,l09c0h + and 003h ;User bp (temporary or permanent)? + jr z,bp_tst_e ;No, check next ld e,(ix+002h) ld d,(ix+003h) ld hl,(reg.pc) - call cp_hl_de - ret z -l09c0h: - ld de,BP_SIZE - add ix,de - djnz l09ach + call cp_hl_de ;Current PC is on a User bp + ret z ;Return zero +bp_tst_e: + call bpl_next sub a - inc a - ret + inc a ;Not on a user bp + ret ;Return not zero -sub_09cah: +bp_trace_enter: call bp_get_freeslot ld (ix+004h),001h ld (ix+005h),000h @@ -1895,16 +1925,15 @@ sub_09cah: ld a,(b_21e2_start) and a ld a,008h - jr nz,l09edh + jr nz,bp_t_e rra -l09edh: +bp_t_e: ld (ix+000h),a ret bp_set_to_mem: - ld b,BP_CNT - ld ix,bp_tab -l09f7h: + call bpl_init + ld a,(ix+000h) and c jr z,l0a1dh @@ -1925,23 +1954,23 @@ l09f7h: inc hl ld (hl),d l0a1dh: - ld de,BP_SIZE - add ix,de - djnz l09f7h + call bpl_next ret +;------------------------------------------------------------------------------- + user_go: sub a ld (b_21e2_start),a - ld a,(l0941h) + ld a,(bp_p_cpu_flag) and a call nz,p_cpustat - call sub_09a6h + call bp_tst_@pc ld c,007h jr nz,l0a41h ld a,001h ld (b_21e2_start),a - call sub_1ffeh + call tc_set_bp ld c,008h l0a41h: call bp_set_to_mem @@ -1963,15 +1992,17 @@ l0a41h: ld sp,(reg_sp) jp reg.iff +;------------------------------------------------------------------------------- + bp_clr_condition: ld a,(ix+000h) and 003h - ret nz + ret nz ; No (user) bp set ld e,(ix+006h) ld d,(ix+007h) ld a,d or e - ret z + ret z ; No conditional expression push bc ld h,d ld l,e @@ -2015,6 +2046,12 @@ l0ab0h: ld (iy+007h),d ret +;------------------------------------------------------------------------------- +; > Y +; examine all Y variables +; > Y[0..9] +; examine (and substitute) an Y variable + cmd_Y: call get.decdigit jr c,l0bc3h @@ -2061,7 +2098,15 @@ sub_0bdch: add hl,bc ex de,hl ld c,003h - jp l0c33h + jr l0c33h + +;------------------------------------------------------------------------------- +; > X +; eXamine (display) all cpu registers and +; the instruction at the current program counter +; > X register +; eXamine (and substitute) a register + cmd_X: call skipbl @@ -2069,15 +2114,15 @@ 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,b_0cc3_start - call sel_dc_string + ld hl,t_reg_names + call str_sel l0c12h: call l0c33h l0c15h: @@ -2087,7 +2132,7 @@ l0c15h: call get_line call skipbl jr z,l0c30h - call sub_0363h + call get_arg_final ex de,hl pop bc pop hl @@ -2135,43 +2180,41 @@ l0c5fh: sub_0c6ah: push af - ld b,000h call outbl call assert_eol call get_line pop af ex af,af' + ld b,0 l0c76h: call skipbl ld a,b ret z push bc - ld hl,b_0ca4_start + ld hl,t_flag_names call lookupch jp nc,ERROR - ld a,b - cp 008h - jr z,l0c97h - pop bc - rlca - rlca - rlca - add a,0c0h - ld (l0c94h),a - defb 0cbh -l0c94h: - defb 0c0h + inc b + xor a + scf +nxt_f: + rla + djnz nxt_f + pop bc + jr c,l0c97h + or b + ld b,a jr l0c76h + l0c97h: ex af,af' jp nc,ERROR ex af,af' ld a,0fbh ld (reg.iff),a - pop bc jr l0c76h -b_0ca4_start: +t_flag_names: db 'CNV H ZSE',0 sub_0caeh: @@ -2191,39 +2234,39 @@ sub_0caeh: scf ret -b_0cc3_start: - 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' +t_reg_names: + 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: @@ -2292,6 +2335,10 @@ b_0cfa_start: db 000h dw reg.f +;------------------------------------------------------------------------------- +; > S [startaddr] +; Substitute memory + cmd_S: ld hl,(last_S) call get_lastarg_def @@ -2328,6 +2375,10 @@ l0d8ah: call sub_0ef8h jr l0d60h +;------------------------------------------------------------------------------- +; > @ +; examine (substitute) displacement register @ + cmd_@: call assert_eol ld hl,msg_@ @@ -2338,8 +2389,11 @@ cmd_@: msg_@: dc '@' +;------------------------------------------------------------------------------- +; >>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 @@ -2354,8 +2408,11 @@ cmd_I: call out.bin.b jp crlf +;------------------------------------------------------------------------------- +; >>O [byte] [port] +; 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 @@ -2372,8 +2429,12 @@ cmd_O: out (c),a ret +;------------------------------------------------------------------------------- +; > Vstartaddr endaddr targetaddr +; Verify (compare) two memory areas + cmd_V: - call sub_034eh + call get_arg_range_target l0dedh: push bc ld a,(de) @@ -2395,14 +2456,15 @@ l0dedh: call crlf l0e10h: pop bc - inc hl inc de - dec bc - ld a,b - or c - jr nz,l0dedh + cpi + jp pe,l0dedh ret +;------------------------------------------------------------------------------- +; > M[V] startaddr endaddr destaddr +; Move memory [and verify] + cmd_M: call get_char_upper cp 'V' @@ -2410,7 +2472,7 @@ cmd_M: inc de l0e1fh: push af - call sub_034eh + call get_arg_range_target push hl push de push bc @@ -2433,6 +2495,17 @@ cmdm_up: jr z,l0dedh ret +;------------------------------------------------------------------------------- +; > 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' @@ -2517,6 +2590,10 @@ psym_e: jp crlf +;------------------------------------------------------------------------------- +; > Q[J] startaddr endaddr bytes +; Query memory for a byte string [Justified] + cmd_Q: call get_char_upper sub 'J' @@ -2541,7 +2618,7 @@ l0e96h: add hl,bc l0ea7h: ld bc,16 - and a + and a ;clear carry call sub_0f58h pop hl pop bc @@ -2556,6 +2633,10 @@ l0eb0h: pop bc ret +;------------------------------------------------------------------------------- +; > Z startaddr endaddr bytes +; Zap (fill) memory with a byte string + cmd_Z: call get_arg_range push bc @@ -2583,7 +2664,7 @@ sub_0ed7h: push de push bc l0edah: - call get_char_upper + ld a,(de) cp (hl) jr nz,l0ee2h inc de @@ -2605,9 +2686,9 @@ sub_0ee6h: ret nz jp ERROR -sub_0ef7h: +sub_0ef7h: ;from cmd_Q, cmd_Z db 0e6h ; and 037h (clear carry) -sub_0ef8h: +sub_0ef8h: ;from cmd_S scf l0ef9h: push af @@ -2669,8 +2750,11 @@ l0f42h: ld (last_S),hl ret +;------------------------------------------------------------------------------- +; >>D [startaddr] [endaddr] +; Display memory in hex and ASCII + cmd_D: - ld hl,cmd_D ld (cmd_rpt),hl ld hl,(last_D) ld bc,128 @@ -2737,6 +2821,10 @@ l0fach: ld a,'.' ret +;------------------------------------------------------------------------------- +; > Fcommandline +; specifiy filenames and command line + cmd_F: push de ld hl,DMA_BUF+1 @@ -2834,6 +2922,7 @@ sub_1012h: cp '.' ret z ld c,'?' + call toupper cp '*' ret @@ -2865,6 +2954,8 @@ sub_1043h: cp ',' ret +;------------------------------------------------------------------------------- + setup_fcb: push de ld hl,12 @@ -2881,6 +2972,8 @@ l1052h: pop de ret +;------------------------------------------------------------------------------- + file_open: ld (cur_fcb),de call setup_fcb @@ -3004,6 +3097,10 @@ read_hexbyte0: pop bc ret +;------------------------------------------------------------------------------- +; > R [displacement] +; Read a binary or hex file and or symbol file [add displacement] + cmd_R: ld hl,0 call get_lastarg_def @@ -3206,18 +3303,21 @@ test_sym_char: ; return nc if valid alfanumeric char test_alphanum: - cp 'z'+1 + cp 'z' + ret z ccf ret c cp 'a' ret nc - cp 'Z'+1 + cp 'Z' + ret z ccf ret c cp '?' ret nc test_numeral: - cp '9'+1 + cp '9' + ret z ccf ret c cp '0' @@ -3234,6 +3334,8 @@ test_whitespace: cp TAB ret +;------------------------------------------------------------------------------- + p_max_high0: call assert_eol p_max_high: @@ -3248,9 +3350,14 @@ p_max_high: call pstr_inl DC ' Top = ' ld hl,(BDOS+1) + dec hl call out_hl jp crlf +;------------------------------------------------------------------------------- +; > Wstartaddr endaddr +; Write a file to disk + cmd_W: call get_arg_range call assert_eol @@ -3312,6 +3419,10 @@ close_file: ld c,BDOS_CLOSE jp ddtz_bdos +;------------------------------------------------------------------------------- +; > A [startaddr] +; Assemble Zilog Z180 mnemonics + cmd_A: ld hl,(last_A) call get_lastarg_def @@ -3354,7 +3465,7 @@ cmda_lpend: jr cmda_loop cmda_restart: - call l0146h + call p_msg_error ld sp,(l1262h) jr cmda_loop @@ -3381,6 +3492,8 @@ asemble_line: CALL_HL: jp (hl) +;------------------------------------------------------------------------------- + b_1289_start: dw as.ADC_SBC ;ADC db 088h ; @@ -3538,6 +3651,8 @@ b_1289_start: dw as.TSTIO ;TSTIO db 074h ; +;------------------------------------------------------------------------------- + as.TST: call arg.r_HL_A ; jr nc,as.tst_0 @@ -3628,7 +3743,7 @@ as.LD: l1395h: call assert_eol ld a,(prefix_ixiy) -l139bh: +as_store_4: ld (iy+000h),a ld (iy+001h),b ld (iy+002h),l @@ -3643,7 +3758,7 @@ l13aah: inc de ld b,032h -as.store_3: +as_store_3: call assert_eol ld (iy+000h),b ld (iy+001h),l @@ -3659,10 +3774,10 @@ l13c2h: l13c9h: call assert_eol ld a,0edh - jr l139bh + jr as_store_4 l13d0h: ld b,022h - jr as.store_3 + jr as_store_3 l13d4h: ld b,a @@ -3736,7 +3851,7 @@ l1432h: add a,006h l143fh: ld b,a -as.store_2: +as_store_2: call assert_eol ld (iy+000h),b ld (iy+001h),l @@ -3763,7 +3878,7 @@ l1466h: call test_expr call test_paren_close ld b,03ah - jp as.store_3 + jp as_store_3 l1471h: call assert_comma @@ -3827,7 +3942,7 @@ l14cch: l14e3h: ld b,02ah - jp as.store_3 + jp as_store_3 l14e8h: call test_expr @@ -3835,7 +3950,7 @@ l14e8h: ld a,001h add a,b ld b,a - jp as.store_3 + jp as_store_3 l14f5h: call assert_comma call get_char_upper @@ -4037,7 +4152,7 @@ l163ch: l163eh: pop af call test_expr - jp as.store_3 + jp as_store_3 as.RET: call arg.cc_ZCPS @@ -4070,7 +4185,7 @@ l1666h: pop af l166eh: call test_expr - jp as.store_3 + jp as_store_3 l1674h: call assert_eol ld a,b @@ -4085,7 +4200,7 @@ l1680h: ld b,0fdh l1687h: ld l,0e9h - jp as.store_2 + jp as_store_2 l168ch: DC '(HL)' @@ -4108,7 +4223,7 @@ l16a9h: call assert_comma l16aeh: call arg.j_displ - jp as.store_2 + jp as_store_2 as.IM: call arg.imm_8bit @@ -4164,7 +4279,7 @@ as.IN: jr c,l1715h call arg.addr_8bit ld b,0dbh - jp as.store_2 + jp as_store_2 l170fh: call assert_comma call sub_171bh @@ -4198,7 +4313,7 @@ l1739h: jr nz,error7 inc de ld b,0d3h - jp as.store_2 + jp as_store_2 as.EX: ld hl,b_176d_start @@ -4326,7 +4441,7 @@ error8: arg.zz: push hl - ld hl,t_BC.DE.HL.AF + ld hl,t_arg_rp2 jr l181fh arg.reg_16bit: @@ -4335,7 +4450,7 @@ arg.reg_16bit: arg.ww: push hl - ld hl,t_BC.DE.HL.SP + ld hl,t_arg_rp l181fh: push bc call sub_030ah @@ -4355,7 +4470,7 @@ arg.r_HL_A: call skipbl push bc push hl - ld hl,t_BCDEHL_HL_A + ld hl,t_arg_r call sub_030ah ld a,b pop hl @@ -4443,7 +4558,7 @@ arg.cc_ZCPS: jr l18b1h arg.cc_ZC: - ld hl,t_tstfl_ZC + ld hl,t_arg_cc ld c,003h l18b1h: push bc @@ -4471,8 +4586,11 @@ test_paren_close: inc de ret +;------------------------------------------------------------------------------- +; >>L [startaddr] [endaddr] +; List disassembled code + cmd_L: - ld hl,cmd_L ld (cmd_rpt),hl call expr jr nc,l18dbh @@ -4504,6 +4622,8 @@ l190fh: jr c,l190fh ret +;------------------------------------------------------------------------------- + cmdl_p_line: push hl call p_disas_line @@ -4534,6 +4654,8 @@ p_disas_line: call outbl jp p_symbol +;------------------------------------------------------------------------------- + p_offset: ld de,(var.@) ld a,d @@ -4547,6 +4669,8 @@ p_offset: add hl,de jp out_rparen +;------------------------------------------------------------------------------- + p_disas_instr: sub a ld (disas_argtype),a @@ -4556,10 +4680,10 @@ p_disas_instr: ld a,(con_col) add a,5 ld c,a - call pstr + call pstr ;print mnemonic call p_goto_col ex de,hl - call call_hl + call call_hl ;print arguments pop bc ld a,(disas_argtype) ld hl,(disas_arg_16) @@ -4606,6 +4730,67 @@ l19b1h: scf ret +;------------------------------------------------------------------------------- + +disas_nopfx: + ld hl,b_1b54_start ;2 byte opcodes + call lookup_op + ld b,2 + ret c + ld hl,b_1ab6_start ;1 byte opcodes (no parameters) + call sub_1a72h + ld b,1 + ret c + ld hl,b_1ad1_start ;1 byte opcodes + call lookup_op + ld b,1 + ret c + ld hl,b_1b9b_start ;3 byte opcodes + call lookup_op + ret nc + ld b,3 + ret + +;------------------------------------------------------------------------------- + +disas_pfx.ED: + inc iy + ld hl,b_1bc9_start ;1 byte opcode, no arguments + call sub_1a72h + ld b,2 + ret c + ld hl,b_1bf4_start + call lookup_op + ld b,2 + ret c + + ld hl,l228bh + call lookup_op + ld b,3 + ret c + ld hl,b_1c40_start + call lookup_op + ld b,4 + ret + +;------------------------------------------------------------------------------- + +disas_pfx.CB: + push iy + inc iy + ld a,(isprefix_ixiy) + and a + jr z,l1a42h + inc iy +l1a42h: + ld hl,b_1c55_start + call lookup_op + pop iy + ld b,2 + ret + +;------------------------------------------------------------------------------- + disas_pfx.DDFD: inc iy ld hl,b_19ef_start @@ -4632,6 +4817,7 @@ l19edh: and a ret +;------------------------------------------------------------------------------- ; DD/FD 3 byte (ix+d)/(iy+d) b_19ef_start: db 034h @@ -4679,58 +4865,7 @@ l1a0ah: db 0f9h db 0 -disas_pfx.ED: - inc iy - ld hl,b_1bc9_start - call sub_1a72h - ld b,2 - ret c - ld hl,b_1bf4_start - call lookup_opc - ld b,2 - ret c - - ld hl,l228bh - call lookup_opc - ld b,3 - ret c - ld hl,b_1c40_start - call lookup_opc - ld b,4 - ret - -disas_pfx.CB: - push iy - inc iy - ld a,(isprefix_ixiy) - and a - jr z,l1a42h - inc iy -l1a42h: - ld hl,b_1c55_start - call lookup_opc - pop iy - ld b,2 - ret - -disas_nopfx: - ld hl,b_1b54_start - call lookup_opc - ld b,2 - ret c - ld hl,b_1ab6_start - call sub_1a72h - ld b,1 - ret c - ld hl,b_1ad1_start - call lookup_opc - ld b,1 - ret c - ld hl,b_1b9b_start - call lookup_opc - ret nc - ld b,3 - ret +;------------------------------------------------------------------------------- sub_1a72h: ld a,(hl) @@ -4758,7 +4893,7 @@ test_DDFD: scf ret -lookup_opc: +lookup_op: ld a,(iy+000h) and (hl) inc hl @@ -4770,7 +4905,7 @@ lookup_opc: inc hl ld a,(hl) and a - jr nz,lookup_opc + jr nz,lookup_op ret l1aa8h: @@ -4787,6 +4922,7 @@ get_mnemonic: scf ret +;------------------------------------------------------------------------------- ; 1 byte opcodes (no parameters) ; Format: db opcode, t_MNEMONICS-index b_1ab6_start: @@ -4864,7 +5000,7 @@ b_1ad1_start: dw l1ce5h db 0 -; 2 byte opdodes +; 2 byte opcodes b_1b54_start: db 0c7h,006h,056h ;ld r,nn dw l1cfah @@ -5040,6 +5176,8 @@ b_1c55_start: dw p_arg_bitop db 0 +;------------------------------------------------------------------------------- + p_arg_r_r: call p_arg_r call p_char_comma @@ -5102,8 +5240,7 @@ l1ce5h: sub_1ce8h: call p_char_lparen call p_arg_ww -out_rparen: - jp p_char_rparen + jr out_rparen l1cf5h: call p_A_comma @@ -5143,7 +5280,11 @@ l1d29h: sub_1d2ch: call p_char_lparen ld a,(iy+001h) - jp l1e6bh +p_arg_nn_rp: + call out_hex +out_rparen: + jr p_char_rparen + l1d37h: call sub_1d2ch jr p_char_comma_A @@ -5180,27 +5321,30 @@ p_arg_addr_a: call p_arg_addr p_char_comma_A: call p_char_comma + jr p_char_A + +p_A_comma: + call p_char_A +p_char_comma: + ld a,',' + db 021h p_char_A: ld a,'A' - jr outchar1 -p_arg_a_addr: - call p_A_comma - jp p_arg_addr + db 021h l1d85h: ld a,'0' - jr outchar1 + db 021h l1d89h: ld a,'1' - jr outchar1 + db 021h l1d8dh: ld a,'2' - jr outchar1 - -p_A_comma: - call p_char_A -p_char_comma: - ld a,',' -outchar1: + db 021h +p_char_rparen: + ld a,')' + db 021h +p_char_lparen: + ld a,'(' jp outchar l1d92h: @@ -5253,6 +5397,16 @@ p_arg_ww_addr: call p_char_comma jr p_arg_addr +p_arg_a_addr: + call p_A_comma +p_arg_addr: + call p_char_lparen + ld l,(iy+001h) + ld h,(iy+002h) + ld a,001h + call sub_1d50h + jr p_char_rparen + p_arg_bitop: ld a,(isprefix_ixiy) and a @@ -5284,17 +5438,6 @@ l1e0eh: l1e11h: jr p_arg_r0 -p_arg_addr: - call p_char_lparen - ld l,(iy+001h) - ld h,(iy+002h) - ld a,001h - call sub_1d50h - -p_char_rparen: - ld a,')' - jp outchar - p_arg_r: ld a,(iy+000h) rra @@ -5319,23 +5462,21 @@ p_arg_r0: l1e4dh: call pstr ld a,(iy+001h) - and a - jp m,l1e61h - call pstr_inl - dc '+' - ld a,(iy+001h) - jr l1e6bh -l1e61h: - call pstr_inl - dc '-' - ld a,(iy+001h) + push af + rlca + ld a,'+' + jr nc,l1e61h + pop af neg -l1e6bh: - call out_hex - jr p_char_rparen + push af + ld a,'-' +l1e61h: + call outchar + pop af + jp p_arg_nn_rp p_arg_r1: - ld hl,t_BCDEHL_HL_A + ld hl,t_arg_r jr p_arg b_1e78_start: @@ -5348,10 +5489,10 @@ p_arg_hlixiy: ld hl,t_HL.IX.IY jr p_arg p_arg_zz: - ld hl,t_BC.DE.HL.AF + ld hl,t_arg_rp2 jr l1e8eh p_arg_ww: - ld hl,t_BC.DE.HL.SP + ld hl,t_arg_rp l1e8eh: ld a,(iy+000h) rra @@ -5373,8 +5514,26 @@ p_arg_cc0: ld hl,t_tstfl_ZCPS p_arg: ld b,a - call sel_dc_string - jp pstr + ;fall thru +pstr_sel: + call str_sel + ;fall thru +pstr: + ld a,(hl) + inc hl + and a + ret z + call outchar + ret m + jr pstr + +pstr_inl: + ex (sp),hl + call pstr + ex (sp),hl + ret + +;------------------------------------------------------------------------------- t_MNEMONICS: DC 'ADC' @@ -5456,7 +5615,7 @@ t_MNEMONICS: DC 'TSTIO' DB 0 -t_BCDEHL_HL_A: +t_arg_r: DC 'B' DC 'C' DC 'D' @@ -5466,13 +5625,13 @@ t_BCDEHL_HL_A: DC '(HL)' DC 'A' DB 0 -t_BC.DE.HL.SP: +t_arg_rp: DC 'BC' DC 'DE' DC 'HL' DC 'SP' DB 0 -t_BC.DE.HL.AF: +t_arg_rp2: DC 'BC' DC 'DE' t_HL.AF: @@ -5497,7 +5656,7 @@ t_IX.IY: DC 'IX' DC 'IY' DB 0 -t_tstfl_ZC: +t_arg_cc: DC 'NZ' DC 'Z' DC 'NC' @@ -5527,7 +5686,9 @@ t__C_: DC '(C)' DB 0 -sub_1ffeh: +;------------------------------------------------------------------------------- + +tc_set_bp: ld hl,(reg.pc) ld a,h or l @@ -5535,7 +5696,7 @@ sub_1ffeh: ld de,BDOS and a sbc hl,de - ld hl,l20edh + ld hl,l20edh ;set break after BDOS call jr z,l2031h ld iy,(reg.pc) call disas_get_instrlen @@ -5544,20 +5705,22 @@ sub_1ffeh: ld b,0 ld hl,(reg.pc) add hl,bc - call sub_09cah + call bp_trace_enter ld iy,(reg.pc) ld hl,b_2039_start - call lookup_opc + call lookup_op ccf ret c ex de,hl l2031h: call CALL_HL - call c,sub_09cah + call c,bp_trace_enter l2037h: scf ret +;------------------------------------------------------------------------------- + b_2039_start: db 0ffh,0ddh,000h ;Prefix DD dw l20a7h @@ -5577,20 +5740,22 @@ b_2048_start: dw l20dch db 0ffh,0cfh,000h ;rst 8 dw l2115h - db 0c7h,0c7h,000h ; + db 0c7h,0c7h,000h ;rst n dw l20f9h - db 0c7h,0c4h,000h ; + db 0c7h,0c4h,000h ;call cc,mn dw l2080h - db 0f7h,010h,000h ; + db 0f7h,010h,000h ;djnz d; jr d dw l2093h - db 0e7h,020h,000h ; + db 0e7h,020h,000h ;jr cc,d dw l2093h - db 0c7h,0c2h,000h ; + db 0c7h,0c2h,000h ;jp cc,mn dw l208bh - db 0c7h,0c0h,000h ; + db 0c7h,0c0h,000h ;ret cc dw l20c5h db 0 +;------------------------------------------------------------------------------- +; call mn call cc,mn l2080h: ld a,(b_21e2_start) and a @@ -5598,11 +5763,15 @@ l2080h: ld a,(trace_call_flag) and a ret nz + +; jp mn jp cc,mn l208bh: ld l,(iy+001h) ld h,(iy+002h) scf ret + +;jr, djnz l2093h: ld c,(iy+001h) ld a,c @@ -5615,30 +5784,39 @@ l2093h: inc hl scf ret + +; jp (hl) l20a2h: ld hl,(reg.l) scf ret + +; Prefix DD l20a7h: ld hl,(reg.ix) jr l20afh +; Prefix FD l20ach: ld hl,(reg.iy) l20afh: ld a,(iy+001h) - cp 0e9h + cp 0e9h ; jp (ix); jp (iy) scf ret z and a ret + +; Prefix ED l20b8h: ld a,(iy+001h) - cp 04dh + cp 04dh ; reti jr z,l20dch - cp 045h + cp 045h ; retn jr z,l20dch and a ret + +;ret cc l20c5h: ld a,(iy+000h) ld (l20d7h),a @@ -5656,6 +5834,7 @@ l20d7h: inc hl jp (hl) +;ret l20dch: ld a,(b_21e2_start) and a @@ -5667,15 +5846,18 @@ l20dch: pop hl ret l20edh: - ld hl,(reg_sp) + ld hl,(reg_sp) ;break on return address ld e,(hl) inc hl ld d,(hl) ex de,hl - call sub_09cah + call bp_trace_enter +;rst 8 +l2115h: and a ret +;rst n l20f9h: ld a,(l0003h) cp (iy+000h) @@ -5693,42 +5875,51 @@ l20f9h: l2113h: scf ret -l2115h: - and a - ret + +;------------------------------------------------------------------------------- +; >>C[N][J] [steps] +; >>C[N][J] W expression +; >>C[N][J] U expression +; trace over Calls [No list] [Jumps only] /.While./.Until. + cmd_C: - ld hl,cmd_C ld a,1 - jr l2122h + jr cmd_tc + +;------------------------------------------------------------------------------- +; >>T[N][J] [steps] +; >>T[N][J] W expression +; >>T[N][J] U expression +; Trace [no List] [Jumps only] / .While. / .Until. + cmd_T: xor a - ld hl,cmd_T -l2122h: +cmd_tc: ld (cmd_rpt),hl ld (trace_call_flag),a call get_char_upper sub 'N' - jr nz,l212eh + jr nz,tc_non inc de -l212eh: +tc_non: ld (trace_N_flag),a call get_char_upper sub 'J' - jr nz,l2137h + jr nz,tc_noj inc de -l2137h: +tc_noj: ld (trace_J_flag),a - call sub_21a6h - jr z,l2145h - ld hl,1 + call tc_chk_u_or_w + jr z,tc_save_uw_expr_ptr + ld hl,1 ;default: 1 step call get_lastarg_def -l2145h: - ld (trace_count),hl +tc_save_uw_expr_ptr: + ld (trace_cnt_or_ptr),hl sub a - ld (l0941h),a + ld (bp_p_cpu_flag),a l214ch: - call sub_1ffeh - jr l21a3h + call tc_set_bp + jr user_go1 l2151h: call bp_clr_temporary @@ -5739,43 +5930,44 @@ l2151h: call sub_21c8h jr z,l216bh ld hl,b_2048_start - call lookup_opc + call lookup_op jr nc,l214ch l216bh: - ld a,(trace_UW_flag) + ld a,(trace_UW_flag) ;0 or 'U' or 'W' and a - jr z,l2188h - ld de,(trace_count) + jr z,tc_cnt ;flag is 0, check for step count. + ld de,(trace_cnt_or_ptr) call expr ld a,h or l add a,0ffh sbc a,a - ld hl,trace_UW_flag + ld hl,trace_UW_flag ;'U' or 'W' xor (hl) - bit 1,a + bit 1,a ;'U' = 55H, 'W' = 57H jr z,l2193h -l2185h: - jp l0902h -l2188h: - ld hl,(trace_count) +do_break0: ;print registers and go to main loop + jp do_break + +tc_cnt: + ld hl,(trace_cnt_or_ptr) dec hl - ld (trace_count),hl + ld (trace_cnt_or_ptr),hl ld a,h or l - jr z,l2185h + jr z,do_break0 l2193h: - call sub_1ffeh - jr nc,l2185h + call tc_set_bp + jr nc,do_break0 ld a,(trace_N_flag) ld b,a - ld a,(l0941h) + ld a,(bp_p_cpu_flag) or b - ld (l0941h),a -l21a3h: + ld (bp_p_cpu_flag),a +user_go1: jp user_go -sub_21a6h: +tc_chk_u_or_w: call skipbl xor a ld (trace_UW_flag),a @@ -5813,25 +6005,27 @@ l21dah: cp 045h ret +;------------------------------------------------------------------------------- + +con_col: + db 0 + +;------------------------------------------------------------------------------- + b_21e2_start: db 0 trace_call_flag: db 0 ;1=call, 0=trace trace_UW_flag: db 0 ;0 or 'U' or 'W' -trace_count: +trace_cnt_or_ptr: dw 0 trace_N_flag: db 0 ;0 if 'N' trace_J_flag: db 0 ;0 if 'J' -;------------------------------------------------------------------------------- - -con_col: - db 0 - -l0941h: +bp_p_cpu_flag: db 0 bp_tab: @@ -5843,8 +6037,6 @@ bp_tab: expr_p1: dw expr_buf -expr_p2: - dw expr_buf expr_buf: current_cseg defl $ - current_cseg @@ -5931,6 +6123,8 @@ current_cseg defl $ ds EXPR_BUF_SIZE - ($ - expr_buf) expr_bufe: +;------------------------------------------------------------------------------- + msg_Y: dc 'Yn' reg_Y: @@ -5982,6 +6176,9 @@ disas_arg_16: disas_argtype: db 0 +pbl_loop_adr: + dw 0 + symlen_cur: ;max length of symbols read so far db 0 cur_fcb: