- Splash screen

- HiRes pixel rendering improvements
This commit is contained in:
tudnai 2020-05-09 03:39:55 -07:00
parent 2805fd8869
commit ccc468ab0b
5 changed files with 82 additions and 55 deletions

View File

@ -68,6 +68,8 @@
325EB6AC2401118300C6B4A4 /* Xonix.woz in Resources */ = {isa = PBXBuildFile; fileRef = 325EB69B2401118300C6B4A4 /* Xonix.woz */; };
3262F37623E169F8008BDB95 /* spk_dn.wav in Resources */ = {isa = PBXBuildFile; fileRef = 3262F37423E169F8008BDB95 /* spk_dn.wav */; };
3262F37723E169F8008BDB95 /* spk_up.wav in Resources */ = {isa = PBXBuildFile; fileRef = 3262F37523E169F8008BDB95 /* spk_up.wav */; };
32A9F72C24668D26004902A1 /* apple-rainbow.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 32A9F72B24668D26004902A1 /* apple-rainbow.jpg */; };
32A9F72D24668D26004902A1 /* apple-rainbow.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 32A9F72B24668D26004902A1 /* apple-rainbow.jpg */; };
32BFFB5B22EACC630003B53F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32BFFB5A22EACC630003B53F /* AppDelegate.swift */; };
32BFFB5D22EACC630003B53F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32BFFB5C22EACC630003B53F /* ViewController.swift */; };
32BFFB5F22EACC660003B53F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 32BFFB5E22EACC660003B53F /* Assets.xcassets */; };
@ -186,6 +188,7 @@
3264261023284F6F008B615F /* Apple2_mmio_8bit_ioaddr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Apple2_mmio_8bit_ioaddr.h; sourceTree = "<group>"; };
326426112328ADF4008B615F /* Apple_II_ROM.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = Apple_II_ROM.s; sourceTree = "<group>"; };
326ED2EE232D7A0000A41337 /* 6502_functional_test.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; path = 6502_functional_test.bin; sourceTree = SOURCE_ROOT; };
32A9F72B24668D26004902A1 /* apple-rainbow.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "apple-rainbow.jpg"; sourceTree = "<group>"; };
32B18435233F10BC00DBB4AB /* Shaders.metal */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.metal; path = Shaders.metal; sourceTree = "<group>"; };
32B18438233FAB3900DBB4AB /* verticies.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = verticies.swift; sourceTree = "<group>"; };
32BFFB5722EACC630003B53F /* A2Mac.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = A2Mac.app; sourceTree = BUILT_PRODUCTS_DIR; };
@ -390,6 +393,7 @@
3262F37823E17013008BDB95 /* Resources */ = {
isa = PBXGroup;
children = (
32A9F72B24668D26004902A1 /* apple-rainbow.jpg */,
3262F37423E169F8008BDB95 /* spk_dn.wav */,
3262F37523E169F8008BDB95 /* spk_up.wav */,
325EB67B23FBD43800C6B4A4 /* PrintChar21.ttf */,
@ -713,6 +717,7 @@
325EB68D23FDDFD200C6B4A4 /* Merlin-8 v2.48 (DOS 3.3).woz in Resources */,
325EB6A62401118300C6B4A4 /* ProDOS_312.woz in Resources */,
325EB6AC2401118300C6B4A4 /* Xonix.woz in Resources */,
32A9F72D24668D26004902A1 /* apple-rainbow.jpg in Resources */,
323E2DCF245531E600156805 /* Apple2e_Enhanced.rom in Resources */,
325EB67D23FBD43800C6B4A4 /* PrintChar21.ttf in Resources */,
325EB6A42401118300C6B4A4 /* Qbit.woz in Resources */,
@ -749,6 +754,7 @@
3262F37723E169F8008BDB95 /* spk_up.wav in Resources */,
32089E4824556DBD0036E667 /* PRNumber3.ttf in Resources */,
325EB6A92401118300C6B4A4 /* Sneakers.woz in Resources */,
32A9F72C24668D26004902A1 /* apple-rainbow.jpg in Resources */,
325EB6A72401118300C6B4A4 /* ProDOS_402_System.woz in Resources */,
325EB69023FE028800C6B4A4 /* Donkey Kong.woz in Resources */,
325EB68923FDDF6200C6B4A4 /* Hard Hat Mack - Disk 1, Side A.woz in Resources */,

View File

@ -789,7 +789,7 @@
<scene sceneID="hIz-AP-VOD">
<objects>
<viewController id="XfG-lQ-9wD" customClass="ViewController" customModule="A2Mac" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" canDrawConcurrently="YES" id="m2S-Jp-Qdl" customClass="MonitorView" customModule="A2Mac" customModuleProvider="target">
<view key="view" wantsLayer="YES" canDrawConcurrently="YES" id="m2S-Jp-Qdl" customClass="MonitorView" customModule="A2Mac" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="1288" height="800"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
@ -804,7 +804,7 @@
</allowedInputSourceLocales>
</textFieldCell>
</textField>
<textField canDrawConcurrently="YES" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" mirrorLayoutDirectionWhenInternationalizing="never" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SEL-hl-0c0">
<textField canDrawConcurrently="YES" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" alphaValue="0.0" mirrorLayoutDirectionWhenInternationalizing="never" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SEL-hl-0c0">
<rect key="frame" x="14" y="16" width="1124" height="768"/>
<constraints>
<constraint firstAttribute="width" secondItem="SEL-hl-0c0" secondAttribute="height" multiplier="35:24" id="4LP-hK-Xit"/>
@ -837,16 +837,22 @@
@@@@@@@@@@@@@@@@@@22@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@23@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@24@@@@@@@@@@@@@@@@@@@@</string>
<color key="textColor" red="0.93333333333333335" green="0.93333333333333335" blue="0.93333333333333335" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="textColor" name="systemGreenColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<customView canDrawConcurrently="YES" translatesAutoresizingMaskIntoConstraints="NO" id="LlM-EV-ruZ" customClass="HiRes" customModule="A2Mac" customModuleProvider="target">
<customView hidden="YES" canDrawConcurrently="YES" translatesAutoresizingMaskIntoConstraints="NO" id="LlM-EV-ruZ" customClass="HiRes" customModule="A2Mac" customModuleProvider="target">
<rect key="frame" x="16" y="16" width="1120" height="768"/>
</customView>
<imageView hidden="YES" canDrawConcurrently="YES" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="M1E-lz-4q8" userLabel="HiRes Image View">
<imageView canDrawConcurrently="YES" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="M1E-lz-4q8" userLabel="Splash Screen">
<rect key="frame" x="16" y="16" width="1120" height="768"/>
<imageCell key="cell" continuous="YES" enabled="NO" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSQuickLookTemplate" id="Zax-kI-rxd"/>
<ciFilter key="compositingFilter" name="CIExclusionBlendMode">
<configuration>
<null key="inputBackgroundImage"/>
<null key="inputImage"/>
</configuration>
</ciFilter>
<imageCell key="cell" continuous="YES" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="apple-rainbow" id="Zax-kI-rxd"/>
</imageView>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="Fdf-pv-iEw" userLabel="Side Panel">
<rect key="frame" x="1160" y="8" width="120" height="784"/>
@ -1040,6 +1046,7 @@
<outlet property="displayField" destination="SEL-hl-0c0" id="4Pc-hG-qQf"/>
<outlet property="hires" destination="LlM-EV-ruZ" id="E60-pA-HM1"/>
<outlet property="speedometer" destination="FBZ-dh-6Fs" id="L0v-RY-xwB"/>
<outlet property="splashScreen" destination="M1E-lz-4q8" id="xc3-CZ-dRf"/>
</connections>
</viewController>
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
@ -1074,6 +1081,6 @@
</scene>
</scenes>
<resources>
<image name="NSQuickLookTemplate" width="19" height="12"/>
<image name="apple-rainbow" width="800" height="800"/>
</resources>
</document>

View File

@ -400,7 +400,7 @@ class HiRes: NSView {
static let ScreenBitmapSize = (PixelWidth * PixelHeight * 4)
static let context = createBitmapContext(pixelsWide: PixelWidth, PixelHeight)
static let pixels = UnsafeMutableRawBufferPointer(start: context?.data, count: ScreenBitmapSize)
static var typedPointer = pixels.bindMemory(to: UInt32.self)
static var pixelsRGBA = pixels.bindMemory(to: UInt32.self)
#endif
let R = 2
@ -499,24 +499,21 @@ class HiRes: NSView {
break
case 0x01: // purple (bits are in reverse!)
HiRes.typedPointer[colorAddr] = color_purple;
// HiRes.typedPointer[colorAddr + 1] = color_black;
HiRes.pixelsRGBA[colorAddr] = color_purple;
if (prev != 0x03) && (prev != 0x07) && (prev != 0x00) && (prev != 0x04) {
HiRes.pixelsRGBA[colorAddr - 1] = color_purple;
}
case 0x02: // green
// reducing color bleeding
if (prev == 0x01) ||
(prev == 0x05)
{
// HiRes.typedPointer[colorAddr + 1] = color_black;
}
else {
HiRes.typedPointer[colorAddr] = color_green;
HiRes.typedPointer[colorAddr + 1] = color_green;
if (colorAddr > 0) && (HiRes.pixelsRGBA[colorAddr - 1] != color_black) {
HiRes.pixelsRGBA[colorAddr] = color_green;
}
HiRes.pixelsRGBA[colorAddr + 1] = color_green;
case 0x03: // white
HiRes.typedPointer[colorAddr] = color_white;
HiRes.typedPointer[colorAddr + 1] = color_white;
HiRes.pixelsRGBA[colorAddr] = color_white;
HiRes.pixelsRGBA[colorAddr + 1] = color_white;
case 0x04: // black 2
// HiRes.typedPointer[colorAddr] = color_black;
@ -524,24 +521,21 @@ class HiRes: NSView {
break
case 0x05: // blue
HiRes.typedPointer[colorAddr] = color_blue;
// HiRes.typedPointer[colorAddr + 1] = color_black;
HiRes.pixelsRGBA[colorAddr] = color_blue;
if (prev != 0x03) && (prev != 0x07) && (prev != 0x00) && (prev != 0x04) {
HiRes.pixelsRGBA[colorAddr - 1] = color_blue;
}
case 0x06: // orange
// reducing color bleeding
if (prev == 0x01) ||
(prev == 0x05)
{
// HiRes.typedPointer[colorAddr + 1] = color_black;
if (colorAddr > 0) && (HiRes.pixelsRGBA[colorAddr - 1] != color_black) {
HiRes.pixelsRGBA[colorAddr] = color_orange;
}
else {
HiRes.typedPointer[colorAddr] = color_orange;
HiRes.typedPointer[colorAddr + 1] = color_orange;
}
HiRes.pixelsRGBA[colorAddr + 1] = color_orange;
case 0x07: // white 2
HiRes.typedPointer[colorAddr] = color_white;
HiRes.typedPointer[colorAddr + 1] = color_white;
HiRes.pixelsRGBA[colorAddr] = color_white;
HiRes.pixelsRGBA[colorAddr + 1] = color_white;
default:
// HiRes.typedPointer[colorAddr] = color_black;
@ -551,40 +545,39 @@ class HiRes: NSView {
// white adjustment
if ( (prev & 2) == 2 ) && ( (pixel & 1) == 1 ) {
HiRes.typedPointer[colorAddr] = color_white;
HiRes.typedPointer[colorAddr - 1] = color_white;
HiRes.pixelsRGBA[colorAddr] = color_white;
HiRes.pixelsRGBA[colorAddr - 1] = color_white;
// TODO: Need better check if extra green was created
if (HiRes.pixels[pixelAddr - 8 + G] == 0xA2 ) {
HiRes.typedPointer[colorAddr - 2] = color_black;
HiRes.pixelsRGBA[colorAddr - 2] = color_black;
}
}
// purple adjustment -- followed by white
else if (prev == 0x01) && (
(pixel == 0x01) ||
(pixel == 0x03) || (pixel == 0x07) || // white
(pixel == 0x00) || (pixel == 0x04) // black
(pixel == 0x03) || (pixel == 0x07) // white
// (pixel == 0x00) || (pixel == 0x04) // black
) {
// was the previous purple pixel promoted to white or is it still purple?
if ( HiRes.pixels[pixelAddr - 8 + R] == 0xBB ) {
HiRes.typedPointer[colorAddr - 1] = color_purple;
if ( HiRes.pixelsRGBA[colorAddr - 2] == color_purple ) {
HiRes.pixelsRGBA[colorAddr - 1] = color_purple;
}
}
// blue adjustment -- followed by white
else if (prev == 0x05) && (
(pixel == 0x05) ||
(pixel == 0x03) || (pixel == 0x07) || // white
(pixel == 0x00) || (pixel == 0x04) // black
(pixel == 0x03) || (pixel == 0x07) // white
// (pixel == 0x00) || (pixel == 0x04) // black
) {
// was the previous purple pixel promoted to white or is it still purple?
if ( HiRes.pixels[pixelAddr - 8 + R] == 0x11 ) {
HiRes.typedPointer[colorAddr - 1] = color_blue;
// was the previous blue pixel promoted to white or is it still blue?
if ( HiRes.pixelsRGBA[colorAddr - 2] == color_blue ) {
HiRes.pixelsRGBA[colorAddr - 1] = color_blue;
}
}
}
@ -669,6 +662,8 @@ class HiRes: NSView {
// refresh changed block only
let screenBlockMargin = 6
let blockScreenWidth = Int(frame.width) / HiRes.blockCols * 2
let blockScreenHeigth = Int(frame.height) / HiRes.blockRows
@ -677,10 +672,10 @@ class HiRes: NSView {
if blockChanged[ blockVertIdx * HiRes.blockCols / 2 + blockHorIdx ] {
// refresh the entire screen
let boundingBox = CGRect(
x: blockHorIdx * blockScreenWidth - 2,
y: Int(frame.height) - blockVertIdx * blockScreenHeigth - blockScreenHeigth - 2,
width: blockScreenWidth + 4,
height: blockScreenHeigth + 4)
x: blockHorIdx * blockScreenWidth - screenBlockMargin,
y: Int(frame.height) - blockVertIdx * blockScreenHeigth - blockScreenHeigth - screenBlockMargin,
width: blockScreenWidth + screenBlockMargin * 2,
height: blockScreenHeigth + screenBlockMargin * 2)
self.setNeedsDisplay( boundingBox )
}

View File

@ -50,6 +50,7 @@ class ViewController: NSViewController {
@IBOutlet weak var display: NSTextFieldCell!
@IBOutlet weak var speedometer: NSTextFieldCell!
@IBOutlet weak var hires: HiRes!
@IBOutlet weak var splashScreen: NSImageView!
// static let charConvStr : String =
@ -101,6 +102,28 @@ class ViewController: NSViewController {
var workItem : DispatchWorkItem? = nil;
@IBAction func Power(_ sender: Any) {
//------------------------------------------------------------
// Animated Splash Screen fade out and (Text) Monitor fade in
displayField.alphaValue = 0
displayField.isHidden = false
splashScreen.alphaValue = 1
splashScreen.isHidden = false
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
NSAnimationContext.runAnimationGroup({ (context) in
context.duration = 1.0
// Use the value you want to animate to (NOT the starting value)
self.displayField.animator().alphaValue = 1
self.splashScreen.animator().alphaValue = 0
},
completionHandler:{ () -> Void in
self.displayField.alphaValue = 1
self.splashScreen.isHidden = true
})
}
//------------------------------------------------------------
#if SPEEDTEST
if ( workItem != nil ) {
@ -624,11 +647,7 @@ class ViewController: NSViewController {
override func viewDidLoad() {
super.viewDidLoad()
// for y in 0 ... textLines - 1 {
// txtClear[ y * (textCols + lineEndChars) + textCols * 2 + 1 ] = "\n"
// }
hires.needsDisplay = true;
hires.clearScreen();
woz_loadFile( Bundle.main.resourcePath, "Apple DOS 3.3 January 1983.woz" )

BIN
Resources/apple-rainbow.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB