1
0
Fork 0
mirror of https://github.com/notwa/lips synced 2024-05-08 12:13:22 -07:00

implement addressing modes for fpu load/stores

This commit is contained in:
Connor Olding 2016-12-28 02:09:15 -08:00
parent b80fb49a22
commit 272ef0fbde
3 changed files with 20 additions and 2 deletions

9
TODO
View File

@ -1,8 +1,16 @@
unify/optimize ascii/asciiz/byte/halfword/word into BIN directives unify/optimize ascii/asciiz/byte/halfword/word into BIN directives
also lex strings to binary strings, why not also lex strings to binary strings, why not
more useful string escapes e.g. \x
lex expressions in Lexer instead of its own separate lexer lex expressions in Lexer instead of its own separate lexer
;pseudo-instr for offsets not within 0x8000 range?
addiu at, t0, 0x7FFF
sb t1, 0x62FE(at)
;versus
sb t1, r0+0xE2FD(t0)
directive aliases, are these right? directive aliases, are these right?
DB = 'BYTE', DB = 'BYTE',
DH = 'HALFWORD', DH = 'HALFWORD',
@ -15,6 +23,7 @@ implement push/pop/jpop as macros
be able to point to specific args of push/pop using variables be able to point to specific args of push/pop using variables
add file-reading directives (e.g. for automatic hook injection macros) add file-reading directives (e.g. for automatic hook injection macros)
allow generation of shared object files (zelda overlays specifically) allow generation of shared object files (zelda overlays specifically)
http://wiki.cloudmodding.com/oot/Overlays#Relocation_Entry_Format
don't require colons for +/- labels (this shouldn't break anything right?) don't require colons for +/- labels (this shouldn't break anything right?)

View File

@ -31,6 +31,8 @@ function Expander:pop(kind)
ret = self.s[self.i] ret = self.s[self.i]
elseif kind == 'CPU' then elseif kind == 'CPU' then
ret = self:register(data.registers) ret = self:register(data.registers)
elseif kind == 'FPU' then
ret = self:register(data.fpu_registers)
elseif kind == 'DEREF' then elseif kind == 'DEREF' then
ret = self:deref() ret = self:deref()
elseif kind == 'CONST' then elseif kind == 'CONST' then

View File

@ -4,6 +4,13 @@ local unpack = rawget(_G, 'unpack') or table.unpack
local path = string.gsub(..., "[^.]+$", "") local path = string.gsub(..., "[^.]+$", "")
local data = require(path.."data") local data = require(path.."data")
local fpu_tob = {
LDC1=true,
LWC1=true,
SDC1=true,
SWC1=true,
}
local function name_pop(name, character) local function name_pop(name, character)
if name:sub(#name) == character then if name:sub(#name) == character then
return name:sub(1, #name - 1), character return name:sub(1, #name - 1), character
@ -51,7 +58,7 @@ local overrides = {}
local function tob_override(self, name) local function tob_override(self, name)
-- handle all the addressing modes for lw/sw-like instructions -- handle all the addressing modes for lw/sw-like instructions
local dest = self:pop('CPU') local dest = fpu_tob[name] and self:pop('FPU') or self:pop('CPU')
local offset, base local offset, base
if self:peek('DEREF') then if self:peek('DEREF') then
offset = 0 offset = 0
@ -94,7 +101,7 @@ local function tob_override(self, name)
end end
for k, v in pairs(data.instructions) do for k, v in pairs(data.instructions) do
if v[2] == 'tob' then if v[2] == 'tob' or v[2] == 'Tob' then
overrides[k] = tob_override overrides[k] = tob_override
end end
end end