Skip to content

Commit

Permalink
rc2014: adapt to new RomWBW memory layout
Browse files Browse the repository at this point in the history
RomWBW version 3.4 changed the memory layout, putting the HBIOS working
copy into RAM bank 0. To prevent the Fuzix loader from overwriting
HBIOS, store data for bank 0 temporarily in bank 4. Copy bank 4 to bank
0 immediately before starting the kernel, when no more RomWBW calls are
needed.

This works with older RomWBW versions as well, which had HBIOS in nRAM-2
and lower banks were free to use.

Tested with RomWBW 3.2, 3.4, 3.5-dev.101 on Zed Pro.
  • Loading branch information
ra1fh committed Dec 23, 2024
1 parent f425f6f commit b721e03
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions Kernel/platform/platform-rc2014/boot-romwbw.s
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ bootit:
ld hl,#0x8000 ; Don't copy first 256 bytes over
ld de,#0x4000
ld bc,#0x4000 ; We've loaded 0000-4000
ld a,#32
ld a,#40

di
out (MPGSEL_1),a ; Low bank at 0x4000 please
out (MPGSEL_1),a ; Bank 4 first 16K at 0x4000
ldir

;
Expand All @@ -102,8 +102,9 @@ bootit:
ld hl,#0x8000 ; Move it into place
ld de,#0x4000
ld bc,#0x4000
ld a,#33
out (MPGSEL_1),a ; Second kernel bank at 0x4000 please
ld a,#41
di
out (MPGSEL_1),a ; Bank 4 second 16K at 0x4000
ldir
pop bc

Expand Down Expand Up @@ -207,6 +208,28 @@ bootit:
out (MPGSEL_1),a
ldir

;
; Copy from bank 4 to bank 0
;
ld hl,#0x4000
ld de,#0x0000
ld bc,#0x4000
ld a,#40
out (MPGSEL_1),a
ld a,#32
out (MPGSEL_0),a
ldir

; page 41 to page 33
ld hl,#0x4000
ld de,#0x0000
ld bc,#0x4000
ld a,#41
out (MPGSEL_1),a
ld a,#33
out (MPGSEL_0),a
ldir

;
; Map the kernel low 16K block and jump into it
;
Expand Down

0 comments on commit b721e03

Please sign in to comment.