--- /dev/null
+#include <kernel.h>
+#include <kdata.h>
+#include <printf.h>
+#include <devide.h>
+#include <blkdev.h>
+#include <platform_ide.h>
+#include <devtty.h>
+
+/* We have to provide slightly custom methods here because of the banked
+ kernel */
+COMMON_MEMORY
+
+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
+ ld bc, #IDE_REG_DATA_LATCH ; setup port number
+ ; and count
+ push af
+#ifdef SWAPDEV
+ cp #2
+ jr nz, not_swapin
+ ld a, (_blk_op+BLKPARAM_SWAP_PAGE) ; blkparam.swap_page
+ call map_for_swap
+ jr doread
+not_swapin:
+#endif
+ or a ; test is_user
+ call nz, map_process_always ; map user memory first if required
+doread:
+readword:
+ in a,(0x10) ; Read a word
+ ld (hl),a ; Store the byte we got
+ inc hl
+ ini ; Now store the latched byte
+ jr nz, readword
+ pop af
+ or a
+ jp nz, map_kernel_restore ; else map kernel then return
+ 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
+ ld bc, #IDE_REG_DATA_LATCH ; setup port number
+ ; and count
+ push af
+#ifdef SWAPDEV
+ cp #2
+ jr nz, not_swapout
+ ld a, (_blk_op+BLKPARAM_SWAP_PAGE) ; blkparam.swap_page
+ call map_for_swap
+ jr dowrite
+not_swapout:
+#endif
+ or a ; test is_user
+ call nz, map_process_always ; else map user memory first if required
+dowrite:
+ ; Write is somewhat ugly
+writeword:
+ ld a,(hl)
+ inc hl ; data byte
+ outi ; latch a byte
+ out (0x10),a ; write the data
+ ; and thus the latch
+ jr nz, writeword
+ pop af
+ or a
+ jp nz, map_kernel_restore ; else map kernel then return
+ ret
+ __endasm;
+}
CDSRCS = discard.c
DSRCS = ../dev/devide.c ../dev/devsd.c ../dev/blkdev.c
DDSRCS = ../dev/devide_discard.c ../dev/devsd_discard.c ../dev/mbr.c
-DZSRCS = ../dev/zx/divide.c ../dev/zx/zxmmc.c ../dev/zx/zxkeyboard.c
+DZSRCS = ../dev/zx/nemoide.c ../dev/zx/zxmmc.c ../dev/zx/zxkeyboard.c
DZSRCS += ../dev/zx/devinput.c ../dev/zx/bankbig.c
DDZSRCS =
ASRCS = crt0.s pentagon.s zxvideo.s
8400-BFFF _DISCARD area - blown away when we exec init
(tons of room in this space)
C000-FFFF
- 0: 0000-3FFF
+ 0: 0000-3FFF (Kernel data/common)
1: Kernel CODE (fairly full)
2: Mapped at 0x8000-0xBFFF (holds current process copy)
3: User process
4: User process
- 5: Mapped at 0x4000-0x7FFF (Sceen, Kernel data/common)
+ 5: Mapped at 0x4000-0x7FFF (Screen, spare)
6: Kernel CODE2 (fairly full)
7: CODE3, Video (lots of room)
to page 2 due to the memory manager liits.
To Do:
+- Debug the rest
+- Write SMUC and Nemo ATA driver code
+- Work out what we need to do for Pentagon v Scorpion etc
+- Floppy driver
- Why does ls /bin lose the lowest pixel row of the 'yes' command ?
(Seems we lose the bottom line of the left most char - off by one bug
- Enable interrupts during swap
- 6 or 5bit wide fonts (42, 51 column)
- Optimize zxvid - especially scrolling
-- SMUC and similar IDE options
- Move vtborder to common
- See if we can in fact keep 6000-7FFF clear. If so we can look at
ldir switching another 8K up and down to give 40K program sizes
put it back all under di but it does look doable.
-TODO
-
-- Write spectrum style and also disk boot style loaders
-- Debug the loading
-- Debug the rest
-- Write SMUC and Nemo ATA driver code
-- Work out what we need to do for Pentagon v Scorpion etc
-- Floppy driver
platform-pentagon/devide_discard.rel
platform-pentagon/devsd.rel
platform-pentagon/devsd_discard.rel
-platform-pentagon/divide.rel
+platform-pentagon/nemoide.rel
platform-pentagon/zxmmc.rel
platform-pentagon/mbr.rel
platform-pentagon/blkdev.rel
/*
- * DivIDE interface
+ * NemoIDE interface
*
- * This is a 16bit interface with a latched data port. Each read
- * from A3 fetches a word then returns low then high etc. In the other
- * direction it latches then writes.
+ * This is a 16bit interface with a latched data port.
*
- * The latch is reset to the first state by any other port access in the
- * IDE space (so the command write sets it up nicely for us)
+ * The latch means we have to work from two ports which is ugly but
+ * at least it's not using the high bits of the address.
*/
#define ide_select(x)
#define IDE_DRIVE_COUNT 2
-#define IDE_REG_DATA 0xA3
-#define IDE_REG_ERROR 0xA7
-#define IDE_REG_FEATURES 0xA7
-#define IDE_REG_SEC_COUNT 0xAB
-#define IDE_REG_LBA_0 0xAF
-#define IDE_REG_LBA_1 0xB3
-#define IDE_REG_LBA_2 0xB7
-#define IDE_REG_LBA_3 0xBB
-#define IDE_REG_DEVHEAD 0xBB
-#define IDE_REG_STATUS 0xBF
-#define IDE_REG_COMMAND 0xBF
+#define IDE_SFR __sfr
+
+#define IDE_REG_DATA 0x10
+#define IDE_REG_DATA_LATCH 0x11
+#define IDE_REG_ERROR 0x30
+#define IDE_REG_FEATURES 0x30
+#define IDE_REG_SEC_COUNT 0x50
+#define IDE_REG_LBA_0 0x70
+#define IDE_REG_LBA_1 0x90
+#define IDE_REG_LBA_2 0xB0
+#define IDE_REG_LBA_3 0xD0
+#define IDE_REG_DEVHEAD 0xD0
+#define IDE_REG_STATUS 0xF0
+#define IDE_REG_COMMAND 0xF0
+
+#define IDE_REG_CONTROL 0xC8
#define IDE_NONSTANDARD_XFER