1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-02-16 18:30:32 +00:00

Expose issues with TST and TAS.

This commit is contained in:
Thomas Harte 2022-05-06 12:18:56 -04:00
parent 9c266d4316
commit 8176bb6f79
5 changed files with 18 additions and 6 deletions

View File

@ -54,6 +54,7 @@ template <Model model, typename BusHandler> class Executor {
template <typename IntT> void movem_toM(Preinstruction instruction, uint32_t source, uint32_t dest);
template <typename IntT> void movem_toR(Preinstruction instruction, uint32_t source, uint32_t dest);
void pea(uint32_t address);
void tas(uint32_t address);
// TODO: ownership of this shouldn't be here.
struct Registers {

View File

@ -401,6 +401,18 @@ void Executor<model, BusHandler>::pea(uint32_t address) {
bus_handler_.template write<uint32_t>(sp().l, address);
}
template <Model model, typename BusHandler>
void Executor<model, BusHandler>::tas(uint32_t address) {
uint8_t value = bus_handler_.template read<uint8_t>(address);
status_.overflow_flag_ = status_.carry_flag_ = 0;
status_.zero_result_ = value;
status_.negative_flag_ = value & 0x80;
value |= 0x80;
bus_handler_.template write<uint8_t>(address, value);
}
template <Model model, typename BusHandler>
template <typename IntT>
void Executor<model, BusHandler>::movep(Preinstruction instruction, uint32_t source, uint32_t dest) {

View File

@ -790,14 +790,11 @@ template <
/*
TAS: sets zero and negative depending on the current value of the destination,
and sets the high bit.
and sets the high bit, using a specialised atomic bus cycle.
*/
case Operation::TAS:
status.overflow_flag_ = status.carry_flag_ = 0;
status.zero_result_ = dest.b;
status.negative_flag_ = dest.b & 0x80;
dest.b |= 0x80;
flow_controller.tas(src.l);
break;
/*

View File

@ -275,6 +275,7 @@ template <Model model, Operation t_operation = Operation::Undefined> uint8_t ope
case Operation::MOVEPw: case Operation::MOVEPl:
case Operation::MOVEMtoMw: case Operation::MOVEMtoMl:
case Operation::MOVEMtoRw: case Operation::MOVEMtoRl:
case Operation::TAS:
return 0;
//
@ -286,6 +287,7 @@ template <Model model, Operation t_operation = Operation::Undefined> uint8_t ope
case Operation::EORItoSR: case Operation::EORItoCCR:
case Operation::Bccb: case Operation::Bccw: case Operation::Bccl:
case Operation::BSRb: case Operation::BSRw: case Operation::BSRl:
case Operation::TSTb: case Operation::TSTw: case Operation::TSTl:
return FetchOp1;
//

View File

@ -78,7 +78,7 @@
- (void)setUp {
// To limit tests run to a subset of files and/or of tests, uncomment and fill in below.
_fileSet = [NSSet setWithArray:@[@"swap.json", @"tst.json"]];
_fileSet = [NSSet setWithArray:@[@"swap.json", @"tst.json", @"tas.json"]];
// _testSet = [NSSet setWithArray:@[@"NEGX 00c0"]];
// _fileSet = [NSSet setWithArray:@[@"jmp_jsr.json"]];
// _testSet = [NSSet setWithArray:@[@"CHK 41a8"]];