| |
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 :)
|
|
... 7 posts hidden. Click here to view all posts.... |
| |
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
|
| |
PopMilo
Registered: Mar 2004 Posts: 146 |
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.
|
| |
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. |
| |
Mace
Registered: May 2002 Posts: 1799 |
MagerValp's "lda #towne" should of course be "ldx #towne"... |
| |
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.
|
| |
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 ;-) |
| |
MagerValp
Registered: Dec 2001 Posts: 1078 |
Quote: MagerValp's "lda #towne" should of course be "ldx #towne"...
Good catch, thanks. |
| |
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/
|
| |
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.
|
| |
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 |