nesdev.com
http://forums.nesdev.com/

spc help
http://forums.nesdev.com/viewtopic.php?f=12&t=552
Page 1 of 1

Author:  dXtr [ Sun Sep 11, 2005 2:49 pm ]
Post subject:  spc help

I'm trying to get this to work in wla-spc700:

Code:
   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:
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:
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:
jmp   [!ya]


edit:

got it to assemble by doing this ugly hack:
Code:
   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... =/

Author:  blargg [ Sun Sep 11, 2005 8:03 pm ]
Post subject: 

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

Author:  dXtr [ Mon Sep 12, 2005 12:07 am ]
Post subject: 

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)

Author:  Bregalad [ Mon Sep 12, 2005 8:45 am ]
Post subject: 

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 ?

Author:  dXtr [ Mon Sep 12, 2005 11:40 am ]
Post subject: 

edit:
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:
   movw ya, $F5


to get the adress to ya :oops:

Author:  dXtr [ Mon Oct 31, 2005 5:40 pm ]
Post subject: 

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 ...

data:
... 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:
Quote:
STACK_CALCULATE: Syntax error. Invalid use of modulo.
ERROR: Couldn't parse "movw".


can anyone help me?

edit:
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?
Quote:
x = 8bit
"MOVW x,YA" $da
"MOVW YA,x" $ba


now I feel really lost...

edit2:
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)
or
>data, <data

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


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

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/