It is currently Mon May 29, 2017 2:23 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 1325 posts ]  Go to page Previous  1 ... 85, 86, 87, 88, 89
Author Message
PostPosted: Mon Mar 20, 2017 2:09 pm 
Offline
User avatar

Joined: Thu Apr 23, 2009 11:21 pm
Posts: 747
Location: cypress, texas
lidnariq wrote:
Branches can go between 129 bytes forward and 126 bytes backwards, and 197 bytes forward is out of range.

Ah ok, thanks lidnariq!! :D Why is it limited to 129 bytes forward? It uses positive and negative numbers maybe... so oh ok, windows 10 calculator in programmer's mode is fantastic!! :D So if... how does that work? How does it differentiate between forwards and backwards? Well, it must use positive and negative numbers... I remember it using negative numbers when it went backwards. But 129 is 1000 0001 and 126 is 0111 1110... but it's confusing to me beyond the fact that those two numbers are inverses. Help? :) *NVM tepples answered!

tepples wrote:
That's 129 bytes forward or 126 bytes backward from the address of the branch instruction's opcode. The apparent imbalance is because the offset is actually measured from the address of the opcode that would be executed if the branch were not taken, and it has the typical range of an 8-bit signed integer: 127 bytes forward or 128 bytes backward.
Thank you so much tepples!! :D Makes sense! :) :mrgreen:

---
found Loopy's new site (from Memblers) (through google): http://3dscapture.com/NES/


Top
 Profile  
 
PostPosted: Sun May 28, 2017 4:33 pm 
Offline
User avatar

Joined: Thu Apr 23, 2009 11:21 pm
Posts: 747
Location: cypress, texas
I'm trying to get a new screen to load when our lady reaches the top of the screen (oY == 00). Almost everything works; as soon as oY reaches 00, currFloor is decremented and stairs is jsred. Stairs tries to disable vblank by anding my copy of $2000 with #01111111b. Then see is jsred correctly.

The only problem is that see never finishes because a vblank is activated and see is called again... the hex editor shows the stack is constantly decremented because see keeps being run because vblanks keep being called.

My function see sets up the screens before the game starts. It works wonderfully. :) Do you have any advice for me to turn off vblanks successfully? I have found where the wiki advises reading $2002 before turning on bit 7 of $2000, but I`m trying to turn bit 7 of $2000 off.


Top
 Profile  
 
PostPosted: Sun May 28, 2017 6:55 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 9657
Location: Rio de Janeiro - Brazil
I'm of the opinion that it's better to leave NMIs always on and control what happens each vblank entirely in software. You can even use the shadow $2001 register to detect when rendering is off, in which case the vblank handler skips all code related to the PPU (after updating register $2001 with the shadow value, that is), so it doesn't interfere with any PPU operations the main thread may be doing (e.g. large updates between levels), but still updates the APU so that music and sound effects aren't interrupted by screen transitions.


Top
 Profile  
 
PostPosted: Sun May 28, 2017 10:09 pm 
Offline
User avatar

Joined: Thu Apr 23, 2009 11:21 pm
Posts: 747
Location: cypress, texas
That's brilliant tokumaru!! :D Will definitely try using shadow $2001; I didn't even consider the music needing vblank updates. Thank you!


Top
 Profile  
 
PostPosted: Mon May 29, 2017 12:10 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 9657
Location: Rio de Janeiro - Brazil
If you wanted to disable rendering for a big update using this method, you'd first change the $2001 shadow value, and then wait for vblank (using whatever communication system you have between the main thread and the NMI thread), when $2001 will effectively be written to and rendering will be disabled. From then on you can update VRAM freely (keep in mind that palette and OAM updates should only take place during vblank, to completely avoid colorful glitches and OAM corruption), because the NMI thread will know not to do any PPU operations other than copying the shadow $2001 value to register $2001, a write that should be harmless even if it interrupts other PPU operations the main thread might be doing.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1325 posts ]  Go to page Previous  1 ... 85, 86, 87, 88, 89

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 1 guest


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