image:
$(CROSS_LD) -o ../fuzix.bin -Map=../fuzix.map --script=fuzix.link \
--oformat=decb \
- crt0.o bootstrap_sdc.o commonmem.o coco2.o discard.o ../simple.o \
+ crt0.o bootstrap.o commonmem.o coco2.o discard.o ../simple.o \
../start.o ../version.o ../lowlevel-6809.o \
tricks.o main.o ../timer.o ../kdata.o devices.o \
drivewire.o devdw.o mini_ide.o mini_ide_discard.o ide.o \
dd if=fuzix.img of=fuzix.rom bs=1024 skip=48 count=16
dd if=fuzix.img of=fuzix.ide bs=256 skip=26 count=102
dd if=fuzix.img of=fuzix.ide bs=256 skip=1 count=1 conv=notrunc
+
+ $(CROSS_LD) -o ../fuzix-sdc.bin -Map=../fuzix-sdc.map --script=fuzix.link \
+ --oformat=decb \
+ crt0.o bootstrap_sdc.o commonmem.o coco2.o discard.o ../simple.o \
+ ../start.o ../version.o ../lowlevel-6809.o \
+ tricks.o main.o ../timer.o ../kdata.o devices.o \
+ drivewire.o devdw.o mini_ide.o mini_ide_discard.o ide.o \
+ ../devio.o ../filesys.o ../process.o ../inode.o ../syscall_fs.o \
+ ../syscall_proc.o ../syscall_other.o ../mm.o ../swap.o \
+ ../tty.o ../devsys.o ../usermem.o usermem.o ../syscall_fs2.o \
+ ../syscall_exec16.o devtty.o libc.o ../vt.o video.o ../syscall_fs3.o \
+ ../font8x8.o devsdc.o sdc.o
+ ../tools/decb-image <../fuzix-sdc.bin fuzix-sdc.img
+ dd if=fuzix-sdc.img of=fuzixsdc.rom bs=1024 skip=48 count=16
+ dd if=fuzix-sdc.img of=fuzix.sdc bs=256 skip=26 count=102
+ dd if=fuzix-sdc.img of=fuzix.sdc bs=256 skip=1 count=1 conv=notrunc
COCO2
=====
-(Work in progress)
-
COCO or Dragon 64 with an IDE port, cartridge and 64K of RAM
Supported hardware:
IDE (Cloud9 or compatible set at FF50) with either built in
cartridge RAM or separate cartridge
- COCO SDC (in progress)
+ COCO SDC
Disk Layout
===========
Emulating in XRoar
==================
-Needs the IDE patches
+Needs the IDE patches, no support for COCOSDC emulation in xroar as of 0.33.2
TODO
====
Make the boot loader robust (timeout handling)
Add hash of code not just simple magic - so we know bits match
-Merge coco and IDE boot code so it works out which is present
Support for a real time clock and clock locking
enough to add support for very minimal MBR parsing and offsets. That would
be a big improvement.
-Automatically pick swap according to whether IDE or SDC is present.
-
-
To Test
=======
In the xroar directory where you have a hard disc image do
-dd if=/tmp/fuzix.ide of=hd0.img bs=512 seek=3 conv=notrunc
-/opt/xroaride/bin/xroar -default-machine dragon64 -cart ide -cart-rom fuzix.rom
+dd if=platform/fuzix.ide of=hd0.img bs=512 seek=3 conv=notrunc
+/opt/xroaride/bin/xroar -default-machine dragon64 -cart ide -cart-rom platform/fuzix.rom
exec 49152
+A 32MB filesystem can be put in slice 1 using dd with an offset of 32MB + 2
+sectors.
+
+For the CocoSDC the same procedure applies (without an emulator however) but
+using the fuzixsdc rom and SD image.
+
enjoy
/*
-
- CoCoSDC driver
- (c)2015 Brett M. Gordon GPL2
-
+ * CoCoSDC driver
+ * (c)2015 Brett M. Gordon GPL2
+ *
* Needs work on extended SDC API stuff.
* init / mounting stuff really needs to set/update blkdev structure for size
- * need to get rawmode=1 and 2 working.
-
-*/
+ *
+ * Only supports simple memory models.
+ */
#include <kernel.h>
#include <kdata.h>
#define sdc_reg_param2 *((volatile uint8_t *)SDC_REG_PARAM2)
#define sdc_reg_param3 *((volatile uint8_t *)SDC_REG_PARAM3)
+static uint8_t sdc_present;
/* Assembler glue */
/* blkdev method: transfer sectors */
static uint8_t sdc_transfer(uint8_t minor, bool is_read, uint8_t rawflag)
{
- uint8_t nb = udata.u_nblock; /* our return value, preset to failure */
+ uint8_t nb = 0;
uint32_t lba; /* holds 32 bit lsn */
- uint8_t *ptr = ((uint8_t *)&lba)+1; /* points to 24 bit lba in blk op */
+ uint8_t *ptr = ((uint8_t *)&lba) + 1; /* points to 24 bit lba in blk op */
uint8_t t; /* temporarory sdc status holder */
uint8_t cmd; /* holds SDC command value */
sdc_transfer_function_t fptr; /* holds which xfer routine we want */
- if (rawflag == 1 && d_blkoff(9) )
+ if (rawflag == 1 && d_blkoff(9))
return -1;
/* pass rawflag to assembler */
ptr[0] |= (minor & 0x7f) << 1;
/* setup cmd pointer and command value from blk_op */
- if( is_read ){
+ if (is_read) {
cmd = 0x80;
fptr = sdc_read_data;
- }
- else{
+ } else {
cmd = 0xa0;
fptr = sdc_write_data;
}
- /* apply our drive value 0 or 1*/
- if( minor & 0x80 )
+ /* apply our drive value 0 or 1 */
+ if (minor & 0x80)
cmd++;
- while(udata.u_nblock--){
+ while (udata.u_nblock--) {
/* load up registers */
sdc_reg_param1 = ptr[0];
sdc_reg_param2 = ptr[1];
asm("\texg x,x\n"); /* delay 16us minimum */
asm("\texg x,x\n");
/* wait till SDC is ready */
- do{
+ do {
t=sdc_reg_stat;
- if( t & SDC_FAIL ) goto fail;
- } while( ! (t & SDC_READY) );
+ if (t & SDC_FAIL)
+ goto fail;
+ } while(!(t & SDC_READY));
/* do our low-level xfer function */
- fptr( udata.u_dptr );
+ fptr(udata.u_dptr);
/* and wait will ready again, and test for failure */
- do{
+ do {
t=sdc_reg_stat;
- if( t & SDC_FAIL ) goto fail;
- }while ( t & SDC_BUSY );
+ if( t & SDC_FAIL )
+ goto fail;
+ } while (t & SDC_BUSY);
/* increment our blk_op values for next 256 bytes sector */
udata.u_dptr += 256;
lba++;
+ nb++;
}
/* Huzzah! success! */
- return nb;
+ return nb << 9;
/* Boo! failure */
fail: sdc_reg_ctl = 0x00;
udata.u_error = EIO;
return sdc_transfer(minor, false, rawflag);
}
-
-
-
+int sdc_open(uint8_t minor, uint16_t flag)
+{
+ if (!sdc_present) {
+ udata.u_error = ENODEV;
+ return -1;
+ }
+ return 0;
+}
__attribute__((section(".discard")))
/* Returns true if SDC hardware seems to exist */
-bool devsdc_exist()
+
+bool devsdc_exist(void)
{
uint8_t t;
- sdc_reg_data=0x64;
- t=sdc_reg_fctl;
- sdc_reg_data=0x00;
- if( (sdc_reg_fctl ^ t) == 0x60 ) return -1;
+ sdc_reg_data = 0x64;
+ t = sdc_reg_fctl;
+ sdc_reg_data = 0x00;
+ if ((sdc_reg_fctl ^ t) == 0x60)
+ return -1;
else return 0;
}
__attribute__((section(".discard")))
/* Call this to initialize SDC/blkdev interface */
-void devsdc_init()
+void devsdc_init(void)
{
kputs("SDC: ");
- if( devsdc_exist() ){
+ if (devsdc_exist()) {
/* turn on uber-secret SDC LBA mode*/
sdc_reg_ctl = 0x43;
+ sdc_present = 1;
kputs("Ok.\n");
}
- else kprintf("Not Found.\n");
+ else kprintf("Not found.\n");
}