added STA/STX/STY, CMP/CPX/CPY (todo: check if CMP works)

This commit is contained in:
Luigi Thirty 2017-07-22 21:46:26 -04:00
parent f3bbb0413e
commit 780f722955
5 changed files with 178 additions and 30 deletions

View File

@ -688,7 +688,7 @@
<window key="window" title="Debugger" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
<rect key="contentRect" x="196" y="240" width="600" height="400"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<connections>
<outlet property="delegate" destination="B8D-0N-5wS" id="98r-iN-zZc"/>
@ -707,11 +707,11 @@
<objects>
<viewController id="XfG-lQ-9wD" customClass="DebuggerViewController" customModule="FruitMachine" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" wantsLayer="YES" id="m2S-Jp-Qdl">
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
<rect key="frame" x="0.0" y="0.0" width="600" height="400"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="9cE-VZ-R2W">
<rect key="frame" x="18" y="233" width="18" height="17"/>
<rect key="frame" x="18" y="363" width="18" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="A" id="teN-CC-Ijg">
<font key="font" metaFont="system"/>
@ -720,16 +720,16 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="WjO-ue-iRg">
<rect key="frame" x="42" y="230" width="96" height="22"/>
<rect key="frame" x="42" y="360" width="96" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="tFR-bO-ncf">
<font key="font" metaFont="system"/>
<font key="font" metaFont="fixedUser" size="11"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="PyS-Mu-bnf">
<rect key="frame" x="18" y="203" width="18" height="17"/>
<rect key="frame" x="18" y="333" width="18" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="X" id="YEp-wn-anc">
<font key="font" metaFont="system"/>
@ -738,16 +738,16 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="nOs-8C-MbH">
<rect key="frame" x="42" y="200" width="96" height="22"/>
<rect key="frame" x="42" y="330" width="96" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="rbk-9r-h0r">
<font key="font" metaFont="system"/>
<font key="font" metaFont="fixedUser" size="11"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="DmJ-LS-i50">
<rect key="frame" x="18" y="173" width="18" height="17"/>
<rect key="frame" x="18" y="303" width="18" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Y" id="Or5-cX-RQb">
<font key="font" metaFont="system"/>
@ -756,16 +756,16 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="eqA-qk-YQy">
<rect key="frame" x="42" y="170" width="96" height="22"/>
<rect key="frame" x="42" y="300" width="96" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="TpP-00-jRa">
<font key="font" metaFont="system"/>
<font key="font" metaFont="fixedUser" size="11"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="X2P-rm-4XW">
<rect key="frame" x="18" y="145" width="18" height="17"/>
<rect key="frame" x="18" y="275" width="18" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="PC" id="okQ-uV-ovH">
<font key="font" metaFont="system"/>
@ -774,16 +774,16 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="XbV-5m-dd0">
<rect key="frame" x="42" y="140" width="96" height="22"/>
<rect key="frame" x="42" y="270" width="96" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="tiL-Qj-d0G">
<font key="font" metaFont="system"/>
<font key="font" metaFont="fixedUser" size="11"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="iZJ-VB-xRU">
<rect key="frame" x="18" y="115" width="18" height="17"/>
<rect key="frame" x="18" y="245" width="18" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="SR" id="2XF-Q8-qZg">
<font key="font" metaFont="system"/>
@ -792,16 +792,16 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="5TT-BA-Iw1">
<rect key="frame" x="42" y="110" width="96" height="22"/>
<rect key="frame" x="42" y="240" width="96" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="wzs-zZ-PQs">
<font key="font" metaFont="system"/>
<font key="font" metaFont="fixedUser" size="11"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="HdY-Jc-lNK">
<rect key="frame" x="50" y="13" width="81" height="32"/>
<rect key="frame" x="36" y="13" width="108" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Step" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="kSv-aI-p6H">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@ -812,14 +812,14 @@
</connections>
</button>
<scrollView fixedFrame="YES" autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="D58-pD-kHB">
<rect key="frame" x="146" y="20" width="314" height="232"/>
<rect key="frame" x="146" y="20" width="434" height="362"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<clipView key="contentView" ambiguous="YES" id="bpK-Jl-YbG">
<rect key="frame" x="1" y="0.0" width="312" height="231"/>
<rect key="frame" x="1" y="0.0" width="432" height="361"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" headerView="Ep4-FK-mkU" viewBased="YES" id="MuT-J3-VZ6">
<rect key="frame" x="0.0" y="0.0" width="312" height="208"/>
<rect key="frame" x="0.0" y="0.0" width="432" height="338"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
@ -858,7 +858,7 @@
</tableCellView>
</prototypeCellViews>
</tableColumn>
<tableColumn identifier="DataCellID" width="190" minWidth="40" maxWidth="1000" id="Ma5-Fz-J7v">
<tableColumn identifier="DataCellID" width="310" minWidth="40" maxWidth="1000" id="Ma5-Fz-J7v">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Disassembly">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
@ -872,11 +872,11 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="ZF1-Mn-oL5">
<rect key="frame" x="120" y="1" width="190" height="17"/>
<rect key="frame" x="120" y="1" width="310" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="gen-Zj-0O4">
<rect key="frame" x="0.0" y="0.0" width="190" height="17"/>
<rect key="frame" x="0.0" y="0.0" width="310" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="lxl-6b-xYm">
<font key="font" metaFont="fixedUser" size="11"/>
@ -904,15 +904,45 @@
<autoresizingMask key="autoresizingMask"/>
</scroller>
<tableHeaderView key="headerView" id="Ep4-FK-mkU">
<rect key="frame" x="0.0" y="0.0" width="312" height="23"/>
<rect key="frame" x="0.0" y="0.0" width="432" height="23"/>
<autoresizingMask key="autoresizingMask"/>
</tableHeaderView>
</scrollView>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="94S-pW-GeW">
<rect key="frame" x="36" y="46" width="108" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Break" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Pg2-w8-mzE">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="btn_Break:" target="XfG-lQ-9wD" id="wvE-WV-51x"/>
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="6li-po-zVA">
<rect key="frame" x="18" y="215" width="18" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="F" id="qfi-b1-PI7">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ecN-Ge-1hE">
<rect key="frame" x="42" y="210" width="96" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="4dD-B8-JHv">
<font key="font" metaFont="fixedUser" size="11"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
</view>
<connections>
<outlet property="debuggerTableView" destination="MuT-J3-VZ6" id="TMx-Do-29u"/>
<outlet property="text_CPU_A" destination="WjO-ue-iRg" id="kaI-Bh-Efs"/>
<outlet property="text_CPU_Flags" destination="ecN-Ge-1hE" id="dDw-IG-xNd"/>
<outlet property="text_CPU_IP" destination="XbV-5m-dd0" id="IoJ-th-0Ve"/>
<outlet property="text_CPU_SR" destination="5TT-BA-Iw1" id="Bnh-oz-AnZ"/>
<outlet property="text_CPU_X" destination="nOs-8C-MbH" id="71D-al-r5q"/>

