diff --git a/Kernel/platform/platform-simple80/Makefile b/Kernel/platform/platform-simple80/Makefile index e05dd0191..e5a2fe16d 100644 --- a/Kernel/platform/platform-simple80/Makefile +++ b/Kernel/platform/platform-simple80/Makefile @@ -49,6 +49,23 @@ clean: rm -f $(OBJS) $(JUNK) core *~ loader.tmp loader.bin fuzix.com image: loader.bin + $(CROSS_LD) -b -C 0x0100 -S 0xF000 -f CLDBbXSs -o fuzix.bin \ + crt0.o commonmem.o simple80.o ../../start.o \ + ../../version.o ../../cpu-z80u/lowlevel-z80u-thunked.o \ + ../../usermem.o usermem.o tricks.o main.o discard.o \ + ../../timer.o ../../kdata.o devices.o ../../devio.o \ + ../../filesys.o ../../blk512.o ../../process.o \ + ../../inode.o ../../syscall_exec.o ../../syscall_exec16.o \ + ../../syscall_fs.o ../../syscall_fs2.o ../../syscall_fs3.o \ + ../../syscall_proc.o ../../syscall_other.o ../../syscall_net.o \ + ../../network.o ../../tty.o ../../mm.o ../../mm/memalloc_none.o \ + ../../swap.o ../../mm/simple.o ../../devsys.o \ + devtty.o ../../dev/tinydisk.o ../../dev/tinydisk_discard.o \ + ../../dev/tinyide.o ../../dev/tinyide_discard.o ide.o \ + ../../dev/ds1302_rcbusu.o ../../dev/ds1302.o ../../dev/ds1302_discard.o \ + /opt/ccz80/lib/libz80.a -m fuzix.tmpmap + perl -lpe '$$_=hex' fuzix.tmpmap | paste -d" " - fuzix.tmpmap | sort -n | cut -d" " -f 2- >../../fuzix.map + ../../tools/pack85 <../../fuzix.map fuzix.bin ../../fuzix.bin loader.bin: loader.S asz80 loader.S @@ -65,6 +82,6 @@ diskimage: image # Loader dd if=loader.bin of=$(IMAGES)/disk.img bs=512 seek=1 conv=notrunc # Add the kernel - dd if=../../fuzix.bin of=$(IMAGES)/disk.img bs=512 seek=2 conv=notrunc + dd if=../../fuzix.bin of=$(IMAGES)/disk.img bs=256 skip=1 seek=4 conv=notrunc # Make an emulator image of it cat $(FUZIX_ROOT)/Standalone/filesystem-src/idehdr.40M $(IMAGES)/disk.img > $(IMAGES)/emu-ide.img diff --git a/Kernel/platform/platform-simple80/ide.S b/Kernel/platform/platform-simple80/ide.S index 7648f5d8e..c82c56ffc 100644 --- a/Kernel/platform/platform-simple80/ide.S +++ b/Kernel/platform/platform-simple80/ide.S @@ -12,7 +12,6 @@ _devide_read_data: push hl push de push bc - ld bc, IDE_REG_DATA ; port and count ld a, (_td_raw) or a jr z, read_k @@ -22,12 +21,14 @@ _devide_read_data: ld a,(bits_to_user + 1) out (c),a read_k: - inir ; transfer first 256 bytes - inir ; transfer second 256 bytes + ld bc, IDE_REG_DATA ; port and count + inir ; transfer first 256 bytes + inir ; transfer second 256 bytes ld bc,(sio_reg) out (c),b ld a,(bits_to_user) out (c),a + pop bc ld a,(_int_disabled) or a ret z @@ -40,7 +41,6 @@ _devide_write_data: push hl push de push bc - ld bc, IDE_REG_DATA ; port and count ld a, (_td_raw) or a jr z, write_k @@ -50,12 +50,14 @@ _devide_write_data: ld a,(bits_to_user + 1) out (c),a write_k: - otir ; transfer first 256 bytes - otir ; transfer second 256 bytes + ld bc, IDE_REG_DATA ; port and count + otir ; transfer first 256 bytes + otir ; transfer second 256 bytes ld bc,(sio_reg) out (c),b ld a,(bits_to_user) out (c),a + pop bc ld a,(_int_disabled) or a ret z diff --git a/Kernel/platform/platform-simple80/ide.c b/Kernel/platform/platform-simple80/ide.c deleted file mode 100644 index 5a92425f4..000000000 --- a/Kernel/platform/platform-simple80/ide.c +++ /dev/null @@ -1,79 +0,0 @@ -#define _IDE_PRIVATE - -#include -#include -#include -#include -#include -#include -#include - -/* - * We need slightly custom transfer routines for the IDE controller - * as we have no common stack to use. - * - * As we only have one bank of user it's a bit simpler - */ - -COMMON_MEMORY - -#undef ei -#undef di - -void devide_read_data(void) __naked -{ - __asm - ld a, (_blk_op+BLKPARAM_IS_USER_OFFSET) ; blkparam.is_user - ld hl, (_blk_op+BLKPARAM_ADDR_OFFSET) ; blkparam.addr - ; and count - or a - jr z, via_kernel - di - ld bc,(sio_reg) - out (c),b - ld a,(bits_to_user + 1) - out (c),a -via_kernel: - ld bc, #IDE_REG_DATA ; setup port number - inir ; transfer first 256 bytes - inir ; transfer second 256 bytes - ld bc,(sio_reg) - out (c),b - ld a,(bits_to_user) - out (c),a - ld a,(_int_disabled) - or a - ret z - ei - ret - __endasm; -} - -void devide_write_data(void) __naked -{ - __asm - ld a, (_blk_op+BLKPARAM_IS_USER_OFFSET) ; blkparam.is_user - ld hl, (_blk_op+BLKPARAM_ADDR_OFFSET) ; blkparam.addr - ; and count - or a - jr z, wvia_kernel - di - ld bc,(sio_reg) - out (c),b - ld a,(bits_to_user + 1) - out (c),a -wvia_kernel: - ld bc, #IDE_REG_DATA ; setup port number - otir ; transfer first 256 bytes - otir ; transfer second 256 bytes - ld bc,(sio_reg) - out (c),b - ld a,(bits_to_user ) - out (c),a - ld a,(_int_disabled) - or a - ret z - ei - ret - __endasm; -} diff --git a/Kernel/platform/platform-simple80/simple80.S b/Kernel/platform/platform-simple80/simple80.S index 695ca53d1..0a81f0d9e 100644 --- a/Kernel/platform/platform-simple80/simple80.S +++ b/Kernel/platform/platform-simple80/simple80.S @@ -4,7 +4,6 @@ ; exported symbols .export init_hardware - .export interrupt_handler .export _program_vectors .export _kernel_flag .export map_page_low @@ -84,8 +83,8 @@ init_hardware: ld hl, 60 ; We lose 4K to common space ld (_procmem), hl - ld hl, s__COMMONMEM - ld de, l__COMMONMEM + ld hl, __common + ld de, __common_size ; Modified board drives the RAM A16 differently ld a,(0xfffe) @@ -258,7 +257,6 @@ _plt_halt: ; ; A little SIO helper ; - .export _sio_r .export _sio2_otir _sio2_otir: @@ -404,7 +402,7 @@ modified_mem: ld (banknum),a ld hl, 0xeae8 ld (bits_from_user),hl - ld hl, 0x0503 ; SIOB R 5 + ld hl, 0x0503 ; SIOB R 5 ld (sio_reg),hl ld a, 0xea ld a,l ; get the register @@ -433,7 +431,7 @@ far_ldir_1: inc hl out (c),b out (c),d - ld (ix),a + ld (ix + 0),a inc ix exx dec bc diff --git a/Kernel/platform/platform-simple80/simple80.s b/Kernel/platform/platform-simple80/simple80.s index e6ab0c7be..c5178fe1f 100644 --- a/Kernel/platform/platform-simple80/simple80.s +++ b/Kernel/platform/platform-simple80/simple80.s @@ -8,7 +8,6 @@ ; exported symbols .export init_hardware - .export interrupt_handler .export _program_vectors .export _kernel_flag .export map_page_low @@ -61,9 +60,9 @@ NBUFS .equ 4 HIGHPAGE .equ 0 ; We only have 1 page byte and the low page ; isn't used -# 26 "simple80.S" 2 +# 25 "simple80.S" 2 # 1 "../../cpu-z80u/kernel-z80.def" 1 -# 27 "simple80.S" 2 +# 26 "simple80.S" 2 ; Base address of SIO/2 chip 0x80 @@ -124,8 +123,8 @@ init_hardware: ld hl, 60 ; We lose 4K to common space ld (_procmem), hl - ld hl, s__COMMONMEM - ld de, l__COMMONMEM + ld hl, __common + ld de, __common_size ; Modified board drives the RAM A16 differently ld a,(0xfffe) @@ -298,7 +297,6 @@ _plt_halt: ; ; A little SIO helper ; - .export _sio_r .export _sio2_otir _sio2_otir: @@ -444,7 +442,7 @@ modified_mem: ld (banknum),a ld hl, 0xeae8 ld (bits_from_user),hl - ld hl, 0x0503 ; SIOB R 5 + ld hl, 0x0503 ; SIOB R 5 ld (sio_reg),hl ld a, 0xea ld a,l ; get the register @@ -473,7 +471,7 @@ far_ldir_1: inc hl out (c),b out (c),d - ld (ix),a + ld (ix + 0),a inc ix exx dec bc diff --git a/Kernel/platform/platform-simple80/usermem.S b/Kernel/platform/platform-simple80/usermem.S index eb639249a..d5c789bad 100644 --- a/Kernel/platform/platform-simple80/usermem.S +++ b/Kernel/platform/platform-simple80/usermem.S @@ -66,11 +66,11 @@ __uput: ; logic ; __uzero: - ld hl,4 + ld hl,5 add hl,sp ld d,(hl) dec hl - ld d,(hl) + ld e,(hl) dec hl ld a,(hl) dec hl diff --git a/Kernel/platform/platform-simple80/usermem.s b/Kernel/platform/platform-simple80/usermem.s index 900133c33..bf6f6554a 100644 --- a/Kernel/platform/platform-simple80/usermem.s +++ b/Kernel/platform/platform-simple80/usermem.s @@ -106,11 +106,11 @@ __uput: ; logic ; __uzero: - ld hl,4 + ld hl,5 add hl,sp ld d,(hl) dec hl - ld d,(hl) + ld e,(hl) dec hl ld a,(hl) dec hl