Compare commits
1 Commits
ed72427c71
...
e96be7b18a
Author | SHA1 | Date |
---|---|---|
Rekai Nyangadzayi Musuka | e96be7b18a |
|
@ -7,3 +7,6 @@
|
||||||
[submodule "lib/arm32"]
|
[submodule "lib/arm32"]
|
||||||
path = lib/arm32
|
path = lib/arm32
|
||||||
url = https://git.musuka.dev/paoda/arm32.git
|
url = https://git.musuka.dev/paoda/arm32.git
|
||||||
|
[submodule "lib/zba-gdbstub"]
|
||||||
|
path = lib/zba-gdbstub
|
||||||
|
url = https://git.musuka.dev/paoda/zba-gdbstub
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
const Sdk = @import("lib/SDL.zig/Sdk.zig");
|
const Sdk = @import("lib/SDL.zig/build.zig");
|
||||||
const zgui = @import("lib/zgui/build.zig");
|
const zgui = @import("lib/zgui/build.zig");
|
||||||
const arm32 = @import("lib/arm32/build.zig");
|
const arm32 = @import("lib/arm32/build.zig");
|
||||||
|
const gdbstub = @import("lib/zba-gdbstub/build.zig");
|
||||||
|
|
||||||
// Although this function looks imperative, note that its job is to
|
// Although this function looks imperative, note that its job is to
|
||||||
// declaratively construct a build graph that will be executed by an external
|
// declaratively construct a build graph that will be executed by an external
|
||||||
|
@ -29,6 +30,7 @@ pub fn build(b: *std.Build) void {
|
||||||
});
|
});
|
||||||
|
|
||||||
exe.addModule("arm32", arm32.module(b));
|
exe.addModule("arm32", arm32.module(b));
|
||||||
|
exe.addModule("gdbstub", gdbstub.module(b));
|
||||||
exe.addModule("zig-clap", b.dependency("zig-clap", .{}).module("clap"));
|
exe.addModule("zig-clap", b.dependency("zig-clap", .{}).module("clap"));
|
||||||
|
|
||||||
exe.addAnonymousModule("bitfield", .{ .source_file = .{ .path = "lib/bitfield.zig" } }); // https://github.com/FlorenceOS/
|
exe.addAnonymousModule("bitfield", .{ .source_file = .{ .path = "lib/bitfield.zig" } }); // https://github.com/FlorenceOS/
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 479319e7cad78c3fd38b6865c56e9fe9e78d495c
|
|
@ -0,0 +1,42 @@
|
||||||
|
const std = @import("std");
|
||||||
|
const Server = @import("gdbstub").Server;
|
||||||
|
const Interface = @import("gdbstub").Emulator;
|
||||||
|
const System = @import("core/emu.zig").System;
|
||||||
|
const Scheduler = @import("core/Scheduler.zig");
|
||||||
|
|
||||||
|
const Allocator = std.mem.Allocator;
|
||||||
|
|
||||||
|
pub const TurboWrapper = struct {
|
||||||
|
system: System,
|
||||||
|
scheduler: *Scheduler,
|
||||||
|
|
||||||
|
pub fn init(system: System, scheduler: *Scheduler) @This() {
|
||||||
|
return .{ .system = system, .scheduler = scheduler };
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn interface(self: *@This(), allocator: Allocator) Interface {
|
||||||
|
return Interface.init(allocator, self);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn read(self: *const @This(), addr: u32) u8 {
|
||||||
|
return self.cpu.bus.dbgRead(u8, addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn write(self: *@This(), addr: u32, value: u8) void {
|
||||||
|
self.cpu.bus.dbgWrite(u8, addr, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn registers(self: *const @This()) *[16]u32 {
|
||||||
|
return &self.cpu.r;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn cpsr(self: *const @This()) u32 {
|
||||||
|
return self.cpu.cpsr.raw;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn step(self: *@This()) void {
|
||||||
|
_ = self;
|
||||||
|
|
||||||
|
@panic("TODO: Handle ARM7 and ARM9 lol");
|
||||||
|
}
|
||||||
|
};
|
|
@ -14,6 +14,7 @@ const ClapResult = clap.Result(clap.Help, &cli_params, clap.parsers.default);
|
||||||
const cli_params = clap.parseParamsComptime(
|
const cli_params = clap.parseParamsComptime(
|
||||||
\\-h, --help Display this help and exit.
|
\\-h, --help Display this help and exit.
|
||||||
\\-f, --firm <str> Path to NDS Firmware Directory
|
\\-f, --firm <str> Path to NDS Firmware Directory
|
||||||
|
\\--gdb Run Turbo in GDB Mode
|
||||||
\\<str> Path to the NDS ROM
|
\\<str> Path to the NDS ROM
|
||||||
\\
|
\\
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue