6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 23, 2024 5:24 pm

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Fri Apr 07, 2006 1:52 pm 
Offline
User avatar

Joined: Fri Dec 12, 2003 7:22 am
Posts: 259
Location: Heerlen, NL
Hallo allemaal,

Can anybody tell me what the level of the individual flags is after a reset?
It seems I simply cannot find this info in the books I have :(
Thanks!

_________________
Code:
    ___
   / __|__
  / /  |_/     Groetjes, Ruud
  \ \__|_\
   \___|       URL: www.baltissen.org



Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Apr 07, 2006 2:24 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1748
Location: Sacramento, CA
Ruud,

On page 11 of the current WDC 65C02 datasheet, the flags setting after reset are decribed. Here is what it shows:
Code:
   7   6   5   4   3   2   1   0
   N   V       B   D   I   Z   C
   *   *   1   1   0   1   *   *

* indicates software initialized.



I take this to mean that the hardware sets the B,D& I flags but its up to the software to configure the N,V,Z&C flags.

Daryl


Last edited by 8BIT on Sat Apr 08, 2006 4:03 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Apr 07, 2006 3:57 pm 
Offline

Joined: Sun Feb 05, 2006 1:20 am
Posts: 21
Location: The Netherlands
Well Ruud, this has been said before: If the datasheet doesn't cover some issue, it is.. err... literally undefined. You can safely assume it is for a reason.

_________________
I trust my somewhat flawed English is comprehensible to all.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Apr 10, 2006 9:50 am 
Offline
User avatar

Joined: Fri Dec 12, 2003 7:22 am
Posts: 259
Location: Heerlen, NL
8BIT wrote:
....
I take this to mean that the hardware sets the B,D& I flags but its up to the software to configure the N,V,Z&C flags.

Daryl


Many thanks!

_________________
Code:
    ___
   / __|__
  / /  |_/     Groetjes, Ruud
  \ \__|_\
   \___|       URL: www.baltissen.org



Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Apr 10, 2006 3:51 pm 
Offline

Joined: Wed Mar 24, 2004 10:54 am
Posts: 38
Hi Ruud,

To quote the original MOS 65xx Hardware Manual :

"It should be assumed that any time the RESET line has been pulled LOW and then HIGH, the internal states of the machine are unknown and all registers must be re-initialised during the restart sequence".

When dealing with IRQ it states :

"Until the various registers in the processor have been initialized, the processor is not able to respond properly to any external interrupts. For this reason it is important that the system RESET disable all external interrupt signals until they are enabled by the processor".

So it would seem that if there is any chance of the code being run on older variants of the 6502 than WDC's, it is prudent to start your reset code with SEI.
:)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Apr 10, 2006 7:18 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8545
Location: Southern California
ghaytack, I don't have a MOS data sheet, but my oldest 6502 datasheet is a Synertek one from 1979, and it does say that the reset sequence sets the interrupt disable bit before loading the reset vector. I think that in your quote above, they're probably just explaining why they do that, saying that if they didn't, even if your first instruction in the reset routine in ROM is SEI, you might still get into trouble if the interrupt line is being held low, because the interrupt vector could be taken before you even get to the SEI. All the interrupt types, including RST I'm sure, set the interrupt-disable flag.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Apr 11, 2006 9:41 am 
Offline

Joined: Wed Mar 24, 2004 10:54 am
Posts: 38
Hi Garth,

It puzzled me as well not finding any mention of it in the MOS hardware manual (it's labelled Frist Edition, August 1975) as I was fully expecting to find it. Other data sheets I looked at last night (Rockwell, CMD) state that RESET disables IRQ in the CPU and I've always written code on that basis since I started 6502 coding with the Lance A Leventhal "6502 Assembly Language Programming" book.

A 1978 edition of the Rockwell R65xx Programming Manual states it explicitly and appears to be a reprint of the MOS 1978 manual with a different cover. An early oversight by the MOS documentation department perhaps (to go with the mistakes in many 6522 data sheets)? :)

George


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 42 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: