X-Git-Url: http://cloudbase.mooo.com/gitweb/ddt180.git/blobdiff_plain/786e99f6a0938ee6e1bce05b3b83e0cbf447f160..1190f4f040cac38f70ef6a25352b3154929d9a78:/ddt180.z80 diff --git a/ddt180.z80 b/ddt180.z80 index 2baacd9..5c13492 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,19 +75,11 @@ di_or_ei: ret ddtz_bdos: jp 0 -screen_width: - db 80 -symlen_max: - db 16 - -symattrib: - db 0 - current_cseg defl $ - current_cseg .phase current_phase + current_cseg signon: - db 'Symbolic DDTZ/180' + db 'DDTZ/180' db ' - Version ' maclib version.inc defvers @@ -135,7 +122,6 @@ reg.pc: dw TPA var.$: dw 0000h var.@: dw 0 -error_func:dw p_msg_error cmd_rpt:dw mainloop ;------------------------------------------------------------------------------- @@ -174,7 +160,6 @@ l0093h: ld hl,ddtz_base ld l,000h ld (reg_sp),hl - call cpy_fcb2 ld a,(dfcb1+1) cp ' ' ld hl,0 @@ -204,20 +189,23 @@ 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 @@ -245,23 +233,16 @@ mainloop: inc hl ld h,(hl) ld l,a - jr exe_hl -ERROR: - ld hl,(error_func) exe_hl: call CALL_HL jr mainloop ;------------------------------------------------------------------------------- -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 @@ -441,17 +422,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 @@ -511,15 +481,6 @@ toupper: and 05fh ret -tolower: - cp 'A' - ret c - cp 'Z'+1 - ccf - ret c - or 020h - ret - ;------------------------------------------------------------------------------- skipbl0: @@ -574,86 +535,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: @@ -1124,37 +1005,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: @@ -1239,59 +1101,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: @@ -1674,12 +1483,8 @@ l07cdh: ld l,(ix+002h) ld h,(ix+003h) call out.hl.@ - call outbl - call p_symbol - ld c,9 - call p_align_@_sym call pstr_inl - dc ':' + dc ' :' ld l,(ix+004h) ld h,(ix+005h) call out_hl @@ -2075,53 +1880,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 @@ -2527,18 +2285,12 @@ 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 @@ -2568,56 +2320,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] @@ -2873,16 +2580,8 @@ l0fb6h: ld de,dfcb1 call parse_filename ld de,dfcb2 - call parse_filename ;fall thru -cpy_fcb2: - ld hl,dfcb2 - ld de,fcbsym - ld bc,16 - ldir - ret - parse_filename: call sub_102ch push de @@ -3110,35 +2809,15 @@ hex_digit_v: error2: jp ERROR -read_hexbyte: - call read_byte -read_hexbyte0: - push bc - call hex_digit_v - rlca - rlca - rlca - rlca - ld c,a - call read_byte - call hex_digit_v - or c - pop bc - ret - ;------------------------------------------------------------------------------- ; > R [displacement] -; Read a binary or hex file and or symbol file [add displacement] +; Read a binary or hex file [add displacement] cmd_R: ld hl,0 call get_lastarg_def read_file: - ld de,dfcb1+1 - ld a,(de) - cp '?' - jr z,read_symfile - dec de + ld de,dfcb1 push hl ld hl,0 ld (high_load),hl @@ -3156,7 +2835,7 @@ l108eh: call read_sector jr nz,read_file_nxt pop hl - jr read_symfile + jp p_max_high read_file_nxt: ld de,DMA_BUF @@ -3200,163 +2879,12 @@ l10cch: call read_hexchar ; CHKSUM ld a,c and a - jr nz,error3 + jp nz,ERROR jr l10aeh rdhex_done: pop hl - jr read_symfile - -read_symfile: - ld de,fcbsym+1 - ld a,(de) - cp ' ' - jp z,p_max_high - - push hl ; offset - call pstr_inl - db 'SYMBOLS',CR,LF+80h + jp p_max_high - dec de - call file_open - ld a,(symattrib) - ld c,a -rs_1: - call read_byte -rs_2: - pop de ; offset - cp 1ah - jp z,p_max_high - push de ; offset - cp '!' - jr c,rs_1 - call read_hexbyte0 ; symval H - ld h,a - call read_hexbyte ; symval L - ld l,a - add hl,de - call read_byte - cp ' ' - jr z,rs_4 -rs_3: call read_byte - cp ' ' - jr nc,rs_3 - jr rs_2 - -rs_4: - push hl ; symval - ld hl,(BDOS+1) ; - ld b,0 ; setup symlen -rs_5: - dec hl ; - call read_byte ; next char of symbol name - call test_sym_char ; valid char? - jr nz,rs_6 - bit SYMCASE_CONV,c - jr z,rs_51 - call toupper - bit SYMCASE_LOWER,c - call nz,tolower -rs_51: - ld (hl),a ; - inc b ; symlen++ - ld a,(symlen_max) ; - cp b ; - jr nc,rs_5 ; -error3: - jp ERROR ; - -rs_6: - call test_symterm_ch - jr nz,error3 - - push bc ; symlen - ex de,hl ; - ld hl,(BDOS+1) ; - inc hl ; - ld c,(hl) ; - inc hl ; - ld b,(hl) ; - ex de,hl - ld (hl),b ; - dec hl ; - ld (hl),c ; - dec hl ; - ld (hl),0c3h ; - - ld de,(max_load) ; - call cp_hl_de ; - jr c,error3 ; - ld de,(reg_sp) ; - call cp_hl_de ; - jr nc,rs_61 ; - ld (reg_sp),hl ; -rs_61: - ld de,(BDOS+1) ; - ld (BDOS+1),hl ; - ex de,hl ; - pop bc ; symlen - ld (hl),b ; - inc hl ; - pop de ; symval - ld (hl),e ; - inc hl ; - ld (hl),d ; - ld a,b ; - ld hl,symlen_cur ; - cp (hl) ; new max? - jr c,$+3 ; - ld (hl),a ; - jp rs_1 ; - - -; 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_symterm_ch: - cp CR - ret z - cp LF - ret z test_whitespace: cp ' ' ret z @@ -3522,7 +3050,6 @@ cmdl_p_line: ret p_disas_line: - call p_label call outbl2 call out.hl.@ call z,outbl @@ -3536,10 +3063,7 @@ p_disas_line: ld c,15 call p_goto_col - call p_offset - call outbl - jp p_symbol - + ; fall thru ;------------------------------------------------------------------------------- p_offset: @@ -4969,13 +4493,6 @@ expr_bufe: ;------------------------------------------------------------------------------- -msg_Y: - dc 'Yn' -reg_Y: - rept YREG_CNT - dw 0 - endm - last_S: dw TPA @@ -5013,12 +4530,8 @@ disas_argtype: pbl_loop_adr: dw 0 -symlen_cur: ;max length of symbols read so far - db 0 cur_fcb: dw 0 -fcbsym: - ds 33 ddtz_size equ $-ddtz_base ddtz_end: