mirror of
https://github.com/Luigi30/FruitMachine-Swift.git
synced 2024-11-23 02:33:00 +00:00
hires starting
This commit is contained in:
parent
7575e135b4
commit
ff51d2f4b2
@ -9,6 +9,7 @@
|
||||
/* Begin PBXBuildFile section */
|
||||
2A044E2C1F37D65A000E8085 /* LanguageCard16K.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A044E2B1F37D65A000E8085 /* LanguageCard16K.swift */; };
|
||||
2A044E2E1F382CA9000E8085 /* AppleIIPlus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A044E2D1F382CA9000E8085 /* AppleIIPlus.swift */; };
|
||||
2A07857D1F3D273E008736D2 /* HiresMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A07857C1F3D273E008736D2 /* HiresMode.swift */; };
|
||||
2A0D0C691F3C09990000913B /* Types.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A0D0C681F3C09990000913B /* Types.swift */; };
|
||||
2A16ADBB1F33C341004A0333 /* DiskImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A16ADBA1F33C341004A0333 /* DiskImage.swift */; };
|
||||
2A2126841F2A9FA300E43DC1 /* DebuggerWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A2126831F2A9FA300E43DC1 /* DebuggerWindowController.swift */; };
|
||||
@ -61,6 +62,7 @@
|
||||
/* Begin PBXFileReference section */
|
||||
2A044E2B1F37D65A000E8085 /* LanguageCard16K.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LanguageCard16K.swift; sourceTree = "<group>"; };
|
||||
2A044E2D1F382CA9000E8085 /* AppleIIPlus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppleIIPlus.swift; sourceTree = "<group>"; };
|
||||
2A07857C1F3D273E008736D2 /* HiresMode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HiresMode.swift; sourceTree = "<group>"; };
|
||||
2A0D0C681F3C09990000913B /* Types.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Types.swift; sourceTree = "<group>"; };
|
||||
2A16ADBA1F33C341004A0333 /* DiskImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiskImage.swift; sourceTree = "<group>"; };
|
||||
2A2126831F2A9FA300E43DC1 /* DebuggerWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DebuggerWindowController.swift; sourceTree = "<group>"; };
|
||||
@ -148,6 +150,7 @@
|
||||
2A86FB981F32694A00AD0C68 /* VideoModes.swift */,
|
||||
2A63C2321F32C39300D4F4F8 /* TextMode.swift */,
|
||||
2A63C2341F32C4F700D4F4F8 /* LoresMode.swift */,
|
||||
2A07857C1F3D273E008736D2 /* HiresMode.swift */,
|
||||
);
|
||||
path = Modes;
|
||||
sourceTree = "<group>";
|
||||
@ -442,6 +445,7 @@
|
||||
2AE42E0A1F28521E00C4900E /* WriteOverride.swift in Sources */,
|
||||
2A6DC7ED1F30492C0066FE0D /* ScreenDelegate.swift in Sources */,
|
||||
2A044E2C1F37D65A000E8085 /* LanguageCard16K.swift in Sources */,
|
||||
2A07857D1F3D273E008736D2 /* HiresMode.swift in Sources */,
|
||||
2A5BC5191F29A28D008C03BE /* AppleIScreenView.swift in Sources */,
|
||||
2A63C2371F32C55100D4F4F8 /* VideoHelpers.swift in Sources */,
|
||||
2A63C23A1F32CCE900D4F4F8 /* DiskII.swift in Sources */,
|
||||
|
55
FruitMachine/AppleII/Video/Modes/HiresMode.swift
Normal file
55
FruitMachine/AppleII/Video/Modes/HiresMode.swift
Normal file
@ -0,0 +1,55 @@
|
||||
//
|
||||
// HiresMode.swift
|
||||
// FruitMachine
|
||||
//
|
||||
// Created by Christopher Rohl on 8/10/17.
|
||||
// Copyright © 2017 Christopher Rohl. All rights reserved.
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
|
||||
class HiresMode: NSObject {
|
||||
static func putHiresPixel(buffer: UnsafeMutablePointer<BitmapPixelsLE555.PixelData>?, pixel: UInt8, address: UInt16) {
|
||||
let pageBase: Address
|
||||
|
||||
if(EmulatedSystemInstance!.videoSoftswitches.PAGE_2) {
|
||||
pageBase = 0x4000
|
||||
} else {
|
||||
pageBase = 0x2000
|
||||
}
|
||||
|
||||
//Convert the address into an (X,Y) pixel coordinate.
|
||||
var offset = address - 0x2000
|
||||
if(offset >= 0x2000) { //Page 2 address
|
||||
offset -= 0x2000
|
||||
}
|
||||
|
||||
//Find the row number.
|
||||
var rowNumber = offset / 0x80
|
||||
let lowByte = offset & 0x0FF
|
||||
|
||||
if(0x28 ... 0x4F ~= lowByte || 0xA8 ... 0xCF ~= lowByte) {
|
||||
//Middle third.
|
||||
rowNumber += 64
|
||||
//cellX = (lowByte & ~(0x80)) - 0x28
|
||||
}
|
||||
else if(0x50 ... 0x77 ~= lowByte || 0xD0 ... 0xF7 ~= lowByte) {
|
||||
//Bottom third.
|
||||
rowNumber += 64
|
||||
//cellX = (lowByte & ~(0x80)) - 0x50
|
||||
}
|
||||
else if(0x78 ... 0x7F ~= lowByte || 0xF8 ... 0xFF ~= lowByte) {
|
||||
//Discard.
|
||||
}
|
||||
else {
|
||||
//Top third.
|
||||
rowNumber += 0
|
||||
//cellX = (lowByte & ~(0x80))
|
||||
}
|
||||
|
||||
rowNumber += offset / 0x400
|
||||
|
||||
let columnByte = (offset & 0x0007)
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user