mamedev / mame

MAME
https://www.mamedev.org/
Other
7.94k stars 1.98k forks source link

apple3 issue booting from disk #5618

Closed frankmilliron closed 1 year ago

frankmilliron commented 5 years ago

This Prodos 8 2.5 alpha 4 disk boots normally on a real Apple III. When booting up from MAME however, it crashes just after the bootloader takes control. Attached are disk image to replicate, as well as a screenshot of the hang. Apple3boot.zip

rb6502 commented 5 years ago

Have you personally tried it on hardware? I just talked with John Brooks and it sounded like it won't actually do anything on the /// yet, unless I'm misunderstanding.

frankmilliron commented 4 years ago

I have an A3 and an applesauce disk controller. On real hardware it stops at the prodos splash screen. I just tried it quickly under MAME and it hangs before the bootloader gets going. I will admit I don't know how to do any debugging/tracing in MAME. I also have no idea what tricks the bootloader uses to get around Apple ][ compatibility mode.

JohnMBrooks commented 4 years ago

On Apple ///, alpha versions of ProDOS 2.5 do the following:

1) copies the block 0 boot loader code from $A000 to $0800 & jumps to $0801 like Apple II 2) loads block 1 boot loader code to $0a00 3) prints "PRODOS". Also prints a loading-bar with one period for every block loaded 4) finds PRODOS in root dir by reading block 2 and following 'next block' links as needed 5) loads the index block for PRODOS 6) loads the data blocks for PRODOS using the index block entries

MAME prints PRODOS and a single period for block 2, then hangs. So it appears to succeed at steps 1-4, but hangs around step 5.

One possibility is that the new boot loader code steps the head via 1/4 tracks and reads the 16-sector disk using a custom RWTS. The PRODOS index block and data blocks in steps #5 & #6 require seeking the head to another track which may expose a MAME incompatibility.

The RWTS, and almost all of the boot loader code is shared between AppleII and Apple///. If the ProDOS 2.5a disks do not work on MAME in AppleII emulation then the incompatibility may be DiskII related and not specific to Apple/// emulation.

frankmilliron commented 4 years ago

Here's a shot of it booted on real hardware... IMG_0084.JPG.zip

rb6502 commented 4 years ago

Current MAME[1] prints the same number of periods that it does for the Apple II, and jumps to $2000 where the full Apple II PRODOS file has been loaded, not PRODOS.III. PRODOS attempts to call Apple II F8 ROM routines that aren't there and you get garbage on the screen followed by a hang.

If I use MAME's debugger to capture the data from the PRODOS.III file and place it at $2000 right before the boot block jumps to it I get the same screen from @frankmilliron 's real hardware photo.

[1] MAME identifies DOS vs ProDOS order disks by fingerprinting the boot blocks. 2.5a4's boot block isn't known in top-of-tree (and unknown disks default to DOS order) but I fixed it locally. This is because our floppy guru decided it was dumb for the format ID routines to know the filename, something I am still pushing back on.

If you convert the disk to a .WOZ file (I think 4AM's Wozardry program will do it) you can reproduce my results right now.

frankmilliron commented 4 years ago

OK. Now it works. I converted the DSK to a WOZ file using the Applesauce software and it does expected behavior. Ironically I was just having problems with Applesauce and the A3 because of .po/.do differences. The author just added code there to detect the track/sector order. I was writing disks that wouldn't boot, but worked fine in MAME. The images ended up having the wrong extension and applesauce wasn't adjusting for that before writing back to a real disk.