Ideal area for ML code...

Started by MIRKOSOFT, November 11, 2009, 12:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MIRKOSOFT

Hi!

I'm not long time programming in assembler on C128, so, I'm not sure of ideal bank config and memory location for ML code.
On C64 it is not problem, there are not banks, MMU...

So, what I want to explain?

Which bank and memory location is best for ML code which access I/O and leave most possible place for BASIC program?

Thank you all!

Miro
MIRKOSOFT of megabytes

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

http://www.mirkosoft.sk

BigDumbDinosaur

A good place to start is at $1300 in RAM 0.  You don't have to do anything with memory mapping if you use SYS to call it.  Just do a BANK 15:SYS DEC("1300") and the memory map will have all ROMs in.

For more elaborate programs, it is possible to adjust the top-of-BASIC pointers to free up some RAM at the high end of the machine.  Here you would do BANK 0:SYS... to run your program.  You wouldn't however, have easy access to ROM and I/O.

There are lots of places where you can load and run M/L routines on the 128 if you know how to manage memory.  You should spend some time reading Mapping the Commodore 128, which is archived somewhere around here.
x86?  We ain't got no x86.  We don't need no stinking x86!

Hydrophilic

Oh, BDD types faster than me!

Commodore reserved RAM on the C128 just for small ML programs.  This is the area $1300~$1BFF.  It is not used by BASIC or the KERNAL.

You can also use area $0B00~$0FFF if you want to loose some functionality.  $B00 area is used to BOOT disk and for cassette.  $C00 and $D00 areas are used for RS-232 (modem).  $E00 and $F00 areas are used for SPRITEs.
I'm kupo for kupo nuts!

MIRKOSOFT

Hi!

Thanks, this I know, but I'll select larger area.

Miro.
MIRKOSOFT of megabytes

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

http://www.mirkosoft.sk

Hydrophilic

To get a fairly large area that works with BASIC, you can use the area normally used by the VIC bitmap (of course then you can not have VIC bitmap graphics, at least not with the BASIC commands).

Your BASIC program should start with GRAPHIC1 (this allocates the VIC bitmap for you to use) and follow it with GRAPHIC0 to use the VIC text screen or GRAPHIC5 to use the VDC text screen.

With this method, you have $1300~$3FFF (10.25 kiB) bytes that work in BANK 15 for easy access to KERNAL and I/O.

If you want even more memory, you should try BANK 12 or 13.  This gives you RAM Bank 0 below $8000, plus KERNAL/EDITOR ROM, and I/O registers.  It also gives you function ROM or catridge ROM at $8000 to $BFFF.  With this method you have $1300~$7FFF (26.25 kiB) to use.  I hope that is large enough!

In this case, BASIC is harder to use because you will have to change start of BASIC pointer ($2D,2E) to higher in memory and be sure no BASIC command is used that (de)allocates the VIC bitmap.  Such as SPRDEF, GRAPHIC [1,2,3,or 4], or GRAPHIC CLR.
I'm kupo for kupo nuts!

BigDumbDinosaur

$0B00 is only disturbed during reset or if the kernel BOOT call is used.  If you don't need RS-232 and sprites, you can usurp everything from $0B00 to $0FFF, giving you 1280 bytes in which to work.  A good programmer can cram a lot in that space.

Unfortunately, the C-128 doesn't really have an analog to the $C000 block in the C-64, which is a contiguous 4K of RAM.  The 2304 bytes in the range from $1300 to $1BFF (inclusive) is as close as it gets.
x86?  We ain't got no x86.  We don't need no stinking x86!