mirror of
https://github.com/TomHarte/CLK.git
synced 2026-04-26 03:29:40 +00:00
Name MSW bits.
This commit is contained in:
@@ -10,7 +10,8 @@
|
||||
|
||||
#include "InstructionSets/x86/AccessType.hpp"
|
||||
#include "InstructionSets/x86/Descriptors.hpp"
|
||||
#include "InstructionSets/x86/Mode.hpp"
|
||||
#include "InstructionSets/x86/Descriptors.hpp"
|
||||
#include "InstructionSets/x86/MachineStatus.hpp"
|
||||
|
||||
#include <utility>
|
||||
|
||||
@@ -93,13 +94,10 @@ void lmsw(
|
||||
ContextT &context
|
||||
) {
|
||||
context.registers.set_msw(source);
|
||||
if(source & 1) {
|
||||
if(source & MachineStatus::ProtectedModeEnable) {
|
||||
context.memory.set_mode(Mode::Protected286);
|
||||
context.segments.set_mode(Mode::Protected286);
|
||||
}
|
||||
|
||||
// TODO: all other bits. Anything?
|
||||
assert(!(source & ~1));
|
||||
}
|
||||
|
||||
template <DescriptorTable table, typename AddressT, typename InstructionT, typename ContextT>
|
||||
|
||||
@@ -13,8 +13,10 @@
|
||||
#include "BCD.hpp"
|
||||
#include "FlowControl.hpp"
|
||||
#include "InOut.hpp"
|
||||
#include "Interrupts.hpp"
|
||||
#include "LoadStore.hpp"
|
||||
#include "Logical.hpp"
|
||||
#include "MachineStatus.hpp"
|
||||
#include "Repetition.hpp"
|
||||
#include "Resolver.hpp"
|
||||
#include "ShiftRoll.hpp"
|
||||
@@ -179,12 +181,22 @@ template <
|
||||
default:
|
||||
assert(false);
|
||||
|
||||
case Operation::NOP: return;
|
||||
|
||||
case Operation::Invalid:
|
||||
if constexpr (!uses_8086_exceptions(ContextT::model)) {
|
||||
throw Exception(Interrupt::InvalidOpcode);
|
||||
}
|
||||
return;
|
||||
|
||||
case Operation::ESC:
|
||||
case Operation::NOP: return;
|
||||
if constexpr (!uses_8086_exceptions(ContextT::model)) {
|
||||
const auto should_throw = context.registers.msw() & MachineStatus::EmulateProcessorExtension;
|
||||
if(should_throw) {
|
||||
throw Exception(Interrupt::DeviceNotAvailable);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
case Operation::AAM:
|
||||
Primitive::aam(context.registers.axp(), uint8_t(instruction.operand()), context);
|
||||
|
||||
@@ -22,7 +22,7 @@ enum Interrupt {
|
||||
BoundRangeExceeded = 5,
|
||||
|
||||
//
|
||||
// Added by the 80286
|
||||
// Added by the 80286.
|
||||
//
|
||||
InvalidOpcode = 6,
|
||||
DeviceNotAvailable = 7,
|
||||
@@ -35,7 +35,7 @@ enum Interrupt {
|
||||
FloatingPointException = 16,
|
||||
|
||||
//
|
||||
// Added by the 80286
|
||||
// Added by the 80286.
|
||||
//
|
||||
PageFault = 14,
|
||||
AlignmentCheck = 17,
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// MachineStatus.hpp
|
||||
// Clock Signal
|
||||
//
|
||||
// Created by Thomas Harte on 30/03/2025.
|
||||
// Copyright © 2025 Thomas Harte. All rights reserved.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace InstructionSet::x86 {
|
||||
|
||||
enum MachineStatus: uint16_t {
|
||||
//
|
||||
// 80286 state.
|
||||
//
|
||||
ProtectedModeEnable = 1 << 0,
|
||||
MonitorProcessorExtension = 1 << 1,
|
||||
EmulateProcessorExtension = 1 << 2,
|
||||
TaskSwitched = 1 << 3,
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1761,6 +1761,7 @@
|
||||
4B85322E2277ABDD00F26553 /* tos100.trace.txt.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; path = tos100.trace.txt.gz; sourceTree = "<group>"; };
|
||||
4B8671EA2D8B40D8009E1610 /* Descriptors.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Descriptors.hpp; sourceTree = "<group>"; };
|
||||
4B8671EB2D8FABA0009E1610 /* Mode.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Mode.hpp; sourceTree = "<group>"; };
|
||||
4B8671EC2D99BE2C009E1610 /* MachineStatus.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = MachineStatus.hpp; sourceTree = "<group>"; };
|
||||
4B86E2591F8C628F006FAA45 /* Keyboard.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Keyboard.cpp; sourceTree = "<group>"; };
|
||||
4B86E25A1F8C628F006FAA45 /* Keyboard.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Keyboard.hpp; sourceTree = "<group>"; };
|
||||
4B8805EE1DCFC99C003085B1 /* Acorn.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Acorn.cpp; path = Parsers/Acorn.cpp; sourceTree = "<group>"; };
|
||||
@@ -5371,6 +5372,7 @@
|
||||
42437B342ACF02A9006DFED1 /* Flags.hpp */,
|
||||
4BEDA3DB25B2588F000C2DBD /* Instruction.hpp */,
|
||||
42437B392AD07465006DFED1 /* Interrupts.hpp */,
|
||||
4B8671EC2D99BE2C009E1610 /* MachineStatus.hpp */,
|
||||
4B8671EB2D8FABA0009E1610 /* Mode.hpp */,
|
||||
4BE3C69527CBC540000EAD28 /* Model.hpp */,
|
||||
42437B352ACF0AA2006DFED1 /* Perform.hpp */,
|
||||
|
||||
Reference in New Issue
Block a user