Skip to content

Commit

Permalink
Merge pull request #1290 from nicolasnoble/imm5-fix
Browse files Browse the repository at this point in the history
Fixing assembler's imm5.
  • Loading branch information
nicolasnoble committed Apr 18, 2023
2 parents b43330d + f3c78ec commit 0093bea
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/supportpsx/assembler/assembler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ PCSX.Assembler.New = function()
ret = bit.bor(ret, bit.band(bimm16, 0xffff))
end
if code.imm5 then
ret = bit.bor(ret, code.imm5)
ret = bit.bor(ret, bit.lshift(code.imm5, 6))
end
if code.imm20 then
ret = bit.bor(ret, bit.lshift(code.imm20, 6))
Expand Down
24 changes: 12 additions & 12 deletions src/supportpsx/assembler/extra.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ PCSX.Assembler.Internals.specialInstructions = {
base = 0x00000000,
rd = checkGPR(args[1]),
rt = checkGPR(args[1]),
sa = checkImm5(args[2], 2),
imm5 = checkImm5(args[2], 2),
}
end
return {
base = 0x00000000,
rd = checkGPR(args[1]),
rt = checkGPR(args[2]),
sa = checkImm5(args[3], 3),
imm5 = checkImm5(args[3], 3),
}
end,

Expand All @@ -52,14 +52,14 @@ PCSX.Assembler.Internals.specialInstructions = {
base = 0x00000002,
rd = checkGPR(args[1]),
rt = checkGPR(args[1]),
sa = checkImm5(args[2], 2),
imm5 = checkImm5(args[2], 2),
}
end
return {
base = 0x00000002,
rd = checkGPR(args[1]),
rt = checkGPR(args[2]),
sa = checkImm5(args[3], 3),
imm5 = checkImm5(args[3], 3),
}
end,

Expand All @@ -72,14 +72,14 @@ PCSX.Assembler.Internals.specialInstructions = {
base = 0x00000003,
rd = checkGPR(args[1]),
rt = checkGPR(args[1]),
sa = checkImm5(args[2], 2),
imm5 = checkImm5(args[2], 2),
}
end
return {
base = 0x00000003,
rd = checkGPR(args[1]),
rt = checkGPR(args[2]),
sa = checkImm5(args[3], 3),
imm5 = checkImm5(args[3], 3),

}
end,
Expand All @@ -93,14 +93,14 @@ PCSX.Assembler.Internals.specialInstructions = {
base = 0x00000004,
rd = checkGPR(args[1]),
rt = checkGPR(args[1]),
sa = checkImm5(args[2], 2),
imm5 = checkImm5(args[2], 2),
}
end
return {
base = 0x00000004,
rd = checkGPR(args[1]),
rt = checkGPR(args[2]),
sa = checkImm5(args[3], 3),
imm5 = checkImm5(args[3], 3),
}
end,

Expand All @@ -113,14 +113,14 @@ PCSX.Assembler.Internals.specialInstructions = {
base = 0x00000006,
rd = checkGPR(args[1]),
rt = checkGPR(args[1]),
sa = checkImm5(args[2], 2),
imm5 = checkImm5(args[2], 2),
}
end
return {
base = 0x00000006,
rd = checkGPR(args[1]),
rt = checkGPR(args[2]),
sa = checkImm5(args[3], 3),
imm5 = checkImm5(args[3], 3),
}
end,

Expand All @@ -133,14 +133,14 @@ PCSX.Assembler.Internals.specialInstructions = {
base = 0x00000007,
rd = checkGPR(args[1]),
rt = checkGPR(args[1]),
sa = checkImm5(args[2], 2),
imm5 = checkImm5(args[2], 2),
}
end
return {
base = 0x00000007,
rd = checkGPR(args[1]),
rt = checkGPR(args[2]),
sa = checkImm5(args[3], 3),
imm5 = checkImm5(args[3], 3),
}
end,

Expand Down

0 comments on commit 0093bea

Please sign in to comment.