@mos_8502 in the case of Apple ProDOS you do a simple jsr to the fixed kernel dispatch address and have param buffers that sit behind the jsr call. This means the kernel decodes the return address, reads params (kernel operation, address of real param buffer) from the callers memory after the jsr, and then pushes a new return address past the param buffer area. Ugly, but it worked. I no longer recall what OS-65D did though they also hooked and extended the basic roms.
Conversation
Notices
-
Embed this notice
gnutelephony (gnutelephony@floss.social)'s status on Monday, 18-Dec-2023 16:57:02 JST gnutelephony
-
Embed this notice
Studio 8502 :verified: (mos_8502@soc.studio8502.ca)'s status on Monday, 18-Dec-2023 16:57:06 JST Studio 8502 :verified:
On x86, you get numbered software interrupts, like int 21h and int 80h. 65816 doesn’t really have that. It can emulate it, but the costs outweigh the benefits in my book.
So, you have the ability to say “call the kernel”. What part of the kernel are you calling? How are you passing arguments? How are you returning values? Basically, what is the kernel calling convention?
-
Embed this notice
Studio 8502 :verified: (mos_8502@soc.studio8502.ca)'s status on Monday, 18-Dec-2023 16:57:07 JST Studio 8502 :verified:
65816 has two software interrupt instructions: BRK and COP. Each has its own vector in memory. BRK is usually meant for inserting breakpoints. COP is nominally meant for invoking coprocessor functionality, but no such coprocessors exist. Of the two, COP is this more useful as your kernel API interrupt.
-
Embed this notice
Studio 8502 :verified: (mos_8502@soc.studio8502.ca)'s status on Monday, 18-Dec-2023 16:57:09 JST Studio 8502 :verified:
Let’s talk kernel API.
On the 6502, normally your kernel is just a bunch of library routines and an interrupt handler. You access it by the JSR instruction. That’s not really practical on the 65816, though, because of the program and data bank registers and movable stack and direct pages.
So what you want is an interrupt based API. 16 bit CP/M, DOS, and Linux on x86 use software interrupts to trigger kernel functions. The specifics differ, of course.
-
Embed this notice