From: Alan Cox Date: Fri, 17 Aug 2018 23:51:14 +0000 (+0100) Subject: sam: restructure loading a bit fix some display and other bugs X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=0c738bf5bd1d7cc85a64e86b3417cd7de207cb8d;p=FUZIX.git sam: restructure loading a bit fix some display and other bugs We now get to the point we start trying to boot, and blow up after the RAM sizing message. I suspect this is program_vectors exploding. --- diff --git a/Kernel/platform-sam/crt0.s b/Kernel/platform-sam/crt0.s index e7f0cf53..cb3bca05 100644 --- a/Kernel/platform-sam/crt0.s +++ b/Kernel/platform-sam/crt0.s @@ -47,21 +47,12 @@ ; 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 diff --git a/Kernel/platform-sam/sam.s b/Kernel/platform-sam/sam.s index b437f21e..b6b959e4 100644 --- a/Kernel/platform-sam/sam.s +++ b/Kernel/platform-sam/sam.s @@ -36,15 +36,18 @@ .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 ; ----------------------------------------------------------------------------- ; @@ -71,8 +74,8 @@ _platform_reboot: .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 @@ -80,9 +83,7 @@ init_early: 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 @@ -94,16 +95,13 @@ init_hardware: 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 diff --git a/Kernel/platform-sam/sam_vt.s b/Kernel/platform-sam/sam_vt.s index 8a9e10af..e1292124 100644 --- a/Kernel/platform-sam/sam_vt.s +++ b/Kernel/platform-sam/sam_vt.s @@ -28,11 +28,13 @@ .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 @@ -43,8 +45,11 @@ base_addr: 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 @@ -103,9 +108,8 @@ _plot_char: 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 @@ -177,6 +181,15 @@ wipe_rowpair: 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 ;