- Proper Graphics - Text switching

- Suports graphics buffer (Page) changes
- Supports Mixed mode
This commit is contained in:
Tamas Rudnai 2020-02-22 16:37:54 -08:00
parent 16cc896c0c
commit 44968a5db3
37 changed files with 1529 additions and 179 deletions

View File

@ -20,6 +20,45 @@
325EB64F23FBBAD100C6B4A4 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 325EB64D23FBBAD100C6B4A4 /* LaunchScreen.storyboard */; };
325EB65A23FBBAD100C6B4A4 /* A2iOSTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 325EB65923FBBAD100C6B4A4 /* A2iOSTests.swift */; };
325EB66523FBBAD100C6B4A4 /* A2iOSUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 325EB66423FBBAD100C6B4A4 /* A2iOSUITests.swift */; };
325EB67423FBC0AA00C6B4A4 /* RepeatingTimer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C45305232E3EEF0000EBA1 /* RepeatingTimer.swift */; };
325EB67523FBC43E00C6B4A4 /* 6502.c in Sources */ = {isa = PBXBuildFile; fileRef = 32439F7422ECD8AD0077AAE0 /* 6502.c */; };
325EB67623FBC44400C6B4A4 /* common.c in Sources */ = {isa = PBXBuildFile; fileRef = 325EB63823F9E48100C6B4A4 /* common.c */; };
325EB67723FBC45300C6B4A4 /* woz.c in Sources */ = {isa = PBXBuildFile; fileRef = 325EB62E23F8856F00C6B4A4 /* woz.c */; };
325EB67823FBC45300C6B4A4 /* disk.c in Sources */ = {isa = PBXBuildFile; fileRef = 325EB63523F8F78300C6B4A4 /* disk.c */; };
325EB67923FBC48400C6B4A4 /* spk_dn.wav in Resources */ = {isa = PBXBuildFile; fileRef = 3262F37423E169F8008BDB95 /* spk_dn.wav */; };
325EB67A23FBC48400C6B4A4 /* spk_up.wav in Resources */ = {isa = PBXBuildFile; fileRef = 3262F37523E169F8008BDB95 /* spk_up.wav */; };
325EB67C23FBD43800C6B4A4 /* PrintChar21.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 325EB67B23FBD43800C6B4A4 /* PrintChar21.ttf */; };
325EB67D23FBD43800C6B4A4 /* PrintChar21.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 325EB67B23FBD43800C6B4A4 /* PrintChar21.ttf */; };
325EB67E23FBDEE700C6B4A4 /* apple.rom in Resources */ = {isa = PBXBuildFile; fileRef = 32439F8422ECD8AD0077AAE0 /* apple.rom */; };
325EB68023FBDF8F00C6B4A4 /* Apple2Plus.rom in Resources */ = {isa = PBXBuildFile; fileRef = 325EB67F23FBDF8F00C6B4A4 /* Apple2Plus.rom */; };
325EB68123FBDF8F00C6B4A4 /* Apple2Plus.rom in Resources */ = {isa = PBXBuildFile; fileRef = 325EB67F23FBDF8F00C6B4A4 /* Apple2Plus.rom */; };
325EB68323FBDFBB00C6B4A4 /* DISK_II_C600.ROM in Resources */ = {isa = PBXBuildFile; fileRef = 325EB68223FBDFBA00C6B4A4 /* DISK_II_C600.ROM */; };
325EB68423FBDFBB00C6B4A4 /* DISK_II_C600.ROM in Resources */ = {isa = PBXBuildFile; fileRef = 325EB68223FBDFBA00C6B4A4 /* DISK_II_C600.ROM */; };
325EB68623FC707A00C6B4A4 /* Apple DOS 3.3 January 1983.woz in Resources */ = {isa = PBXBuildFile; fileRef = 325EB68523FC707A00C6B4A4 /* Apple DOS 3.3 January 1983.woz */; };
325EB68723FC707A00C6B4A4 /* Apple DOS 3.3 January 1983.woz in Resources */ = {isa = PBXBuildFile; fileRef = 325EB68523FC707A00C6B4A4 /* Apple DOS 3.3 January 1983.woz */; };
325EB68923FDDF6200C6B4A4 /* Hard Hat Mack - Disk 1, Side A.woz in Resources */ = {isa = PBXBuildFile; fileRef = 325EB68823FDDF6200C6B4A4 /* Hard Hat Mack - Disk 1, Side A.woz */; };
325EB68A23FDDF6200C6B4A4 /* Hard Hat Mack - Disk 1, Side A.woz in Resources */ = {isa = PBXBuildFile; fileRef = 325EB68823FDDF6200C6B4A4 /* Hard Hat Mack - Disk 1, Side A.woz */; };
325EB68C23FDDFD200C6B4A4 /* Merlin-8 v2.48 (DOS 3.3).woz in Resources */ = {isa = PBXBuildFile; fileRef = 325EB68B23FDDFD200C6B4A4 /* Merlin-8 v2.48 (DOS 3.3).woz */; };
325EB68D23FDDFD200C6B4A4 /* Merlin-8 v2.48 (DOS 3.3).woz in Resources */ = {isa = PBXBuildFile; fileRef = 325EB68B23FDDFD200C6B4A4 /* Merlin-8 v2.48 (DOS 3.3).woz */; };
325EB69023FE028800C6B4A4 /* Donkey Kong.woz in Resources */ = {isa = PBXBuildFile; fileRef = 325EB68F23FE028800C6B4A4 /* Donkey Kong.woz */; };
325EB69123FE028800C6B4A4 /* Donkey Kong.woz in Resources */ = {isa = PBXBuildFile; fileRef = 325EB68F23FE028800C6B4A4 /* Donkey Kong.woz */; };
325EB69323FE6C6200C6B4A4 /* HiRes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32DBF7632334657900DD50E7 /* HiRes.swift */; };
325EB69D2401118300C6B4A4 /* Lode Runner.woz in Resources */ = {isa = PBXBuildFile; fileRef = 325EB6942401118200C6B4A4 /* Lode Runner.woz */; };
325EB69E2401118300C6B4A4 /* Lode Runner.woz in Resources */ = {isa = PBXBuildFile; fileRef = 325EB6942401118200C6B4A4 /* Lode Runner.woz */; };
325EB69F2401118300C6B4A4 /* Crossfire.woz in Resources */ = {isa = PBXBuildFile; fileRef = 325EB6952401118200C6B4A4 /* Crossfire.woz */; };
325EB6A02401118300C6B4A4 /* Crossfire.woz in Resources */ = {isa = PBXBuildFile; fileRef = 325EB6952401118200C6B4A4 /* Crossfire.woz */; };
325EB6A12401118300C6B4A4 /* Wavy Navy.woz in Resources */ = {isa = PBXBuildFile; fileRef = 325EB6962401118200C6B4A4 /* Wavy Navy.woz */; };
325EB6A22401118300C6B4A4 /* Wavy Navy.woz in Resources */ = {isa = PBXBuildFile; fileRef = 325EB6962401118200C6B4A4 /* Wavy Navy.woz */; };
325EB6A32401118300C6B4A4 /* qbit.woz in Resources */ = {isa = PBXBuildFile; fileRef = 325EB6972401118200C6B4A4 /* qbit.woz */; };
325EB6A42401118300C6B4A4 /* qbit.woz in Resources */ = {isa = PBXBuildFile; fileRef = 325EB6972401118200C6B4A4 /* qbit.woz */; };
325EB6A52401118300C6B4A4 /* ProDOS_312.woz in Resources */ = {isa = PBXBuildFile; fileRef = 325EB6982401118200C6B4A4 /* ProDOS_312.woz */; };
325EB6A62401118300C6B4A4 /* ProDOS_312.woz in Resources */ = {isa = PBXBuildFile; fileRef = 325EB6982401118200C6B4A4 /* ProDOS_312.woz */; };
325EB6A72401118300C6B4A4 /* ProDOS_402_System.woz in Resources */ = {isa = PBXBuildFile; fileRef = 325EB6992401118200C6B4A4 /* ProDOS_402_System.woz */; };
325EB6A82401118300C6B4A4 /* ProDOS_402_System.woz in Resources */ = {isa = PBXBuildFile; fileRef = 325EB6992401118200C6B4A4 /* ProDOS_402_System.woz */; };
325EB6A92401118300C6B4A4 /* Sneakers.woz in Resources */ = {isa = PBXBuildFile; fileRef = 325EB69A2401118300C6B4A4 /* Sneakers.woz */; };
325EB6AA2401118300C6B4A4 /* Sneakers.woz in Resources */ = {isa = PBXBuildFile; fileRef = 325EB69A2401118300C6B4A4 /* Sneakers.woz */; };
325EB6AB2401118300C6B4A4 /* Xonix.woz in Resources */ = {isa = PBXBuildFile; fileRef = 325EB69B2401118300C6B4A4 /* Xonix.woz */; };
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 */; };
326ED2EF232D7A0000A41337 /* 6502_functional_test.bin in Resources */ = {isa = PBXBuildFile; fileRef = 326ED2EE232D7A0000A41337 /* 6502_functional_test.bin */; };
@ -32,7 +71,6 @@
32C4530B2331F7220000EBA1 /* 6502.c in Sources */ = {isa = PBXBuildFile; fileRef = 32439F7422ECD8AD0077AAE0 /* 6502.c */; };
32C4530C2331F7220000EBA1 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32BFFB5C22EACC630003B53F /* ViewController.swift */; };
32C4530D2331F7220000EBA1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32BFFB5A22EACC630003B53F /* AppDelegate.swift */; };
32C4530E2331F7220000EBA1 /* RepeatingTimer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C45305232E3EEF0000EBA1 /* RepeatingTimer.swift */; };
32C453112331F7220000EBA1 /* fail1.txt in Resources */ = {isa = PBXBuildFile; fileRef = 32EDB7A123272CA80073AF2D /* fail1.txt */; };
32C453122331F7220000EBA1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 32BFFB5E22EACC660003B53F /* Assets.xcassets */; };
32C453132331F7220000EBA1 /* apple.rom in Resources */ = {isa = PBXBuildFile; fileRef = 32439F8422ECD8AD0077AAE0 /* apple.rom */; };
@ -40,7 +78,6 @@
32C4531D2331FED90000EBA1 /* 6502.c in Sources */ = {isa = PBXBuildFile; fileRef = 32439F7422ECD8AD0077AAE0 /* 6502.c */; };
32C4531E2331FED90000EBA1 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32BFFB5C22EACC630003B53F /* ViewController.swift */; };
32C4531F2331FED90000EBA1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32BFFB5A22EACC630003B53F /* AppDelegate.swift */; };
32C453202331FED90000EBA1 /* RepeatingTimer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C45305232E3EEF0000EBA1 /* RepeatingTimer.swift */; };
32C453232331FED90000EBA1 /* fail1.txt in Resources */ = {isa = PBXBuildFile; fileRef = 32EDB7A123272CA80073AF2D /* fail1.txt */; };
32C453242331FED90000EBA1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 32BFFB5E22EACC660003B53F /* Assets.xcassets */; };
32C453252331FED90000EBA1 /* apple.rom in Resources */ = {isa = PBXBuildFile; fileRef = 32439F8422ECD8AD0077AAE0 /* apple.rom */; };
@ -51,10 +88,6 @@
32C4533123335E560000EBA1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 32BFFB6022EACC660003B53F /* Main.storyboard */; };
32C4533223335E570000EBA1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 32BFFB6022EACC660003B53F /* Main.storyboard */; };
32C4533323335E570000EBA1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 32BFFB6022EACC660003B53F /* Main.storyboard */; };
32DBF7642334657900DD50E7 /* HiRes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32DBF7632334657900DD50E7 /* HiRes.swift */; };
32DBF7652334657900DD50E7 /* HiRes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32DBF7632334657900DD50E7 /* HiRes.swift */; };
32DBF7662334657900DD50E7 /* HiRes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32DBF7632334657900DD50E7 /* HiRes.swift */; };
32EDB7A223272CA80073AF2D /* fail1.txt in Resources */ = {isa = PBXBuildFile; fileRef = 32EDB7A123272CA80073AF2D /* fail1.txt */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -128,6 +161,22 @@
325EB66023FBBAD100C6B4A4 /* A2iOSUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = A2iOSUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
325EB66423FBBAD100C6B4A4 /* A2iOSUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = A2iOSUITests.swift; sourceTree = "<group>"; };
325EB66623FBBAD100C6B4A4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
325EB67323FBBF0C00C6B4A4 /* A2iOS-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "A2iOS-Bridging-Header.h"; sourceTree = "<group>"; };
325EB67B23FBD43800C6B4A4 /* PrintChar21.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = PrintChar21.ttf; sourceTree = "<group>"; };
325EB67F23FBDF8F00C6B4A4 /* Apple2Plus.rom */ = {isa = PBXFileReference; lastKnownFileType = file; path = Apple2Plus.rom; sourceTree = "<group>"; };
325EB68223FBDFBA00C6B4A4 /* DISK_II_C600.ROM */ = {isa = PBXFileReference; lastKnownFileType = file; path = DISK_II_C600.ROM; sourceTree = "<group>"; };
325EB68523FC707A00C6B4A4 /* Apple DOS 3.3 January 1983.woz */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Apple DOS 3.3 January 1983.woz"; sourceTree = "<group>"; };
325EB68823FDDF6200C6B4A4 /* Hard Hat Mack - Disk 1, Side A.woz */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Hard Hat Mack - Disk 1, Side A.woz"; sourceTree = "<group>"; };
325EB68B23FDDFD200C6B4A4 /* Merlin-8 v2.48 (DOS 3.3).woz */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Merlin-8 v2.48 (DOS 3.3).woz"; sourceTree = "<group>"; };
325EB68F23FE028800C6B4A4 /* Donkey Kong.woz */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Donkey Kong.woz"; sourceTree = "<group>"; };
325EB6942401118200C6B4A4 /* Lode Runner.woz */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Lode Runner.woz"; sourceTree = "<group>"; };
325EB6952401118200C6B4A4 /* Crossfire.woz */ = {isa = PBXFileReference; lastKnownFileType = file; path = Crossfire.woz; sourceTree = "<group>"; };
325EB6962401118200C6B4A4 /* Wavy Navy.woz */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Wavy Navy.woz"; sourceTree = "<group>"; };
325EB6972401118200C6B4A4 /* qbit.woz */ = {isa = PBXFileReference; lastKnownFileType = file; path = qbit.woz; sourceTree = "<group>"; };
325EB6982401118200C6B4A4 /* ProDOS_312.woz */ = {isa = PBXFileReference; lastKnownFileType = file; path = ProDOS_312.woz; sourceTree = "<group>"; };
325EB6992401118200C6B4A4 /* ProDOS_402_System.woz */ = {isa = PBXFileReference; lastKnownFileType = file; path = ProDOS_402_System.woz; sourceTree = "<group>"; };
325EB69A2401118300C6B4A4 /* Sneakers.woz */ = {isa = PBXFileReference; lastKnownFileType = file; path = Sneakers.woz; sourceTree = "<group>"; };
325EB69B2401118300C6B4A4 /* Xonix.woz */ = {isa = PBXFileReference; lastKnownFileType = file; path = Xonix.woz; sourceTree = "<group>"; };
3262F37423E169F8008BDB95 /* spk_dn.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = spk_dn.wav; sourceTree = "<group>"; };
3262F37523E169F8008BDB95 /* spk_up.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = spk_up.wav; sourceTree = "<group>"; };
3264261023284F6F008B615F /* Apple2_mmio_8bit_ioaddr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Apple2_mmio_8bit_ioaddr.h; sourceTree = "<group>"; };
@ -274,6 +323,7 @@
325EB63723F9492200C6B4A4 /* util */ = {
isa = PBXGroup;
children = (
32C45305232E3EEF0000EBA1 /* RepeatingTimer.swift */,
32439F8622ECD8AD0077AAE0 /* common.h */,
325EB63823F9E48100C6B4A4 /* common.c */,
32DBF76723373FB400DD50E7 /* disassembler.h */,
@ -310,6 +360,7 @@
325EB64B23FBBAD100C6B4A4 /* Assets.xcassets */,
325EB64D23FBBAD100C6B4A4 /* LaunchScreen.storyboard */,
325EB65023FBBAD100C6B4A4 /* Info.plist */,
325EB67323FBBF0C00C6B4A4 /* A2iOS-Bridging-Header.h */,
);
path = A2iOS;
sourceTree = "<group>";
@ -337,6 +388,22 @@
children = (
3262F37423E169F8008BDB95 /* spk_dn.wav */,
3262F37523E169F8008BDB95 /* spk_up.wav */,
325EB67B23FBD43800C6B4A4 /* PrintChar21.ttf */,
32439F8422ECD8AD0077AAE0 /* apple.rom */,
325EB67F23FBDF8F00C6B4A4 /* Apple2Plus.rom */,
325EB68223FBDFBA00C6B4A4 /* DISK_II_C600.ROM */,
325EB68523FC707A00C6B4A4 /* Apple DOS 3.3 January 1983.woz */,
325EB68823FDDF6200C6B4A4 /* Hard Hat Mack - Disk 1, Side A.woz */,
325EB68B23FDDFD200C6B4A4 /* Merlin-8 v2.48 (DOS 3.3).woz */,
325EB6952401118200C6B4A4 /* Crossfire.woz */,
325EB6942401118200C6B4A4 /* Lode Runner.woz */,
325EB6982401118200C6B4A4 /* ProDOS_312.woz */,
325EB68F23FE028800C6B4A4 /* Donkey Kong.woz */,
325EB6992401118200C6B4A4 /* ProDOS_402_System.woz */,
325EB6972401118200C6B4A4 /* qbit.woz */,
325EB69A2401118300C6B4A4 /* Sneakers.woz */,
325EB6962401118200C6B4A4 /* Wavy Navy.woz */,
325EB69B2401118300C6B4A4 /* Xonix.woz */,
);
path = Resources;
sourceTree = "<group>";
@ -377,16 +444,14 @@
32BFFB5922EACC630003B53F /* A2Mac */ = {
isa = PBXGroup;
children = (
32439F8422ECD8AD0077AAE0 /* apple.rom */,
326ED2EE232D7A0000A41337 /* 6502_functional_test.bin */,
32B18438233FAB3900DBB4AB /* verticies.swift */,
32BFFB5A22EACC630003B53F /* AppDelegate.swift */,
32BFFB5C22EACC630003B53F /* ViewController.swift */,
32B18435233F10BC00DBB4AB /* Shaders.metal */,
32C4532D233345420000EBA1 /* MonitorView.swift */,
32DBF7632334657900DD50E7 /* HiRes.swift */,
32C453072331C0910000EBA1 /* NSLayoutManager-Extension.swift */,
32C45305232E3EEF0000EBA1 /* RepeatingTimer.swift */,
32DBF7632334657900DD50E7 /* HiRes.swift */,
32EDB7A123272CA80073AF2D /* fail1.txt */,
32BFFB5E22EACC660003B53F /* Assets.xcassets */,
32BFFB6022EACC660003B53F /* Main.storyboard */,
@ -623,9 +688,27 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
325EB6A22401118300C6B4A4 /* Wavy Navy.woz in Resources */,
325EB67E23FBDEE700C6B4A4 /* apple.rom in Resources */,
325EB64F23FBBAD100C6B4A4 /* LaunchScreen.storyboard in Resources */,
325EB68423FBDFBB00C6B4A4 /* DISK_II_C600.ROM in Resources */,
325EB69E2401118300C6B4A4 /* Lode Runner.woz in Resources */,
325EB68123FBDF8F00C6B4A4 /* Apple2Plus.rom in Resources */,
325EB6AA2401118300C6B4A4 /* Sneakers.woz in Resources */,
325EB6A82401118300C6B4A4 /* ProDOS_402_System.woz in Resources */,
325EB69123FE028800C6B4A4 /* Donkey Kong.woz in Resources */,
325EB68A23FDDF6200C6B4A4 /* Hard Hat Mack - Disk 1, Side A.woz in Resources */,
325EB6A02401118300C6B4A4 /* Crossfire.woz in Resources */,
325EB67923FBC48400C6B4A4 /* spk_dn.wav in Resources */,
325EB64C23FBBAD100C6B4A4 /* Assets.xcassets in Resources */,
325EB68D23FDDFD200C6B4A4 /* Merlin-8 v2.48 (DOS 3.3).woz in Resources */,
325EB6A62401118300C6B4A4 /* ProDOS_312.woz in Resources */,
325EB6AC2401118300C6B4A4 /* Xonix.woz in Resources */,
325EB67D23FBD43800C6B4A4 /* PrintChar21.ttf in Resources */,
325EB6A42401118300C6B4A4 /* qbit.woz in Resources */,
325EB68723FC707A00C6B4A4 /* Apple DOS 3.3 January 1983.woz in Resources */,
325EB64A23FBBACF00C6B4A4 /* Main.storyboard in Resources */,
325EB67A23FBC48400C6B4A4 /* spk_up.wav in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -647,10 +730,24 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
32EDB7A223272CA80073AF2D /* fail1.txt in Resources */,
325EB6A12401118300C6B4A4 /* Wavy Navy.woz in Resources */,
325EB68023FBDF8F00C6B4A4 /* Apple2Plus.rom in Resources */,
325EB68323FBDFBB00C6B4A4 /* DISK_II_C600.ROM in Resources */,
325EB67C23FBD43800C6B4A4 /* PrintChar21.ttf in Resources */,
325EB69D2401118300C6B4A4 /* Lode Runner.woz in Resources */,
3262F37723E169F8008BDB95 /* spk_up.wav in Resources */,
325EB6A92401118300C6B4A4 /* Sneakers.woz 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 */,
325EB69F2401118300C6B4A4 /* Crossfire.woz in Resources */,
32C4533123335E560000EBA1 /* Main.storyboard in Resources */,
32BFFB5F22EACC660003B53F /* Assets.xcassets in Resources */,
325EB68C23FDDFD200C6B4A4 /* Merlin-8 v2.48 (DOS 3.3).woz in Resources */,
325EB6A52401118300C6B4A4 /* ProDOS_312.woz in Resources */,
325EB6AB2401118300C6B4A4 /* Xonix.woz in Resources */,
325EB68623FC707A00C6B4A4 /* Apple DOS 3.3 January 1983.woz in Resources */,
325EB6A32401118300C6B4A4 /* qbit.woz in Resources */,
32439F8822ECD8AD0077AAE0 /* apple.rom in Resources */,
326ED2EF232D7A0000A41337 /* 6502_functional_test.bin in Resources */,
3262F37623E169F8008BDB95 /* spk_dn.wav in Resources */,
@ -702,9 +799,14 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
325EB67623FBC44400C6B4A4 /* common.c in Sources */,
325EB67523FBC43E00C6B4A4 /* 6502.c in Sources */,
325EB67823FBC45300C6B4A4 /* disk.c in Sources */,
325EB64723FBBACF00C6B4A4 /* ViewController.swift in Sources */,
325EB64323FBBACF00C6B4A4 /* AppDelegate.swift in Sources */,
325EB67723FBC45300C6B4A4 /* woz.c in Sources */,
325EB64523FBBACF00C6B4A4 /* SceneDelegate.swift in Sources */,
325EB67423FBC0AA00C6B4A4 /* RepeatingTimer.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -729,10 +831,10 @@
buildActionMask = 2147483647;
files = (
32439F8722ECD8AD0077AAE0 /* 6502.c in Sources */,
32DBF7642334657900DD50E7 /* HiRes.swift in Sources */,
325EB63623F8F78300C6B4A4 /* disk.c in Sources */,
325EB63923F9E48100C6B4A4 /* common.c in Sources */,
32BFFB5D22EACC630003B53F /* ViewController.swift in Sources */,
325EB69323FE6C6200C6B4A4 /* HiRes.swift in Sources */,
32C4532E233345430000EBA1 /* MonitorView.swift in Sources */,
325EB62F23F8856F00C6B4A4 /* woz.c in Sources */,
32BFFB5B22EACC630003B53F /* AppDelegate.swift in Sources */,
@ -761,11 +863,9 @@
buildActionMask = 2147483647;
files = (
32C4530B2331F7220000EBA1 /* 6502.c in Sources */,
32DBF7652334657900DD50E7 /* HiRes.swift in Sources */,
32C4530C2331F7220000EBA1 /* ViewController.swift in Sources */,
32C4532F233345820000EBA1 /* MonitorView.swift in Sources */,
32C4530D2331F7220000EBA1 /* AppDelegate.swift in Sources */,
32C4530E2331F7220000EBA1 /* RepeatingTimer.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -774,11 +874,9 @@
buildActionMask = 2147483647;
files = (
32C4531D2331FED90000EBA1 /* 6502.c in Sources */,
32DBF7662334657900DD50E7 /* HiRes.swift in Sources */,
32C4531E2331FED90000EBA1 /* ViewController.swift in Sources */,
32C45330233345820000EBA1 /* MonitorView.swift in Sources */,
32C4531F2331FED90000EBA1 /* AppDelegate.swift in Sources */,
32C453202331FED90000EBA1 /* RepeatingTimer.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -847,9 +945,11 @@
"$(inherited)",
"@executable_path/Frameworks",
);
OTHER_SWIFT_FLAGS = "-DHIRES -DHIRESDRAW -D_NO_HIRESLOW";
PRODUCT_BUNDLE_IDENTIFIER = com.gamealloy.A2iOS;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SWIFT_OBJC_BRIDGING_HEADER = "A2iOS/A2iOS-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
@ -867,9 +967,11 @@
"$(inherited)",
"@executable_path/Frameworks",
);
OTHER_SWIFT_FLAGS = "-DHIRES -DHIRESDRAW -D_NO_HIRESLOW";
PRODUCT_BUNDLE_IDENTIFIER = com.gamealloy.A2iOS;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SWIFT_OBJC_BRIDGING_HEADER = "A2iOS/A2iOS-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
@ -1106,8 +1208,9 @@
OTHER_CFLAGS = (
"-DDISASSEMBLER",
"-DINTERRUPT_CHECK_PER_STEP",
"-DCLK_ABSOLUTE_PRECISE",
);
OTHER_SWIFT_FLAGS = "-D_NO_HIRES -DHIRESDRAW -D_NO_HIRESLOW";
OTHER_SWIFT_FLAGS = "-DHIRES -DHIRESDRAW -D_NO_HIRESLOW";
PRODUCT_BUNDLE_IDENTIFIER = com.gamealloy.A2Mac;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
@ -1141,8 +1244,9 @@
OTHER_CFLAGS = (
"-DDISASSEMBLER",
"-DINTERRUPT_CHECK_PER_STEP",
"-DCLK_ABSOLUTE_PRECISE",
);
OTHER_SWIFT_FLAGS = "-D_NO_HIRES -DHIRESDRAW -D_NO_HIRESLOW";
OTHER_SWIFT_FLAGS = "-DHIRES -DHIRESDRAW -D_NO_HIRESLOW";
PRODUCT_BUNDLE_IDENTIFIER = com.gamealloy.A2Mac;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "A2Mac/A2Mac-Bridging-Header.h";

View File

@ -32,6 +32,21 @@
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>325EB63F23FBBACF00C6B4A4</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>325EB65423FBBAD100C6B4A4</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>325EB65F23FBBAD100C6B4A4</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>32BFFB5622EACC630003B53F</key>
<dict>
<key>primary</key>

View File

@ -1,5 +1,19 @@
//
// A2Mac-Bridging-Header.h
// A2Mac
//
// Created by Tamas Rudnai on 2/17/20.
// Copyright © 2020 GameAlloy. All rights reserved.
//
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#ifndef A2Mac_Bridging_Header_h
#define A2Mac_Bridging_Header_h
#import "6502.h"
#endif /* A2Mac_Bridging_Header_h */

View File

@ -756,6 +756,9 @@
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="LlM-EV-ruZ" customClass="HiRes" customModule="A2Mac" customModuleProvider="target">
<rect key="frame" x="16" y="8" width="568" height="384"/>
</customView>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="mfd-12-bcR">
<rect key="frame" x="594" y="362" width="82" height="32"/>
<constraints>
@ -782,24 +785,20 @@
</connections>
</buttonCell>
</button>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="LlM-EV-ruZ" customClass="HiRes" customModule="A2Mac" customModuleProvider="target">
<rect key="frame" x="16" y="8" width="568" height="384"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
</customView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Fb7-Jc-jmt">
<rect key="frame" x="598" y="186" width="74" height="17"/>
<constraints>
<constraint firstAttribute="height" constant="17" id="xCE-LE-hVy"/>
</constraints>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="left" title="CPU Speed" id="b3T-0k-ama">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<stackView distribution="fill" orientation="vertical" alignment="leading" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" fixedFrame="YES" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="lVP-FP-u6x">
<rect key="frame" x="600" y="44" width="52" height="136"/>
<rect key="frame" x="600" y="19" width="70" height="161"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Fb7-Jc-jmt">
<rect key="frame" x="-2" y="144" width="74" height="17"/>
<constraints>
<constraint firstAttribute="height" constant="17" id="xCE-LE-hVy"/>
</constraints>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="left" title="CPU Speed" id="b3T-0k-ama">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="7Pw-e8-92m">
<rect key="frame" x="-1" y="119" width="55" height="18"/>
<buttonCell key="cell" type="radio" title="1.023" bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="AgQ-Np-TYQ">
@ -868,6 +867,7 @@
<integer value="1000"/>
<integer value="1000"/>
<integer value="1000"/>
<integer value="1000"/>
</visibilityPriorities>
<customSpacing>
<real value="3.4028234663852886e+38"/>
@ -876,6 +876,7 @@
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
</customSpacing>
</stackView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="FZk-VW-alq">
@ -896,14 +897,18 @@
<constraint firstAttribute="trailing" secondItem="rR3-9T-NFu" secondAttribute="trailing" constant="10" id="68s-0C-BVZ"/>
<constraint firstAttribute="bottom" secondItem="FZk-VW-alq" secondAttribute="bottom" constant="20" id="E2f-MY-c2Y"/>
<constraint firstItem="iIF-Q5-Onc" firstAttribute="leading" secondItem="m2S-Jp-Qdl" secondAttribute="leading" id="LGA-tZ-gFh"/>
<constraint firstItem="LlM-EV-ruZ" firstAttribute="leading" secondItem="iIF-Q5-Onc" secondAttribute="leading" constant="16" id="Lak-zX-Szi"/>
<constraint firstItem="rR3-9T-NFu" firstAttribute="leading" secondItem="iIF-Q5-Onc" secondAttribute="trailing" constant="8" id="ON4-IE-HmP"/>
<constraint firstAttribute="trailing" secondItem="FZk-VW-alq" secondAttribute="trailing" constant="10" id="Q0s-uC-GPT"/>
<constraint firstItem="SEL-hl-0c0" firstAttribute="bottom" secondItem="iIF-Q5-Onc" secondAttribute="bottom" constant="-8" id="Q2B-a3-gBp"/>
<constraint firstItem="SEL-hl-0c0" firstAttribute="leading" secondItem="iIF-Q5-Onc" secondAttribute="leading" constant="16" id="QGx-a9-RR9"/>
<constraint firstItem="LlM-EV-ruZ" firstAttribute="bottom" secondItem="iIF-Q5-Onc" secondAttribute="bottom" constant="-8" id="Vfh-f8-sRz"/>
<constraint firstItem="SEL-hl-0c0" firstAttribute="top" secondItem="iIF-Q5-Onc" secondAttribute="top" constant="8" id="aWz-Ad-PIM"/>
<constraint firstAttribute="bottom" secondItem="iIF-Q5-Onc" secondAttribute="bottom" id="acb-Dy-fu5"/>
<constraint firstItem="SEL-hl-0c0" firstAttribute="trailing" secondItem="iIF-Q5-Onc" secondAttribute="trailing" constant="-8" id="cmY-Vb-ckJ"/>
<constraint firstItem="iIF-Q5-Onc" firstAttribute="top" secondItem="m2S-Jp-Qdl" secondAttribute="top" id="m3e-ww-N7S"/>
<constraint firstItem="LlM-EV-ruZ" firstAttribute="top" secondItem="iIF-Q5-Onc" secondAttribute="top" constant="8" id="mJ3-xG-dB3"/>
<constraint firstItem="LlM-EV-ruZ" firstAttribute="trailing" secondItem="iIF-Q5-Onc" secondAttribute="trailing" constant="-8" id="nCM-Ge-DZf"/>
<constraint firstItem="rR3-9T-NFu" firstAttribute="top" secondItem="mfd-12-bcR" secondAttribute="bottom" constant="10" id="ycb-iY-X4I"/>
<constraint firstItem="mfd-12-bcR" firstAttribute="top" secondItem="m2S-Jp-Qdl" secondAttribute="top" constant="10" id="zDl-Cs-xmz"/>
</constraints>

View File

@ -18,12 +18,17 @@ class HiRes: NSView {
static let PixelWidth = 280
static let PixelMixedHeight = 160
static let PixelHeight = 192
static let MixedTextHeight = 4
static let MixedHeight = 160
static let blockRows = 24
static let blockCols = 40
static let blockWidth = PixelWidth / blockCols
static let blockHeight = PixelHeight / blockRows
let HiResBufferPointer = UnsafeRawBufferPointer(start: RAM + Page1Addr, count: PageSize * 2)
let HiResBuffer1 = UnsafeRawBufferPointer(start: RAM + Page1Addr, count: PageSize * 2)
let HiResBuffer2 = UnsafeRawBufferPointer(start: RAM + Page2Addr, count: PageSize * 2)
var HiResBufferPointer = UnsafeRawBufferPointer(start: RAM + Page1Addr, count: PageSize * 2)
let HiResRawPointer = UnsafeRawPointer(RAM + Page1Addr)
#if METAL_YES
@ -179,6 +184,7 @@ class HiRes: NSView {
func render() {
guard let drawable = metalLayer?.nextDrawable() else { return }
let renderPassDescriptor = MTLRenderPassDescriptor()
renderPassDescriptor.colorAttachments[0].texture = drawable.texture
@ -459,48 +465,168 @@ class HiRes: NSView {
let boundingBox = CGRect(x: 0, y: 0, width: CGFloat(HiRes.PixelWidth), height: CGFloat(HiRes.PixelHeight))
currentContext!.draw (image, in: boundingBox)
}
#elseif HIRESDRAW
#elseif HIRESDRAWCOLOR
let colorPalette : [NSColor] = [
NSColor(calibratedRed: 0.0000, green: 0.000, blue: 0.000, alpha: 0.0), // black
NSColor(calibratedRed: 0.0314, green: 0.635, blue: 0.071, alpha: 1.0), // green
NSColor(calibratedRed: 0.0314, green: 0.635, blue: 0.071, alpha: 1.0), // purple
NSColor(calibratedRed: 1.0000, green: 1.000, blue: 1.000, alpha: 1.0), // white
NSColor(calibratedRed: 0.0000, green: 0.000, blue: 0.000, alpha: 0.0), // black
NSColor(calibratedRed: 0.0314, green: 0.635, blue: 0.071, alpha: 1.0), // orange
NSColor(calibratedRed: 0.0314, green: 0.635, blue: 0.071, alpha: 1.0), // blue
NSColor(calibratedRed: 1.0000, green: 1.000, blue: 1.000, alpha: 1.0), // white
]
let path = NSBezierPath()
override func draw(_ rect: CGRect) {
// NSColor.green.setFill()
NSColor(calibratedRed: 0.0314, green: 0.635, blue: 0.071, alpha: 0.5).setStroke()
NSColor(calibratedRed: 0.0314, green: 0.635, blue: 0.071, alpha: 1.0).setStroke()
let path = NSBezierPath()
path.lineWidth=1
path.removeAllPoints()
path.lineWidth = 0.7
path.move(to: NSPoint(x: 0, y: 0))
// path.appendRect(NSRect(x: 0, y: 0, width: 10, height: 10))
for y in 0 ..< HiRes.PixelHeight {
var color : UInt = 0
var lastColor : UInt = 0
path.move(to: NSPoint(x: 0, y: y))
// for color screen we need to process blocks in a pair
for blockX in 0 ..< HiRes.blockCols / 2 {
let lineAddr = HiResLineAddrTbl[y]
var x = blockX * HiRes.blockWidth * 2
var block0 = UInt(HiResBufferPointer[ Int(lineAddr + blockX * 2) + 0 ])
var block1 = UInt(HiResBufferPointer[ Int(lineAddr + blockX * 2) + 1 ])
let b70 : UInt = (block0 & 0x80) >> 5
let b71 : UInt = (block1 & 0x80) >> 5
var block7 : [UInt] = [0,0,0,0,0,0,0]
var i = 0
for _ in 0 ... 2 {
block7[i] = b70
block7[i] |= block0 & 3
block0 >>= 2
i += 1
}
block7[i] = b70
block7[i] |= ((block0 & 1) << 1) | (block1 & 1)
block1 >>= 1
i += 1
for _ in 0 ... 2 {
block7[i] = b71
block7[i] |= block1 & 3
block1 >>= 2
i += 1
}
for px in 0 ... 6 { // stride(from: 0, through: 6, by: 1) {
color = block7[px]
if (color != lastColor) {
colorPalette[Int(color)].setStroke()
path.line(to: NSPoint(x: x, y: y))
path.stroke()
path.removeAllPoints()
lastColor = color
}
x += 1
}
} // x
// make sure we close the path at the end of the horizontal line
if (color != lastColor) {
path.line(to: NSPoint(x: 279, y: y))
lastColor = color
}
}
// path.fill()
path.stroke()
}
#elseif HIRESDRAW
let path = NSBezierPath()
override func draw(_ rect: CGRect) {
// self.hidden = videoMode.text == 1
// NSColor.green.setFill()
NSColor(calibratedRed: 0.0314, green: 0.635, blue: 0.071, alpha: 1.0).setStroke()
path.removeAllPoints()
path.lineWidth=0.7
path.move(to: NSPoint(x: 0, y: 0))
// path.appendRect(NSRect(x: 0, y: 0, width: 10, height: 10))
var height = HiRes.PixelHeight
// do not even render it...
if videoMode.text == 1 {
return
}
else {
if videoMode.mixed == 1 {
height = HiRes.MixedHeight
}
if videoMode.page == 1 {
HiResBufferPointer = HiResBuffer2
}
else {
HiResBufferPointer = HiResBuffer1
}
}
for y in 0 ..< height {
var inX = false
path.move(to: NSPoint(x: 0, y: y))
for blockX in 0 ..< HiRes.blockCols {
let lineAddr = HiResLineAddrTbl[y]
let block = Int(HiResBufferPointer[ Int(lineAddr + blockX) ])
let block = UInt(HiResBufferPointer[ Int(lineAddr + blockX) ])
// if( shadowScreen[ screenIdx ] != block ) {
// shadowScreen[ screenIdx ] = block
//
var x = blockX * HiRes.blockWidth
for bit in stride(from: 0, through: 6, by: 1) {
let bitMask = 1 << bit
if (block & bitMask) == 0 {
if inX {
inX = false
path.line(to: NSPoint(x: x, y: 192-y))
if block != 0 && block != 0x80 {
for bit in 0 ... 6 { // stride(from: 0, through: 6, by: 1) {
let bitMask : UInt = 1 << bit
if (block & bitMask) == 0 {
if inX {
inX = false
path.line(to: NSPoint(x: x, y: 192-y))
}
}
}
else { // 28CD41
if ( inX == false ) {
inX = true
path.move(to: NSPoint(x: x, y: 192-y))
else { // 28CD41
if ( inX == false ) {
inX = true
path.move(to: NSPoint(x: x, y: 192-y))
}
}
x += 1
}
}
else {
// make sure we close the path if the next block is completely zero
if inX {
inX = false
path.line(to: NSPoint(x: x, y: 192-y))
}
x += 1
}
} // x
// make sure we close the path at the end of the horizontal line
if inX {
inX = false
path.line(to: NSPoint(x: 279, y: 192-y))

View File

@ -9,7 +9,46 @@
import Cocoa
class MonitorView: NSView {
override func performKeyEquivalent(with event: NSEvent) -> Bool {
return true
}
// override func performKeyEquivalent(with event: NSEvent) -> Bool {
// return true
// }
// override func keyDown(with event: NSEvent) {
// print("MV KBD Event")
// // switch event.modifierFlags.intersection(.deviceIndependentFlagsMask) {
// // case [.command] where event.characters == "l",
// // [.command, .shift] where event.characters == "l":
// // print("command-l or command-shift-l")
// // default:
// // break
// // }
// // print( "key = " + (event.charactersIgnoringModifiers ?? ""))
// // print( "\ncharacter = " + (event.characters ?? ""))
//
// #if FUNCTIONTEST
// #else
// let keyCode = UInt32(event.keyCode)
// switch keyCode {
// case eLeftArrowKey:
// kbdInput(0x08)
// case eRightArrowKey:
// kbdInput(0x15)
// case eLeftArrowKey:
// kbdInput(0x0B)
// case eRightArrowKey:
// kbdInput(0x0A)
// default:
// // print("keycode: %d", keyCode)
// if let chars = event.characters {
// let char = chars.uppercased()[chars.startIndex]
// if let ascii = char.asciiValue {
// kbdInput(ascii)
// }
// }
// }
// #endif
//
// }
}

View File

@ -112,7 +112,7 @@ class ViewController: NSViewController {
DispatchQueue.global().async(execute: workItem!);
}
#else
m6502_ColdReset()
m6502_ColdReset( Bundle.main.resourcePath )
#endif
}
@ -130,14 +130,61 @@ class ViewController: NSViewController {
}
static let textBaseAddr = 0x400
static let textBufferSize = 0x400
let textLines = 24
let textCols = 40
let lineEndChars = 1
var frameCnt = 0
// let spaceChar : Character = "\u{E17F}"
// let blockChar : Character = "\u{E07F}"
let spaceChar : Character = " "
let blockChar : Character = ""
var flashingSpace : Character = " "
let ramBufferPointer = UnsafeRawBufferPointer(start: RAM, count: 64 * 1024)
let textBufferPointer = UnsafeRawBufferPointer(start: RAM + textBaseAddr, count: textBufferSize)
var txtClear = [Character](repeating: " ", count: textBufferSize)
var txtArr = [Character](repeating: " ", count: textBufferSize)
var s = String()
func HexDump() {
var txt : String = ""
for y in 0...textLines - 1 {
txt += String(format: "%04X: ", y * 16)
for x in 0...15 {
let byte = ramBufferPointer[ y * 16 + x ]
let chr = String(format: "%02X ", byte)
txt += chr
}
txt += "\n"
}
DispatchQueue.main.async {
self.display.stringValue = txt
self.speedometer.stringValue = String(format: "%0.3lf MHz", mhz);
}
}
// AppleScript Keycodes
let leftArrowKey = 123
let rightArrowKey = 124
let upArrowKey = 126
let downArrowKey = 125
var ddd = 9;
override func keyDown(with event: NSEvent) {
// print("KBD Event")
print("KBD Event")
for i in 0...65536 {
ddd = Int(event.keyCode) + i
}
ddd = ddd * 2
// switch event.modifierFlags.intersection(.deviceIndependentFlagsMask) {
// case [.command] where event.characters == "l",
// [.command, .shift] where event.characters == "l":
@ -154,12 +201,20 @@ class ViewController: NSViewController {
switch keyCode {
case leftArrowKey:
kbdInput(0x08)
setIO(0xC064, 0);
print("LEFT", ddd);
case rightArrowKey:
kbdInput(0x15)
case leftArrowKey:
setIO(0xC064, 255);
print("RIGHT")
case downArrowKey:
kbdInput(0x0B)
case rightArrowKey:
setIO(0xC065, 255);
print("DOWN")
case upArrowKey:
kbdInput(0x0A)
setIO(0xC065, 0);
print("UP")
default:
// print("keycode: %d", keyCode)
if let chars = event.characters {
@ -173,6 +228,51 @@ class ViewController: NSViewController {
}
override func keyUp(with event: NSEvent) {
print("KBD Event")
// switch event.modifierFlags.intersection(.deviceIndependentFlagsMask) {
// case [.command] where event.characters == "l",
// [.command, .shift] where event.characters == "l":
// print("command-l or command-shift-l")
// default:
// break
// }
// print( "key = " + (event.charactersIgnoringModifiers ?? ""))
// print( "\ncharacter = " + (event.characters ?? ""))
#if FUNCTIONTEST
#else
let keyCode = Int(event.keyCode)
switch keyCode {
case leftArrowKey:
// kbdInput(0x08)
setIO(0xC064, 127);
print("left")
case rightArrowKey:
// kbdInput(0x15)
setIO(0xC064, 128);
print("right")
case downArrowKey:
// kbdInput(0x0B)
setIO(0xC065, 127);
print("down")
case upArrowKey:
// kbdInput(0x0A)
setIO(0xC065, 128);
print("up")
default:
// print("keycode: %d", keyCode)
// if let chars = event.characters {
// let char = chars.uppercased()[chars.startIndex]
// if let ascii = char.asciiValue {
// kbdInput(ascii)
// }
// }
break
}
#endif
}
// override func flagsChanged(with event: NSEvent) {
// switch event.modifierFlags.intersection(.deviceIndependentFlagsMask) {
// case [.shift]:
@ -210,43 +310,7 @@ class ViewController: NSViewController {
// }
// }
static let textBaseAddr = 0x400
static let textBufferSize = 0x400
let textLines = 24
let textCols = 40
let lineEndChars = 1
var frameCnt = 0
// let spaceChar : Character = "\u{E17F}"
// let blockChar : Character = "\u{E07F}"
let spaceChar : Character = " "
let blockChar : Character = ""
var flashingSpace : Character = " "
let ramBufferPointer = UnsafeRawBufferPointer(start: RAM, count: 64 * 1024)
let textBufferPointer = UnsafeRawBufferPointer(start: RAM + textBaseAddr, count: textBufferSize)
var txtArr = [Character](repeating: " ", count: textBufferSize)
var s = String()
func HexDump() {
var txt : String = ""
for y in 0...textLines - 1 {
txt += String(format: "%04X: ", y * 16)
for x in 0...15 {
let byte = ramBufferPointer[ y * 16 + x ]
let chr = String(format: "%02X ", byte)
txt += chr
}
txt += "\n"
}
DispatchQueue.main.async {
self.display.stringValue = txt
self.speedometer.stringValue = String(format: "%0.3lf MHz", mhz);
}
}
var was = 0;
@ -277,42 +341,36 @@ class ViewController: NSViewController {
var txt : String = ""
for y in 0...textLines-1 {
// let textAddr = textBaseAddr + textLineOfs[y]
// let linePointer = UnsafeMutableRawPointer( mutating: &RAM + textBaseAddr + y * textCols ) //( start: &RAM + 0x400, count: 0x400)
// let lineStr = String(bytesNoCopy: linePointer, length: textCols, encoding: .ascii, freeWhenDone: false)!
// txt += lineStr + "\n"
var fromLines = 0
var toLines = textLines
for x in 0...textCols-1 {
if videoMode.text == 0 {
if videoMode.mixed == 1 {
fromLines = toLines - 4
}
else {
toLines = 0
}
}
txtArr = txtClear
for y in fromLines ..< toLines {
for x in 0 ..< textCols {
let byte = textBufferPointer[ textLineOfs[y] + x ]
let idx = Int(byte);
let chr = ViewController.charConvTbl[idx]
// is it a cursor? (slashing space)
// if ( chr == "blockChar" ) {
// chr = flashingSpace
// }
// print("byte \(index): \(chr)")
// txt = txt + "\(chr)"
txtArr[ y * (textCols + lineEndChars) + x ] = chr
}
// for (_, byte) in textBufferPointer.enumerated() {
// let idx = Int(byte);
// var chr = ViewController.charConvTbl[idx]
// // is it a cursor? (slashing space)
// if ( chr == blockChar ) {
// chr = flashingSpace
// }
// // print("byte \(index): \(chr)")
// txt = txt + "\(chr)"
// }
// txt = txt + "\n"
txtArr[ y * (textCols + lineEndChars) + textCols ] = "\n"
}
// txtArr[ textLines * (textCols+1) + textCols ] = "\0"
txt = String(txtArr)
DispatchQueue.main.async {
@ -362,6 +420,10 @@ class ViewController: NSViewController {
override func viewDidLoad() {
super.viewDidLoad()
for y in 0 ... textLines - 1 {
txtClear[ y * (textCols + lineEndChars) + textCols ] = "\n"
}
let spk_up_path = Bundle.main.path(forResource: "spk_up", ofType:"wav")!
let spk_up_url = URL(fileURLWithPath: spk_up_path)

View File

@ -0,0 +1,20 @@
//
// A2iOS-Bridging-Header.h
// A2Mac
//
// Created by Tamas Rudnai on 2/17/20.
// Copyright © 2020 GameAlloy. All rights reserved.
//
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#ifndef A2iOS_Bridging_Header_h
#define A2iOS_Bridging_Header_h
#import "6502.h"
#import "disk.h"
#endif /* A2iOS_Bridging_Header_h */

View File

@ -1,24 +1,359 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<customFonts key="customFonts">
<array key="PrintChar21.ttf">
<string>PrintChar21</string>
</array>
</customFonts>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="A2iOS" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="UDx-40-ORS" userLabel="Background View">
<rect key="frame" x="0.0" y="44" width="414" height="294"/>
<subviews>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" textAlignment="natural" adjustsFontForContentSizeCategory="YES" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nMe-JQ-ldk" userLabel="Display View">
<rect key="frame" x="8" y="8" width="398" height="278"/>
<string key="text">1234567890123456789012345678901234567890
@@@@@@@@@1@@@@@@@@@2@@@@@@@@@3@@@@@@@@@4
@@@@@@@@@@@@@@@@@@@3@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@4@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@5@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@6@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@7@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@8@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@9@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@10@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@11@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@12@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@13@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@14@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@15@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@16@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@17@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@18@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@19@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@20@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@21@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@22@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@23@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@24@@@@@@@@@@@@@@@@@@@@</string>
<color key="textColor" systemColor="systemGreenColor" red="0.20392156859999999" green="0.78039215689999997" blue="0.34901960780000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" name="PrintChar21" family="Print Char 21" pointSize="11"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
<view alpha="0.5" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Vi7-A0-0Jo" userLabel="HiRes" customClass="HiRes" customModule="A2iOS" customModuleProvider="target">
<rect key="frame" x="8" y="8" width="568" height="384"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="width" constant="568" id="Zt7-jR-A9l"/>
<constraint firstAttribute="height" constant="384" id="yhH-Mi-66m"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="Vi7-A0-0Jo" firstAttribute="leading" secondItem="nMe-JQ-ldk" secondAttribute="leading" id="4nE-P5-f7w"/>
<constraint firstItem="Vi7-A0-0Jo" firstAttribute="top" secondItem="nMe-JQ-ldk" secondAttribute="top" id="6Lq-A0-E1c"/>
<constraint firstAttribute="bottom" secondItem="nMe-JQ-ldk" secondAttribute="bottom" constant="8" id="DPv-PT-d2d"/>
<constraint firstAttribute="trailing" secondItem="nMe-JQ-ldk" secondAttribute="trailing" constant="8" id="GEu-gM-CNF"/>
<constraint firstAttribute="width" secondItem="UDx-40-ORS" secondAttribute="height" multiplier="69:49" id="RZg-ls-eky"/>
<constraint firstItem="nMe-JQ-ldk" firstAttribute="leading" secondItem="UDx-40-ORS" secondAttribute="leading" constant="8" id="t9T-Pg-eMl"/>
</constraints>
</view>
<navigationBar contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="NfH-Md-IFn">
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="wqp-NV-x0V"/>
</constraints>
<color key="barTintColor" cocoaTouchSystemColor="viewFlipsideBackgroundColor"/>
<textAttributes key="titleTextAttributes">
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</textAttributes>
<items>
<navigationItem title="A2iOS" id="vFD-A6-f26">
<barButtonItem key="leftBarButtonItem" title="Power" id="wzl-9p-KCO">
<connections>
<action selector="Power:" destination="BYZ-38-t0r" id="9BP-2y-d77"/>
</connections>
</barButtonItem>
<barButtonItem key="rightBarButtonItem" title="Reset" id="icP-Ci-Ygt">
<color key="tintColor" red="1" green="0.36774935790000002" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<connections>
<action selector="Reset:" destination="BYZ-38-t0r" id="xXh-Mp-ybp"/>
</connections>
</barButtonItem>
</navigationItem>
</items>
</navigationBar>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Q9J-69-63J">
<rect key="frame" x="274" y="346" width="120" height="26"/>
<constraints>
<constraint firstAttribute="width" constant="120" id="Nub-YK-2HW"/>
<constraint firstAttribute="height" constant="26" id="f39-gy-BwM"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="right" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="LWV-xR-zzl">
<rect key="frame" x="327" y="380" width="67" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="67" id="WHb-SE-Gkk"/>
<constraint firstAttribute="height" constant="30" id="qDC-k4-fB7"/>
</constraints>
<state key="normal" title="1.023">
<color key="titleColor" red="0.69019607839999997" green="0.90980392160000001" blue="0.51764705879999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="speedSelected:" destination="BYZ-38-t0r" eventType="touchUpInside" id="MTU-in-qfq"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="right" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rYe-dy-hot">
<rect key="frame" x="327" y="418" width="67" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="67" id="Mkd-qV-Kj1"/>
<constraint firstAttribute="height" constant="30" id="oKy-qh-d9O"/>
</constraints>
<state key="normal" title="4">
<color key="titleColor" red="0.69019607839999997" green="0.90980392160000001" blue="0.51764705879999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="speedSelected:" destination="BYZ-38-t0r" eventType="touchUpInside" id="ple-Iy-dbb"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="right" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="f9G-OM-FNm">
<rect key="frame" x="327" y="456" width="67" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="67" id="8Y3-Vw-dfz"/>
<constraint firstAttribute="height" constant="30" id="iTY-HK-wl7"/>
</constraints>
<state key="normal" title="10">
<color key="titleColor" red="0.69019607839999997" green="0.90980392160000001" blue="0.51764705879999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="speedSelected:" destination="BYZ-38-t0r" eventType="touchUpInside" id="qZz-rf-0Lj"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="right" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="TLZ-33-q0M">
<rect key="frame" x="327" y="494" width="67" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="8pg-Fn-9at"/>
<constraint firstAttribute="width" constant="67" id="9SL-QA-6sZ"/>
</constraints>
<state key="normal" title="100">
<color key="titleColor" red="0.69019607839999997" green="0.90980392160000001" blue="0.51764705879999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="speedSelected:" destination="BYZ-38-t0r" eventType="touchUpInside" id="y7q-kK-3h3"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="right" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="qNn-GH-aIG">
<rect key="frame" x="327" y="532" width="67" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="67" id="mSD-q3-vE4"/>
<constraint firstAttribute="height" constant="30" id="rXv-K3-Vr2"/>
</constraints>
<state key="normal" title="666">
<color key="titleColor" red="0.69019607839999997" green="0.90980392160000001" blue="0.51764705879999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="speedSelected:" destination="BYZ-38-t0r" eventType="touchUpInside" id="ILu-FW-q5i"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="InU-ap-ckM">
<rect key="frame" x="8" y="346" width="67" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="ATG-c1-PNL"/>
<constraint firstAttribute="width" constant="67" id="hoo-za-ij5"/>
</constraints>
<state key="normal" title="CATALOG">
<color key="titleColor" red="0.69019607839999997" green="0.90980392160000001" blue="0.51764705879999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="Command:" destination="BYZ-38-t0r" eventType="touchUpInside" id="vew-QM-cMf"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="lGY-TL-dYl">
<rect key="frame" x="8" y="384" width="67" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="67" id="TJ7-tO-TV6"/>
<constraint firstAttribute="height" constant="30" id="rNb-jZ-CLx"/>
</constraints>
<state key="normal" title="LIST">
<color key="titleColor" red="0.69019607839999997" green="0.90980392160000001" blue="0.51764705879999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="Command:" destination="BYZ-38-t0r" eventType="touchUpInside" id="y6a-4h-noZ"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="lBw-C9-kAw">
<rect key="frame" x="8" y="422" width="67" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="67" id="C5g-6H-QPQ"/>
<constraint firstAttribute="height" constant="30" id="Xsx-5I-uow"/>
</constraints>
<state key="normal" title="NEW">
<color key="titleColor" red="0.69019607839999997" green="0.90980392160000001" blue="0.51764705879999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="Command:" destination="BYZ-38-t0r" eventType="touchUpInside" id="aMt-1f-TfX"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="xbl-kL-cRQ">
<rect key="frame" x="8" y="460" width="280" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="280" id="4g2-2b-aRp"/>
<constraint firstAttribute="height" constant="30" id="gGm-Qo-Gvf"/>
</constraints>
<state key="normal" title="LOAD RENUMBER">
<color key="titleColor" red="0.69019607839999997" green="0.90980392160000001" blue="0.51764705879999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="Command:" destination="BYZ-38-t0r" eventType="touchUpInside" id="pC3-Ii-hiD"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Wuq-OJ-QCj">
<rect key="frame" x="8" y="498" width="280" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="280" id="RyG-XC-bdy"/>
<constraint firstAttribute="height" constant="30" id="yiN-OC-wrq"/>
</constraints>
<state key="normal" title="BLOAD INTBASIC">
<color key="titleColor" red="0.69019607839999997" green="0.90980392160000001" blue="0.51764705879999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="Command:" destination="BYZ-38-t0r" eventType="touchUpInside" id="pju-Np-drJ"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="PL9-nx-yy4">
<rect key="frame" x="8" y="536" width="280" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="280" id="VYA-Dc-Vyv"/>
<constraint firstAttribute="height" constant="30" id="Vc1-xv-qLq"/>
</constraints>
<state key="normal" title="FOR I = 1 TO 65536: PRINT I : NEXT">
<color key="titleColor" red="0.69019607839999997" green="0.90980392160000001" blue="0.51764705879999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="Command:" destination="BYZ-38-t0r" eventType="touchUpInside" id="gdZ-gr-yul"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Disk Accel" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DQV-kq-kpF">
<rect key="frame" x="274" y="574" width="120" height="26"/>
<constraints>
<constraint firstAttribute="height" constant="26" id="Bdd-pU-rtD"/>
<constraint firstAttribute="width" constant="120" id="CHD-6p-heI"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="right" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="XuV-wg-S6w">
<rect key="frame" x="327" y="608" width="67" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="67" id="8rZ-oM-unL"/>
<constraint firstAttribute="height" constant="30" id="Iho-Oo-RVC"/>
</constraints>
<state key="normal" title="1">
<color key="titleColor" red="0.69019607839999997" green="0.90980392160000001" blue="0.51764705879999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="diskAccelSepected:" destination="BYZ-38-t0r" eventType="touchUpInside" id="KV0-fG-qPP"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="right" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="nzo-cq-BqT">
<rect key="frame" x="327" y="646" width="67" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="GZe-0n-i9h"/>
<constraint firstAttribute="width" constant="67" id="bfg-tJ-krJ"/>
</constraints>
<state key="normal" title="25">
<color key="titleColor" red="0.69019607839999997" green="0.90980392160000001" blue="0.51764705879999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="diskAccelSepected:" destination="BYZ-38-t0r" eventType="touchUpInside" id="mdd-la-FFe"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="right" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="0PZ-a6-C0R">
<rect key="frame" x="327" y="684" width="67" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="Ngo-hs-Tpl"/>
<constraint firstAttribute="width" constant="67" id="RIc-Ya-YCY"/>
</constraints>
<state key="normal" title="100">
<color key="titleColor" red="0.69019607839999997" green="0.90980392160000001" blue="0.51764705879999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="diskAccelSepected:" destination="BYZ-38-t0r" eventType="touchUpInside" id="1fW-4M-Vme"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" cocoaTouchSystemColor="viewFlipsideBackgroundColor"/>
<constraints>
<constraint firstItem="xbl-kL-cRQ" firstAttribute="top" secondItem="lBw-C9-kAw" secondAttribute="bottom" constant="8" id="0oS-2D-WjN"/>
<constraint firstItem="Wuq-OJ-QCj" firstAttribute="leading" secondItem="xbl-kL-cRQ" secondAttribute="leading" id="1a6-oO-MR9"/>
<constraint firstItem="LWV-xR-zzl" firstAttribute="top" secondItem="Q9J-69-63J" secondAttribute="bottom" constant="8" id="4NL-Vb-Vk7"/>
<constraint firstItem="XuV-wg-S6w" firstAttribute="top" secondItem="DQV-kq-kpF" secondAttribute="bottom" constant="8" id="6RU-7x-2yY"/>
<constraint firstItem="lGY-TL-dYl" firstAttribute="top" secondItem="InU-ap-ckM" secondAttribute="bottom" constant="8" id="6tk-tJ-uYI"/>
<constraint firstItem="PL9-nx-yy4" firstAttribute="leading" secondItem="Wuq-OJ-QCj" secondAttribute="leading" id="9Uf-H3-eAP"/>
<constraint firstItem="NfH-Md-IFn" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" id="Aoh-dk-DVd"/>
<constraint firstItem="Wuq-OJ-QCj" firstAttribute="top" secondItem="xbl-kL-cRQ" secondAttribute="bottom" constant="8" id="BMr-YH-6Ti"/>
<constraint firstItem="InU-ap-ckM" firstAttribute="top" secondItem="UDx-40-ORS" secondAttribute="bottom" constant="8" id="GDb-b5-bkW"/>
<constraint firstItem="qNn-GH-aIG" firstAttribute="top" secondItem="TLZ-33-q0M" secondAttribute="bottom" constant="8" id="GE1-OV-Gi1"/>
<constraint firstItem="rYe-dy-hot" firstAttribute="top" secondItem="LWV-xR-zzl" secondAttribute="bottom" constant="8" id="Kac-Ry-igj"/>
<constraint firstItem="Q9J-69-63J" firstAttribute="top" secondItem="UDx-40-ORS" secondAttribute="bottom" constant="8" id="Ktm-nN-N77"/>
<constraint firstItem="TLZ-33-q0M" firstAttribute="trailing" secondItem="f9G-OM-FNm" secondAttribute="trailing" id="MI4-Vx-O13"/>
<constraint firstItem="0PZ-a6-C0R" firstAttribute="top" secondItem="nzo-cq-BqT" secondAttribute="bottom" constant="8" id="MRX-zF-SeM"/>
<constraint firstItem="f9G-OM-FNm" firstAttribute="trailing" secondItem="rYe-dy-hot" secondAttribute="trailing" id="MrH-wo-OSH"/>
<constraint firstItem="nMe-JQ-ldk" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="8" id="Mt2-Db-3L6"/>
<constraint firstItem="xbl-kL-cRQ" firstAttribute="leading" secondItem="lBw-C9-kAw" secondAttribute="leading" id="NZn-bY-S54"/>
<constraint firstItem="lGY-TL-dYl" firstAttribute="leading" secondItem="InU-ap-ckM" secondAttribute="leading" id="OOP-99-iR6"/>
<constraint firstItem="lBw-C9-kAw" firstAttribute="top" secondItem="lGY-TL-dYl" secondAttribute="bottom" constant="8" id="R84-l7-gEy"/>
<constraint firstItem="PL9-nx-yy4" firstAttribute="top" secondItem="Wuq-OJ-QCj" secondAttribute="bottom" constant="8" id="RFb-zs-Rna"/>
<constraint firstItem="0PZ-a6-C0R" firstAttribute="trailing" secondItem="nzo-cq-BqT" secondAttribute="trailing" id="Wh0-fm-GSN"/>
<constraint firstItem="NfH-Md-IFn" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="top" id="YPj-dz-79I"/>
<constraint firstItem="XuV-wg-S6w" firstAttribute="trailing" secondItem="DQV-kq-kpF" secondAttribute="trailing" id="Z1E-Ku-RdM"/>
<constraint firstItem="rYe-dy-hot" firstAttribute="trailing" secondItem="LWV-xR-zzl" secondAttribute="trailing" id="ZTR-lL-C7h"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="NfH-Md-IFn" secondAttribute="trailing" id="btj-RB-kcG"/>
<constraint firstItem="UDx-40-ORS" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" id="cKh-cv-iHV"/>
<constraint firstItem="TLZ-33-q0M" firstAttribute="top" secondItem="f9G-OM-FNm" secondAttribute="bottom" constant="8" id="cjd-tY-Jkn"/>
<constraint firstItem="InU-ap-ckM" firstAttribute="leading" secondItem="nMe-JQ-ldk" secondAttribute="leading" id="cmC-jT-PSH"/>
<constraint firstItem="qNn-GH-aIG" firstAttribute="trailing" secondItem="TLZ-33-q0M" secondAttribute="trailing" id="ehL-FI-ZwW"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="UDx-40-ORS" secondAttribute="trailing" id="fxO-d5-Mwe"/>
<constraint firstItem="nzo-cq-BqT" firstAttribute="top" secondItem="XuV-wg-S6w" secondAttribute="bottom" constant="8" id="i1h-cz-mLN"/>
<constraint firstItem="LWV-xR-zzl" firstAttribute="trailing" secondItem="Q9J-69-63J" secondAttribute="trailing" id="l9Q-fD-Bsy"/>
<constraint firstItem="DQV-kq-kpF" firstAttribute="trailing" secondItem="Q9J-69-63J" secondAttribute="trailing" id="mrN-Ds-KmE"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="top" secondItem="UDx-40-ORS" secondAttribute="top" id="oLF-Sc-Qhf"/>
<constraint firstItem="nzo-cq-BqT" firstAttribute="trailing" secondItem="XuV-wg-S6w" secondAttribute="trailing" id="ohP-DX-JWl"/>
<constraint firstItem="f9G-OM-FNm" firstAttribute="top" secondItem="rYe-dy-hot" secondAttribute="bottom" constant="8" id="ovo-z1-d6N"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="Q9J-69-63J" secondAttribute="trailing" constant="20" id="rCg-Wp-oie"/>
<constraint firstItem="lBw-C9-kAw" firstAttribute="leading" secondItem="lGY-TL-dYl" secondAttribute="leading" id="ySo-8N-gmh"/>
<constraint firstItem="DQV-kq-kpF" firstAttribute="top" secondItem="PL9-nx-yy4" secondAttribute="bottom" constant="8" id="yX9-GM-OeU"/>
</constraints>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
<connections>
<outlet property="diskAccel" destination="DQV-kq-kpF" id="C0C-uj-iFP"/>
<outlet property="displayField" destination="nMe-JQ-ldk" id="0o6-Wq-oQd"/>
<outlet property="hires" destination="Vi7-A0-0Jo" id="EgG-IA-7JU"/>
<outlet property="speedometer" destination="Q9J-69-63J" id="iyH-O7-jbd"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="131.8840579710145" y="105.80357142857143"/>
</scene>
</scenes>
</document>

View File

@ -60,5 +60,9 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIAppFonts</key>
<array>
<string>PrintChar21.ttf</string>
</array>
</dict>
</plist>

View File

@ -7,14 +7,465 @@
//
import UIKit
import AVFoundation
let K : Double = 1000.0
let M : Double = (K * K)
let G : Double = (M * K)
let T : Double = (G * K)
let KB : Double = 1024.0
let MB : Double = (KB * KB)
let GB : Double = (MB * KB)
let TB : Double = (GB * KB)
var spk_up: AVAudioPlayer?
var spk_dn: AVAudioPlayer?
@_cdecl("ViewController_spk_up_play")
func spk_up_play() {
spk_up?.stop()
spk_dn?.stop()
spk_up?.play()
}
@_cdecl("ViewController_spk_dn_play")
func spk_dn_play() {
spk_up?.stop()
spk_dn?.stop()
spk_dn?.play()
}
#if METAL_YES
import Metal
#endif
class ViewController: UIViewController {
@IBOutlet weak var displayField: UITextView!
@IBOutlet weak var display: UITableViewCell!
@IBOutlet weak var speedometer: UILabel! // UITextFieldCell!
@IBOutlet weak var diskAccel: UILabel! // UITextFieldCell!
@IBOutlet weak var hires: HiRes!
// static let charConvStr : String =
// "@🄰🄱🄲🄳🄴🄵🄶🄷🄸🄹🄺🄻🄼🄽🄾🄿🅀🅁🅂🅃🅄🅅🅆🅇🅈🅉[\\]^_ !\"#$%&'()*+,-./0123456789:;<=>?" +
// "@🅰🅱🅲🅳🅴🅵🅶🅷🅸🅹🅺🅻🅼🅽🅾🅿🆀🆁🆂🆃🆄🆅🆆🆇🆈🆉[\\]^_!\"#$%&'()*+,-./0123456789:;<=>?" + // FL
// "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_ !\"#$%&'()*+,-./0123456789:;<=>?" +
// "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~?"
// static let charConvStr : String =
// "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_ !\"#$%&'()*+,-./0123456789:;<=>?" +
// "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_!\"#$%&'()*+,-./0123456789:;<=>?" + // FL
// "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\u{E0A0}!\"#$%&'()*+,-./0123456789:;<=>?" +
// "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~?"
// static let charConvStr : String =
// "\u{E140}\u{E141}\u{E142}\u{E143}\u{E144}\u{E145}\u{E146}\u{E147}\u{E148}\u{E149}\u{E14A}\u{E14B}\u{E14C}\u{E14D}\u{E14E}\u{E14F}\u{E150}\u{E151}\u{E152}\u{E153}\u{E154}\u{E155}\u{E156}\u{E157}\u{E158}\u{E159}\u{E15A}\u{E15B}\u{E15C}\u{E15D}\u{E15E}\u{E15F}\u{E120}\u{E121}\u{E122}\u{E123}\u{E124}\u{E125}\u{E126}\u{E127}\u{E128}\u{E129}\u{E12A}\u{E12B}\u{E12C}\u{E12D}\u{E12E}\u{E12F}\u{E130}\u{E131}\u{E132}\u{E133}\u{E134}\u{E135}\u{E136}\u{E137}\u{E138}\u{E139}\u{E13A}\u{E13B}\u{E13C}\u{E13D}\u{E13E}\u{E13F}" +
// "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_!\"#$%&'()*+,-./0123456789:;<=>?" + // FL
// "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\u{E0A0}!\"#$%&'()*+,-./0123456789:;<=>?" +
// "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~?"
static let charConvStrFlashOff : String =
"\u{E140}\u{E141}\u{E142}\u{E143}\u{E144}\u{E145}\u{E146}\u{E147}\u{E148}\u{E149}\u{E14A}\u{E14B}\u{E14C}\u{E14D}\u{E14E}\u{E14F}\u{E150}\u{E151}\u{E152}\u{E153}\u{E154}\u{E155}\u{E156}\u{E157}\u{E158}\u{E159}\u{E15A}\u{E15B}\u{E15C}\u{E15D}\u{E15E}\u{E15F}\u{E120}\u{E121}\u{E122}\u{E123}\u{E124}\u{E125}\u{E126}\u{E127}\u{E128}\u{E129}\u{E12A}\u{E12B}\u{E12C}\u{E12D}\u{E12E}\u{E12F}\u{E130}\u{E131}\u{E132}\u{E133}\u{E134}\u{E135}\u{E136}\u{E137}\u{E138}\u{E139}\u{E13A}\u{E13B}\u{E13C}\u{E13D}\u{E13E}\u{E13F}" +
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_ !\"#$%&'()*+,-./0123456789:;<=>?" + // FL
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_ !\"#$%&'()*+,-./0123456789:;<=>?" +
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~?"
static let charConvStrFlashOn : String =
"\u{E140}\u{E141}\u{E142}\u{E143}\u{E144}\u{E145}\u{E146}\u{E147}\u{E148}\u{E149}\u{E14A}\u{E14B}\u{E14C}\u{E14D}\u{E14E}\u{E14F}\u{E150}\u{E151}\u{E152}\u{E153}\u{E154}\u{E155}\u{E156}\u{E157}\u{E158}\u{E159}\u{E15A}\u{E15B}\u{E15C}\u{E15D}\u{E15E}\u{E15F}\u{E120}\u{E121}\u{E122}\u{E123}\u{E124}\u{E125}\u{E126}\u{E127}\u{E128}\u{E129}\u{E12A}\u{E12B}\u{E12C}\u{E12D}\u{E12E}\u{E12F}\u{E130}\u{E131}\u{E132}\u{E133}\u{E134}\u{E135}\u{E136}\u{E137}\u{E138}\u{E139}\u{E13A}\u{E13B}\u{E13C}\u{E13D}\u{E13E}\u{E13F}" +
"\u{E140}\u{E141}\u{E142}\u{E143}\u{E144}\u{E145}\u{E146}\u{E147}\u{E148}\u{E149}\u{E14A}\u{E14B}\u{E14C}\u{E14D}\u{E14E}\u{E14F}\u{E150}\u{E151}\u{E152}\u{E153}\u{E154}\u{E155}\u{E156}\u{E157}\u{E158}\u{E159}\u{E15A}\u{E15B}\u{E15C}\u{E15D}\u{E15E}\u{E15F}\u{E120}\u{E121}\u{E122}\u{E123}\u{E124}\u{E125}\u{E126}\u{E127}\u{E128}\u{E129}\u{E12A}\u{E12B}\u{E12C}\u{E12D}\u{E12E}\u{E12F}\u{E130}\u{E131}\u{E132}\u{E133}\u{E134}\u{E135}\u{E136}\u{E137}\u{E138}\u{E139}\u{E13A}\u{E13B}\u{E13C}\u{E13D}\u{E13E}\u{E13F}" +
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_ !\"#$%&'()*+,-./0123456789:;<=>?" +
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~?"
static let charConvTblFlashOn = Array( charConvStrFlashOn )
static let charConvTblFlashOff = Array( charConvStrFlashOff )
static var charConvTbl = charConvTblFlashOn
let textLineOfs : [Int] = [
0x000, 0x080, 0x100, 0x180, 0x200, 0x280, 0x300, 0x380, 0x028, 0x0A8, 0x128, 0x1A8,
0x228, 0x2A8, 0x328, 0x3A8, 0x050, 0x0D0, 0x150, 0x1D0, 0x250, 0x2D0, 0x350, 0x3D0
]
var workItem : DispatchWorkItem? = nil;
@IBAction func Power(_ sender: Any) {
#if SPEEDTEST
if ( workItem != nil ) {
workItem!.cancel();
workItem = nil;
}
else {
workItem = DispatchWorkItem {
DispatchQueue.global(qos: .userInteractive).async {
// DispatchQueue.global(qos: .userInitiated).async {
// DispatchQueue.global(qos: .background).async {
tst6502()
}
}
DispatchQueue.global().async(execute: workItem!);
}
#else
m6502_ColdReset( Bundle.main.bundlePath )
#endif
}
@IBAction func Reset(_ sender: Any) {
// let resetPointer = UnsafeRawBufferPointer(start: &RAM + 0x3F2, count: 2)
// let ral = UInt16(resetPointer[0])
// let rah = UInt16(resetPointer[1])
// let resetAddr = rah << 8 + ral
//
// let hex = String(resetAddr, radix: 16, uppercase: true)
// print("reset to:\(hex)\n")
// m6502.pc = resetAddr
m6502.interrupt = SOFTRESET;
}
@IBAction func Command(_ sender: UIButton) {
if let label = sender.titleLabel, let command = label.text {
for c in command {
kbdInput(c.asciiValue! + 128);
}
kbdInput(Character("\r").asciiValue! + 128);
}
}
// AppleScript Keycodes
let leftArrowKey = 123
let rightArrowKey = 124
let upArrowKey = 126
let downArrowKey = 125
// override func keyDown(with event: UIEvent) {
//// print("KBD Event")
//// switch event.modifierFlags.intersection(.deviceIndependentFlagsMask) {
//// case [.command] where event.characters == "l",
//// [.command, .shift] where event.characters == "l":
//// print("command-l or command-shift-l")
//// default:
//// break
//// }
//// print( "key = " + (event.charactersIgnoringModifiers ?? ""))
//// print( "\ncharacter = " + (event.characters ?? ""))
//
// #if FUNCTIONTEST
// #else
// let keyCode = Int(event.keyCode)
// switch keyCode {
// case leftArrowKey:
// kbdInput(0x08)
// case rightArrowKey:
// kbdInput(0x15)
// case leftArrowKey:
// kbdInput(0x0B)
// case rightArrowKey:
// kbdInput(0x0A)
// default:
//// print("keycode: %d", keyCode)
// if let chars = event.characters {
// let char = chars.uppercased()[chars.startIndex]
// if let ascii = char.asciiValue {
// kbdInput(ascii)
// }
// }
// }
// #endif
//
// }
// override func flagsChanged(with event: NSEvent) {
// switch event.modifierFlags.intersection(.deviceIndependentFlagsMask) {
// case [.shift]:
// print("shift key is pressed")
// case [.control]:
// print("control key is pressed")
// case [.option] :
// print("option key is pressed")
// case [.command]:
// print("Command key is pressed")
// case [.control, .shift]:
// print("control-shift keys are pressed")
// case [.option, .shift]:
// print("option-shift keys are pressed")
// case [.command, .shift]:
// print("command-shift keys are pressed")
// case [.control, .option]:
// print("control-option keys are pressed")
// case [.control, .command]:
// print("control-command keys are pressed")
// case [.option, .command]:
// print("option-command keys are pressed")
// case [.shift, .control, .option]:
// print("shift-control-option keys are pressed")
// case [.shift, .control, .command]:
// print("shift-control-command keys are pressed")
// case [.control, .option, .command]:
// print("control-option-command keys are pressed")
// case [.shift, .command, .option]:
// print("shift-command-option keys are pressed")
// case [.shift, .control, .option, .command]:
// print("shift-control-option-command keys are pressed")
// default:
// print("no modifier keys are pressed")
// }
// }
static let textBaseAddr = 0x400
static let textBufferSize = 0x400
let textLines = 24
let textCols = 40
let lineEndChars = 1
var frameCnt = 0
// let spaceChar : Character = "\u{E17F}"
// let blockChar : Character = "\u{E07F}"
let spaceChar : Character = " "
let blockChar : Character = ""
var flashingSpace : Character = " "
let ramBufferPointer = UnsafeRawBufferPointer(start: RAM, count: 64 * 1024)
let textBufferPointer = UnsafeRawBufferPointer(start: RAM + textBaseAddr, count: textBufferSize)
let txtClear = [Character](repeating: " ", count: textBufferSize)
var txtArr = txtClear
var s = String()
func HexDump() {
var txt : String = ""
for y in 0...textLines - 1 {
txt += String(format: "%04X: ", y * 16)
for x in 0...15 {
let byte = ramBufferPointer[ y * 16 + x ]
let chr = String(format: "%02X ", byte)
txt += chr
}
txt += "\n"
}
DispatchQueue.main.async {
self.displayField.text = txt
self.speedometer.text = String(format: "%0.3lf MHz", mhz);
}
}
var was = 0;
func Update() {
#if SPEEDTEST
#else
m6502_Run()
#endif
// render()
// hires.compute()
// HexDump()
// return
frameCnt += 1
if ( frameCnt == fps / 2 ) {
// flashingSpace = blockChar
ViewController.charConvTbl = ViewController.charConvTblFlashOn
}
else if ( frameCnt >= fps ) {
// flashingSpace = spaceChar
ViewController.charConvTbl = ViewController.charConvTblFlashOff
frameCnt = 0
}
var txt : String = ""
for y in 0...textLines-1 {
// let textAddr = textBaseAddr + textLineOfs[y]
// let linePointer = UnsafeMutableRawPointer( mutating: &RAM + textBaseAddr + y * textCols ) //( start: &RAM + 0x400, count: 0x400)
// let lineStr = String(bytesNoCopy: linePointer, length: textCols, encoding: .ascii, freeWhenDone: false)!
// txt += lineStr + "\n"
for x in 0...textCols-1 {
let byte = textBufferPointer[ textLineOfs[y] + x ]
let idx = Int(byte);
let chr = ViewController.charConvTbl[idx]
// is it a cursor? (slashing space)
// if ( chr == "blockChar" ) {
// chr = flashingSpace
// }
// print("byte \(index): \(chr)")
// txt = txt + "\(chr)"
txtArr[ y * (textCols + lineEndChars) + x ] = chr
}
// for (_, byte) in textBufferPointer.enumerated() {
// let idx = Int(byte);
// var chr = ViewController.charConvTbl[idx]
// // is it a cursor? (slashing space)
// if ( chr == blockChar ) {
// chr = flashingSpace
// }
// // print("byte \(index): \(chr)")
// txt = txt + "\(chr)"
// }
// txt = txt + "\n"
txtArr[ y * (textCols + lineEndChars) + textCols ] = "\n"
}
// txtArr[ textLines * (textCols+1) + textCols ] = "\0"
txt = String(txtArr)
DispatchQueue.main.async {
self.displayField.text = txt
// self.display.stringValue = "testing\nit\nout"
if ( (mhz < 10) && (mhz != floor(mhz)) ) {
self.speedometer.text = String(format: "%0.3lf MHz", mhz);
}
else {
self.speedometer.text = String(format: "%.0lf MHz", mhz);
}
#if HIRES
// if ( self.was < 300 ) {
// self.was += 1
//
// for x in stride(from: 0, to: 280, by: 7) {
// for y in stride(from: 0, to: 192, by: 8) {
// self.hires.setNeedsDisplay( CGRect(x: x, y: y, width: 7, height: 8) )
// }
// }
// }
// self.HiRes.setNeedsDisplay(self.HiRes.frame)
// self.hires.setNeedsDisplay( CGRect(x: 0, y: 191-50, width: 50, height: 50) )
self.hires.needsDisplay = true
// }
#endif
}
}
// func FromBuf(ptr: UnsafeMutablePointer<UInt8>, length len: Int) -> String? {
// // convert the bytes using the UTF8 encoding
// if let theString = NSString(bytes: ptr, length: len, encoding: NSUTF8StringEncoding) {
// return theString as String
// } else {
// return nil // the bytes aren't valid UTF8
// }
// }
let upd = RepeatingTimer(timeInterval: 1/Double(fps))
override var prefersStatusBarHidden: Bool {
return true
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let spk_up_path = Bundle.main.path(forResource: "spk_up", ofType:"wav")!
let spk_up_url = URL(fileURLWithPath: spk_up_path)
do {
spk_up = try AVAudioPlayer(contentsOf: spk_up_url)
// spk_up?.play()
} catch {
// couldn't load file :(
}
let spk_dn_path = Bundle.main.path(forResource: "spk_dn", ofType:"wav")!
let spk_dn_url = URL(fileURLWithPath: spk_dn_path)
do {
spk_dn = try AVAudioPlayer(contentsOf: spk_dn_url)
// spk_up?.play()
} catch {
// couldn't load file :(
}
//view.frame = CGRect(origin: CGPoint(), size: NSScreen.main!.visibleFrame.size)
// createHiRes()
// self.displayField.scaleUnitSquare(to: NSSize(width: 1, height: 1))
// NSEvent.removeMonitor(NSEvent.EventType.flagsChanged)
// NSEvent.addLocalMonitorForEvents(matching: .flagsChanged) {
// self.flagsChanged(with: $0)
// return $0
// }
// // NSEvent.removeMonitor(NSEvent.EventType.keyDown)
// NSEvent.addLocalMonitorForEvents(matching: .keyDown) {
//// print("keyDown event")
// self.keyDown(with: $0)
// return $0
// }
displayField.textContainer.maximumNumberOfLines = textLines
// displayField.preferredMaxLayoutWidth = displayField.frame.width
// DispatchQueue.main.asyncAfter(deadline: .now() + 1/fps, execute: {
// self.update()
// })
// #if FUNCTIONTEST
// #else
// DispatchQueue.global(qos: .background).async {
// self.update()
// }
upd.eventHandler = {
self.Update()
}
upd.resume()
// #endif
}
func setCPUClockSpeed( freq : Double ) {
mhz = freq
MHz_6502 = UInt64(mhz * M)
clk_6502_per_frm = MHz_6502 / UInt64(fps)
clk_6502_per_frm_set = clk_6502_per_frm
}
@IBAction func speedSelected(_ sender: UIButton) {
if ( sender.titleLabel?.text == "Max" ) {
clk_6502_per_frm = UINT64_MAX
}
else if let freqValue = sender.titleLabel?.text, let freq = Double( freqValue ) {
setCPUClockSpeed(freq: freq)
}
}
@IBAction func diskAccelSepected(_ sender: UIButton) {
if let freqValue = sender.titleLabel?.text, let freq = Int32( freqValue ) {
diskAccelerator_speed = freq
diskAccel.text = "Disk Accel: " + freqValue
}
}
}

Binary file not shown.

BIN
Resources/Crossfire.woz Normal file

Binary file not shown.

BIN
Resources/DISK_II_C600.ROM Normal file

Binary file not shown.

BIN
Resources/Donkey Kong.woz Normal file

Binary file not shown.

Binary file not shown.

BIN
Resources/Lode Runner.woz Normal file

Binary file not shown.

Binary file not shown.

BIN
Resources/PrintChar21.ttf Normal file

Binary file not shown.

BIN
Resources/ProDOS_312.woz Normal file

Binary file not shown.

Binary file not shown.

BIN
Resources/Sneakers.woz Normal file

Binary file not shown.

BIN
Resources/Wavy Navy.woz Normal file

Binary file not shown.

BIN
Resources/Xonix.woz Normal file

Binary file not shown.

BIN
Resources/apple.rom Normal file

Binary file not shown.

BIN
Resources/qbit.woz Normal file

Binary file not shown.

View File

@ -14,14 +14,14 @@
#include <string.h>
#include <time.h>
#include "6502.h"
#include "woz.h"
#include "../dev/disk/woz.h"
void ViewController_spk_up_play(void);
void ViewController_spk_dn_play(void);
#include "common.h"
#include "../util/common.h"
#define SOFTRESET_VECTOR 0x3F2
@ -43,12 +43,12 @@ unsigned long long clk_6502_per_frm_set = default_MHz_6502 / fps;
unsigned long long tick_per_sec = G;
unsigned long long tick_6502_per_sec = 0;
INLINE unsigned long long rdtsc(void)
{
unsigned hi, lo;
__asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi) );
return ( (unsigned long long)lo) | ( ((unsigned long long)hi) << 32 );
}
//INLINE unsigned long long rdtsc(void)
//{
// unsigned hi, lo;
// __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi) );
// return ( (unsigned long long)lo) | ( ((unsigned long long)hi) << 32 );
//}
m6502_t m6502 = {
0, // A
@ -538,7 +538,7 @@ INLINE int m6502_Step() {
case 0x75: ADC( src_zp_X() ); return 4; // ADC zpg,X
case 0x76: ROR( dest_zp_X() ); return 6; // ROR zpg,X
// case 0x77:
case 0x78: SEI(); break; // SEI
case 0x78: SEI(); return 2; // SEI
case 0x79: ADC( src_abs_Y() ); return 4; // ADC abs,Y
// case 0x7A:
// case 0x7B:
@ -610,8 +610,8 @@ INLINE int m6502_Step() {
case 0xBD: LDA( src_abs_X() ); return 4; // LDA abs,X
case 0xBE: LDX( src_abs_Y() ); return 4; // LDX abs,Y
// case 0xBF:
case 0xC0: CPY( imm() ); break; // CPY imm
case 0xC1: CMP( src_X_ind() ) ; break; // LDA X,ind
case 0xC0: CPY( imm() ); return 2; // CPY imm
case 0xC1: CMP( src_X_ind() ) ; return 6; // LDA X,ind
// case 0xC2:
// case 0xC3:
case 0xC4: CPY( src_zp() ); return 3; // CPY zpg
@ -624,7 +624,7 @@ INLINE int m6502_Step() {
// case 0xCB:
case 0xCC: CPY( src_abs() ); return 4; // CPY abs
case 0xCD: CMP( src_abs() ); return 4; // CMP abs
case 0xCE: DEC( dest_abs() ); return 4; // DEC abs
case 0xCE: DEC( dest_abs() ); return 6; // DEC abs
// case 0xCF:
case 0xD0: BNE( rel_addr() ); return 2; // BNE rel
case 0xD1: CMP( src_ind_Y() ); return 5; // CMP ind,Y
@ -672,7 +672,7 @@ INLINE int m6502_Step() {
// case 0xFB:
// case 0xFC:
case 0xFD: SBC( src_abs_X() ); return 4; // SBC abs,X
case 0xFE: INC( dest_abs_X() ); return 6; // INC abs,X
case 0xFE: INC( dest_abs_X() ); return 7; // INC abs,X
// case 0xFF:
default:
@ -804,6 +804,11 @@ void m6502_Run() {
}
// if ( m6502.clktime - disk.clk_last_access > clk_diskAcceleratorTimeout ) {
clk_6502_per_frm = clk_6502_per_frm_set;
// }
// clock_t end = clock();
// double execution_time = ((double) (end - start)) / CLOCKS_PER_SEC;
// unsigned long long e = rdtsc();
@ -814,10 +819,17 @@ void m6502_Run() {
// mhz = clktime / (execution_time * M);
}
void read_rom( const char * filename, uint8_t * rom, const uint16_t addr ) {
FILE * f = fopen(filename, "rb");
void read_rom( const char * bundlePath, const char * filename, uint8_t * rom, const uint16_t addr ) {
char fullPath[256];
strcpy( fullPath, bundlePath );
strcat(fullPath, "/");
strcat(fullPath, filename);
FILE * f = fopen(fullPath, "rb");
if (f == NULL) {
perror("Failed: ");
perror("Failed to read ROM: ");
return;
}
@ -831,15 +843,17 @@ void read_rom( const char * filename, uint8_t * rom, const uint16_t addr ) {
}
void m6502_ColdReset() {
void m6502_ColdReset( const char * bundlePath ) {
inst_cnt = 0;
mhz = (double)MHz_6502 / M;
printf("Bundlepath: %s", bundlePath);
epoch = rdtsc();
sleep(1);
unsigned long long e = rdtsc();
tick_per_sec = e - epoch;
tick_6502_per_sec = tick_per_sec / MHz_6502;
// epoch = rdtsc();
// sleep(1);
// unsigned long long e = rdtsc();
// tick_per_sec = e - epoch;
// tick_6502_per_sec = tick_per_sec / MHz_6502;
memset( RAM, 0, sizeof(Apple2_64K_RAM) );
memset( RAM + 0xC000, 0, 0x1000 ); // I/O area should be 0
@ -865,19 +879,42 @@ void m6502_ColdReset() {
#else
// Apple ][+ ROM
read_rom("/Users/trudnai/Library/Containers/com.gamealloy.A2Mac/Data/Apple2Plus.rom", Apple2_12K_ROM, 0);
read_rom( bundlePath, "Apple2Plus.rom", Apple2_12K_ROM, 0);
// read_rom( "/Users/trudnai/Library/Containers/com.gamealloy.A2Mac/Data/", "Apple2Plus.rom", Apple2_12K_ROM, 0);
// read_rom("/Users/trudnai/Library/Containers/com.gamealloy.A2Mac/Data/Apple2Plus.rom", Apple2_12K_ROM, 0);
memcpy(Apple2_64K_RAM + 0xD000, Apple2_12K_ROM, sizeof(Apple2_12K_ROM));
// Disk ][ ROM in Slot 6
read_rom("/Users/trudnai/Library/Containers/com.gamealloy.A2Mac/Data/DISK_II_C600.ROM", Apple2_64K_RAM, 0xC600);
read_rom( bundlePath, "DISK_II_C600.ROM", Apple2_64K_RAM, 0xC600);
// read_rom( "/Users/trudnai/Library/Containers/com.gamealloy.A2Mac/Data/", "DISK_II_C600.ROM", Apple2_64K_RAM, 0xC600);
// WOZ DISK
// woz_loadFile("/Users/trudnai/Library/Containers/com.gamealloy.A2Mac/Data/DOS 3.3 System Master.woz");
// woz_loadFile("/Users/trudnai/Library/Containers/com.gamealloy.A2Mac/Data/Hard Hat Mack - Disk 1, Side A.woz");
// woz_loadFile("/Users/trudnai/Library/Containers/com.gamealloy.A2Mac/Data/Merlin-8 v2.48 (DOS 3.3).woz");
// woz_loadFile("/Users/trudnai/Library/Containers/com.gamealloy.A2Mac/Data/DOS3.3.Launcher.2.2.woz");
woz_loadFile("/Users/trudnai/Library/Containers/com.gamealloy.A2Mac/Data/Apple DOS 3.3 January 1983.woz");
// woz_loadFile("/Users/trudnai/Library/Containers/com.gamealloy.A2Mac/Data/", "Apple DOS 3.3 January 1983.woz");
// GAMES
//woz_loadFile( bundlePath, "qbit.woz"); // Lode Runner, Hard Hat Mack, QBit, Crossfire, Heat Seaker, Flight Simulator
// woz_loadFile( bundlePath, "Donkey Kong.woz");
/**/// woz_loadFile( bundlePath, "Crossfire.woz");
// woz_loadFile( bundlePath, "Lode Runner.woz");
/**/// woz_loadFile( bundlePath, "Sneakers.woz");
/**/// woz_loadFile( bundlePath, "Wavy Navy.woz");
/**/// woz_loadFile( bundlePath, "Xonix.woz");
/**/// woz_loadFile( bundlePath, "Hard Hat Mack - Disk 1, Side A.woz");
// SYSTEM
/* Requires 64K */// woz_loadFile( bundlePath, "ProDOS_312.woz");
// woz_loadFile( bundlePath, "Merlin-8 v2.48 (DOS 3.3).woz");
woz_loadFile( bundlePath, "Apple DOS 3.3 January 1983.woz");
m6502.A = m6502.X = m6502.Y = 0xFF;
// reset vector
m6502.SP = 0xFF; //-3;
@ -1004,10 +1041,10 @@ void tst6502() {
// insert code here...
printf("6502\n");
m6502_ColdReset();
m6502_ColdReset( "" );
// clock_t start = clock();
epoch = rdtsc();
// epoch = rdtsc();
m6502_Run();
// clock_t end = clock();
// double execution_time = ((double) (end - start)) / CLOCKS_PER_SEC;

View File

@ -10,7 +10,7 @@
#define __6502_H__
#include <stdint.h>
#include "common.h"
#include "../../src/util/common.h"
extern unsigned long long MHz_6502;
@ -92,6 +92,21 @@ typedef struct disassembly_s {
} disassembly_t;
typedef union videoMode_u {
struct {
uint8_t text : 1; // 0: graphics 1: text
uint8_t col80 : 1; // 0: 40 col 1: 80 col
uint8_t altChr : 1; // 0: normal 1: alternate character set
uint8_t mixed : 1; // 0: no mix 1: mixed graphics and text when in graphics mode
uint8_t hires : 1; // 0: loRes 1: hiRes
uint8_t page : 1; // 0: page 1 1: page 2 (aux video memory)
};
uint8_t mode;
} videoMode_t;
extern videoMode_t videoMode;
extern m6502_t m6502;
extern uint8_t * RAM;
extern uint32_t * videoMemPtr;
@ -101,12 +116,13 @@ extern void hires_Update(void);
extern double mips;
extern double mhz;
#define fps 15
#define fps 30
extern void tst6502(void);
extern void m6502_ColdReset(void);
extern void m6502_ColdReset( const char * bundlePath );
extern void m6502_Run(void);
extern void kbdInput ( uint8_t code );
extern void setIO ( uint16_t ioaddr, uint8_t val );

View File

@ -10,8 +10,13 @@
#define __6502_INSTR_BRANCH_H__
INLINE void BRA( int8_t reladdr ) {
uint8_t pg = m6502.PC >> 8;
m6502.PC += reladdr;
#ifdef CLK_ABSOLUTE_PRECISE
m6502.clktime += m6502.PC >> 8 == pg ? 1 : 2;
#else
m6502.clktime++;
#endif
#ifdef DEBUG
if ( reladdr == -2 ) {
dbgPrintf2("Infinite Loop at %04X!\n", m6502.PC);

View File

@ -68,9 +68,9 @@ INLINE void RTS() {
// disk accelerator would only work for a certain amount of time
// currently it is 200ms simulated times
if ( m6502.clktime - disk.clk_last_access > clk_diskAcceleratorTimeout ) {
clk_6502_per_frm = clk_6502_per_frm_set;
}
// if ( m6502.clktime - disk.clk_last_access > clk_diskAcceleratorTimeout ) {
// clk_6502_per_frm = clk_6502_per_frm_set;
// }
}
/**

View File

@ -7,8 +7,8 @@
//
#include "disk.h"
#include "6502.h"
#include "common.h"
#include "../../cpu/6502.h"
#include "../../util/common.h"
#include "woz.h"
@ -17,8 +17,9 @@ disk_t disk = {
0, // clk_since_last_read
};
const unsigned long long clk_6502_per_frm_diskAccelerator = 25 * M / fps; // disk acceleration bumps up CPU clock to 25 MHz
const unsigned long long clk_diskAcceleratorTimeout = 200000ULL;
int diskAccelerator_speed = 25; // 0 means no acceleration
//const unsigned long long clk_6502_per_frm_diskAccelerator = 25 * M / fps; // disk acceleration bumps up CPU clock to 25 MHz
//const unsigned long long clk_diskAcceleratorTimeout = 1000ULL;
// motor position from the magnet state
@ -61,7 +62,10 @@ void disk_phase() {
// printf(", p:%d d:%d l:%d: ph:%u trk:%u)", position, direction, lastPosition, phase.count, woz_tmap.phase[phase.count]);
disk.clk_last_access = m6502.clktime;
clk_6502_per_frm = clk_6502_per_frm_diskAccelerator;
if ( diskAccelerator_speed > clk_6502_per_frm ) {
// clk_6502_per_frm = clk_6502_per_frm_diskAccelerator;
clk_6502_per_frm = diskAccelerator_speed * M / fps; // clk_6502_per_frm_diskAccelerator;
}
}
else {
@ -75,7 +79,9 @@ void disk_phase() {
uint8_t disk_read() {
dbgPrintf("io_DISK_READ (S%u)\n", 6);
disk.clk_last_access = m6502.clktime;
clk_6502_per_frm = clk_6502_per_frm_diskAccelerator;
if ( diskAccelerator_speed > 2 ) {
clk_6502_per_frm = diskAccelerator_speed * M / fps; // clk_6502_per_frm_diskAccelerator;
}
return woz_read();
}

View File

@ -9,7 +9,7 @@
#ifndef disk_h
#define disk_h
#include "common.h"
#include "../../util/common.h"
#define minDiskTrackNum 0
@ -52,8 +52,10 @@ extern disk_t disk;
extern const int magnet_to_Poistion[16];
extern const int position_to_direction[8][8];
extern const unsigned long long clk_6502_per_frm_diskAccelerator;
extern const unsigned long long clk_diskAcceleratorTimeout;
extern int diskAccelerator_speed; // 0 means no acceleration
//extern const unsigned long long clk_6502_per_frm_diskAccelerator;
//extern const unsigned long long clk_diskAcceleratorTimeout;
extern void disk_phase(void);
extern uint8_t disk_read(void);

View File

@ -7,6 +7,7 @@
//
#include <stdlib.h>
#include <string.h>
#include "woz.h"
#include "disk.h"
@ -85,13 +86,12 @@ uint8_t woz_read() {
return rand();
}
#ifdef WOZ_REAL_SPIN
if ( track != track_loaded ) {
woz_loadTrack(track);
track_loaded = track;
}
#ifdef WOZ_REAL_SPIN
WOZread.shift32 = 0;
bitOffset = (m6502.clktime >> 2) & 7;
trackOffset = (m6502.clktime >> 5) % WOZ_TRACK_BYTE_COUNT;
@ -253,23 +253,25 @@ uint8_t woz_read() {
#else // WOZ_REAL_SPIN
clkelpased = m6502.clktime - m6502.clklast;
m6502.clklast = m6502.clktime;
uint16_t usedBytes = woz_trks[track].bytes_used < WOZ_TRACK_BYTE_COUNT ? woz_trks[track].bytes_used : WOZ_TRACK_BYTE_COUNT;
if ( clkelpased > 100 ) {
// printf("NEED SYNC : %llu\n", clkelpased);
bitOffset = (clkelpased >> 2) & 7;
trackOffset += ((clkelpased >> 5) +100) % WOZ_TRACK_BYTE_COUNT;
trackOffset += ((clkelpased >> 5) +100) % usedBytes;
WOZread.data = woz_trks[track].data[trackOffset];
}
// to avoid infinite loop and to search for bit 7 high
for ( int i = 0; i < WOZ_TRACK_BYTE_COUNT * 8; i++ ) {
for ( int i = 0; i < usedBytes * 8; i++ ) {
if ( ++bitOffset >= 8 ) {
bitOffset = 0;
// if ( ++trackOffset >= WOZ_TRACK_BYTE_COUNT ) {
// trackOffset = 0;
// }
trackOffset++;
trackOffset %= WOZ_TRACK_BYTE_COUNT;
trackOffset %= usedBytes;
// printf("offs:%u\n", trackOffset);
WOZread.data = woz_trks[track].data[trackOffset];
@ -292,10 +294,17 @@ uint8_t woz_read() {
}
void woz_loadFile( const char * filename ) {
FILE * f = fopen(filename, "rb");
void woz_loadFile( const char * bundlePath, const char * filename ) {
char fullpath[256];
strcpy(fullpath, bundlePath);
strcat(fullpath, "/");
strcat(fullpath, filename);
FILE * f = fopen(fullpath, "rb");
if (f == NULL) {
perror("Failed: ");
perror("Failed to read WOZ: ");
return;
}

View File

@ -120,7 +120,7 @@ extern uint8_t WOZlatch;
extern uint8_t woz_read(void);
extern void woz_loadFile( const char * filename );
extern void woz_loadFile( const char * bundlePath, const char * filename );
#endif /* woz_h */

View File

@ -24,6 +24,8 @@ typedef union address16_u {
} address16_t;
videoMode_t videoMode = { 1 }; // 40 col text, page 1
uint8_t Apple2_Dummy_Page[ 1 * PG ]; // Dummy Page for discarding data
uint8_t Apple2_512_AUX[ 2 * PG ] = {0}; // Auxiliary bank for page 0 and 1
@ -178,11 +180,35 @@ struct MEMcfg_s {
} MEMcfg = { 1, 0, 0, 0, 0 };
enum mmio {
// Keyboard
io_KBD = 0xC000,
io_KBDSTRB = 0xC010,
// Audio
io_SPKR = 0xC030,
// Video
io_VID_80col_OFF = 0xC00C,
io_VID_80col_ON = 0xC00D,
io_VID_AltChar_OFF = 0xC00E,
io_VID_AltChar_ON = 0xC00F,
io_VID_Text_OFF = 0xC050,
io_VID_Text_ON = 0xC051,
io_VID_Mixed_OFF = 0xC052,
io_VID_Mixed_ON = 0xC053,
io_VID_Page2_OFF = 0xC054,
io_VID_Page2_ON = 0xC055,
io_VID_Hires_OFF = 0xC056,
io_VID_Hires_ON = 0xC057,
// Game Controller
io_PDL0 = 0xC064,
io_PDL1 = 0xC065,
io_PDL2 = 0xC066,
io_PDL3 = 0xC067,
io_PDL_STROBE = 0xC070,
// Disk ][
io_DISK_PHASE0_OFF = 0xC080,
io_DISK_PHASE0_ON = 0xC081,
io_DISK_PHASE1_OFF = 0xC082,
@ -200,6 +226,7 @@ enum mmio {
io_DISK_CLEAR = 0xC08E,
io_DISK_SHIFT = 0xC08F,
// Memory
io_MEM_RDRAM_NOWR_2 = 0xC080,
io_MEM_RDROM_WRAM_2 = 0xC081,
io_MEM_RDROM_NOWR_2 = 0xC082,
@ -239,6 +266,64 @@ INLINE uint8_t ioRead( uint16_t addr ) {
return RAM[io_SPKR];
case io_VID_80col_OFF:
videoMode.col80 = 0;
break;
case io_VID_80col_ON:
videoMode.col80 = 1;
break;
case io_VID_AltChar_OFF:
videoMode.altChr = 0;
break;
case io_VID_AltChar_ON:
videoMode.altChr = 1;
break;
case io_VID_Text_OFF:
videoMode.text = 0;
break;
case io_VID_Text_ON:
videoMode.text = 1;
break;
case io_VID_Mixed_OFF:
videoMode.mixed = 0;
break;
case io_VID_Mixed_ON:
videoMode.mixed = 1;
break;
case io_VID_Page2_OFF:
videoMode.page = 0;
break;
case io_VID_Page2_ON:
videoMode.page = 1;
break;
case io_VID_Hires_OFF:
videoMode.hires = 0;
break;
case io_VID_Hires_ON:
videoMode.hires = 1;
break;
case io_PDL0:
case io_PDL1:
case io_PDL2:
case io_PDL3:
// if ( RAM[addr] > 127 ) {
// RAM[addr]--;
// }
return RAM[addr];
case io_MEM_RDRAM_NOWR_2:
case io_MEM_RDROM_WRAM_2:
case io_MEM_RDROM_NOWR_2:
@ -380,6 +465,11 @@ INLINE uint8_t ioRead( uint16_t addr ) {
}
void setIO ( uint16_t ioaddr, uint8_t val ) {
RAM[ioaddr] = val;
}
void kbdInput ( uint8_t code ) {
// printf("kbdInput: %02X ('%c')\n", code, isprint(code) ? code : ' ');
switch ( code ) {
@ -397,7 +487,7 @@ void kbdInput ( uint8_t code ) {
code |= 0x80;
while ( RAM[io_KBD] > 0x7F ) {
for( int i = 1000; i && ( RAM[io_KBD] > 0x7F ); --i ) {
usleep(10);
}
@ -483,6 +573,11 @@ static void memwrite( uint16_t addr, uint8_t byte ) {
**/
INLINE uint8_t fetch() {
disHexB( disassembly.pOpcode, RAM[m6502.PC] );
#ifdef CLK_ABSOLUTE_PRECISE
if ( (m6502.PC & 0xFF) >= 0xFF ) {
m6502.clktime++;
}
#endif
return memread( m6502.PC++ );
}
@ -493,6 +588,11 @@ INLINE uint8_t fetch() {
INLINE uint16_t fetch16() {
uint16_t word = memread16( m6502.PC );
// disPrintf(disassembly.comment, "fetch16:%04X", word);
#ifdef CLK_ABSOLUTE_PRECISE
if ( (m6502.PC & 0xFF) >= 0xFE ) {
m6502.clktime++;
}
#endif
m6502.PC += 2;
disHexW( disassembly.pOpcode, word );
return word;