View File

@ -14,6 +14,7 @@ class DebuggerViewController: NSViewController {
@IBOutlet weak var text_CPU_Y: NSTextField!
@IBOutlet weak var text_CPU_IP: NSTextField!
@IBOutlet weak var text_CPU_SR: NSTextField!
@IBOutlet weak var text_CPU_Flags: NSTextField!
@IBOutlet weak var debuggerTableView: NSTableView!
@ -26,6 +27,7 @@ class DebuggerViewController: NSViewController {
text_CPU_Y.stringValue = String(format:"%02X", CPU.index_y)
text_CPU_IP.stringValue = String(format:"%04X", CPU.program_counter)
text_CPU_SR.stringValue = String(format:"%02X", CPU.stack_pointer)
text_CPU_Flags.stringValue = String(CPU.status_register.asString())
}
override func viewDidLoad() {
@ -63,6 +65,9 @@ class DebuggerViewController: NSViewController {
cpuStep()
}
@IBAction func btn_Break(_ sender: Any) {
_ = 0
}
}
extension DebuggerViewController: NSTableViewDelegate {
@ -90,21 +95,21 @@ extension DebuggerViewController: NSTableViewDelegate {
case .accumulator:
cellText = String(format: "%@ A", operation.instruction!.mnemonic)
case .immediate:
cellText = String(format: "%@ #%02X", operation.instruction!.mnemonic, operation.data[0])
cellText = String(format: "%@ #$%02X", operation.instruction!.mnemonic, operation.data[0])
case .implied:
cellText = String(format: "%@", operation.instruction!.mnemonic)
case .relative:
cellText = String(format: "%@ #%04X", operation.instruction!.mnemonic, UInt16(operation.data[0]) + operation.address)
cellText = String(format: "%@ #$%04X", operation.instruction!.mnemonic, UInt16(operation.data[0]) + operation.address)
case .absolute:
cellText = String(format: "%@ #%02X%02X", operation.instruction!.mnemonic, operation.data[1], operation.data[0])
cellText = String(format: "%@ $%02X%02X", operation.instruction!.mnemonic, operation.data[1], operation.data[0])
case .zeropage:
cellText = String(format: "%@ $%02X", operation.instruction!.mnemonic, operation.data[0])
case .indirect:
cellText = String(format: "%@ ($%02X%02X)", operation.instruction!.mnemonic, operation.data[1], operation.data[0])
case .absolute_indexed_x:
cellText = String(format: "%@ #%02X%02X,X", operation.instruction!.mnemonic, operation.data[1], operation.data[0])
cellText = String(format: "%@ $%02X%02X,X", operation.instruction!.mnemonic, operation.data[1], operation.data[0])
case .absolute_indexed_y:
cellText = String(format: "%@ #%02X%02X,Y", operation.instruction!.mnemonic, operation.data[1], operation.data[0])
cellText = String(format: "%@ $%02X%02X,Y", operation.instruction!.mnemonic, operation.data[1], operation.data[0])
case .zeropage_indexed_x:
cellText = String(format: "%@ $%02X,X", operation.instruction!.mnemonic, operation.data[0])
case .zeropage_indexed_y:

View File

@ -92,6 +92,14 @@ let InstructionTable: [UInt8:CPUInstruction] = [
0x81: CPUInstruction(mnemonic: "STA", cycles: 6, bytes: 2, addressingMode: .indexed_indirect, action: Opcodes.STA),
0x91: CPUInstruction(mnemonic: "STA", cycles: 6, bytes: 2, addressingMode: .indirect_indexed, action: Opcodes.STA),
0x86: CPUInstruction(mnemonic: "STX", cycles: 3, bytes: 2, addressingMode: .zeropage, action: Opcodes.STX),
0x96: CPUInstruction(mnemonic: "STX", cycles: 4, bytes: 2, addressingMode: .zeropage_indexed_y, action: Opcodes.STX),
0x8E: CPUInstruction(mnemonic: "STX", cycles: 4, bytes: 3, addressingMode: .absolute, action: Opcodes.STX),
0x84: CPUInstruction(mnemonic: "STY", cycles: 3, bytes: 2, addressingMode: .zeropage, action: Opcodes.STY),
0x94: CPUInstruction(mnemonic: "STY", cycles: 4, bytes: 2, addressingMode: .zeropage_indexed_x, action: Opcodes.STY),
0x8C: CPUInstruction(mnemonic: "STY", cycles: 4, bytes: 3, addressingMode: .absolute, action: Opcodes.STY),
//Register functions
0x88: CPUInstruction(mnemonic: "DEY", cycles: 2, bytes: 1, addressingMode: .implied, action: Opcodes.DEY),
0x8A: CPUInstruction(mnemonic: "TXA", cycles: 2, bytes: 1, addressingMode: .implied, action: Opcodes.TXA),

View File

@ -22,6 +22,50 @@ struct StatusRegister {
var zero: Bool //Z - 0x02
var carry: Bool //C - 0x01
func asString() -> String {
var str = ""
if(negative) {
str += "N"
} else {
str += "-"
}
if(overflow) {
str += "V"
} else {
str += "-"
}
str += "-" //0x20 is unassigned
if(brk) {
str += "B"
} else {
str += "-"
}
if(decimal) {
str += "D"
} else {
str += "-"
}
if(irq_disable) {
str += "I"
} else {
str += "-"
}
if(zero) {
str += "Z"
} else {
str += "-"
}
return str
}
mutating func fromByte(state: UInt8) {
negative = (state & 0x80 == 0x80)
overflow = (state & 0x40 == 0x40)

View File

@ -124,6 +124,42 @@ class Opcodes: NSObject {
}
}
static func STX(state: CPUState, addressingMode: AddressingMode) -> Void {
let address: UInt16
if(addressingMode == .zeropage || addressingMode == .zeropage_indexed_y) {
address = zpAsUInt16(address: state.getOperandByte())
state.memoryInterface.writeByte(offset: address, value: state.index_x)
}
else if (addressingMode == .absolute) {
address = state.getOperandWord()
state.memoryInterface.writeByte(offset: address, value: state.index_x)
}
else {
print("Illegal addressing mode for STX")
return
}
}
static func STY(state: CPUState, addressingMode: AddressingMode) -> Void {
let address: UInt16
if(addressingMode == .zeropage || addressingMode == .zeropage_indexed_x) {
address = zpAsUInt16(address: state.getOperandByte())
state.memoryInterface.writeByte(offset: address, value: state.index_y)
}
else if (addressingMode == .absolute) {
address = state.getOperandWord()
state.memoryInterface.writeByte(offset: address, value: state.index_y)
}
else {
print("Illegal addressing mode for STY")
return
}
}
//Register instructions
static func TAX(state: CPUState, addressingMode: AddressingMode) -> Void {
state.index_x = state.accumulator
@ -231,6 +267,31 @@ class Opcodes: NSObject {
state.updateNegativeFlag(value: val);
}
//CMP
static func CMP(state: CPUState, addressingMode: AddressingMode) -> Void {
let data = state.accumulator - state.getOperandByte() //CMP is a subtract that doesn't affect memory
state.updateZeroFlag(value: data)
state.updateNegativeFlag(value: data)
state.status_register.carry = !state.status_register.negative //? check this
}
static func CPX(state: CPUState, addressingMode: AddressingMode) -> Void {
let data = state.index_x - state.getOperandByte() //CMP is a subtract that doesn't affect memory
state.updateZeroFlag(value: data)
state.updateNegativeFlag(value: data)
state.status_register.carry = !state.status_register.negative //? check this
}
static func CPY(state: CPUState, addressingMode: AddressingMode) -> Void {
let data = state.index_y - state.getOperandByte() //CMP is a subtract that doesn't affect memory
state.updateZeroFlag(value: data)
state.updateNegativeFlag(value: data)
state.status_register.carry = !state.status_register.negative //? check this
}
//Processor flag instructions
static func CLC(state: CPUState, addressingMode: AddressingMode) -> Void {
state.status_register.carry = false