Skip to content

Commit 843daf2

Browse files
authored
Merge branch 'develop' into fix-tool-links
2 parents 8afe506 + 746469d commit 843daf2

File tree

6 files changed

+36
-33
lines changed

6 files changed

+36
-33
lines changed

neotron-os/build.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ use std::io::prelude::*;
33
fn main() {
44
if let Ok("none") = std::env::var("CARGO_CFG_TARGET_OS").as_deref() {
55
copy_linker_script("neotron-flash-1002.ld");
6-
println!("cargo:rustc-link-arg-bin=flash1002=-Tneotron-flash-1002.ld");
6+
println!("cargo::rustc-link-arg-bin=flash1002=-Tneotron-flash-1002.ld");
77
copy_linker_script("neotron-flash-0802.ld");
8-
println!("cargo:rustc-link-arg-bin=flash0802=-Tneotron-flash-0802.ld");
8+
println!("cargo::rustc-link-arg-bin=flash0802=-Tneotron-flash-0802.ld");
99
copy_linker_script("neotron-flash-0002.ld");
10-
println!("cargo:rustc-link-arg-bin=flash0002=-Tneotron-flash-0002.ld");
10+
println!("cargo::rustc-link-arg-bin=flash0002=-Tneotron-flash-0002.ld");
1111
}
1212

1313
if let Ok(cmd_output) = std::process::Command::new("git")
@@ -19,25 +19,26 @@ fn main() {
1919
{
2020
let git_version = std::str::from_utf8(&cmd_output.stdout).unwrap();
2121
println!(
22-
"cargo:rustc-env=OS_VERSION={} (git:{})",
22+
"cargo::rustc-env=OS_VERSION={} (git:{})",
2323
env!("CARGO_PKG_VERSION"),
2424
git_version.trim()
2525
);
2626
} else {
27-
println!("cargo:rustc-env=OS_VERSION={}", env!("CARGO_PKG_VERSION"));
27+
println!("cargo::rustc-env=OS_VERSION={}", env!("CARGO_PKG_VERSION"));
2828
}
2929

3030
if Ok("macos") == std::env::var("CARGO_CFG_TARGET_OS").as_deref() {
31-
println!("cargo:rustc-link-lib=c");
31+
println!("cargo::rustc-link-lib=c");
3232
}
3333

3434
if Ok("windows") == std::env::var("CARGO_CFG_TARGET_OS").as_deref() {
35-
println!("cargo:rustc-link-lib=dylib=msvcrt");
35+
println!("cargo::rustc-link-lib=dylib=msvcrt");
3636
}
3737

3838
if option_env!("ROMFS_PATH").is_some() {
39-
println!("cargo:rustc-cfg=romfs_enabled=\"yes\"");
40-
println!("cargo:rerun-if-env-changed=ROMFS_PATH");
39+
println!("cargo::rustc-cfg=romfs_enabled=\"yes\"");
40+
println!("cargo::rustc-check-cfg=cfg(romfs_enabled, values(\"yes\"))");
41+
println!("cargo::rerun-if-env-changed=ROMFS_PATH");
4142
}
4243
}
4344

@@ -50,7 +51,7 @@ fn copy_linker_script(path: &str) {
5051
.unwrap()
5152
.write_all(contents.as_bytes())
5253
.unwrap();
53-
println!("cargo:rustc-link-search={}", out.display());
54+
println!("cargo::rustc-link-search={}", out.display());
5455
}
5556

5657
// End of file

neotron-os/neotron-flash-0002.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ MEMORY
3131
}
3232

3333
/* # Entry point = what the BIOS calls to start the OS */
34-
ENTRY(main);
34+
ENTRY(os_main);
3535

3636
/*
3737
Where the Transient Program Area starts.

neotron-os/neotron-flash-0802.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ MEMORY
3131
}
3232

3333
/* # Entry point = what the BIOS calls to start the OS */
34-
ENTRY(main);
34+
ENTRY(os_main);
3535

