Skip to content

Commit

Permalink
Merge pull request #96 from Neotron-Compute/release/v0.8.1
Browse files Browse the repository at this point in the history
Release/v0.8.1
  • Loading branch information
thejpster authored May 17, 2024
2 parents a95aaa3 + 941b2e2 commit 65798e8
Show file tree
Hide file tree
Showing 7 changed files with 341 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
./build.sh --verbose
- name: Upload Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: ${{success()}}
with:
name: Artifacts
Expand Down
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.8.0...develop))
## Unreleased changes ([Source](https://github.com/neotron-compute/neotron-os/tree/develop) | [Changes](https://github.com/neotron-compute/neotron-os/compare/v0.8.1...develop))

* None

## v0.8.1 - 2024-05-17 ([Source](https://github.com/neotron-compute/neotron-os/tree/v0.8.1) | [Release](https://github.com/neotron-compute/neotron-os/releases/tag/v0.8.1))

* The `run` command now takes command-line arguments
* Add `ioctl` API
* Updated to `neotron-api` v0.2, to provide support for both of the above
* Add `AUDIO:` device, including `ioctl` to get/set sample rate and get buffer space
* Implement `fstat` for files (although only file size works)

## 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
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.8.0"
version = "0.8.1"
authors = [
"Jonathan 'theJPster' Pallant <[email protected]>",
"The Neotron Developers"
Expand Down Expand Up @@ -45,7 +45,7 @@ chrono = { version = "0.4", default-features = false }
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 65798e8

Please sign in to comment.