|
Post by stiggity on Mar 31, 2022 16:57:16 GMT
How can the kernal be banked out, so i can store code underneath $E000 - $FFFF. Right now, i switch out BASIC ROM via
LDA #$0E STA $FF00
then execute code underneath, afterwards fall through`
LDA #$00 STA $FF00
thats been great, but finding a chunk of memory that code can be permanently stored. Of course load the kernal underlay in via BASIC or ML.. Any sort of insight is beyond appreciated.
|
|
|
Post by stiggity on Mar 31, 2022 22:37:24 GMT
Well, after some reading and research from google/bing searches, i found some good info, and actually have it working. But I have a question. I derived the binary # "00110000" #$30 wich once stored into MMU allows me to flip in and out of Kernal! But, the only kernal i want to access is $E000 - $FFFF. I believe the #$30 is banking out $C000 - $FFFF. IO have some routines that use $cdca, etc. the read and write registers for displaying character/colors to the VDC.. If anyone feels like clearing this up, I'm more than greatful.
|
|
|
Post by mirkosoft on Mar 31, 2022 22:52:18 GMT
|
|
|
Post by oziphantom on Apr 1, 2022 10:23:17 GMT
I have a video that covers the MMU in depth here youtu.be/GUH434tcg7U But yes you can only bank out C000-FFFF as one. While we might call E000-FFFF "the Kernal" and C000-CFFF Editor rom, to the 128 they are the same system. I.e the Kernal expect to have Editor ROM and Editor ROM expects to have the Kernal as well. Just copy the routines at CDCA,CDCC etc they are really small anyway.
|
|
|
Post by stiggity on Apr 2, 2022 3:12:41 GMT
Ozi: Im trying to execute code in the $E000 range, off of the IRQ. Below is an _attempt_ at showing my IRQ handler.
CLK sei lda #<newirq sta $0314 lda #>newirq sta $0315 cli rts
newirq jsr kernout CLD
tsx lda $0100 +7,x eor #$cd beq continue
jsr UpdVDC
continue jmp $FA65
UpdVDC ldx #$13 jsr cdda sec sbc #$01 sta VupdSavL jsr cdcc dex jsr cdda sbc #$00 sta VupdSavH jsr cdcc jsr cdd8 sta VdtaSav
ldx #$13 lda #$96 jsr cdcc dex lda #$07 jsr cdcc
;then to exit
ldx #$13 lda VupdSavL jsr cdcc dex lda VupdSavH jsr cdcc lda VdtaSav jmp cdca
an example of my KERNOUT handler.
kernout pha LDA #$30 sta $02de STA $FF00 JSR $e000 lda #0 sta $02de sta $ff00 pla rts
|
|
|
Post by stiggity on Apr 2, 2022 16:12:39 GMT
The prg in the $e000 range is a time and date retrieval and display. it works no problem in the $1300 - $3fff range, but my idea is to try and permanently keep it under $c000 - $ffff. I do know the irq fires 60x/1sec. I mean this routine could refresh one time every second? Aye? I'd really like an experts advice. Ive come thus far..
|
|
|
Post by stiggity on Apr 2, 2022 16:42:19 GMT
I've come up with something that's working.. sort of.. the entire prg loads, but the moment i try to handle any string variables, it will find them, but im getting a jam at $4946! once I try to print the variable.. 4946 is BASIC??
|
|
|
Post by stiggity on Apr 4, 2022 3:24:09 GMT
i got everything working. wasn't as bad as I had imagined. Making sure banks are right for certain routines tucked under basic rom. Ozi:Your video was wonderful. Copying the $CDCA routine is a brilliant idea. It's all working, thanks for the help!!
|
|
|
Post by oziphantom on Apr 6, 2022 16:58:06 GMT
sorry, got distracted and forgot to check this forum for a couple of days.
It's worth noting that the IRQ on the 128 is driven by the VIC-IIe and is on VIC-IIe VBlank, which is the opposite to the C64 which is on a CIA timer and always runs at the same rate on PAL and NTSC. While the 128 is 50 times a second or 60 times a second depending if you are on PAL or NTSC model.
in case you don't know the $1300-1BFF area is the 128's version of C000-CFFF ( although its half the size ), if you just want a user machine code area, and don't need more than 2.5K for it. The problem with C000-FFFF on the 128 is that is the top of program text. the 128 puts BASIC code from $1c00-$ff00 for 57.75K of code. So be sure to limit the top of BASIC PROG TEXT, otherwise a large basic program will just destroy your code. The Variables are fine as all the variables are stored in block 1.
|
|