It is currently Tue Oct 17, 2017 10:56 pm

All times are UTC - 7 hours



Forum rules


Related:



Post new topic Reply to topic  [ 15 posts ] 
Author Message
 Post subject: dsp instruction?
PostPosted: Sun Sep 04, 2005 4:13 am 
Offline
User avatar

Joined: Tue Sep 21, 2004 12:11 am
Posts: 377
Location: Karlshamn (Sweden)
I'm trying out some stuff on the spc-700 and thrying to understand how it works so I looked up the source for the mssdemo (I know it dosen't work on hardware.. but it can be nice to look at to get a little clue on what to do anyway) and found that he has a instruction he call DSP I checked in his tasmmms.tab that defines the instruction and found:

Code:
/*INSTR ARGS OPCODE BYTES MOD CLASS SHIFT OR */
   DSP     *,*     02          3       COMBINE            1


he used it like:
Code:
DSP $00,$3F

I guess what he is doing is setting voice0 left volume
but according to docs I've found you should do something like that in this way:

Code:
mov $F2, $00  ; Set DSP register to voice0 left volume
mov $F3, $3F  ; Set DSP data to $3F


or have I understood it all wrong?

edit:
nevermind found the answear myself in his spcplay.asm

_________________
Sorry for misspellings, I'm from Sweden ^^


Last edited by dXtr on Sun Sep 04, 2005 4:47 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 04, 2005 4:49 am 
Offline
User avatar

Joined: Tue Sep 21, 2004 12:11 am
Posts: 377
Location: Karlshamn (Sweden)
Now for another question.. I'm using wla-spc700 to assemble this.. but it complains on this:
Code:
ERROR: Unknown symbol "bne"


is it a bug in wla-spc700 or is there no bne instruction?

edit:
I think the reason I got it was b/c it was a hardcoded adress and not a label.. but shouldn't wla-spc700 support that?

_________________
Sorry for misspellings, I'm from Sweden ^^


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 04, 2005 11:30 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7224
Location: Chexbres, VD, Switzerland
Yeah, there is also a lot of unknown opcode about the SPC-700 for me, like PCALL, TCALL, CBNE, AND1, OR1, DAA, DAS and probably more. If you found a detailed list, that would be cool to tell it to us.
Also, there is EI and DI, that probably stand for Enable Interrupts and Disable Interrupts, but I don't know what could trigger an interrupt nor where it would jump if an interrupt would be triggered.

About Wla-DX, there is the WLA message board, I reccomand to post all your problems here. I have been in trouble with WLA-6502, because 16-bit stx and sty didn't work, I put my complain, and the guy eventually respond me and fixed it (if no anwer come immediately, don't worry).

_________________
Life is complex: it has both real and imaginary components.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 04, 2005 11:41 am 
Offline
User avatar

Joined: Tue Sep 21, 2004 12:11 am
Posts: 377
Location: Karlshamn (Sweden)
for the moment my biggest issue is wla-spc700 ;)
I can't get it do what I want it to do.. so I have to come up with ugly hacks all the time.. and this bank/slot thing makes my brain explode ;D

as an example.. I want to put some data at an specific adress (like $0300) unfortantly there is no way to tell the assembler to put it at that specific adress.. so I have to create padding files that I .INCBIN =/ maybe I could use the repeat macro in some way.. but I don't fully understand everything in the assembler yet =/

_________________
Sorry for misspellings, I'm from Sweden ^^


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 04, 2005 12:07 pm 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7224
Location: Chexbres, VD, Switzerland
Since the SPC-700 is RAM only, and have no ROM, you can store your code anywhere. I think you could reserve a piece of RAM (for example $300-$fff) for code, and the rest for Sample pointer data, music data, possible sound effect data and sample data (this is probably the biggest one).
I think you may do it as if $300-$fff would be ROM.
So, the definition are :
Code:
.memorymap
defaultslot 0
slotsize $f0
slot 0 $0   ;0 page RAM ($f0-$ff should be safe !)
slotsize $100
slot 1 $200 ;Other variable may come at $200-$2ff before the code
slotsize $d00
slot 2 $300 ;Code goes here
slotsize $400
slot 3 $1000 ;Sample pointer data
slotsize $c00
slot 4 $1400 ;Music data
slotsize $e000
slot 5 $2000 ;Sample data
.endme
.rombankmap
bankstotal 1
banksize $d00
banks 1
.endro

Then, imput all your code into secrions (either FREE, or FORCE), and imput the following :
Code:
.section "Volume" SLOT 2
... code for your volume goes here
.ends

This *should* work. Else, try asking to WLA-DX forums.

By the way, could I ask what are you doing at the momment with the SPC-700 ? I always gets exited with this chip, because of all the good music that the SNES games have. I'm hopefully to write SNES code once only for the sound, hehe.

_________________
Life is complex: it has both real and imaginary components.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 04, 2005 12:43 pm 
Offline
User avatar

Joined: Tue Sep 21, 2004 12:11 am
Posts: 377
Location: Karlshamn (Sweden)
well.. for the moment I'm just experementing to get to know the SNES APU.. I do this by assembling it into a spc file that I playback on spc tool (for debuging). later on when I feel like I know what I'm doing I'm going to write my own sfx/music engine for the snes :)

the only problem with having as a spc file instead of making a snes rom of it is that you can't do all the nice stuff like copying new samples the the spc memory and other things..

but I can tell you that I got supprised of how easy it seems to be coding for the spc-700, I had never touched it before because all docs I found explained it in such a weird way that I couldn't really get what you were suppose to do.

I will release the source for what I'm working on later on when I get it to actually make some noise ;)

