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

#fill raises 'expected expression' error #178

Open
nicolandu opened this issue Sep 1, 2023 · 7 comments
Open

#fill raises 'expected expression' error #178

nicolandu opened this issue Sep 1, 2023 · 7 comments
Labels

Comments

@nicolandu
Copy link

nicolandu commented Sep 1, 2023

#fill complains about there being a missing expression, but is satisfied with any dummy expression. This is contrary to the documentation (wiki), available at https://github.com/hlorenzi/customasm/wiki/Working-with-banks-%E2%80%94-%23bankdef%2C-%23bank#fill-attribute

@hlorenzi
Copy link
Owner

hlorenzi commented Sep 2, 2023

Hmm, in what case exactly are you encountering the hard error? I have a few test cases for #fill, but none of them are catching it.

About it accepting any dummy expression, it's from a not-yet-implemented feature where you could provide a custom fill pattern. I should add an error to it while the feature isn't complete!

@hlorenzi hlorenzi added the bug label Sep 2, 2023
@nicolandu
Copy link
Author

nicolandu commented Sep 3, 2023

I needed to include a dummy expression in this case: #bankdef header { #size 0x10, #outp 8 * 0x0, #fill dummy }, as well as similar banks.

The error first occurred when I switched from an older version to v0.13.2. I found it odd that the error 'missing expression' was undocumented, so I tried adding #fill true, but false, 1 and 0 all seemed to silence the error as well. This led me to think that any dummy expression was fine.

@thenorili
Copy link
Contributor

@nicolandu could you please provide an asm file that reproduces the problem? I copied your example and removed dummy, but it compiles with no error.

@nicolandu
Copy link
Author

nicolandu commented Nov 5, 2023

@nicolandu could you please provide an asm file that reproduces the problem? I copied your example and removed dummy, but it compiles with no error.

This is what I had done (using Windows 10 and customasm 0.13.2):

PRG_BANK_COUNT = 2 ; PRG ROM size (x * 16 kiB)
CHR_BANK_COUNT = 1 ; CHR ROM size (y * 8 kiB)

#bankdef header   {               #size 0x10,         #outp 8 * 0x0,                          #fill dummy }
#bankdef prg      { #addr 0x8000, #size 0x8000 - 0x6, #outp 8 * 0x10,                         #fill dummy }
#bankdef vectors  { #addr 0xfffa, #size 0x6,          #outp 8 * 0x10 + 8 * 0x8000 - 8 * 0x06, #fill dummy }
#bankdef chr      {               #size 0x2000,       #outp 8 * 0x10 + 8 * 0x8000,            #fill dummy }

#bankdef zeropage { #addr 0x0,    #size 0x100 }
#bankdef oam      { #addr 0x200,  #size 0x100 }
#bankdef ram      { #addr 0x300,  #size 0x500 }


#bank header

; magic number
#d "NES", 0x1a

#d8 2 ; 2 * 16 kiB PRG ROM
#d8 1 ; 1 * 8 kiB CHR ROM
#d4 0 ; low nybble of mapper id
#d1 0
#d1 0 ; trainer presence
#d1 0 ; SRAM presence
#d1 1 ; mirroring (0:H, 1:V in memory)
#d4 0 ; high nybble of mapper id
#d4 0
#d8 0
#d8 0
#d2 0
#d1 0 ; bus conflict presence
#d1 0 ; extra RAM presence
#d2 0
#d2 0 ; region


#bank vectors
#d16 le(nmi`16)
#d16 le(reset`16)
#d16 le(irq`16)

EDIT: I don't know whether that changes anything, but this file was #included along with a few other files in my main program, if that can help.

@thenorili
Copy link
Contributor

@nicolandu the program you've provided doesn't compile, 'nmi', 'reset', and 'irq' aren't defined in this file -- probably deferred resolution until they were included. Removing those commands does not result in a compilation error.

@nicolandu
Copy link
Author

@nicolandu the program you've provided doesn't compile, 'nmi', 'reset', and 'irq' aren't defined in this file -- probably deferred resolution until they were included. Removing those commands does not result in a compilation error.

Indeed, these reset/interrupt vectors are defined in the file which includes this one. I think the issue can be closed for the time being, as it seems to be okay on your side and I don't have access to the exact setup when the error occurred. I'll keep you updated in case any similar issues arise in the future.

Thank you for your support!

@nicolandu nicolandu reopened this Nov 7, 2023
@nicolandu
Copy link
Author

It seems that the problem doesn't appear in multi-line form: whereas

#bankdef header { #size $10,  #outp 8 * $0, #fill }

doesn't work (by itself), the equivalent snippet

#bankdef header {
    #size $10
    #outp 8 * $0                        
    #fill
}

does work (by itself). I wonder if that can be of any help.

→ Tested using customasm v0.13.5, both native and web.

@nicolandu nicolandu reopened this Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants