Note this article is not finished it supposed to be a three part article, but due lack of time and it was suggested to me that it contain some details that are never documented before so here it is in draft version:
Commodore 128(D) Personal Computer is great and versatile Dual CPU 8 bit system with Dual Head Graphic chips.
Dual CPUs are 8502 for C64/128 (6510 opcode compatible but 2x faster) and Z80 for CPM. It is even better three CPUs in Commodore 128DCR as on same board there is another 6502 on same board π
Versatile because it can run 3 different Operative Systems:
-Native Commodore 128 at 1 and 2MHz with 40 and 80 Columns (Dual head display possible)
-Compatible Commodore 64
-CPM Mode
Another hardware feature that Commodore 128 had was reset button π
Unfortunately some C128 users were only playing game, so advanced C64 gamer would only turn C128 on and pressed C= button. Other that have more C128 experience will type GO64 and confirm it by Y π
0.Booting from Floppy
C128 have boot feature as when it starts it checks track 01 sector 00 disk drive number 8 for boot sector to either start file on C128 or to execute it!
Now there you can not put much code but if you know some tricks you can:
-run some C128 program
-renumber drives
-start program that just change colors and Function Keys
-start REU ram drive and copy some programs to it, for development or fun
-and even start some c64 program in C64 mode
-execute 235 bytes of code π
samples of C128 boot disk are:
1571-demo boots C128 DOS SHELL and also contains autoboot maker
c128_boot_disk boots in C128 then goes to 64 mode and loads ultraload speed loader with name LOAD.
You just need to do load”$”,8 and chose game. Games on disks are FREE and are from A.Savonas and o.PAIGE
1. Hack for C64 with reset
Type:
BANK1:POKE DEC(“FFF9”),DEC(“FF”):POKE DEC(“FFF8”),DEC(“4D”)
And now press on that C64 reset button that C128 have !
Do I hear WOW, now press reset again π Works in Vice too π
Too much to type ? hm lets do it shorter $FF=255 $4D=77
Less typing, more play
BANK1:POKE DEC(“FFF9”),255:POKE DEC(“FFF8”),77 press reset
Even Less typing
BANK1:POKE 65529,255:POKE65528,77
Super short
B[SHIFT A]1:PO[SHIFT K]65529,255:PO[SHIFT K]65528,77
What magic was used here ?
FFF8Β is SYSTEM vector of C128 Kernel Jump Table. It is located in BANK1 (RAM1) and as we put $4D $FF upon reset it JUMPs to $FF4D
And $FF4D JuMPs to C64 MODE (JMP $E24B)
To make it even few cycles faster you will type
BANK1:POKE 65529,226:POKE65528,75
You are stuck in C64 mode forever! Until you do not cut power to your C128!
1.1. GONE to C64
You can go to C64 mode on several ways from basic in either 40 or 80 column you can type:
-GO64
-GO 64
-GO 128/2
-GO 32+32
-GO 65-1
-GO 8^2
-GO NOT(-65)
-FAST:GO 64
All above combination are same, it is just math, but they will ask for confirmation “ARE YOU SURE?” and if your answer start with “Y” you will be in C64 mode in few seconds.
1.1.1. GONE to C64 with no Questions Asked π
1 GO64
RUN
So from basic program it will not ask you to confirm if you want C64 mode. And your basic C128 program will be lost too π
1.2. C= to C64
There is also alternative press C= (Commodore Key) and reset, you will go straight to C64 π
2.MHz
Commodore 128 have a 2MHz mode at a cost of blanking VIC II chip, but 80 columns (VDC) works fine.
So if your program needs some fast calculation you can start with FAST command and in case you need to print out or you are expecting some input from user you can go back to 1MHz mode with SLOW command.
3.CP/M or CPM
3.1. There are few versions of CPM disks:
-first one does not support REU and 1581 (1 AUG 85)
-from (8 DEC 85)
-the last one supports REU ram disk and 1581 and contains programs to turn off verification on 1571/1581 and 40 column screen off
3.512. REU Ram Disk Support
With CPM that support REU you can use it as a 512KB RAM DISK,
if we say that 1571 is about 360(GCR)-410KB(MFM) it can fit entire 1571 disk to 512KB RAM DISK while 1581 is a bit larger 800KB(MFM)
to copy files under CPM you use PIP command, ie:
PIP m:=a:*.* (copy to M: from A:*.* (all files))
Yes Destination is first and source second!!!
Now make sure bootable CPM is in bootable drive and press reset,
content of M: is still there
4.MHz is speed of your Z80 CPU in C128(D)(CR)
It is actually the cpu that start your C128 and after some tasks give control to 8502 CPU, so ripping it out will not help your C128 π
And yes you can say that you have DUAL CPU (Z80 and 8502) on board C128(CR), but people with C128DCR have THREE CPUs on board (Z80, 8502 and 6502). While the people with plastic C128D have THREE CPUs inside case as 1571 drive has separate board.
7.Interleave on disk 1571
Single file is stored over several sectors on disk.
Disk in drive is constantly spinning and drive is optimized to read sector and send data. So it does not have enough time or ram storage to read every consecutive sector or entire track and send data.
In order to optimize reading we are counting how many sectors passed head befeore drive is ready to read next sector.
So whole purpose of interleave is to make the disk drive more efficient and to read file faster.
Best Interleave for 1571 drive is 7 in C128 mode and in C64 with ultraload (try to boot c128_boot_disk in c128 mode)
use open 1,8,15,”u0>s7″:close 1 to set interleave 7 for 1571
For C64 user every disk speed loader have its own interleave as it depends on speed of reading of disk, disk drive and sending data to C64.
8.Functional Keys
Like C64, C128 have 8 Functional Keys,
but also HELP is also kind of Functional Key,
pressing on HELP will not HELP you at ALL, you will get nothing,
but you will get something, when you get an error in your code.
8.1.You can redefine Functional KEY in C128 and also save it as a program
and Boot at (re)start your C128 with customized Functional Keys.
8.2.Key Repeat
You can disable your key repeat under C128 with POKE 2594,0.
To return to normal POKE 2594,128
36.Function ROM
Commodore 128 have free socket for 32KB internal function rom. With some additional tricks you can expand its use, so megabit function roms also exists.
List of Function ROM one may find usefull:
-Basic 8 (Press CTRL while turning C128 ON)
Now you have draw commands and more with your C128 π
Now above picture is a bit boring, but you can do also 3D images, painting…
The Servant
RamDos128 (Press Ctrl to boot) gives you ramdisk
Geos 1571 ROM instant GEOS loading with 1571
Geos 1581 ROM instant GEOS loading with 1581
Super Chip (several utilities on Function keys)
TurboAssembler128 (in C64 mode), KeyDos etc
C128 Device ManagerΒ is perhaps only one you will need as it provides basic system info, ram check of your c128 and reu, but you can also swap, renumber and shut off drives. We hope to see also ram disk option.
Choosing boot drive is nice option if you need andwant to choose bootingΒ from 1581 or SD2IEC
Megabit ROM contains selection ofΒ software, but additional pcb is required and additional bank switching wire.
Now that we covered Internal Function rom that is inside your C128 in U36 slot, there is also 32KB External Function rom available as external cartridge or you can find empty slot in your REU (Ram Expansion Unit 1700,1764 or 1750) and some of roms can work in either slot or even together.
Note Commodore 128 emulators are not handling well function roms and some may or may not work with your emulator and sometime you will need to press ESC or ALT to run it.
Even on real C128(d)(cr) you may find problems with them some work with older sets of rom , some with new set of rom.
40.Column mode is controlled by VIC II
What is for that 40/80 Display for ?
80.Column mode thanks to VDC in your 128 can do very interesting things like 720Γ700 pixel video resolution or 80×50 text mode π
Yes that key 40/80 display can be used on C128 if you start Geos 128 in 40 column mode you can switch it to 80 and back.
Now first commodore 128 came with 16KB of VDC ram, later cost reduced ones are with 64KB ram π
If you know how to de solder chips there is fine trick for people with C128 with 16KB VDC .
Now you can expand easily your 16KB 128 to 64KB if with de solderingΒ two 4416 ram chips with soldering two 4464 (same as in C64c later models)
Extra gain is also as some copy programs used VDC ram as a ram disk for disk duplicating and of course use those 80 column software and games.
128. Easter Egg
To see who are creators of your Commodore 128 Computer you will need to type: SYS 32800,123,45,6
146. First series of Commodore 128 had actually 146KB of ram on board, but it can use only 145KB.Β Base ram is 128KB+16KB VDC ram+2KB color ram (C128 have two pages of color ram) as it have only 16 colors 1KB ram is wired to resistors. By replacing 16KB VDC ram with 64KB you will get
194.Cost Reduced C128 version have 194KB and usable only 193KB
(128KB+64KB VDC ram + 2KB color ram)
196.While metal C128DCR have 196KB on board, but usable only 195KB
(128KB+64KB VDC ram + 2KB color ram + 2KB for onboard 1571)
512. REU (Ram Expansion Module) 1700(128KB),1764(256KB),1750 (512KB)
Depend of model REU expand C64/C128 storage for 128/256 or 512KB,
with some hacks you can get 2MB and even 16MB of ram (Ultimate1541)
512.J1.Now if you have REU 1764 (256KB) model you can easy upgrade it to 512KB one, if you know how to solder.
You just need to solder 8 DIL sockets in their empty places in second row and insert DRAM 41256-15 (150 ns or faster, doesn’t matter), and cut the proper J1 connection on the other side of pcb, where it say:”CUT-512K”
512.3.1. We already mentioned CPM REU RAM DISK M:
512.128. There is also C128 REU RAM DISK
Now lets put some data to REU RAM DISK (entire 1351 demo disk)
Now let us see what is in REU RAM DISK (Directory U11)
512.64. There is no REU for C64 without RAM DISK So lets GO64 π
First load REU RAM DISK for C64 π
Note we DO NOT WANT to INIT RAM DISK so say N!
Now let us see what is on REU RAM DISK
Yes all is there !!! π
Reset it and go back to C64 and C128 data in REU
will be there until you do not shut C128 OFF.
1541.Disk Validation
Never Validate Bootable 5.25 1541/1570/1571 disk,
it will release T01/S00 and it will be overwritten and
disk will not be bootable anymore!
1570.Disk Validation
Never Validate Bootable 5.25 1541/1570/1571 disk,
it will release T01/S00 and it will be overwritten and
disk will not be bootable anymore!
1571.Disk Validation
Never Validate Bootable 5.25 1541/1570/1571 disk,
it will release T01/S00 and it will be overwritten and
disk will not be bootable anymore!
Yes that is SO IMPORTANT!!!
1581. Commodore disk drive has also Easter Egg
You can also try this code in vice emulator just do cut and paste:
10 open15,9,15:n$=”m-w”:m$=””
20 fori=0to3:reada:n$=n$+chr$(a):next
30 fori=0to2:reada:m$=m$+chr$(a):next
40 print#15,n$chr$(121)m$:print#15,”m-e”chr$(0)chr$(3)
50 get#15,a$:printa$;:ifst=0goto50
60 print#15,n$chr$(122)m$:print#15,”m-e”chr$(0)chr$(3)
70 get#15,a$:printa$;:ifst=0goto70
80 data0,3,5,169
90 data76,63,255
8502.MONITOR
C128 has great monitor built in from basic you can start it with F8 or simply typing monitor(or short moN) and enter, but power is yet to come.
You can enter in monitor with [RUN/STOP] and reset, you will go straight to C128 Monitor π
Now one can dissemble or assemble 8502 (6502) code or just looking at memory, write code and go to C64 mode and back to monitor, with just one single byte lost at location $A000 (40960)
When you go to C64 mode Commodore 64 do the ram check, non destructive one, routine basically read byte from ram , write another byte $55 and reads it again to compare it, as BASIC rom starts at $A000 it finds $94 an as this location as end of ram it prints amount of ram, but it actually write $55 to ram under rom and hence one byte is lost.
So there is a bug in C64 KERNAL.
You can exit from monitor to C128 Basic with X π
If you noticed that some C128 BASIC programs with sprites and music does not work, it is because you need to enable BASIC interrupts with >A04 C1
There is one more benefit you will not see BOOTING from device 8 π
8502.1.Let see some of addresses that we can use π
8502.1.1. G FF8A1
Put bootable disk in drive 8, press F8 and type G FF8A1,
yes this is same as typing BOOT from C128
8502.1.2. G 0FFD0
Put CPM bootable disk in drive 8, press F8 and type G 0FFD0
yes this is executed if BOOT find CPM disk
People with only 1541 drive can skip to end π
9876.Burst Mode (or synchronous Serial) Loading
Commodore 128 got few new drives VC1570/1571/1581 capable of burst protocol, that was initial intention of Commodore to have fast IEC drive with C64 but they found a bug in VIA 6522 and because of compatibility to VIC20 they stick to painfully slow iec. So they created floppy with 6526 CIA chip.
To be fair we need to mention that also CMD disk drives are capable of burst protocol FD2000, FD4000 and CMD-HDD. There are also SD2IEC with burst patch for outdated firmware and Pi1581 (emulation of 1581 in RPI)
BTW You can modify your C64 to be capable of burst loading with rom change and soldering one wire from CIA to IEC port.
Note this article is not finished it supposed to be a three part article, but due lack of time and suggestion to me that it contain some details that are never documented before so here is draft version.
Comment bellow, comments will not be visible without approval.