; ; JR-IDE Project ; - (c) 2020 Alan Hightower ; ; This program is free software: you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation, either version 3 of the License, or ; (at your option) any later version. ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with this program. If not, see . ; LF equ 10h CR equ 13h ESCAPE equ 27h F1 equ 3bh SECTOR_SIZE equ 512 ; standard 512 byte sectors ; JR-IDE registers are memory mapped in the same option ROM ; segment starting at +14.5 KB. After the registers is some ; scratch RAM that we use for keeping a data area and scratch JRIDE_ROM_REG_BASE equ ((14 * 1024) + 512) JRIDE_IDE_DATA_WIN equ (JRIDE_ROM_REG_BASE + 0) JRIDE_IDE_REG_BASE equ (JRIDE_ROM_REG_BASE + 512) JRIDE_RAM_MAP_REG equ (JRIDE_ROM_REG_BASE + 512 + 16) JRIDE_FLASH_MAP_REG equ (JRIDE_ROM_REG_BASE + 512 + 17) JRIDE_SCRATCH_RAM equ (JRIDE_ROM_REG_BASE + 512 + 18) JRIDE_BOOT_MAGIC equ (JRIDE_SCRATCH_RAM) JRIDE_BOOT_MAGIC_HI equ (0afbeh) ; de ad be af JRIDE_BOOT_MAGIC_LO equ (0addeh) JRIDE_SCRATCH_ALIGN equ (JRIDE_SCRATCH_RAM + 14) JRIDE_DRIVE0_PARMS equ (JRIDE_SCRATCH_ALIGN) JRIDE_DRIVE1_PARMS equ (JRIDE_SCRATCH_ALIGN + 20h) JRIDE_DRIVE2_PARMS equ (JRIDE_SCRATCH_ALIGN + 40h) JRIDE_DATA_AREA equ (JRIDE_SCRATCH_ALIGN + 60h) ; 416 total ; Fixed Disk Parameter Table offset (DRIVEx_PARMS above) FDPT_LOGICAL_CYLS equ (000h) ; (DOS) Total cylinders (1024 limit) FDPT_LOGICAL_HEADS equ (002h) ; (DOS) Total heads (0 = 256) FDPT_OBSOLETE_3 equ (003h) ; Reduced write current lower byte (0) FDPT_OBSOLETE_4 equ (004h) ; Reduced write current upper byte (0) FDPT_OBSOLETE_5 equ (005h) ; Precomp cylinder lower byte (0) FDPT_OBSOLETE_6 equ (006h) ; Precomp cylinder upper byte (0) FDPT_OBSOLETE_7 equ (007h) ; ECC burst length (0) FDPT_DRIVE_CTRL equ (008h) ; Drive control byte (0 ok) FDPT_OBSOLETE_9 equ (009h) ; Standard timeout XT (0) FDPT_OBSOLETE_A equ (00Ah) ; Formatting timeout (0) FDPT_OBSOLETE_B equ (00Bh) ; Drive check timeout (0) FDPT_OBSOLETE_C equ (00Ch) ; Landing zone cylinder lower byte (0) FDPT_OBSOLETE_D equ (00Dh) ; Landing zone cylinder upper byte (0) FDPT_LOGICAL_SPT equ (00Eh) ; (DOS) Sectors per track, max 63 FDPT_RESERVED_F equ (00Fh) ; Reserved ; Extensions custom to this BIOS: FDPT_EXT_SECTORS_LOW equ (010h) ; Total physical sectors low word FDPT_EXT_SECTORS_HIGH equ (012h) ; Total physical sectors high word FDPT_EXT_DISPATCH equ (014h) ; Offset of int13h function table FDPT_EXT_LAST_STATUS equ (016h) ; Status code from last drive op FDPT_EXT_TRANSLATION equ (017h) ; CHS translation mode (see below) FDPT_EXT_IDE_SLAVE equ (018h) ; IDE Only: slave select bit FDPT_EXT_PHYSICAL_SPT equ (019h) ; (IDE) Sectors per track, max 255 FDPT_EXT_PHYSICAL_CYLS equ (01Ah) ; (IDE) Total cylinders (0 = 65536) FDPT_EXT_PHYSICAL_HEADS equ (01Ch) ; (IDE) Total heads, max 16 FDPT_UNUSED equ (01Dh) ; +3 bytes of unused space ; JR-IDE Data Area JDA_DRIVE_COUNT equ (JRIDE_DATA_AREA + 0) JDA_DRIVE0_INDEX equ (JRIDE_DATA_AREA + 1) ; eg 080h JDA_DRIVE1_INDEX equ (JRIDE_DATA_AREA + 2) JDA_DRIVE2_INDEX equ (JRIDE_DATA_AREA + 3) JDA_REMAP_SEGMENT equ (JRIDE_DATA_AREA + 4) ; for ROM disk JDA_PREV_INT13 equ (JRIDE_DATA_AREA + 6) JDA_PREV_INT1A equ (JRIDE_DATA_AREA + 10) JDA_PREV_INT2F equ (JRIDE_DATA_AREA + 14) JRIDE_SCRATCH_END equ (JRIDE_DATA_AREA + 18) ; memset to here JRIDE_ROMDISK_TRAMP equ (JRIDE_SCRATCH_END) ; Trampoline helper JRIDE_SCRATCH_SECTOR equ (JRIDE_ROM_REG_BASE + 1024) CHS_MODE_NATIVE equ (000h) CHS_MODE_LBA equ (0A0h) JRIDE_POST_DATA_PORT equ (010h) JRIDE_POST_CTRL_PORT equ (072h) JRIDE_RTC_ADDR_PORT equ (070h) JRIDE_RTC_DATA_PORT equ (071h) JRIDE_FLASH_PAGE_SIZE equ (04000h) JRIDE_FLASH_PAGE_MASK equ (JRIDE_FLASH_PAGE_SIZE - 1) IDE_REG_COMMAND equ (JRIDE_IDE_REG_BASE + 7) IDE_REG_STATUS equ (JRIDE_IDE_REG_BASE + 7) IDE_REG_DEVICE equ (JRIDE_IDE_REG_BASE + 6) IDE_REG_CYL_HIGH equ (JRIDE_IDE_REG_BASE + 5) IDE_REG_CYL_LOW equ (JRIDE_IDE_REG_BASE + 4) IDE_REG_SECTOR_START equ (JRIDE_IDE_REG_BASE + 3) IDE_REG_SECTOR_COUNT equ (JRIDE_IDE_REG_BASE + 2) IDE_REG_FEATURES equ (JRIDE_IDE_REG_BASE + 1) IDE_REG_ERROR equ (JRIDE_IDE_REG_BASE + 1) IDE_CMD_READ_SECTORS equ (020h) IDE_CMD_WRITE_SECTORS equ (030h) IDE_CMD_VERIFY_SECTORS equ (040h) IDE_CMD_IDENTIFY_DEVICE equ (0ECh) IDE_CMD_IDENTIFY_PACKET equ (0A1h) ; there are several more, but these are the ones used here INT13_ERR_INVALID equ (001h) INT13_ERR_WRITE_PROT equ (003h) INT13_ERR_SECTOR_NF equ (004h) INT13_ERR_SEEK_FAIL equ (040h) INT13_ERR_TIMEOUT equ (080h) // BIOS Data Area Offsets BDA_MEMORY_SIZE equ (013h) BDA_ADAPTER_MEMORY equ (015h) BDA_DRIVE_COUNT equ (075h) BOOT_STRAP_OFF equ (7c00h) BOOT_STRAP_SEG equ (0000h)