X-Git-Url: http://cloudbase.mooo.com/gitweb/ddt180.git/blobdiff_plain/35b535f6ac49b6533a60236bb2cd9f46f2c79c88..c18ba81991314d10f95b00051fd1e3fbcebc8e48:/ddt180.z80 diff --git a/ddt180.z80 b/ddt180.z80 index 0890182..3a445c3 100644 --- a/ddt180.z80 +++ b/ddt180.z80 @@ -29,32 +29,21 @@ current_cseg defl $ ; Some greneral definitions -TAB equ 9 -LF equ 10 -CR equ 13 +BS equ 08h +TAB equ 09h +CR equ 0dh +LF equ 0ah +DEL equ 7fh +CNTRX equ 'X'-'@' ; CP/M memory layout BDOS equ 5 -dfcb1 equ 05ch -dfcb2 equ 06ch -DMA_BUF equ 080h TPA equ 0100h ; BDOS function calls -BDOS_CIN equ 1 ;Console Input -BDOS_COUT equ 2 ;Console Output BDOS_PSTR equ 9 ;Print String -BDOS_CBUF equ 10 ;Read Console Buffer -BDOS_CSTAT equ 11 ;Get Console Status -BDOS_OPEN equ 15 ;Open File -BDOS_CLOSE equ 16 ;Close File -BDOS_DELETE equ 19 ;Delete File -BDOS_READ equ 20 ;Read Sequential -BDOS_WRITE equ 21 ;Write Sequential -BDOS_CREATE equ 22 ;Make File -BDOS_SETDMA equ 26 ;Set DMA Address ; ddtz specific definitions @@ -62,7 +51,7 @@ 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 -BP_SIZE equ 8 ;Size of a breakpoint record +BP_SIZE equ 4 ;Size of a breakpoint record ;------------------------------------------------------------------------------- @@ -157,24 +146,44 @@ l0093h: ld hl,ddtz_base ld l,000h ld (reg_sp),hl - ld a,(dfcb1+1) - cp ' ' - ld hl,0 - call nz,read_file + + ld hl,(1) ;wboot addr + ld de,?const + ld b,6 +vini_l: + inc hl + inc hl + inc hl + ex de,hl + inc hl + ld (hl),e + inc hl + ld (hl),d + inc hl + ex de,hl + djnz vini_l + jr mainloop ds CONBUF_SIZE + 3 - ($ - conbuf) ;------------------------------------------------------------------------------- +?const: jp 0 ; return console input status +?conin: jp 0 ; return console input character +?cono: jp 0 ; send console output character +?list: jp 0 ; send list output character +?auxo: jp 0 ; send auxiliary output character +?auxi: jp 0 ; return auxiliary input character + CMDTAB: 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 + dw ERROR ;cmd_C ;trace over Calls dw cmd_D ;Display memory in hex and ascii dw ERROR ; - dw cmd_F ;specify Filename and command line + dw ERROR ;cmd_F ;specify Filename and command line dw cmd_G ;Go dw cmd_H ;compute Hex and other expressions dw cmd_I ;Input a byte from port @@ -191,7 +200,7 @@ CMDTAB: dw cmd_T ;Trace dw ERROR ; dw cmd_V ;Verify (compare) two memory areas - dw cmd_W ;Write a file to disk + dw ERROR ;cmd_W ;Write a file to disk dw cmd_X ;eXamine [and substitute] registers dw ERROR ;cmd_Y ;examine [and substitute] Y variables dw cmd_Z ;Zap (fill) memory with a byte string @@ -208,6 +217,7 @@ mainloop: call bp_clr_temporary ld hl,(cmd_rpt) ld de,mainloop + push de call cp_hl_de ld a,'>' call outchar @@ -216,7 +226,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 '@' @@ -230,19 +241,17 @@ mainloop: inc hl ld h,(hl) ld l,a - exe_hl: - call CALL_HL - jr mainloop + jp (hl) ;------------------------------------------------------------------------------- crlf: call pstr_inl dc CR,LF - call inchar - ld a,0 + xor a ld (con_col),a + call inchar jr c,mainloop ret @@ -371,9 +380,8 @@ outchar: push bc push af and 07fh - ld e,a - ld c,BDOS_COUT - call ddtz_bdos + ld c,a + call ?cono ld hl,con_col inc (hl) pop af @@ -390,7 +398,6 @@ pstr: and a ret z call outchar - and a ret m jr pstr @@ -410,41 +417,114 @@ p_goto_col: ;------------------------------------------------------------------------------- +incharw: + call inchar + jr nc,incharw + ret + +;------------------------------------------------------------------------------- + inchar: push ix push hl push de push bc - ld c,BDOS_CSTAT - call ddtz_bdos + call ?const and a - jr z,l0284h - ld c,BDOS_CIN - call ddtz_bdos + jr z,inch1 + call ?conin scf -l0284h: +inch1: pop bc pop de pop hl pop ix ret +;------------------------------------------------------------------------------- + +DELC: + ld a,b + or a + ret z + call DELC1 + dec hl + dec b + inc c + ld a,(hl) + cp ' ' + ret nc +DELC1: + call pstr_inl + dc BS,' ',BS + ret + +DELL: + ld a,b ; + or a ; + ret z ; + call DELC ; + jr DELL ; + +;------------------------------------------------------------------------------- + get_line: - push hl - ld de,conbuf - ld c,BDOS_CBUF - call ddtz_bdos - call crlf - ld hl,conbuf+1 - ld e,(hl) - xor a - ld d,a + push hl ; + ld hl,conbuf ; + ld c,(hl) ; + inc hl ; + ld b,000h ; + inc hl ; +inlnxtch: + ld a,c ; + or a ; + jr z,inl_e ; + call incharw ; + cp CR ; + jr z,inl_e ;Accept line + cp LF ; + jr z,inl_e ;Accept line + + cp BS ; + jr z,gl_1 ; + cp DEL ; + jr nz,gl_2 ; +gl_1: + call DELC ;Delete Char + jr inlnxtch ; +gl_2: + cp CNTRX ; + jr nz,gl_3 ; + call DELL ;Delete Line + jr inlnxtch ; +gl_3: + cp TAB ; + jr nz,gl_4 ; + ld a,' ' ; +gl_4: + ld (hl),a ; + cp ' ' ; + jr nc,gl_5 ; + ld a,'^' ;Controll characters + call outchar ; + ld a,(hl) ; + add a,'@' ; +gl_5: + call outchar ; + inc hl ; + inc b ; + dec c ; + jr inlnxtch ; + +inl_e: + ld (hl),0 + ld hl,conbuf+1 ; + ld (hl),b ; + call CRLF ; inc hl ex de,hl - add hl,de - ld (hl),a - pop hl - ret + pop hl ; + ret ; ;------------------------------------------------------------------------------- @@ -465,17 +545,20 @@ skipbl0: inc de skipbl: call get_char_upper - call test_whitespace + cp ' ' + jr z,skipbl0 + cp TAB jr z,skipbl0 or a ret +;------------------------------------------------------------------------------- + next_arg: call skipbl cp ',' ret nz - inc de - call skipbl + call skipbl0 cp a ret @@ -1189,6 +1272,7 @@ p_cpustat: l063eh: call p_regs djnz l063eh + call outbl6 push hl push de ld iy,(reg.pc) @@ -1261,12 +1345,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: @@ -1329,7 +1407,6 @@ b_0709_start: cmd_G: sub a - ld (trace_call_flag),a ld (bp_p_cpu_flag),a call expr jr c,l0740h @@ -1374,7 +1451,6 @@ bp_clr_temporary: ld a,(ix+000h) and 0f1h ld (ix+000h),a - call bp_clr_condition call bpl_next ret @@ -1386,11 +1462,10 @@ bp_clr_temporary: ; set breakpoints ; > BX ; clear all breakpoints -; > BX address [address..] +; > BX breakp [breakp..] ; clear breakpoints ; -; where breakp is: -; [R] expression [I condition] +; breakp can be any valid expression cmd_B: call skipbl @@ -1427,45 +1502,27 @@ bp_clr: jr nz,l07aeh l07a7h: ld (ix+000h),000h - call bp_clr_condition l07aeh: pop af call bpl_next ret bp_print: + ld c,0 call bpl_init bit 0,(ix+000h) jr z,bp_pr_cont - ld a,'R' - bit 4,(ix+000h) - jr nz,l07cdh - ld a,' ' -l07cdh: - call outchar - call outbl ld l,(ix+002h) ld h,(ix+003h) call out_hl - call pstr_inl - dc ' :' - ld l,(ix+004h) - ld h,(ix+005h) - call out_hl - ld l,(ix+006h) - ld h,(ix+007h) - ld a,h - or l - jr z,l0805h - call outbl4 - call pstr_inl - dc 'I ' - call pstr -l0805h: - call crlf + call outbl2 + inc c bp_pr_cont: call bpl_next + ld a,c + or a + call nz,crlf ret ;------------------------------------------------------------------------------- @@ -1477,11 +1534,7 @@ bp_enter: ld b,a call skipbl ret z - cp 'R' - jr nz,bp_e_1 - inc de - set 4,b -bp_e_1: + push bc call expr jr c,error12 @@ -1496,12 +1549,6 @@ bp_e_1: pop de ld (ix+002h),l ld (ix+003h),h - call bp_get_count - ld (ix+004h),l - ld (ix+005h),h - call bp_get_condition - ld (ix+006h),l - ld (ix+007h),h call next_arg pop af ld (ix+000h),a @@ -1519,48 +1566,6 @@ bp_get_freeslot: error12 jp ERROR -bp_get_count: - call skipbl - ld hl,1 - cp ':' - ret nz - inc de - call expr - jr c,error12 - ret - -bp_get_condition: - call skipbl - cp 'I' - ld hl,0 - ret nz - inc de - call skipbl - push de - call expr - jr c,error12 - ex de,hl - pop de - push de - sbc hl,de - ld b,h - ld c,l - ld hl,(expr_p1) - push hl - add hl,bc - ld de,expr_bufe - call cp_hl_de - jr nc,error12 - pop de - pop hl - push de - ldir - ex de,hl - ld (hl),c ; trailing 0 - inc hl - ld (expr_p1),hl - pop hl - ret ;------------------------------------------------------------------------------- ; Breakpoint handling routine. @@ -1628,46 +1633,14 @@ sub_0913h: ld d,(ix+003h) ld hl,(reg.pc) call cp_hl_de - push bc - call z,sub_0942h - pop bc -l0938h: - - call bpl_next - ex af,af' - ret - -sub_0942h: + jr nz,l0938h ex af,af' res 7,a - ex af,af' - ld e,(ix+006h) - ld d,(ix+007h) - ld a,d - or e - ld hl,0ffffh - call nz,expr - ld a,h - or l - jr z,l0969h - ld e,(ix+004h) - ld d,(ix+005h) - dec de - ld a,d - or e - jr z,l0974h - ld (ix+004h),e - ld (ix+005h),d -l0969h: - bit 4,(ix+000h) - ret z - ld a,001h - ld (bp_p_cpu_flag),a - ret -l0974h: - ex af,af' or (ix+000h) ex af,af' +l0938h: + call bpl_next + ex af,af' ret bp_restore_mem: @@ -1708,12 +1681,8 @@ bp_tst_e: bp_trace_enter: call bp_get_freeslot - ld (ix+004h),001h - ld (ix+005h),000h ld (ix+002h),l ld (ix+003h),h - ld (ix+006h),000h - ld (ix+007h),000h ld a,(b_21e2_start) and a ld a,008h @@ -1785,60 +1754,6 @@ l0a41h: ld sp,(reg_sp) jp reg.iff -;------------------------------------------------------------------------------- - -bp_clr_condition: - ld a,(ix+000h) - and 003h - ret nz - ld e,(ix+006h) - ld d,(ix+007h) - ld a,d - or e - ret z - push bc - ld h,d - ld l,e - sub a - ld (ix+006h),a - ld (ix+007h),a - ld bc,0ffffh - cpir -l0a7dh: - push de - ld de,(expr_p1) - call cp_hl_de - pop de - jr nc,l0a93h - call sub_0a99h -l0a8bh: - ld a,(hl) - ldi - and a - jr nz,l0a8bh - jr l0a7dh -l0a93h: - ld (expr_p1),de - pop bc - ret - -sub_0a99h: - ld iy,bp_tab - push de -l0a9eh: - ld e,(iy+006h) - ld d,(iy+007h) - call cp_hl_de - jr z,l0ab0h - ld de,BP_SIZE - add iy,de - jr l0a9eh -l0ab0h: - pop de - ld (iy+006h),e - ld (iy+007h),d - ret - ;------------------------------------------------------------------------------- ; > Y ; examine all Y variables @@ -1869,7 +1784,6 @@ cmd_X: ex de,hl ld hl,t_reg_names call sel_dc_string -l0c12h: call l0c33h call outbl @@ -2130,7 +2044,6 @@ l0d8ah: ; Input a byte from port cmd_I: - ld hl,cmd_I ld (cmd_rpt),hl ld hl,(last_I) call get_lastarg_def @@ -2150,7 +2063,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 @@ -2194,29 +2106,17 @@ 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] +; > M startaddr endaddr destaddr +; Move memory cmd_M: - call get_char_upper - cp 'V' - jr nz,l0e1fh - inc de -l0e1fh: - push af call sub_034eh - push hl - push de - push bc call cp_hl_de jr nc,cmdm_up add hl,bc @@ -2229,11 +2129,6 @@ l0e1fh: db 01h ;swallow ldir instruction (ld bc,...) cmdm_up: ldir - pop bc - pop de - pop hl - pop af - jr z,l0dedh ret ;------------------------------------------------------------------------------- @@ -2242,30 +2137,11 @@ cmdm_up: ; off all loaded files, and Top address of available memory ; > 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 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 @@ -2285,32 +2161,31 @@ l0e5eh: ; Query memory for a byte string [Justified] cmd_Q: - call get_char_upper - sub 'J' - ld (cmd_Q_jopt),a - jr nz,l0e8dh - inc de -l0e8dh: call get_arg_range push bc push hl call sub_0ee6h pop hl l0e96h: - call sub_0ed7h + push hl + push de + push bc +l0edah: + ld a,(de) + cp (hl) + jr nz,l0ee2h + inc de + inc hl + djnz l0edah +l0ee2h: + pop bc + pop de + pop hl jr nz,l0eb0h push bc - push hl - ld a,(cmd_Q_jopt) - or a - jr nz,l0ea7h - ld bc,-8 - add hl,bc -l0ea7h: ld bc,16 - and a + and a ;clear carry call sub_0f58h - pop hl pop bc l0eb0h: inc hl @@ -2349,23 +2224,6 @@ l0ed3h: pop hl ret -sub_0ed7h: - push hl - push de - push bc -l0edah: - ld a,(de) - cp (hl) - jr nz,l0ee2h - inc de - inc hl - djnz l0edah -l0ee2h: - pop bc - pop de - pop hl - ret - sub_0ee6h: ld hl,conbuf+1 call sub_0ef7h @@ -2376,26 +2234,13 @@ sub_0ee6h: ret nz jp ERROR -sub_0ef7h: - db 0e6h ; and 037h (clear carry) -sub_0ef8h: +sub_0ef7h: ;from cmd_Q, cmd_Z + db 0e6h ;and 037h (clear carry) +sub_0ef8h: ;from cmd_S scf l0ef9h: push af call next_arg - cp 'W' - jr nz,l0f0eh - inc de - push hl - call sub_035dh - ex de,hl - ex (sp),hl - ld (hl),e - inc hl - ld a,d - pop de - jr l0f1ah -l0f0eh: cp '''' jr z,l0f1eh push hl @@ -2445,7 +2290,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 @@ -2458,8 +2302,7 @@ sub_0f58h: push af l0f5ch: call out_hl - call z,outbl2 - call outbl + call outbl2 ld de,0 l0f68h: ld a,(hl) @@ -2516,201 +2359,89 @@ l0fach: ; > Fcommandline ; specifiy filenames and command line -cmd_F: +;cmd_F: + +;------------------------------------------------------------------------------- +; > R [displacement] +; Read Intel Hex File from console [add displacement] + +cmd_R: + ld hl,0 + call get_lastarg_def ;get offset from command line + push hl + ld hl,0 + ld (high_load),hl +w_recstart: + call i.getchar + jr z,rdhex_done + cp ':' + jr nz,w_recstart + ld c,0 ;init checksum + call i.gethexbyte ;record len + ld b,a + call i.gethexbyte ;address high + ld h,a + call i.gethexbyte ;address low + ld l,a + call i.gethexbyte ;record type (ignored) + ld a,b + and a ;record len == 0? + jr z,rdhex_done +l16c6h: + call i.gethexbyte + pop de ;offset push de - ld hl,DMA_BUF+1 - ld (hl),' ' + push hl + add hl,de + call i.storebyte + pop hl inc hl -l0fb6h: - call get_char_upper - ld (hl),a - inc hl - inc de + djnz l16c6h ;repeat for record len + call i.gethexbyte ;checksum + ld a,c and a - jr nz,l0fb6h - ld a,l - sub DMA_BUF+2 - ld (DMA_BUF),a + jp nz,ERROR ;exit if checksum error + jr w_recstart ;next record +rdhex_done: pop hl - ld de,dfcb1 - call parse_filename - ld de,dfcb2 - ;fall thru - -parse_filename: - call sub_102ch - push de - push bc - ld b,(hl) - inc hl - ld a,(hl) - cp ':' - jr nz,l0fe1h - inc hl - ld a,b - sub 040h - and 01fh - jr l0fe3h -l0fe1h: - dec hl - xor a -l0fe3h: - ld (de),a - inc de - ld b,8 - call sub_0ff2h - ld b,3 - call sub_0ff2h - pop bc - pop de - ret - -sub_0ff2h: - call sub_1012h - jr z,l0ffeh - inc hl - ld (de),a - inc de - djnz sub_0ff2h - jr l1003h -l0ffeh: - ld a,c -l0fffh: - ld (de),a - inc de - djnz l0fffh -l1003h: - call sub_1012h - inc hl - jr nz,l1003h - cp '*' - jr z,l1003h - cp '.' - ret z - dec hl - ret - -sub_1012h: - ld a,(hl) - ld c,' ' - and 01fh - ret z - ld a,(hl) - cp ' ' - ret z - call sub_1043h - ret z - cp '/' - ret z - cp '.' - ret z - ld c,'?' - call toupper - cp '*' - ret - -l102bh: - inc hl -sub_102ch: - ld a,(hl) - cp '/' - jr z,l103bh - call sub_1043h - jr z,l102bh -l1036h: - cp ' ' - jr z,l102bh - ret - -l103bh: - ld a,(hl) - cp ' '+1 - jr c,l1036h - inc hl - jr l103bh - -sub_1043h: - cp '=' - ret z - cp '_' - ret z - cp ',' - ret - -;------------------------------------------------------------------------------- + call i.gethexbyte + jp p_max_high -setup_fcb: - push de - ld hl,12 - add hl,de - xor a - ld b,21 -l1052h: - ld (hl),a - inc hl - djnz l1052h - ld de,DMA_BUF - ld c,BDOS_SETDMA - call ddtz_bdos - pop de +i.gethexbyte: + call sub_16f6h + rlca + rlca + rlca + rlca + ld d,a + call sub_16f6h + add a,d + ld d,a + add a,c + ld c,a + ld a,d ret -;------------------------------------------------------------------------------- - -file_open: - ld (cur_fcb),de - call setup_fcb - ld c,BDOS_OPEN - call ddtz_bdos - inc a - jp z,ERROR - ld a,080h - ld (cmdR_rindex),a - ret +sub_16f6h: + call i.getchar + jr z,error2 + call hex_digit + ret nc +error2: + jp ERROR -read_byte: - ld a,(cmdR_rindex) - cp 080h - jr nz,l1111h - call read_sector - ld a,01ah - ret z - sub a -l1111h: - inc a - ld (cmdR_rindex),a - push hl - add a,07fh - ld l,a - ld h,000h - ld a,(hl) - pop hl +i.getchar: + call incharw cp 01ah ret -read_sector: - push hl - push de - push bc - ld de,(cur_fcb) - ld c,BDOS_READ - call ddtz_bdos - sub a,1 - jr z,l1132h - jr nc,error2 -l1132h: - pop bc - pop de - pop hl - ret - -cmdR_storebyte: +i.storebyte: push af push de - ld de,TPA + ld de,TPA ;lowest allowed load address call cp_hl_de jr c,error2 - ld de,(BDOS+1) + ld de,(BDOS+1) ;highest allowed load address call cp_hl_de jr nc,error2 ld de,(high_load) @@ -2725,125 +2456,7 @@ l1157h: l1163h: pop de pop af - ld (hl),a - ret - -strncmp: - ld a,(de) - cp (hl) - inc de - inc hl - ret nz - djnz strncmp - ret - -str_hex: - db 'HEX' - -read_hexchar: - call read_hexdigit - rlca - rlca - rlca - rlca - ld d,a - call read_hexdigit - add a,d - ld d,a - add a,c - ld c,a - ld a,d - ret - -read_hexdigit: - call read_byte - jr z,error2 -hex_digit_v: - call hex_digit - ret nc -error2: - jp ERROR - -;------------------------------------------------------------------------------- -; > R [displacement] -; Read a binary or hex file [add displacement] - -cmd_R: - ld hl,0 - call get_lastarg_def -read_file: - ld de,dfcb1 - push hl - ld hl,0 - ld (high_load),hl - call file_open - ld hl,dfcb1+9 - ld de,str_hex - ld b,3 - call strncmp - pop hl - jr z,read_hexfile - ld de,TPA - push hl - add hl,de -l108eh: - call read_sector - jr nz,read_file_nxt - pop hl - jp p_max_high - -read_file_nxt: - ld de,DMA_BUF - ld b,080h -l109ah: - ld a,(de) - call cmdR_storebyte - inc de - inc hl - djnz l109ah - jr l108eh - -read_hexfile: - push hl -l10aeh: - call read_byte ; RECORD MARK - jr z,rdhex_done - cp ':' - jr nz,l10aeh - ld c,0 - call read_hexchar ; RECLEN - ld b,a - call read_hexchar ; LOAD ADDR H - ld h,a - call read_hexchar ; LOAD ADDR L - ld l,a - ld a,b - and a - jr z,rdhex_done - call read_hexchar ; RECTYP -l10cch: - call read_hexchar ; DATA - pop de - push de - push hl - add hl,de - call cmdR_storebyte - pop hl - inc hl - djnz l10cch - call read_hexchar ; CHKSUM - ld a,c - and a - jp nz,ERROR - jr l10aeh -rdhex_done: - pop hl - jp p_max_high - -test_whitespace: - cp ' ' - ret z - cp TAB + ld (hl),a ;store byte ret ;------------------------------------------------------------------------------- @@ -2869,66 +2482,7 @@ p_max_high: ; > Wstartaddr endaddr ; Write a file to disk -cmd_W: - call get_arg_range - call assert_eol - push hl - ld a,c - add a,07fh - jr nc,l11adh - inc b -l11adh: - and 080h - ld c,a - push bc - ld a,(dfcb1+1) - cp ' ' - jr z,error4 - ld de,dfcb1 - call setup_fcb - push de - ld c,BDOS_DELETE - call ddtz_bdos - pop de - ld c,BDOS_CREATE - call ddtz_bdos - inc a - jr z,error4 - pop bc - pop hl -l11cch: - ld a,b - or c - jr z,close_file - push bc - ld de,080h ; DMA_BUF - ld b,d - ld c,e - ldir - call write_sector - ex (sp),hl - ld bc,0ff80h - add hl,bc - ex (sp),hl - pop bc - jr l11cch - -write_sector: - push hl - ld de,dfcb1 - ld c,BDOS_WRITE - call ddtz_bdos - pop hl - and a - ret z - call close_file -error4: - jp ERROR - -close_file: - ld de,dfcb1 - ld c,BDOS_CLOSE - jp ddtz_bdos +;cmd_W: ;------------------------------------------------------------------------------- ; > A [startaddr] @@ -2959,7 +2513,6 @@ l1773h: ; List disassembled code cmd_L: - ld hl,cmd_L ld (cmd_rpt),hl call expr jr nc,l18dbh @@ -4011,7 +3564,7 @@ tc_set_bp: 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 @@ -4072,12 +3625,6 @@ b_2048_start: ;------------------------------------------------------------------------------- ; call mn call cc,mn l2080h: - ld a,(b_21e2_start) - and a - jr nz,l208bh - ld a,(trace_call_flag) - and a - ret nz ; jp mn jp cc,mn l208bh: @@ -4147,17 +3694,8 @@ l20d7h: jp (hl) l20dch: - ld a,(b_21e2_start) - and a - jr nz,l20edh - ld a,(trace_call_flag) - and a - jr z,l20edh - call l20edh - pop hl - ret l20edh: - ld hl,(reg_sp) + ld hl,(reg_sp) ;break on return address ld e,(hl) inc hl ld d,(hl) @@ -4177,11 +3715,8 @@ l20f9h: ld h,000h ld a,(b_21e2_start) and a - jr nz,l2113h - ld a,(trace_call_flag) - and a - ret nz -l2113h: + ret z + scf ret @@ -4191,10 +3726,6 @@ l2113h: ; >>C[N][J] U expression ; trace over Calls [No list] [Jumps only] /.While./.Until. -cmd_C: - ld hl,cmd_C - ld a,1 - jr cmd_tc ;------------------------------------------------------------------------------- ; >>T[N][J] [steps] @@ -4203,119 +3734,31 @@ cmd_C: ; Trace [no List] [Jumps only] / .While. / .Until. cmd_T: - xor a - ld hl,cmd_T -cmd_tc: ld (cmd_rpt),hl - ld (trace_call_flag),a - call get_char_upper - sub 'N' - jr nz,tc_non - inc de -tc_non: - ld (trace_N_flag),a - call get_char_upper - sub 'J' - jr nz,tc_noj - inc de -tc_noj: - ld (trace_J_flag),a - call tc_chk_u_or_w - jr z,tc_save_uw_expr_ptr ld hl,1 ;default: 1 step call get_lastarg_def -tc_save_uw_expr_ptr: ld (trace_cnt_or_ptr),hl sub a ld (bp_p_cpu_flag),a -l214ch: call tc_set_bp jr user_go1 l2151h: call bp_clr_temporary - ld a,(trace_J_flag) - and a - jr nz,l216bh - ld iy,(reg.pc) - call sub_21c8h - jr z,l216bh - ld hl,b_2048_start - call lookup_opc - jr nc,l214ch -l216bh: - ld a,(trace_UW_flag) ;0 or 'U' or 'W' - and a - 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 ;'U' or 'W' - xor (hl) - bit 1,a ;'U' = 55H, 'W' = 57H - jr z,l2193h -do_break0: ;print registers and go to main loop - jp do_break - -tc_cnt: ld hl,(trace_cnt_or_ptr) dec hl ld (trace_cnt_or_ptr),hl ld a,h or l - jr z,do_break0 -l2193h: + jp z,do_break + call tc_set_bp - jr nc,do_break0 - ld a,(trace_N_flag) - ld b,a - ld a,(bp_p_cpu_flag) - or b + jp nc,do_break + sbc a,a ld (bp_p_cpu_flag),a user_go1: jp user_go -tc_chk_u_or_w: - call skipbl - xor a - ld (trace_UW_flag),a - call get_char_upper - cp 'U' - jr z,l21b5h - cp 'W' - ret nz -l21b5h: - inc de - push af - push de - call expr - jp c,ERROR - call assert_eol - pop hl - pop af - ld (trace_UW_flag),a - sub a - ret - -sub_21c8h: - ld a,(iy+000h) - cp 0edh - jr z,l21dah - and 0dfh - cp 0ddh - ret nz - ld a,(iy+001h) - cp 0e9h - ret -l21dah: - ld a,(iy+001h) - and 0f7h - cp 045h - ret - ;------------------------------------------------------------------------------- con_col: @@ -4325,16 +3768,8 @@ con_col: 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_cnt_or_ptr: dw 0 -trace_N_flag: - db 0 ;0 if 'N' -trace_J_flag: - db 0 ;0 if 'J' bp_p_cpu_flag: db 0 @@ -4346,9 +3781,6 @@ bp_tab: endm endm -expr_p1: - dw expr_buf - expr_buf: current_cseg defl $ - current_cseg .phase current_phase + current_cseg @@ -4447,15 +3879,9 @@ last_O_addr: last_O_val: db 0 -cmd_Q_jopt: - db -1 - last_D: dw TPA -cmdR_rindex: - db 0 - high_load: dw TPA max_load: @@ -4473,9 +3899,6 @@ disas_argtype: pbl_loop_adr: dw 0 -cur_fcb: - dw 0 - ddtz_size equ $-ddtz_base ddtz_end: