1 post / 0 new
Enabling/disabling the Kernal in C128 mode

Here's what I'd like to do:  I want to call some native C128 kernal routines from CP/M. The documentation shows what function calls to make in order to do this, but I've run into a little snag:  I need to pass control to the 8502, enable the Kernal, call the routine, re-enable the Kernal, and pass control back to the Z80.

Here is how the Commodore 128 Programmer's Reference Guide, pages 700-701 puts what I'd like to do:

This is the routine that allows you to call an 8502 machine language subroutine from Z80 mode. The 8502 coded routine is usually user defined. It must execute in RAM bank 0 with the input/output registers enabled. The MMU value = $3E. Control is transferred to the 8502 processor with the KERNAL disabled. If you want to call a C128 KERNAL routine, you must enable the KERNAL after you have transferred control to the 8502. Before you return to the Z80, you must disable the KERNAL again.

Now, Commodore assembly language programmers are among the smartest!  Surely some well-informed guru knows how to do this :)  I've tried using the C64 method if enabling/disabling the kernel, but it doesn't seem to work.  It would seem, therefore, that the routine would be how you would do it in C128 Native Mode.  I've scoured the Internet, but can only find the method for the C64.  Unfortunately too, the Reference Guide does not tell you how to do it either.

Thanks for any assistance you can give me on this!