Re: C128 Inter-Bank SYS call?



On May 24, 3:08 pm, Harry Potter <maspethro...@xxxxxxx> wrote:
Let's say I'm in a function ROM on a C128 and I want to call a BASIC
or kernal routine when it's not visible.  I tried calling the code at
$02CD, but it requires the kernal to be visible.  I am currently using
the following code to call the BASIC CLR routine, but it breaks into
the monitor:

;Call BASIC CLR routine so that new BASIC memory cfg. takes hold.
        ldx     #$0F                    ;MMU cfg. for BASIC/kernal ROMs/IO
        stx     $02
        lda     #$F8                    ;Address of routine.
        sta     $03
        lda     #$51
        sta     $04
        jsr     $02CD                   ;BANK call.

Earlier in the subroutine, I wrote #$06 to address $FF00 to make the
kernal and my ROM visible.  Am I missing something?

If you need to call a program in another bank, than the subroutine at
$02CD (or the KERNAL ROUTINE at JSRFAR) should do the memory
management for you without confusing the program by storing a value in
the MMU($FF00). JSRFAR usage is documented in the COMMODORE 128
PTOGRAMMER'S REFERENCE GUIDE page 453 and 454. Download the C128 PRG
from :

http://www.devili.iki.fi/pub/Commodore/docs/books/

If your calling and target routines aren't in a standard bank
configuration, then a call to JSRFAR can't be used, and a nonstandard
value needs to be stored in the MMU

In the December 1991 issue of COMPUTE, in the DAZETTE section page
G25, a BANK configuration aid program appeared. The disk image can be
downloaded from :

ftp://arnold.c64.org/pub/magazines/Gaz-Type/

For a bank configuration register value of #6, the confusing output
looks something like:

$0000 $FFFF
RAM 0 (BASIC program text)

$C000 $FFFF
SYSTEM ROM

$8000 $BFFF
MID internal (user EPROM) ROM

$4000 $7FFF
Exposed RAM

$D000 $DFFF
I / O devices

This is equivalent to BANK 12

The program can assist in selecting another memory configuration value
if the above configuration is inappropriate for your needs.

.



Relevant Pages

  • Re: IAR and memory banking for 128K flash and 8051
    ... Reading the IAR and XLINK documents didnt help...I appreciate some ... switchable and then another bank to be switchable. ... a call was made from a routine in one bank to a routine in another ... were done through this bank switching routine. ...
    (comp.arch.embedded)
  • Re: [PATCH] virtio_console: Add support for multiple ports for generic guest and host communication
    ... routine instead of in the init_conosle routine just because multiple ... We have already managed to clutter all other virtio drivers ... with tons of configuration stuff and feature bits - and every driver uses ... So even though I didn't like merging the stuff, ...
    (Linux-Kernel)
  • Re: ML: Parameters for ACCESSBank0
    ... repair with a total bank reformat, ... Returns: If library is found: D0 = Address of library prolog and Carry ... D0=Address of prolog of the backup object ... P15 --> EXECUTE CUSTOM ROUTINE ON EVERY OBJECT ...
    (comp.sys.hp48)
  • Re: C128 Inter-Bank SYS call?
    ... call kernal routines from the ROM. ... How do I do the function call to return to my cartridge instead of Bank ... Well, I do not know much about c128 asm programming, but routine at $02CD ... $0202 sta bank ...
    (comp.sys.cbm)
  • Re: IAR and memory banking for 128K flash and 8051
    ... switchable and then another bank to be switchable. ... a call was made from a routine in one bank to a routine in another ... were done through this bank switching routine. ... described by IAR compiler documents, but when I program the flash, the ...
    (comp.arch.embedded)