Disk Door Open / Close

This commit is contained in:
tudnai 2022-10-17 15:21:10 -07:00
parent 283f5ac7b9
commit b6df485d4d
3 changed files with 29 additions and 2 deletions

View File

@ -1191,6 +1191,24 @@ class ViewController: NSViewController {
}
}
// Disk Loaded
if ( frameCounter % DEF_DRV_LED_DIV == 0 ) {
if woz_is_loaded() > 0 {
if disk1_closed.isHidden {
DispatchQueue.main.sync {
disk1_closed.isHidden = false
}
}
}
else {
if !disk1_closed.isHidden {
DispatchQueue.main.sync {
disk1_closed.isHidden = true
}
}
}
}
switch cpuState {
case cpuState_running:
clkCounter += Double(m6502.clkfrm)

View File

@ -489,7 +489,7 @@ void woz_write( uint8_t data ) {
}
void woz_free_buffer() {
void woz_free_buffer(void) {
if ( woz_file_buffer ) {
free(woz_file_buffer);
woz_file_buffer = NULL;
@ -505,7 +505,7 @@ int woz_parseBuffer() {
woz_flags.disk_modified = 0;
woz_flags.disk_write_protected = 0;
woz_flags.image_file_readonly = 0;
woz_flags.image_loaded = 1;
woz_flags.image_loaded = 0;
woz_header = (woz_header_t*)woz_file_buffer;
@ -578,6 +578,8 @@ int woz_parseBuffer() {
// DO NOT COMMIT THIS! ONLY FOR DEBUG!!!
// woz_loadTrack(0x11);
woz_flags.image_loaded = 1;
return WOZ_ERR_OK;
}
@ -641,6 +643,11 @@ void woz_eject() {
}
uint8_t woz_is_loaded(void) {
return woz_flags.image_loaded;
}
int woz_saveFile( const char * filename ) {
if ( filename == NULL ) {

View File

@ -209,5 +209,7 @@ extern int woz_parseBuffer(void);
extern int woz_loadFile( const char * filename );
extern int woz_saveFile( const char * filename );
extern void woz_eject(void);
extern uint8_t woz_is_loaded(void);
#endif /* woz_h */