clean:
rm -f $(OBJS) *.lst *.asm *.sym *.rst *.rel core *~
- rm -f FUZIX FUZIX.BIN load-esx.ihx load-esx.tmp
-
+ rm -f load-fat.ihx load-fat.tmp load-hd.ihx load-hd.tmp
+ rm -f load-fat load-hd
image:
- # Build an esxdos friendly setup
- sdasz80 -o load-esx.s
- sdldz80 -i load-esx.rel
- makebin -s 8704 load-esx.ihx load-esx.tmp
+ sdasz80 -o load-hd.s
+ sdldz80 -i load-hd.rel
+ makebin -s 25088 load-hd.ihx load-hd.tmp
# Generate the image file we need
- dd if=load-esx.tmp of=FUZIX bs=8192 skip=1
+ # 512 bytes at 24576
+ dd if=load-hd.tmp of=load-hd bs=512 skip=48
+ sdasz80 -o load-fat.s
+ sdldz80 -i load-fat.rel
+ makebin -s 25088 load-fat.ihx load-fat.tmp
+ # Generate the image file we need
+ # 512 bytes at 24576
+ dd if=load-fat.tmp of=load-fat bs=512 skip=48
dd if=/dev/zero bs=256 count=1 >FUZIX.BIN
cat ../fuzix.bin >>FUZIX.BIN
;
; startup code. Runs from 0x100. The kernel is mapped into pages
- ; 16-23 and 16-22 are currently mapped. Stack is not valid on entry
- ; and interrupts are off.
+ ; 0/1/2/3 but 0 / 5 / 2 / 3 are currently mapped. Stack is not
+ ; necessarily valid on entry, shadow mode is on and interrupts are
+ ; off.
;
.area _CODE
.globl _start
_start:
- ; Map in the top page (it couldn't be mapped by the loader as the
- ; loader is living in it)
- ld a,#0x57 ; MMU E000-FFFF
- ld bc,#0x243B
+ ; Map in the other 16K
out (c),a
- ld a,#23 ; Top kernel page
- inc b
+
+ ; Black border so we know we arrived
+ xor a
out (c),a
; We need to wipe the BSS but the rest of the job is done.
-
ld hl, #s__DATA
ld de, #s__DATA+1
ld bc, #l__DATA-1
* 16x50 conversion betwen a Bxxxx speed rate (see tty.h) and the values
* to stuff into the chip.
*
- * FIXME: update for this board
+ * The equation for this board is
+ * 115200 /((DLM*256) + DLL)
+ *
+ * Two extensions exist which we ignore
+ * DLM bit 7 selects native clocking ((11059200)/16/baud)
+ * DLM 0 DLL 0 = 256Kbit
*/
static uint16_t clocks[] = {
12, /* Not a real rate */
--- /dev/null
+;
+; Load the kernel from sectors 3+ of the media
+;
+
+ .area _BOOT(ABS)
+
+ .org 0x5FEF ; 17 lead bytes
+
+header:
+ .db 'F','U','Z','I','X', 0, 0, 0 ; name
+ .db 'C' ; code type
+ .db 0x00, 0x60 ; load
+ .dw 0x0200 ; size
+ .dw 0x0002 ; in sectors
+ .dw 0x3FA6 ; checksum
+
+ ; Code at 0x6000 as with a direct HD load
+
+ .include "load-hd.s"
--- /dev/null
+;
+; Load the kernel from sectors 3+ of the media
+;
+
+ .area _BOOT(ABS)
+
+ .org 0x6000
+
+start:
+ di
+ ld sp,#0x6000
+
+ ; Wipe the video memory so we have something to show we live
+ ld hl,#0x4000
+ ld de,#0x4001
+ ld bc,#0x1800
+ ld (hl),#0
+ ldir
+ ld bc,#0x2ff
+ ld (hl),#7
+ ldir
+ ld a,#7
+ out (0xFE),a
+ ; Shadow on
+ ld bc,#0xBF
+ ld a,#1
+ out (c),a
+
+ ; Set the MMU up so that our code is MMU mapped to match the
+ ; direct mapping
+ ld bc,#0x77f7
+ ld a,#0x5
+ cpl
+ out (c),a
+
+ ld bc,#0xF177 ; ROM defaults, with MMU on
+ ld a,#0x03 ; spectrum, no turbo
+ out (c),a
+
+
+ ; Kernel lives in 0 / 1 / 2 / 3
+
+ ld e, #3 ; sector
+ xor a
+ call load_bank
+ ld a,#1
+ call load_bank
+ ld a,#2
+ call load_bank
+ ld a,#3
+ call load_bank
+
+ ; Now put the MMU right
+ ld bc,#0x37f7
+ ld a,#0xff
+ out (c),a
+; ld b,#0x77 ; Skip setting this page because
+ dec a ; we are running in it
+; out (c),a
+ ld b,#0xC7
+ dec a
+ out (c),a
+ ld b,#0xF7
+ dec a
+ out (c),a
+ ; And go (we can't map everything yet but the code at 0x0100 will do
+ ; the final mapping). Note we enter with shadow on (for the final
+ ; MMU call)
+ ld b,#0x77
+ ld a,#1
+ out (0xfe),a
+ ld a,#0xfe
+ jp 0x0100
+
+;
+; Load bank A
+;
+load_bank:
+ ld bc,#0xf7f7
+ cpl
+ out (c),a
+ ld b,#32
+ ld hl,#0xC000
+load_bank_loop:
+ call sector
+ djnz load_bank_loop
+ ret
+
+sector:
+ ld a,e
+ inc e
+ out (0x70), a
+ ld a,#1
+ out (0x50), a
+ ld a,#0x20
+ out (0xF0), a
+ nop
+ nop
+w0:
+ in a,(0xF0)
+ rla
+ jr c, w0
+ and #0x10 ; DRQ shifted
+ jr nc, w0
+
+ ld bc,#0x10
+ inir
+ inir
+w1:
+ in a,(0xF0)
+ rla
+ jr c, w1
+ rla
+ jr nc, w1
+
+ ret
_platform_monitor:
;
; Not so much a monitor as wait for space
+ ; (or should we jump into the profi rom ?)
;
ld a, #0x7F
in a, (0xFE)
_platform_reboot:
di
- ; FIXME: put back 48K ROM
+ ; FIXME: put back boot ROM and all the rest
rst 0 ; back into our booter
platform_interrupt_all:
; set system RAM size
ld hl, #4096
ld (_ramsize), hl
- ld hl, #512 ; FIXME: TBD
+ ld hl, #720 ; FIXME: TBD (15 * 48K for now)
ld (_procmem), hl
; Set up video etc
ld a,#0x01
out (0xBF),a ; Shadow on
- ld bc,#0x0177 ; MMU on, hold off, res off
+ ld bc,#0xFF77 ; MMU on, hold off, res off
ld a,#0x0F ; 14MHz, 80x25 text mode
out (c),a
- ld bc,#0xFFBF
- ld a,#0x00 ; FIXME: correct value
- out (c),a ; Video and turbo set
-
xor a
- out (c),a ; Shadow back off
-
- ; EFE7 is shadow off !
- ld bc,#0xEFE7
-
- ld a,#0x80 ; turbo, pentagon, video 80x25
- ; no RAM0 override
- out (c),a
-
+ out (0xBF),a ; Shadow back off
; screen initialization
call _vtinit