Skip to content

Commit

Permalink
Console8 VDP 2.7.1. Booting into different screen modes with --mode <n>
Browse files Browse the repository at this point in the history
  • Loading branch information
tomm committed Mar 30, 2024
1 parent 60d9bc8 commit 0956dfb
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
members = ["agon-light-emulator-debugger"]

[workspace.package]
version = "0.9.38"
version = "0.9.39"
edition = "2021"
authors = ["Tom Morton <[email protected]>"]
license = "GPL-3.0"
Expand Down
3 changes: 3 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ pub fn main() -> Result<(), pico_args::Error> {
let _vdp_thread = thread::Builder::new()
.name("VDP".to_string())
.spawn(move || unsafe {
if let Some(scr_mode) = args.scr_mode {
(*vdp_interface.set_startup_screen_mode)(scr_mode);
}
(*vdp_interface.vdp_setup)();
(*vdp_interface.vdp_loop)();
});
Expand Down
7 changes: 5 additions & 2 deletions src/parse_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ USAGE:
OPTIONS:
-d, --debugger Enable the eZ80 debugger
-b, --breakpoint Set a breakpoint before starting
-z, --zero Initialize ram with zeroes instead of random values
-f, --fullscreen Start in fullscreen mode
-h, --help Prints help information
-u, --unlimited-cpu Don't limit eZ80 CPU frequency
--firmware 1.03 Use quark 1.03 firmware (default is console8)
--firmware quark Use quark 1.04 firmware (default is console8)
--firmware electron Use ElectronOS firmware (default is console8)
--mode <n> Start in a specific screen mode
--sdcard <path> Sets the path of the emulated SDCard
--scale <max-height> Use perfect (integer) video mode scaling, up to
a maximum window height of <max-height>
Expand All @@ -25,7 +25,8 @@ ADVANCED:
--renderer hw Use GL/D3D renderer (default)
--uart1-device <dev> Link ez80 uart1 to this host serial device
--uart1-baud <rate> Open --uart1-device with the given baud rate
--verbose Verbose mode
--verbose Verbose mode (includes VDP debug logs)
-z, --zero Initialize ram with zeroes instead of random values
";

#[derive(Debug, Copy, Clone)]
Expand All @@ -52,6 +53,7 @@ pub struct AppArgs {
pub fullscreen: bool,
pub verbose: bool,
pub zero: bool,
pub scr_mode: Option<u32>,
pub mos_bin: Option<std::path::PathBuf>,
pub vdp_dll: Option<std::path::PathBuf>,
pub firmware: FirmwareVer,
Expand Down Expand Up @@ -86,6 +88,7 @@ pub fn parse_args() -> Result<AppArgs, pico_args::Error> {
fullscreen: pargs.contains(["-f", "--fullscreen"]),
verbose: pargs.contains("--verbose"),
zero: pargs.contains(["-z", "--zero"]),
scr_mode: pargs.opt_value_from_str("--mode")?,
perfect_scale: pargs.opt_value_from_str("--scale")?,
mos_bin: pargs.opt_value_from_str("--mos")?,
vdp_dll: pargs.opt_value_from_str("--vdp")?,
Expand Down
6 changes: 6 additions & 0 deletions src/vdp/rust_glue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@
extern void delay(int ms);

bool vdp_debug_logging = false;
uint32_t startup_screen_mode = 1;

extern "C" void setVdpDebugLogging(bool state)
{
vdp_debug_logging = state;
}

extern "C" void set_startup_screen_mode(uint32_t mode)
{
startup_screen_mode = mode;
}

/* ps2scancode is the set2 'make' code */
extern "C" void sendHostKbEventToFabgl(uint16_t ps2scancode, uint8_t isDown)
{
Expand Down
2 changes: 1 addition & 1 deletion src/vdp/vdp-console8
4 changes: 2 additions & 2 deletions src/vdp/vdp-console8.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ extern fabgl::Point translate(int X, int Y);
extern bool cmp_char(uint8_t *c1, uint8_t *c2, int len);
extern void cursorRight(bool scrollProtect = false);
extern void cursorLeft();
extern void cursorDown();
extern void cursorUp();
extern void cursorDown(bool moveOnly = false);
extern void cursorUp(bool moveOnly = false);
extern fabgl::Point *activeCursor;
extern fabgl::Rect *activeViewport;
extern void cursorHome(fabgl::Point * cursor = activeCursor, fabgl::Rect * viewport = activeViewport);
Expand Down
2 changes: 1 addition & 1 deletion src/vdp/vdp-quark
Submodule vdp-quark updated 1 files
+3 −1 video/video.ino
1 change: 1 addition & 0 deletions src/vdp/vdp.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <stdio.h>
#include <stdint.h>
#include "fabgl.h"
#include "devdrivers/soundgen.h"

Expand Down
2 changes: 2 additions & 0 deletions src/vdp_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pub struct VdpInterface {
'static,
unsafe extern "C" fn(outWidth: *mut u32, outHeight: *mut u32, buffer: *mut u8),
>,
pub set_startup_screen_mode: libloading::Symbol<'static, unsafe extern "C" fn(m: u32)>,
pub z80_send_to_vdp: libloading::Symbol<'static, unsafe extern "C" fn(b: u8)>,
pub z80_recv_from_vdp: libloading::Symbol<'static, unsafe extern "C" fn(out: *mut u8) -> bool>,
pub sendHostKbEventToFabgl:
Expand All @@ -30,6 +31,7 @@ impl VdpInterface {
copyVgaFramebuffer: lib.get(b"copyVgaFramebuffer").unwrap(),
z80_send_to_vdp: lib.get(b"z80_send_to_vdp").unwrap(),
z80_recv_from_vdp: lib.get(b"z80_recv_from_vdp").unwrap(),
set_startup_screen_mode: lib.get(b"set_startup_screen_mode").unwrap(),
sendHostKbEventToFabgl: lib.get(b"sendHostKbEventToFabgl").unwrap(),
sendHostMouseEventToFabgl: lib.get(b"sendHostMouseEventToFabgl").unwrap(),
setVdpDebugLogging: lib.get(b"setVdpDebugLogging").unwrap(),
Expand Down

0 comments on commit 0956dfb

Please sign in to comment.