fox32+fox32rom: Rename "mount"/"unmount" to "insert"/"remove"
This commit is contained in:
parent
eebeff2073
commit
27f308e785
10
src/bus.rs
10
src/bus.rs
|
@ -77,13 +77,13 @@ impl Bus {
|
||||||
|
|
||||||
match operation {
|
match operation {
|
||||||
0x10 => {
|
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 {
|
if address_or_id > 3 {
|
||||||
panic!("invalid disk ID");
|
panic!("invalid disk ID");
|
||||||
}
|
}
|
||||||
match &self.disk_controller.disk[address_or_id] {
|
match &self.disk_controller.disk[address_or_id] {
|
||||||
Some(disk) => disk.size as u32, // return size if this disk is mounted
|
Some(disk) => disk.size as u32, // return size if this disk is inserted
|
||||||
None => 0, // return 0 if this disk is not mounted
|
None => 0, // return 0 if this disk is not inserted
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
0x20 => {
|
0x20 => {
|
||||||
|
@ -165,13 +165,13 @@ impl Bus {
|
||||||
|
|
||||||
match operation {
|
match operation {
|
||||||
0x10 => {
|
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 {
|
if address_or_id > 3 {
|
||||||
panic!("invalid disk ID");
|
panic!("invalid disk ID");
|
||||||
}
|
}
|
||||||
let file = self.disk_controller.select_file();
|
let file = self.disk_controller.select_file();
|
||||||
match 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 => {},
|
None => {},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,17 +38,17 @@ impl DiskController {
|
||||||
.add_filter("f32 Binary", &["f32"])
|
.add_filter("f32 Binary", &["f32"])
|
||||||
.add_filter("Raw Binary", &["bin"])
|
.add_filter("Raw Binary", &["bin"])
|
||||||
.add_filter("All Files", &["*"])
|
.add_filter("All Files", &["*"])
|
||||||
.set_title(&format!("Select a file to mount"))
|
.set_title(&format!("Select a file to insert"))
|
||||||
.pick_file();
|
.pick_file();
|
||||||
match path {
|
match path {
|
||||||
Some(path) => Some(File::open(path).unwrap()),
|
Some(path) => Some(File::open(path).unwrap()),
|
||||||
None => None,
|
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));
|
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;
|
self.disk[disk_id as usize] = None;
|
||||||
}
|
}
|
||||||
pub fn get_size(&mut self, disk_id: u8) -> u64 {
|
pub fn get_size(&mut self, disk_id: u8) -> u64 {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user