-
CSRCS = devtty.c
CSRCS += devices.c main.c
+CSRCS2 = bankzx128.c
+
ASRCS = crt0.s zx128.s zxvideo.s
ASRCS += tricks.s commonmem.s
COBJS = $(CSRCS:.c=.rel)
+COBJS2 = $(CSRCS2:.c=.rel)
AOBJS = $(ASRCS:.s=.rel)
-OBJS = $(COBJS) $(AOBJS)
+OBJS = $(COBJS) $(COBJS2) $(AOBJS)
JUNK = $(CSRCS:.c=.lst) $(CSRCS:.c=.asm) $(CSRCS:.c=.sym) $(ASRCS:.s=.lst) $(ASRCS:.s=.sym) $(CSRCS:.c=.rst) $(ASRCS:.s=.rst)
$(COBJS): %.rel: %.c
$(CROSS_CC) $(CROSS_CCOPTS) -c $<
+$(COBJS2): %.rel: %.c
+ $(CROSS_CC) $(CROSS_CCOPTS) $(CROSS_CC_SEG2) -c $<
+
$(AOBJS): %.rel: %.s
$(CROSS_AS) $(ASOPTS) $<
--- /dev/null
+#include <kernel.h>
+#include <timer.h>
+#include <kdata.h>
+#include <printf.h>
+
+/* This is copied version of bankfixed.c
+ The only difference is pagemap_realloc function.
+ Since we have PROGBASE at 0xC000, pagemap_realloc
+ returned ENOMEM even when 0 bytes were requested */
+
+/* Kernel is 0, apps 1,2,3 etc */
+static unsigned char pfree[MAX_MAPS];
+static unsigned char pfptr = 0;
+static unsigned char pfmax;
+
+void pagemap_add(uint8_t page)
+{
+ pfree[pfptr++] = page;
+ pfmax = pfptr;
+}
+
+void pagemap_free(ptptr p)
+{
+ if (p->p_page == 0)
+ panic("free0");
+ pfree[pfptr++] = p->p_page;
+}
+
+int pagemap_alloc(ptptr p)
+{
+#ifdef SWAP_DEV
+ if (pfptr == 0) {
+ swapneeded(p, 1);
+ }
+#endif
+ if (pfptr == 0)
+ return ENOMEM;
+ p->p_page = pfree[--pfptr];
+ return 0;
+}
+
+/* Realloc is trivial - we can't do anything useful */
+int pagemap_realloc(uint16_t size)
+{
+ if (size - PROGBASE >= MAP_SIZE)
+ return ENOMEM;
+ return 0;
+}
+
+uint16_t pagemap_mem_used(void)
+{
+ return (pfmax - pfptr) * (MAP_SIZE >> 10);
+}
#define CONFIG_FONT8X8
#define CONFIG_FONT8X8SMALL
-/* We have 1 bank at C000 with 6 possible pages to map, but I'm not sure
- if CONFIG_BANK_FIXED is our choice. */
+/* We have 1 bank at C000 with 6 possible pages to map.
+ Our choise should be CONFIG_BANK_FIXED, but we are.
+ using custom implementation of it */
+
+#undef CONFIG_BANK_FIXED
-/* Fixed banking */
-#define CONFIG_BANK_FIXED
/* 6 16K banks, 1 is for kernel needs */
#define MAX_MAPS 5
#define MAP_SIZE 0x4000U
platform-zx128/zx128.rel
platform-zx128/zxvideo.rel
platform-zx128/main.rel
-platform-zx128/devfd.rel
start.rel
version.rel
lowlevel-z80.rel
vt.rel
font8x8.rel
mm.rel
-bankfixed.rel
+platform-zx128/bankzx128.rel
swap.rel
devsys.rel
platform-zx128/devtty.rel