fox32+fox32rom: Rename "mount"/"unmount" to "insert"/"remove"

This commit is contained in:
ry755 2022-02-22 14:05:39 -08:00 committed by Ry
parent eebeff2073
commit 27f308e785
2 changed files with 8 additions and 8 deletions

View File

@ -77,13 +77,13 @@ impl Bus {
match operation {
0x10 => {
// we're reading the current mount state of the specified disk id
// we're reading the current insert state of the specified disk id
if address_or_id > 3 {
panic!("invalid disk ID");
}
match &self.disk_controller.disk[address_or_id] {
Some(disk) => disk.size as u32, // return size if this disk is mounted
None => 0, // return 0 if this disk is not mounted
Some(disk) => disk.size as u32, // return size if this disk is inserted
None => 0, // return 0 if this disk is not inserted
}
}
0x20 => {
@ -165,13 +165,13 @@ impl Bus {
match operation {
0x10 => {
// we're requesting a disk to be mounted to the specified disk id
// we're requesting a disk to be inserted to the specified disk id
if address_or_id > 3 {
panic!("invalid disk ID");
}
let file = self.disk_controller.select_file();
match file {
Some(file) => self.disk_controller.mount(file, address_or_id as u8),
Some(file) => self.disk_controller.insert(file, address_or_id as u8),
None => {},
};
}

View File

@ -38,17 +38,17 @@ impl DiskController {
.add_filter("f32 Binary", &["f32"])
.add_filter("Raw Binary", &["bin"])
.add_filter("All Files", &["*"])
.set_title(&format!("Select a file to mount"))
.set_title(&format!("Select a file to insert"))
.pick_file();
match path {
Some(path) => Some(File::open(path).unwrap()),
None => None,
}
}
pub fn mount(&mut self, file: File, disk_id: u8) {
pub fn insert(&mut self, file: File, disk_id: u8) {
self.disk[disk_id as usize] = Some(Disk::new(file));
}
pub fn unmount(&mut self, disk_id: u8) {
pub fn remove(&mut self, disk_id: u8) {
self.disk[disk_id as usize] = None;
}
pub fn get_size(&mut self, disk_id: u8) -> u64 {