| |
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 |
|
| |
Endurion
Registered: Mar 2007 Posts: 73 |
= sets a label's value. * = current program Counter
so reseta1 is set to the current program Counter - 1
I can't believe Kick Ass wouldn't have something similar, that's a quite essential Feature. |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
ya. reseta is the addy of #$00 in lda #$00.
and * works.
http://www.theweb.dk/KickAssembler/webhelp/content/ch03s05.html |
| |
Angel of Death
Registered: Apr 2008 Posts: 211 |
Ehmm... This has nothing to do with ACME itself. This is one of the oldest tricks there are used since the very first assemblers were around.
And the manual provided with ACME is fine and readable, so...
Are you sure you are ready for kickassembler yet? ;) |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
thats what you get for having the attention span of a fruit fly |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
The syntax is not that different.
- Use // instead of ; for comments
- Use : at the end of labels.
- Use .label x=*+1 when you want to define a user defined label
- In older Kick Ass versions use .pc=$1000 instead of *=$1000
You could use the converter by Noice. Copy-paste your example into this form and get a converted output: http://tasmtokickass.insoft.se
The output is KickAss3.x but will also work in 4.x, and will work fine for your purpose.
Feel free to join https://www.facebook.com/groups/RetroAssembler/
A lot of the same people who hang around on CSDb is also is on RetroAssembler, but the discussion is a bit more friendly. |
| |
ChristopherJam
Registered: Aug 2004 Posts: 1409 |
Interesting coding style. Personally I tend to express that pattern like this, albeit with the disadvantage of having to add the +1s if I move to SMC from (eg) zero page vars.
sta reseta1+1 ;Preserve A,X and Y
stx resetx1+1 ;registers
sty resety1+1 ;via self modifying code
...
reseta1
lda #$00 ;Reload A,X,and Y
resetx1 ;registers
ldx #$00
resety1
ldy #$00
|
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
Quote: Interesting coding style. Personally I tend to express that pattern like this, albeit with the disadvantage of having to add the +1s if I move to SMC from (eg) zero page vars.
sta reseta1+1 ;Preserve A,X and Y
stx resetx1+1 ;registers
sty resety1+1 ;via self modifying code
...
reseta1
lda #$00 ;Reload A,X,and Y
resetx1 ;registers
ldx #$00
resety1
ldy #$00
I do the same. I think its more readable. just I put the labels infront of the instructions. moving from zp changes a lot in the other case aswell. its a small issue.
sta reseta1+1 ;Preserve A,X and Y
stx resetx1+1 ;registers
sty resety1+1 ;via self modifying code
...
reseta1 lda #$00 ;Reload A,X,and Y registers
resetx1 ldx #$00
resety1 ldy #$00
|
| |
Frantic
Registered: Mar 2003 Posts: 1648 |
In my case I tend to do similar to the original example, except putting it before the instruction rather than after:
myvariable = *+1
lda #$ff
Having that *+1 stuff at the line before an instruction immediately tells me that this is about self modifying code rather than being a program flow label (e.g. a label that you branch/jump to). Not saying that this is "the best way to do it". Just explicating why I do it the way I do.
...and, doing it this way, I don't have to put "+1" and stuff after the labels when accessing it. This means that if I change a variable from being stored in a "data segment" (so to speak) to being stored in (selfmodifying) code instead, I don't have to change all variable references to "sta myvariable+1" but I can just keep on using "sta myvariable". |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
"...and, doing it this way, I don't have to put "+1" and stuff after the labels when accessing it."
when you put +1 after the labels its an implied sign that your code deals with self modify there. otherwise its just a label there and there's no way to tell if its a var or smc.
also you get even more clutter in the way of clean code when you want to selfmod 16bit abs value.
but its a matter of taste. |
| |
Pixman Account closed
Registered: Dec 2001 Posts: 42 |
Thanks for your help, Oswald.
But *-1 doesn't work. I found a solution, though:
.pc = *-1
Compiles!
€dit: Assembles, sorry
Yay! |
... 80 posts hidden. Click here to view all posts.... |
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 - Next |