mirror of
https://github.com/TomHarte/CLK.git
synced 2025-11-23 21:17:42 +00:00
Attempt read block.
This commit is contained in:
@@ -24,6 +24,9 @@ void HostFSHandler::perform(const uint8_t function, uint8_t &a, uint16_t &bc, ui
|
|||||||
const auto read_de = [&]() {
|
const auto read_de = [&]() {
|
||||||
return accessor_.hostfs_read(de++);
|
return accessor_.hostfs_read(de++);
|
||||||
};
|
};
|
||||||
|
const auto write_de = [&](const uint8_t ch) {
|
||||||
|
return accessor_.hostfs_write(de++, ch);
|
||||||
|
};
|
||||||
const auto find_channel = [&]() {
|
const auto find_channel = [&]() {
|
||||||
if(a == 255) {
|
if(a == 255) {
|
||||||
return channels_.end();
|
return channels_.end();
|
||||||
@@ -97,7 +100,7 @@ void HostFSHandler::perform(const uint8_t function, uint8_t &a, uint16_t &bc, ui
|
|||||||
} break;
|
} break;
|
||||||
|
|
||||||
// Page 55.
|
// Page 55.
|
||||||
case uint8_t(EXOS::Function::ReadCharacter):
|
case uint8_t(EXOS::Function::ReadCharacter): {
|
||||||
auto channel = find_channel();
|
auto channel = find_channel();
|
||||||
if(channel == channels_.end()) {
|
if(channel == channels_.end()) {
|
||||||
set_error(EXOS::Error::ChannelIllegalOrDoesNotExist);
|
set_error(EXOS::Error::ChannelIllegalOrDoesNotExist);
|
||||||
@@ -111,8 +114,32 @@ void HostFSHandler::perform(const uint8_t function, uint8_t &a, uint16_t &bc, ui
|
|||||||
} else {
|
} else {
|
||||||
set_error(EXOS::Error::EndOfFileMetInRead);
|
set_error(EXOS::Error::EndOfFileMetInRead);
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
|
|
||||||
|
// Page 55.
|
||||||
|
case uint8_t(EXOS::Function::ReadBlock): {
|
||||||
|
auto channel = find_channel();
|
||||||
|
if(channel == channels_.end()) {
|
||||||
|
set_error(EXOS::Error::ChannelIllegalOrDoesNotExist);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_error(EXOS::Error::NoError);
|
||||||
|
while(true) {
|
||||||
|
const auto next = channel->second.get();
|
||||||
|
if(!channel->second.eof()) {
|
||||||
|
bc--;
|
||||||
|
write_de(next);
|
||||||
|
if(!bc) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
set_error(EXOS::Error::EndOfFileMetInRead);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HostFSHandler::set_file_bundle(std::shared_ptr<Storage::FileBundle::FileBundle> bundle) {
|
void HostFSHandler::set_file_bundle(std::shared_ptr<Storage::FileBundle::FileBundle> bundle) {
|
||||||
|
|||||||
Reference in New Issue
Block a user