3636
/*
3737
Where the Transient Program Area starts.

neotron-os/neotron-flash-1002.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ MEMORY
3535
}
3636

3737
/* # Entry point = what the BIOS calls to start the OS */
38-
ENTRY(main);
38+
ENTRY(os_main);
3939

4040
/*
4141
Where the Transient Program Area starts.

neotron-os/src/commands/screen.rs

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
//! Screen-related commands for Neotron OS
22
3-
use neotron_common_bios::video::RGBColour;
4-
use pc_keyboard::DecodedKey;
5-
63
use crate::{
74
bios::{
85
video::{Format, Mode},
@@ -138,18 +135,34 @@ fn gfx_cmd(_menu: &menu::Menu<Ctx>, item: &menu::Item<Ctx>, args: &[&str], ctx:
138135
};
139136
let _ = file.read(buffer);
140137
} else {
138+
let (odd_pattern, even_pattern) = match mode.format() {
139+
// This is alternating hearts and diamonds
140+
Format::Text8x16 | Format::Text8x8 => (
141+
u32::from_le_bytes(*b"\x03\x0F\x04\x70"),
142+
u32::from_le_bytes(*b"\x04\x70\x03\x0F"),
143+
),
144+
// Can't do a checkerboard here - so stripes will do
145+
Format::Chunky32 => (0x0000_0000, 0x0000_0001),
146+
// These should produce black/white checkerboard, in the default
147+
// palette
148+
Format::Chunky16 => (0x0000_FFFF, 0xFFFF_0000),
149+
Format::Chunky8 => (0x000F_000F, 0x0F00_0F00),
150+
Format::Chunky4 => (0x0F0F_0F0F, 0xF0F0_F0F0),
151+
Format::Chunky2 => (0x3333_3333, 0xCCCC_CCCC),
152+
Format::Chunky1 => (0x5555_5555, 0xAAAA_AAAA),
153+
_ => todo!(),
154+
};
141155
// draw a dummy non-zero data. In Chunky1 this is a checkerboard.
142156
let line_size_words = mode.line_size_bytes() / 4;
143157
for row in 0..mode.vertical_lines() as usize {
144158
let word = if (row % 2) == 0 {
145-
0x5555_5555
159+
even_pattern
146160
} else {
147-
0xAAAA_AAAA
161+
odd_pattern
148162
};
149163
for col in 0..line_size_words {
150164
let idx = (row * line_size_words) + col;
151165
unsafe {
152-
// Let's try stripes?
153166
buffer_ptr.add(idx).write_volatile(word);
154167
}
155168
}
@@ -163,20 +176,8 @@ fn gfx_cmd(_menu: &menu::Menu<Ctx>, item: &menu::Item<Ctx>, args: &[&str], ctx:
163176
}
164177

165178
// Now wait for user input
166-
let mut r = 0u8;
167-
let mut g = 80u8;
168-
let mut b = 160u8;
169-
'wait: loop {
170-
(api.video_wait_for_line)(0);
171-
((api.video_set_palette)(0, RGBColour::from_rgb(r, g, b)));
172-
r = r.wrapping_add(1);
173-
g = g.wrapping_add(1);
174-
b = b.wrapping_add(1);
175-
176-
let keyin = crate::STD_INPUT.lock().get_raw();
177-
if let Some(DecodedKey::Unicode('Q') | DecodedKey::Unicode('q')) = keyin {
178-
break 'wait;
179-
}
179+
while crate::STD_INPUT.lock().get_raw().is_none() {
180+
// spin
180181
}
181182

182183
// Put it back as it was

neotron-os/src/program.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ static OPEN_HANDLES: CsRefCell<[OpenHandle; 8]> = CsRefCell::new([
6868

6969
/// Ways in which loading a program can fail.
7070
#[derive(Debug)]
71+
#[allow(unused)]
7172
pub enum Error {
7273
/// A filesystem error occurred
7374
Filesystem(crate::fs::Error),

0 commit comments

Comments
 (0)