mirror of
https://github.com/mauiaaron/apple2.git
synced 2024-12-26 15:29:19 +00:00
Show disk track sector change animations
This commit is contained in:
parent
74c951f64f
commit
943b8842f7
22
src/disk.c
22
src/disk.c
@ -463,6 +463,23 @@ static void save_track_data(int drive) {
|
||||
disk6.disk[drive].track_dirty = false;
|
||||
}
|
||||
|
||||
static inline void animate_disk_track_sector(void) {
|
||||
if (video_backend && video_backend->animation_showTrackSector) {
|
||||
static int previous_sect = 0;
|
||||
int sect_width = disk6.disk[disk6.drive].track_width>>4; // div-by-16
|
||||
do {
|
||||
if (UNLIKELY(sect_width <= 0)) {
|
||||
break;
|
||||
}
|
||||
int sect = disk6.disk[disk6.drive].run_byte/sect_width;
|
||||
if (sect != previous_sect) {
|
||||
previous_sect = sect;
|
||||
video_backend->animation_showTrackSector(disk6.drive, disk6.disk[disk6.drive].phase>>1, sect);
|
||||
}
|
||||
} while (0);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Emulator hooks
|
||||
|
||||
@ -536,6 +553,9 @@ GLUE_C_READ(disk_read_write_byte)
|
||||
if (disk6.disk[disk6.drive].run_byte >= disk6.disk[disk6.drive].track_width) {
|
||||
disk6.disk[disk6.drive].run_byte = 0;
|
||||
}
|
||||
|
||||
animate_disk_track_sector();
|
||||
|
||||
#if DISK_TRACING
|
||||
if ((disk6.disk[disk6.drive].run_byte % NIB_SEC_SIZE) == 0) {
|
||||
if (disk6.ddrw) {
|
||||
@ -615,6 +635,8 @@ GLUE_C_READ(disk_read_phase)
|
||||
fprintf(test_write_fp, "NEW TRK:%d\n", (disk6.disk[disk6.drive].phase>>1));
|
||||
}
|
||||
#endif
|
||||
|
||||
animate_disk_track_sector();
|
||||
}
|
||||
|
||||
return ea == 0xE0 ? 0xFF : floating_bus_hibit(1);
|
||||
|
@ -233,7 +233,6 @@ static void _animation_showMessage(char *messageTemplate, unsigned int cols, uns
|
||||
nextMessage = message;
|
||||
nextMessageCols = framedCols;
|
||||
nextMessageRows = framedRows;
|
||||
LOG("New message with %d cols %d rows", nextMessageCols, nextMessageRows);
|
||||
pthread_mutex_unlock(&messageMutex);
|
||||
}
|
||||
|
||||
@ -314,6 +313,41 @@ static void _animation_showDiskChosen(int drive) {
|
||||
_animation_showMessage(template, shownCols, DISK_ANIMATION_ROWS);
|
||||
}
|
||||
|
||||
static void _animation_showTrackSector(int drive, int track, int sect) {
|
||||
|
||||
#define DISK_TRACK_SECTOR_ROWS 3
|
||||
#define DISK_TRACK_SECTOR_COLS 9
|
||||
|
||||
static char diskTrackSectorTemplate[DISK_TRACK_SECTOR_ROWS][DISK_TRACK_SECTOR_COLS+1] = {
|
||||
" ",
|
||||
"D / TT/SS",
|
||||
" ",
|
||||
};
|
||||
char *template = diskTrackSectorTemplate[0];
|
||||
|
||||
char c = diskTrackSectorTemplate[1][2];
|
||||
switch (c) {
|
||||
case '/':
|
||||
c = '-';
|
||||
break;
|
||||
case '-':
|
||||
c = '\\';
|
||||
break;
|
||||
case '\\':
|
||||
c = '|';
|
||||
break;
|
||||
case '|':
|
||||
c = '/';
|
||||
break;
|
||||
default:
|
||||
assert(false && "should not happen");
|
||||
break;
|
||||
}
|
||||
snprintf(&diskTrackSectorTemplate[1][0], DISK_TRACK_SECTOR_COLS+1, "%d %c %02X/%02X", drive+1, c, track, sect);
|
||||
|
||||
_animation_showMessage(template, DISK_TRACK_SECTOR_COLS, DISK_TRACK_SECTOR_ROWS);
|
||||
}
|
||||
|
||||
__attribute__((constructor(CTOR_PRIORITY_LATE)))
|
||||
static void _init_glalert(void) {
|
||||
LOG("Initializing message animation subsystem");
|
||||
@ -322,6 +356,7 @@ static void _init_glalert(void) {
|
||||
video_backend->animation_showPaused = &_animation_showPaused;
|
||||
video_backend->animation_showCPUSpeed = &_animation_showCPUSpeed;
|
||||
video_backend->animation_showDiskChosen = &_animation_showDiskChosen;
|
||||
video_backend->animation_showTrackSector = &_animation_showTrackSector;
|
||||
|
||||
glnode_registerNode(RENDER_MIDDLE, (GLNode){
|
||||
.setup = &alert_init,
|
||||
|
Loading…
Reference in New Issue
Block a user