- Disassembly shadow view

- Disassembly Highlighter background View
- Disassembly Background color view
This commit is contained in:
tudnai 2022-11-25 20:17:39 -08:00
parent 55fd25d01a
commit 0ac222ad3f
3 changed files with 290 additions and 204 deletions

View File

@ -3,16 +3,31 @@
version = "1.0">
<ContextStates>
<ContextState
contextName = "specialized closure #1 in DebuggerViewController.DisplayDisassembly():DebuggerViewController.swift">
contextName = "spkr_toggle:speaker.c">
<PersistentStrings>
<PersistentString
value = "line_number">
value = "default_MHz_6502 * 1000 * 1000 / spkr_sample_rate">
</PersistentString>
<PersistentString
value = "currentScrollLine">
value = "( (spkr_clk + m6502.clkfrm) / ( 1024000 / spkr_sample_rate ) ) * 2">
</PersistentString>
<PersistentString
value = "current_line_number">
value = "(int16_t)28000 + (int16_t)-32768">
</PersistentString>
<PersistentString
value = "spkr_samples[spkr_sample_last_idx]">
</PersistentString>
<PersistentString
value = "(int)spkr_sample_idx_diff">
</PersistentString>
<PersistentString
value = "m6502.clkfrm">
</PersistentString>
<PersistentString
value = "(spkr_clk + m6502.clkfrm)">
</PersistentString>
<PersistentString
value = "( (spkr_clk + m6502.clkfrm) / ( default_MHz_6502 * 1000 * 1000 / spkr_sample_rate)) * 2">
</PersistentString>
</PersistentStrings>
</ContextState>
@ -20,49 +35,29 @@
contextName = "HiRes.compute():HiRes.swift">
<PersistentStrings>
<PersistentString
value = "UnsafeRawBufferPointer(result)">
value = "computePipelineState.maxTotalThreadsPerThreadgroup">
</PersistentString>
<PersistentString
value = "result[2]">
</PersistentString>
<PersistentString
value = "computePipelineState.maxTotalThreadsPerThreadgroup">
value = "UnsafeRawBufferPointer(result)">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "ViewController.mouseMoved(with:):ViewController.swift">
contextName = "memwrite8_bank2:mmio.h">
<PersistentStrings>
<PersistentString
value = "oldLocation">
value = "WRD0MEM">
</PersistentString>
<PersistentString
value = "mouseLocation">
</PersistentString>
<PersistentString
value = "view.bounds">
value = "WRHIMEM">
</PersistentString>
</PersistentStrings>
</ContextState>
<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>
contextName = "AND:6502_instr_logic.h">
</ContextState>
<ContextState
contextName = "_INC:6502_instr_inc_dec.h">
@ -84,25 +79,25 @@
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "specialized closure #2 in DebuggerViewController.DisplayDisassembly(scrollY:):DebuggerViewController.swift">
<PersistentStrings>
<PersistentString
value = "highlighted_line_number">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "DebuggerViewController.getLineRange(inView:forLine:):DebuggerViewController.swift">
<PersistentStrings>
<PersistentString
value = "disassLineRange[forLine]">
</PersistentString>
<PersistentString
value = "disassLineRange.count">
</PersistentString>
<PersistentString
value = "disassLineRange">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "specialized closure #2 in DebuggerViewController.DisplayDisassembly(scrollY:):DebuggerViewController.swift">
<PersistentStrings>
<PersistentString
value = "highlighted_line_number">
value = "disassLineRange.count">
</PersistentString>
</PersistentStrings>
</ContextState>
@ -142,17 +137,14 @@
contextName = "HiRes.draw(_:):HiRes.swift">
<PersistentStrings>
<PersistentString
value = "(blockH7 | ( block &amp; bitMask ))">
value = "linAddr">
</PersistentString>
<PersistentString
value = "ctx?.data">
value = "ctx?.bitsPerComponent">
</PersistentString>
<PersistentString
value = "ctx?.width">
</PersistentString>
<PersistentString
value = "ctx?.bitmapInfo">
</PersistentString>
<PersistentString
value = "ctx?.bytesPerRow">
</PersistentString>
@ -162,6 +154,12 @@
<PersistentString
value = "HiResLineAddrTbl">
</PersistentString>
<PersistentString
value = "ctx?.bitmapInfo">
</PersistentString>
<PersistentString
value = "(blockH7 | ( block &amp; bitMask ))">
</PersistentString>
<PersistentString
value = "HiRes.blockCols">
</PersistentString>
@ -172,10 +170,7 @@
value = "ctx?.height">
</PersistentString>
<PersistentString
value = "linAddr">
</PersistentString>
<PersistentString
value = "ctx?.bitsPerComponent">
value = "ctx?.data">
</PersistentString>
</PersistentStrings>
</ContextState>
@ -203,7 +198,7 @@
contextName = "DebuggerViewController.DisplayDisassembly():DebuggerViewController.swift">
<PersistentStrings>
<PersistentString
value = "disass_addr_min">
value = "line_number">
</PersistentString>
<PersistentString
value = "disass_addr">
@ -212,7 +207,7 @@
value = "m6502.PC">
</PersistentString>
<PersistentString
value = "line_number">
value = "disass_addr_min">
</PersistentString>
</PersistentStrings>
</ContextState>
@ -464,12 +459,38 @@
<ContextState
contextName = "addr_ind_Y:Apple2_mmio.h">
</ContextState>
<ContextState
contextName = "specialized closure #1 in DebuggerViewController.DisplayDisassembly(scrollY:):DebuggerViewController.swift">
<PersistentStrings>
<PersistentString
value = "scroll_line_number">
</PersistentString>
<PersistentString
value = "m6502_saved.PC">
</PersistentString>
<PersistentString
value = "highlighted_line_number">
</PersistentString>
<PersistentString
value = "m6502.PC">
</PersistentString>
<PersistentString
value = "isCurrentLine">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "_addr_zp_X_dbg:mmio.c">
</ContextState>
<ContextState
contextName = "MonitorView.adjustTextDisplaySize():MonitorView.swift">
<PersistentStrings>
<PersistentString
value = "textDisplay_height_diff">
</PersistentString>
<PersistentString
value = "textDisplay.frame">
</PersistentString>
<PersistentString
value = "frame.size">
</PersistentString>
@ -482,20 +503,6 @@
<PersistentString
value = "textDisplay_width_diff">
</PersistentString>
<PersistentString
value = "textDisplay.frame">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "_addr_zp_X_dbg:mmio.c">
</ContextState>
<ContextState
contextName = "specialized closure #1 in DebuggerViewController.DisplayDisassembly(scrollY:):DebuggerViewController.swift">
<PersistentStrings>
<PersistentString
value = "highlighted_line_number">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
@ -560,10 +567,10 @@
contextName = "set_flags_NZC:common.h">
<PersistentStrings>
<PersistentString
value = "(unsigned)0xFF">
value = "(unsigned)test ">
</PersistentString>
<PersistentString
value = "(unsigned)test ">
value = "(unsigned)0xFF">
</PersistentString>
</PersistentStrings>
</ContextState>
@ -664,18 +671,18 @@
<ContextState
contextName = "ioRead:mmio.c">
<PersistentStrings>
<PersistentString
value = "MEMcfg.int_Cx_ROM">
</PersistentString>
<PersistentString
value = "lastIO">
</PersistentString>
<PersistentString
value = "m6502.clkfrm">
value = "MEMcfg.int_Cx_ROM">
</PersistentString>
<PersistentString
value = "(int)IOframe">
</PersistentString>
<PersistentString
value = "m6502.clkfrm">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
@ -685,10 +692,10 @@
value = "Apple2_64K_AUX + 0xC600">
</PersistentString>
<PersistentString
value = "Apple2_64K_RAM + 0xC600">
value = "(void*)rom">
</PersistentString>
<PersistentString
value = "(void*)rom">
value = "Apple2_64K_RAM + 0xC600">
</PersistentString>
<PersistentString
value = "strlen(fullPath)">
@ -812,16 +819,16 @@
contextName = "DisplayScrollView.scrollWheel(with:):DisplayScrollView.swift">
<PersistentStrings>
<PersistentString
value = "textView.defaultParagraphStyle?.lineSpacing">
value = "subviews[1].subviews">
</PersistentString>
<PersistentString
value = "subviews">
</PersistentString>
<PersistentString
value = "subviews[1].subviews">
value = "documentView">
</PersistentString>
<PersistentString
value = "documentView">
value = "textView.defaultParagraphStyle?.lineSpacing">
</PersistentString>
</PersistentStrings>
</ContextState>
@ -913,10 +920,10 @@
contextName = "_fetch_dbg:mmio.c">
<PersistentStrings>
<PersistentString
value = "disassembly.pOpcode">
value = "memread8_low(m6502.PC)">
</PersistentString>
<PersistentString
value = "memread8_low(m6502.PC)">
value = "disassembly.pOpcode">
</PersistentString>
</PersistentStrings>
</ContextState>
@ -924,13 +931,13 @@
contextName = "m6502_dbg_bp_add:6502_bp.c">
<PersistentStrings>
<PersistentString
value = "bp">
value = "mem_bp_arr">
</PersistentString>
<PersistentString
value = "bp_array">
</PersistentString>
<PersistentString
value = "mem_bp_arr">
value = "bp">
</PersistentString>
</PersistentStrings>
</ContextState>
@ -1002,7 +1009,10 @@
contextName = "DebuggerViewController.DisplayDisassembly(scrollY:):DebuggerViewController.swift">
<PersistentStrings>
<PersistentString
value = "disassLineRange">
value = "highlighted_line_number">
</PersistentString>
<PersistentString
value = "isCurrentLine">
</PersistentString>
<PersistentString
value = "disass_addr">
@ -1023,7 +1033,7 @@
value = "scroll_line_number">
</PersistentString>
<PersistentString
value = "highlighted_line_number">
value = "disassLineRange">
</PersistentString>
</PersistentStrings>
</ContextState>
@ -1139,7 +1149,7 @@
contextName = "LoRes.Update():LoRes.swift">
<PersistentStrings>
<PersistentString
value = "UInt8( (block &gt;&gt; 4) &amp; 0x0F )">
value = "blockChanged[ screenIdx ]">
</PersistentString>
<PersistentString
value = "UInt8(block)">
@ -1148,7 +1158,7 @@
value = "UInt8(block &amp; 4)">
</PersistentString>
<PersistentString
value = "blockChanged[ screenIdx ]">
value = "UInt8( (block &gt;&gt; 4) &amp; 0x0F )">
</PersistentString>
</PersistentStrings>
</ContextState>
@ -1205,22 +1215,22 @@
value = "m6502">
</PersistentString>
<PersistentString
value = "Apple2_64K_AUX + 0x3600">
value = "(void*)Apple2_64K_RAM">
</PersistentString>
<PersistentString
value = "m6502.clkfrm">
value = "Apple2_64K_RAM + 0x3600">
</PersistentString>
<PersistentString
value = "m6502.ecoSpindown">
</PersistentString>
<PersistentString
value = "Apple2_64K_AUX + 0x3600">
</PersistentString>
<PersistentString
value = "m6502.PC">
</PersistentString>
<PersistentString
value = "(void*)Apple2_64K_RAM">
</PersistentString>
<PersistentString
value = "Apple2_64K_RAM + 0x3600">
value = "m6502.clkfrm">
</PersistentString>
</PersistentStrings>
</ContextState>
@ -1234,7 +1244,7 @@
value = "pdl_value[pdl]">
</PersistentString>
<PersistentString
value = "normalized_time">
value = "normalized_time &gt;= pdl_value[pdl] ? 255 : 0">
</PersistentString>
<PersistentString
value = "(3300 * 255/3300)">
@ -1246,7 +1256,7 @@
value = "1 * 512 * (1 - ( 3300 / 3300.0 ))">
</PersistentString>
<PersistentString
value = "normalized_time &gt;= pdl_value[pdl] ? 255 : 0">
value = "normalized_time">
</PersistentString>
</PersistentStrings>
</ContextState>
@ -1265,10 +1275,10 @@
contextName = "ToolBarController.GamePort(_:):ToolBarController.swift">
<PersistentStrings>
<PersistentString
value = "ViewController.current?.mouseCursorHidden">
value = "ViewController.current?.mouseCursorJoystickEmulation">
</PersistentString>
<PersistentString
value = "ViewController.current?.mouseCursorJoystickEmulation">
value = "ViewController.current?.mouseCursorHidden">
</PersistentString>
</PersistentStrings>
</ContextState>
@ -1491,7 +1501,7 @@
value = "m6502.PC">
</PersistentString>
<PersistentString
value = "m6502.debugger.on">
value = "m6502.clkfrm">
</PersistentString>
<PersistentString
value = "textLines * (textCols+1) + textCols">
@ -1500,7 +1510,7 @@
value = "frameCounter">
</PersistentString>
<PersistentString
value = "m6502.clkfrm">
value = "m6502.debugger.on">
</PersistentString>
<PersistentString
value = "spkr_play_disk_motor_time">
@ -1555,7 +1565,7 @@
value = "new">
</PersistentString>
<PersistentString
value = "WOZtmp.shift16">
value = "WOZwrite.shift16">
</PersistentString>
<PersistentString
value = "WOZwrite.shift">
@ -1567,7 +1577,7 @@
value = "(1 &lt;&lt; i) - 1">
</PersistentString>
<PersistentString
value = "WOZwrite.shift16">
value = "WOZtmp.shift16">
</PersistentString>
</PersistentStrings>
</ContextState>
@ -1591,62 +1601,67 @@
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "specialized closure #1 in DebuggerViewController.DisplayDisassembly():DebuggerViewController.swift">
<PersistentStrings>
<PersistentString
value = "line_number">
</PersistentString>
<PersistentString
value = "currentScrollLine">
</PersistentString>
<PersistentString
value = "current_line_number">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "m6502_Debug:6502.c">
<PersistentStrings>
<PersistentString
value = "m6502.debugger.SP">
value = "m6502.SP">
</PersistentString>
<PersistentString
value = "m6502.debugger.mask.ret">
</PersistentString>
<PersistentString
value = "m6502.SP">
value = "m6502.debugger.SP">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "spkr_toggle:speaker.c">
contextName = "ViewController.mouseMoved(with:):ViewController.swift">
<PersistentStrings>
<PersistentString
value = "default_MHz_6502 * 1000 * 1000 / spkr_sample_rate">
value = "oldLocation">
</PersistentString>
<PersistentString
value = "( (spkr_clk + m6502.clkfrm) / ( default_MHz_6502 * 1000 * 1000 / spkr_sample_rate)) * 2">
value = "mouseLocation">
</PersistentString>
<PersistentString
value = "(int16_t)28000 + (int16_t)-32768">
</PersistentString>
<PersistentString
value = "spkr_samples[spkr_sample_last_idx]">
</PersistentString>
<PersistentString
value = "(int)spkr_sample_idx_diff">
</PersistentString>
<PersistentString
value = "m6502.clkfrm">
</PersistentString>
<PersistentString
value = "(spkr_clk + m6502.clkfrm)">
</PersistentString>
<PersistentString
value = "( (spkr_clk + m6502.clkfrm) / ( 1024000 / spkr_sample_rate ) ) * 2">
value = "view.bounds">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "memwrite8_bank2:mmio.h">
contextName = "closure #1 in ViewController.Update():ViewController.swift">
<PersistentStrings>
<PersistentString
value = "WRD0MEM">
value = "txtArr">
</PersistentString>
<PersistentString
value = "WRHIMEM">
value = "self.shadowTxt">
</PersistentString>
<PersistentString
value = "txt">
</PersistentString>
<PersistentString
value = "MEMcfg.txt_page_2">
</PersistentString>
<PersistentString
value = "MEMcfg.is_80STORE">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "AND:6502_instr_logic.h">
</ContextState>
</ContextStates>
</VariablesViewState>

View File

@ -233,14 +233,41 @@
<objects>
<viewController title="Debugger Controller Scene" id="R5e-co-cXs" customClass="DebuggerViewController" customModule="A2MacTests" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" identifier="Monitor View" wantsLayer="YES" focusRingType="none" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" id="Myj-W6-YvY" userLabel="Debugger View">
<rect key="frame" x="0.0" y="0.0" width="1100" height="520"/>
<rect key="frame" x="0.0" y="0.0" width="1100" height="500"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="uQh-oP-EwQ" userLabel="DisassBackground">
<rect key="frame" x="12" y="10" width="362" height="454"/>
<textFieldCell key="cell" lineBreakMode="clipping" drawsBackground="YES" id="YJj-UG-uPe">
<font key="font" size="10" name="PrintChar21"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" red="0.1137254902" green="0.1137254902" blue="0.1137254902" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="KwD-2D-fNp" userLabel="DisassHighlighter">
<rect key="frame" x="12" y="449" width="362" height="15"/>
<constraints>
<constraint firstAttribute="height" constant="15" id="ZoQ-wC-c4X"/>
</constraints>
<textFieldCell key="cell" lineBreakMode="clipping" drawsBackground="YES" id="CJy-tb-1Xs">
<font key="font" size="10" name="PrintChar21"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="lw3-np-MbY" userLabel="Disassembly">
<rect key="frame" x="10" y="10" width="366" height="454"/>
<textFieldCell key="cell" lineBreakMode="clipping" id="V2q-LD-et1">
<font key="font" size="10" name="PrintChar21"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" red="0.11372549019607843" green="0.11372549019607843" blue="0.11372549019607843" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
</textFieldCell>
</textField>
<stackView focusRingType="none" distribution="fill" orientation="vertical" alignment="leading" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="jY7-ZU-I4z" userLabel="Disassebler">
<rect key="frame" x="8" y="10" width="366" height="504"/>
<rect key="frame" x="8" y="10" width="366" height="484"/>
<subviews>
<stackView distribution="fill" orientation="horizontal" alignment="top" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="lUp-Ww-thA">
<rect key="frame" x="0.0" y="484" width="363" height="20"/>
<rect key="frame" x="0.0" y="464" width="363" height="20"/>
<subviews>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="yYC-5c-mvY" userLabel="Leading Space">
<rect key="frame" x="-2" y="0.0" width="16" height="20"/>
@ -334,17 +361,17 @@
</customSpacing>
</stackView>
<scrollView horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" borderType="line" horizontalLineScroll="0.0" horizontalPageScroll="0.0" verticalLineScroll="0.0" verticalPageScroll="0.0" hasHorizontalScroller="NO" minMagnification="1" translatesAutoresizingMaskIntoConstraints="NO" id="Pcn-4j-EEM" userLabel="Disass Scroll View" customClass="DisplayScrollView" customModule="A2MacTests" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="366" height="476"/>
<clipView key="contentView" copiesOnScroll="NO" id="9iz-cs-4As" userLabel="Disass Clip View">
<rect key="frame" x="1" y="1" width="349" height="474"/>
<rect key="frame" x="0.0" y="0.0" width="366" height="456"/>
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="9iz-cs-4As" userLabel="Disass Clip View">
<rect key="frame" x="1" y="1" width="349" height="454"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView editable="NO" selectable="NO" drawsBackground="NO" importsGraphics="NO" richText="NO" horizontallyResizable="YES" verticallyResizable="YES" baseWritingDirection="leftToRight" findStyle="bar" allowsCharacterPickerTouchBarItem="NO" textCompletion="NO" id="Hwx-Gd-XW1" userLabel="Disass Display" customClass="DisassView" customModule="A2MacTests" customModuleProvider="target">
<rect key="frame" x="0.0" y="-258" width="349" height="510"/>
<rect key="frame" x="0.0" y="-294" width="349" height="510"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" red="0.12549019610000001" green="0.12549019610000001" blue="0.12549019610000001" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<size key="minSize" width="349" height="474"/>
<size key="minSize" width="349" height="454"/>
<size key="maxSize" width="3840" height="58101"/>
<attributedString key="textStorage">
<fragment>
@ -399,13 +426,13 @@
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" verticalHuggingPriority="750" horizontal="NO" id="8wE-fn-MQK">
<rect key="frame" x="350" y="1" width="15" height="474"/>
<rect key="frame" x="350" y="1" width="15" height="454"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
</subviews>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" priority="999" constant="500" identifier="Disassembler.Height" id="32e-qn-VpW"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" priority="999" constant="480" identifier="Disassembler.Height" id="32e-qn-VpW"/>
<constraint firstAttribute="trailing" secondItem="Pcn-4j-EEM" secondAttribute="trailing" identifier="Disassembler.Trailing - Disass Scroll View.Trailing" id="9dB-f0-xxS"/>
<constraint firstAttribute="width" constant="366" id="H6l-7F-VyP"/>
<constraint firstItem="Pcn-4j-EEM" firstAttribute="leading" secondItem="jY7-ZU-I4z" secondAttribute="leading" identifier="Disass Scroll View.Leading - Disassembler.Leading" id="SAn-3M-8BI"/>
@ -421,13 +448,13 @@
</customSpacing>
</stackView>
<customView identifier="Side Panel" focusRingType="none" translatesAutoresizingMaskIntoConstraints="NO" id="JUf-qx-iuW" userLabel="Debug Side Panel">
<rect key="frame" x="382" y="10" width="710" height="504"/>
<rect key="frame" x="382" y="10" width="710" height="484"/>
<subviews>
<stackView focusRingType="none" distribution="fill" orientation="vertical" alignment="leading" spacing="20" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="0fW-4Y-eIm" userLabel="Debug Views">
<rect key="frame" x="0.0" y="0.0" width="710" height="504"/>
<rect key="frame" x="0.0" y="0.0" width="710" height="484"/>
<subviews>
<stackView distribution="fill" orientation="horizontal" alignment="top" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Cvo-4B-v1R" userLabel="CPU Stack View">
<rect key="frame" x="0.0" y="320" width="710" height="184"/>
<rect key="frame" x="0.0" y="300" width="710" height="184"/>
<subviews>
<stackView distribution="fill" orientation="vertical" alignment="leading" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Crh-BM-MCy" userLabel="CPU View">
<rect key="frame" x="0.0" y="0.0" width="351" height="184"/>
@ -517,7 +544,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView editable="NO" selectable="NO" drawsBackground="NO" importsGraphics="NO" richText="NO" horizontallyResizable="YES" verticallyResizable="YES" baseWritingDirection="leftToRight" findStyle="bar" allowsCharacterPickerTouchBarItem="NO" textCompletion="NO" id="BHr-Q4-rBI" userLabel="Stack Display" customClass="DisplayView" customModule="A2MacTests" customModuleProvider="target">
<rect key="frame" x="0.0" y="-253" width="334" height="165"/>
<rect key="frame" x="0.0" y="-267" width="334" height="165"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="windowBackgroundColor" catalog="System" colorSpace="catalog"/>
@ -584,10 +611,10 @@
</customSpacing>
</stackView>
<stackView distribution="fill" orientation="vertical" alignment="leading" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ZWI-gS-oPs" userLabel="Memory View">
<rect key="frame" x="0.0" y="0.0" width="710" height="300"/>
<rect key="frame" x="0.0" y="0.0" width="710" height="280"/>
<subviews>
<stackView distribution="fill" orientation="horizontal" alignment="top" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fik-fC-8sT">
<rect key="frame" x="0.0" y="280" width="710" height="20"/>
<rect key="frame" x="0.0" y="260" width="710" height="20"/>
<subviews>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="P9L-wR-0tv" userLabel="Leading Space">
<rect key="frame" x="-2" y="0.0" width="8" height="20"/>
@ -670,17 +697,17 @@
</customSpacing>
</stackView>
<scrollView focusRingType="none" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" borderType="line" horizontalLineScroll="0.0" horizontalPageScroll="0.0" verticalLineScroll="0.0" verticalPageScroll="0.0" hasHorizontalScroller="NO" hasVerticalScroller="NO" minMagnification="1" translatesAutoresizingMaskIntoConstraints="NO" id="dzC-sA-aHa" userLabel="Memory Scroll" customClass="DisplayScrollView" customModule="A2MacTests" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="710" height="272"/>
<rect key="frame" x="0.0" y="0.0" width="710" height="252"/>
<clipView key="contentView" focusRingType="none" copiesOnScroll="NO" id="Jy3-yS-sE4" userLabel="Memory Clip View">
<rect key="frame" x="1" y="1" width="708" height="270"/>
<rect key="frame" x="1" y="1" width="708" height="250"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView editable="NO" selectable="NO" drawsBackground="NO" importsGraphics="NO" richText="NO" horizontallyResizable="YES" verticallyResizable="YES" baseWritingDirection="leftToRight" selectionGranularity="word" findStyle="bar" allowsCharacterPickerTouchBarItem="NO" textCompletion="NO" id="qqp-t0-j4i" userLabel="Memory Display" customClass="DisplayView" customModule="A2MacTests" customModuleProvider="target">
<rect key="frame" x="0.0" y="89" width="708" height="270"/>
<rect key="frame" x="0.0" y="82" width="708" height="250"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="windowBackgroundColor" catalog="System" colorSpace="catalog"/>
<size key="minSize" width="708" height="270"/>
<size key="minSize" width="708" height="250"/>
<size key="maxSize" width="3840" height="58101"/>
<attributedString key="textStorage">
<fragment>
@ -708,7 +735,7 @@
</scrollView>
</subviews>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="300" identifier="Memory View.Height" id="1q4-G0-gXU"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="280" identifier="Memory View.Height" id="1q4-G0-gXU"/>
<constraint firstAttribute="trailing" secondItem="fik-fC-8sT" secondAttribute="trailing" id="Bw2-S7-pH0"/>
<constraint firstAttribute="trailing" secondItem="dzC-sA-aHa" secondAttribute="trailing" identifier="Memory View.Trailing - Memory Scroll.Trailing" id="CnA-zf-PRO"/>
<constraint firstItem="fik-fC-8sT" firstAttribute="leading" secondItem="ZWI-gS-oPs" secondAttribute="leading" id="LVP-JS-pu0"/>
@ -741,33 +768,11 @@
<real value="3.4028234663852886e+38"/>
</customSpacing>
</stackView>
<stackView focusRingType="none" distribution="fill" orientation="vertical" alignment="leading" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="jQ2-04-lPn" userLabel="Bottom Selection">
<rect key="frame" x="8" y="8" width="694" height="10"/>
<subviews>
<box focusRingType="none" verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="oa2-bF-OPT">
<rect key="frame" x="0.0" y="7" width="68" height="5"/>
</box>
<box focusRingType="none" verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="VUT-jD-TzS">
<rect key="frame" x="0.0" y="-2" width="68" height="5"/>
</box>
</subviews>
<visibilityPriorities>
<integer value="1000"/>
<integer value="1000"/>
</visibilityPriorities>
<customSpacing>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
</customSpacing>
</stackView>
</subviews>
<constraints>
<constraint firstItem="0fW-4Y-eIm" firstAttribute="top" secondItem="JUf-qx-iuW" secondAttribute="top" identifier="Debug Views.Top - Debug Side Panel.Top" id="4K9-Jh-Zby"/>
<constraint firstAttribute="bottom" secondItem="jQ2-04-lPn" secondAttribute="bottom" constant="8" identifier="Debug Side Panel.Bottom - Bottom Selection.Bottom" id="Gux-DY-2ne"/>
<constraint firstAttribute="width" constant="710" identifier="Debug Side Panel.Width" id="ISn-zl-W0I"/>
<constraint firstAttribute="trailing" secondItem="jQ2-04-lPn" secondAttribute="trailing" constant="8" identifier="Debug Side Panel.Trailing - Bottom Selection.Trailing" id="IgJ-iQ-fya"/>
<constraint firstAttribute="trailing" secondItem="0fW-4Y-eIm" secondAttribute="trailing" identifier="Debug Side Panel.Trailing - Debug Views.Trailing" id="QYl-GI-RBo"/>
<constraint firstItem="jQ2-04-lPn" firstAttribute="leading" secondItem="JUf-qx-iuW" secondAttribute="leading" constant="8" identifier="Bottom Selection.Leading - Debug Side Panel.Leading" id="S6T-Kb-26z"/>
<constraint firstAttribute="bottom" secondItem="0fW-4Y-eIm" secondAttribute="bottom" identifier="Debug Side Panel.Bottom - Debug Views.Bottom" id="i6Q-OP-9m0"/>
<constraint firstItem="0fW-4Y-eIm" firstAttribute="leading" secondItem="JUf-qx-iuW" secondAttribute="leading" identifier="Debug Views.Leading - Debug Side Panel.Leading" id="oiu-yH-cRR"/>
</constraints>
@ -775,17 +780,31 @@
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="jY7-ZU-I4z" secondAttribute="bottom" constant="10" identifier="Debugger View.Bottom - Disassembler.Bottom" id="8jC-7G-Ofh"/>
<constraint firstItem="uQh-oP-EwQ" firstAttribute="trailing" secondItem="lw3-np-MbY" secondAttribute="trailing" id="8q5-Sd-fZ8"/>
<constraint firstItem="KwD-2D-fNp" firstAttribute="leading" secondItem="lw3-np-MbY" secondAttribute="leading" id="HHi-Vl-G7O"/>
<constraint firstItem="uQh-oP-EwQ" firstAttribute="bottom" secondItem="lw3-np-MbY" secondAttribute="bottom" id="JnX-xB-eor"/>
<constraint firstItem="KwD-2D-fNp" firstAttribute="top" secondItem="lw3-np-MbY" secondAttribute="top" id="KjG-Xt-w0g"/>
<constraint firstItem="KwD-2D-fNp" firstAttribute="trailing" secondItem="lw3-np-MbY" secondAttribute="trailing" id="LYb-x4-eZt"/>
<constraint firstItem="JUf-qx-iuW" firstAttribute="top" secondItem="Myj-W6-YvY" secondAttribute="top" constant="6" identifier="Debug Side Panel.Top - Debugger View.Top" id="OaJ-lc-b0j"/>
<constraint firstAttribute="bottom" secondItem="JUf-qx-iuW" secondAttribute="bottom" constant="10" identifier="Debugger View.Bottom - Sebug Side Panel.Bottom" id="Y4T-sR-Hag"/>
<constraint firstItem="uQh-oP-EwQ" firstAttribute="top" secondItem="lw3-np-MbY" secondAttribute="top" id="YuC-6J-6RS"/>
<constraint firstItem="jY7-ZU-I4z" firstAttribute="top" secondItem="Myj-W6-YvY" secondAttribute="top" constant="6" identifier="Disassembler.Top - Debugger View.Top" id="cCh-QQ-pyz"/>
<constraint firstItem="lw3-np-MbY" firstAttribute="bottom" secondItem="Pcn-4j-EEM" secondAttribute="bottom" id="e8j-dQ-6Dc"/>
<constraint firstItem="jY7-ZU-I4z" firstAttribute="leading" secondItem="Myj-W6-YvY" secondAttribute="leading" constant="8" identifier="Disassembler.Leading - Debugger View.Leading" id="gka-CA-9WG"/>
<constraint firstAttribute="trailing" secondItem="JUf-qx-iuW" secondAttribute="trailing" constant="8" identifier="Debugger View.Trailing - Sebug Side Panel.Trailing" id="kwa-ri-Rtq"/>
<constraint firstItem="lw3-np-MbY" firstAttribute="leading" secondItem="Pcn-4j-EEM" secondAttribute="leading" constant="4" id="rCO-iJ-DOu"/>
<constraint firstItem="uQh-oP-EwQ" firstAttribute="leading" secondItem="lw3-np-MbY" secondAttribute="leading" id="uRt-lv-mfI"/>
<constraint firstItem="lw3-np-MbY" firstAttribute="trailing" secondItem="Pcn-4j-EEM" secondAttribute="trailing" id="x4p-qF-iKb"/>
<constraint firstItem="lw3-np-MbY" firstAttribute="top" secondItem="Pcn-4j-EEM" secondAttribute="top" constant="2" id="yYL-a5-8xr"/>
</constraints>
</view>
<connections>
<outlet property="CPU_Display" destination="Wrs-Qt-Kmd" id="SUW-Lc-Zv4"/>
<outlet property="DisassAddressField" destination="bwO-w1-hlg" id="tBp-cc-OcF"/>
<outlet property="DisassAddressPC" destination="zov-nz-fce" id="fhe-fN-yPd"/>
<outlet property="DisassHighlighter" destination="KwD-2D-fNp" id="bTl-R3-0bK"/>
<outlet property="DisassHightlighterContriant" destination="KjG-Xt-w0g" id="PrT-Dn-qaX"/>
<outlet property="DisassTextField" destination="lw3-np-MbY" id="xv3-mQ-zMX"/>
<outlet property="Disass_Display" destination="Hwx-Gd-XW1" id="XHS-dZ-gCR"/>
<outlet property="Disass_Scroll" destination="Pcn-4j-EEM" id="5w1-DZ-ypu"/>
<outlet property="Mem1_Display" destination="qqp-t0-j4i" id="85A-sB-M0p"/>

View File

@ -34,37 +34,58 @@ class DebuggerViewController: NSViewController {
@IBOutlet weak var MemoryAddressField: NSTextField!
@IBOutlet weak var DisassAddressField: NSTextField!
@IBOutlet weak var DisassAddressPC: NSButton!
// @IBOutlet weak var test: NSTextField!
//
//
// // let bold14:NSFont = NSFont.boldSystemFontOfSize(14.0)
// let textFont : NSFont = NSFont(name: "Print Char 21", size: 10.0)!
// let textColor : NSColor = NSColor.white
// let textParagraph : NSMutableParagraphStyle = NSMutableParagraphStyle()
// // textParagraph.lineSpacing = 10.0 /*this sets the space BETWEEN lines to 10points*/
// // textParagraph.maximumLineHeight = 12.0/*this sets the MAXIMUM height of the lines to 12points*/
//// textParagraph.lineHeightMultiple = 1.15
// let textAttribs : [NSAttributedString.Key : NSObject]
@IBOutlet weak var DisassTextField: NSTextField!
@IBOutlet weak var DisassHighlighter: NSTextField!
@IBOutlet weak var DisassHightlighterContriant: NSLayoutConstraint!
let textFont : NSFont = NSFont(name: "Print Char 21", size: 10.0)!
let textColor : NSColor = NSColor.white
let highlightColor : NSColor = NSColor.blue
let textParagraph : NSMutableParagraphStyle = NSMutableParagraphStyle()
let textAttribs : [NSAttributedString.Key : NSObject]
let highlightAttribs : [NSAttributedString.Key : NSObject]
required init?(coder: NSCoder) {
// textParagraph.lineHeightMultiple = 1.15
// textAttribs = [
// NSAttributedString.Key.font: textFont,
// NSAttributedString.Key.foregroundColor: textColor,
// NSAttributedString.Key.paragraphStyle: textParagraph
// ]
//
// textParagraph.lineSpacing = 10.0 /*this sets the space BETWEEN lines to 10points*/
// textParagraph.maximumLineHeight = 12.0/*this sets the MAXIMUM height of the lines to 12points*/
textParagraph.lineHeightMultiple = 1.15
textAttribs = [
NSAttributedString.Key.font: textFont,
NSAttributedString.Key.foregroundColor: textColor,
NSAttributedString.Key.paragraphStyle: textParagraph
]
highlightAttribs = [
NSAttributedString.Key.font: textFont,
NSAttributedString.Key.foregroundColor: textColor,
NSAttributedString.Key.backgroundColor: highlightColor,
NSAttributedString.Key.paragraphStyle: textParagraph
]
super.init(coder: coder)
DebuggerViewController.shared = self
}
// func testTextField(str : String) {
// let attrString:NSAttributedString = NSAttributedString.init(string: str, attributes: textAttribs)
// test.attributedStringValue = attrString
// }
//
func testTextField(str : String) {
let attrString = NSAttributedString.init(string: String(str.dropLast()), attributes: textAttribs)
DisassTextField.attributedStringValue = attrString
// let hlString = String(repeating: "\n", count: 4) +
// String(repeating: " ", count: 20) +
// String(repeating: "\n", count: 10) +
// String(repeating: " ", count: 30) +
// String(repeating: "\n", count: 4)
//
// let hlAttrString = NSAttributedString.init(string: hlString, attributes: highlightAttribs)
// DisassHighlighter.attributedStringValue = hlAttrString
// let hlAttrString = NSAttributedString.init(string: "\n", attributes: highlightAttribs)
// DisassHighlighter.attributedStringValue = hlAttrString
}
override func viewDidLoad() {
super.viewDidLoad()
self.preferredContentSize = NSMakeSize(self.view.frame.size.width, self.view.frame.size.height)
@ -275,7 +296,7 @@ N V - B D I Z C
var scroll_line_number = 0
var highlighted_line_number = 0
var line_number_cursor = 0
let lines_to_disass = 300
let lines_to_disass = 30
func get_scroll_line(view: NSTextView) -> Int {
@ -347,9 +368,17 @@ N V - B D I Z C
let lineFromTopToMiddle = 0
func scroll_to(view: NSTextView, line: Int) {
let line = line > 0 ? line : 0
let lineSpacing = 1.5
let lineHeight = Double(Disass_Display.font!.pointSize) * lineSpacing
let line = line > 0 ? line - 1 : 0
if let lineRange = getLineRange(disassLineRange, forLine: line + lineFromTopToMiddle) {
view.scrollRangeToVisible(lineRange)
// view.scrollRangeToVisible(lineRange)
// let to = CGRect(x: 0, y: lineRange.location, width: 0, height: lineRange.location + Int(Disass_Scroll.frame.size.height))
// view.scrollToVisible(to)
view.scroll( NSPoint(x: 0, y: Double(line) * lineHeight ) )
}
}
@ -405,13 +434,20 @@ N V - B D I Z C
func highlight(view: NSTextView, line: Int, attr: [NSAttributedString.Key : Any]) {
if line > 0 {
// let lineSpacing = CGFloat(1.25)
// let lineHeight = CGFloat(view.font!.pointSize) * lineSpacing
let line = line > 0 ? line - 1 : 0
// remove old highlighted line
remove_highlight(view: view, line: line)
if let lineRange = getLineRange(disassLineRange, forLine: line) {
DispatchQueue.main.async {
view.layoutManager?.addTemporaryAttributes(attr, forCharacterRange: lineRange)
}
}
// remove_highlight(view: view, line: line)
// if let lineRange = getLineRange(disassLineRange, forLine: line) {
// DispatchQueue.main.async {
// view.layoutManager?.addTemporaryAttributes(attr, forCharacterRange: lineRange)
// }
// }
let lineHeight = CGFloat(14.96) // magic number... No idea why... 10pt font size + 1.5 lineSpacing
DisassHightlighterContriant.constant = CGFloat(line) * lineHeight + 1
}
}
@ -527,8 +563,12 @@ N V - B D I Z C
}
var isCurrentLine = false
func DisplayDisassembly( scrollY : CGFloat = -1 ) {
var disass = "" // String(repeating: "\n", count: 0x1800)
// var disass = ""
var disass = ""
var loc = 0
if cpuState == cpuState_running {
@ -578,6 +618,13 @@ N V - B D I Z C
// hopefully instruction address is in sync
disass_addr = m6502.PC
let preLines = 0 // Int(self.disass_addr / 2)
for _ in 0..<preLines {
let lineRange = LineRange_t(loc: loc, len: 1)
disassLineRange.append(lineRange)
loc += 1
}
// normal disassembly
for _ in 1...lines_to_disass {
@ -585,7 +632,7 @@ N V - B D I Z C
line_number += 1
addr_line.updateValue(line_number, forKey: m6502.PC)
let isCurrentLine = m6502.PC == m6502_saved.PC
isCurrentLine = m6502.PC == m6502_saved.PC
if isCurrentLine {
// line = invertLine(line: line)
highlighted_line_number = line_number
@ -605,6 +652,8 @@ N V - B D I Z C
loc += len
disass += line + "\n"
// let attr = highlight ? highlightAttribs : textAttribs
// let attrString = NSAttributedString.init(string: String(disass.dropLast()), attributes: attr)
}
m6502 = m6502_saved
@ -613,17 +662,20 @@ N V - B D I Z C
DispatchQueue.main.async {
// let isEmpty = self.Disass_Display.string.isEmpty
let preLines = 0 // Int(self.disass_addr / 2)
if need_disass {
self.Disass_Display.string = disass // + String(repeating: "\n", count: 0x8000)
self.Disass_Display.string = "" // disass // String(repeating: "\n", count: preLines) + String(repeating: "\n", count: 0x8000)
// self.scroll_to(view: self.Disass_Display, line: preLines)
self.Disass_Display.scroll(CGPoint.zero)
// self.testTextField(str: "")
self.testTextField(str: disass)
}
let currentScrollLine = self.get_scroll_line(view: self.Disass_Display) + 1
if self.highlighted_line_number <= currentScrollLine || self.highlighted_line_number > currentScrollLine + 25 {
if scrollY < 0 {
self.scroll_to(view: self.Disass_Display, line: self.scroll_line_number - 5)
self.scroll_to(view: self.Disass_Display, line: /*preLines +*/ self.scroll_line_number)
// at the beginning it takes a while to fill up the buffer -- maybe allocation issue?
// if currentScrollLine == 1 {