mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-11 15:30:52 +00:00
Distinguish [ADD/SUB]QA from [ADD/SUB]Q.
This commit is contained in:
parent
5ebae85a16
commit
b6ffff5bbd
@ -258,7 +258,14 @@ template <uint8_t op> uint32_t Predecoder<model>::invalid_operands() {
|
||||
case SUBQw: case SUBQl:
|
||||
return ~TwoOperandMask<
|
||||
Quick,
|
||||
AlterableAddressingModes
|
||||
AlterableAddressingModesNoAn
|
||||
>::value;
|
||||
|
||||
case ADDQAw: case ADDQAl:
|
||||
case SUBQAw: case SUBQAl:
|
||||
return ~TwoOperandMask<
|
||||
Quick,
|
||||
An
|
||||
>::value;
|
||||
|
||||
case OpT(Operation::MOVEb):
|
||||
@ -827,7 +834,9 @@ template <uint8_t op, bool validate> Preinstruction Predecoder<model>::decode(ui
|
||||
// b9–b11: an immediate value, embedded in the opcode.
|
||||
//
|
||||
case ADDQb: case ADDQw: case ADDQl:
|
||||
case ADDQAw: case ADDQAl:
|
||||
case SUBQb: case SUBQw: case SUBQl:
|
||||
case SUBQAw: case SUBQAl:
|
||||
return validated<op, validate>(
|
||||
AddressingMode::Quick, 0,
|
||||
combined_mode(ea_mode, ea_register), ea_register);
|
||||
@ -1108,16 +1117,50 @@ template <Model model>
|
||||
Preinstruction Predecoder<model>::decode5(uint16_t instruction) {
|
||||
using Op = Operation;
|
||||
|
||||
switch(instruction & 0x1c0) {
|
||||
switch(instruction & 0x1f8) {
|
||||
// 4-11 (p115)
|
||||
case 0x000: Decode(ADDQb);
|
||||
case 0x040: Decode(ADDQw);
|
||||
case 0x080: Decode(ADDQl);
|
||||
case 0x000:
|
||||
case 0x010: case 0x018:
|
||||
case 0x020: case 0x028:
|
||||
case 0x030: case 0x038:
|
||||
Decode(ADDQb);
|
||||
|
||||
case 0x040:
|
||||
case 0x050: case 0x058:
|
||||
case 0x060: case 0x068:
|
||||
case 0x070: case 0x078:
|
||||
Decode(ADDQw);
|
||||
|
||||
case 0x080:
|
||||
case 0x090: case 0x098:
|
||||
case 0x0a0: case 0x0a8:
|
||||
case 0x0b0: case 0x0b8:
|
||||
Decode(ADDQl);
|
||||
|
||||
case 0x048: Decode(ADDQAw);
|
||||
case 0x088: Decode(ADDQAl);
|
||||
|
||||
// 4-181 (p285)
|
||||
case 0x100: Decode(SUBQb);
|
||||
case 0x140: Decode(SUBQw);
|
||||
case 0x180: Decode(SUBQl);
|
||||
case 0x100:
|
||||
case 0x110: case 0x118:
|
||||
case 0x120: case 0x128:
|
||||
case 0x130: case 0x138:
|
||||
Decode(SUBQb);
|
||||
|
||||
case 0x140:
|
||||
case 0x150: case 0x158:
|
||||
case 0x160: case 0x168:
|
||||
case 0x170: case 0x178:
|
||||
Decode(SUBQw);
|
||||
|
||||
case 0x180:
|
||||
case 0x190: case 0x198:
|
||||
case 0x1a0: case 0x1a8:
|
||||
case 0x1b0: case 0x1b8:
|
||||
Decode(SUBQl);
|
||||
|
||||
case 0x148: Decode(SUBQAw);
|
||||
case 0x188: Decode(SUBQAl);
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@
|
||||
- (void)setUp {
|
||||
// To limit tests run to a subset of files and/or of tests, uncomment and fill in below.
|
||||
_fileSet = [NSSet setWithArray:@[@"addq_subq.json"]];
|
||||
// _testSet = [NSSet setWithArray:@[@"OR 8103"]];
|
||||
// _testSet = [NSSet setWithArray:@[@"ADDQ 0048"]];
|
||||
// _fileSet = [NSSet setWithArray:@[@"jmp_jsr.json"]];
|
||||
// _testSet = [NSSet setWithArray:@[@"CHK 41a8"]];
|
||||
}
|
||||
|
@ -93,8 +93,20 @@ template <int index> NSString *operand(Preinstruction instruction, uint16_t opco
|
||||
case Operation::ADDw: instruction = @"ADD.w"; break;
|
||||
case Operation::ADDl: instruction = @"ADD.l"; break;
|
||||
|
||||
case Operation::ADDAw: instruction = @"ADDA.w"; break;
|
||||
case Operation::ADDAl: instruction = @"ADDA.l"; break;
|
||||
case Operation::ADDAw:
|
||||
if(found.mode<0>() == AddressingMode::Quick) {
|
||||
instruction = @"ADD.w";
|
||||
} else {
|
||||
instruction = @"ADDA.w";
|
||||
}
|
||||
break;
|
||||
case Operation::ADDAl:
|
||||
if(found.mode<0>() == AddressingMode::Quick) {
|
||||
instruction = @"ADD.l";
|
||||
} else {
|
||||
instruction = @"ADDA.l";
|
||||
}
|
||||
break;
|
||||
|
||||
case Operation::ADDXb: instruction = @"ADDX.b"; break;
|
||||
case Operation::ADDXw: instruction = @"ADDX.w"; break;
|
||||
@ -104,8 +116,20 @@ template <int index> NSString *operand(Preinstruction instruction, uint16_t opco
|
||||
case Operation::SUBw: instruction = @"SUB.w"; break;
|
||||
case Operation::SUBl: instruction = @"SUB.l"; break;
|
||||
|
||||
case Operation::SUBAw: instruction = @"SUBA.w"; break;
|
||||
case Operation::SUBAl: instruction = @"SUBA.l"; break;
|
||||
case Operation::SUBAw:
|
||||
if(found.mode<0>() == AddressingMode::Quick) {
|
||||
instruction = @"SUB.w";
|
||||
} else {
|
||||
instruction = @"SUBA.w";
|
||||
}
|
||||
break;
|
||||
case Operation::SUBAl:
|
||||
if(found.mode<0>() == AddressingMode::Quick) {
|
||||
instruction = @"SUB.l";
|
||||
} else {
|
||||
instruction = @"SUBA.l";
|
||||
}
|
||||
break;
|
||||
|
||||
case Operation::SUBXb: instruction = @"SUBX.b"; break;
|
||||
case Operation::SUBXw: instruction = @"SUBX.w"; break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user