-
Notifications
You must be signed in to change notification settings - Fork 472
Description
I use ca65 quite often, and there is an inconvenience with using .PROC: some labels require to specify the root namespace explicitly, even when there is no ambiguity.
For example, this code compiles as expected:
JSR testfunc
.IFREF testfunc
testfunc:
RTS
.ENDIFBut, this variant doesn't:
.PROC caller
JSR testfunc
.ENDPROC
.IFREF testfunc
testfunc:
RTS
.ENDIFIt tells Error: Symbol 'testfunc' is undefined, but when I call the testfunc as JSR ::testfunc, it works as expected.
Probably, it was designed this way. But, it is inconsistent, sometimes it is not required to specify the root namespace. For example, this code is assembled properly without explicit root namespace:
.PROC caller
JSR testfunc
.ENDPROC
testfunc:
RTSAnother variation of the issue. This code is assembled as expected:
DEBUGMODE = 1
.IF DEBUGMODE
LDA #0
.ENDIFBut, this can't be assembled:
DEBUGMODE = 1
.PROC caller
.IF DEBUGMODE
LDA #0
.ENDIF
.ENDPROCIt tells Error: Constant expression expected, but when I use DEBUGMODE as .IF ::DEBUGMODE, it starts to work as expected.