0/1/2/3 - user process 0: 48K, 16K common
4/5/6/3 - user process 1: 32K, 16K common, 16K is kernel reserved
4/7/6/3 - kernel: 48K minus screen, common 16K (some kernel in it)
+ (conveniently the map 'BOOT' uses)
As an aside this only works for the +2A/+3. The various clones even with
lots of RAM clone the original 128K and add more pages of memory in the top
.module crt0
- ;
- ; Bank 4-7
- ;
- .area _CODE
- .area _CODE2
+ .area _CODE ; Code lives at 0000-0x3FFF in bank 4
+ .area _CODE2 ; Lives at 0x5B00 onwards in bank 7/6
.area _CODE3
.area _CONST
.area _VIDEO
+ .area _FONT
.area _INITIALIZED
.area _DATA
.area _BSEG
.area _GSINIT
.area _GSFINAL
.area _DISCARD
- .area _FONT
;
; Above 0xC000 in the top of bank 3
;
-mwxuy
--r
-i fuzix.ihx
-b _COMMONDATA=0xF800
--b _CODE=0x0000
--b _DISCARD=0xC000
+-b _COMMONMEM=0xF000
+-b _CODE=0x0100
+-b _CODE2=0x5B00
+-b _DISCARD=0xE400
-l z80
platform-plus3/crt0.rel
platform-plus3/commonmem.rel
.globl map_restore
.globl map_process_save
.globl map_kernel_restore
- .globl map_video
- .globl unmap_video
.globl map_for_swap
.globl _need_resched
ld hl, #(128 - 64) ; 64K for kernel/screen/etc
ld (_procmem), hl
- call map_video
; screen initialization
; clear
- ld hl, #0xC000
- ld de, #0xC001
+ ld hl, #0x4000
+ ld de, #0x4001
ld bc, #0x1800 ; There should be 0x17FF, but we are going
xor a ; to copy additional byte to avoid need of
ld (hl), a ; DE and HL increment before attribute
ld (hl), a
ldir
- call unmap_video
ret
;------------------------------------------------------------------------------
switch_kernel:
ld a, (port_map)
- and #0xF8 ; Preserve the other bits
- or #0x05 ; Map 4,5,6,3
+ or #0x07 ; Map 4,7,6,3
switchit:
push bc
ld (port_map), a
ld a, (port_map)
and #0xF8 ; Preserve the other bits
and #0x01 ; Map 0,1,2,3
- jr switch_kernel
-
-switch_video:
- ld a, (port_map)
- or #0x7 ; Map 4,7,6,3
+ or #0x04
jr switchit
map_process:
pop af
ret
-unmap_video:
map_kernel:
map_kernel_restore:
push af
pop af
ret
-map_video:
- push af
- call switch_video
- pop af
- ret
-
map_save:
push af
ld a, (port_map)
ld e,a
ld a,d
and #0x18
- or #0xC0 ; not 0x40 as in screen 7
+ or #0x40 ; page 7 is mapped here
ld d,a
ret
rl b
ld c, a
+ ; FIXME: Can't do this any more!
ld hl, #0x3C00 ; ROM font
add hl, bc ; hl points to first byte of char data