5 unstable releases
0.3.1 | Feb 8, 2025 |
---|---|
0.3.0 | Jan 31, 2025 |
0.2.0 | Jan 27, 2025 |
0.1.1 | Jan 24, 2025 |
0.1.0 | Jan 22, 2025 |
#217 in Hardware support
404 downloads per month
Used in rs1541
145KB
2.5K
SLoC
xum1541
A native Rust implementation of the xum1541 (ZoomFloppy) protocol for communicating with Commodore disk drives.
Overview
This project reimplements OpenCBM's xum1541 plugin natively in Rust, offering several key improvements:
- Native Rust implementation for better integration with Rust applications
- Consistent, ergonomic API design with proper error handling
- Enhanced stability compared to OpenCBM's C implementation, particularly on Linux systems
- Type-safe interfaces and modern Rust idioms
Features
- Direct communication with Commodore disk drives via xum1541/ZoomFloppy devices
- Native Rust error handling and type safety
- Clean API design following Rust best practices
- Improved stability and reliability over C FFI implementations
- Safe resource management through RAII - USB device resources are automatically closed when objects go out of scope
- Thread-safe design supporting concurrent access and async/futures through standard Rust concurrency primitives (Arc<Mutex<>>)
Note, this is not a drop-in replacement for the OpenCBM plugin - it will not work with the OpenCBM library and applications.
Installation
cargo add xum1541
Usage
use xum1541::{BusBuilder, DeviceChannel, Error};
fn main() -> Result<(), Error> {
// Connect to the XUM1541 device via USB
let mut bus = BusBuilder::new().build()?;
// Initialize the bus
bus.initialize()?;
// Reset the IEC
bus.reset()?;
// Instuct device 8 to talk using channel 15
bus.talk(DeviceChannel::new(8, 15)?)?;
// Read up to 256 bytes of data from the drive
let mut data = vec![0u8; 256];
bus.read(&mut data)?;
// Print it out (this should be the drive status)
println!(
"Retrieved data from drive: {}",
std::str::from_utf8(&data).unwrap()
);
// Tell the drive to stop talking
bus.untalk()?;
// No need to close the XUM1541 device, it will be closed when bus goes
// out of scope
Ok(())
}
Requirements
- Rust 1.70 or higher
- USB device access permissions (Linux systems may need udev rules)
- Compatible xum1541/ZoomFloppy hardware
Building from Source
- Clone the repository:
git clone https://github.com/piersfinlayson/xum1541.git
cd xum1541
- Build the project:
cargo build --release
Testing
Run the test suite:
cargo test
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
GPLv3
Acknowledgments
- Original OpenCBM project and xum1541 plugin developers
- ZoomFloppy hardware developers
- Commodore community
Project Status
This project is under active development. Please report any issues or feature requests through GitHub issues.
Dependencies
~2.7–8.5MB
~82K SLoC