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

Predefined constants do not work, like _PI #54

Closed
Sanqui opened this issue Feb 10, 2015 · 1 comment · Fixed by #55
Closed

Predefined constants do not work, like _PI #54

Sanqui opened this issue Feb 10, 2015 · 1 comment · Fixed by #55

Comments

@Sanqui
Copy link
Member

Sanqui commented Feb 10, 2015

_PI is defined with sym_AddEqu during sym_Init, but that's broken for some reason.

sanky@warata:~/romhacking/rgbds_$ cat test.asm
SECTION "rst00",HOME[0]

db _PI % 256
sanky@warata:~/romhacking/rgbds_$ rgbasm test.asm
ERROR:  test.asm(3) :
    '_PI' not defined
Segmentation fault (core dumped)
@Sanqui
Copy link
Member Author

Sanqui commented Feb 10, 2015

In addition, for purposes of comparison, constants like these are treated as undefined, but the opposite case still gets parsed. This is in contrast to real undefined constants, for which the opposite use case is not parsed.

Contrived example:

sanky@warata:~/romhacking/rgbds_$ cat test.asm
SECTION "rst00",HOME[0]
IF !DEF(WHATEVER)
    db "_WHATEVER IS NOT DEFINED\n"
ENDC

IF DEF(WHATEVER)
    stop
    db "_WHATEVER IS DEFINED\n"
ENDC
sanky@warata:~/romhacking/rgbds_$ ./rgbasm -o test_ test.asm
sanky@warata:~/romhacking/rgbds_$ cat test_
RGB2�������_WHATEVER IS NOT DEFINED



sanky@warata:~/romhacking/rgbds_$ gedit test.asm
sanky@warata:~/romhacking/rgbds_$ cat test.asm
SECTION "rst00",HOME[0]
IF !DEF(_Z80)
    db "_Z80 IS NOT DEFINED\n"
ENDC

IF DEF(_Z80)
    db "_Z80 IS DEFINED\n"
ENDC
sanky@warata:~/romhacking/rgbds_$ ./rgbasm -o test_ test.asm
sanky@warata:~/romhacking/rgbds_$ cat test_
RGB2�������_Z80 IS NOT DEFINED



sanky@warata:~/romhacking/rgbds_$ gedit test.asm
sanky@warata:~/romhacking/rgbds_$ cat test.asm
SECTION "rst00",HOME[0]
IF !DEF(_Z80)
    db "_Z80 IS NOT DEFINED\n"
ENDC

IF DEF(_Z80)
    stop
    db "_Z80 IS DEFINED\n"
ENDC
sanky@warata:~/romhacking/rgbds_$ ./rgbasm -o test_ test.asm
ERROR:  test.asm(7) :
    STOP is not a Z80 instruction
rgbasm: Assembly aborted in pass 1 (1 errors)!
sanky@warata:~/romhacking/rgbds_$ 

@Sanqui Sanqui mentioned this issue Feb 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant