mirror of
https://github.com/trudnai/Steve2.git
synced 2024-12-21 14:30:09 +00:00
Display Text Memory
This commit is contained in:
parent
b9e8640178
commit
f5ea13eb86
@ -686,8 +686,7 @@
|
||||
<windowController id="B8D-0N-5wS" sceneMemberID="viewController">
|
||||
<window key="window" title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
|
||||
<rect key="contentRect" x="196" y="240" width="480" height="440"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="B8D-0N-5wS" id="98r-iN-zZc"/>
|
||||
@ -706,16 +705,16 @@
|
||||
<objects>
|
||||
<viewController id="XfG-lQ-9wD" customClass="ViewController" customModule="A2Mac" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" id="m2S-Jp-Qdl">
|
||||
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="480" height="440"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Uza-t6-XSw">
|
||||
<rect key="frame" x="20" y="20" width="440" height="235"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" allowsUndo="NO" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="5AO-Gd-Lzo">
|
||||
<font key="font" metaFont="fixedUser" size="11"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Uza-t6-XSw">
|
||||
<rect key="frame" x="10" y="10" width="460" height="420"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" enabled="NO" refusesFirstResponder="YES" allowsUndo="NO" sendsActionOnEndEditing="YES" state="on" borderStyle="border" alignment="center" placeholderString="Apple ][ Emulator Virtual Monitor" drawsBackground="YES" allowsEditingTextAttributes="YES" id="5AO-Gd-Lzo">
|
||||
<font key="font" size="14" name="Courier-Bold"/>
|
||||
<color key="textColor" name="systemGreenColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" red="0.12549019607843137" green="0.17933968321917809" blue="0.12549019607843137" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</subviews>
|
||||
|
@ -12,14 +12,54 @@ class ViewController: NSViewController {
|
||||
|
||||
@IBOutlet weak var display: NSTextFieldCell!
|
||||
|
||||
func check() {
|
||||
let textBufferPointer = UnsafeRawBufferPointer(start: &RAM+0x400, count: 0x400)
|
||||
// let string = String(bytes: ram, encoding: .utf8)
|
||||
// print(string)
|
||||
static let charConvStr : String =
|
||||
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_ !\"#$%&'()*+,-./0123456789:;<=>?" +
|
||||
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_ !\"#$%&'()*+,-./0123456789:;<=>?" +
|
||||
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_ !\"#$%&'()*+,-./0123456789:;<=>?" +
|
||||
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~?"
|
||||
|
||||
static let charConvTbl = Array( charConvStr )
|
||||
|
||||
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
|
||||
]
|
||||
|
||||
func update() {
|
||||
|
||||
for (index, byte) in textBufferPointer.enumerated() {
|
||||
print("byte \(index): \(byte)")
|
||||
while true {
|
||||
usleep(33333) // 1/30 sec
|
||||
|
||||
let textBaseAddr = 0x400
|
||||
let textLines = 24
|
||||
let textCols = 40
|
||||
|
||||
var txt : String = "|"
|
||||
|
||||
for y in 0...textLines-1 {
|
||||
let textAddr = textBaseAddr + textLineOfs[y]
|
||||
let textBufferPointer = UnsafeRawBufferPointer(start: &RAM + textAddr, count: textCols)
|
||||
|
||||
for (index, byte) in textBufferPointer.enumerated() {
|
||||
let idx = Int(byte);
|
||||
let chr = ViewController.charConvTbl[idx]
|
||||
// print("byte \(index): \(chr)")
|
||||
txt = txt + [chr]
|
||||
}
|
||||
|
||||
txt = txt + "|\n|"
|
||||
}
|
||||
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.display.stringValue = txt;
|
||||
}
|
||||
}
|
||||
|
||||
// DispatchQueue.main.asyncAfter(deadline: .now() + 1/30, execute: {
|
||||
// self.update()
|
||||
// })
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -67,10 +107,14 @@ class ViewController: NSViewController {
|
||||
// }
|
||||
|
||||
|
||||
// DispatchQueue.main.asyncAfter(deadline: .now() + 5.0, execute: {
|
||||
// self.check()
|
||||
// DispatchQueue.main.asyncAfter(deadline: .now() + 1/30, execute: {
|
||||
// self.update()
|
||||
// })
|
||||
|
||||
DispatchQueue.global(qos: .background).async {
|
||||
self.update()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override var representedObject: Any? {
|
||||
|
@ -98,6 +98,7 @@ static inline void STR( uint8_t * dst, uint8_t imm ) {
|
||||
// if (( imm > ' ' ) && ( c < 0x7F ))
|
||||
// printf("%04X: t:%02X '%c'\n", v, imm, isprint(c) ? c : ' ');
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user