// // TextMode.swift // FruitMachine // // Created by Christopher Rohl on 8/2/17. // Copyright © 2017 Christopher Rohl. All rights reserved. // import Cocoa extension AppleIIBase { class TextMode: NSObject { static func putGlyph(buffer: UnsafeMutablePointer?, glyph: Glyph, attributes: UInt8, pixelPosition: CGPoint) { //You better have locked the buffer before getting here... if(pixelPosition.x == -1 && pixelPosition.y == -1) { return } let ca: CharacterAttributes if(attributes == 0x00) { ca = .inverse } else if(attributes == 0x40) { ca = .flashing } else { ca = .normal } //Calculate the offset to reach the desired position. var baseOffset = EmulatedSystemInstance!.emulatorViewDelegate.scanlineOffsets[Int(pixelPosition.y) % 192] + Int(pixelPosition.x) if(EmulatedSystemInstance!.videoSoftswitches.PAGE_2) { baseOffset += 0x400 } for charY in 0..