MMU & BANK settings

Started by MIRKOSOFT, May 29, 2010, 03:29 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MIRKOSOFT

Hi!


I need to set bank which enables to read RAM0 in $4000-$7fff, no BASIC there, but I need Kernal and I/O.
I tried MMU, SETBNK routine - nothing was successful.


Can anybody help me?


Thank you all.


Miro
MIRKOSOFT of megabytes

Commodore 64 was great, Commodore 128 is bigger, better, faster and more!!!

http://www.mirkosoft.sk

Hydrophilic

Use BANK 12 or BANK 13 (MMU Configuration Register value of $06 and $0A respectively).  You get KERNAL, I/O, and RAM 0 in range $0000 ~ $7FFF.  From $8000 to $BFFF you get internal or cartridge ROM (or junk if you have neither installed).
I'm kupo for kupo nuts!

BigDumbDinosaur

LDA #%00001110
STA $FF00


The above will expose RAM-0 to $BFFF, the screen kernel at $C000, I/O at $D000, and the kernel proper at $E000.  All of this information is available on this site.  All that's required is that you make the effort to read the appropriate documentation.  Mapping the C-128 would be a good start.
x86?  We ain't got no x86.  We don't need no stinking x86!

Hydrophilic

Using MMU configuration register value = $0e (or %00001110) is fine for running code.  It is better than BANK 12 or BANK 13 in that you get more RAM.  But you can't use KERNAL LOAD/SAVE/VERIFY or BASIC SYS because that configuration does not correspond to any BANK.
I'm kupo for kupo nuts!

BigDumbDinosaur

Quote from: Hydrophilic on June 23, 2010, 04:41 AM
Using MMU configuration register value = $0e (or %00001110) is fine for running code.  It is better than BANK 12 or BANK 13 in that you get more RAM.  But you can't use KERNAL LOAD/SAVE/VERIFY or BASIC SYS because that configuration does not correspond to any BANK.
The kernel LOAD/SAVE/VERIFY works with %00001110 in the MMU configuration register because all of the "original" kernel calls are in the range $E000-$FFFF.  The %00001110 configuration assumes that it is set up within an M/L routine, not BASIC.  That routine can be almost anywhere as long as it is still visible after the memory map has changed.  Both 80CDM and CC128 take advantage of that fact by running underneath the high end of the kernel ROM (with CC128 linked into the IRQ subsystem).  I didn't think it was necessary to point out all that, as a beginning C-128 M/L programmer most likely wouldn't be fiddling with the memory map.
x86?  We ain't got no x86.  We don't need no stinking x86!

MIRKOSOFT

Hi!


Many thanks.


I solved it with setting $ff00 to value #$02.
So I have free mem up to $7fff.
For now it is sufficient memory.
MIRKOSOFT of megabytes

Commodore 64 was great, Commodore 128 is bigger, better, faster and more!!!

http://www.mirkosoft.sk

Hydrophilic

Glad to hear you solved your problem, Mircosoft.

Quote from: BigDumbDinosaurThe kernel LOAD/SAVE/VERIFY works with %00001110 in the MMU configuration register because all of the "original" kernel calls are in the range $E000-$FFFF.

Can you explain how that would work?  Before calling LOAD/SAVE/VERIFY, you need to call SETBNK.  It only accepts standard BANK numbers (0~15, same as BASIC).  Since %00001110 does not correspond to any of BANKS 0~15, I am quite confused!
I'm kupo for kupo nuts!

BigDumbDinosaur

#7
Quote from: Hydrophilic on June 24, 2010, 08:58 AM
Quote from: BigDumbDinosaurThe kernel LOAD/SAVE/VERIFY works with %00001110 in the MMU configuration register because all of the "original" kernel calls are in the range $E000-$FFFF.

Can you explain how that would work?  Before calling LOAD/SAVE/VERIFY, you need to call SETBNK.  It only accepts standard BANK numbers (0~15, same as BASIC).  Since %00001110 does not correspond to any of BANKS 0~15, I am quite confused!
          LDA #DATABANK
          LDX #NAMEBANK
          JSR SETBNK

What the above is doing is establishing the banks (not MMU configuration) where the data to be loaded/saved/verified resides (.A) and where the filename string is located (.X).  All SETBNK does is store those values at $C6 and $C7 respectively.  Later, when LOAD/SAVE/VERIFY is called, the SETBNK values are used to called the INDFET, INDSTA and INDCMP kernel routines, which internally call the GETCFG kernel routine to translate the bank numbers into an MMU configuration value on the fly.  The map that existed at the time the LOAD/SAVE/VERIFY call was made is restored upon exit.  Therefore writing
%00001110 to the MMU is perfectly logical.  Note that there is no relationship between the values established by SETBNK and the memory map established by writing directly to the MMU configuration register at $FF00.  Also note that the only SETBNK values that are of any particular value are 0 and 1, as the data and filename could only be located in RAM-0 or RAM-1.
x86?  We ain't got no x86.  We don't need no stinking x86!