msx: Add initial (non working) bootrom test, also make it build fuzix.com
authorAlan Cox <alan@etchedpixels.co.uk>
Thu, 6 Nov 2014 21:38:39 +0000 (21:38 +0000)
committerAlan Cox <alan@etchedpixels.co.uk>
Thu, 6 Nov 2014 21:38:39 +0000 (21:38 +0000)
Kernel/platform-msx2/Makefile
Kernel/platform-msx2/bootrom.s [new file with mode: 0644]
Kernel/platform-msx2/crt0.s
Kernel/platform-msx2/uzi.lnk

index eb8c11b..9c53bd4 100644 (file)
@@ -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 (file)
index 0000000..4a1d76c
--- /dev/null
@@ -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
index fc95c4f..1765f36 100644 (file)
@@ -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
index e9ffdd8..d5c5a4f 100644 (file)
@@ -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