1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-27 16:31:31 +00:00

Merge pull request #53 from TomHarte/BCDTest

Resolves failure of the jsbeeb BCDTest.ssd
This commit is contained in:
Thomas Harte 2016-10-03 22:07:20 -04:00 committed by GitHub
commit f1af6ef8b6
6 changed files with 17 additions and 20 deletions

View File

@ -12,7 +12,7 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Options" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" hidesOnDeactivate="YES" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="gsl-7V-TTU" customClass="Atari2600OptionsPanel" customModule="Clock_Signal" customModuleProvider="target">
<windowStyleMask key="styleMask" titled="YES" closable="YES" utility="YES" HUD="YES"/>
<windowStyleMask key="styleMask" titled="YES" closable="YES" utility="YES" nonactivatingPanel="YES" HUD="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="83" y="102" width="200" height="121"/>
<rect key="screenRect" x="0.0" y="0.0" width="1366" height="768"/>

View File

@ -12,7 +12,7 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Options" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" hidesOnDeactivate="YES" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="ZW7-Bw-4RP" customClass="ElectronOptionsPanel" customModule="Clock_Signal" customModuleProvider="target">
<windowStyleMask key="styleMask" titled="YES" closable="YES" utility="YES" HUD="YES"/>
<windowStyleMask key="styleMask" titled="YES" closable="YES" utility="YES" nonactivatingPanel="YES" HUD="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="83" y="102" width="200" height="83"/>
<rect key="screenRect" x="0.0" y="0.0" width="1366" height="768"/>

View File

@ -12,7 +12,7 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Options" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" hidesOnDeactivate="YES" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="ota-g7-hOL" customClass="Vic20OptionsPanel" customModule="Clock_Signal" customModuleProvider="target">
<windowStyleMask key="styleMask" titled="YES" closable="YES" utility="YES" HUD="YES"/>
<windowStyleMask key="styleMask" titled="YES" closable="YES" utility="YES" nonactivatingPanel="YES" HUD="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="83" y="102" width="200" height="134"/>
<rect key="screenRect" x="0.0" y="0.0" width="1366" height="768"/>

View File

@ -56,6 +56,6 @@ class DPLLTests: XCTestCase {
}
let endOfStream = (pll?.stream)!&0xffffffff;
XCTAssert(endOfStream == 0xaaaaaaaa || endOfStream == 0x55555555, "PLL should have synchronised and clocked repeating 0xa or 0x5 nibbles; got \(String(pll?.stream, radix: 16, uppercase: false))")
XCTAssert(endOfStream == 0xaaaaaaaa || endOfStream == 0x55555555, "PLL should have synchronised and clocked repeating 0xa or 0x5 nibbles; got \(String(pll!.stream, radix: 16, uppercase: false))")
}
}

View File

@ -208,7 +208,7 @@ class WolfgangLorenzTests: XCTestCase, CSTestMachineJamHandler {
let dataPointer = (testData as NSData).bytes.bindMemory(to: UInt8.self, capacity: testData.count)
let loadAddress = UInt16(dataPointer[0]) | (UInt16(dataPointer[1]) << 8)
let contents = testData.subdata(in: NSMakeRange(2, testData.count - 2))
let contents = testData.subdata(in: 2..<(testData.count - 2))
machine.setData(contents, atAddress: loadAddress)

View File

@ -833,25 +833,22 @@ template <class T> class Processor {
case OperationADC:
if(_decimalFlag) {
const uint16_t decimalResult = (uint16_t)_a + (uint16_t)_operand + (uint16_t)_carryFlag;
uint16_t temp16;
temp16 = (_a&0xf) + (_operand&0xf) + _carryFlag;
if(temp16 > 0x9) temp16 += 0x6;
temp16 = (temp16&0x0f) + ((temp16 > 0x0f) ? 0x10 : 0x00) + (_a&0xf0) + (_operand&0xf0);
uint8_t low_nibble = (_a & 0xf) + (_operand & 0xf) + _carryFlag;
if(low_nibble >= 0xa) low_nibble = ((low_nibble + 0x6) & 0xf) + 0x10;
uint16_t result = (uint16_t)(_a & 0xf0) + (uint16_t)(_operand & 0xf0) + (uint16_t)low_nibble;
_negativeResult = (uint8_t)result;
_overflowFlag = (( (result^_a)&(result^_operand) )&0x80) >> 1;
if(result >= 0xa0) result += 0x60;
_overflowFlag = (( (decimalResult^_a)&(decimalResult^_operand) )&0x80) >> 1;
_negativeResult = (uint8_t)temp16;
_carryFlag = (result >> 8) ? 1 : 0;
_a = (uint8_t)result;
_zeroResult = (uint8_t)decimalResult;
if(temp16 > 0x9f) temp16 += 0x60;
_carryFlag = (temp16 > 0xff) ? Flag::Carry : 0;
_a = (uint8_t)temp16;
} else {
const uint16_t decimalResult = (uint16_t)_a + (uint16_t)_operand + (uint16_t)_carryFlag;
_overflowFlag = (( (decimalResult^_a)&(decimalResult^_operand) )&0x80) >> 1;
_negativeResult = _zeroResult = _a = (uint8_t)decimalResult;
_carryFlag = (decimalResult >> 8)&1;
const uint16_t result = (uint16_t)_a + (uint16_t)_operand + (uint16_t)_carryFlag;
_overflowFlag = (( (result^_a)&(result^_operand) )&0x80) >> 1;
_negativeResult = _zeroResult = _a = (uint8_t)result;
_carryFlag = (result >> 8)&1;
}
// fix up in case this was INS