Page 1 of 1

spc help

Posted: Sun Sep 11, 2005 2:49 pm
by dXtr
I'm trying to get this to work in wla-spc700:

Code: Select all

	mov $F2, #$F5
	movw ya, $F3
	jmp	[!ya]
what it does is recive a 16bit adress from the IO port 2+3 ($F5 and $F6)
then I set the 16bit ya register to this adress I recived. and now I try to jmp to it. but wla gives me:

Code: Select all

ERROR: Unknown symbol "jmp".
which basicly in wla language means "you wrote it in a way I don't understand"... ;)

so I looked up the spc-700 opcode list for wla and found

Code: Select all

x = 8bit
? = 16bit

$1f "JMP [!?+X]"
and thats as far as I get exactly as I've writen (with the exception of the + X part):

Code: Select all

jmp	[!ya]

got it to assemble by doing this ugly hack:

Code: Select all

	mov $F2, #$F5
	movw ya, $F3
	movw $0000, ya
	mov x, #0
	jmp	[!$0000+x]
but I think that it should be a better looking way to do this... =/

Posted: Sun Sep 11, 2005 8:03 pm
by blargg
I also had significant trouble figuring out WLA while coding for the SPC-700. The main thing was that you had to add a ! (just that) before absolute addresses. I don't have my code in front of me, but I think jump was just

jmp !label

Posted: Mon Sep 12, 2005 12:07 am
by dXtr
yeah I understand that part.. but I wanted to store a adress in the 16bit YA register and then do a jmp using that register as the adress:
jmp [!ya] (or what ever it would look like)

Posted: Mon Sep 12, 2005 8:45 am
by Bregalad
The SPC instuction set definitely lacks decent doccumentation.
Your MOVW YA, $f3 would load A with $f3 and Y with $f4, which is pretty crazy because A will load from the DPS register $f5 (scince adress is 7 bits, it will be $75) so channel 7 attack/decay register, and load Y with the main CPU transfer register #0. Is that really what you want ?

Posted: Mon Sep 12, 2005 11:40 am
by dXtr
nevermind my old post.. most have been drunk when I wrote that :P

now when I've actually though little of what I had used written I realised that it was totally wrong.. it should have been something more like:

Code: Select all

	movw ya, $F5
to get the adress to ya :oops:

Posted: Mon Oct 31, 2005 5:40 pm
by dXtr
I thought I continued on this one instead of makeing a new thread ;)

I got this problem..
I want to load a 16bit adress (a label) into the YA register

this is how I think it should be:

movw ya, #data
... lots of code ...

... lots of data ....

but wla-dx don't wont to assemble it :(
all I get is the standard error that wla-dx seems to allways say when something is wrong:
STACK_CALCULATE: Syntax error. Invalid use of modulo.
ERROR: Couldn't parse "movw".
can anyone help me?

nevermind.. by reading the mnemonics of the spc700 it seems like the movw can't do 16bit numbers...?! then what is the w in movw for if not word?
x = 8bit
"MOVW x,YA" $da
"MOVW YA,x" $ba
now I feel really lost...

so I guess inorder to do what I want I have
to do something like

mov y, data <- high 8bit part of adress
mov a, data <- low 8bit part of adress

but how do I do this in wla-dx? I have seen other assemblers use things like:
HI(data), LOW(data)
>data, <data

but I can't find anything similar for wla-dx (maybe I have to look harder?)

after lots of trial and error I have discoverd that wla-dx use the <data and >data... so now my code works. yay!! :D