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

All times are UTC




Post new topic Reply to topic  [ 19 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Tue Jan 09, 2024 4:32 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
For comparison, Acorn's MOS does the same thing in both the early 6502 and later 65C02 versions:
Code:
 irqEntryPoint = $dc1c
    STA .interruptAccumulator                           save A
    PLA                                                 read flags
    PHA                                                 store flags again
    AND #%00010000                                      check BRK flag
    BNE .brkRoutine                                     if (BRK flag set) then branch (to
                                                        BRK handler)
... and on into the IRQ handler

This is nice and fast, but (perhaps notably) not re-entrant. Whether the ISR should be re-entrant is of course a system design decision.


Top
 Profile  
Reply with quote  
PostPosted: Thu Jan 11, 2024 2:12 am 
Offline

Joined: Fri May 05, 2017 9:27 pm
Posts: 895

For comparison this is a portion of the Commodore 64's interrupt service routine.
Code:
FFFE @ DIS
 FF48         PHA
 FF49         TXA
 FF4A         PHA
 FF4B         TYA
 FF4C         PHA
 FF4D         TSX
 FF4E  104 ,X LDA
 FF51   10  # AND
 FF53 FF58    BEQ
 FF55  316  ) JMP
 FF58  314  ) JMP
13
 OK
CONSOLE



Top
 Profile  
Reply with quote  
PostPosted: Thu Jan 11, 2024 8:47 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1949
Location: Sacramento, CA, USA
BigEd wrote:
For comparison, Acorn's MOS does the same thing in both the early 6502 and later 65C02 versions:
Code:
 irqEntryPoint = $dc1c
    STA .interruptAccumulator                           save A
    PLA                                                 read flags
    PHA                                                 store flags again
    AND #%00010000                                      check BRK flag
    BNE .brkRoutine                                     if (BRK flag set) then branch (to
                                                        BRK handler)
... and on into the IRQ handler

This is nice and fast, but (perhaps notably) not re-entrant. Whether the ISR should be re-entrant is of course a system design decision.

Woz did somthing very similar on the Apple ][, but curiously decided to ASL ASL ASL BMI instead of AND# BNE ... it wasn't like him to seemingly "waste" a byte of ROM like that, but there you have it. He wouldn't hesitate to spend a handful of cycles to save a byte, but this is larger and slower, so I'm stumped.

_________________
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)


Top
 Profile  
Reply with quote  
PostPosted: Thu Jan 11, 2024 9:22 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
Mmm, that's a puzzler.


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

All times are UTC


Who is online

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