It is currently Thu Jul 19, 2018 12:38 pm

All times are UTC - 7 hours



Forum rules


Related:



Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Mon Jan 29, 2018 12:59 pm 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 2713
Unfortunately my sprite rotation routine happens outside of the main loop, and can be interrupted by NMI at any time, and uses multiplication registers so it needs to disable interrupts. Doing so might cause it to go into NMI pretty late, causing black bars if the DMA is also being used.


Top
 Profile  
 
PostPosted: Mon Jan 29, 2018 3:57 pm 
Offline
User avatar

Joined: Tue Apr 05, 2016 5:25 pm
Posts: 186
The multiplication registers do their work in the background, and software only has to read and write them, right? I'd think that the state of those registers would survive the NMI interrupt, as long as you don't touch those registers in your interrupt routine. Let me know if I'm wrong though.

_________________
SNES NTSC 2/1/3 1CHIP | serial number UN318588627


Top
 Profile  
 
PostPosted: Mon Jan 29, 2018 4:37 pm 
Online

Joined: Fri Jul 04, 2014 9:31 pm
Posts: 931
psycopathicteen wrote:
uses multiplication registers so it needs to disable interrupts.

I mean, that's only a problem if the interrupt is using the multiplier too, right? I suppose one might wish to leave the option open...

Alternately, you could dedicate a couple of banks to an 8x8 multiplication table. I think the ALU should be a bit faster, especially if you use the waiting time intelligently, but you could use tabulated multiplication in interrupts without worrying about what the main code is doing, and if you wanted to waste four banks instead of two you could do 7x7 signed multiply just as easily.

Let's see:

Code:
sep #$20
lda A
xba
lda B
rep #$20
asl
tax
bcs +
lda.l multable_low,x
bra ++
+ lda.l multable_high,x
++

Is there a better way to do that?

Hold on. If you split the results into low-byte and high-byte tables:
Code:
sep #$20
lda A
xba
lda B
tax
lda.l multable_hib,x
xba
lda.l multable_lob,x
rep #$20

...exactly the same length (but more predictable). Huh.


Last edited by 93143 on Mon Jan 29, 2018 4:54 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Mon Jan 29, 2018 4:52 pm 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 2713
The entire game runs in the "NMI" code. All that's being done outside of NMI, is rotating sprites, and that takes many frames to finish.

I decided to check what scanline the code is on before doing the multiplication and if it is on the last 2 lines in a frame it waits for the next frame.


Top
 Profile  
 
PostPosted: Tue Jan 30, 2018 3:38 pm 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 2713
Now I just need to figure out how to seamlessly switch to Mode 7 mid level. I'd have to make an alternate version of the tile-map scrolling code. I can probably limit the first area of the level to use the second 16kB chunk of VRAM, and only use the first half the Mode-7 layer's memory.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2

All times are UTC - 7 hours


Who is online

Users browsing this forum: Google Adsense [Bot], LuigiBlood 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