1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-17 10:06:21 +00:00

Start formalising/extracting 8272 status.

This commit is contained in:
Thomas Harte 2023-11-25 18:10:49 -05:00
parent 8c70317d31
commit 0bb048e24b
4 changed files with 71 additions and 5 deletions

View File

@ -0,0 +1,45 @@
//
// Status.hpp
// Clock Signal
//
// Created by Thomas Harte on 25/11/2023.
// Copyright © 2023 Thomas Harte. All rights reserved.
//
#ifndef Status_hpp
#define Status_hpp
namespace Intel::i8272 {
class Status {
public:
uint8_t main() const {
return main_status_;
}
void reset() {
main_status_ = DataReady;
status_[0] = status_[1] = status_[2] = 0;
}
private:
uint8_t main_status_;
uint8_t status_[3];
enum MainStatus: uint8_t {
FDD0Seeking = 0x01,
FDD1Seeking = 0x02,
FDD2Seeking = 0x04,
FDD3Seeking = 0x08,
ReadOrWriteOngoing = 0x10,
InNonDMAExecution = 0x20,
DataIsToProcessor = 0x40,
DataReady = 0x80,
};
};
}
#endif /* Status_hpp */

View File

@ -276,7 +276,7 @@ void i8272::posit_event(int event_type) {
if(!command_.has_command()) {
goto wait_for_complete_command_sequence;
}
if(command_.has_geometry() == 9) {
if(command_.has_geometry()) {
cylinder_ = command_.geometry().cylinder;
head_ = command_.geometry().head;
sector_ = command_.geometry().sector;

View File

@ -21,6 +21,7 @@
#include "../../Components/6845/CRTC6845.hpp"
#include "../../Components/8255/i8255.hpp"
#include "../../Components/8272/CommandDecoder.hpp"
#include "../../Components/8272/Status.hpp"
#include "../../Components/AudioToggle/AudioToggle.hpp"
#include "../../Numeric/RegisterSizes.hpp"
@ -52,6 +53,7 @@ class FloppyController {
const bool hold_reset = !(control & 0x04);
if(!hold_reset && hold_reset_) {
// TODO: add a delay mechanism.
reset();
}
hold_reset_ = hold_reset;
@ -60,9 +62,14 @@ class FloppyController {
}
}
uint8_t status() const {
return status_.main();
}
private:
void reset() {
decoder_.clear();
status_.reset();
pic_.apply_edge<6>(true);
}
@ -71,7 +78,9 @@ class FloppyController {
bool hold_reset_ = false;
bool enable_dma_ = false;
Intel::i8272::CommandDecoder decoder_;
Intel::i8272::Status status_;
};
class KeyboardController {
@ -815,7 +824,10 @@ class IO {
break;
case 0x03f3:
case 0x03f4: case 0x03f5: case 0x03f6: case 0x03f7:
case 0x03f4:
case 0x03f5:
case 0x03f6:
case 0x03f7:
printf("TODO: FDC write of %02x at %04x\n", value, port);
break;
@ -879,8 +891,15 @@ class IO {
// Ignore parallel port accesses.
break;
case 0x03f0: case 0x03f1: case 0x03f2: case 0x03f3:
case 0x03f4: case 0x03f5: case 0x03f6: case 0x03f7:
case 0x03f4: return fdc_.status();
case 0x03f0:
case 0x03f1:
case 0x03f2:
case 0x03f3:
case 0x03f5:
case 0x03f6:
case 0x03f7:
printf("TODO: FDC read from %04x\n", port);
break;

View File

@ -1126,6 +1126,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
4238200B2B1295AD00964EFE /* Status.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Status.hpp; sourceTree = "<group>"; };
423BDC492AB24699008E37B6 /* 8088Tests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = 8088Tests.mm; sourceTree = "<group>"; };
42437B342ACF02A9006DFED1 /* Flags.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Flags.hpp; sourceTree = "<group>"; };
42437B352ACF0AA2006DFED1 /* Perform.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Perform.hpp; sourceTree = "<group>"; };
@ -4552,8 +4553,9 @@
isa = PBXGroup;
children = (
4BBC951C1F368D83008F4C34 /* i8272.cpp */,
4BBC951D1F368D83008F4C34 /* i8272.hpp */,
4267A9CB2B113958008A59BB /* CommandDecoder.hpp */,
4BBC951D1F368D83008F4C34 /* i8272.hpp */,
4238200B2B1295AD00964EFE /* Status.hpp */,
);
path = 8272;
sourceTree = "<group>";