diff --git a/doc/ca65.sgml b/doc/ca65.sgml index 978aaf159..3fc534066 100644 --- a/doc/ca65.sgml +++ b/doc/ca65.sgml @@ -3765,7 +3765,7 @@ See: , -.REFERTO +.REFERTO, .REFTO Mark a symbol as referenced. @@ -3779,11 +3779,24 @@ See: , + .ifref NegateValue ; If this subroutine is used + NegateValue: ; Define it + lda #0 + sec + sbc Value + .ifref ResetValue ; If the ResetValue is also used + jmp SetValue ; Jump over it + .else + .refto SetValue ; Ensure that SetValue will be included + .endif + .endif + .ifref ResetValue ; If this subroutine is used ResetValue: ; Define it lda #0 ; Set a default value - .referto SetValue ; Ensure that SetValue will be included + .refto SetValue ; Ensure that SetValue will be included .endif + .ifref SetValue ; If this or previous subroutine is used SetValue: sta Value diff --git a/src/ca65/scanner.c b/src/ca65/scanner.c index 2c099a517..bf0a85183 100644 --- a/src/ca65/scanner.c +++ b/src/ca65/scanner.c @@ -272,6 +272,7 @@ struct DotKeyword { { ".REF", TOK_REFERENCED }, { ".REFERENCED", TOK_REFERENCED }, { ".REFERTO", TOK_REFERTO }, + { ".REFTO", TOK_REFERTO }, { ".RELOC", TOK_RELOC }, { ".REPEAT", TOK_REPEAT }, { ".RES", TOK_RES },
+.REFERTO, .REFTO Mark a symbol as referenced. @@ -3779,11 +3779,24 @@ See: , + .ifref NegateValue ; If this subroutine is used + NegateValue: ; Define it + lda #0 + sec + sbc Value + .ifref ResetValue ; If the ResetValue is also used + jmp SetValue ; Jump over it + .else + .refto SetValue ; Ensure that SetValue will be included + .endif + .endif + .ifref ResetValue ; If this subroutine is used ResetValue: ; Define it lda #0 ; Set a default value - .referto SetValue ; Ensure that SetValue will be included + .refto SetValue ; Ensure that SetValue will be included .endif + .ifref SetValue ; If this or previous subroutine is used SetValue: sta Value diff --git a/src/ca65/scanner.c b/src/ca65/scanner.c index 2c099a517..bf0a85183 100644 --- a/src/ca65/scanner.c +++ b/src/ca65/scanner.c @@ -272,6 +272,7 @@ struct DotKeyword { { ".REF", TOK_REFERENCED }, { ".REFERENCED", TOK_REFERENCED }, { ".REFERTO", TOK_REFERTO }, + { ".REFTO", TOK_REFERTO }, { ".RELOC", TOK_RELOC }, { ".REPEAT", TOK_REPEAT }, { ".RES", TOK_RES },
Mark a symbol as referenced. @@ -3779,11 +3779,24 @@ See: , + .ifref NegateValue ; If this subroutine is used + NegateValue: ; Define it + lda #0 + sec + sbc Value + .ifref ResetValue ; If the ResetValue is also used + jmp SetValue ; Jump over it + .else + .refto SetValue ; Ensure that SetValue will be included + .endif + .endif + .ifref ResetValue ; If this subroutine is used ResetValue: ; Define it lda #0 ; Set a default value - .referto SetValue ; Ensure that SetValue will be included + .refto SetValue ; Ensure that SetValue will be included .endif + .ifref SetValue ; If this or previous subroutine is used SetValue: sta Value diff --git a/src/ca65/scanner.c b/src/ca65/scanner.c index 2c099a517..bf0a85183 100644 --- a/src/ca65/scanner.c +++ b/src/ca65/scanner.c @@ -272,6 +272,7 @@ struct DotKeyword { { ".REF", TOK_REFERENCED }, { ".REFERENCED", TOK_REFERENCED }, { ".REFERTO", TOK_REFERTO }, + { ".REFTO", TOK_REFERTO }, { ".RELOC", TOK_RELOC }, { ".REPEAT", TOK_REPEAT }, { ".RES", TOK_RES },