Sa-1 IRQ oddity (SMW modding)

Strictly for discussing ZSNES development and for submitting code. You can also join us on IRC at irc.libera.chat in #zsnes.
Please, no requests here.

Moderator: ZSNES Mods

Bio
New Member
Posts: 8
Joined: Thu Mar 06, 2008 6:23 am

Sa-1 IRQ oddity (SMW modding)

Post by Bio »

I started implenting SA-1 into SMW(mostly because superFX gave me too much trouble). However, when SA-1 is active and the V-counter IRQ is enabled, the SNES randomly get IRQ signal, causing chaotic slowdown and layer 3 displacement(Since SMW use IRQ to make layer 3 at the correct location). Here the code used by both SA-1 and the SNES:

Code: Select all

Define:
!CIE  = $220A  ;ITDNxxxx
;I: Receive SNES' IRQ T:Timer IRQ enable D: DMA IRQ enable N: Receive SNES NMI
!CIC  = $220B  ;ITDNxxxx
;I: Clear IRQ T: Clear Timer IRQ D: Clear DMA IRQ N:Clear NMI
!SNV  = $220C  ;Alternate NMI vector from then SNES
!SNV2 = $220D
!SIV  = $220E  ;Alternate IRQ vector
!SIV2 = $220F
!TMC  = $2210  ;SxxxxxVH
;S: 0:HV timer 1:linear timer V:enable V timer H: enable H timer
!CTR  = $2211  ;Writing here reset timer to 0
!HCNT = $2212
!VCNT = $2214
!VCNT2 = $2215
!CXB  = $2220
!DXB  = $2221
!EXB  = $2222
!FXB  = $2223
!BMAPS = $2224
!BMAP = $2225
!SBWE = $2226
!CBWE = $2227
!BWPA = $2228
!SIWP = $2229
!CIWP = $222A
!DCNT = $2230
!CDMA = $2231
!SDA  = $2232
!DDA  = $2235
!DTC  = $2238
!BBF  = $223F
!BRF  = $2240
!MCNT = $2250
!MA   = $2251
!MB   = $2253
!VBD  = $2258
!VDA  = $2259
!SFR  = $2300
!CFR  = $2301
!HCR  = $2302
!VCR  = $2304
!MR   = $2306
!OF   = $230B
!VDP  = $230C
!VC   = $230E



		    lda #$A0
		    stz !SIE
		    sta !SIC
		    stz !BWPA
		    stz !BMAPS
		    lda #$FF
		    sta !SIWP
		    stz !CXB
		    lda #$01
		    sta !DXB
		    inc a
		    sta !EXB
		    inc a
		    sta !FXB
		    rep #$20
		    lda #SA_1NMI
		    sta !CNV
		    lda #SA_1NMI
		    sta !CIV
		    lda #SA_1_Start      
		    sta !CRV
		    sep #$20
		    lda #$FF
		    sta !SIWP
		    stz !CCNT


SA-1Code:

SA_1NMI:

                              rti

SA_1_Start:

          clc
		    xce
		    sep #$20
		    lda #$f0
		    stz !CIE
		    stz !TMC
		    stz !DCNT
		    stz !SCNT
		    sta !CIC
		    stz !BMAP
		    lda #$00
		    sta !CBWE
		    lda #$FF
		    sta !CIWP
		    rep #$30
		    ldx #$37FF
		    txs
		    PHK
		    PLB
		    bra $FE
Y~K
Hazed
Posts: 54
Joined: Mon Jan 22, 2007 3:27 am

Post by Y~K »

Any idea why people call it SA-1 instead of SA1 as in the chip & PCB printing?

http://upload.wikimedia.org/wikipedia/c ... SA1_01.jpg
Bio
New Member
Posts: 8
Joined: Thu Mar 06, 2008 6:23 am

Post by Bio »

Y~K wrote:Any idea why people call it SA-1 instead of SA1 as in the chip & PCB printing?

