Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Converting ACME code to Kick Assembler
2016-06-19 03:24
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
2016-06-19 05:20
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.
2016-06-19 06:25
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
2016-06-19 07:17
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? ;)
2016-06-19 08:05
chatGPZ

Registered: Dec 2001
Posts: 11386
thats what you get for having the attention span of a fruit fly
2016-06-19 11:08
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.
2016-06-19 16:46
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
2016-06-19 17:37
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
2016-06-19 19:17
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".
2016-06-19 20:51
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.
2016-06-19 21:03
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
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
csabanw
Magic/Nah-Kolor
psych
JackAsser/Booze Design
bepp/ΤRIΛD
Guests online: 110
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top NTSC-Fixers
1 Pudwerx  (10)
2 Booze  (9.7)
3 Stormbringer  (9.7)
4 Fungus  (9.6)
5 Grim Reaper  (9.3)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.047 sec.