; Our low bank is set, our high bank is still setup
;
start:
- ; Map the kernel high bank
- ld a,#4
+ ; Map the kernel high bank (2/3)
+ ld a,#2
out (251),a
l1: jp l1
ld sp, #kstack_top
- ; move the common memory where it belongs
- ld hl, #s__DATA
- ld de, #s__COMMONMEM
- ld bc, #l__COMMONMEM
- ldir
- ; then the discard
- ld de, #s__DISCARD
- ld bc, #l__DISCARD
- ldir
- ; then zero the data area
+ ; Zero the data area (shouldn't be needed)
ld hl, #s__DATA
ld de, #s__DATA + 1
ld bc, #l__DATA - 1
.globl outcharhex
.globl _keyin
+ .globl _vtwipe
+ .globl _vtinit
+
.globl s__COMMONMEM
.globl l__COMMONMEM
.include "kernel.def"
.include "../kernel.def"
-KERNEL_HIGH .equ 0
-KERNEL_LOW .equ 2 ; 0/1 high 2/3 low
-VIDEO_LOW .equ 4
+KERNEL_LOW .equ 0 ; 0/1 low 2/3 high
+KERNEL_HIGH .equ 2
+VIDEO_LOW .equ 4 ; 4/5 video and font
; -----------------------------------------------------------------------------
;
.byte 0x00 ; Black
.byte 0x40 ; Green
.byte 0x20 ; Red
- .byte 0x70 ; White
clutmap:
+ .byte 0x70 ; White
init_early:
ld a, #0x44 ; Kernel is in 0/1 2/3, so video goes above it
out (252), a
ld a, #0x10 ; black border, mic 1
out (254), a
- in a, (251)
- and #0x9F ; low palette colours
- ld hl, #clutmap
+ ld hl, #clutmap ; set low palette colours
ld bc, #4*256 + 248 ; 4 colours, port 248
otdr
ret
ld hl, #(256-64) ; 64K for kernel
ld (_procmem), hl
- ; set up interrupt vectors for the kernel (also sets up common memory in page 0x000F which is unused)
- ld hl, #0
- push hl
- call _program_vectors
- pop hl
-
im 1 ; set CPU interrupt mode
; interrupt mask
- ; 60Hz timer on
+ ; 50Hz timer on
+
+ call _vtwipe
+ call _vtinit
ret
.globl _vtattr_notify
.globl _vtattr_cap
+ .globl _vtwipe
+
.globl map_video
.globl unmap_video
.globl ___hard_di
-_fontdata_8x8_exp2 .equ 0xE000 ; in video bank
+_fontdata_8x8_exp2 .equ 0x6000 ; in video bank
VIDEO_PAGE .equ 4
ld a,d ; save X
ld d,e ; 256 * Y
ld e,#0
- srl d
- srl e ; this is DE = E * 128
+ sla e
+ sla d ; this is DE = E * 512
+ sla e
+ sla d ; this is DE = E * 1024
+
; A is a char 0-63 - need a byte 0-126
; Aligned so no carry issues
add a
ld bc,#_fontdata_8x8_exp2 ; plus font base
add hl,bc
call map_video
- ld b,#20 ; it gets decremented by 4 by the ldi's
- ; and once by djnz, and we need to do it
- ; four times
+ ld bc,#0x04FF ; it gets decremented by DJNZ while the FF
+ ; ensures the ldi never decrements B
plot_loop:
ldi ; copy expanded char
ldi
jr nz, wipe_line
jp pop_unmap
+_vtwipe:
+ call map_video
+ ld hl,#0
+ ld de,#1
+ ld bc,#24575
+ ld (hl),#0
+ ldir
+ call unmap_video
+ ret
;
; TODO
;