Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > C128 coding
2011-09-08 07:07
AmiDog

Registered: Mar 2003
Posts: 97
C128 coding

I recently decided to atempt some C128 coding, as in porting a little something from C64 mode to native C128 one. Some things I've learned:

1. The C128 has ROM all over the place. If you use exomizer and have a start address >= $4000, you need to have exomizer enable some RAM (-Di_ram_exit=$0e) or you end up trying to execute ROM.

2. Did I mention the C128 has ROM all over the place? Poke $3e to $ff00 to enable RAM all over the place. But remember to disable raster interrupts first (or prepare to crash), as it's used by the C128 kernel.

3. Ever been annoyed about the hardware vectors getting in your way? Prepare to be annoyed about the MMU register mirror at $ff00. Accidently poke the "wrong" value there and you end up switching 64K RAM bank (=crash).

4. $01 is a totally different beast on the C128. Poke your normal $35 in there and you end up disabling CharROM in the current bank (which is handy) but you also tell VIC to access one of the ColorRAM banks while the CPU accesses the other. Took me some time to figure out why my $d800 writes didn't have any effect.

5. I told you about the kernel using raster interrupts, right? Well, unless you disable them, you need to use the shadow VIC registers or become confused as to why your VIC register writes gets wiped out all the time.

Now it's time to try to understand the banking and take advantage of the extra 64K somehow...
2011-09-08 07:16
ready.

Registered: Feb 2003
Posts: 441
interesting, I have always thought it'd be cool to do a C128 demo myself, but I need to get myself study this machine. Sometime in the not-so-near future.....
2011-09-08 07:26
Skate

Registered: Jul 2003
Posts: 490
3. Isn't it the expected behaviour? Try poking wrong values to hw vectors on c64 and see what happens. :)

4. This looks a little bit weird at the beginning but when you start using color ram double buffering feature, you will stop complaining. ;)
2011-09-08 09:15
AmiDog

Registered: Mar 2003
Posts: 97
@Skate

3. The annoying thing about the MMU registers is that they basically waste a full page at the end of the 64K bank. My problem was that I was using that page as part of a charset on the C64 and things just blew up when I copied that charset to the last page during setup. On the C64 the hardware vectors are only a problem when interrupts are enabled, but the MMU registers are there all the time.

4. Yes, double buffered ColorRAM is nice.
2011-09-08 15:04
Skate

Registered: Jul 2003
Posts: 490
Thanks for the explanation on the 3rd item.

I had a platform game project for C128 but somehow it turned into a C64 game project. :) I hadn't own a C128 until last year. I bought it to examine the real thing but because of my other projects on several platforms, my C128 projects are in pending status.

Continue discussing C128 stuff. It will help me and other coders who are interested in C128 in the future when searching CSDB forums. :)
2011-09-13 11:51
AmiDog

Registered: Mar 2003
Posts: 97
Having two 64K banks is nice, but how to use them both? There are a few ways:

1. Enable a little common RAM. Common RAM is basically bank 0 RAM visible in bank 1 as well. This means you can swap between banks at any time as long as the code currently running is in common RAM.

2. Relocate page 0 and/or page 1. As these pages can be put in the opposite bank (whichever that currently is), you basically have two 256 byte windows (or a combined 512 byte one) which can be used to poke and peek the other bank. Just rememner that $00 and $01 will remain special even when page 0 is relocated.

3. As a PHA is only three cycles, people seem to like to copy between banks by relocating page 1 and doing:

-
LDA (SRC),Y
PHA
DEY
BNE -


4. As the VIC can be directed to a different bank than the CPU, you can have 64K reserved for the VIC and 64K for code and data, if you need a lot of VIC banks that is :-)
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
A3/AFL
jmin
Guests online: 102
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Memento Mori  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Onscreen 5k  (9.5)
8 Wafer Demo  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Diskmag Editors
1 Jazzcat  (9.4)
2 Magic  (9.4)
3 hedning  (9.2)
4 Newscopy  (9.1)
5 Elwix  (9.1)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.038 sec.