Megalextoria
Retro computing and gaming, sci-fi books, tv and movies and other geeky stuff.

Home » Digital Archaeology » Computer Arcana » Commodore » Commodore 8-bit » Query re C64 interrupt routine
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Query re C64 interrupt routine [message #104470] Tue, 01 March 2005 19:01 Go to next message
Ian Kenny is currently offline  Ian Kenny
Messages: 21
Registered: January 2005
Karma: 0
Junior Member
I have a question about the interrupt code in the C64 rom that starts at
FF48. Specifically from FF4D to the branch at FF53. I can understand it as a
piece of assembly code but what is being tested here?

Here's the code:

FF4D TSX
FF4E LDA, $104,X
FF51 AND #$10
FF53 BEQ $FF58

The code then either branches to the 'normal interrupt routine' or to the
'BRK routine'. I just can't see how that particular test makes the decision.

Cheers

Ian
Re: Query re C64 interrupt routine [message #104472 is a reply to message #104470] Tue, 01 March 2005 19:55 Go to previous messageGo to next message
Anton Treuenfels is currently offline  Anton Treuenfels
Messages: 105
Registered: December 2011
Karma: 0
Senior Member
Ian Kenny wrote:

> I have a question about the interrupt code in the C64 rom that starts at

> FF48. Specifically from FF4D to the branch at FF53. I can understand it as a

> piece of assembly code but what is being tested here?

>

> Here's the code:

>

> FF4D TSX

> FF4E LDA, $104,X

> FF51 AND #$10

> FF53 BEQ $FF58


When an interrupt occurs the hardware stored the status flags and program
counter on the stack before loading the shared IRQ/BRK vector into the program
counter. This code recovers the stacked status flag and checks the break flag.
It's set if the interrupt was caused by a BRK instruction, clear if caused by an
IRQ.

Checking the stacked break flag is actually the only way to tell the difference
between the two.
Well, I suppose the service routine could recover the saved program counter and
see if the byte at PC-2 is a BRK instruction, but that byte might be $00 for any
number of reasons.

- Anton Treuenfels
Re: Query re C64 interrupt routine [message #104590 is a reply to message #104472] Wed, 02 March 2005 09:30 Go to previous message
Ian Kenny is currently offline  Ian Kenny
Messages: 21
Registered: January 2005
Karma: 0
Junior Member
Aah, of course. Thanks.

> When an interrupt occurs the hardware stored the status flags and program

> counter on the stack before loading the shared IRQ/BRK vector into the

> program

> counter. This code recovers the stacked status flag and checks the break

> flag.

> It's set if the interrupt was caused by a BRK instruction, clear if caused

> by an

> IRQ.

>

> Checking the stacked break flag is actually the only way to tell the

> difference

> between the two.

> Well, I suppose the service routine could recover the saved program

> counter and

> see if the byte at PC-2 is a BRK instruction, but that byte might be $00

> for any

> number of reasons.

>

> - Anton Treuenfels

>
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: wanted C1581 1541 II PS
Next Topic: WHo's got C*Base 128 BBS?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Apr 24 09:04:51 EDT 2024

Total time taken to generate the page: 0.11983 seconds