Skip to content

Commit

Permalink
Merge branch 'develop' into add-graphics-api
Browse files Browse the repository at this point in the history
  • Loading branch information
thejpster authored May 12, 2024
2 parents 162541d + 70fd859 commit b4d26d9
Show file tree
Hide file tree
Showing 6 changed files with 340 additions and 53 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
# Change Log

## Unreleased changes ([Source](https://github.com/neotron-compute/neotron-os/tree/develop) | [Changes](https://github.com/neotron-compute/neotron-os/compare/v0.7.1...develop))
## Unreleased changes ([Source](https://github.com/neotron-compute/neotron-os/tree/develop) | [Changes](https://github.com/neotron-compute/neotron-os/compare/v0.8.0...develop))

* None

## v0.8.0 - 2024-04-11 ([Source](https://github.com/neotron-compute/neotron-os/tree/v0.8.0) | [Release](https://github.com/neotron-compute/neotron-os/releases/tag/v0.8.0))

* Added a global `FILESYSTEM` object
* Updated to embedded-sdmmc 0.7
* Updated to Neotron Common BIOS 0.12
* Add a bitmap viewer command - `gfx`
* Treat text buffer as 32-bit values

## v0.7.1 - 2023-10-21 ([Source](https://github.com/neotron-compute/neotron-os/tree/v0.7.1) | [Release](https://github.com/neotron-compute/neotron-os/releases/tag/v0.7.1))

* Update `Cargo.lock` so build string no longer shows build as *dirty*
Expand Down
6 changes: 3 additions & 3 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "neotron-os"
version = "0.7.1"
version = "0.8.0"
authors = [
"Jonathan 'theJPster' Pallant <[email protected]>",
"The Neotron Developers"
Expand Down Expand Up @@ -46,7 +46,7 @@ embedded-graphics = "0.8.1"
embedded-sdmmc = { version = "0.7", default-features = false }
heapless = "0.7"
menu = "0.3"
neotron-api = "0.1"
neotron-api = "0.2"
neotron-common-bios = "0.12.0"
neotron-loader = "0.1"
pc-keyboard = "0.7"
Expand Down
25 changes: 21 additions & 4 deletions src/commands/ram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,27 @@ pub static HEXDUMP_ITEM: menu::Item<Ctx> = menu::Item {
pub static RUN_ITEM: menu::Item<Ctx> = menu::Item {
item_type: menu::ItemType::Callback {
function: run,
parameters: &[],
parameters: &[
menu::Parameter::Optional {
parameter_name: "arg1",
help: None,
},
menu::Parameter::Optional {
parameter_name: "arg2",
help: None,
},
menu::Parameter::Optional {
parameter_name: "arg3",
help: None,
},
menu::Parameter::Optional {
parameter_name: "arg4",
help: None,
},
],
},
command: "run",
help: Some("Jump to start of application area"),
help: Some("Run a program (with up to four arguments)"),
};

pub static LOAD_ITEM: menu::Item<Ctx> = menu::Item {
Expand Down Expand Up @@ -90,8 +107,8 @@ fn hexdump(_menu: &menu::Menu<Ctx>, _item: &menu::Item<Ctx>, args: &[&str], _ctx
}

/// Called when the "run" command is executed.
fn run(_menu: &menu::Menu<Ctx>, _item: &menu::Item<Ctx>, _args: &[&str], ctx: &mut Ctx) {
match ctx.tpa.execute() {
fn run(_menu: &menu::Menu<Ctx>, _item: &menu::Item<Ctx>, args: &[&str], ctx: &mut Ctx) {
match ctx.tpa.execute(args) {
Ok(0) => {
osprintln!();
}
Expand Down
16 changes: 16 additions & 0 deletions src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ impl File {
FILESYSTEM.file_read(self, buffer)
}

/// Write to a file
pub fn write(&self, buffer: &[u8]) -> Result<(), Error> {
FILESYSTEM.file_write(self, buffer)
}

/// Are we at the end of the file
pub fn is_eof(&self) -> bool {
FILESYSTEM
Expand Down Expand Up @@ -202,6 +207,17 @@ impl Filesystem {
Ok(bytes_read)
}

/// Write to an open file
pub fn file_write(&self, file: &File, buffer: &[u8]) -> Result<(), Error> {
let mut fs = self.volume_manager.lock();
if fs.is_none() {
*fs = Some(embedded_sdmmc::VolumeManager::new(BiosBlock(), BiosTime()));
}
let fs = fs.as_mut().unwrap();
fs.write(file.inner, buffer)?;
Ok(())
}

/// How large is a file?
pub fn file_length(&self, file: &File) -> Result<u32, Error> {
let mut fs = self.volume_manager.lock();
Expand Down
Loading

0 comments on commit b4d26d9

Please sign in to comment.