mirror of
https://github.com/akuker/RASCSI.git
synced 2026-04-22 09:17:29 +00:00
Added command byte count to SCSI command mapping (#966)
* Extended mapping table with command byte count * Terminate early if command is unknown
This commit is contained in:
+4
-10
@@ -11,24 +11,18 @@
|
||||
#include "bus.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace scsi_defs;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Get the number of bytes for a command
|
||||
// TODO Add the byte count to the enum value/command name mapping and remove the comparisons
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
int BUS::GetCommandByteCount(uint8_t opcode)
|
||||
{
|
||||
if (opcode == 0x88 || opcode == 0x8A || opcode == 0x8F || opcode == 0x91 || opcode == 0x9E || opcode == 0x9F) {
|
||||
return 16;
|
||||
} else if (opcode == 0xA0) {
|
||||
return 12;
|
||||
} else if (opcode >= 0x20 && opcode <= 0x7D) {
|
||||
return 10;
|
||||
} else {
|
||||
return 6;
|
||||
}
|
||||
const auto& mapping = command_mapping.find(static_cast<scsi_command>(opcode));
|
||||
|
||||
return mapping != command_mapping.end() ? mapping->second.first : 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user