_________________
Sorry for misspellings, I'm from Sweden ^^


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 05, 2005 8:27 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7224
Location: Chexbres, VD, Switzerland
Then you'll probably have to make some sample data transfer routines where both the SNES CPU and the SPC-700 would comunicate to copy samples from the SNES ROM to the SPC-700 RAM.
Some games does use only one set of samples (Zelda3, CastleVania 4, Breath of Fire, etc...) but the quality will become mediocre then, instead of using variable sample data (Secret of Mana, Chrono Trigger, etc...)
I think you would need to do it manually while dealing only with SPC files, while this could be done by transfer code later.

_________________
Life is complex: it has both real and imaginary components.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 05, 2005 11:02 am 
Offline
User avatar

Joined: Tue Sep 21, 2004 12:11 am
Posts: 377
Location: Karlshamn (Sweden)
yeah I know.. it's a little harder to work with just creating spc files as they become static and you can't upload new samples to the spc... but as I said before.. this is only for testing, so I learn how it all works.

_________________
Sorry for misspellings, I'm from Sweden ^^


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2005 5:11 am 
Offline
User avatar

Joined: Tue Sep 21, 2004 12:11 am
Posts: 377
Location: Karlshamn (Sweden)
wow! just made it make it's first noise! :D
the reason it hadn't work before was b/c I had forgotten the # when sending the DSP commands ;D
it dosen't sound beautiful.. but it does atleast make some noise

I try to have some source up by tomorrow (have to do some other stuff now and clean up the code when I come home tonight)

_________________
Sorry for misspellings, I'm from Sweden ^^


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2005 9:42 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7224
Location: Chexbres, VD, Switzerland
By the way... does the DSP instuction directly setup a DPS regiser (1st argument) with the 2nd argument's value ? Or is it something else ?

Have you figured out what is PCALL, TCALL, AND1, OR1, DAA and DAS ?

_________________
Life is complex: it has both real and imaginary components.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2005 10:26 am 
Offline
User avatar

Joined: Tue Sep 21, 2004 12:11 am
Posts: 377
Location: Karlshamn (Sweden)
the DSP instruction isn't really a instruction as I discoverd but a command for the MSS engine.. he had added a special instruction that his engine translated in to real code.. example:

he sends to the APU through the I/O ports on the SNES
Code:
DSP $00, $3F


and that got translated to something like:
Code:
$06, $00, $3F


that was put into the different I/O ports and transferd to the APU where his engine would use it like this:

Code:
SCPU:
...
mov IOport0, #$06
mov IOport1, #$00
mov IOport2, #$3F
...

----------------------
APU:
...
cmp IOport0, #$06
beq SetDSP
...

SetDSP:
mov $F2, IOport1
mov $F3, IOport2
ret


and about the other commands.. sorry havn't read up on those

edit:
that's just one way it's used.. the other one is that he tells the engine to jump to that specific code on the apu to for example init the apu.

sorry if I'm not good at explaining.. it's much easier to understand if you watch his code...

_________________
Sorry for misspellings, I'm from Sweden ^^


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2005 12:20 pm 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7224
Location: Chexbres, VD, Switzerland
Ok, it wasn't an insturcion, but a macro then.

If you wan't to just test various samples, try to get anything using BRR mode 2, then overflow the data (so the decoded wav data will override from $ffff or underride from $0000, if you see what I mean), then loop this sample. This usually results in an interessting "noisy" sample, that is much shorter and more accurate than recording/encoding a real noise sound, and much more fun than use the SPC's noise generator (that can outpout only one frequency for all channels). I always found these noise samples very interesting and fun. ZSNES emulates them very badly, the last SNES9x seems to emulate them wrong but not that bad, and SnesAmp (Win-amp plug-in) seems to emulate them just like the real hardware does. Chrono Trigger is a good game to test this, it's sound effect's samples 4, 6, 7 and 8 are all different "noise samples", they all sound the same under ZSNES, but they actually are different, and the sound effects won't sound as good that the real game under an emulator.
Well, I'm passioned a lot by this feature of the SPC 700.

_________________
Life is complex: it has both real and imaginary components.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2005 1:46 pm 
Offline
User avatar

Joined: Tue Sep 21, 2004 12:11 am
Posts: 377
Location: Karlshamn (Sweden)
yeah I can here you like this :)
after just doing this I realy felt I needed to go through the DSP page that tepples posted in my other snes thread ;D
I noticed that much of the stuff I read about on that page could be good to know, to setup everything correct on the dsp in the snes.

_________________
Sorry for misspellings, I'm from Sweden ^^


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 5:14 pm 
Offline
User avatar

Joined: Tue Sep 21, 2004 12:11 am
Posts: 377
Location: Karlshamn (Sweden)
hm.. was going to post the code now.. but I just remeberd I've lost the login information to my web-account =/
I see if I can get a hold of it tomorrow...

edit:
well.. atleast that gives me time to test this on a real snes to verify the code ^^

_________________
Sorry for misspellings, I'm from Sweden ^^


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 11, 2005 4:35 pm 
Offline
User avatar

Joined: Tue Sep 21, 2004 12:11 am
Posts: 377
Location: Karlshamn (Sweden)
ok so here it come:
http://www.student.bth.se/~joaf03/snesdev/BRRtest.rar

enjoy ;)

I've tested it on my PAL SNES using a Super Wildcard DX2. So hopefully this should work :)

I know that there is lots of weird things in there.. but that is mostly b/c I don't fully understand wla dx yet.
and if you like the spc700.inc file I created feel free to use it in you're own projects

edit:
noticed a typo in the snes part when setting start adress for the spc.. strangely it still worked.. but anyway.. a corrected version is up now (still the same URL)

_________________
Sorry for misspellings, I'm from Sweden ^^


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: Google Adsense [Bot] and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group