randrews wrote:
So I'm not super clear on how 65816 / 65265 interrupts work... The monitor itself must use them, right? So if I want to call its functions like put_chr or whatever, all I should have to do is cli in my main() before I do anything, and then it'll use the monitor's handler.
Yea, if you want to use the monitors routines, you need to leverage the monitors interrupt handlers.
Quote:
The cost of this is that probably I can't use my OWN interrupt handler... Without disabling the ROM and providing my own, of course. But maybe that's what the IRQHandler symbol is for, maybe the monitor ROM jsl's to that symbol as well on interrupts, if it's an interrupt type (or however 6502 interrupts work, I only speak Z80) that it doesn't know how to handle.
All of the monitors interrupts are vectored through RAM, which is another aspect of the monitor.
You can tap in those vectors, pointing them at your code, and then calling the monitors routines, so you don't necessarily have to replace them completely.
That said, it is just a monitor, set up to make working with the board reasonably easy to start with. But it's not a BIOS. Whatever is there is there to support the monitor, not the chip per se.
You could certainly lift stuff out of it in to a BIOS of your own.
Also, the fact that the default C runtime disables interrupts is just that -- a default. You should be able to provide your own.
Historically, there's always been crt0 routine that is actually the bootstrap of the program. The binary starts with crt0, and crt0 works its magic and then calls 'main'.
Admittedly, it would have been very nice for WDC to provide a working toolchain to produce C code that works with the boards and the monitor. Example programs showing those little ins and outs.