-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Evaluate macro parameters in outer scope
- Loading branch information
Showing
5 changed files
with
69 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
MACRO SHOW x, y | ||
PRINT x, y | ||
ASSERT(x=5) | ||
ASSERT(y=5) | ||
ENDMACRO | ||
|
||
\ Check that macro parameters are evaluated in the outer scope | ||
x=2 | ||
y=3 | ||
SHOW x+y, x+y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
MACRO LOAD address | ||
LDA address | ||
ENDMACRO | ||
|
||
ORG &2000 | ||
\ On the first pass LOAD is called with an undefined symbol. | ||
\ Test that the undefinedness propagates to the macro so | ||
\ that the LDA has the correct width (i.e. not zero page). | ||
LOAD data | ||
RTS | ||
.data | ||
EQUB 2 | ||
|
||
\ This example fails because zp moves out of zero page between | ||
\ passes. It would be better if scopes couldn't override symbols | ||
\ from outer scopes. | ||
\zp=&70 | ||
\{ | ||
\ LDA zp | ||
\ RTS | ||
\ .zp | ||
\ EQUB 3 | ||
\} |