X-Git-Url: http://cloudbase.mooo.com/gitweb/ddt180.git/blobdiff_plain/c1ae5a7d955f1b8d6d80317e2d70d66d7a7f810a..efc2486ea0340c32c372f5565a48eea068687cac:/ddt180.z80 diff --git a/ddt180.z80 b/ddt180.z80 index 7464549..81b68b4 100644 --- a/ddt180.z80 +++ b/ddt180.z80 @@ -6,22 +6,140 @@ ; - Use Digital Research Link-80 to generate a .PRL file (op switch). ; - Cut the .PRL header (first 256 byte) end rename the result to DDTZ.COM. +TPA equ 0100h + + cseg +ldr_start: + LD SP,stack + +; LD DE,signon +; LD C,BDOS_PSTR +; CALL BDOS + + ld hl,(1) ;wboot addr + ld de,?const + ld b,3 +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 + +signon: + call pstr_inl + db 'DDTZ/180' + db ' - Version ' + maclib version.inc + defvers + dc CR,LF + +; ld sp,stack +; exx +; ld de,ddtz_base +; call cp_hl_de +; jr c,l0079h +; ex de,hl +;l0079h: +; ld de,TPA +;l007ch: +; dec hl +; ld (hl),000h +; ld a,h +; sub d +; ld b,a +; ld a,l +; sub e +; or b +; jr nz,l007ch + + ld a,i + ld (reg.i),a + ld a,0f3h + jp po,l0093h + ld a,0fbh +l0093h: + ld (reg.iff),a + call di_or_ei + ld hl,ddtz_base + ld l,000h + ld (reg_sp),hl + + jp mainloop + ;------------------------------------------------------------------------------- ; Relocation loader ; -TPA equ 0100h - cseg - .phase TPA + LD HL,ddtz_end ;start of reloc bitmap + ld bc,0108h ;init bit counter - jp start - ds 3 + EXX + LD HL,(BDOS+1) + LD (ddtz_base+1),HL + LD BC,ddtz_size-1 + LD D,B + LD E,0FFH + INC DE ;size rounded up to next page boundary + INC BC ;ddtz_size + OR A + SBC HL,DE ;BDOS - size + LD (BDOS+1),HL ;-> new BDOS entry -ldr_end: -ldr_size equ $ - TPA -current_phase defl $ + push hl + PUSH BC + ld de,ldr_end + sbc hl,de + EX DE,HL ;-> DE + LD HL,ldr_size + add hl,bc + ld b,h + ld c,l + LD HL,TPA +reloc_lp: + EXX + djnz reloc_nl + ld b,c ;reload bit counter + LD e,(HL) ;get next 8 relocation bits + INC HL +reloc_nl: + sla e + EXX + JR NC,reloc_next + DEC HL + LD A,(HL) + ADD A,E + LD (HL),A + INC HL + LD A,(HL) + ADC A,D + LD (HL),A +reloc_next: + inc hl + dec bc + ld a,b + or c + jr nz,reloc_lp + dec hl - .dephase -current_cseg defl $ + POP BC + pop de + EX DE,HL + ADD HL,BC + EX DE,HL + DEC DE + LDDR + LD HL,conbuf+2-ddtz_base + ADD HL,DE + JP (HL) + +ldr_end: +ldr_size equ $ - ldr_start ;------------------------------------------------------------------------------- ; DDT/Z core @@ -49,38 +167,20 @@ BDOS_PSTR equ 9 ;Print String 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 4 ;Size of a breakpoint record ;------------------------------------------------------------------------------- ddtz_base: - jp ddtz_bdos + jp 0 l0003h: rst 30h di_or_ei: nop ret -ddtz_bdos: - jp 0 - -current_cseg defl $ - current_cseg - .phase current_phase + current_cseg -signon: - db 'DDTZ/180' - db ' - Version ' - maclib version.inc - defvers - db CR,LF,'$' -msgz80: - db 'Z80 or better required!',cr,lf,'$' - -current_phase defl $ - .dephase -current_cseg defl $ - ds STACK_SIZE - (current_phase - signon) + ds STACK_SIZE stack: reg.l2: db 000h @@ -116,54 +216,6 @@ cmd_rpt:dw mainloop conbuf: db CONBUF_SIZE - ld sp,stack - exx - ld de,ddtz_base - call cp_hl_de - jr c,l0079h - ex de,hl -l0079h: - ld de,TPA -l007ch: - dec hl - ld (hl),000h - ld a,h - sub d - ld b,a - ld a,l - sub e - or b - jr nz,l007ch - ld a,i - ld (reg.i),a - ld a,0f3h - jp po,l0093h - ld a,0fbh -l0093h: - ld (reg.iff),a - call di_or_ei - ld hl,ddtz_base - ld l,000h - ld (reg_sp),hl - - 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) ;------------------------------------------------------------------------------- @@ -171,9 +223,6 @@ vini_l: ?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 @ @@ -630,14 +679,23 @@ l031eh: pop bc ret l0336h: - call sub_0345h + call str_sel_next l0339h: pop de and a pop bc ret -sub_0345h: +str_sel: + inc b + jr str_sel2 +str_sel1: + call str_sel_next +str_sel2: + djnz str_sel1 + ret + +str_sel_next: ld a,(hl) and a ret z @@ -2484,15 +2542,6 @@ disas_nopfx: disas_pfx.ED: inc iy - ld hl,b_1bc9_start ;1 byte opcode, no arguments - call lookup_op - ld b,2 - ret c - ld hl,b_1bf4_start - call lookup_op_arg - ld b,2 - ret c - ld hl,l228bh call lookup_op_arg ld b,3 @@ -2500,6 +2549,32 @@ disas_pfx.ED: ld hl,b_1c40_start call lookup_op_arg ld b,4 + ret c + + ld hl,b_1bc9_start ;1 byte opcode, no arguments + call lookup_op + jr c,da_ed1 + + ld hl,b_1bf4_start + call lookup_op_arg + ret nc + + ld a,e + cp a_noarg + jr nz,da_ed0 + ld c,(iy+0) + ld a,c + rra + and 0ch + ld b,a + ld a,c + and 03h + call str_sel_ab + +da_ed0: + scf +da_ed1: + ld b,2 ret ;------------------------------------------------------------------------------- @@ -2596,22 +2671,6 @@ l1a0ah: ;------------------------------------------------------------------------------- -lookup_op: - ld a,(hl) - cp 0ffh - ret z - cp (iy+000h) - jr z,l1a7fh - inc hl - inc hl - jr lookup_op -l1a7fh: - ld e,a_noarg - inc hl - ld c,(hl) - jr get_mnemonic - - test_DDFD: ld a,(hl) and a @@ -2622,47 +2681,59 @@ test_DDFD: scf ret -lookup_op_arg: - ld a,(iy+000h) - and (hl) - inc hl - cp (hl) - inc hl - jr z,l1aa8h +lookup_op: + ld a,(hl) inc hl + cp 0ffh + ret z + cp (iy+000h) + jr z,l1a7fh inc hl - ld a,(hl) - and a - jr nz,lookup_op_arg - ret + jr lookup_op +l1a7fh: + ld b,(hl) + ld e,a_noarg + jr get_mnemonic -l1aa8h: - ld c,(hl) - inc c +lookup_op_arg: + call lookup_branch_op + ret nc + ld a,e + ld e,d + cp a,0ffh ret z ;carry clear - dec c - inc hl - ld e,(hl) + ld b,a + get_mnemonic: ld hl,t_MNEMONICS - ld b,0 - add hl,bc + bit 7,b + jr z,get_m1 + res 7,b + ld a,(iy+000h) + rra + rra + rra + and 07h +str_sel_ab: + add b + ld b,a +get_m1: + call str_sel scf ret lookup_branch_op ;TODO - ld a,(iy+000h) - and (hl) + ld a,(hl) + and a + ret z inc hl + and (iy+000h) cp (hl) inc hl jr z,l1aa8_br inc hl inc hl - ld a,(hl) - and a - jr nz,lookup_branch_op - ret + jr lookup_branch_op l1aa8_br: ld e,(hl) @@ -2675,20 +2746,20 @@ l1aa8_br: ; 1 byte opcodes (no parameters) ; Format: db opcode, t_MNEMONICS-index b_1ab6_start: - db 076h,o_HALT ;halt - db 0d9h,o_EXX ;exx - db 0f3h,o_DI ;di - db 0fbh,o_EI ;ei - db 000h,o_NOP ;nop - db 007h,o_RLCA ;rlca - db 00fh,o_RRCA ;rrca - db 017h,o_RLA ;rla - db 01fh,o_RRA ;rra - db 027h,o_DAA ;daa - db 02fh,o_CPL ;cpl - db 037h,o_SCF ;scf - db 03fh,o_CCF ;ccf - db 0c9h,o_RET ;ret + db 076h,i_HALT ;halt + db 0d9h,i_EXX ;exx + db 0f3h,i_DI ;di + db 0fbh,i_EI ;ei + db 000h,i_NOP ;nop +; db 007h,i_RLCA ;rlca +; db 00fh,i_RRCA ;rrca +; db 017h,i_RLA ;rla +; db 01fh,i_RRA ;rra +; db 027h,i_DAA ;daa +; db 02fh,i_CPL ;cpl +; db 037h,i_SCF ;scf +; db 03fh,i_CCF ;ccf + db 0c9h,i_RET ;ret db 0ffh @@ -2696,182 +2767,198 @@ b_1ab6_start: ; Format: db mask, match, t_MNEMONICS-index ; dw argument formating function b_1ad1_start: - db 0c0h,040h,o_LD ;ld r[y],r[z] + db 0c0h,040h,i_LD ;ld r[y],r[z] db a_rr - db 0f8h,080h,o_ADD ;add a,r[z] - db a_ar - db 0f8h,088h,o_ADC ;adc a,r[z] - db a_ar - db 0f8h,090h,o_SUB ;sub r[z] - db a_r - db 0f8h,098h,o_SBC ;sbc a,r[z] - db a_ar - db 0f8h,0a0h,o_AND ;and r[z] - db a_r - db 0f8h,0a8h,o_XOR ;xor r[z] - db a_r - db 0f8h,0b0h,o_OR ;or r[z] - db a_r - db 0f8h,0b8h,o_CP ;cp r[z] + + db 0c0h,080h,i_ADD+080h ;add a,r[z] db a_r - db 0c7h,0c0h,o_RET ;ret cc + +; db 0f8h,080h,i_ADD ;add a,r[z] +; db a_ar +; db 0f8h,088h,i_ADC ;adc a,r[z] +; db a_ar +; db 0f8h,090h,i_SUB ;sub r[z] +; db a_r +; db 0f8h,098h,i_SBC ;sbc a,r[z] +; db a_ar +; db 0f8h,0a0h,i_AND ;and r[z] +; db a_r +; db 0f8h,0a8h,i_XOR ;xor r[z] +; db a_r +; db 0f8h,0b0h,i_OR ;or r[z] +; db a_r +; db 0f8h,0b8h,i_CP ;cp r[z] +; db a_r + + db 0c7h,0c0h,i_RET ;ret cc db a_cc - db 0c7h,0c7h,o_RST ;rst + db 0c7h,0c7h,i_RST ;rst db a_rst - db 0cfh,0c1h,o_POP ;pop rp2 + db 0cfh,0c1h,i_POP ;pop rp2 db a_p2 - db 0cfh,0c5h,o_PUSH ;push rp2 + db 0cfh,0c5h,i_PUSH ;push rp2 db a_p2 - db 0ffh,0e3h,o_EX ;ex (sp),hl + db 0ffh,0e3h,i_EX ;ex (sp),hl db a_esphl - db 0ffh,0e9h,o_JP ;jp (hl) + db 0ffh,0e9h,i_JP ;jp (hl) db a_hl - db 0ffh,0ebh,o_EX ;ex de,hl + db 0ffh,0ebh,i_EX ;ex de,hl db a_dehl - db 0ffh,0f9h,o_LD ;ld sp,hl + db 0ffh,0f9h,i_LD ;ld sp,hl db a_lsphl - db 0cfh,003h,o_INC ;inc rp + db 0cfh,003h,i_INC ;inc rp db a_p - db 0cfh,00bh,o_DEC ;dec rp + db 0cfh,00bh,i_DEC ;dec rp db a_p - db 0c7h,004h,o_INC ;inc r[y] + db 0c7h,004h,i_INC ;inc r[y] db a_ry - db 0c7h,005h,o_DEC ;dec r[y] + db 0c7h,005h,i_DEC ;dec r[y] db a_ry - db 0ffh,008h,o_EX ;ex af,af' + db 0ffh,008h,i_EX ;ex af,af' db a_eaf - db 0cfh,009h,o_ADD ;add hl,rp + db 0cfh,009h,i_ADD ;add hl,rp db a_hlp - db 0efh,002h,o_LD ;ld (rp),a ;rp=bc,de + db 0efh,002h,i_LD ;ld (rp),a ;rp=bc,de db a_pa - db 0efh,00ah,o_LD ;ld a,(rp) ;rp=bc,de + db 0efh,00ah,i_LD ;ld a,(rp) ;rp=bc,de db a_ap + + db 0c7h,007h,i_RLCA+080h;rlca + db a_noarg + db 0 ; 2 byte opcodes b_1b54_start: - db 0c7h,006h,o_LD ;ld r[y],nn + db 0c7h,006h,i_LD ;ld r[y],nn db a_rn - db 0ffh,0c6h,o_ADD ;add a,nn - db a_an - db 0ffh,0ceh,o_ADC ;adc a,nn - db a_an - db 0ffh,0d6h,o_SUB ;sub nn - db a_n - db 0ffh,0deh,o_SBC ;sbc a,nn - db a_an - db 0ffh,0e6h,o_AND ;and nn - db a_n - db 0ffh,0eeh,o_XOR ;xor nn - db a_n - db 0ffh,0f6h,o_OR ;or nn - db a_n - db 0ffh,0feh,o_CP ;cp nn + + db 0c7h,0c6h,i_ADD+080h ;add a,r[z] db a_n - db 0ffh,010h,o_DJNZ ;djnz + +; db 0ffh,0c6h,i_ADD ;add a,nn +; db a_an +; db 0ffh,0ceh,i_ADC ;adc a,nn +; db a_an +; db 0ffh,0d6h,i_SUB ;sub nn +; db a_n +; db 0ffh,0deh,i_SBC ;sbc a,nn +; db a_an +; db 0ffh,0e6h,i_AND ;and nn +; db a_n +; db 0ffh,0eeh,i_XOR ;xor nn +; db a_n +; db 0ffh,0f6h,i_OR ;or nn +; db a_n +; db 0ffh,0feh,i_CP ;cp nn +; db a_n + + db 0ffh,010h,i_DJNZ ;djnz db a_j - db 0ffh,018h,o_JR ;jr + db 0ffh,018h,i_JR ;jr db a_j - db 0e7h,020h,o_JR ;jr cc, + db 0e7h,020h,i_JR ;jr cc, db a_ccj - db 0ffh,0d3h,o_OUT ;out (nn),a + db 0ffh,0d3h,i_OUT ;out (nn),a db a_ma - db 0ffh,0dbh,o_IN ;in a,(nn) + db 0ffh,0dbh,i_IN ;in a,(nn) db a_am db 0 ; 3 byte opcodes b_1b9b_start: - db 0c7h,0c2h,o_JP ;jp cc,mn + db 0c7h,0c2h,i_JP ;jp cc,mn db a_ccnn - db 0c7h,0c4h,o_CALL ;call cc,mn + db 0c7h,0c4h,i_CALL ;call cc,mn db a_ccnn - db 0cfh,001h,o_LD ;ld ww,mn + db 0cfh,001h,i_LD ;ld ww,mn db a_rnn - db 0ffh,0c3h,o_JP ;jp mn + db 0ffh,0c3h,i_JP ;jp mn db a_nn - db 0ffh,0cdh,o_CALL ;call mn + db 0ffh,0cdh,i_CALL ;call mn db a_nn - db 0ffh,022h,o_LD ;ld (mn),hl + db 0ffh,022h,i_LD ;ld (mn),hl db a_mmhl - db 0ffh,02ah,o_LD ;ld hl,(mn) + db 0ffh,02ah,i_LD ;ld hl,(mn) db a_hlmm - db 0ffh,032h,o_LD ;ld (mn),a + db 0ffh,032h,i_LD ;ld (mn),a db a_mma - db 0ffh,03ah,o_LD ;ld a,(mn) + db 0ffh,03ah,i_LD ;ld a,(mn) db a_amm db 0 ; Prefix ED + 1 byte opcode, no arguments ; Format: opcode, t_MNEMONICS index b_1bc9_start: - db 044h,o_NEG ;neg - db 045h,o_RETN ;retn - db 04dh,o_RETI ;reti - db 067h,o_RRD ;rrd - db 06fh,o_RLD ;rld - db 0a0h,o_LDI ;ldi - db 0a1h,o_CPI ;cpi - db 0a2h,o_INI ;ini - db 0a3h,o_OUTI ;outi - db 0a8h,o_LDD ;ldd - db 0a9h,o_CPD ;cpd - db 0aah,o_IND ;ind - db 0abh,o_OUTD ;outd - db 0b0h,o_LDIR ;ldir - db 0b1h,o_CPIR ;cpir - db 0b2h,o_INIR ;inir - db 0b3h,o_OTIR ;otir - db 0b8h,o_LDDR ;lddr - db 0b9h,o_CPDR ;cpdr - db 0bah,o_INDR ;indr - db 0bbh,o_OTDR ;otdr - db 08bh,o_OTDM ;otdm - db 09bh,o_OTDMR ;otdmr - db 083h,o_OTIM ;otim - db 093h,o_OTIMR ;otimr - db 076h,o_SLP ;slp + db 044h,i_NEG ;neg + db 045h,i_RETN ;retn + db 04dh,i_RETI ;reti + db 067h,i_RRD ;rrd + db 06fh,i_RLD ;rld +; db 0a0h,i_LDI ;ldi +; db 0a1h,i_CPI ;cpi +; db 0a2h,i_INI ;ini +; db 0a3h,i_OUTI ;outi +; db 0a8h,i_LDD ;ldd +; db 0a9h,i_CPD ;cpd +; db 0aah,i_IND ;ind +; db 0abh,i_OUTD ;outd +; db 0b0h,i_LDIR ;ldir +; db 0b1h,i_CPIR ;cpir +; db 0b2h,i_INIR ;inir +; db 0b3h,i_OTIR ;otir +; db 0b8h,i_LDDR ;lddr +; db 0b9h,i_CPDR ;cpdr +; db 0bah,i_INDR ;indr +; db 0bbh,i_OTDR ;otdr + db 08bh,i_OTDM ;otdm + db 09bh,i_OTDMR ;otdmr + db 083h,i_OTIM ;otim + db 093h,i_OTIMR ;otimr + db 076h,i_SLP ;slp db 0ffh ; b_1bf4_start: - db 0ffh,070h,o_IN ;in (c) ; + db 0e4h,0a0h,i_LDI + db a_noarg + db 0ffh,070h,i_IN ;in (c) ; db a_c - db 0c7h,040h,o_IN ;in r,(c) ;r=b,c,d,e,h,l,a + db 0c7h,040h,i_IN ;in r,(c) ;r=b,c,d,e,h,l,a db a_rc db 0ffh,071h,0ffh ;out (c),0 ; db a_cr - db 0c7h,041h,o_OUT ;out (c),r ;r=b,c,d,e,h,l,a + db 0c7h,041h,i_OUT ;out (c),r ;r=b,c,d,e,h,l,a db a_cr - db 0cfh,042h,o_SBC ;sbc hl,rp + db 0cfh,042h,i_SBC ;sbc hl,rp db a_hlp - db 0cfh,04ah,o_ADC ;adc hl,rp + db 0cfh,04ah,i_ADC ;adc hl,rp db a_hlp - db 0ffh,046h,o_IM ;im 0 + db 0ffh,046h,i_IM ;im 0 db a_im0 - db 0ffh,056h,o_IM ;im 1 + db 0ffh,056h,i_IM ;im 1 db a_im1 - db 0ffh,05eh,o_IM ;im 2 + db 0ffh,05eh,i_IM ;im 2 db a_im2 - db 0e7h,047h,o_LD ;ld i,a ... ld a,r + db 0e7h,047h,i_LD ;ld i,a ... ld a,r db a_ai - db 0cfh,04ch,o_MLT ;mlt rr + db 0cfh,04ch,i_MLT ;mlt rr db a_p - db 0c7h,004h,o_TST ;tst r + db 0c7h,004h,i_TST ;tst r db a_ry db 0 l228bh: - db 0ffh,030h,o_IN0 ;in0 (m) + db 0ffh,030h,i_IN0 ;in0 (m) db a_m - db 0c7h,000h,o_IN0 ;in0 r,(m) ;r=b,c,d,e,h,l,a + db 0c7h,000h,i_IN0 ;in0 r,(m) ;r=b,c,d,e,h,l,a db a_rm db 0ffh,031h,0ffh ;out0 (m),0 db a_mr - db 0c7h,001h,o_OUT0 ;out0 (m),r ;r=b,c,d,e + db 0c7h,001h,i_OUT0 ;out0 (m),r ;r=b,c,d,e db a_mr - db 0ffh,064h,o_TST ;tst m + db 0ffh,064h,i_TST ;tst m db a_n - db 0ffh,074h,o_TSTIO ;tstio m + db 0ffh,074h,i_TSTIO ;tstio m db a_n db 0 @@ -2879,33 +2966,36 @@ l228bh: ; Format: db mask, match, t_MNEMONICS-index ; dw argument formating function b_1c40_start: - db 0cfh,043h,o_LD ;ld (mn),ww ;ww=bc,de,hl,sp + db 0cfh,043h,i_LD ;ld (mn),ww ;ww=bc,de,hl,sp db a_mmp - db 0cfh,04bh,o_LD ;ld ww,(mn) ;ww=bc,de,hl,sp + db 0cfh,04bh,i_LD ;ld ww,(mn) ;ww=bc,de,hl,sp db a_pmm db 0 ; CB b_1c55_start: - db 0f8h,000h,o_RLC ;rlc g - db a_cbr - db 0f8h,008h,o_RRC ;rrc g - db a_cbr - db 0f8h,010h,o_RL ;rl g - db a_cbr - db 0f8h,018h,o_RR ;rr g - db a_cbr - db 0f8h,020h,o_SLA ;sla g - db a_cbr - db 0f8h,028h,o_SRA ;sra g - db a_cbr - db 0f8h,038h,o_SRL ;srl g + db 0c0h,000h,i_RLC+080h ;rlc g db a_cbr - db 0c0h,040h,o_BIT ;bit b,g + +; db 0f8h,000h,i_RLC ;rlc g +; db a_cbr +; db 0f8h,008h,i_RRC ;rrc g +; db a_cbr +; db 0f8h,010h,i_RL ;rl g +; db a_cbr +; db 0f8h,018h,i_RR ;rr g +; db a_cbr +; db 0f8h,020h,i_SLA ;sla g +; db a_cbr +; db 0f8h,028h,i_SRA ;sra g +; db a_cbr +; db 0f8h,038h,i_SRL ;srl g +; db a_cbr + db 0c0h,040h,i_BIT ;bit b,g db a_bcbr - db 0c0h,080h,o_RES ;res b,g + db 0c0h,080h,i_RES ;res b,g db a_bcbr - db 0c0h,0c0h,o_SET ;set b,g + db 0c0h,0c0h,i_SET ;set b,g db a_bcbr db 0 @@ -2954,8 +3044,8 @@ a_rr equ $-t_argf db fi_ry,',' ;ld r[y],r[z] a_r equ $-t_argf db fi_rz,0 ;op r[z] -a_ar equ $-t_argf - db 'A,',fi_rz,0 ;op A,r[z] +;a_ar equ $-t_argf +; db 'A,',fi_rz,0 ;op A,r[z] a_cc equ $-t_argf db fi_ccy,0 ;op cc[y] a_rst equ $-t_argf @@ -2984,8 +3074,8 @@ a_ap equ $-t_argf ; 2 byte opcodes a_rn equ $-t_argf db fi_ry,',',fi_n,0 ;ld r[y],n -a_an equ $-t_argf - db 'A,' ;op a,n +;a_an equ $-t_argf +; db 'A,' ;op a,n a_n equ $-t_argf db fi_n,0 ;op n a_ccj equ $-t_argf @@ -3206,12 +3296,7 @@ p_arg0: ;fall thru pstr_sel: - inc b - jr pstr_sel2 -pstr_sel1: - call sub_0345h -pstr_sel2: - djnz pstr_sel1 + call str_sel ;fall thru pstr: ld a,(hl) @@ -3233,29 +3318,17 @@ pstr_inl: opc macro x i_&x equ opc_index -o_&x equ $-opc_tabstart +;o_&x equ $-opc_tabstart dc '&x' opc_index defl opc_index+1 endm -opc1 macro x,y - -i_&x&y equ opc_index -o_&x&y equ $-opc_tabstart - db '&x' -i_&y equ opc_index+1 -o_&y equ $-opc_tabstart - dc '&y' -opc_index defl opc_index+2 - endm - - t_MNEMONICS: -opc_tabstart defl $ +;opc_tabstart defl $ opc_index defl 0 ; 1-byte other opc NOP - opc1 R,LD + opc LD opc INC opc DEC opc DJNZ @@ -3277,8 +3350,8 @@ opc_index defl 0 opc SUB opc SBC opc AND -; opc XOR - opc1 X,OR + opc XOR + opc OR opc CP opc RET @@ -3291,17 +3364,17 @@ opc_index defl 0 opc EXX opc IN opc EX - opc1 L,DI + opc DI opc EI ; CB opc RLC opc RRC - opc1 S,RL + opc RL opc RR opc SLA opc SRA -; SLL -; opc SRL + opc SLL + opc SRL opc BIT opc RES opc SET @@ -3310,13 +3383,12 @@ opc_index defl 0 opc NEG opc RETN opc RETI - opc1 OT,IM + opc IM opc RRD -; opc RLD + opc RLD -;Block instructions -t_mn_bli: -; opc LDI +; Block instructions + opc LDI opc CPI opc INI opc OUTI @@ -3333,14 +3405,14 @@ t_mn_bli: opc INDR opc OTDR -;Z180 +; Z180 opc IN0 opc OUT0 opc TST opc MLT opc TSTIO opc SLP -; opc OTIM + opc OTIM opc OTDM opc OTIMR opc OTDMR @@ -3439,7 +3511,7 @@ t_op_branch: dw l20ach db 0ffh,0edh ;Prefix ED dw l20b8h -t_op_branch0: + db 0ffh,0cdh ;call mn dw l2080h db 0ffh,0c3h ;jp mn @@ -3622,91 +3694,6 @@ bp_tab: endm endm -expr_buf: -current_cseg defl $ - current_cseg - .phase current_phase + current_cseg - -start: - LD SP,ldr_end+(stack-ddtz_base) - LD DE,signon ;ldr_end+(expr_buf-ddtz_base) - LD C,BDOS_PSTR - CALL BDOS - - xor a - dec a - jp po,reloc - ld de,msgz80 - LD C,BDOS_PSTR - CALL BDOS - jp 0 - -reloc: - LD HL,ldr_end+ddtz_size ;start of reloc bitmap - ld bc,0108h ;init bit counter - - EXX - LD HL,(BDOS+1) - LD (ldr_end+(ddtz_bdos+1-ddtz_base)),HL - LD BC,ddtz_size-1 - LD D,B - LD E,0FFH - INC DE ;size rounded up to next page boundary - INC BC ;ddtz_size - OR A - SBC HL,DE ;BDOS - size - LD (BDOS+1),HL ;-> new BDOS entry - - push hl - PUSH BC - ld de,ldr_end - sbc hl,de - EX DE,HL ;-> DE - LD HL,ldr_size - add hl,bc - ld b,h - ld c,l - LD HL,TPA -reloc_lp: - EXX - djnz reloc_nl - ld b,c ;reload bit counter - LD e,(HL) ;get next 8 relocation bits - INC HL -reloc_nl: - sla e - EXX - JR NC,reloc_next - DEC HL - LD A,(HL) - ADD A,E - LD (HL),A - INC HL - LD A,(HL) - ADC A,D - LD (HL),A -reloc_next: - cpi - jp pe,reloc_lp - dec hl - - POP BC - pop de - EX DE,HL - ADD HL,BC - EX DE,HL - DEC DE - LDDR - LD HL,conbuf+2-ddtz_base - ADD HL,DE - JP (HL) - -current_phase defl $ - .dephase -current_cseg defl $ - - ds EXPR_BUF_SIZE - ($ - expr_buf) -expr_bufe: - ;------------------------------------------------------------------------------- last_S: @@ -3734,7 +3721,7 @@ last_L: dw TPA pbl_loop_adr: - dw 0 + dw 0addeh ddtz_size equ $-ddtz_base ddtz_end: