Skip to content

Commit

Permalink
Command shell updates and quirks modes
Browse files Browse the repository at this point in the history
  • Loading branch information
dkgrizzly committed Dec 11, 2021
1 parent 178cffa commit 0c04852
Show file tree
Hide file tree
Showing 13 changed files with 1,798 additions and 176 deletions.
739 changes: 630 additions & 109 deletions src/cmd.ino

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions src/config.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef __CONFIG_H
#define __CONFIG_H

#define DEBUG 0 // 0:No debug information output (Faster by 2-3x+)
#define DEBUG 1 // 0:No debug information output (Faster by 2-3x+)
// 1: Debug information output to USB Serial
// 2: Debug information output to LOG.txt (slow)

Expand All @@ -21,16 +21,19 @@
// HDD format
#define MAX_BLOCKSIZE (1 << 15) // Maximum BLOCK size (2048 to 8192 tested, 16384 had issues)

#define SCSI_INQUIRY_RESPONSE_SIZE 96

// Supported Device Types
#define SUPPORT_DISK true
#define SUPPORT_OPTICAL true
#define SUPPORT_TAPE false

#define SUPPORT_MO false
#define SUPPORT_INITIATOR true

// Compatibility Settings
#define SUPPORT_SASI false // Enable SASI compatiblity for Sharp X68000
#define SUPPORT_SASI_DEFAULT false // Turn it on by default

#define SUPPORT_APPLE true
#define SUPPORT_APPLE_DEFAULT false

#endif /* __CONFIG_H */
134 changes: 117 additions & 17 deletions src/defaults.ino
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
#include "config.h"

// SCSI Drive Vendor information

static uint8_t SCSI_INQUIRY_RESPONSE[][SCSI_INQUIRY_RESPONSE_SIZE] = {
#if SUPPORT_SASI
{
0x00, //Device type
0x00, //RMB = 0
0x01, //ISO,ECMA,ANSI version
0x01, //Response data format
35 - 4, //Additional data length
0, 0, //Reserve
0x00, //Support function
'N', 'E', 'C', 'I', 'T', 'S', 'U', ' ',
'A', 'r', 'd', 'S', 'C', 'S', 'i', 'n', 'o', ' ', ' ',' ', ' ', ' ', ' ', ' ',
'0', '0', '1', '0',
0
},
#endif /* SUPPORT_SASI */

#if SUPPORT_DISK
static uint8_t SCSI_DISK_INQUIRY_RESPONSE[96] = {
{
0x00, //device type
0x00, //RMB = 0
0x05, //ISO, ECMA, ANSI version
Expand All @@ -18,27 +36,29 @@ static uint8_t SCSI_DISK_INQUIRY_RESPONSE[96] = {
// Revision Date (10 Bytes)
'2','0','2','1','/','1','1','/','2','2',
0
};
#endif /* SUPPORT_DISK */
},

#if SUPPORT_SASI
static uint8_t SCSI_NEC_INQUIRY_RESPONSE[96] = {
0x00, //Device type
{
0x00, //device type
0x00, //RMB = 0
0x01, //ISO,ECMA,ANSI version
0x01, //Response data format
0x05, //ISO, ECMA, ANSI version
0x02, //Response data format
35 - 4, //Additional data length
0, 0, //Reserve
0x00, //Support function
'N', 'E', 'C', 'I', 'T', 'S', 'U', ' ',
'A', 'r', 'd', 'S', 'C', 'S', 'i', 'n', 'o', ' ', ' ',' ', ' ', ' ', ' ', ' ',
'0', '0', '1', '0',
'S', 'E', 'A', 'G', 'A', 'T', 'E', ' ', // vendor 8
'S', 'T', '2', '2', '5', 'N', ' ', ' ', ' ', ' ', ' ',' ', ' ', ' ', ' ', ' ', // product 16
'1', '.', '0', ' ', // version 4
// Release Number (1 Byte)
0x20,
// Revision Date (10 Bytes)
'2','0','2','1','/','1','1','/','2','2',
0
};
#endif /* SUPPORT_SASI */
},
#endif /* SUPPORT_DISK */

#if SUPPORT_OPTICAL
static uint8_t SCSI_CDROM_INQUIRY_RESPONSE[96] = {
{
0x05, //device type
0x80, //RMB = 0
0x05, //ISO, ECMA, ANSI version
Expand All @@ -54,11 +74,80 @@ static uint8_t SCSI_CDROM_INQUIRY_RESPONSE[96] = {
// Revision Date (10 Bytes)
'2','0','2','1','/','1','1','/','2','2',
0
};
},
{
0x05, //device type
0x80, //RMB = 0
0x05, //ISO, ECMA, ANSI version
0x02, //Response data format
46 - 4, //Additional data length
0, 0, //Reserve
0x00, //Support function
'S', 'O', 'N', 'Y', ' ', ' ', ' ', ' ', // vendor 8
'C', 'D', 'U', '-', '7', '6', 'S', ' ', ' ', ' ', ' ',' ', ' ', ' ', ' ', ' ', // product 16
'1', '.', '0', ' ', // version 4
// Release Number (1 Byte)
0x20,
// Revision Date (10 Bytes)
'2','0','2','1','/','1','1','/','2','2',
0
},
{
0x05, //device type
0x80, //RMB = 0
0x05, //ISO, ECMA, ANSI version
0x02, //Response data format
35 - 4, //Additional data length
0, 0, //Reserve
0x00, //Support function
'M', 'A', 'T', 'S', 'H', 'I', 'T', 'A', // vendor 8
'C', 'D', '-', 'R', 'O', 'M', ' ', 'C', 'R', '8', '0','0', '5', ' ', ' ', ' ', // product 16
'1', '.', '0', 'k', // version 4
0
},
{
0x05, //device type
0x80, //RMB = 0
0x05, //ISO, ECMA, ANSI version
0x02, //Response data format
35 - 4, //Additional data length
0, 0, //Reserve
0x00, //Support function
'D', 'E', 'C', ' ', ' ', ' ', ' ', ' ', // vendor 8
'R', 'R', 'D', '4', '5', ' ', ' ', ' ', '(', 'C', ')',' ', 'D', 'E', 'C', ' ', // product 16
'0', '4', '3', '6', // version 4
0
},
{
0x05, //device type
0x80, //RMB = 0
0x05, //ISO, ECMA, ANSI version
0x02, //Response data format
35 - 4, //Additional data length
0, 0, //Reserve
0x98, //Support function
'T', 'O', 'S', 'H', 'I', 'B', 'A', ' ', // vendor 8
'C', 'D', '-', 'R', 'O', 'M', ' ', 'X', 'M', '-', '3','3', '0', '1', 'T', 'A', // product 16
'0', '2', '7', '2', // version 4
0
},
{
0x05, //device type
0x80, //RMB = 0
0x05, //ISO, ECMA, ANSI version
0x02, //Response data format
35 - 4, //Additional data length
0, 0, //Reserve
0x98, //Support function
'T', 'O', 'S', 'H', 'I', 'B', 'A', ' ', // vendor 8
'C', 'D', '-', 'R', 'O', 'M', ' ', 'X', 'M', '-', '5','7', '0', '1', 'T', 'A', // product 16
'3', '1', '3', '6', // version 4
0
},
#endif /* SUPPORT_OPTICAL */

#if SUPPORT_TAPE
static uint8_t SCSI_TAPE_INQUIRY_RESPONSE[96] = {
{
0x01, //device type
0x80, //RMB = 0
0x03, //ISO, ECMA, ANSI version
Expand All @@ -71,5 +160,16 @@ static uint8_t SCSI_TAPE_INQUIRY_RESPONSE[96] = {
'U', 'L', 'T', '3', '5', '8', '0', '-', 'T', 'D', '1',' ', ' ', ' ', ' ', ' ', // product 16
'M', 'B', 'N', '0', // version 4
0
};
},
#endif /* SUPPORT_TAPE */

// Invalid entry to mark end of data
{
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
' ', ' ', ' ', ' ',
0
}

};
17 changes: 14 additions & 3 deletions src/disk.ino
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,27 @@ void ConfigureDiskHandlers(VirtualDevice_t *vdev) {
vdev->m_handler[CMD_WRITE10] = &Write10CommandHandler;
vdev->m_handler[CMD_SEEK10] = &Seek10CommandHandler;
vdev->m_handler[CMD_MODE_SENSE10] = &ModeSenseCommandHandler;
vdev->m_handler[CMD_SEARCH_DATA_EQUAL] = &SearchDataEqualCommandHandler;
vdev->m_handler[CMD_READ_DEFECT_DATA] = &ReadDefectCommandHandler;
#if SUPPORT_SASI
if(m_sasi_mode)
if(vdev->m_quirks & QUIRKS_SASI)
vdev->m_handler[CMD_SET_DRIVE_PARAMETER] = &DTCsetDriveParameterCommandHandler;
#endif
#endif
#if SUPPORT_APPLE
if(vdev->m_quirks & QUIRKS_APPLE)
vdev->m_handler[CMD_MAC_UNKNOWN] = &AppleEECommandHandler;
#endif
}

// If config file exists, read the first three lines and copy the contents.
// File must be well formed or you will get junk in the SCSI Vendor fields.
void ConfigureDisk(VirtualDevice_t *vdev, const char *image_name) {
memcpy(vdev->m_inquiryresponse, SCSI_DISK_INQUIRY_RESPONSE, sizeof(SCSI_DISK_INQUIRY_RESPONSE));
for(int i = 0; SCSI_INQUIRY_RESPONSE[i][0] != 0xff; i++) {
if(SCSI_INQUIRY_RESPONSE[i][0] == DEV_DISK) {
memcpy(vdev->m_inquiryresponse, SCSI_INQUIRY_RESPONSE[i], SCSI_INQUIRY_RESPONSE_SIZE);
break;
}
}

if(image_name) {
char configname[MAX_FILE_PATH+1];
Expand Down
Loading

0 comments on commit 0c04852

Please sign in to comment.