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 > -Set multiple values according to table- routine ?
2011-05-08 14:56
PopMilo

Registered: Mar 2004
Posts: 145
-Set multiple values according to table- routine ?

What do you guys think: what would be a best way for routine that would set multiple values in memory according to simple table ?

Example:

Instead of this:
lda #$00
sta $d020
lda #$0f
sta $d022
lda #$ff
sta $d012

Something like this:
ldx #>table
ldy #<table
jsr setvalues

table .word $D020
      .byte $0
      .word $D022
      .byte $0f
      .word $D012
      .byte $ff
      .byte $0,$0    ; end of table


Or maybe it could be done with macros ?

ps. I don't think I would save any memory with this, it wouldn't be faster, but at least it's something to do in a free afternoon :)
 
... 7 posts hidden. Click here to view all posts....
 
2011-05-08 19:11
Cruzer

Registered: Dec 2001
Posts: 1048
For easy-to-read and more compact sourcecode I'm using a KickAss pseudocommand called mb ("move byte') for simple lda/sta's.
.pseudocommand mb arg1;arg2 {
	lda arg1
	sta arg2
}

With this your code would look like:
:mb #$00; $d020
:mb #$0f; $d022
:mb #$ff; $d012
2011-05-08 19:47
PopMilo

Registered: Mar 2004
Posts: 145
KickAss does seem like good choice for new asm (I'm still using tasm :) ).

I did try it when it came out, but I remember some bugs prevented me from using it. As I see now, lots of new versions and lots of bug fixes.

Will give it a go.
2011-05-08 21:03
Cruzer

Registered: Dec 2001
Posts: 1048
Yep, KickAss has reached a much more stable state since the early days in 2005/06. It's years since I have encountered any serious bug. I also know that Slammer has written a huge test suite (100s of unit tests as far as I remember) which get checked before each release.
2011-05-09 09:07
Mace

Registered: May 2002
Posts: 1799
MagerValp's "lda #towne" should of course be "ldx #towne"...
2011-05-09 09:25
PopMilo

Registered: Mar 2004
Posts: 145
Does Kick assembler have something like XASM, MADS - DTA directive ?

It is like .byte or .word but types of values can be mixed.

so instead of:

.byte $00
.word $d000

it looks like this:

dta $00,a($d000)

"a()" is used for "lo hi address" type.

---------------------------------------
Just red kickass manual... Lists, hashtables, vectors... It sure is much more than simple compiler :)

So even if does not have "dta" I can make one.
2011-05-09 18:12
Slammer

Registered: Feb 2004
Posts: 416
No not at the moment. If I see a good notation i might give it a go.

MADS assembler.. Sounds like a good one ;-)
2011-05-09 19:10
MagerValp

Registered: Dec 2001
Posts: 1055
Quote: MagerValp's "lda #towne" should of course be "ldx #towne"...

Good catch, thanks.
2011-05-09 20:22
PopMilo

Registered: Mar 2004
Posts: 145
Quote: No not at the moment. If I see a good notation i might give it a go.

MADS assembler.. Sounds like a good one ;-)


I'll try Kickassembler and make macros for something like this.

@MADS:
Yeah, name is well chosen :)

It is made by Polish Atari group so all instructions are in Polish - that can make a foreigner go mad.

Great 6502 assembler thou, lots of cool features. A8 specific.
"MAD-ASSEMBLER"
http://mads.atari8.info/
2011-09-01 00:34
Glasnost
Account closed

Registered: Aug 2011
Posts: 26
y try macro or pseudocommand in kickass.


with a defined as:

.pseudocommand a adress;value {.word adress .byte value}

you can write it down as
:a $d020;0
:a $d022;$0f
:a $d012;$ff

and make that script for initialising variables.

or as cruzer recommends for the faster runtime and more readable program.

2011-09-01 06:52
PopMilo

Registered: Mar 2004
Posts: 145
@Glasnost: Thanks!
That looks just like that dta archive from atari assembler.

I'm using simple macro (lda #n sta ad) for now.
As always it turns out - "keep it simple" is still best way to go :)

ps. I do have ideas about my own new compiler ;)
Previous - 1 | 2 - 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
Martin Piper
Sentinel/Excess/TREX
Didi/Laxity
lA-sTYLe/Quantum
Guests online: 113
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Memento Mori  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Onscreen 5k  (9.5)
8 Wafer Demo  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Fullscreen Graphicians
1 Carrion  (9.8)
2 Joe  (9.8)
3 Duce  (9.8)
4 Mirage  (9.7)
5 Facet  (9.7)

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