| |
Slammer
Registered: Feb 2004 Posts: 416 |
Kick Assembler Thread 2
The previous thread took a little long to load, so this is a new fresh one.. |
|
... 592 posts hidden. Click here to view all posts.... |
| |
TWW
Registered: Jul 2009 Posts: 543 |
So my "Stupid ZP fix" wasn't so stupid after all then 8-D
Not really important but any plans on including mnemonic extensions (ref. Table 3.4. in the manual) for psuedos? |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
Never thought of that. If there is a need then I'll put it in the todo list. |
| |
Cruzer
Registered: Dec 2001 Posts: 1048 |
Good idea, TWW! I vote for putting it on the TODO list. |
| |
TWW
Registered: Jul 2009 Posts: 543 |
Aaannd... If you're really feeling like boored, include some more adressing modes in the extensions;
Program Counter Relative Long
BRL $1234
Stack Relative
LDA 15,S
Stack Relative Indirect Indexed Y
LDA (9,S),Y
Block Move
MVP 0,0
Absolute Long
LDA $123456
Absolute Long Indexed X
LDA $123456,X
Absolute Indexed Indirect
JMP ($1234,X)
Absolute Indirect Long
JMP [$1234]
Direct Page Indirect
LDA ($12)
Direct Page Indirect Long
LDA [$12]
Direct Page Indirect Long Indexed Y
LDA [$77],Y
Anyways, just a suggestion (And a boon for those of us who wishes to play more with the 65C816). |
| |
Carlos Account closed
Registered: Mar 2009 Posts: 15 |
Maybe this is a bit silly question but i'm starting with KickAss (and with asm in general...)
I have made a small macro library (change vic bank, change vic mode and things like that...) i have, for instance, a macro like:
.macro setBackground(color)
{
lda #color
sta $d021
}
nothing fancy, works ok if i use it.
Now i want use it from my mainloop to change the background color when i move the joystick up:
.var color = 0
read_joy:
lda $dc00
lsr
bcc joy_up
jmp read_joy
joy_up:
.eval color++
:setBackground(color)
jmp read_joy
i tought that the .var directive was the answer to my problem but seems that's only evaluated while assembling not during execution (so this code only works once).
Any idea how to set some kind of 'variable' in my main loop and use it as a parameter to a macro? |
| |
Cruzer
Registered: Dec 2001 Posts: 1048 |
Yes, variables and other fancy stuff is only evaluated during assembly. Nothing but the machine code is compiled to the executable, so it's not like a normal programming language where you can do color++ in "realtime". In your case you need a memory location to hold your color value, and a machine code way of incrementing it:
read_joy:
lda $dc00
lsr
bcc joy_up
jmp read_joy
joy_up:
inc color
lda color
sta $d021
jmp read_joy
color: .byte 0
|
| |
Carlos Account closed
Registered: Mar 2009 Posts: 15 |
Yeah.. this was my second approach but, as far as i know, i can't use a memory location as the parameter of a KickAss macro. I have tested it and the assembler gives no error but nothing happens:
read_joy:
lda $dc00
lsr
bcc joy_up
jmp read_joy
joy_up:
inc color
:setBackground(color)
jmp read_joy
color: .byte 0
|
| |
Cruzer
Registered: Dec 2001 Posts: 1048 |
Change the macro to this, to avoid immediate addressing mode:
.macro setBackground(color) {
lda color
sta $d021
} |
| |
Carlos Account closed
Registered: Mar 2009 Posts: 15 |
Great! didn't notice that.. thks Cruzer. |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
Once you get more comfortable with the basic stuff, you can start using pseudocommands, which support both things at once.
.pseudocommand setBackground(color) {
lda color
sta $d021
}
:setBackground #color // Use predetermined value (immediate mode)
:setBackground color // Use value from memory (absolute mode)
Btw. The background color macro is just an example of how to create and use a macro. I guess you cant benefit much by using this particular macro.. |
Previous - 1 | ... | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | ... | 61 - Next |