1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-05 10:28:58 +00:00

Implements EXT.

This commit is contained in:
Thomas Harte 2019-04-25 18:22:19 -04:00
parent 7df85ea695
commit dab9bb6575
3 changed files with 34 additions and 3 deletions

View File

@ -519,6 +519,31 @@ template <class T, bool dtack_is_implicit, bool signal_will_perform> void Proces
set_ccr(active_program_->source->full);
break;
case Operation::EXTbtow:
active_program_->destination->halves.low.halves.high =
(active_program_->destination->halves.low.halves.low & 0x80) ? 0xff : 0x00;
overflow_flag_ = carry_flag_ = 0;
zero_result_ = active_program_->destination->halves.low.halves.high;
negative_flag_ = zero_result_ & 0x8000;
break;
case Operation::EXTbtol:
active_program_->destination->full =
active_program_->destination->halves.low.halves.low |
((active_program_->destination->halves.low.halves.low & 0x80) ? 0xffffff00 : 0x00000000);
overflow_flag_ = carry_flag_ = 0;
zero_result_ = active_program_->destination->full;
negative_flag_ = zero_result_ & 0x80000000;
break;
case Operation::EXTwtol:
active_program_->destination->halves.high.full =
(active_program_->destination->halves.low.full & 0x8000) ? 0xffff : 0x0000;
overflow_flag_ = carry_flag_ = 0;
zero_result_ = active_program_->destination->full;
negative_flag_ = zero_result_ & 0x80000000;
break;
#define and_op(a, b) a &= b
#define or_op(a, b) a |= b
#define eor_op(a, b) a ^= b

View File

@ -449,7 +449,7 @@ struct ProcessorStorageConstructor {
NOP, // Maps to a NOP.
EXG, // Maps source and destination registers and an operation mode to an EXG.
SWAP, // Maps a source register to a SWAP.
EXT_SWAP, // Maps a source register to a SWAP or EXT.
EORI_ORI_ANDI_SR, // Maps to an EORI, ORI or ANDI to SR/CCR.
@ -656,7 +656,7 @@ struct ProcessorStorageConstructor {
{0xf1f8, 0xc148, Operation::EXG, Decoder::EXG}, // 4-105 (p209)
{0xf1f8, 0xc188, Operation::EXG, Decoder::EXG}, // 4-105 (p209)
{0xfff8, 0x4840, Operation::SWAP, Decoder::SWAP}, // 4-185 (p289)
{0xfff8, 0x4840, Operation::SWAP, Decoder::EXT_SWAP}, // 4-185 (p289)
{0xffff, 0x027c, Operation::ANDItoSR, Decoder::EORI_ORI_ANDI_SR},
{0xffff, 0x023c, Operation::ANDItoCCR, Decoder::EORI_ORI_ANDI_SR},
@ -671,6 +671,10 @@ struct ProcessorStorageConstructor {
{0xffc0, 0x08c0, Operation::BSETb, Decoder::BCHG_BSET}, // 4-58 (p162)
{0xffc0, 0x4ac0, Operation::TAS, Decoder::TAS}, // 4-186 (p290)
{0xfff8, 0x4880, Operation::EXTbtow, Decoder::EXT_SWAP}, // 4-106 (p210)
{0xfff8, 0x48c0, Operation::EXTwtol, Decoder::EXT_SWAP}, // 4-106 (p210)
{0xfff8, 0x49c0, Operation::EXTbtol, Decoder::EXT_SWAP}, // 4-106 (p210)
};
std::vector<size_t> micro_op_pointers(65536, std::numeric_limits<size_t>::max());
@ -812,7 +816,7 @@ struct ProcessorStorageConstructor {
op(Action::PerformOperation, seq("np np"));
} break;
case Decoder::SWAP: {
case Decoder::EXT_SWAP: {
storage_.instructions[instruction].set_destination(storage_, Dn, ea_register);
op(Action::PerformOperation, seq("np"));
} break;

View File

@ -109,6 +109,8 @@ class ProcessorStorage {
BSETl, BSETb,
TAS,
EXTbtow, EXTbtol, EXTwtol,
};
/*!