| |
Pixman Account closed
Registered: Dec 2001 Posts: 42 |
Converting ACME code to Kick Assembler
In this code there are some confusing lines (since there are no proper ACME manuals):
http://codebase64.org/doku.php?id=base:double_irq
lda #$00 ;Reload A,X,and Y
reseta1 = *-1 ;registers
ldx #$00
resetx1 = *-1
ldy #$00
resety1 = *-1
Someone on #c-64 told me = is for the current Program Counter.
But there is no equivalent to this in Kick Assembler.
Solve it with branches?
I seriously have no idea how to fix this problem.
Any suggestions?
Tnx,
Pix |
|
... 80 posts hidden. Click here to view all posts.... |
| |
JackAsser
Registered: Jun 2002 Posts: 2014 |
Quote: hehe, that kinda defeats the whole new syntax thing though =)
Yeah, indeed.
Suggestion:
; 8-bit argument
sta arg
lda arg:#$00
; 16-bit argument
lda #<$c020
sta <addr
lda #>$c020
sta >addr
...
bit addr:$0000
|
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
args. operators that change their meaning depending on what labels come after them? /o\ |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
very neat suggestions. but sta >addr would conflict with normal usage of >< |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
how about sta addr> and sta addr< |
| |
Krill
Registered: Apr 2002 Posts: 2980 |
To be honest, this looks like syntactical sachharin to me, creating more problems than it solves. A 6502 op-code is always one byte, its first argument byte always one byte later, and the second two. I see no problem with the classical way of doing it, e.g.store: sta $1234
[...]
stx store + 1; set lo-byte of argument address
sty store + 2; set hi-byte of argument address To make it a bit fancier (and cleaner, depending on taste), use macros, so you can dostore: sta $1234
[...]
stx SELFMODLO(store); set lo-byte of argument address
sty SELFMODHI(store); set hi-byte of argument address |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
I don't mind writing +1 at the end of the label reference, if we should do that better it must only be one char since +1 is only two.
I see alot of possibilities in this:
- It makes a label point to the argument, so you can easier switch between 'normal label before byte directive' and 'selfmodifying code'.
- You don't have to reuse a loop label as an argument label, you can do: loop: lda.a memPos:$0000 - When a label is inside a library routine it might be good that the caller don't know what the implmentations is behind it:myRoutine: {
lda color
sta $d020
rts
color: byte 0
} ormyRoutine: {
lda color:#$00
sta $d020
rts
} - Visually, It might make it easier to find your loop labels as there are fewer labels on the left of the screen. (Again it might make it harder to find you argument labels since they don't start at column 0)
- It makes it clearer what the purpose of the label is.
- Users don't have to use the syntax, so it don't cripple anybodys codingstyle - you can always use good old +2 if you want to.
- It works nicely without +1 for all one byte arguments
I think its a matter of style, and it have to be tried in practise to figure out if its good or not and taste is individual. You never improve your style if you don't try something new.
Krill: Indeed it is syntactic sugar, since you could do the same by combining a mnemonic an a user defined label. |
| |
Skate
Registered: Jul 2003 Posts: 494 |
Slammer, I liked that syntax. I'd definitely use it. |
| |
Bitbreaker
Registered: Oct 2002 Posts: 508 |
These are the coder's problems when we wait for the graphics to be done. |
| |
ChristopherJam
Registered: Aug 2004 Posts: 1409 |
I like that syntax a lot.
Happy to be using +1 to get to the high byte; I already do that for zero page pointers anyway, this way I'd not be using +0/+1 for zp, +1/+2 for SMC.
It removes the overloading where sometimes +1 means SMC and sometimes it means high byte.
(oh, and a belated +1 for JackAsser's comment that newbies should be using stack rather than SMC anyway. Optionally only save what you're going to trash too - applies as much to AXY as it does to $01) |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
An argument label could generate 3 labels: lda.a memPos:$1000 // Generates: memPos, memPosLo, memPosHi This enforces a special naming convention, which I don't like (It should be up to the user).
We could also make fields on labels. So you could do:sta memPos.lo
stx memPos.hi
...
lda.a memPos:$1000 That would remove the need for +1. There are alot of possibilities :-) |
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 - Next |