mirror of
https://github.com/trudnai/Steve2.git
synced 2025-04-08 13:37:17 +00:00
Further move to display disassembly code
This commit is contained in:
parent
50ae3a33a4
commit
6b32fe3d9e
@ -628,6 +628,7 @@
|
||||
324D15D224ADAC71008AAFB0 /* floppy.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = floppy.png; sourceTree = "<group>"; };
|
||||
32544194264A6C1600B7E3ED /* DisplayView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayView.swift; sourceTree = "<group>"; };
|
||||
325B75DF2909F95000B29605 /* 6502_debugger.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = 6502_debugger.c; sourceTree = "<group>"; };
|
||||
325B7652290A32CC00B29605 /* 6502_debugger.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = 6502_debugger.h; sourceTree = "<group>"; };
|
||||
325DC40D24AC5ABC00EB8858 /* doc.on.doc.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = doc.on.doc.png; sourceTree = "<group>"; };
|
||||
325DC40F24AC691B00EB8858 /* rgb_color.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = rgb_color.png; sourceTree = "<group>"; };
|
||||
325DC41124AC692D00EB8858 /* rgb_mono.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = rgb_mono.png; sourceTree = "<group>"; };
|
||||
@ -983,6 +984,7 @@
|
||||
32439F7522ECD8AD0077AAE0 /* instructions */,
|
||||
32439F8522ECD8AD0077AAE0 /* 6502.h */,
|
||||
32439F7422ECD8AD0077AAE0 /* 6502.c */,
|
||||
325B7652290A32CC00B29605 /* 6502_debugger.h */,
|
||||
325B75DF2909F95000B29605 /* 6502_debugger.c */,
|
||||
320F2A8924CFFBE300671B35 /* 6502_std.h */,
|
||||
320F2A8A24D0001600671B35 /* 6502_und.h */,
|
||||
@ -1181,11 +1183,11 @@
|
||||
32BCCD182650D3B1002151C5 /* Debug-Info.plist */,
|
||||
320F2A8724CFD74000671B35 /* Steve2Icon.icns */,
|
||||
32BFFB6422EACC660003B53F /* A2Mac.entitlements */,
|
||||
32439F7222ECD8AC0077AAE0 /* A2Mac-Bridging-Header.h */,
|
||||
32E3126C24AC033A00E61891 /* ToolBarController.swift */,
|
||||
3267641724BCC9A5000BEA11 /* COPYING */,
|
||||
3277D7A2273C603600749544 /* DisplayScrollView.swift */,
|
||||
3268B96F27DBD219003FBDCC /* convert_spkr_buf_to_wav.py */,
|
||||
32439F7222ECD8AC0077AAE0 /* A2Mac-Bridging-Header.h */,
|
||||
);
|
||||
path = A2Mac;
|
||||
sourceTree = "<group>";
|
||||
|
@ -29,6 +29,8 @@
|
||||
|
||||
|
||||
#import "6502.h"
|
||||
#import "6502_debugger.h"
|
||||
#import "disassembler.h"
|
||||
#import "speaker.h" // So we can access to speaker stuff from Swift
|
||||
#import "disk.h"
|
||||
#import "dsk2woz.h"
|
||||
|
@ -765,6 +765,7 @@ C20D: 4C C5 FE JMP $FEC5
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="CPU_Display" destination="Wrs-Qt-Kmd" id="SUW-Lc-Zv4"/>
|
||||
<outlet property="Disass_Display" destination="Hwx-Gd-XW1" id="XHS-dZ-gCR"/>
|
||||
<outlet property="Mem1_Display" destination="qqp-t0-j4i" id="85A-sB-M0p"/>
|
||||
<outlet property="Stack_Display" destination="BHr-Q4-rBI" id="qlA-JC-xkW"/>
|
||||
</connections>
|
||||
|
@ -17,7 +17,7 @@ class CheatMenu: NSMenu {
|
||||
|
||||
// AppDelegate.current?.Cheat_Menu()
|
||||
|
||||
let ships = ViewController.current?.Get_Hard_Hat_Mack()
|
||||
let /* ships */ _ = ViewController.current?.Get_Hard_Hat_Mack()
|
||||
// AppDelegate.current?.MenuItem_Hard_Hat_Mack_Add_3_Macks.title = String(format: "Add 3 Macks (%d)", ships!)
|
||||
|
||||
}
|
||||
|
@ -29,8 +29,9 @@ class DebuggerViewController: NSViewController {
|
||||
@IBOutlet var CPU_Display: DisplayView!
|
||||
@IBOutlet var Stack_Display: DisplayView!
|
||||
@IBOutlet var Mem1_Display: DisplayView!
|
||||
@IBOutlet var Disass_Display: DisplayView!
|
||||
|
||||
// required init?(coder: NSCoder) {
|
||||
// required init?(coder: NSCoder) {
|
||||
// super.init(coder: coder)
|
||||
// DebuggerViewController.shared = self
|
||||
// }
|
||||
@ -154,10 +155,27 @@ N V - B D I Z C
|
||||
}
|
||||
|
||||
|
||||
func DisplayDisassembly() {
|
||||
m6502_Disass_1_Instr()
|
||||
|
||||
let disass_C = disassemblyLine()
|
||||
let disass = withUnsafePointer(to: disass_C) {
|
||||
$0.withMemoryRebound(to: UInt8.self, capacity: MemoryLayout.size(ofValue: $0)) {
|
||||
String(cString: $0)
|
||||
}
|
||||
}
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.Disass_Display.string = disass
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func Update() {
|
||||
DisplayRegisters()
|
||||
DisplayStack()
|
||||
DisplayMemory()
|
||||
DisplayDisassembly()
|
||||
}
|
||||
|
||||
|
||||
|
@ -30,6 +30,9 @@
|
||||
|
||||
#define CLK_WAIT
|
||||
|
||||
#undef DEBUGGER
|
||||
#define FETCH_ADDR m6502.PC
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
@ -31,6 +31,7 @@
|
||||
#define CLK_WAIT
|
||||
|
||||
#define DEBUGGER
|
||||
#define FETCH_ADDR disass_addr
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -52,6 +53,8 @@
|
||||
|
||||
extern m6502_t m6502;
|
||||
|
||||
uint16_t disass_addr = 0xFDED;
|
||||
|
||||
#include "../util/disassembler.h"
|
||||
#include "../dev/mem/mmio.h"
|
||||
|
||||
@ -123,7 +126,7 @@ void m6502_Disass(void) {
|
||||
{
|
||||
}
|
||||
// TODO: clkfrm is already increamented!!!
|
||||
printDisassembly(outdev);
|
||||
// printDisassembly(outdev);
|
||||
|
||||
}
|
||||
|
||||
|
17
src/cpu/6502_debugger.h
Normal file
17
src/cpu/6502_debugger.h
Normal file
@ -0,0 +1,17 @@
|
||||
//
|
||||
// 6502_debugger.h
|
||||
// A2Mac
|
||||
//
|
||||
// Created by Tamas Rudnai on 10/26/22.
|
||||
// Copyright © 2022 GameAlloy. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef _6502_debugger_h
|
||||
#define _6502_debugger_h
|
||||
|
||||
|
||||
extern uint16_t disass_addr;
|
||||
extern int m6502_Disass_1_Instr(void);
|
||||
|
||||
|
||||
#endif /* _6502_debugger_h */
|
@ -154,6 +154,22 @@ void printDisassembly( FILE * f ) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // DISASSEMBLER
|
||||
|
||||
|
||||
const char * disassemblyLine(void) {
|
||||
static char line[256];
|
||||
|
||||
snprintf( line, sizeof(line), "%s: %-11s%-4s%s",
|
||||
disassembly.addr,
|
||||
disassembly.opcode,
|
||||
disassembly.inst,
|
||||
disassembly.oper
|
||||
);
|
||||
|
||||
return line;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -43,7 +43,7 @@ extern disassembly_t disassembly;
|
||||
//#define DISASSEMBLER
|
||||
//#undef DISASSEMBLER
|
||||
|
||||
#ifdef DISASSEMBLER
|
||||
#if defined(DISASSEMBLER) || defined(DEBUGGER)
|
||||
|
||||
//extern unsigned long long int clktime;
|
||||
extern unsigned long long discnt;
|
||||
@ -62,11 +62,14 @@ extern void _disPrintf( char * s, const size_t n, const char * fmt, ... );
|
||||
|
||||
|
||||
// TODO: We should add a new field for clk counter, so we can print that out _before_ execution, not after...
|
||||
extern void _disNewInstruction();
|
||||
extern void _disNewInstruction(void);
|
||||
#define disNewInstruction() _disNewInstruction()
|
||||
|
||||
|
||||
#ifdef DISASSEMBLER
|
||||
extern void printDisassembly( FILE * f );
|
||||
#endif
|
||||
|
||||
|
||||
#else // DISASSEMBLER
|
||||
|
||||
@ -80,5 +83,7 @@ extern void printDisassembly( FILE * f );
|
||||
#endif // DISASSEMBLER
|
||||
|
||||
|
||||
extern const char * disassemblyLine(void);
|
||||
|
||||
|
||||
#endif /* disassembler_h */
|
||||
|
Loading…
x
Reference in New Issue
Block a user