grumpycoders / pcsx-redux

The PCSX-Redux project is a collection of tools, research, hardware design, and libraries aiming at development and reverse engineering on the PlayStation 1. The core product itself, PCSX-Redux, is yet another fork of the Playstation emulator, PCSX.
https://pcsx-redux.consoledev.net
GNU General Public License v2.0
637 stars 96 forks source link

Assembling li opcode results in lui #1684

Closed marco-calautti closed 2 months ago

marco-calautti commented 2 months ago

Describe the bug

When trying to assemble an instruction like li $a0,4 the resulting instruction is instead lui a$0,4. I Need to write addiu $a0,@r0,4 to get the desired effect.

Expected behavior

The correct instruction is assembled. Considering pcsx-redux is able to show pseudo instructions like li, It would be useful to also be able to assemble them. If this is not desired, then it would be better to issue an error, rather than assembling to the wrong instruction.

Steps to reproduce the bug

  1. Open debugger
  2. Right-click on any visible instruction, and select assemble opcode
  3. Write li @a0, 4 and click assemble
  4. The resulting instruction is a lui

Operating System

Arch Linux

PCSX-Redux version

Current latest AppImage

CPU model

i7

GPU model & Drivers

gtx 1650ti

BIOS version

SCPH1001

Options

Iso checks

No response

Logs

No response

Additional information

No response

nicolasnoble commented 2 months ago

Oooh, that's definitely sounding like a copy paste mistake in the assembler code. Should be an easy fix, thank you. https://github.com/grumpycoders/pcsx-redux/blob/main/src/supportpsx/assembler/pseudo.lua#L40

Also reading this, it doesn't handle the full lui case of doing li XX, 0x12340000.