| |
Sasq
Registered: Apr 2004 Posts: 155 |
Wanted: Source codes (for badass)
In order to improve my assembler it would be great to try it on existing projects.
So if you have sources for demos/intros/games that you don't mind sharing it would be kind if you could send them my way, and I'll try to get them working in bass.
They need to be buildable the normal way (Kickass, Acme or whatever) so I can compare the output binaries...
(this also means that if your type of demos requires special tools there is a greater chance I will include such functionality in bass).
-- sasq64@gmail.com |
|
... 65 posts hidden. Click here to view all posts.... |
| |
tlr
Registered: Sep 2003 Posts: 1714 |
Quote: well 68k, x86 and any other arch needs this kind of syntax since they can load 8, 16, 32+ bit words. On 6502 you only need a distinction because of the zero page. I'd rather have the one byte address be always ZP and 2 byte address always be a full address, i.e
lda $00 = zp load
lda $000 = normal load
Yes, but what about things like: lda lab,x
lab equ $f0 + 15 Do you want lda <abs>,x or lda <zp>,x? |
| |
tlr
Registered: Sep 2003 Posts: 1714 |
Quote: I have now refactored the assembler into using an AST for parsing, so parsing does not have to happen for every pass, and not for every rept, define or other block.
For instance, a !rept 30000 { opcode } is now around 15x faster.
It also means the parser can become a lot more advanced.
Yay! An AST really pays off.
All this discussion actually got inspired to update mine a bit too. My aim might be a bit different though, although I noticed I'd put lua scripting in the TODO too. :) |
| |
Krill
Registered: Apr 2002 Posts: 2844 |
Quoting tlrYes, but what about things like: lda lab,x
lab equ $f0 + 15 Do you want lda <abs>,x or lda <zp>,x? Sum is $ff, so this is not really ambiguous yet, i guess.
I'd implement the type promotion from ZP to mem16 access to happen when the result is at least $0100.
If this would belab = $00f0 + 15 instead, it would mean mem16 access, as the biggest type is mem16 in that expression.
But there should be some way to explicity force ZP access on a symbol (when all operands in an expression have type ZP but result in a value >255).
Could be as simple as "symbol = <( ... bla... expression )", though. :) |
| |
tlr
Registered: Sep 2003 Posts: 1714 |
Quoting KrillQuoting tlrYes, but what about things like: lda lab,x
lab equ $f0 + 15 Do you want lda <abs>,x or lda <zp>,x? Sum is $ff, so this is not really ambiguous yet, i guess.
I'd implement the type promotion from ZP to mem16 access to happen when the result is at least $0100.
If this would belab = $00f0 + 15 instead, it would mean mem16 access, as the biggest type is mem16 in that expression. It was probably a bad example. $100 - 15 would be a better example. If the result is interpreted as zp, then the behaviour would be different.
Your idea with mem16 would solve that case if I understand it correctly. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11116 |
I'd prefer those ambigious cases to just show an error, so i am forced to write into the code explicitly what i mean/want. All those "smart" automatisms *will* fail to do what you intended in one case or another - and result in a night of WTF |
| |
Krill
Registered: Apr 2002 Posts: 2844 |
Quoting tlr$100 - 15 would be a better example. If the result is interpreted as zp, then the behaviour would be different.
Your idea with mem16 would solve that case if I understand it correctly. I think most sensible would be to remain with the mem16 type in such a case. Then there is no implicit type demotion from mem16 to ZP, which i think would do more harm than good anyways. There was a 16-bit address on the way somewhere, probably for a good reason. :)
But then yeah, maybe what Groepaz said. Might be a good idea to have an option (default setting to be discussed) to force the programmer to mark the result type explicitly if the individual types within an expression are mixed. Then there is no implicit type conversion in any direction. This might be a bit annoying, as i'd prefer "$0100 + 15" over "$0100 + $000f" for getting 16-bit memory access without any warnings or errors. |
| |
JackAsser
Registered: Jun 2002 Posts: 1989 |
Quote: I'd prefer those ambigious cases to just show an error, so i am forced to write into the code explicitly what i mean/want. All those "smart" automatisms *will* fail to do what you intended in one case or another - and result in a night of WTF
Agreed |
| |
Golara Account closed
Registered: Jan 2018 Posts: 212 |
I would skip the whole math and just use what's in the code, that is.
lda $f0 + $0A = lda $00 (still zp)
lda $00f0 + $0a = lda $0100
But since Sasq says it's more complicated to parse or whatever... well, too bad. I'm just saying what I'd be happy with |
| |
Krill
Registered: Apr 2002 Posts: 2844 |
Quoting GolaraI would skip the whole math and just use what's in the code, that is.
lda $f0 + $0A = lda $00 (still zp)
lda $00f0 + $0a = lda $0100
But since Sasq says it's more complicated to parse or whatever... well, too bad. I'm just saying what I'd be happy with This seems to be the "largest type in expression determines access size" and "no type demotion" idea i detailed above. |
| |
Golara Account closed
Registered: Jan 2018 Posts: 212 |
Quote: Quoting GolaraI would skip the whole math and just use what's in the code, that is.
lda $f0 + $0A = lda $00 (still zp)
lda $00f0 + $0a = lda $0100
But since Sasq says it's more complicated to parse or whatever... well, too bad. I'm just saying what I'd be happy with This seems to be the "largest type in expression determines access size" and "no type demotion" idea i detailed above.
Point is, I don't think the automatic optimization to ZP is necessary, ZP is pretty small and always used knowingly. Adding a postfix like lda.w sta.b would be ugly, since only few opcodes would use that and it would destroy the perfect 3 characters for opcode rule which I really like.
For numbers that are generated in a loop, like :
.for (var i = 0; i < 100; i++) {
lda i
sta i+10
}
I'd just add a static zero of a 1 or 2 bytes size
.for (var i = 0; i < 100; i++) {
lda $00 + i
sta $0000 + i + 10
}
|
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 - Next |