1
0
mirror of https://github.com/g012/l65.git synced 2024-11-15 19:09:19 +00:00

Added 0x64xx instructions.

This commit is contained in:
mooz 2018-11-16 23:31:48 +01:00
parent a2e44ae24a
commit 08086d222e
3 changed files with 467 additions and 235 deletions

View File

@ -37,6 +37,7 @@ local Keywords_control = {
local Keywords_data = {
'dc',
}
local Keywords_7801 = {
'aci','adi','adinc','ani','bit0','bit1','bit2','bit3',
'bit4','bit5','bit6','bit7','block','calb','calf','call',
@ -50,7 +51,7 @@ local Keywords_7801 = {
'staw','stax','staxd','staxi','stc','stm','sui','suinb',
'table','xri',
'ana','xra','ora','addnc','gta','subnb','lta','add','adc','sub','nea','sbb','eqa',
'ona','offa'
'ona','offa',
}
local Registers_7801 = {
a=8,b=8,c=8,d=8,e=8,h=8,l=8,v=8,
@ -119,13 +120,14 @@ local opcode_timer = lookupify{
}
local opcode_reg_list = {
a = lookupify{'aci','adi','adinc','ani','dcr','inr','eqi','gti','lti','mvi','nei','offi','oni','ori','rll','rlr','sbi','sll','slr','sui','suinb','xri'},
b = lookupify{'dcr','inr','mvi'},
c = lookupify{'dcr','inr','mvi','rll','rlr','sll','slr'},
d = lookupify{'mvi'},
e = lookupify{'mvi'},
h = lookupify{'mvi'},
l = lookupify{'mvi'},
v = lookupify{'inrw','ldaw','dcrw','eqiw','mvi','mviw','staw',
b = lookupify{'ani','xri','ori','adinc','gti','suinb','lti','adi','oni','aci','offi','sui','nei','sbi','eqi','dcr','inr','mvi'},
c = lookupify{'ani','xri','ori','adinc','gti','suinb','lti','adi','oni','aci','offi','sui','nei','sbi','eqi','dcr','inr','mvi','rll','rlr','sll','slr'},
d = lookupify{'ani','xri','ori','adinc','gti','suinb','lti','adi','oni','aci','offi','sui','nei','sbi','eqi','mvi'},
e = lookupify{'ani','xri','ori','adinc','gti','suinb','lti','adi','oni','aci','offi','sui','nei','sbi','eqi','mvi'},
h = lookupify{'ani','xri','ori','adinc','gti','suinb','lti','adi','oni','aci','offi','sui','nei','sbi','eqi','mvi'},
l = lookupify{'ani','xri','ori','adinc','gti','suinb','lti','adi','oni','aci','offi','sui','nei','sbi','eqi','mvi'},
v = lookupify{'ani','xri','ori','adinc','gti','suinb','lti','adi','oni','aci','offi','sui','nei','sbi','eqi',
'inrw','ldaw','dcrw','eqiw','mvi','mviw','staw',
'bit0','bit1','bit2','bit3','bit4','bit5','bit6','bit7',
},
bc = lookupify{'ldax','lxi','mvix','pop','push','stax'},
@ -133,6 +135,10 @@ local opcode_reg_list = {
hl = lookupify{'dcx','inx','ldax','ldaxd','ldaxi','lxi','mvix','pop','push','stax','staxd','staxi'},
sp = lookupify{'dcx','inx','lxi'},
va = lookupify{'pop','push'},
pa = lookupify{'ani','xri','ori','adinc','gti','suinb','lti','adi','oni','aci','offi','sui','nei','sbi','eqi'},
pb = lookupify{'ani','xri','ori','adinc','gti','suinb','lti','adi','oni','aci','offi','sui','nei','sbi','eqi'},
pc = lookupify{'ani','xri','ori','adinc','gti','suinb','lti','adi','oni','aci','offi','sui','nei','sbi','eqi'},
mk = lookupify{'ani','xri','ori','adinc','gti','suinb','lti','adi','oni','aci','offi','sui','nei','sbi','eqi'},
}
local opcode_reg_reg_list = {
@ -1583,7 +1589,7 @@ local function ParseLua(src, src_name)
if not Registers_7801[register_name] then
return false, GenerateError(register_name .. " is not a valid register")
end
if not opcode_reg_list[register_name] and opcode_reg_list[register_name][op] then
if (not opcode_reg_list[register_name]) and (not opcode_reg_list[register_name][op]) then
return false, GenerateError("Opcode " .. op .. " doesn't support this addressing mode")
end
if opcode_regw[op] or opcode_regb[op] then

View File

@ -186,229 +186,409 @@ section{"rom", org=0x8000}
mov tm0,a
mov tm1,a
mov s,a
ana v,a
ana a,a
ana b,a
ana c,a
ana d,a
ana e,a
ana h,a
ana l,a
xra v,a
xra a,a
xra b,a
xra c,a
xra d,a
xra e,a
xra h,a
xra l,a
ora v,a
ora a,a
ora b,a
ora c,a
ora d,a
ora e,a
ora h,a
ora l,a
addnc v,a
addnc a,a
addnc b,a
addnc c,a
addnc d,a
addnc e,a
addnc h,a
addnc l,a
gta v,a
gta a,a
gta b,a
gta c,a
gta d,a
gta e,a
gta h,a
gta l,a
subnb v,a
subnb a,a
subnb b,a
subnb c,a
subnb d,a
subnb e,a
subnb h,a
subnb l,a
lta v,a
lta a,a
lta b,a
lta c,a
lta d,a
lta e,a
lta h,a
lta l,a
add v,a
add a,a
add b,a
add c,a
add d,a
add e,a
add h,a
add l,a
adc v,a
adc a,a
adc b,a
adc c,a
adc d,a
adc e,a
adc h,a
adc l,a
sub v,a
sub a,a
sub b,a
sub c,a
sub d,a
sub e,a
sub h,a
sub l,a
nea v,a
nea a,a
nea b,a
nea c,a
nea d,a
nea e,a
nea h,a
nea l,a
sbb v,a
sbb a,a
sbb b,a
sbb c,a
sbb d,a
sbb e,a
sbb h,a
sbb l,a
eqa v,a
eqa a,a
eqa b,a
eqa c,a
eqa d,a
eqa e,a
eqa h,a
eqa l,a
ana a,v
ana a,a
ana a,b
ana a,c
ana a,d
ana a,e
ana a,h
ana a,l
xra a,v
xra a,a
xra a,b
xra a,c
xra a,d
xra a,e
xra a,h
xra a,l
ora a,v
ora a,a
ora a,b
ora a,c
ora a,d
ora a,e
ora a,h
ora a,l
addnc a,v
addnc a,a
addnc a,b
addnc a,c
addnc a,d
addnc a,e
addnc a,h
addnc a,l
gta a,v
gta a,a
gta a,b
gta a,c
gta a,d
gta a,e
gta a,h
gta a,l
subnb a,v
subnb a,a
subnb a,b
subnb a,c
subnb a,d
subnb a,e
subnb a,h
subnb a,l
lta a,v
lta a,a
lta a,b
lta a,c
lta a,d
lta a,e
lta a,h
lta a,l
add a,v
add a,a
add a,b
add a,c
add a,d
add a,e
add a,h
add a,l
ona a,v
ona a,a
ona a,b
ona a,c
ona a,d
ona a,e
ona a,h
ona a,l
adc a,v
adc a,a
adc a,b
adc a,c
adc a,d
adc a,e
adc a,h
adc a,l
offa a,v
offa a,a
offa a,b
offa a,c
offa a,d
offa a,e
offa a,h
offa a,l
sub a,v
sub a,a
sub a,b
sub a,c
sub a,d
sub a,e
sub a,h
sub a,l
nea a,v
nea a,a
nea a,b
nea a,c
nea a,d
nea a,e
nea a,h
nea a,l
sbb a,v
sbb a,a
sbb a,b
sbb a,c
sbb a,d
sbb a,e
sbb a,h
sbb a,l
eqa a,v
eqa a,a
eqa a,b
eqa a,c
eqa a,d
eqa a,e
eqa a,h
eqa a,l
ana v,a
ana a,a
ana b,a
ana c,a
ana d,a
ana e,a
ana h,a
ana l,a
xra v,a
xra a,a
xra b,a
xra c,a
xra d,a
xra e,a
xra h,a
xra l,a
ora v,a
ora a,a
ora b,a
ora c,a
ora d,a
ora e,a
ora h,a
ora l,a
addnc v,a
addnc a,a
addnc b,a
addnc c,a
addnc d,a
addnc e,a
addnc h,a
addnc l,a
gta v,a
gta a,a
gta b,a
gta c,a
gta d,a
gta e,a
gta h,a
gta l,a
subnb v,a
subnb a,a
subnb b,a
subnb c,a
subnb d,a
subnb e,a
subnb h,a
subnb l,a
lta v,a
lta a,a
lta b,a
lta c,a
lta d,a
lta e,a
lta h,a
lta l,a
add v,a
add a,a
add b,a
add c,a
add d,a
add e,a
add h,a
add l,a
adc v,a
adc a,a
adc b,a
adc c,a
adc d,a
adc e,a
adc h,a
adc l,a
sub v,a
sub a,a
sub b,a
sub c,a
sub d,a
sub e,a
sub h,a
sub l,a
nea v,a
nea a,a
nea b,a
nea c,a
nea d,a
nea e,a
nea h,a
nea l,a
sbb v,a
sbb a,a
sbb b,a
sbb c,a
sbb d,a
sbb e,a
sbb h,a
sbb l,a
eqa v,a
eqa a,a
eqa b,a
eqa c,a
eqa d,a
eqa e,a
eqa h,a
eqa l,a
ana a,v
ana a,a
ana a,b
ana a,c
ana a,d
ana a,e
ana a,h
ana a,l
xra a,v
xra a,a
xra a,b
xra a,c
xra a,d
xra a,e
xra a,h
xra a,l
ora a,v
ora a,a
ora a,b
ora a,c
ora a,d
ora a,e
ora a,h
ora a,l
addnc a,v
addnc a,a
addnc a,b
addnc a,c
addnc a,d
addnc a,e
addnc a,h
addnc a,l
gta a,v
gta a,a
gta a,b
gta a,c
gta a,d
gta a,e
gta a,h
gta a,l
subnb a,v
subnb a,a
subnb a,b
subnb a,c
subnb a,d
subnb a,e
subnb a,h
subnb a,l
lta a,v
lta a,a
lta a,b
lta a,c
lta a,d
lta a,e
lta a,h
lta a,l
add a,v
add a,a
add a,b
add a,c
add a,d
add a,e
add a,h
add a,l
ona a,v
ona a,a
ona a,b
ona a,c
ona a,d
ona a,e
ona a,h
ona a,l
adc a,v
adc a,a
adc a,b
adc a,c
adc a,d
adc a,e
adc a,h
adc a,l
offa a,v
offa a,a
offa a,b
offa a,c
offa a,d
offa a,e
offa a,h
offa a,l
sub a,v
sub a,a
sub a,b
sub a,c
sub a,d
sub a,e
sub a,h
sub a,l
nea a,v
nea a,a
nea a,b
nea a,c
nea a,d
nea a,e
nea a,h
nea a,l
sbb a,v
sbb a,a
sbb a,b
sbb a,c
sbb a,d
sbb a,e
sbb a,h
sbb a,l
eqa a,v
eqa a,a
eqa a,b
eqa a,c
eqa a,d
eqa a,e
eqa a,h
eqa a,l
ani v,0x00
ani a,0x01
ani b,0x02
ani c,0x03
ani d,0x04
ani e,0x05
ani h,0x06
ani l,0x07
xri v,0x08
xri a,0x09
xri b,0x0a
xri c,0x0b
xri d,0x0c
xri e,0x0d
xri h,0x0e
xri l,0x0f
ori v,0x10
ori a,0x11
ori b,0x12
ori c,0x13
ori d,0x14
ori e,0x15
ori h,0x16
ori l,0x17
adinc v,0x18
adinc a,0x19
adinc b,0x1a
adinc c,0x1b
adinc d,0x1c
adinc e,0x1d
adinc h,0x1e
adinc l,0x1f
gti v,0x20
gti a,0x21
gti b,0x22
gti c,0x23
gti d,0x24
gti e,0x25
gti h,0x26
gti l,0x27
suinb v,0x28
suinb a,0x29
suinb b,0x2a
suinb c,0x2b
suinb d,0x2c
suinb e,0x2d
suinb h,0x2e
suinb l,0x2f
lti v,0x30
lti a,0x31
lti b,0x32
lti c,0x33
lti d,0x34
lti e,0x35
lti h,0x36
lti l,0x37
adi v,0x38
adi a,0x39
adi b,0x3a
adi c,0x3b
adi d,0x3c
adi e,0x3d
adi h,0x3e
adi l,0x4f
oni v,0x40
oni a,0x41
oni b,0x42
oni c,0x43
oni d,0x44
oni e,0x45
oni h,0x46
oni l,0x47
aci v,0x48
aci a,0x49
aci b,0x4a
aci c,0x4b
aci d,0x4c
aci e,0x4d
aci h,0x4e
aci l,0x4f
offi v,0x50
offi a,0x51
offi b,0x52
offi c,0x53
offi d,0x54
offi e,0x55
offi h,0x56
offi l,0x57
sui v,0x58
sui a,0x59
sui b,0x5a
sui c,0x5b
sui d,0x5c
sui e,0x5d
sui h,0x5e
sui l,0x5f
nei v,0x60
nei a,0x61
nei b,0x62
nei c,0x63
nei d,0x64
nei e,0x65
nei h,0x66
nei l,0x67
sbi v,0x68
sbi a,0x69
sbi b,0x6a
sbi c,0x6b
sbi d,0x6c
sbi e,0x6d
sbi h,0x6e
sbi l,0x6f
eqi v,0x70
eqi a,0x71
eqi b,0x72
eqi c,0x73
eqi d,0x74
eqi e,0x75
eqi h,0x76
eqi l,0x77
ani pa,0x78
ani pb,0x79
ani pc,0x7a
ani mk,0x7b
xri pa,0x7c
xri pb,0x7d
xri pc,0x7e
xri mk,0x7f
ori pa,0x80
ori pb,0x81
ori pc,0x82
ori mk,0x83
adinc pa,0x84
adinc pb,0x85
adinc pc,0x86
adinc mk,0x87
gti pa,0x88
gti pb,0x89
gti pc,0x8a
gti mk,0x8b
suinb pa,0x8c
suinb pb,0x8d
suinb pc,0x8e
suinb mk,0x8f
lti pa,0x90
lti pb,0x91
lti pc,0x92
lti mk,0x93
adi pa,0x94
adi pb,0x95
adi pc,0x96
adi mk,0x97
oni pa,0x98
oni pb,0x99
oni pc,0x9a
oni mk,0x9b
aci pa,0x9c
aci pb,0x9d
aci pc,0x9e
aci mk,0x9f
offi pa,0xa0
offi pb,0xa1
offi pc,0xa2
offi mk,0xa3
sui pa,0xa4
sui pb,0xa5
sui pc,0xa6
sui mk,0xa7
nei pa,0xa8
nei pb,0xa9
nei pc,0xaa
nei mk,0xab
sbi pa,0xac
sbi pb,0xad
sbi pc,0xae
sbi mk,0xaf
eqi pa,0xb0
eqi pb,0xb1
eqi pc,0xb2
eqi mk,0xb3
writebin(filename .. '.bin')
writebin(filename .. '.bin')

View File

@ -484,12 +484,58 @@ for i,o in ipairs(op60names) do
end
end
k = 0x08
local op64names = { 'ani','xri','ori','adinc','gti','suinb','lti','adi','oni','aci','offi','sui','nei','sbi','eqi' }
for i,o in ipairs(op64names) do
for j,r in ipairs(register_names) do
local name = o .. r
if not M[name] then
local l = k
M[name] = function(late,early)
local l65dbg = { info=debug.getinfo(2, 'Sl'), trace=debug.traceback(nil, 1) }
local op = { cycles=11 }
op.size = function() late,early = M.size_op(late,early) return 3 end
op.bin = function() local l65dbg=l65dbg
local x = 0x00 + l;
local y = 0x00 + M.op_eval_byte(late,early)
return { 0x64, x, y }
end
table.insert(M.section_current.instructions, op)
end
end
k = k + 1
end
end
k = 0x88
local ex_register_names = {'pa','pb','pc','mk'}
for i,o in ipairs(op64names) do
for j,r in ipairs(ex_register_names) do
local name = o .. r
if not M[name] then
local l = k
M[name] = function(late,early)
local l65dbg = { info=debug.getinfo(2, 'Sl'), trace=debug.traceback(nil, 1) }
local op = { cycles=11 }
op.size = function() late,early = M.size_op(late,early) return 3 end
op.bin = function() local l65dbg=l65dbg
local x = 0x00 + l;
local y = 0x00 + M.op_eval_byte(late,early)
return { 0x64, x, y }
end
table.insert(M.section_current.instructions, op)
end
end
k = k + 1
end
k = k + 4
end
return M
--[[ [todo]
16 bits instructions:
0x64xx
0x70xx
0x74xx
]]--