X-Git-Url: http://cloudbase.mooo.com/gitweb/ddt180.git/blobdiff_plain/4a39ae180ee23038b2eb0d1e574e85c341bff50b..1190f4f040cac38f70ef6a25352b3154929d9a78:/ddt180.z80 diff --git a/ddt180.z80 b/ddt180.z80 index 220c074..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 @@ -187,7 +172,7 @@ l0093h: CMDTAB: dw cmd_@ ;examine/substitute the displacement register @ - dw cmd_A ;Assemble + dw ERROR ;cmd_A ;Assemble dw cmd_B ;Breakpoints display/set/clear dw cmd_C ;trace over Calls dw cmd_D ;Display memory in hex and ascii @@ -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 - - 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 + jp p_max_high -test_symterm_ch: - cp CR - ret z - cp LF - ret z test_whitespace: cp ' ' ret z @@ -3451,918 +2979,16 @@ close_file: ; > A [startaddr] ; Assemble Zilog Z180 mnemonics -cmd_A: - ld hl,(last_A) - call get_lastarg_def - ld (last_A),hl - ld (cmd_A_prev),hl - ld hl,cmda_restart - ld (error_func),hl - ld (l1262h),sp -cmda_loop: - ld hl,(last_A) - ld (var.$),hl - push hl - call p_disas_line - ld c,19 - call p_align_@_sym - ld c,b - push bc - call get_line - pop bc - pop hl - call skipbl - cp '.' - ret z - cp '-' - jr nz,l124bh - ld hl,(cmd_A_prev) - jr cmda_lpend -l124bh: - push hl - pop iy - push hl - and a - call nz,asemble_line - ld b,0 - pop hl - ld (cmd_A_prev),hl - add hl,bc -cmda_lpend: - ld (last_A),hl - jr cmda_loop - -cmda_restart: - call p_msg_error - ld sp,(l1262h) - jr cmda_loop +;cmd_A: -asemble_line: - call skipbl - ld hl,t_MNEMONICS - call sub_030ah - jr nc,error4 - call skipbl - push de - ld a,b - add a,b - add a,b - ld hl,b_1289_start - call add_hl_a - ld e,(hl) - inc hl - ld d,(hl) - inc hl - ld b,(hl) - ex de,hl - pop de CALL_HL: jp (hl) ;------------------------------------------------------------------------------- -b_1289_start: - dw as.ADC_SBC ;ADC - db 088h ; - dw as.ADD ;ADD - db 080h ; - dw as.AND_CP_OR_SUB_XOR ;AND - db 0a0h ; - dw as.BITOP ;BIT - db 040h ; - dw as.CALL ;CALL - db 0c4h ; - dw as.opc.noarg ;CCF - db 03fh ; - dw as.AND_CP_OR_SUB_XOR ;CP - db 0b8h ; - dw gen.opc.ED2 ;CPD - db 0a9h ; - dw gen.opc.ED2 ;CPDR - db 0b9h ; - dw gen.opc.ED2 ;CPI - db 0a1h ; - dw gen.opc.ED2 ;CPIR - db 0b1h ; - dw as.opc.noarg ;CPL - db 02fh ; - dw as.opc.noarg ;DAA - db 027h ; - dw as.DEC_INC ;DEC - db 005h ; - dw as.opc.noarg ;DI - db 0f3h ; - dw as.DJNZ ;DJNZ - db 010h ; - dw as.opc.noarg ;EI - db 0fbh ; - dw as.EX ;EX - db 0e3h ; - dw as.opc.noarg ;EXX - db 0d9h ; - dw as.opc.noarg ;HALT - db 076h ; - dw as.IM ;IM - db 046h ; - dw as.IN ;IN - db 040h ; - dw as.DEC_INC ;INC - db 004h ; - dw gen.opc.ED2 ;IND - db 0aah ; - dw gen.opc.ED2 ;INDR - db 0bah ; - dw gen.opc.ED2 ;INI - db 0a2h ; - dw gen.opc.ED2 ;INIR - db 0b2h ; - dw as.JP ;JP - db 0c2h ; - dw as.JR ;JR - db 020h ; - dw as.LD ;LD - db 040h ; - dw gen.opc.ED2 ;LDD - db 0a8h ; - dw gen.opc.ED2 ;LDDR - db 0b8h ; - dw gen.opc.ED2 ;LDI - db 0a0h ; - dw gen.opc.ED2 ;LDIR - db 0b0h ; - dw gen.opc.ED2 ;NEG - db 044h ; - dw as.opc.noarg ;NOP - db 000h ; - dw as.AND_CP_OR_SUB_XOR ;OR - db 0b0h ; - dw gen.opc.ED2 ;OTDR - db 0bbh ; - dw gen.opc.ED2 ;OTIR - db 0b3h ; - dw as.OUT ;OUT - db 041h ; - dw gen.opc.ED2 ;OUTD - db 0abh ; - dw gen.opc.ED2 ;OUTI - db 0a3h ; - dw as.POP_PUSH ;POP - db 0c1h ; - dw as.POP_PUSH ;PUSH - db 0c5h ; - dw as.BITOP ;RES - db 080h ; - dw as.RET ;RET - db 0c0h ; - dw gen.opc.ED2 ;RETI - db 04dh ; - dw gen.opc.ED2 ;RETN - db 045h ; - dw as.SHIFTOP ;RL - db 010h ; - dw as.opc.noarg ;RLA - db 017h ; - dw as.SHIFTOP ;RLC - db 000h ; - dw as.opc.noarg ;RLCA - db 007h ; - dw gen.opc.ED2 ;RLD - db 06fh ; - dw as.SHIFTOP ;RR - db 018h ; - dw as.opc.noarg ;RRA - db 01fh ; - dw as.SHIFTOP ;RRC - db 008h ; - dw as.opc.noarg ;RRCA - db 00fh ; - dw gen.opc.ED2 ;RRD - db 067h ; - dw as.RST ;RST - db 0c7h ; - dw as.ADC_SBC ;SBC - db 098h ; - dw as.opc.noarg ;SCF - db 037h ; - dw as.BITOP ;SET - db 0c0h ; - dw as.SHIFTOP ;SLA - db 020h ; - dw as.SHIFTOP ;SRA - db 028h ; - dw as.SHIFTOP ;SRL - db 038h ; - dw as.AND_CP_OR_SUB_XOR ;SUB - db 090h ; - dw as.AND_CP_OR_SUB_XOR ;XOR - db 0a8h ; - - dw as.IN0 ;IN0 - db 000h ; - dw as.MLT ;MLT - db 04ch ; - dw gen.opc.ED2 ;OTDM - db 08bh ; - dw gen.opc.ED2 ;OTDMR - db 09bh ; - dw gen.opc.ED2 ;OTIM - db 083h ; - dw gen.opc.ED2 ;OTIMR - db 093h ; - dw as.OUTO ;OUT0 - db 001h ; - dw gen.opc.ED2 ;SLP - db 076h ; - dw as.TST ;TST - db 004h ; - dw as.TSTIO ;TSTIO - db 074h ; -;------------------------------------------------------------------------------- -as.TST: - call arg.r_HL_A ; - jr nc,as.tst_0 - rlca - rlca - rlca - add a,b - ld b,a - jp gen.opc.ED2 -as.tst_0: - ld b,064h -as.TSTIO: - call arg.imm_8bit ; - jr as.store_io0 - -as.IN0: - call arg.r_HL_A ; - jr nc,error5 - cp 006h - jr z,error5 - rlca - rlca - rlca - add a,b - ld b,a - call assert_comma ; - call arg.addr_8bit ; - jr as.store_io0 - -as.OUTO: - call arg.addr_8bit ; - call assert_comma ; - call arg.r_HL_A ; - jr nc,error5 - cp 006h - jr z,error5 - rlca - rlca - rlca - add a,b - ld b,a - -as.store_io0: - call assert_eol - ld (iy+000h),0edh - ld (iy+001h),b - ld (iy+002h),l - ld c,003h - ret - -as.MLT: - call arg.ww ; - jr nc,error5 - add a,b - ld b,a - jp gen.opc.ED2 - -error5: - jp ERROR - -as.LD: - call arg.r_HL_A - jr c,l13d4h - call arg.IDX_displcmnt - jp c,l1471h - call arg.ww - jp c,l149ch - call arg.IX_IY - jp c,l14f5h - call get_char_upper - cp 'I' - jp z,l1511h - cp 'R' - jp z,l1519h - cp '(' - jr nz,error5 - inc de - call arg.ww - jp c,l1528h - call test_expr - call test_paren_close - call assert_comma - call arg.ww - jr c,l13c2h - call arg.IX_IY - jr nc,l13aah - ld b,022h -l1395h: - call assert_eol - ld a,(prefix_ixiy) -l139bh: - ld (iy+000h),a - ld (iy+001h),b - ld (iy+002h),l - ld (iy+003h),h - ld c,004h - ret - -l13aah: - call get_char_upper - cp 'A' - jr nz,error5 - inc de - ld b,032h - -as.store_3: - call assert_eol - ld (iy+000h),b - ld (iy+001h),l - ld (iy+002h),h - ld c,003h - ret - -l13c2h: - cp 020h - jr z,l13d0h - add a,043h - ld b,a -l13c9h: - call assert_eol - ld a,0edh - jr l139bh -l13d0h: - ld b,022h - jr as.store_3 - -l13d4h: - ld b,a - call assert_comma - call arg.r_HL_A - jr nc,l13f0h - push af - ld a,b - rlca - rlca - rlca - ld b,a - pop af - add a,b - add a,040h - cp 076h - jr z,error60 -l13ech: - ld b,a - jp as.opc.noarg - -l13f0h: - call arg.IDX_displcmnt - jr nc,l1413h - ld a,b - rlca - rlca - rlca - add a,046h - cp 076h - jr z,error60 - -l1400h: - ld b,a - call assert_eol - ld (iy+001h),b - ld (iy+002h),c - ld a,(prefix_ixiy) - ld (iy+000h),a - ld c,003h - ret - -l1413h: - call get_char_upper - cp 'I' - jr z,l1426h - cp 'R' - jr nz,l1432h - ld a,b - cp 007h - jr nz,error60 - ld b,05fh - jr l142eh - -l1426h: - ld a,b - cp 007h - jr nz,error60 - ld b,057h -l142eh: - inc de - jp gen.opc.ED2 -l1432h: - cp '(' - jr z,l144ch - call arg.imm_8bit - ld a,b - rlca - rlca - rlca - add a,006h -l143fh: - ld b,a -as.store_2: - call assert_eol - ld (iy+000h),b - ld (iy+001h),l - ld c,002h - ret -l144ch: - inc de - ld a,b - cp 007h - jr nz,error60 - call arg.ww - jr nc,l1466h - cp 030h - jr nc,error60 - add a,00ah - ld b,a - call test_paren_close - jp as.opc.noarg - -error60: - jp error - -l1466h: - call test_expr - call test_paren_close - ld b,03ah - jp as.store_3 - -l1471h: - call assert_comma - call arg.r_HL_A - jr nc,l1483h - cp 006h - jr z,error60 - add a,070h - jp l1400h - -l1483h: - call arg.imm_8bit - call assert_eol - ld a,(prefix_ixiy) - ld (iy+000h),a - ld (iy+001h),036h - ld (iy+002h),c - ld (iy+003h),l - ld c,004h - ret -l149ch: - ld b,a - call assert_comma - ld hl,t_HL.AF - call sub_0318h - jr c,l14c3h - call arg.IX_IY - jr nc,l14cch - ld a,b - cp 030h - jr nz,error6 - ld b,0f9h -l14b4h: - call assert_eol - ld a,(prefix_ixiy) - ld (iy+000h),a - ld (iy+001h),b - ld c,002h - ret - -l14c3h: - ld a,b - cp 030h - jr nz,error6 - ld b,0f9h - jr as.opc.noarg ;14ca - -l14cch: - call get_char_upper - cp '(' - jr nz,l14e8h - inc de - call test_expr - call test_paren_close - ld a,b - cp 020h - jr z,l14e3h - add a,04bh - ld b,a - jp l13c9h - -l14e3h: - ld b,02ah - jp as.store_3 - -l14e8h: - call test_expr - call assert_eol - ld a,001h - add a,b - ld b,a - jp as.store_3 -l14f5h: - call assert_comma - call get_char_upper - cp '(' - jr nz,l1509h - inc de - call test_expr - call test_paren_close - ld b,02ah - jp l1395h - -l1509h: - call test_expr - ld b,021h - jp l1395h - -l1511h: - inc de - call assert_comma - ld b,047h - jr l151fh - -l1519h: - inc de - call assert_comma - ld b,04fh -l151fh: - call get_char_upper - inc de - cp 'A' - jr z,gen.opc.ED2 -error6: - jp ERROR - -l1528h: - cp 020h - jr nc,error6 - add a,002h - ld b,a - call test_paren_close - call assert_comma - call get_char_upper - cp 'A' - jr nz,error6 - inc de -as.opc.noarg: - call assert_eol - ld (iy+000h),b - ld c,001h - ret - -gen.opc.ED2: - call assert_eol - ld (iy+000h),0edh - ld (iy+001h),b - ld c,002h - ret - -as.ADC_SBC: - ld hl,t_HL.AF - call sub_0318h - jr nc,as.AND_CP_OR_SUB_XOR - call assert_comma - call arg.ww - jr nc,error6 - push af - ld a,b - cp 088h - ld b,04ah - jr z,l156ch - ld b,042h -l156ch: - pop af - add a,b -l156eh: - ld b,a - jr gen.opc.ED2 - -as.ADD: - ld hl,t_HL.AF - call sub_0318h - jr c,l159ah - call arg.IX_IY - jr nc,as.AND_CP_OR_SUB_XOR - call assert_comma - ld hl,t_BC.DE.IX.SP - ld a,(prefix_ixiy) - cp 0fdh - jr nz,l158eh - ld hl,t_BC.DE.IY.SP -l158eh: - call arg.reg_16bit - jr nc,error6 - add a,009h -l1596h: - ld b,a - jp l14b4h -l159ah: - call assert_comma - call arg.ww -error61nc: - jr nc,error6 - add a,009h - jp l13ech -as.AND_CP_OR_SUB_XOR: - call get_char_upper - cp 'A' - jr nz,l15b8h - push de - inc de - call next_arg - jr z,l15b7h - pop de - jr l15b8h -l15b7h: - pop af -l15b8h: - call arg.r_HL_A - jr c,l15cbh - call arg.IDX_displcmnt - jr c,l15cfh - call arg.imm_8bit - ld a,b - add a,046h - jp l143fh -l15cbh: - add a,b - jp l13ech -l15cfh: - ld a,b - add a,006h - jp l1400h - -as.SHIFTOP: - call arg.r_HL_A - jr c,l15fah - call arg.IDX_displcmnt - jr nc,error61nc - ld a,b - add a,006h - ld b,a -l15e4h: - call assert_eol - ld a,(prefix_ixiy) - ld (iy+000h),a - ld (iy+001h),0cbh - ld (iy+002h),c - ld (iy+003h),b - ld c,004h - ret - -l15fah: - add a,b -l15fbh: - ld b,a - call assert_eol - ld (iy+001h),b - ld (iy+000h),0cbh - ld c,002h - ret - -as.BITOP: - call arg.bit - call assert_comma - call arg.r_HL_A - jr c,l1624h - call arg.IDX_displcmnt - jr nc,error61nc - ld a,l - rlca - rlca - rlca - add a,006h - add a,b - ld b,a - jr l15e4h -l1624h: - add a,b - ld b,a - ld a,l - rlca - rlca - rlca - add a,b - jr l15fbh - -as.CALL: - push de - call arg.cc_ZCPS - jr nc,l163ch - add a,b - ld b,a - call next_arg - jr z,l163eh - pop de - push de -l163ch: - ld b,0cdh -l163eh: - pop af - call test_expr - jp as.store_3 - -as.RET: - call arg.cc_ZCPS - jr nc,l164eh - add a,b - ld b,a - jr l1650h -l164eh: - ld b,0c9h -l1650h: - jp as.opc.noarg - -as.JP: - push de - call arg.cc_ZCPS - jr c,l1666h -l1659h: - pop de - ld hl,l168ch - call sub_030ah - jr c,l1674h - ld b,0c3h - jr l166eh - -l1666h: - add a,b - ld b,a - call next_arg - jr nz,l1659h - pop af -l166eh: - call test_expr - jp as.store_3 -l1674h: - call assert_eol - ld a,b - and a - jr nz,l1680h - ld b,0e9h - jp as.opc.noarg -l1680h: - ld b,0ddh - dec a - jr z,l1687h - ld b,0fdh -l1687h: - ld l,0e9h - jp as.store_2 - -l168ch: - DC '(HL)' - DC '(IX)' - DC '(IY)' - DB 0 - -as.DJNZ: - call next_arg - ld b,010h - jr l16aeh -as.JR: - call arg.cc_ZC - jr c,l16a9h - ld b,018h - jr l16aeh -l16a9h: - add a,b - ld b,a - call assert_comma -l16aeh: - call arg.j_displ - jp as.store_2 - -as.IM: - call arg.imm_8bit - ld a,l - cp 003h - jr nc,error7 - and a - jr z,l16c7h - ld b,056h - cp 001h - jr z,l16c7h - ld b,05eh -l16c7h: - jp gen.opc.ED2 - -as.RST: - call arg.imm_8bit - ld a,l - push af - add a,b - ld b,a - pop af - and 0c7h - jr nz,error7 - jp as.opc.noarg - -as.POP_PUSH: - call arg.IX_IY - jr c,l16e7h - call arg.zz - jr nc,error7 - add a,b - jp l13ech -l16e7h: - ld a,b - add a,020h - jp l1596h - -as.IN: - call arg.r_HL_A - jr nc,error7 - cp 006h - jr z,error7 - rlca - rlca - rlca - add a,b - ld b,a - cp 078h - jr nz,l170fh - call assert_comma - call sub_171bh - jr c,l1715h - call arg.addr_8bit - ld b,0dbh - jp as.store_2 -l170fh: - call assert_comma - call sub_171bh -l1715h: - jp c,gen.opc.ED2 -error7: - jp ERROR - -sub_171bh: - ld hl,t__C_ - jp sub_0318h - -as.OUT: - call sub_171bh - jr nc,l1739h - call assert_comma - call arg.r_HL_A - jr nc,error7 - cp 006h - jr z,error7 - rlca - rlca - rlca - add a,b - jp l156eh - -l1739h: - call arg.addr_8bit - call assert_comma - cp 'A' - jr nz,error7 - inc de - ld b,0d3h - jp as.store_2 - -as.EX: - ld hl,b_176d_start - call sub_030ah - jr nc,error7 - ld c,b - call assert_eol - ld b,000h - ld hl,l178eh - add hl,bc - add hl,bc - ld a,(hl) - ld (iy+000h),a - ld c,001h - inc hl - ld a,(hl) - and a - ret z - ld (iy+001h),a - ld c,002h - ret b_176d_start: DC 'AF,AF''' @@ -4372,247 +2998,6 @@ l1773h: DC '(SP),IX' DC '(SP),IY' db 0 -l178eh: - db 008h,000h - db 0ebh,000h - db 0e3h,000h - db 0ddh,0e3h - db 0fdh,0e3h - -as.DEC_INC: - call arg.IX_IY - jr c,l17b3h - call arg.ww - jr c,l17bfh - call arg.r_HL_A - jr c,l17cch - call arg.IDX_displcmnt - jr nc,error8 - ld a,b - add a,030h - jp l1400h -l17b3h: - ld a,b - ld b,023h - cp 004h - jr z,l17bch - ld b,02bh -l17bch: - jp l14b4h -l17bfh: - push af - ld a,b - ld b,003h - cp 004h - jr z,l17c9h - ld b,00bh -l17c9h: - pop af - jr l17cfh -l17cch: - rlca - rlca - rlca -l17cfh: - add a,b - jp l13ech - -arg.bit: - call arg.imm_8bit - ld a,l - cp 008h - jr nc,error8 - ret - -arg.j_displ: - call test_expr - push bc - push iy - pop bc - and a - sbc hl,bc - dec hl - dec hl - pop bc - call sub_1802h - ld a,h - xor l - bit 7,a - jr nz,error8 - ret - -arg.addr_8bit: - call get_char_upper - cp '(' - jr nz,arg.imm_8bit - inc de - call arg.imm_8bit - jp test_paren_close - -arg.imm_8bit: - call test_expr -sub_1802h: - ld a,h - and a - ret z - inc a - ret z - jr error8 - -test_expr: - push bc - call expr - pop bc - ret nc -error8: - jp ERROR - -arg.zz: - push hl - ld hl,t_BC.DE.HL.AF - jr l181fh - -arg.reg_16bit: - push hl - jr l181fh - -arg.ww: - push hl - ld hl,t_BC.DE.HL.SP -l181fh: - push bc - call sub_030ah - jr nc,l182bh - ld a,b - rlca - rlca - rlca - rlca - scf -l182bh: - pop bc - pop hl - ret - -arg.r_HL_A: - call skipbl - push bc - push hl - ld hl,t_BCDEHL_HL_A - call sub_030ah - ld a,b - pop hl - pop bc - ret - -arg.IX_IY: - push hl - push bc - ld hl,t_IX.IY - call sub_030ah - jr nc,l1852h - ld a,0ddh - dec b - jr nz,l184eh - ld a,0fdh -l184eh: - ld (prefix_ixiy),a - scf -l1852h: - pop bc - pop hl - ret - -arg.IDX_displcmnt: - push hl - push bc - call get_char_upper - cp '(' - jr nz,l18a1h - push de - inc de - ld hl,t_IX.IY - call sub_030ah - jr nc,l18a0h - pop af - ld a,0ddh - dec b - jr nz,l186eh - ld a,0fdh -l186eh: - ld (prefix_ixiy),a - call get_char_upper - cp '+' - jr z,l1882h - cp ')' - ld hl,0 - jr z,l189ah - cp '-' - jr nz,error9 -l1882h: - push af - inc de - call arg.imm_8bit - pop af - cp '+' - jr z,l1894h - ld b,h - ld c,l - ld hl,0 - and a - sbc hl,bc -l1894h: - call get_char_upper - cp ')' - jr nz,error9 -l189ah: - inc de - pop bc - ld c,l - pop hl - scf - ret -l18a0h: - pop de -l18a1h: - pop bc - pop hl - and a - ret - -arg.cc_ZCPS: - ld hl,t_tstfl_ZCPS - ld c,007h - jr l18b1h - -arg.cc_ZC: - ld hl,t_tstfl_ZC - ld c,003h -l18b1h: - push bc - call sub_030ah - ld a,b - pop bc - ret nc - and c - rlca - rlca - rlca - scf - ret - -assert_comma: - call next_arg - ret z -error9: - jp ERROR - -test_paren_close: - call get_char_upper - cp ')' - jr nz,error9 - inc de - ret ;------------------------------------------------------------------------------- ; >>L [startaddr] [endaddr] @@ -4665,7 +3050,6 @@ cmdl_p_line: ret p_disas_line: - call p_label call outbl2 call out.hl.@ call z,outbl @@ -4679,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: @@ -5647,38 +4028,16 @@ t_BC.DE.HL.SP: t_BC.DE.HL.AF: DC 'BC' DC 'DE' -t_HL.AF: + DC 'HL' DC 'AF' DB 0 -t_BC.DE.IY.SP: - DC 'BC' - DC 'DE' - DC 'IY' - DC 'SP' - DB 0 -t_BC.DE.IX.SP: - DC 'BC' - DC 'DE' - DC 'IX' - DC 'SP' - DB 0 t_HL.IX.IY: DC 'HL' -t_IX.IY: + DC 'IX' DC 'IY' DB 0 -t_tstfl_ZC: - DC 'NZ' - DC 'Z' - DC 'NC' - DC 'C' - DC 'NE' - DC 'EQ' - DC 'GE' - DC 'LT' - DB 0 t_tstfl_ZCPS: DC 'NZ' DC 'Z' @@ -6134,13 +4493,6 @@ expr_bufe: ;------------------------------------------------------------------------------- -msg_Y: - dc 'Yn' -reg_Y: - rept YREG_CNT - dw 0 - endm - last_S: dw TPA @@ -6166,16 +4518,6 @@ high_load: max_load: dw TPA -l1262h: - dw 0 -last_A: - dw TPA -cmd_A_prev: - dw TPA - -prefix_ixiy: - db 0 - isprefix_ixiy: db 0 last_L: @@ -6188,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: