- Fixed 80 col rendering issue

- Interestingly speed bumped up a bit too
This commit is contained in:
tudnai 2020-05-26 21:13:31 -07:00
parent 0e1fc3e44b
commit e18173605b
6 changed files with 61 additions and 33 deletions

View File

@ -28,6 +28,7 @@
32440B7D247CB649000F9DA1 /* Merlin Macroassembler Side 1 (SDS, 1983).woz in Resources */ = {isa = PBXBuildFile; fileRef = 32440B7B247CB649000F9DA1 /* Merlin Macroassembler Side 1 (SDS, 1983).woz */; };
32440B80247CB66C000F9DA1 /* Merlin Assembler (early version, 40-column, DOS 3.3) side A.woz in Resources */ = {isa = PBXBuildFile; fileRef = 32440B7E247CB66C000F9DA1 /* Merlin Assembler (early version, 40-column, DOS 3.3) side A.woz */; };
32440B81247CB66C000F9DA1 /* Merlin Assembler (early version, 40-column, DOS 3.3) side B.woz in Resources */ = {isa = PBXBuildFile; fileRef = 32440B7F247CB66C000F9DA1 /* Merlin Assembler (early version, 40-column, DOS 3.3) side B.woz */; };
32440B83247CC4C0000F9DA1 /* Wavy Navy (4am crack).woz in Resources */ = {isa = PBXBuildFile; fileRef = 32440B82247CC4C0000F9DA1 /* Wavy Navy (4am crack).woz */; };
325EB62F23F8856F00C6B4A4 /* woz.c in Sources */ = {isa = PBXBuildFile; fileRef = 325EB62E23F8856F00C6B4A4 /* woz.c */; };
325EB63623F8F78300C6B4A4 /* disk.c in Sources */ = {isa = PBXBuildFile; fileRef = 325EB63523F8F78300C6B4A4 /* disk.c */; };
325EB63923F9E48100C6B4A4 /* common.c in Sources */ = {isa = PBXBuildFile; fileRef = 325EB63823F9E48100C6B4A4 /* common.c */; };
@ -174,6 +175,7 @@
32440B7B247CB649000F9DA1 /* Merlin Macroassembler Side 1 (SDS, 1983).woz */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Merlin Macroassembler Side 1 (SDS, 1983).woz"; sourceTree = "<group>"; };
32440B7E247CB66C000F9DA1 /* Merlin Assembler (early version, 40-column, DOS 3.3) side A.woz */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Merlin Assembler (early version, 40-column, DOS 3.3) side A.woz"; sourceTree = "<group>"; };
32440B7F247CB66C000F9DA1 /* Merlin Assembler (early version, 40-column, DOS 3.3) side B.woz */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Merlin Assembler (early version, 40-column, DOS 3.3) side B.woz"; sourceTree = "<group>"; };
32440B82247CC4C0000F9DA1 /* Wavy Navy (4am crack).woz */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Wavy Navy (4am crack).woz"; sourceTree = "<group>"; };
325EB62D23F8856F00C6B4A4 /* woz.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = woz.h; sourceTree = "<group>"; };
325EB62E23F8856F00C6B4A4 /* woz.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = woz.c; sourceTree = "<group>"; };
325EB63423F8F78300C6B4A4 /* disk.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = disk.h; sourceTree = "<group>"; };
@ -452,6 +454,7 @@
325EB6972401118200C6B4A4 /* Qbit.woz */,
325EB69A2401118300C6B4A4 /* Sneakers.woz */,
325EB6962401118200C6B4A4 /* Wavy Navy.woz */,
32440B82247CC4C0000F9DA1 /* Wavy Navy (4am crack).woz */,
325EB69B2401118300C6B4A4 /* Xonix.woz */,
32440B73247CAA00000F9DA1 /* Merlin Pro 2.45 (DOS) Disk 1-2.woz */,
32440B74247CAA00000F9DA1 /* Merlin Pro 2.45 (DOS) Disk 2-2.woz */,
@ -825,6 +828,7 @@
325EB69023FE028800C6B4A4 /* Donkey Kong.woz in Resources */,
325EB68923FDDF6200C6B4A4 /* Hard Hat Mack - Disk 1, Side A.woz in Resources */,
325EB69F2401118300C6B4A4 /* Crossfire.woz in Resources */,
32440B83247CC4C0000F9DA1 /* Wavy Navy (4am crack).woz in Resources */,
32440B81247CB66C000F9DA1 /* Merlin Assembler (early version, 40-column, DOS 3.3) side B.woz in Resources */,
32440B80247CB66C000F9DA1 /* Merlin Assembler (early version, 40-column, DOS 3.3) side A.woz in Resources */,
32BFFB5F22EACC660003B53F /* Assets.xcassets in Resources */,

View File

@ -66,9 +66,21 @@
<ContextState
contextName = "closure #1 in ViewController.Update():ViewController.swift">
<PersistentStrings>
<PersistentString
value = "MEMcfg.txt_page_2">
</PersistentString>
<PersistentString
value = "self.shadowTxt">
</PersistentString>
<PersistentString
value = "txt">
</PersistentString>
<PersistentString
value = "MEMcfg.is_80STORE">
</PersistentString>
<PersistentString
value = "txtArr">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
@ -215,13 +227,16 @@
contextName = "textPageSelect:mmio.h">
<PersistentStrings>
<PersistentString
value = "AUX[0x22]">
value = "MEMcfg">
</PersistentString>
<PersistentString
value = "RAM[0x22]">
</PersistentString>
<PersistentString
value = "MEMcfg">
value = "AUX[0x22]">
</PersistentString>
<PersistentString
value = "newTextPage">
</PersistentString>
</PersistentStrings>
</ContextState>

