Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for instructions with a "(reg+expression)" argument and parenthesis in the expression #17

Merged

Conversation

Konamiman
Copy link
Owner

Instructions with a (reg+expression) argument were throwing an error when the expression had itself parenthesis. This was due to an error in the regular expressions used to parse the source code.

The fix can be tested with the following code:

    ld a,(ix+(1))
    ld a,(ix+1)    
    
    set 0,(iy+(1))
    set 0,(iy+1)
    
    .cpu Z280

    ld a,(sp+(1))
    ld a,(sp+1)

    ld a,(pc+(1))
    ld a,(pc+1)

    ld a,(hl+(1))
    ld a,(hl+1)

Without this fix the instructions with +(1) will fail with "invalid argument" or "constant not found" errors, with the fix these will assemble as expected:

  0000'   DD 7E 01                  ld a,(ix+(1))
  0003'   DD 7E 01                  ld a,(ix+1)    
                                
  0006'   FD CB 01 C6               set 0,(iy+(1))
  000A'   FD CB 01 C6               set 0,(iy+1)
                                
                                    .cpu Z280
                                
  000E'   DD 78 01 00               ld a,(sp+(1))
  0012'   DD 78 01 00               ld a,(sp+1)
                                
  0016'   FD 78 01 00               ld a,(pc+(1))
  001A'   FD 78 01 00               ld a,(pc+1)
                                
  001E'   FD 7B 01 00               ld a,(hl+(1))
  0022'   FD 7B 01 00               ld a,(hl+1)

These instructions were failing when the expression had parenthesis.
@Konamiman Konamiman added this to the v1.3.1 milestone Jan 31, 2025
@Konamiman Konamiman self-assigned this Jan 31, 2025
@Konamiman Konamiman merged commit 0ed8df8 into master Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant