mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-01-27 08:31:03 +00:00
Make disk loading faster on slow Android devices
- So for now we are not "conformant" on Android, but it appears to be worth the disk image loading times
This commit is contained in:
parent
09ff973016
commit
7e249745d8
@ -269,6 +269,7 @@ dnl Misc ...
|
|||||||
|
|
||||||
AC_DEFINE(APPLE2IX, 1, [Denotes a section of code as Apple//ix sourced, used with external sources])
|
AC_DEFINE(APPLE2IX, 1, [Denotes a section of code as Apple//ix sourced, used with external sources])
|
||||||
AC_DEFINE(KEYPAD_JOYSTICK, 1, [Joystick emulated on keyboard ... should not be true on mobile devices])
|
AC_DEFINE(KEYPAD_JOYSTICK, 1, [Joystick emulated on keyboard ... should not be true on mobile devices])
|
||||||
|
AC_DEFINE(CONFORMANT_TRACKS, 1, [Conformant to Applewin, and apparently also to the original //e disk timing, but hella-slow on low-end mobile devices])
|
||||||
|
|
||||||
dnl ---------------------------------------------------------------------------
|
dnl ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
19
src/disk.c
19
src/disk.c
@ -270,10 +270,18 @@ static unsigned long nibblize_track(uint8_t *buf, int drive) {
|
|||||||
|
|
||||||
uint8_t *output = disk6.disk[drive].track_image;
|
uint8_t *output = disk6.disk[drive].track_image;
|
||||||
|
|
||||||
// Write track beginning gap containing 48 self-sync bytes
|
#if CONFORMANT_TRACKS
|
||||||
|
// Write track-beginning gap containing 48 self-sync bytes
|
||||||
for (unsigned int i=0; i<48; i++) {
|
for (unsigned int i=0; i<48; i++) {
|
||||||
*(output++) = 0xFF;
|
*(output++) = 0xFF;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
// NOTE : original apple2emul used 6 sync bytes here and disk loading becomes much faster at a cost of conformance
|
||||||
|
// for certain disk images. For resource-constrained mobile/wearable devices, this is prolly the right path.
|
||||||
|
for (unsigned int i=0; i<6; i++) {
|
||||||
|
*(output++) = 0xFF;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
unsigned int sector = 0;
|
unsigned int sector = 0;
|
||||||
while (sector < 16) {
|
while (sector < 16) {
|
||||||
@ -329,10 +337,17 @@ static unsigned long nibblize_track(uint8_t *buf, int drive) {
|
|||||||
*(output)++ = 0xAA;
|
*(output)++ = 0xAA;
|
||||||
*(output)++ = 0xEB;
|
*(output)++ = 0xEB;
|
||||||
|
|
||||||
|
#if CONFORMANT_TRACKS
|
||||||
// Sector gap of 27 self-sync bytes
|
// Sector gap of 27 self-sync bytes
|
||||||
for (unsigned int i=0; i<27; i++) {
|
for (unsigned int i=0; i<27; i++) {
|
||||||
*(output++) = 0xFF;
|
*(output++) = 0xFF;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
// NOTE : original apple2emul used 5 self-sync bytes here
|
||||||
|
for (unsigned int i=0; i<5; i++) {
|
||||||
|
*(output++) = 0xFF;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
++sector;
|
++sector;
|
||||||
}
|
}
|
||||||
@ -424,8 +439,10 @@ static bool load_track_data(void) {
|
|||||||
|
|
||||||
disk6.disk[disk6.drive].nib_count = nibblize_track(buf, disk6.drive);
|
disk6.disk[disk6.drive].nib_count = nibblize_track(buf, disk6.drive);
|
||||||
if (disk6.disk[disk6.drive].nib_count != NI2_TRACK_SIZE) {
|
if (disk6.disk[disk6.drive].nib_count != NI2_TRACK_SIZE) {
|
||||||
|
#if CONFORMANT_TRACKS
|
||||||
ERRLOG("Invalid dsk image creation...");
|
ERRLOG("Invalid dsk image creation...");
|
||||||
return false;
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user