# Re-order the image and snapshop it
image:
+ # Merge the first code bank into common
+ dd if=../bank1.bin bs=16384 skip=3 seek=3 count=1 \
+ of=../common.bin conv=notrunc
# The bootstrap to con Fatware
dd if=../common.bin of=BOOT.BIN bs=8192 count=1
# Rest of the base image, starts at 0x2200, pad it
4000-7FFF Kernel data continued (lots of space)
-8000-BFFF _DISCARD area - blown away when we exec init
+8000-83FF Needed to create the exec of init
+8400-BFFF _DISCARD area - blown away when we exec init
+ (tons of room in this space)
C000-FFFF
0: Kernel CODE (fairly full)
To Do:
-- Get the DivIDE interface working
-- Review DivIDE writes - is the port aliasing safe with a full
- otir or do we need to avoid port aliasing ?
- Check the swap hooks are ok
-- See what we can get below 0x2000
+- Turn on swap so we can make progress
- Set video space in CODE3 bank to 0 not 0xFF for neatness
- Look at what is needed for other suitable interfaces. DIVMMC would
in particular be good to support but that means another harder
Could we jump up and down on it enough to get user to be a bit bigger than 32K
and if so where and how do we handle the extra
+
+
+DONE - Get the DivIDE interface working
+DONE - See what we can get below 0x2000
+DONE - Review DivIDE writes - is the port aliasing safe with a full
+ otir or do we need to avoid port aliasing ? - safe
+DONE - Crash when we fork() or switch ?
-#define CONFIG_LEVEL_0
-
#define CONFIG_IDE
#define CONFIG_SD
#define SD_DRIVE_COUNT 1 /* For the moment */
#define TICKSPERSEC 50 /* Ticks per second */
#define PROGBASE 0x8000 /* also data base */
#define PROGLOAD 0x8000 /* also data base */
-#define PROGTOP 0xFC00 /* Top of program, base of U_DATA copy */
+#define PROGTOP 0xFE00 /* Top of program, base of U_DATA copy */
#define PROC_SIZE 32 /* Memory needed per process */
#define BOOT_TTY (513) /* Set this to default device for stdio, stderr */
;
; Our common lives low
;
+ .area _CODE
.area _COMMONMEM
.area _STUBS
.area _CONST
;
; All our code is banked at 0xC000
;
- .area _CODE
+ .area _CODE1
.area _CODE2
;
; Code3 sits above the display area along with the font and video
; the kernel image for us from blocks 1+ and all is good.
;
- .area _CODE
+ .area _CODE1
.globl _go
; Boot marker at 0x2200
- .area _COMMONMEM
+ .area _COMMONDATA
.globl _marker
_marker:
.byte 'Z' ; marker
-mwxuy
-r
-i fuzix.ihx
--b _COMMONMEM=0x2200
--b _CODE=0xC000
+-b _CODE=0x0200
+-b _COMMONMEM=0x400
+-b _COMMONDATA=0x2200
+-b _CODE1=0xC000
-b _CODE2=0xC000
-b _CODE3=0xDB00
--b _DISCARD=0x8000
+-b _DISCARD=0x8400
-b BOOT1FEC=0x1FEC
-b BOOT1FF7=0x1FF7
-b BOOT1FFE=0x1FFE
; UZI mnemonics for memory addresses etc
-; FIXME: THIS IS WRONG - NEED TO SORT OUT MAPPINGS AND DEAL WITH THIS
-U_DATA .equ 0x4000 ; (this is struct u_data from kernel.h)
-U_DATA__TOTALSIZE .equ 0x300 ; 256+256+256 bytes.
+; We stick it straight after the tag
+U_DATA .equ 0x2204 ; (this is struct u_data from kernel.h)
+U_DATA__TOTALSIZE .equ 0x200 ; 256+256+256 bytes.
-U_DATA_STASH .equ 0xFC00 ; FC00-FEFF
+U_DATA_STASH .equ 0xFE00 ; FE00-FFFF
Z80_TYPE .equ 1
timer_interrupt();
}
-size_t strlcpy(char *dst, const char *src, size_t dstsize)
+/*
+ * So that we don't suck in a library routine we can't use from
+ * the runtime
+ */
+
+int strlen(const char *p)
{
- size_t len = strlen(src);
- size_t cp = len >= dstsize ? dstsize - 1 : len;
- memcpy(dst, src, cp);
- dst[cp] = 0;
+ int len = 0;
+ while(*p++)
+ len++;
return len;
}
export BANKED=-banked
#
export CROSS_CC_SEG1=--codeseg CODE2
-export CROSS_CC_SEG3=--codeseg CODE
-export CROSS_CC_SYS1=--codeseg CODE
-export CROSS_CC_SYS2=--codeseg CODE
-export CROSS_CC_SYS3=--codeseg CODE
-export CROSS_CC_SYS4=--codeseg CODE
+export CROSS_CC_SEG3=--codeseg CODE1
+export CROSS_CC_SEG4=--codeseg CODE1
+export CROSS_CC_SYS1=--codeseg CODE1
+export CROSS_CC_SYS2=--codeseg CODE1
+export CROSS_CC_SYS3=--codeseg CODE1
+export CROSS_CC_SYS4=--codeseg CODE3
export CROSS_CC_SYS5=--codeseg CODE3
# The banking default is to put fonts in bank3. We don't want this so build
# our font as CONST so it lands where we want it
out (c), a
ret
-fork_proc_ptr: .dw 0 ; (C type is struct p_tab *) -- address of child process p_tab entry
;
; Called from _fork. We are in a syscall, the uarea is live as the
;
bankfork:
or #0x18 ; ROM bits for the bank
- ld b, #0x3C ; 40 x 256 minus 4 sets for the uarea stash/irqs
+ ld b, #0x3E ; 64 x 256 minus 2 sets for the uarea stash/irqs
ld hl, #0xC000 ; base of memory to fork (vectors included)
bankfork_1:
push bc ; Save our counter and also child offset
_low_bank:
.dw _ptab ; Init starts owning this
+fork_proc_ptr:
+ .dw 0 ; (C type is struct p_tab *) -- address of child process p_tab entry
; -----------------------------------------------------------------------------
; KERNEL MEMORY BANK (above 0xC000, only accessible when the kernel is mapped)
; -----------------------------------------------------------------------------
- .area _CODE
+ .area _CODE1
;
; The memory banker will deal with the map setting