1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 23:52:26 +00:00

Fix TAS Dn.

This commit is contained in:
Thomas Harte 2022-05-06 12:23:04 -04:00
parent 8176bb6f79
commit ac6a9ab631
4 changed files with 20 additions and 10 deletions

View File

@ -54,7 +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);
void tas(Preinstruction instruction, uint32_t address);
// TODO: ownership of this shouldn't be here.
struct Registers {

View File

@ -402,15 +402,22 @@ void Executor<model, BusHandler>::pea(uint32_t address) {
}
template <Model model, typename BusHandler>
void Executor<model, BusHandler>::tas(uint32_t address) {
void Executor<model, BusHandler>::tas(Preinstruction instruction, uint32_t address) {
uint8_t original_value;
if(instruction.mode<0>() != AddressingMode::DataRegisterDirect) {
uint8_t value = bus_handler_.template read<uint8_t>(address);
original_value = value;
value |= 0x80;
bus_handler_.template write<uint8_t>(address, value);
} else {
original_value = uint8_t(address);
address |= 0x80;
registers_[instruction.reg<0>()].b = 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);
status_.zero_result_ = original_value;
status_.negative_flag_ = original_value & 0x80;
}
template <Model model, typename BusHandler>

View File

@ -794,7 +794,7 @@ template <
*/
case Operation::TAS:
flow_controller.tas(src.l);
flow_controller.tas(instruction, src.l);
break;
/*

View File

@ -49,6 +49,9 @@
// mulu_muls
// neg_not
// negx_clr
// swap
// tas
// tst
// Issues to fix:
//
@ -78,7 +81,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", @"tas.json"]];
_fileSet = [NSSet setWithArray:@[@"rts.json", @"rtr.json"]];
// _testSet = [NSSet setWithArray:@[@"NEGX 00c0"]];
// _fileSet = [NSSet setWithArray:@[@"jmp_jsr.json"]];
// _testSet = [NSSet setWithArray:@[@"CHK 41a8"]];