http://upload.wikimedia.org/wikipedia/c ... SA1_01.jpg
Because the SNES dev manual refer to it as SA-1
Y~K
Hazed
Posts: 54
Joined: Mon Jan 22, 2007 3:27 am

Post by Y~K »

Bio wrote:
Y~K wrote:Any idea why people call it SA-1 instead of SA1 as in the chip & PCB printing?

http://upload.wikimedia.org/wikipedia/c ... SA1_01.jpg
Because the SNES dev manual refer to it as SA-1
link?
creaothceann
Seen it all
Posts: 2302
Joined: Mon Jan 03, 2005 5:04 pm
Location: Germany
Contact:

Post by creaothceann »

Might've been this one.
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
Y~K
Hazed
Posts: 54
Joined: Mon Jan 22, 2007 3:27 am

Post by Y~K »

Japanese official docs please.
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Post by pagefault »

Y~K wrote:Japanese official docs please.
Weeaboo.
Watering ur plants.
whicker
Trooper
Posts: 479
Joined: Sat Nov 27, 2004 4:33 am

Post by whicker »

just everyone call it "Super Accelerator One" if you want to be pedantic. Even if there was never a two.
sweener2001
Inmate
Posts: 1751
Joined: Mon Dec 06, 2004 7:47 am
Location: WA

Post by sweener2001 »

http://pbfcomics.com/?cid=PBF071-Weeaboo.gif

because it's hilarious. and demanding japanese documents is ridiculous, given what was linked.
[img]http://i26.photobucket.com/albums/c128/sweener2001/StewieSIGPIC.png[/img]
Y~K
Hazed
Posts: 54
Joined: Mon Jan 22, 2007 3:27 am

Post by Y~K »

How is it ridiculous given the chip was developed and manufactured in Japan.
The japanese docs ought to be more accurate.
sweener2001
Inmate
Posts: 1751
Joined: Mon Dec 06, 2004 7:47 am
Location: WA

Post by sweener2001 »

i'm pretty confident that the documents made the transition to english without any problems. it's not like there's going to be a kaeru issue there. and does it really matter why a hyphen was added?

one would guess readability, something that isn't really needed so much on the chip itself.
[img]http://i26.photobucket.com/albums/c128/sweener2001/StewieSIGPIC.png[/img]
declan
Lurker
Posts: 194
Joined: Thu Jan 03, 2008 12:45 am
Location: Austalia

Post by declan »

What would be the point in implementin SA-1, MARIO CHIP, Super FX GSU-1, Super FX GSU-2, Super FX GSU-2 SP-1 or any other enhancement chip for SMW????????????

I thought this game works fine as is :?:
Hardware means nothing if you don't have good software.
Compare the success of SNES over Genisis
franpa
Gecko snack
Posts: 2374
Joined: Sun Aug 21, 2005 11:06 am
Location: Australia, QLD
Contact:

Post by franpa »

maybe he wants to make his own game and needs that special chip!
Core i7 920 @ 2.66GHZ | ASUS P6T Motherboard | 8GB DDR3 1600 RAM | Gigabyte Geforce 760 4GB | Windows 10 Pro x64
declan
Lurker
Posts: 194
Joined: Thu Jan 03, 2008 12:45 am
Location: Austalia

Post by declan »

franpa wrote:maybe he wants to make his own game and needs that special chip!
Oh.... i didn't think of that.
(keeps quiet)
Hardware means nothing if you don't have good software.
Compare the success of SNES over Genisis
declan
Lurker
Posts: 194
Joined: Thu Jan 03, 2008 12:45 am
Location: Austalia

Post by declan »

(not quiet anymore)
I actually don't know much at all (if anything) about programming for the snes.
But just out of curiosity; Bio, what language is that code ,you've provided, in?

EDIT:
Is it assembly? doesn't look familiar, but i have heard (maybe i heard incorrectly) the snes is programmed in assembly
Hardware means nothing if you don't have good software.
Compare the success of SNES over Genisis
grinvader
ZSNES Shake Shake Prinny
Posts: 5632
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

