Faster C64 Boot
February 12, 2022
Weren’t you always wondering if you can boot C64 faster? Have you heard about startup memory test? Actually each time C64 turns on mem test is performed (general idea: memory byte is loaded, moved temporarily to X register, $55 is stored to ram and loaded back, ROLed (so it becomes $AA) and then compared to what was stored again and RAM byte is restored from X register if everything goes well)
All this is made actually not to test ram itself (usually you get black screen with bad ram anyway) but to see what is TOP OF RAM (this is probably some legacy code from VIC20 where determining how much memory is installed in machine was important variety top mem configs starting from $1400 to $8000), which can be $8000 if /ROML cart is inserted or $A000 otherwise.
This actually make testing memory lower than $8000 completely unnecessary and side-effect is that it makes boot process slower. Even if ram is only partially broken and machine manages to boot, you can get OUT OF MEMORY ERROR if just beginning ($0800) is bad or you simply get less than usual 38911 (-8k if /ROML occupied) bytes free, not a real mem test, huh?
Some time ago I happened to stumble upon EXOS kernal ROM replacement. This one standed from crowd due to its instant boot. Today I finally tried to take few mintues to see what’s the difference and it looks like clever guy from Germany (probably J. Schemmel unless someone haxx0red ROM image) just tested one byte in /ROML area to see if cart is attached and set TOPMEM pointers accordingly to $8000 or $a000, so you only need to patch RAMTBT routine in original kernal or even JiffyDOS with this code at $FD67-FD8D:
.C:fd67 A8 TAY
.C:fd68 AD FF 9F LDA $9FFF
.C:fd6b A2 FF LDX #$FF
.C:fd6d 8E FF 9F STX $9FFF
.C:fd70 EC FF 9F CPX $9FFF
.C:fd73 D0 10 BNE $FD85
.C:fd75 E8 INX
.C:fd76 8E FF 9F STX $9FFF
.C:fd79 EC FF 9F CPX $9FFF
.C:fd7c D0 07 BNE $FD85
.C:fd7e 8D FF 9F STA $9FFF
.C:fd81 A0 A0 LDY #$A0
.C:fd83 D0 07 BNE $FD8C
.C:fd85 8D FF 9F STA $9FFF
.C:fd88 A0 80 LDY #$80
.C:fd8a A2 00 LDX #$00
.C:fd8c 18 CLC
.C:fd8d 20 2D FE JSR $FE2D
After that you get INSTANT boot (like some cartridge does, these are actually bypassing that useless mem test).
Categorized as: Uncategorized
Leave a Reply
You must be logged in to post a comment.