From d0a805c6a00c8ac8b83293cc188587b96737f024 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Thu, 6 Nov 2014 21:38:39 +0000 Subject: [PATCH] msx: Add initial (non working) bootrom test, also make it build fuzix.com --- Kernel/platform-msx2/Makefile | 4 +- Kernel/platform-msx2/bootrom.s | 94 ++++++++++++++++++++++++++++++++++ Kernel/platform-msx2/crt0.s | 1 + Kernel/platform-msx2/uzi.lnk | 3 +- 4 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 Kernel/platform-msx2/bootrom.s diff --git a/Kernel/platform-msx2/Makefile b/Kernel/platform-msx2/Makefile index eb8c11b2..9c53bd43 100644 --- a/Kernel/platform-msx2/Makefile +++ b/Kernel/platform-msx2/Makefile @@ -3,7 +3,7 @@ CSRCS = devtty.c devfd.c devhd.c devlpr.c CSRCS += devices.c main.c ASRCS = msx2.s crt0.s vdp.s -ASRCS += tricks.s commonmem.s +ASRCS += tricks.s commonmem.s bootrom.s COBJS = $(CSRCS:.c=.rel) AOBJS = $(ASRCS:.s=.rel) @@ -23,3 +23,5 @@ clean: rm -f $(OBJS) $(JUNK) core *~ image: + dd if=../fuzix.bin of=../fuzix.com bs=256 skip=1 + dd if=../fuzix.bin of=../fuzix.cart bs=16384 conv=sync diff --git a/Kernel/platform-msx2/bootrom.s b/Kernel/platform-msx2/bootrom.s new file mode 100644 index 00000000..4a1d76ce --- /dev/null +++ b/Kernel/platform-msx2/bootrom.s @@ -0,0 +1,94 @@ + .area _CODE + + .db 'A' + .db 'B' + .dw wtfami + 0x4000 + .dw 0,0,0,0,0,0 + +; +; Entered at 0x4000 but linked at 0x0000 so be careful +; +wtfami: di + + ld a, #0x23 ; Debug port + out (0x2e), a + ld a, #':' + out (0x2f), a + + in a, (0xA8) + ld d, a + and #0x0C ; bits for 0x4000 + ld b, a + rla + rla ; to 0x8000 + or b ; and 0x4000 + rla + rla ; to 0xC000/8000 + or b ; and 0x4000 + ld b, a ; B is now the bits for + ; putting 48K of cartridge + ; in place + out (0xA8), a ; Map cartridge + ld a, #3 + out (0xFC), a ; Begin mapping RAM + ld a, #'1' + out (0x2f), a + exx + ld hl, #0x4000 ; Cartridge 0x4000 -> RAM 0 + ld de, #0x0 + ld bc, #0x4000 + ldir + dec a + out (0xFC), a + ld de, #0 ; 0x8000 -> RAM 0x4000 + ld bc, #0x4000 + ldir + dec a + out (0xFC), a + ld de, #0 ; 0xC000 -> RAM 0x8000 + ld bc, #0x4000 + ldir + exx + ld a, #3 ; put the maps right + out (0xFC), a + ld a, #2 + out (0xFD), a + ld a, #1 + out (0xFE), a + xor a + out (0xFF), a + ld a, #'G' + out (0x2f), a + ld a, d + and #0xC0 ; RAM in 0xC000 slot bits + ld e, a + rra ; Propogate into other banks + rra + or e + rra + rra + or e + rra + rra + or e + ld e, a ; E is now "all RAM" + and #0xF3 + ld c, a + ld a, d ; Get original status + and #0x0c ; bits for 0x4000 as cartridge + or c ; bits for the RAM + out (0xA8), a + ld a, #'O' + out (0x2f), a + ; + ; We now have RAM where we need it + ; + jp ramgo +ramgo: ld a, #'!' + out (0x2f), a + ld a, e + out (0xA8), a ; Now go all ram + jp 0x100 + + ; Hack Hack FIXME + .ds 0x73 diff --git a/Kernel/platform-msx2/crt0.s b/Kernel/platform-msx2/crt0.s index fc95c4fe..1765f369 100644 --- a/Kernel/platform-msx2/crt0.s +++ b/Kernel/platform-msx2/crt0.s @@ -2,6 +2,7 @@ ; WRS: Note we list all our segments here, even though ; we don't use them all, because their ordering is set ; when they are first seen. + .area _BOOT .area _CODE .area _CODE2 .area _VIDEO diff --git a/Kernel/platform-msx2/uzi.lnk b/Kernel/platform-msx2/uzi.lnk index e9ffdd8f..d5c5a4f5 100644 --- a/Kernel/platform-msx2/uzi.lnk +++ b/Kernel/platform-msx2/uzi.lnk @@ -1,8 +1,9 @@ -mwxuy -i uzi.ihx --b _CODE=0x0100 +-b _CODE=0x0000 -b _COMMONMEM=0xF000 -l z80 +platform-msx2/bootrom.rel platform-msx2/crt0.rel platform-msx2/commonmem.rel platform-msx2/msx2.rel -- 2.34.1