Post by grinvader »

... It's sa-1 assembly. Which is also 5a22 assembly.

... programming in assembly is pretty much a must considering there aren't any complete C compilers for these platforms.
皆黙って俺について来い!!

Code: Select all

<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
Bio
New Member
Posts: 8
Joined: Thu Mar 06, 2008 6:23 am

Post by Bio »

declan wrote:What would be the point in implementin SA-1, MARIO CHIP, Super FX GSU-1, Super FX GSU-2, Super FX GSU-2 SP-1 or any other enhancement chip for SMW????????????

I thought this game works fine as is :?:
the original game, not any of his mods. The main issue is that tools just keep stacking new code on it(some of wich are really ineficient). as a result, the game can very easly become laggy when you add too much stuff. I also got some nice effect added with them, such as real-time modification of Mario graphic and creation of HDMA table that get updated when the screen scroll up or down
declan
Lurker
Posts: 194
Joined: Thu Jan 03, 2008 12:45 am
Location: Austalia

Post by declan »

Sound's impressive Bio :shock:

EDIT:
The SA-1 would be good for what your donig right? 'cause you're not doing anything out of the ordinary (like polygons or somthing), just more of the same "snes stuff", like Donkey Kong (even though it doesn't use the SA-1).
Unless you were trying to make it more like Yoshi's Island, with the sprite stetching, rotating and those mad paralax layers. In which case the Super FX would come in handy right?
Hardware means nothing if you don't have good software.
Compare the success of SNES over Genisis
creaothceann
Seen it all
Posts: 2302
Joined: Mon Jan 03, 2005 5:04 pm
Location: Germany
Contact:

Post by creaothceann »

declan wrote:those mad paralax layers
?
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
declan
Lurker
Posts: 194
Joined: Thu Jan 03, 2008 12:45 am
Location: Austalia

Post by declan »

creaothceann wrote:
declan wrote: those mad paralax layers


?
I'm talking the paralax layers used in Yoshi's Island. and some point there's like four layers, some with animation. Not just still paralax layers, like in Donkey Kong Country
Last edited by declan on Thu Mar 27, 2008 2:56 am, edited 1 time in total.
Hardware means nothing if you don't have good software.
Compare the success of SNES over Genisis
creaothceann
Seen it all
Posts: 2302
Joined: Mon Jan 03, 2005 5:04 pm
Location: Germany
Contact:

Post by creaothceann »

At what point in the game?

(For 4 layers they'd have to use sprites to simulate a background, or use BG mode 0.)
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
declan
Lurker
Posts: 194
Joined: Thu Jan 03, 2008 12:45 am
Location: Austalia

Post by declan »

I recon at some points in monkey world there'd be four layers, though maybe your right, probly only 1 or 2 have animation (and of coase, if there's animation, there's spites), the rest are just stills i supose.
Though, in Donkey Country 2: Diddy's Kong Quest, I think its in "Web Woods", world 5, level 5, i spotted i think about 5 layers, though none of them had animation.
Hardware means nothing if you don't have good software.
Compare the success of SNES over Genisis
Bio
New Member
Posts: 8
Joined: Thu Mar 06, 2008 6:23 am

Post by Bio »

what animation has to do with all this? the HDMA effect for pseudo multi-layer don't becom harder to do if you add animation.

I already implented said effect with SuperFX(see it here:http://www.youtube.com/watch?v=GKUfY16V7IU)

Can we get back on the main topic? I really to know why timer IRQ get mad if SA-1 is active
grinvader
ZSNES Shake Shake Prinny
Posts: 5632
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

Post by grinvader »

You do know that the SA-1 has its own irqs, right ?
皆黙って俺について来い!!

Code: Select all

<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
doktor_kris
Lurker
Posts: 102
Joined: Sat Feb 25, 2006 7:47 pm
Contact:

Post by doktor_kris »

A splendid piece of work, there! :-)
Post Reply