spc help

Discussion of hardware and software development for Super NES and Super Famicom.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Post Reply
User avatar
dXtr
Posts: 375
Joined: Tue Sep 21, 2004 12:11 am
Location: Karlshamn (Sweden)

spc help

Post by dXtr » Sun Sep 11, 2005 2:49 pm

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]
edit:

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... =/
Sorry for misspellings, I'm from Sweden ^^

User avatar
blargg
Posts: 3715
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Post by blargg » Sun Sep 11, 2005 8:03 pm

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

User avatar
dXtr
Posts: 375
Joined: Tue Sep 21, 2004 12:11 am
Location: Karlshamn (Sweden)

Post by dXtr » Mon Sep 12, 2005 12:07 am

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)
Sorry for misspellings, I'm from Sweden ^^

User avatar
Bregalad
Posts: 7870
Joined: Fri Nov 12, 2004 2:49 pm
Location: Chexbres, VD, Switzerland

Post by Bregalad » Mon Sep 12, 2005 8:45 am

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 ?
Life is complex: it has both real and imaginary components.

User avatar
dXtr
Posts: 375
Joined: Tue Sep 21, 2004 12:11 am
Location: Karlshamn (Sweden)

Post by dXtr » Mon Sep 12, 2005 11:40 am

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: Select all

	movw ya, $F5
to get the adress to ya :oops:
Sorry for misspellings, I'm from Sweden ^^

User avatar
dXtr
Posts: 375
Joined: Tue Sep 21, 2004 12:11 am
Location: Karlshamn (Sweden)

Post by dXtr » Mon Oct 31, 2005 5:40 pm

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:
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?
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
Sorry for misspellings, I'm from Sweden ^^

Post Reply