mirror of
https://github.com/Luigi30/FruitMachine-Swift.git
synced 2024-11-26 21:52:45 +00:00
page 2
This commit is contained in:
parent
6a149b3365
commit
cfb764b85a
@ -142,30 +142,37 @@ class AppleIIBase: NSObject, EmulatedSystem {
|
|||||||
|
|
||||||
videoMode = getCurrentVideoMode(switches: videoSoftswitches)
|
videoMode = getCurrentVideoMode(switches: videoSoftswitches)
|
||||||
|
|
||||||
|
let videoMemoryStart: Address
|
||||||
|
if(videoSoftswitches.PAGE_2) {
|
||||||
|
videoMemoryStart = 0x800
|
||||||
|
} else {
|
||||||
|
videoMemoryStart = 0x400
|
||||||
|
}
|
||||||
|
|
||||||
if(videoMode == .Text)
|
if(videoMode == .Text)
|
||||||
{
|
{
|
||||||
//Text mode: Get character codes from $0400-$07FF
|
//Text mode: Get character codes from $0400-$07FF
|
||||||
putGlyphs(buffer: buf!, start: 0x400, end: 0x7F8)
|
putGlyphs(buffer: buf!, start: videoMemoryStart, end: videoMemoryStart + 0x3F8)
|
||||||
}
|
}
|
||||||
else if(videoMode == .Lores)
|
else if(videoMode == .Lores)
|
||||||
{
|
{
|
||||||
putLoresPixels(buffer: buf!, start: 0x400, end: 0x7F8)
|
putLoresPixels(buffer: buf!, start: videoMemoryStart, end: videoMemoryStart + 0x3F8)
|
||||||
}
|
}
|
||||||
else if(videoMode == .MixedLores) {
|
else if(videoMode == .MixedLores) {
|
||||||
//Draw the lores pixel rows.
|
//Draw the lores pixel rows.
|
||||||
putLoresPixels(buffer: buf!, start: 0x400, end: 0x650)
|
putLoresPixels(buffer: buf!, start: videoMemoryStart, end: videoMemoryStart + 0x250)
|
||||||
putLoresPixels(buffer: buf!, start: 0x680, end: 0x6A8)
|
putLoresPixels(buffer: buf!, start: videoMemoryStart + 0x280, end: videoMemoryStart + 0x2A8)
|
||||||
putLoresPixels(buffer: buf!, start: 0x700, end: 0x728)
|
putLoresPixels(buffer: buf!, start: videoMemoryStart + 0x300, end: videoMemoryStart + 0x328)
|
||||||
putLoresPixels(buffer: buf!, start: 0x780, end: 0x7A8)
|
putLoresPixels(buffer: buf!, start: videoMemoryStart + 0x380, end: videoMemoryStart + 0x3A8)
|
||||||
putLoresPixels(buffer: buf!, start: 0x6A8, end: 0x6D0)
|
putLoresPixels(buffer: buf!, start: videoMemoryStart + 0x2A8, end: videoMemoryStart + 0x2D0)
|
||||||
putLoresPixels(buffer: buf!, start: 0x728, end: 0x750)
|
putLoresPixels(buffer: buf!, start: videoMemoryStart + 0x328, end: videoMemoryStart + 0x350)
|
||||||
putLoresPixels(buffer: buf!, start: 0x7A8, end: 0x7D0)
|
putLoresPixels(buffer: buf!, start: videoMemoryStart + 0x3A8, end: videoMemoryStart + 0x3D0)
|
||||||
|
|
||||||
//Draw the bottom 4 text rows.
|
//Draw the bottom 4 text rows.
|
||||||
putGlyphs(buffer: buf!, start: 0x650, end: 0x678)
|
putGlyphs(buffer: buf!, start: videoMemoryStart + 0x250, end: videoMemoryStart + 0x278)
|
||||||
putGlyphs(buffer: buf!, start: 0x6D0, end: 0x6F8)
|
putGlyphs(buffer: buf!, start: videoMemoryStart + 0x2D0, end: videoMemoryStart + 0x2F8)
|
||||||
putGlyphs(buffer: buf!, start: 0x750, end: 0x778)
|
putGlyphs(buffer: buf!, start: videoMemoryStart + 0x350, end: videoMemoryStart + 0x378)
|
||||||
putGlyphs(buffer: buf!, start: 0x7D0, end: 0x7F8)
|
putGlyphs(buffer: buf!, start: videoMemoryStart + 0x3D0, end: videoMemoryStart + 0x3F8)
|
||||||
} else {
|
} else {
|
||||||
print("Unimplemented video mode!")
|
print("Unimplemented video mode!")
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ extension AppleIIBase {
|
|||||||
static let switchC055R = ReadOverride(start: 0xC055, end: 0xC055, readAnyway: false, action: SoftswitchOverrides.actionSwitchC055)
|
static let switchC055R = ReadOverride(start: 0xC055, end: 0xC055, readAnyway: false, action: SoftswitchOverrides.actionSwitchC055)
|
||||||
static let switchC055W = WriteOverride(start: 0xC055, end: 0xC055, writeAnyway: false, action: SoftswitchOverrides.actionSwitchC055)
|
static let switchC055W = WriteOverride(start: 0xC055, end: 0xC055, writeAnyway: false, action: SoftswitchOverrides.actionSwitchC055)
|
||||||
static func actionSwitchC055(dummy: AnyObject, address: UInt16, byte: UInt8?) -> UInt8? {
|
static func actionSwitchC055(dummy: AnyObject, address: UInt16, byte: UInt8?) -> UInt8? {
|
||||||
EmulatedSystemInstance!.videoSoftswitches.MIX_MODE = true
|
EmulatedSystemInstance!.videoSoftswitches.PAGE_2 = true
|
||||||
return 0x00
|
return 0x00
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ extension AppleIIBase {
|
|||||||
|
|
||||||
class LoresMode: NSObject {
|
class LoresMode: NSObject {
|
||||||
static func putLoresPixel(buffer: UnsafeMutablePointer<BitmapPixelsLE555.PixelData>?, pixel: UInt8, address: UInt16) {
|
static func putLoresPixel(buffer: UnsafeMutablePointer<BitmapPixelsLE555.PixelData>?, pixel: UInt8, address: UInt16) {
|
||||||
|
|
||||||
let pageOffset = address - 0x400
|
let pageOffset = address - 0x400
|
||||||
let pixelPosition = VideoHelpers.getPixelOffset(memoryOffset: Int(pageOffset))
|
let pixelPosition = VideoHelpers.getPixelOffset(memoryOffset: Int(pageOffset))
|
||||||
if(pixelPosition.x == -1 && pixelPosition.y == -1) {
|
if(pixelPosition.x == -1 && pixelPosition.y == -1) {
|
||||||
|
@ -25,7 +25,11 @@ extension AppleIIBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Calculate the offset to reach the desired position.
|
//Calculate the offset to reach the desired position.
|
||||||
let baseOffset = EmulatedSystemInstance!.emulatorViewDelegate.scanlineOffsets[Int(pixelPosition.y)] + Int(pixelPosition.x)
|
var baseOffset = EmulatedSystemInstance!.emulatorViewDelegate.scanlineOffsets[Int(pixelPosition.y) % 192] + Int(pixelPosition.x)
|
||||||
|
|
||||||
|
if(EmulatedSystemInstance!.videoSoftswitches.PAGE_2) {
|
||||||
|
baseOffset += 0x400
|
||||||
|
}
|
||||||
|
|
||||||
for charY in 0..<AppleII.A2CharacterGenerator.CHAR_HEIGHT {
|
for charY in 0..<AppleII.A2CharacterGenerator.CHAR_HEIGHT {
|
||||||
let offset = baseOffset + (AppleII.ScreenDelegate.PIXEL_WIDTH * charY)
|
let offset = baseOffset + (AppleII.ScreenDelegate.PIXEL_WIDTH * charY)
|
||||||
|
@ -10,6 +10,9 @@ import Cocoa
|
|||||||
|
|
||||||
extension AppleIIBase {
|
extension AppleIIBase {
|
||||||
|
|
||||||
|
static let PAGE1_BASE: Address = 0x400
|
||||||
|
static let PAGE2_BASE: Address = 0x800
|
||||||
|
|
||||||
typealias Softswitch = Bool
|
typealias Softswitch = Bool
|
||||||
|
|
||||||
struct VideoSoftswitches {
|
struct VideoSoftswitches {
|
||||||
|
Loading…
Reference in New Issue
Block a user