6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Sep 22, 2024 10:35 pm

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Thu Dec 30, 2021 8:41 pm 
Offline
User avatar

Joined: Mon Aug 30, 2021 11:52 am
Posts: 287
Location: South Africa
Following on from this post I've tried detecting interrupts BEFORE any of the stack pushes occur; and using Dr Jefyll's schematic below
Attachment:
wavery00.png
wavery00.png [ 14.9 KiB | Viewed 578 times ]


I've simulated up the following for detecting software interrupts:
Attachment:
SoftwareInterrupt.png
SoftwareInterrupt.png [ 59.6 KiB | Viewed 578 times ]

and hardware interrupts:
Attachment:
HardwareInterrupt.png
HardwareInterrupt.png [ 44.33 KiB | Viewed 578 times ]

And both cases seem to work quite nicely. Excellent! :D


I have made a change to the latching logic to only latch the opcode when PHI2 is high and VDA and VPA are also both high. It might be overkill but if I ever have a need to know the opcode I'll have it sitting in that latch.

I've changed the '574 to a '573 because the '574 is a chonky boi. The SO20 takes up a LOT of space whereas the '573 is available as a TSSOP20.

I'm using a pair of comparators for a couple of reasons firstly I don't want to have to muck around with a bunch of NAND gates and inverters each of which cost the same as the comparator and secondly it makes testing for other opcodes much easier. I'll probably also swap the 'F521 for an 'HC688 (because again, the 'F521 is another chonky boi) but this is all still simulation land.

I've separated the circuits into hardware and software to make it easier for me to understand but ultimately to add hardware interrupt detection into the software circuit only needs a single NOR gate.

And that's a big thank you to everyone on this forum for the help. It's very much appreciated :)

(and after all of this I've realised I may have a problem switch back to user mode on the RTI leg ... but that's a problem for another time)


Attachments:
HardwareInterruptBW.png
HardwareInterruptBW.png [ 26.64 KiB | Viewed 578 times ]
SoftwareInterruptBW.png
SoftwareInterruptBW.png [ 36.31 KiB | Viewed 578 times ]
Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 30, 2021 9:08 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
Bravo!


Top
 Profile  
Reply with quote  
PostPosted: Fri Dec 31, 2021 2:21 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Glad to hear the info I provided has been helpful.

It's worth noting the same scheme works for '02 and 'C02 processors. The only difference is trivial: with the '816 you need a gate to determine which cycles are opcode fetches. On '02 and 'C02 you can simply use SYNC.

-- Jeff

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Fri Dec 31, 2021 6:52 am 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1948
Location: Sacramento, CA, USA
AndrewP wrote:
I've changed the '574 to a '573 because the '574 is a chonky boi.

Attachment:
chonky.gif
chonky.gif [ 2.93 MiB | Viewed 525 times ]

_________________
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: Fri Jan 14, 2022 2:31 pm 
Offline
User avatar

Joined: Mon Aug 30, 2021 11:52 am
Posts: 287
Location: South Africa
BigEd wrote:
Bravo!
Ta!
barrym95838 wrote:
chonky.gif
:lol:

Dr Jefyll wrote:
Glad to hear the info I provided has been helpful.
Very thanks! I've added a bit to the original design since.

I also needed to detect when an RTI was done using the stack so I've added a '595 shift register to count the cycles of said RTI. Its working well in simulation and hopefully I should be getting to building things in the real world soon (after payday :| )
Attachment:
Interrupt Detection copy.png
Interrupt Detection copy.png [ 62.69 KiB | Viewed 430 times ]
A one gets shifted into the shift register whilst the op-code is an RTI and VDA & VPA. When Q5 on the shift register goes high then I know it's on the sixth cycle of the RTI and it's done with stack manipulation*.

After that things get a bit implementation specific but I count up on interrupts (both hardware and software) and count down on return from interrupts.
Attachment:
Interrupt Depth Count copy.png
Interrupt Depth Count copy.png [ 57.37 KiB | Viewed 430 times ]
Yes, I am using a '521 to check for zero :shock:. It's cheaper and smaller than any other combination of ICs I can find unless there's an eight input NOR gate I haven't found.

In simulation RESET is being detected as an interrupt which starts the counter at one. I'm hoping this will work because I want to start at one in kernal mode.

*In native mode, I think emulation mode would be the 5th cycle.


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

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: