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: 146
-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 :)
 
... 10 posts hidden. Click here to view all posts....
 
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: 146
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: 1078
Quote: MagerValp's "lda #towne" should of course be "ldx #towne"...

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

Registered: Mar 2004
Posts: 146
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: 146
@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
DeMOSic/MS^LSD^ONS
kbs/Pht/Lxt
Sepa/OCD
Andy/AEG
MCM/ONSLAUGHT
theK/ATL
Peacemaker/CENSOR/Hi..
New Design/Excess
MightyAxle
LDX#40
algorithm
Guests online: 98
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 Censor Design  (9.3)
5 Triad  (9.3)
Top Diskmag Editors
1 Magic  (9.8)
2 hedning  (9.6)
3 Jazzcat  (9.5)
4 Elwix  (9.1)
5 Remix  (9.1)

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