LIBC=$(LIBPATH)/libc8080.a $(ACK_ROOT)/share/ack/cpm/libem.a
CSRCS += devices.c main.c devtty.c msm5832.c devrd.c
+DISCARD_CSRCS = discard.c
-DISCARD_DSRCS = ../dev/devide_discard.c
-DSRCS = ../dev/devide.c ../dev/mbr.c ../dev/blkdev.c ../dev/devfdc765.c
+DISCARD_DSRCS = ../dev/devide_discard.c ../dev/mbr.c
+DSRCS = ../dev/devide.c ../dev/blkdev.c ../dev/devfdc765.c
CROSS_CCOPTS += -I../dev/
AOBJS = $(ASRCS:.s=.o)
COBJS = $(CSRCS:.c=.o)
+DISCARD_COBJS = $(DISCARD_CSRCS:.c=.o)
DISCARD_DOBJS = $(patsubst ../dev/%.c,%.o, $(DISCARD_DSRCS))
DOBJS = $(patsubst ../dev/%.c,%.o, $(DSRCS))
-OBJS = $(AOBJS) $(COBJS) $(DISCARD_DOBJS) $(DOBJS)
+OBJS = $(AOBJS) $(COBJS) $(DISCARD_COBJS) $(DISCARD_DOBJS) $(DOBJS)
JUNK = *.o *.lst *.asm *.sym *.rst
$(COBJS): %.o: %.c
$(CROSS_CC) $(CROSS_CCOPTS) $<
+$(DISCARD_COBJS): %.o: %.c
+ $(CROSS_CC) -Ras=../tools/discard85 $(CROSS_CCOPTS) $<
+
$(DOBJS): %.o: ../dev/%.c
$(CROSS_CC) $(CROSS_CCOPTS) $<
# Need to make discard work yet
$(DISCARD_DOBJS): %.o: ../dev/%.c
- $(CROSS_CC) $(CROSS_CCOPTS) $<
+ $(CROSS_CC) -t -Ras=../tools/discard85 $(CROSS_CCOPTS) $<
tricks.s: ../lib/8080fixedbank.s ../lib/8080fixedbank-core.s
rm -f $(OBJS) $(JUNK) core *~ bootblock.bin bootblock
image:
- $(CROSS_LD) -b0:0x0100 -b4:0xE800 -o fuzix.bin crt0.o devices.o main.o \
- commonmem.o tricks.o v85.o devtty.o \
+ $(CROSS_LD) -b0:0x0100 -b4:0xE800 -b5:0xD800 -o fuzix.bin crt0.o devices.o main.o \
+ discard.o commonmem.o tricks.o v85.o devtty.o \
../start.o ../version.o ../lowlevel-8085.o \
../bankfixed.o ../timer.o ../kdata.o \
../devio.o ../filesys.o ../process.o ../inode.o ../syscall_fs.o \
bssstart:
.sect .common
commonstart:
+.sect .discard
+discardstart:
.sect .text
call init_early
+ ! Common is packed in the BSS space
lxi h,commonend
lxi d,commonstart
lxi h,bssstart
lxi d,commonstart
-
+
+ ! Copy it high
nextbyte:
mov a,m
stax d
ora c
jnz nextbyte
+ ! The discard follows the common
+
+ push h
+
+ lxi h,discardend
+ lxi d,discardstart
+ call calcsize
+
+ pop h
+ dad b
+ dcx h
+ xchg
+ dad b
+ dcx h
+ xchg
+
+!
+! We copy discard from the top because it will probably overlap
+! on an 8080/8085 type system due to the larger code sizes.
+!
+nextbyted:
+ mov a,m
+ stax d
+ dcx h
+ dcx d
+ dcx b
+ mov a,b
+ ora c
+ jnz nextbyted
+
! lxi h,bssend ! We should really do this but bssend
! isnt appearing at the end so plan b
- lxi h,commonstart ! Wipe all the free space
+ lxi h,discardstart ! Wipe all the free space
lxi d,bssstart
call calcsize
--- /dev/null
+#include <kernel.h>
+#include <timer.h>
+#include <kdata.h>
+#include <printf.h>
+#include <devtty.h>
+#include <blkdev.h>
+#include <devfdc765.h>
+
+void pagemap_init(void)
+{
+ uint8_t i;
+ uint8_t m = 2;
+
+ for (i = 1; i < 8; i++) {
+ if (probe_bank(m) == 0) {
+ pagemap_add(m);
+ ramsize += 48;
+ procmem += 48;
+ }
+ m <<= 1;
+ }
+ if (procmem < 96)
+ panic("insufficient memory");
+}
+
+/* Nothing to do for the map of init */
+void map_init(void)
+{
+}
+
+uint8_t platform_param(char *p)
+{
+ used(p);
+ return 0;
+}
+
+/*
+ * This function is called for partitioned devices if a partition is found
+ * and marked as swap type. The first one found will be used as swap. We
+ * only support one swap device.
+ */
+void platform_swap_found(uint8_t letter, uint8_t m)
+{
+ blkdev_t *blk = blk_op.blkdev;
+ uint16_t n;
+ if (swap_dev != 0xFFFF)
+ return;
+ letter -= 'a';
+ kputs("(swap) ");
+ swap_dev = letter << 4 | m;
+
+ if (blk->lba_count[m - 1] > 0xFFFF)
+ n = 0xFFFF;
+ else
+ n = (uint16_t)blk->lba_count[m-1];
+ n /= SWAP_SIZE;
+ if (n > MAX_SWAPS)
+ n = MAX_SWAPS;
+#ifdef SWAPDEV
+ while (n)
+ swapmap_init(n--);
+#endif
+}
+
.define bssend
bssend:
+
+.sect .discard
+.define discardend
+
+discardend:
extern uint16_t probe_bank(uint16_t);
-void pagemap_init(void)
-{
- uint8_t i;
- uint8_t m = 2;
-
- for (i = 1; i < 8; i++) {
- if (probe_bank(m) == 0) {
- pagemap_add(m);
- ramsize += 48;
- procmem += 48;
- }
- m <<= 1;
- }
- if (procmem < 96)
- panic("insufficient memory");
-}
/* On idle we spin checking for the terminals. Gives us more responsiveness
for the polled ports */
devfd_spindown();
}
-/* Nothing to do for the map of init */
-void map_init(void)
-{
-}
-
-uint8_t platform_param(char *p)
-{
- used(p);
- return 0;
-}
-
-/*
- * This function is called for partitioned devices if a partition is found
- * and marked as swap type. The first one found will be used as swap. We
- * only support one swap device.
- */
-void platform_swap_found(uint8_t letter, uint8_t m)
-{
- blkdev_t *blk = blk_op.blkdev;
- uint16_t n;
- if (swap_dev != 0xFFFF)
- return;
- letter -= 'a';
- kputs("(swap) ");
- swap_dev = letter << 4 | m;
-
- if (blk->lba_count[m - 1] > 0xFFFF)
- n = 0xFFFF;
- else
- n = (uint16_t)blk->lba_count[m-1];
- n /= SWAP_SIZE;
- if (n > MAX_SWAPS)
- n = MAX_SWAPS;
-#ifdef SWAPDEV
- while (n)
- swapmap_init(n--);
-#endif
-}
-