re-named int to word
parent
229a7b73fa
commit
97b12551e5
43
assembler.rb
43
assembler.rb
|
@ -7,8 +7,7 @@ def zero_fill(pos)
|
|||
end
|
||||
end
|
||||
|
||||
# TODO: RENAME TO WORD
|
||||
def int(i)
|
||||
def word(i)
|
||||
$bytes.push((i & 0x000000ff),
|
||||
(i & 0x0000ff00) >> 8,
|
||||
(i & 0x00ff0000) >> 16,
|
||||
|
@ -28,7 +27,7 @@ def jmp(addr)
|
|||
raise "jmp addr must be 4 byte aligned" if addr % 4 != 0
|
||||
op = 0b0000_1000_0000_0000_0000_0000_0000_0000
|
||||
op = op | ((addr >> 2) & 0b11_11111111_11111111_11111111)
|
||||
int op
|
||||
word op
|
||||
end
|
||||
|
||||
def jal(addr)
|
||||
|
@ -36,11 +35,11 @@ def jal(addr)
|
|||
raise "jmp addr must be 4 byte aligned" if addr % 4 != 0
|
||||
op = 0b0000_1100_0000_0000_0000_0000_0000_0000
|
||||
op = op | ((addr >> 2) & 0b11_11111111_11111111_11111111)
|
||||
int op
|
||||
word op
|
||||
end
|
||||
|
||||
def nop
|
||||
int 0x00000000
|
||||
word 0x00000000
|
||||
end
|
||||
|
||||
# load upper immediate
|
||||
|
@ -49,7 +48,7 @@ def lui(reg, val)
|
|||
op = 0b001111_00000_00000_0000000000000000
|
||||
op |= (0b11111 & reg) << 16
|
||||
op |= 0xffff & val
|
||||
int op
|
||||
word op
|
||||
end
|
||||
|
||||
|
||||
|
@ -66,16 +65,16 @@ $base_addr = 0x80010000 # 0x10000 # 0x80010000
|
|||
# # # EXE HEADER # # #
|
||||
string "PS-X EXE"
|
||||
zero_fill 0x00f
|
||||
int $base_addr # initial pc
|
||||
int 0x00000000 # initial GP/R28
|
||||
int $base_addr # destintation address in RAM
|
||||
int 0x800 # file size excluding header (must be N * 0x800)
|
||||
int 0x00000000 # Unknown/Unused
|
||||
int 0x00000000 # Unknown/Unused
|
||||
int 0x00000000 # Memfill start address
|
||||
int 0x00000000 # Memfill size in bytes
|
||||
int 0x801ffff0 # Initial SP/R29 & FP/R30 Base
|
||||
int 0x00000000 # Initial SP/R29 & FP/R30 Offs
|
||||
word $base_addr # initial pc
|
||||
word 0x00000000 # initial GP/R28
|
||||
word $base_addr # destintation address in RAM
|
||||
word 0x800 # file size excluding header (must be N * 0x800)
|
||||
word 0x00000000 # Unknown/Unused
|
||||
word 0x00000000 # Unknown/Unused
|
||||
word 0x00000000 # Memfill start address
|
||||
word 0x00000000 # Memfill size in bytes
|
||||
word 0x801ffff0 # Initial SP/R29 & FP/R30 Base
|
||||
word 0x00000000 # Initial SP/R29 & FP/R30 Offs
|
||||
zero_fill 0x4b # Reserved for A(43h) Function
|
||||
# Ascii marker would go here
|
||||
zero_fill 0x7ff
|
||||
|
@ -100,13 +99,13 @@ lui 2, 1
|
|||
# int 0b101011_00010_00001_01111111_11111111
|
||||
|
||||
string "this is a test lol"
|
||||
int 0xFFAAFFAA
|
||||
int 0b001001_11101_11101_11111111_11111111
|
||||
int 0b001000_11101_11101_11111111_11111111
|
||||
word 0xFFAAFFAA
|
||||
word 0b001001_11101_11101_11111111_11111111
|
||||
word 0b001000_11101_11101_11111111_11111111
|
||||
|
||||
int 0xAAFFAAFF
|
||||
int 0b001001_00101_00101_11111111_11111111
|
||||
int 0b001000_00101_00101_11111111_11111111
|
||||
word 0xAAFFAAFF
|
||||
word 0b001001_00101_00101_11111111_11111111
|
||||
word 0b001000_00101_00101_11111111_11111111
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue