|
|
| version 1.4, 2004/03/12 18:19:57 | version 1.8, 2005/05/20 13:59:46 |
|---|---|
| Line 21 extern void iptrace_out(void); | Line 21 extern void iptrace_out(void); |
| #endif | #endif |
| static const BYTE hdd_inquiry[0x20] = { | static const UINT8 hdd_inquiry[0x20] = { |
| 0x00,0x00,0x02,0x02,0x1c,0x00,0x00,0x18, | 0x00,0x00,0x02,0x02,0x1c,0x00,0x00,0x18, |
| 'N', 'E', 'C', 0x20,0x20,0x20,0x20,0x20, | 'N', 'E', 'C', 0x20,0x20,0x20,0x20,0x20, |
| 'N', 'P', '2', '-', 'H', 'D', 'D', 0x20, | 'N', 'P', '2', '-', 'H', 'D', 'D', 0x20, |
| 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20}; | 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20}; |
| static UINT scsicmd_datain(SXSIDEV sxsi, BYTE *cdb) { | static UINT scsicmd_datain(SXSIDEV sxsi, UINT8 *cdb) { |
| UINT length; | UINT length; |
| Line 75 REG8 scsicmd_select(REG8 id) { | Line 75 REG8 scsicmd_select(REG8 id) { |
| return(0x42); | return(0x42); |
| } | } |
| sxsi = sxsi_getptr((REG8)(0x20 + id)); | sxsi = sxsi_getptr((REG8)(0x20 + id)); |
| if ((sxsi) && (sxsi->type)) { | if ((sxsi) && (sxsi->flag & SXSIFLAG_READY)) { |
| scsiio.phase = SCSIPH_COMMAND; | scsiio.phase = SCSIPH_COMMAND; |
| return(0x8a); // Transfer CommandÍ×µá | return(0x8a); // Transfer CommandÍ×µá |
| } | } |
| return(0x42); // Timeout | return(0x42); // Timeout |
| } | } |
| REG8 scsicmd_transfer(REG8 id, BYTE *cdb) { | REG8 scsicmd_transfer(REG8 id, UINT8 *cdb) { |
| SXSIDEV sxsi; | SXSIDEV sxsi; |
| UINT leng; | UINT leng; |
| Line 92 REG8 scsicmd_transfer(REG8 id, BYTE *cdb | Line 92 REG8 scsicmd_transfer(REG8 id, BYTE *cdb |
| } | } |
| sxsi = sxsi_getptr((REG8)(0x20 + id)); | sxsi = sxsi_getptr((REG8)(0x20 + id)); |
| if ((sxsi == NULL) || (sxsi->type == 0)) { | if ((sxsi == NULL) || (!(sxsi->flag & SXSIFLAG_READY))) { |
| return(0x42); | return(0x42); |
| } | } |
| Line 127 static REG8 scsicmd_cmd(REG8 id) { | Line 127 static REG8 scsicmd_cmd(REG8 id) { |
| return(0x42); | return(0x42); |
| } | } |
| sxsi = sxsi_getptr((REG8)(0x20 + id)); | sxsi = sxsi_getptr((REG8)(0x20 + id)); |
| if ((sxsi == NULL) || (sxsi->type == 0)) { | if ((sxsi == NULL) || (!(sxsi->flag & SXSIFLAG_READY))) { |
| return(0x42); | return(0x42); |
| } | } |
| switch(scsiio.cmd[0]) { | switch(scsiio.cmd[0]) { |
| Line 144 static REG8 scsicmd_cmd(REG8 id) { | Line 144 static REG8 scsicmd_cmd(REG8 id) { |
| return(0xff); | return(0xff); |
| } | } |
| BOOL scsicmd_send(void) { | BRESULT scsicmd_send(void) { |
| switch(scsiio.phase) { | switch(scsiio.phase) { |
| case SCSIPH_COMMAND: | case SCSIPH_COMMAND: |
| Line 165 static const UINT8 stat2ret[16] = { | Line 165 static const UINT8 stat2ret[16] = { |
| static REG8 bios1bc_seltrans(REG8 id) { | static REG8 bios1bc_seltrans(REG8 id) { |
| BYTE cdb[16]; | UINT8 cdb[16]; |
| REG8 ret; | REG8 ret; |
| MEML_READSTR(CPU_DS, CPU_DX, cdb, 16); | MEMR_READS(CPU_DS, CPU_DX, cdb, 16); |
| scsiio.reg[SCSICTR_TARGETLUN] = cdb[0]; | scsiio.reg[SCSICTR_TARGETLUN] = cdb[0]; |
| if ((cdb[1] & 0x0c) == 0x08) { // OUT | if ((cdb[1] & 0x0c) == 0x08) { // OUT |
| MEML_READSTR(CPU_ES, CPU_BX, scsiio.data, CPU_CX); | MEMR_READS(CPU_ES, CPU_BX, scsiio.data, CPU_CX); |
| } | } |
| ret = scsicmd_transfer(id, cdb + 4); | ret = scsicmd_transfer(id, cdb + 4); |
| if ((cdb[1] & 0x0c) == 0x04) { // IN | if ((cdb[1] & 0x0c) == 0x04) { // IN |
| MEML_WRITESTR(CPU_ES, CPU_BX, scsiio.data, CPU_CX); | MEMR_WRITES(CPU_ES, CPU_BX, scsiio.data, CPU_CX); |
| } | } |
| return(ret); | return(ret); |
| } | } |
| Line 194 void scsicmd_bios(void) { | Line 194 void scsicmd_bios(void) { |
| return; | return; |
| } | } |
| flag = MEML_READ8(CPU_SS, CPU_SP+4) & 0xbe; | flag = MEMR_READ8(CPU_SS, CPU_SP+4) & 0xbe; |
| ret = mem[0x0483]; | ret = mem[0x0483]; |
| cmd = CPU_AH & 0x1f; | cmd = CPU_AH & 0x1f; |
| dstid = CPU_AL & 7; | dstid = CPU_AL & 7; |
| Line 236 void scsicmd_bios(void) { | Line 236 void scsicmd_bios(void) { |
| else { | else { |
| switch(cmd) { | switch(cmd) { |
| case 0x19: // Data In | case 0x19: // Data In |
| MEML_WRITESTR(CPU_ES, CPU_BX, scsiio.data, CPU_CX); | MEMR_WRITES(CPU_ES, CPU_BX, scsiio.data, CPU_CX); |
| scsiio.phase = SCSIPH_STATUS; | scsiio.phase = SCSIPH_STATUS; |
| stat = 0x8b; | stat = 0x8b; |
| break; | break; |
| case 0x1a: // Transfer command | case 0x1a: // Transfer command |
| MEML_READSTR(CPU_ES, CPU_BX, scsiio.cmd, 12); | MEMR_READS(CPU_ES, CPU_BX, scsiio.cmd, 12); |
| stat = scsicmd_cmd(dstid); | stat = scsicmd_cmd(dstid); |
| break; | break; |
| Line 273 void scsicmd_bios(void) { | Line 273 void scsicmd_bios(void) { |
| ret &= 0x7f; | ret &= 0x7f; |
| } | } |
| CPU_AH = ret; | CPU_AH = ret; |
| MEML_WRITE8(CPU_SS, CPU_SP + 4, flag); | MEMR_WRITE8(CPU_SS, CPU_SP + 4, flag); |
| } | } |
| #endif | #endif |