From da3ec90c8d343af800b45ca298bd4fefca48c7f5 Mon Sep 17 00:00:00 2001 From: "K.Ohta" Date: Sun, 30 Sep 2018 13:53:20 +0900 Subject: [PATCH] [BUILD][MZ2800] Fix FTBFS. [BUILD][VM][SCSI_HDD] Fix FTBFS around SASI_HDD. --- source/build-cmake/mz2800/CMakeLists.txt | 4 ++- source/src/vm/mz2800/CMakeLists.txt | 1 + source/src/vm/scsi_hdd.cpp | 46 +++++++++++++++++++++++++++++++- source/src/vm/scsi_hdd.h | 2 +- 4 files changed, 50 insertions(+), 3 deletions(-) diff --git a/source/build-cmake/mz2800/CMakeLists.txt b/source/build-cmake/mz2800/CMakeLists.txt index ea336c35b..716f92470 100644 --- a/source/build-cmake/mz2800/CMakeLists.txt +++ b/source/build-cmake/mz2800/CMakeLists.txt @@ -20,7 +20,9 @@ set(WITH_MOUSE ON) set(VMFILES mz1p17.cpp - + scsi_dev.cpp + scsi_hdd.cpp + scsi_host.cpp event.cpp io.cpp ) diff --git a/source/src/vm/mz2800/CMakeLists.txt b/source/src/vm/mz2800/CMakeLists.txt index e9d0197f4..b02225824 100644 --- a/source/src/vm/mz2800/CMakeLists.txt +++ b/source/src/vm/mz2800/CMakeLists.txt @@ -11,6 +11,7 @@ set(BASIC_VM_FILES memory.cpp mouse.cpp reset.cpp + sasi.cpp serial.cpp sysport.cpp printer.cpp diff --git a/source/src/vm/scsi_hdd.cpp b/source/src/vm/scsi_hdd.cpp index ccfa06142..a683fbda2 100644 --- a/source/src/vm/scsi_hdd.cpp +++ b/source/src/vm/scsi_hdd.cpp @@ -182,7 +182,7 @@ void SCSI_HDD::decl_state() enter_decl_state(STATE_VERSION); for(int i = 0; i < 8; i++) { - DECL_STATE_ENTRY_STRING_MEMBER(&(image_path[i][0]), MAX_PATH, i); + DECL_STATE_ENTRY_STRING_MEMBER(&(image_path[i][0]), _MAX_PATH, i); } DECL_STATE_ENTRY_1D_ARRAY(sector_size, sizeof(sector_size) / sizeof(int)); leave_decl_state(); @@ -236,3 +236,47 @@ bool SCSI_HDD::load_state(FILEIO* state_fio) return true; } +int SASI_HDD::get_command_length(int value) +{ + return SCSI_HDD::get_command_length(value); +} + +void SASI_HDD::start_command() +{ + switch(command[0]) { + case SCSI_CMD_REQ_SENSE: + #ifdef _SCSI_DEBUG_LOG + this->out_debug_log(_T("[SASI_HDD:ID=%d] Command: Request Sense\n"), scsi_id); + #endif + // start position + position = (command[1] & 0x1f) * 0x10000 + command[2] * 0x100 + command[3]; + position *= physical_block_size(); + // transfer length + remain = 4; + // create sense data table + buffer->clear(); + buffer->write(get_sense_code()); + buffer->write(((max_logical_block_addr() >> 16) & 0x1f) | (get_logical_unit_number() << 5)); + buffer->write(((max_logical_block_addr() >> 8) & 0xff)); + buffer->write(((max_logical_block_addr() >> 0) & 0xff)); + // change to data in phase + set_dat(buffer->read()); + set_phase_delay(SCSI_PHASE_DATA_IN, 10.0); + set_sense_code(SCSI_SENSE_NOSENSE); + return; + + case 0xc2: + #ifdef _SCSI_DEBUG_LOG + this->out_debug_log(_T("[SASI_HDD:ID=%d] Command: SASI Command 0xC2\n"), scsi_id); + #endif + // transfer length + remain = 10; // DTCŒn (ƒgƒ‰ƒ“ƒWƒXƒ^‹ZpSPECIAL No.27, P.88) + // clear data buffer + buffer->clear(); + // change to data in phase + set_phase_delay(SCSI_PHASE_DATA_OUT, 1.0); + return; + } + // start standard command + SCSI_HDD::start_command(); +} diff --git a/source/src/vm/scsi_hdd.h b/source/src/vm/scsi_hdd.h index bd57929c6..6a460957b 100644 --- a/source/src/vm/scsi_hdd.h +++ b/source/src/vm/scsi_hdd.h @@ -23,7 +23,7 @@ private: //protected: // csp_state_utils *state_entry; - _TCHAR image_path[8][MAX_PATH]; + _TCHAR image_path[8][_MAX_PATH]; int sector_size[8]; public: -- 2.11.0