Post by jmpff3d on Nov 10, 2018 15:50:24 GMT
57549 $E0CD - Initializes all RAM-resident Kernal routines.
Copies the interrupt- and reset-handling routines at 65285-65348/$FF05-$FF44 in Kernal ROM into the same addresses in both RAM banks. These routines redirect interrupts and reset to the proper handling routine in Kernal ROM (bank 15). It's necessary to have a copy in each bank, because an interrupt or reset can occur while the system is configured for any bank. The routines are actually copied into banks 0-3, even though there isn't unique RAM in banks 2 and 3 in the current 128.
It's been a while since I've messed with the C-128 like I have the past few weeks. I'm wondering if I ever noticed the startup behavior noted above before or simply forgot about it. In the insert below, check out the superfluous copy/write dance to phantom ramblocks on init .. and the presumptive 'fix' for it, if you dare mod your kernal! ... Mapping the 128 (as seen above) makes mention of this behavior, so it's not an 'unknown thing'. Would have been nice if they had fixed this on final release, but maybe they REALLY were planning on proper MMU 0-3 ramblocks and consequent C256 action!
; MMU bitswitch guide - https://pastebin.com/Wh2EKdwt
. fe0cd a0 03 ldy #$03 ; is it as simple as changing this to #$01 to remove copy/writes to non-existing ram ?
. fe0cf b9 05 e1 lda $e105,y ; y-index pulls c0 80 40 00 .. from table at $e105 into A, and sends A to mmu mirror $ff00
. fe0d2 8d 00 ff sta $ff00 ; 00 -> ramblock0 .. 40 -> ramblock1 .. 80 -> ramblock2 .. c0 -> ramblock3
. fe0d5 a2 3f ldx #$3f
. fe0d7 bd 05 ff lda $ff05,x
. fe0da 9d 05 ff sta $ff05,x
. fe0dd ca dex
. fe0de 10 f7 bpl $e0d7
. fe0e0 a2 05 ldx #$05
. fe0e2 bd fa ff lda $fffa,x
. fe0e5 9d fa ff sta $fffa,x
. fe0e8 ca dex
. fe0e9 10 f7 bpl $e0e2
. fe0eb 88 dey
. fe0ec 10 e1 bpl $e0cf
. fe0ee a2 59 ldx #$59
. fe0f0 bd 00 f8 lda $f800,x
. fe0f3 9d a2 02 sta $02a2,x
. fe0f6 ca dex
. fe0f7 10 f7 bpl $e0f0
. fe0f9 a2 0c ldx #$0c
. fe0fb bd 5a f8 lda $f85a,x
. fe0fe 9d f0 03 sta $03f0,x
. fe101 ca dex
. fe102 10 f7 bpl $e0fb
. fe104 60 rts