Comments (6)
Came across this today, and I got some additional information:
!rb as3
org $008000
ldy #datasize(Data)
Data: db 0
_Data_End:
This produces A0 01 00 00
as expected. However:
!rb as3
org $008000
arch spc700
mov Y, #datasize(Data)
Data: db 0
_Data_End:
This produces:
Errors occurred while assembling.
: error: (Ephantom_error): A phantom error occurred. This is an Asar bug, please report it: https://github.com/RPGHacker/asar/issues
from asar.
I think that's a different issue.
<Sir Walrus> .rb as3
arch spc700
org $008000
mov Y, #1/(x-y)
x:
nop
y:
<randombot999> Errors occurred while assembling.
: error: (Ephantom_error): A phantom error occurred. This is an Asar bug, please report it: https://github.com/RPGHacker/asar/issues
from asar.
I don't think so, but even if it is, I think you've pointed out a different issue yourself. You tried dividing 1 by -1; was that your intention? Either way, mov Y, #x-y
correctly produces 8D FF 00 00
, but I assume you meant mov Y, #y-x
, which works equally fine.
from asar.
No, I intended to divide by the difference between two labels.
On the first pass, Asar assumes all unknown labels are forward labels and returns some constant (I don't know which, but it's same for all). 1/(val-val) is 1/0, which is an error. However, math errors are not reported on the first pass, it just sets the 'there was an error' flag and expects that the same error will show up on the third pass.
On the second and third passes, labels have their actual values, and 1/($8002-$8003) is just -1.
For the one you posted, I believe that Data is not defined yet, and datasize(Data) is an error. But, like the 1/(val-val) example, it only sets the error flag, it doesn't actually print anything.
In both cases, the root cause is spc700 opcodes trying to evaluate math on first pass. The 65816 opcodes don't, and spc700 shouldn't either.
We should remove the 'unknown labels are fine on first pass' thing; it does nothing useful (it did in earlier Asar versions, but apparently I never cleaned that out when it became obsolete), it just hides errors.
from asar.
For the one you posted, I believe that Data is not defined yet, and datasize(Data) is an error.
The Asar manual gives this as example codeblock for datasize()
usage:
org $008000
main:
lda #datasize(my_table) ;3
lda #datasize(other_label) ;0x7FF3 (last label, throws a warning. calculated as $FFFFFF-$00800C)
lda #datasize(main) ;9
my_table:
db $00, $00, $02
other_label:
So, based on what you said that I quoted, would that mean that the manual sports erroneous usage of it too? It's using datasize(my_table)
while my_table
is not defined yet, as far as I can see. Or there's a nuanced difference between this excerpt and mine that I'm not getting.
from asar.
We're talking about Asar bugs, so yes, there is a nuanced difference. 65816 lda #n is correctly implemented, spc700 mov y,#n is not.
from asar.
Related Issues (20)
- org Label in freespace yields too small rats tags HOT 1
- Finding freespace beyond on the end of the ROM only works if the value is 0 HOT 2
- Allow branches to take full addresses HOT 1
- asar_getlabelval throws C++ exception for missing label
- Please document deprecation of features HOT 4
- Segfault with invalid syntax in an assert HOT 2
- defining a label on the same line as an `if` statement is sometimes broken HOT 3
- allow math in labels HOT 15
- arch superfx is haunted HOT 1
- MVP and MVN documentation HOT 6
- [Asar2] Phantom Error when using array indices HOT 1
- How do I actually compile a ROM, not a patch? HOT 2
- `includeonce` breaks on some equivalent paths HOT 2
- Mapping mode detection is always lorom
- "check bankcross off" breaks "freedata" on fullsa1rom
- Trailing comma after `db` statement lacks helpful error HOT 3
- if statement can no longer have a bracket on same line HOT 3
- Freespace finder is broken when RATS tags cross banks HOT 1
- [Asar2] Three letter variable names are not accepted anymore HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asar.