summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeo C2019-05-14 15:17:02 +0200
committerLeo C2019-05-14 23:28:40 +0200
commit8c416d5a86ae7c2c9557057b230438552f9f992b (patch)
tree723a7260d0423c53f40a67f0417ffab408c41f0b
parentc1ae5a7d955f1b8d6d80317e2d70d66d7a7f810a (diff)
downloadddt180-8c416d5a86ae7c2c9557057b230438552f9f992b.zip
+ tables alu, rot, bli. WIP
-rw-r--r--ddt180.z80296
1 files changed, 155 insertions, 141 deletions
diff --git a/ddt180.z80 b/ddt180.z80
index 7464549..45b3ea5 100644
--- a/ddt180.z80
+++ b/ddt180.z80
@@ -630,14 +630,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
@@ -2608,7 +2617,7 @@ lookup_op:
l1a7fh:
ld e,a_noarg
inc hl
- ld c,(hl)
+ ld b,(hl)
jr get_mnemonic
@@ -2637,16 +2646,26 @@ lookup_op_arg:
ret
l1aa8h:
- ld c,(hl)
- inc c
+ ld b,(hl)
+ inc b
ret z ;carry clear
- dec c
+ dec b
inc hl
ld e,(hl)
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
+ add b
+ ld b,a
+get_m1:
+ call str_sel
scf
ret
@@ -2675,20 +2694,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 +2715,182 @@ 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 0f8h,080h,i_ADD ;add a,r[z]
db a_ar
- db 0f8h,088h,o_ADC ;adc a,r[z]
+ db 0f8h,088h,i_ADC ;adc a,r[z]
db a_ar
- db 0f8h,090h,o_SUB ;sub r[z]
+ db 0f8h,090h,i_SUB ;sub r[z]
db a_r
- db 0f8h,098h,o_SBC ;sbc a,r[z]
+ db 0f8h,098h,i_SBC ;sbc a,r[z]
db a_ar
- db 0f8h,0a0h,o_AND ;and r[z]
+ db 0f8h,0a0h,i_AND ;and r[z]
db a_r
- db 0f8h,0a8h,o_XOR ;xor r[z]
+ db 0f8h,0a8h,i_XOR ;xor r[z]
db a_r
- db 0f8h,0b0h,o_OR ;or r[z]
+ db 0f8h,0b0h,i_OR ;or r[z]
db a_r
- db 0f8h,0b8h,o_CP ;cp r[z]
+ db 0f8h,0b8h,i_CP ;cp r[z]
db a_r
- db 0c7h,0c0h,o_RET ;ret cc
+ 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 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 0ffh,0c6h,i_ADD ;add a,nn
db a_an
- db 0ffh,0ceh,o_ADC ;adc a,nn
+ db 0ffh,0ceh,i_ADC ;adc a,nn
db a_an
- db 0ffh,0d6h,o_SUB ;sub nn
+ db 0ffh,0d6h,i_SUB ;sub nn
db a_n
- db 0ffh,0deh,o_SBC ;sbc a,nn
+ db 0ffh,0deh,i_SBC ;sbc a,nn
db a_an
- db 0ffh,0e6h,o_AND ;and nn
+ db 0ffh,0e6h,i_AND ;and nn
db a_n
- db 0ffh,0eeh,o_XOR ;xor nn
+ db 0ffh,0eeh,i_XOR ;xor nn
db a_n
- db 0ffh,0f6h,o_OR ;or nn
+ db 0ffh,0f6h,i_OR ;or nn
db a_n
- db 0ffh,0feh,o_CP ;cp nn
+ db 0ffh,0feh,i_CP ;cp nn
db a_n
- db 0ffh,010h,o_DJNZ ;djnz
+ 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 ;<end mark>
b_1bf4_start:
- db 0ffh,070h,o_IN ;in (c) ;
+ 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 +2898,33 @@ 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 0f8h,000h,i_RLC ;rlc g
db a_cbr
- db 0f8h,008h,o_RRC ;rrc g
+ db 0f8h,008h,i_RRC ;rrc g
db a_cbr
- db 0f8h,010h,o_RL ;rl g
+ db 0f8h,010h,i_RL ;rl g
db a_cbr
- db 0f8h,018h,o_RR ;rr g
+ db 0f8h,018h,i_RR ;rr g
db a_cbr
- db 0f8h,020h,o_SLA ;sla g
+ db 0f8h,020h,i_SLA ;sla g
db a_cbr
- db 0f8h,028h,o_SRA ;sra g
+ db 0f8h,028h,i_SRA ;sra g
db a_cbr
- db 0f8h,038h,o_SRL ;srl g
+ db 0f8h,038h,i_SRL ;srl g
db a_cbr
- db 0c0h,040h,o_BIT ;bit b,g
+ 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
@@ -3206,12 +3225,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)
@@ -3255,7 +3269,7 @@ 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 +3291,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 +3305,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 +3324,13 @@ 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
+ opc LDI
opc CPI
opc INI
opc OUTI
@@ -3340,7 +3354,7 @@ t_mn_bli:
opc MLT
opc TSTIO
opc SLP
-; opc OTIM
+ opc OTIM
opc OTDM
opc OTIMR
opc OTDMR