From a9a12189af14faefdd9db3ec2cdcb72bf7547d64 Mon Sep 17 00:00:00 2001 From: Luigi Thirty Date: Fri, 11 Aug 2017 20:15:07 -0400 Subject: [PATCH] black and white high resolution graphics work --- FruitMachine/AppleII/AppleIIBase.swift | 7 +++++-- FruitMachine/AppleII/Video/Modes/HiresMode.swift | 9 ++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/FruitMachine/AppleII/AppleIIBase.swift b/FruitMachine/AppleII/AppleIIBase.swift index 5a2870e..bd1f5f9 100644 --- a/FruitMachine/AppleII/AppleIIBase.swift +++ b/FruitMachine/AppleII/AppleIIBase.swift @@ -144,10 +144,13 @@ class AppleIIBase: NSObject, EmulatedSystem { videoMode = getCurrentVideoMode(switches: videoSoftswitches) let videoMemoryStart: Address + let hgrMemoryStart: Address if(videoSoftswitches.PAGE_2) { videoMemoryStart = 0x800 + hgrMemoryStart = 0x4000 } else { videoMemoryStart = 0x400 + hgrMemoryStart = 0x2000 } if(videoMode == .Text) @@ -175,9 +178,9 @@ class AppleIIBase: NSObject, EmulatedSystem { putGlyphs(buffer: buf!, start: videoMemoryStart + 0x350, end: videoMemoryStart + 0x378) putGlyphs(buffer: buf!, start: videoMemoryStart + 0x3D0, end: videoMemoryStart + 0x3F8) } else if(videoMode == .Hires) { - + putHiresPixels(buffer: buf!, start: hgrMemoryStart, end: hgrMemoryStart + 0x1fff) } else if(videoMode == .MixedHires) { - putHiresPixels(buffer: buf!, start: 0x2000, end: 0x3fff) + putHiresPixels(buffer: buf!, start: hgrMemoryStart, end: hgrMemoryStart + 0x1fff) //Draw the bottom 4 text rows. putGlyphs(buffer: buf!, start: videoMemoryStart + 0x250, end: videoMemoryStart + 0x278) diff --git a/FruitMachine/AppleII/Video/Modes/HiresMode.swift b/FruitMachine/AppleII/Video/Modes/HiresMode.swift index 5da78db..c0473b5 100644 --- a/FruitMachine/AppleII/Video/Modes/HiresMode.swift +++ b/FruitMachine/AppleII/Video/Modes/HiresMode.swift @@ -22,10 +22,13 @@ extension AppleIIBase { } //Convert the address into an (X,Y) pixel coordinate. - var offset = address - 0x2000 + var offset = address - pageBase + + /* if(offset >= 0x2000) { //Page 2 address offset -= 0x2000 } + */ //Find the row number. var rowNumber = 0 @@ -44,6 +47,7 @@ extension AppleIIBase { } else if(0x78 ... 0x7F ~= lowByte || 0xF8 ... 0xFF ~= lowByte) { //Discard. + return } else { //Top third. @@ -67,12 +71,11 @@ extension AppleIIBase { let dot4 = (pixel & 0x10) == 0x10 let dot5 = (pixel & 0x20) == 0x20 let dot6 = (pixel & 0x40) == 0x40 - //let dot7 = (pixel & 0x80) == 0x80 let pixelRowOffset = Int(rowNumber * AppleII.ScreenDelegate.PIXEL_WIDTH) let pixelColumnOffset = Int(UInt16(columnByte) * 7) - if(pixelRowOffset + pixelColumnOffset == 17920) { + if(pixelRowOffset + pixelColumnOffset == (5 * AppleII.ScreenDelegate.PIXEL_WIDTH)) { let x = 0 }