View File

@ -711,6 +711,12 @@
<action selector="Disk1_Selected:" target="Voe-Tx-rLC" id="lcd-GR-OVR"/>
</connections>
</menuItem>
<menuItem title="Wavy Navy (4am crack)" identifier="Wavy Navy (4am crack)" id="owL-6l-KXD">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="Disk1_Selected:" target="Voe-Tx-rLC" id="hRl-0O-47L"/>
</connections>
</menuItem>
<menuItem title="Xonix" identifier="Xonix" id="242-uR-ubX">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>

View File

@ -192,10 +192,12 @@ class ViewController: NSViewController {
// static var flashingSpace : Character = " "
let ramBufferPointer = UnsafeRawBufferPointer(start: MEM, count: 64 * 1024)
static let textPage1Pointer = UnsafeRawBufferPointer(start: MEM + textPage1Addr, count: textBufferSize * 2)
static let textPage2Pointer = UnsafeRawBufferPointer(start: MEM + textPage2Addr, count: textBufferSize * 2)
static let textPage1Pointer = UnsafeRawBufferPointer(start: MEM + textPage1Addr, count: textBufferSize)
static let textPage2Pointer = UnsafeRawBufferPointer(start: MEM + textPage2Addr, count: textBufferSize)
static let textIntBufferPointer = UnsafeRawBufferPointer(start: RAM + textPage1Addr, count: textBufferSize)
static let textAuxBufferPointer = UnsafeRawBufferPointer(start: AUX + textPage1Addr, count: textBufferSize)
var textBufferPointer = textPage1Pointer
let textAuxBufferPointer = UnsafeRawBufferPointer(start: AUX + textPage1Addr, count: textBufferSize)
static let textArraySize = textLines * (textCols + lineEndChars) + textCols * 2
@ -495,7 +497,7 @@ class ViewController: NSViewController {
// Rendering is happening in the main thread, which has two implications:
// 1. We can update UI elements
// 2. it is independent of the simulation, de that is running in the background thread while we are busy with rendering...
DispatchQueue.main.async {
DispatchQueue.main.sync {
var txt : String = ""
var fromLines = 0
@ -542,16 +544,21 @@ class ViewController: NSViewController {
}
// 80 col
else {
let auxPage = ( MEMcfg.is_80STORE == 1 ) && ( MEMcfg.txt_page_2 == 1 )
let textIntBuffer = auxPage ? ViewController.textIntBufferPointer : ViewController.textPage1Pointer
let textAuxBuffer = auxPage ? ViewController.textPage1Pointer : ViewController.textAuxBufferPointer
// render the rest of the text screen
for y in fromLines ..< toLines {
for x in 0 ..< self.textCols {
let byte = self.textBufferPointer[ self.textLineOfs[y] + x ]
let byte = textIntBuffer[ self.textLineOfs[y] + x ]
let idx = Int(byte);
let chr = ViewController.charConvTbl[idx]
self.txtArr[ y * (self.textCols * 2 + self.lineEndChars) + x * 2 + 1] = chr
let byte2 = self.textAuxBufferPointer[ self.textLineOfs[y] + x ]
let byte2 = textAuxBuffer[ self.textLineOfs[y] + x ]
let idx2 = Int(byte2);
let chr2 = ViewController.charConvTbl[idx2]

Binary file not shown.

View File

@ -328,36 +328,32 @@ void resetMemory() {
}
static uint8_t page2 = 0;
static uint8_t * activePage = Apple2_64K_RAM + 0x400;
static uint8_t activeTextAuxPage = 0;
static uint8_t * activeTextPage = Apple2_64K_RAM + 0x400;
static uint8_t * shadowTextPage = Apple2_64K_MEM + 0x400;
inline uint8_t *extracted() {
uint8_t * shadow = Apple2_64K_MEM + 0x400;
return shadow;
}
void textPageSelect() {
uint8_t * shadow = Apple2_64K_MEM + 0x400;
uint8_t textAuxPage = MEMcfg.is_80STORE && MEMcfg.txt_page_2;
if ( page2 != MEMcfg.txt_page_2 ) {
page2 = MEMcfg.txt_page_2;
static uint8_t * newPage = NULL;
if ( activeTextAuxPage != textAuxPage ) {
activeTextAuxPage = textAuxPage;
uint8_t * newTextPage = ( textAuxPage ? Apple2_64K_AUX : Apple2_64K_RAM ) + 0x400;
if ( MEMcfg.is_80STORE && MEMcfg.txt_page_2 ) {
newPage = Apple2_64K_AUX + 0x400;
}
else {
newPage = Apple2_64K_RAM + 0x400;
}
if ( activePage != newPage ) {
if ( activePage ) {
// save the content of Shadow Memory
memcpy(activePage, shadow, 0x400);
}
// load the content of Video Page 2
memcpy(shadow, newPage, 0x400);
activePage = newPage;
if ( activeTextPage ) {
// save the content of Shadow Memory
memcpy(activeTextPage, shadowTextPage, 0x400);
}
// load the content of new Video Page
memcpy(shadowTextPage, newTextPage, 0x400);
activeTextPage = newTextPage;
}
}
@ -786,7 +782,7 @@ INLINE void ioWrite( uint16_t addr, uint8_t val ) {
case io_VID_TXTPAGE2:
// printf("io_VID_TXTPAGE2\n");
MEMcfg.txt_page_2 = ! MEMcfg.is_80STORE;
MEMcfg.txt_page_2 = 1;
textPageSelect();
break;