trying to figure out what XCN does..

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)

trying to figure out what XCN does..

Post by dXtr » Mon Oct 31, 2005 3:36 pm

anyone know what it does?

from what I managed to dig up:

from spc document:
XCN A 9F 1 5 A(7-1) <-> A(3-0) N......Z.

from snes9x source:
// XCN A
areg->YA.B.A = (areg->YA.B.A >> 4) | (areg->YA.B.A << 4);

so from what I can understand.. it exchange the upper nibble with the lower?
i.e.:
mov a, #%00001111
xcn a
a = 11110000

is this correct?
Sorry for misspellings, I'm from Sweden ^^

User avatar
koitsu
Posts: 4217
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Post by koitsu » Tue Nov 01, 2005 6:10 am

I'll see what I can dig up on this opcode and post here later today (I'm at work right now).

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

Post by dXtr » Tue Nov 01, 2005 3:31 pm

koitsu wrote:I'll see what I can dig up on this opcode and post here later today (I'm at work right now).
thanks. but I'm pretty sure i was correct asuming that..
atleast my code works. :D

edit:
now I've tried it on hardware too, and my code seems to work.. but I got alittle disappointed, because it didn't sound like on emu.. don't know if it's because of the TV having crappy speakers or if it is because the emus can't emulate the spc good enough yet. :?:
Sorry for misspellings, I'm from Sweden ^^

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

Post by Bregalad » Wed Nov 02, 2005 10:47 am

What differences between the real hardware and emus ??
I know sound emulation can go VERY wrong and VERY innacurate in some cases (Chrono Trigger's sound effects for example) or be just fine (music of most games).
The problem with CT is that there is particular sample that loops on themselves while overflow from the normal 16-bit range trough BRR compression to output particular noisy sound. Some "normal" sampes also sometimes get pretty different, especailly be carefull with sampling rate. The real hardware mix all thing at 32kHz, but most emus/player doesn't (or at least not by default), and this can make a difference.
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 » Wed Nov 02, 2005 11:58 am

well the differnece was that the sample sounded all smered out (think thats the right word) and the pitch changes wasn't as noticable as on a emu.

what I simply did for the demo was to have a sample that I played and changed the pitch on with small delays creating a little melody.. but it didn't sound as good on my tv as on the emu.. but I guess it's probably because of the tv:s speakers
Sorry for misspellings, I'm from Sweden ^^

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

Post by Bregalad » Wed Nov 02, 2005 12:34 pm

Well, the 32kHz limit of the real hardware should be the cause of that, possibly along with your speakers.
Pitch change is less noticable ? Scince it's the good pitch, I can't see what would be less noticable.
Life is complex: it has both real and imaginary components.

Guest

GoodLuck

Post by Guest » Mon Nov 14, 2005 2:09 pm

This conversation is just beyond me so i am out, best of luck.

User avatar
koitsu
Posts: 4217
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: trying to figure out what XCN does..

Post by koitsu » Thu Nov 17, 2005 8:14 pm

The official SPC700 docs I have say this:

Mneumonic: XCN
Operand: A
Opcode: 9F
Bytes: 1
Cycles: 5
Operation: A (7-4) <--> A (3-0)
Flags modified: N and Z

A == A register
N == Negative flag
Z == Zero flag

Based upon the fact that the directional flow is labelled <-->, I assume that means bits 3-0 of A are exchanged/swapped with bits 7-4 of A.

Again, these are official docs, so...

User avatar
Disch
Posts: 1849
Joined: Wed Nov 10, 2004 6:47 pm

Post by Disch » Thu Nov 17, 2005 9:54 pm

This looks like a SWAP command in z80 (at least I think it was swap --- it's been a while).

Perhaps XCN stands for 'eXChange Nybbles'?

User avatar
koitsu
Posts: 4217
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Post by koitsu » Fri Nov 18, 2005 6:13 am

Disch wrote:Perhaps XCN stands for 'eXChange Nybbles'?
My vote is on eXChaNge.

Post Reply