#fill raises 'expected expression' error
nicolandu opened this issue · 7 comments
#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
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!
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.
@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 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.
@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 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!
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.