It is currently Sat Nov 18, 2017 6:15 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: Thu Aug 11, 2005 1:37 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19226
Location: NE Indiana, USA (NTSC)
Bregalad wrote:
Also I don't know it it's needed to initialize the CPU ram between the two VBlank waits.

It's not. A lot of official games do the vblank waits one after another. It's just that the time between the vblanks is just a very convenient time to clear CPU RAM, as what else do you have to do during nearly 30,000 CPU cycles between vblank #1 and vblank #2?

Quote:
About the $700-$702 stuff, I think he's just checking for particular value in theese 3 bytes, to check if it's the first boot or not. So, he doesn't clear $700-$7ff if it isn't the first boot.

Correct.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 11, 2005 4:47 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10112
Location: Rio de Janeiro - Brazil
I read somewhere that initializing the stack is quite pointless too... the explanation said that the SP value didn't matter at all, as the stack page is fixed and it warps around once we get to the end (or gegining) of the page...
So, you'll have your 256 stack bytes, no matter where the stack pointer points too in the begining of the program...

I don't know if this is true, but makes sense to me...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 11, 2005 5:05 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1392
If you're short on memory and know the maximum amount of stack space you're going to use, you can allocate variables within the empty space at the bottom of the stack.

_________________
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 11, 2005 5:08 pm 
Offline
User avatar

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1845
Plus if your stack is split on the page boundary, you'll have problems with reading pushed values:

Code:
TSX
LDA $103,X  ; read 3rd-last pushed value -- will not work if SP wrapped


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 11, 2005 5:24 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10112
Location: Rio de Janeiro - Brazil
Ok, you might have problems if you are going to do direct manipulations to the stack. But if you just use push an pull you're safe, right?

I can understand why one might want to have the stack aligned to the memory page, but it's not mandatory to do so...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 11, 2005 5:46 pm 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3482
Location: Indianapolis
Right, it's not mandatory. But considering that programs I've seen rarely go more than 16 bytes deep or so, the whole page is pretty much going to waste. And that's nearly 1/8th of the CPU's RAM.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 12, 2005 12:40 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7266
Location: Chexbres, VD, Switzerland
I just noticed, using FCEUltra, that Megaman and Megaman 2 doesn't write anything to $4017, but thoose two DOES use the triangle timer, wich is, I belive, based on the 4 steps or 5 steps sequences.

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


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 12, 2005 7:01 am 
Offline
User avatar

Joined: Mon Sep 27, 2004 8:33 am
Posts: 3715
Location: Central Texas, USA
On reset and power-up, $00 is internally written to $4017 before the CPU starts execution. This begins the 4-step sequence and enables the APU's frame IRQ flag (but the I flag is set so it won't occur until a CLI or equivalent).


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: Bing [Bot] and 5 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