mirror of
https://github.com/pevans/erc-c.git
synced 2024-12-21 23:29:16 +00:00
Only read or write if a disk is in the drive
This commit is contained in:
parent
a13be6c413
commit
4ce79c785c
@ -243,6 +243,12 @@ apple2_dd_position(apple2dd *drive)
|
||||
vm_8bit
|
||||
apple2_dd_read(apple2dd *drive)
|
||||
{
|
||||
// If we have no disk in the drive, we will always return a zero
|
||||
// byte
|
||||
if (drive->data == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
vm_8bit byte = vm_segment_get(drive->data, apple2_dd_position(drive));
|
||||
apple2_dd_shift(drive, 1);
|
||||
|
||||
@ -359,6 +365,11 @@ apple2_dd_turn_on(apple2dd *drive, bool online)
|
||||
void
|
||||
apple2_dd_write(apple2dd *drive)
|
||||
{
|
||||
// If there's no disk in the drive, then we can't write anything
|
||||
if (drive->data == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
vm_segment_set(drive->data, apple2_dd_position(drive), drive->latch);
|
||||
apple2_dd_shift(drive, 1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user