dd if=/dev/zero of=fuzix.raw bs=512 count=1600
# Boot block at track 4 sector 1
dd if=boot.bin of=fuzix.raw bs=512 seek=40 count=1 conv=notrunc
- # Kernel from track 4 sector 2
- dd if=../fuzix.bin of=fuzix.raw bs=512 seek=41 conv=notrunc
+ # Kernel from track 4 sector 2 highest 32K first
+ dd if=../fuzix.bin of=fuzix.raw bs=512 seek=41 skip=64 count=64 conv=notrunc
+ # Low 32K next
+ dd if=../fuzix.bin of=fuzix.raw bs=512 seek=105 count=64 conv=notrunc
# Font and setup from 64K further on
- dd if=setup.bin of=fuzix.raw bs=512 seek=169 conv=notrunc
+ dd if=setup.bin of=fuzix.raw bs=512 seek=169 skip=64 conv=notrunc
# Now shuffle it into a .mgt file
../tools/raw2mgt fuzix.raw fuzix.mgt
jp go
go:
ld sp,#go
- ld de,#0x0401 ; track 4 sector 2 (we are sector 1)
+ ld de,#0x0402 ; track 4 sector 2 (we are sector 1)
ld a,e ; Start in bank 2
ld hl,#0x8000 ; Which we map high
out (HIMEM),a
ex af,af'
still_good:
ld a,e ; update the sector register
- ld (SECTOR),a
+ out (SECTOR),a
dread: ld a,#CMD_READ ; Ask for data from the FDC
out (CMD),a
ld b,#20 ; Wait for FDC
;
; Once the loader completes it jumps here
+; Our low bank is set, our high bank is still setup
;
start:
+ ; Map the kernel high bank
+ ld a,#4
+ out (251),a
+l1: jp l1
ld sp, #kstack_top
; move the common memory where it belongs
ld hl, #s__DATA
nop
nop
nop
- ; 40
- .ds 0x26
-nmi_handler: ; FIXME: check ends up at 0066
+ .ds 0x27
+nmi_handler: ; Should be at 0x66
retn
.area _PAGEH
-m
-i setup.ihx
+-b _BOOTSTRAP=0x8000
setup.rel
../font8x8_exp2.rel
-e
.globl _fontdata_8x8_exp2
.area _BOOTSTRAP
+ .area _FONT
+
+ .area _BOOTSTRAP
MODE3 .equ 0x40 ; I think ?
+LOMEM .equ 250
+VIDEO .equ 252
+BORDER .equ 254
bootstrap:
; Blue border for debugging
ld a,#1
- out (254),a
+ out (BORDER),a
;
; The kernel low 32K is currently sitting in 4/5 not 0/1 so
; move it. The upper 32K is already in 2/3
;
ld de,#0x2420
+ ld sp,#here
+here:
call copy16k
ld de,#0x2521
call copy16k
;
; Map bank 4/5 low
ld a,#0x24
- out (250),a
+ out (LOMEM),a
; Put the font data where it belongs
ld hl,#_fontdata_8x8_exp2
ld de,#0xE000-0x8000
;
; Put the video in the right place and set the mode
ld a,#4 + MODE3
- out (252),a
+ out (VIDEO),a
; Map the kernel low
ld a,#0x20 ; ROM off bank 0/1
- out (250),a
+ out (LOMEM),a
; Black border to hint where we got to
xor a
- out (254),a
+ out (BORDER),a
jp 0x100
;
; Move 16K via a bounce buffer
;
copy16k:
ld a,d ; soure bank
- out (250),a
+ out (LOMEM),a
ld a,e
ld hl,#0x0000
ld de,#0xC000 ; buffer via bank 7
ld bc,#0x4000
ldir
- out (250),a ; dest bank
+ out (LOMEM),a ; dest bank
ld hl,#0xC000
ld de,#0x0000
ld bc,#0x4000
s__INITIALIZED, s__INITIALIZER, s__COMMONMEM, s__VIDEO, l__INITIALIZED,
l__GSFINAL, l__GSINIT, l__COMMONMEM, s__FONT, l__FONT, s__DISCARD,
l__DISCARD, l__CODE, l__CODE2, l__VIDEO, l__DATA, s__CONST, l__CONST,
- s__HEAP, l__HEAP;
+ s__HEAP, l__HEAP, s__PAGE0 = 0xFFFF;
static void ProcessMap(FILE * fp)
sscanf(p1, "%x", &s__HEAP);
if (strcmp(p2, "l__HEAP") == 0)
sscanf(p1, "%x", &l__HEAP);
+ if (strcmp(p2, "s__PAGE0") == 0)
+ sscanf(p1, "%x", &s__PAGE0);
}
}
/* Our standard layout begins with the code */
start = s__CODE;
+ /* But for some cases we have a 0 page we need to keep */
+ if (s__PAGE0 != 0xFFFF)
+ start = 0;
/* TODO: Support a proper discardable high discard in other mappings */