}
#if KS12_BOOT_HACK
-extern uaecptr ks12_resident;
-static void set_ks12_boot_hack(bool enable)
+static uaecptr ks12_resident;
+static void set_ks12_boot_hack(void)
{
uaecptr old = here();
org(ks12_resident);
- dw(enable ? 0x4afc : 0x0000);
- org(ks12_resident + 9);
+ dw(ks12orolder() ? 0x4afc : 0x0000);
+ org(ks12_resident + 11);
db((uae_u8)kickstart_version);
org(old);
}
+
+void create_ks12_boot(void)
+{
+ // KS 1.2 boot resident
+ uaecptr name = ds(_T("UAE boot"));
+ align(2);
+ uaecptr code = here();
+ // allocate fake diagarea
+ dl(0x48e73f3e); // movem.l d2-d7/a2-a6,-(sp)
+ dw(0x203c); // move.l #x,d0
+ dl(0x0300);
+ dw(0x7201); // moveq #1,d1
+ dl(0x4eaeff3a); // jsr -0xc6(a6)
+ dw(0x2440); // move.l d0,a2 ;diag area
+ dw(0x9bcd); // sub.l a5,a5 ;expansionbase
+ dw(0x97cb); // sub.l a3,a3 ;configdev
+ dw(0x4eb9); // jsr
+ dl(ROM_filesys_diagentry);
+ dl(0x4cdf7cfc); // movem.l (sp)+,d2-d7/a2-a6
+ dw(0x4e75);
+ // struct Resident
+ ks12_resident = here();
+ dw(0x0000);
+ dl(ks12_resident);
+ dl(ks12_resident + 26);
+ db(1); // RTF_COLDSTART
+ db((uae_u8)kickstart_version); // version
+ db(0); // NT_UNKNOWN
+ db(1); // priority
+ dl(name);
+ dl(name);
+ dl(code);
+ set_ks12_boot_hack();
+}
#endif
static bool expamem_init_filesys(struct autoconfig_info *aci)
put_word_host(expamem + FILESYS_DIAGAREA + FILESYS_BOOTPOINT, 0x4EF9); /* JMP */
put_long_host(expamem + FILESYS_DIAGAREA + FILESYS_BOOTPOINT + 2, EXPANSION_bootcode);
- set_ks12_boot_hack(ks12);
+ set_ks12_boot_hack();
return true;
}
}
}
+ set_ks12_boot_hack();
call_card_init(0);
}
}
_T("dip_2_5")
},
{
- _T("DIP2 #6)"),
+ _T("DIP2 #6"),
_T("dip_2_6")
},
{
- _T("DIP2 #7 "),
+ _T("DIP2 #7"),
_T("dip_2_7")
},
{
0, 0, 0, false, NULL,
false, 0, dataflyersplus_settings
},
+ {
+ _T("arriba"), _T("Arriba"), _T("Gigatron"),
+ NULL, arriba_init, NULL, arriba_add_ide_unit, ROMTYPE_ARRIBA | ROMTYPE_NOT, 0, 0, BOARD_AUTOCONFIG_Z2, false,
+ NULL, 0,
+ false, EXPANSIONTYPE_IDE,
+ 0, 0, 0, false, NULL,
+ false, 0, NULL,
+ { 0xc1, 0x01, 0x00, 0x00, 0x08, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+ },
{
_T("gvp1"), _T("GVP Series I"), _T("Great Valley Products"),
NULL, gvp_init_s1, NULL, gvp_s1_add_scsi_unit, ROMTYPE_GVPS1 | ROMTYPE_NONE, ROMTYPE_GVPS12, 0, BOARD_AUTOCONFIG_Z2, false,
#define UAEFS_VERSION "UAEfs 0.5"
uaecptr filesys_initcode, filesys_initcode_ptr, filesys_initcode_real;
-uaecptr ks12_resident;
static uaecptr bootrom_start;
static uae_u32 fsdevname, fshandlername, filesys_configdev;
static uae_u32 cdfs_devname, cdfs_handlername;
org (loop);
- // KS 1.2 boot resident
- uaecptr name = ds(_T("UAE boot"));
- align(2);
- uaecptr code = here();
- // allocate fake diagarea
- dl(0x48e73f3e); // movem.l d2-d7/a2-a6,-(sp)
- dw(0x203c); // move.l #x,d0
- dl(0x0300);
- dw(0x7201); // moveq #1,d1
- dl(0x4eaeff3a); // jsr -0xc6(a6)
- dw(0x2440); // move.l d0,a2 ;diag area
- dw(0x9bcd); // sub.l a5,a5 ;expansionbase
- dw(0x97cb); // sub.l a3,a3 ;configdev
- dw(0x4eb9); // jsr
- dl(ROM_filesys_diagentry);
- dl(0x4cdf7cfc); // movem.l (sp)+,d2-d7/a2-a6
- dw(0x4e75);
- // struct Resident
- ks12_resident = here();
- dw(0x0000);
- dl(ks12_resident);
- dl(ks12_resident + 26);
- db(1); // RTF_COLDSTART
- db((uae_u8)kickstart_version); // version
- db(0); // NT_UNKNOWN
- db(1); // priority
- dl(name);
- dl(name);
- dl(code);
+ create_ks12_boot();
}
uaecptr filesys_get_entry(int index)
* (c) 2006 - 2015 Toni Wilen
*/
-#define IDE_LOG 0
+#define IDE_LOG 1
#include "sysconfig.h"
#include "sysdeps.h"
return true;
}
-
uae_u16 adide_decode_word(uae_u16 w)
{
uae_u16 o = 0;
if (ide->byteswap) {
w = (w >> 8) | (w << 8);
}
- if (ide->adide)
- w = adide_decode_word(w);
ide->secbuf[offset * 2 + 0] = (uae_u8)w;
ide->secbuf[offset * 2 + 1] = w >> 8;
}
if (ide->byteswap) {
w = (w >> 8) | (w << 8);
}
- if (ide->adide)
- w = adide_decode_word(w);
ide->secbuf[offset * 2 + 0] &= ~((uae_u8)w);
ide->secbuf[offset * 2 + 1] &= ~(w >> 8);
}
if (ide->byteswap) {
w = (w >> 8) | (w << 8);
}
- if (ide->adide)
- w = adide_decode_word(w);
ide->secbuf[offset * 2 + 0] |= (uae_u8)w;
ide->secbuf[offset * 2 + 1] |= w >> 8;
}
if (ide->byteswap) {
w = (w >> 8) | (w << 8);
}
- if (ide->adide)
- w = adide_decode_word(w);
ide->secbuf[offset * 2 + 0] = w >> 8;
ide->secbuf[offset * 2 + 1] = w >> 0;
offset++;
ide_data_ready (ide);
ide->direction = 0;
ide_identity_buffer(ide);
+ if (ide->adide) {
+ for (int i = 0; i < 256; i++) {
+ uae_u16 w = (ide->secbuf[i * 2 + 0] << 8) | (ide->secbuf[i * 2 + 1] << 0);
+ uae_u16 we = adide_decode_word(w);
+ ide->secbuf[i * 2 + 0] = we >> 8;
+ ide->secbuf[i * 2 + 1] = we >> 0;
+ }
+ }
}
static void set_signature (struct ide_hdf *ide)
{
unsigned int cyl, head, sec, nsec, nsec_total;
uae_u64 lba;
- bool last;
+ bool last = true;
ide->data_offset = 0;
+
+ if (ide->direction > 1) {
+ // FORMAT TRACK?
+ // Don't write anything
+ goto end;
+ }
+
nsec = get_nsec (ide);
get_lbachs (ide, &lba, &cyl, &head, &sec);
if (IDE_LOG > 1)
hdf_write (&ide->hdhfd.hfd, ide->secbuf, ide->start_lba * ide->blocksize, ide->start_nsec * ide->blocksize);
}
+end:
if (ide->direction) {
if (last) {
ide_fast_interrupt(ide);
ide->regs.ide_status &= ~IDE_STATUS_BSY;
}
+static void ide_format_track(struct ide_hdf *ide)
+{
+ unsigned int cyl, head, sec;
+ uae_u64 lba;
+
+ gui_flicker_led(LED_HD, ide->num, 2);
+ cyl = (ide->regs.ide_hcyl << 8) | ide->regs.ide_lcyl;
+ head = ide->regs.ide_select & 15;
+ sec = ide->regs.ide_nsector;
+ lba = (((cyl) * ide->hdhfd.heads + (head)) * ide->hdhfd.secspertrack);
+ if (lba >= ide->max_lba) {
+ ide_interrupt(ide);
+ return;
+ }
+ if (IDE_LOG > 0)
+ write_log(_T("IDE%d format cyl=%d, head=%d, sectors=%d\n"), ide->num, cyl, head, sec);
+
+ ide->data_multi = 1;
+ ide->data_offset = 0;
+ ide->data_size = ide->blocksize;
+ ide->direction = 2;
+ ide->buffer_offset = 0;
+
+ // write start: set DRQ and clear BSY. No interrupt.
+ ide->regs.ide_status |= IDE_STATUS_DRQ;
+ ide->regs.ide_status &= ~IDE_STATUS_BSY;
+}
+
static void ide_do_command (struct ide_hdf *ide, uae_u8 cmd)
{
int lba48 = ide->lba48;
if (ide->atapi) {
- gui_flicker_led (LED_CD, ide->num, 1);
+ if (ide->scsi->device_type == UAEDEV_CD) {
+ gui_flicker_led(LED_CD, ide->num, 1);
+ }
ide->atapi_drdy = true;
if (cmd == 0x00) { /* nop */
ide_interrupt (ide);
ide_write_sectors (ide, 1);
} else if (cmd == 0x39 && lba48) { /* write multiple ext */
ide_write_sectors (ide, 1|2);
- } else if (cmd == 0x50) { /* format track (nop) */
- ide_interrupt (ide);
+ } else if (cmd == 0x50) { /* format track */
+ ide_format_track (ide);
} else if (cmd == 0xef) { /* set features */
ide_set_features (ide);
} else if (cmd == 0x00) { /* nop */
memcpy (&ide->hdhfd.hfd.ci, ci, sizeof (struct uaedev_config_info));
if (ci->type == UAEDEV_CD && ci->device_emu_unit >= 0) {
- device_func_init (0);
- ide->scsi = scsi_alloc_cd (ch, ci->device_emu_unit, true);
+ device_func_init(0);
+ ide->scsi = scsi_alloc_cd(ch, ci->device_emu_unit, true);
if (!ide->scsi) {
- write_log (_T("IDE: CD EMU unit %d failed to open\n"), ide->cd_unit_num);
+ write_log(_T("IDE: CD EMU unit %d failed to open\n"), ide->cd_unit_num);
return NULL;
}
ide->cd_unit_num = ci->device_emu_unit;
ide->atapi = true;
ide->blocksize = 512;
- gui_flicker_led (LED_CD, ch, -1);
+ gui_flicker_led(LED_CD, ch, -1);
+
+ write_log(_T("IDE%d CD %d\n"), ch, ide->cd_unit_num);
+
+ } else if (ci->type == UAEDEV_TAPE) {
+
+ ide->scsi = scsi_alloc_tape(ch, ci->rootdir, ci->readonly);
+ if (!ide->scsi) {
+ write_log(_T("IDE: TAPE EMU unit %d failed to open\n"), ch);
+ return NULL;
+ }
+
+ ide_identity_buffer(ide);
+ ide->atapi = true;
+ ide->blocksize = 512;
+ ide->cd_unit_num = -1;
+
+ write_log(_T("IDE%d TAPE %d\n"), ch, ide->cd_unit_num);
- write_log (_T("IDE%d CD %d\n"), ch, ide->cd_unit_num);
} else if (ci->type == UAEDEV_HDF) {
#define GVP_IDE 0 // GVP A3001
#define ALF_IDE 1
-#define APOLLO_IDE (ALF_IDE + MAX_DUPLICATE_EXPANSION_BOARDS)
+#define ARRIBA_IDE 2
+#define APOLLO_IDE (ARRIBA_IDE + MAX_DUPLICATE_EXPANSION_BOARDS)
#define MASOBOSHI_IDE (APOLLO_IDE + MAX_DUPLICATE_EXPANSION_BOARDS)
#define ADIDE_IDE (MASOBOSHI_IDE + MAX_DUPLICATE_EXPANSION_BOARDS)
#define MTEC_IDE (ADIDE_IDE + MAX_DUPLICATE_EXPANSION_BOARDS)
static struct ide_board *buddha_board[MAX_DUPLICATE_EXPANSION_BOARDS];
static struct ide_board *dataflyerplus_board[MAX_DUPLICATE_EXPANSION_BOARDS];
static struct ide_board *ateam_board[MAX_DUPLICATE_EXPANSION_BOARDS];
+static struct ide_board *arriba_board[MAX_DUPLICATE_EXPANSION_BOARDS];
static struct ide_board *fastata4k_board[MAX_DUPLICATE_EXPANSION_BOARDS];
static struct ide_hdf *idecontroller_drive[TOTAL_IDE * 2];
return addr;
}
+static int get_arriba_reg(uaecptr addr, struct ide_board *board)
+{
+ if (!(addr & 0x8000))
+ return -1;
+ if (addr & 1)
+ return -1;
+ int reg = ((addr & 0x0fff) >> 9) & 7;
+ return reg;
+}
+
static int get_fastata4k_reg(uaecptr addr, struct ide_board *board, int *portnum)
{
*portnum = 0;
}
}
+ } else if (board->type == ARRIBA_IDE) {
+
+ int reg = get_arriba_reg(addr, board);
+ if (reg >= 0) {
+ v = get_ide_reg(board, reg);
+ }
+
} else if (board->type == FASTATA4K_IDE) {
int portnum;
v = get_ide_reg_multi(board, IDE_DATA, 0, 1);
}
+ } else if (board->type == ARRIBA_IDE) {
+
+ int reg = get_arriba_reg(addr, board);
+ if (reg == 0) {
+ v = get_ide_reg_multi(board, IDE_DATA, 0, 1);
+ }
+
} else if (board->type == FASTATA4K_IDE) {
int portnum;
}
}
+ } else if (board->type == ARRIBA_IDE) {
+
+ int reg = get_arriba_reg(addr, board);
+ if (reg >= 0) {
+ put_ide_reg(board, reg, v);
+ }
+
} else if (board->type == FASTATA4K_IDE) {
int portnum;
}
} else if (board->type == ATEAM_IDE) {
-
+
if (board->configured && (addr & 0xf800) == 0xf800) {
put_ide_reg_multi(board, IDE_DATA, v, 0, 1);
}
-
+
+ } else if (board->type == ARRIBA_IDE) {
+
+ int reg = get_arriba_reg(addr, board);
+ if (!reg) {
+ put_ide_reg_multi(board, IDE_DATA, v, 0, 1);
+ }
+
} else if (board->type == FASTATA4K_IDE) {
int portnum;
add_ide_standard_unit(ch, ci, rc, fastata4k_board, FASTATA4K_IDE, false, false, 2);
}
+bool arriba_init(struct autoconfig_info *aci)
+{
+ const struct expansionromtype *ert = get_device_expansion_rom(ROMTYPE_ARRIBA);
+ if (!aci->doinit) {
+ aci->autoconfigp = ert->autoconfig;
+ return true;
+ }
+
+ struct ide_board *ide = getide(aci);
+
+ ide->bank = &ide_bank_generic;
+ ide->mask = 65536 - 1;
+
+ for (int i = 0; i < 16; i++) {
+ uae_u8 b = ert->autoconfig[i];
+ ew(ide, i * 4, b);
+ }
+
+ aci->addrbank = ide->bank;
+ return true;
+}
+
+void arriba_add_ide_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc)
+{
+ add_ide_standard_unit(ch, ci, rc, arriba_board, ARRIBA_IDE, false, false, 2);
+}
+
+
extern void x86_xt_ide_bios(struct zfile*, struct romconfig*);
static bool x86_at_hd_init(struct autoconfig_info *aci, int type)
{
extern void filesys_install (void);
extern void filesys_install_code (void);
+extern void create_ks12_boot(void);
extern uaecptr filesys_get_entry(int);
extern void filesys_store_devinfo (uae_u8 *);
extern void hardfile_install (void);
bool fastata4k_init(struct autoconfig_info *aci);
void fastata4k_add_ide_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc);
+bool arriba_init(struct autoconfig_info *aci);
+void arriba_add_ide_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc);
+
uae_u32 REGPARAM3 apollo_ide_lget (uaecptr addr) REGPARAM;
uae_u32 REGPARAM3 apollo_ide_wget (uaecptr addr) REGPARAM;
uae_u32 REGPARAM3 apollo_ide_bget (uaecptr addr) REGPARAM;
#define ROMTYPE_CUBO 0x0010006b
#define ROMTYPE_GOLEMHD3000 0x0010006c
#define ROMTYPE_WEDGE 0x0010006d
+#define ROMTYPE_ARRIBA 0x0010006e
#define ROMTYPE_NOT 0x00800000
#define ROMTYPE_QUAD 0x01000000