6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu Nov 21, 2024 11:55 pm

All times are UTC




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: [45.1] Interrupt
PostPosted: Tue Apr 18, 2000 3:32 am 
Dear All:

I met a problem. In 6502, the BRK is one byte instruction, But in the WDC's W65SC02, it has two byte, what's the meanings of the second byte?


Report this post
Top
  
Reply with quote  
 Post subject: [45.2] Interrupt
PostPosted: Tue Apr 18, 2000 9:02 am 
Hi,

A quick look at the 65c02 datasheet (I downloaded it from Western Design Center's FTP site) gives the following information:-

6.2 The BRK instruction for both the NMOS 6502 and 65C02 is a 2 byte instruction. The NMOS device simply skips the second byte (i.e. doesn't care about the second byte) by incrementing the program counter twice. The 65C02 does the same thing except the assembler is looking for that second byte as a "signature byte". With either device (NMOS or CMOS), the second byte is not used. It is important to realize that if a return from interrupt is used it will return to the location after the second or signature byte.

However, my old MOS Technology Programming Manual has an appendix that shows, as you said and as I recall, that BRK is a single byte instruction but it shows that the PC (program counter) + 2 followed by the PC is pushed onto the stack. The result is that the address pushed into the stack is two bytes after the address of the BRK instruction. So, in one sense BRK is a two byte instruction!

I hope this 'helps'.

:-)

Simon


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC


Who is online

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