Edge interrupts on W65C265SXB - Sample projects?

Programming the 6502 microprocessor and its relatives in assembly and other languages.
Post Reply
rehsd
Posts: 60
Joined: 19 Feb 2022
Contact:

Edge interrupts on W65C265SXB - Sample projects?

Post by rehsd »

Hi, everyone. I am trying to get interrupts to work on a W65C265SXB board and not having any luck. Is anyone aware of sample project code that includes processing interrupts, such as an edge interrupt on one of the supported pins?

I am uploading my assembled program with easysxb and jumping to the start address. My start code seems to be running (e.g., I output to a 1602 LCD). I am trying to use a negative edge interrupt on P64, using a momentary switch (signal looks good on the oscilloscope). Unfortunately, the ISR is never reached. I also tried IRQB. Possibly, the onboard monitor is interfering in some way. I'm probably missing something simple, and I'd love to see working code samples. I have searched and can't find a single example that implements user interrupts on the 65265.

I have attached the assembly that I have so far.

Thank you!

Rich
Attachments
1602_LCD_PS2KBD_20251210.asm.txt
(18.46 KiB) Downloaded 34 times
User avatar
Dr Jefyll
Posts: 3525
Joined: 11 Dec 2009
Location: Ontario, Canada
Contact:

Re: Edge interrupts on W65C265SXB - Sample projects?

Post by Dr Jefyll »

Offhand, I can think of a few possibilities. Either the interrupt never occurs (isn't properly enabled, for example), or it does occur but the interrupt vector doesn't agree with where the ISR is located. (It may also be possible that it *does* reach the ISR but for some reason the ISR crashes or otherwise fails to function in a manner you can recognize.)
Quote:
Unfortunately, the ISR is never reached
Alright, we suspect it never reaches the ISR. But does it at least leave the mainline code?

Just throwing this idea out there. If you haven't already, maybe you should make execution of the mainline code visible to the outside world. For example, it could be a loop that continuously toggles a port pin.

If the activity on the port pin stops, you'll at least know that the interrupt did occur.

-- Jeff
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
rehsd
Posts: 60
Joined: 19 Feb 2022
Contact:

Re: Edge interrupts on W65C265SXB - Sample projects?

Post by rehsd »

Thank you, Dr Jefyll!

To help with debugging, I do toggle an LED (PD72) in the ISR. Additionally, I am writing to $2F00 some markers to help me track progress as it runs. I initialize this space with 55s and then progressively fill in values just to track progress. The markers I try to write during/in the ISR never happen (should show up as CC DD in $2F0A and $2F0B).
dbg1.png
dbg1.png (8.22 KiB) Viewed 714 times
I can read the EIFR ($DF45) after pressing the button that should trigger the interrupt, and I see a value of $34, which includes the %00010000 bit for NE64, indicating the MCU recognizes the interrupt (along with two other interrupts, probably from monitor ROM activity).
dbg2b.png
dbg2b.png (8.61 KiB) Viewed 701 times
I have also checked EIER ($DF47) after jumping to my code, before pressing the button. I can verify the bit for NE64 is enabled (and the only bit enabled). After I press the button to trigger the interrupt, NE64 is cleared out of EIER (assuming the monitor code is doing this, as my code only enables the bit during initialization and does not modify it after that).

I'm leaning towards something is wrong with my ISR vector setup -- how I'm defining them, how they co-exist with the monitor ROM (and if the monitor is conflicting), simultaneous interrupt handling, etc. I question which addresses should be used for the shadow vector setup and whether BCR needs to be modified. This could also be an issue with my assembly coding (stack management, register width, or some other silly mistake).
rehsd
Posts: 60
Joined: 19 Feb 2022
Contact:

Re: Edge interrupts on W65C265SXB - Sample projects?

Post by rehsd »

I have interrupts working now using an external flash (keeping with the $FFxx vectors). I still haven't been able to get shadow vectors working. If anyone has an example of shadow vectors on the W65C265S or SXB board, please let me know. I'll post an update on interrupts in the coming days with more details on the configuration I have working. Thanks!
rehsd
Posts: 60
Joined: 19 Feb 2022
Contact:

Re: Edge interrupts on W65C265SXB - Sample projects?

Post by rehsd »

Here's the code I have with interrupts working (but not shadow interrupt vectors): https://github.com/rehsd/microcontoller ... PS2KBD.asm.

I posted a video with the progress I have made so far. If you're interested... https://youtu.be/4PiMg2al97U.

There are still a lot of details I don't have sorted yet, but I'm making progress!
rehsd
Posts: 60
Joined: 19 Feb 2022
Contact:

Re: Edge interrupts on W65C265SXB - Sample projects?

Post by rehsd »

I was able to get interrupt shadow vectors working. It came down to writing vectors at $00:0100. If you're interested, I posted more details to https://www.rehsdonline.com/post/w65c26 ... ow-vectors.
Post Reply