FruitMachine-Swift/FruitMachine/ViewController.swift

44 lines
1007 B
Swift
Raw Normal View History

2017-07-20 03:44:57 +00:00
//
// ViewController.swift
// FruitMachine
//
// Created by Christopher Rohl on 7/19/17.
// Copyright © 2017 Christopher Rohl. All rights reserved.
//
import Cocoa
class ViewController: NSViewController {
2017-07-20 06:50:28 +00:00
let CPU = CPUState.sharedInstance
2017-07-20 03:44:57 +00:00
override func viewDidLoad() {
super.viewDidLoad()
2017-07-20 06:50:28 +00:00
CPU.memoryInterface.memory[0] = 0xAD
2017-07-21 07:25:48 +00:00
CPU.memoryInterface.memory[1] = 0x34
CPU.memoryInterface.memory[2] = 0x12
CPU.memoryInterface.memory[0x1234] = 0xAA
2017-07-20 06:50:28 +00:00
do {
try CPU.executeNextInstruction()
2017-07-21 07:25:48 +00:00
try CPU.executeNextInstruction()
2017-07-20 06:50:28 +00:00
} catch CPUExceptions.invalidInstruction {
print("*** 6502 Exception: Invalid instruction 0xXX at 0xXXXX")
} catch {
print(error)
}
2017-07-20 03:44:57 +00:00
// Do any additional setup after loading the view.
}
override var representedObject: Any? {
didSet {
// Update the view, if already loaded.
}
}
}