Tuesday, April 12, 2016

Creating a Hard Drive Image For Emulator Use

Recently we found a bug where the game would crash when a user would boot to a hard drive before launching the game off of a floppy. We recreated this situation by using an AppleWIN hard drive image that booted to ProDOS Basic and then executing a ProDOS command from there to boot from the floppy drive.

Below are instructions on how to set this up and some challenges we ran into during that process. The instructions assume a basic understanding of the Windows Command Prompt, CiderPress, AppleWIN, and Copy II Plus. I’m happy elaborate on any steps involving use of this software, just ask.

When AppleWIN is setup with a hard drive it will only attempt to boot from the hard drive. In this scenario it is necessary to type a ProDOS command, after the hard drive is booted, if you want the machine to load an image on the floppy drive.  Keep in mind the command prompt is identical for both ProDOS and AppleSoft. The following ProDOS command will attempt a boot from a floppy disk drive in slot 6:

] PR#6

So, we found an interesting chicken-and-egg paradox in this process: booting an unformatted hard disk will result in a crash.

How do we load a utility to format a hard disk for the first time if AppleWIN automatically tries to boot from the hard disk once the hard disk is enabled? Hint: It’s not an AppleWIN setting. 

The answer is found below.

1. Create a 0 byte file using a Windows PC.
  • Launch the command prompt with admin privileges
    • Click Start and type cmd in the search box
    • Press CTRL+Shift+Enter 
    • A command prompt with admin privileges enabled will open 
  • Create a 0 byte file in c:\applwin using the following syntax
    • In Win7 - fsutil file createnew c:\applewin\applehdd.hdv 0
    • Previous versions of Windows can use debug instead of fsutil to create the file

2. Use CiderPress to choose any random Windows file to add to applehdd.hdv
  • This step prevents Windows from deleting the 0 byte file when it is accessed by an application
  • It doesn’t matter what file type is added as all contents of the hard drive will be erased when it is formatted. I chose a text file

3. Enable the Hard Drive in AppleWIN
  • Enter AppleWIN configuration
  • Click on the Disk tab
  • Check the box next to Enable Hard Disk
  • Choose the applehdd.hdv file in c:\applewin
  • AppleWIN will pop up a window saying it needs to restart. Proceed with the restart. 

4. Boot Copy II Plus version 8.2
  • Other versions of Copy II Plus may work. This is just the version I used
    • Note that Copy II Plus 9.1 requires the model in AppleWIN's configuration to be set to enhanced Apple IIe
  • Insert the Copy II Plus 8.2 floppy disk in drive 1
  • Click the boot button in AppleWIN using the Apple icon
  • You should see the Apple monitor prompt (an asterisk with a bunch of hex numbers)
    • This is because once a hard disk is enabled, AppleWIN will try to boot from the hard disk first. Since the hard disk isn’t formatted, the boot process crashes.
  • Boot from the floppy after crashing
    • Type C600G at the Apple monitor prompt. 
      • This will execute the machine instructions stored in ROM for the boot0 process 
      • AppleWIN attempts to boot the floppy disk in drive 1 at this point

5. Format Hard Disk
  • Once Copy II Plus has launched, format the hard disk for ProDOS 
    • Use Format menu option. Pretty much just follow the prompts
    • The hard disk is slot 7, drive 1

6. Copy ProDOS onto Hard Disk
  • If you're copy of ProDOS is stored on a .SHK file you'll need to transfer it to a disk image. If ProDOS is already on a disk image, skip ahead to the "Insert the ProDOS disk image" step below.
    • To transfer ProDOS from a .SHK file to a disk image, start by using CiderPress to extract the file
      • Select Keep Apple II Formats
    • Create a blank disk image with CiderPress
    • Add the extracted file to the disk image
  • Insert the ProDOS disk image into the floppy drive. (I used ProDOS 2.03)
  • Copy the file from the ProDOS disk image in drive 1 to the hard disk

7. Copy ProDOS Basic onto Hard Disk
  • Insert any disk image that contains the ProDOS file BASIC.SYSTEM into floppy drive 1. Copy II Plus 9.1 contains this file and is what I used. 
  • Copy the file BASIC.SYSTEM from drive 1 to the hard disk
  • All done! 
    • Clicking the boot button on AppleWIN should now result in the hard disk booting to the ProDOS basic prompt ]
  • From the ProDOS Basic prompt, launch floppy disks by typing PR#6 
  • Create folders using the Copy II Plus 9.1 menu option Create Subdirectories

Notes:
*All versions of ProDOS after 1.9 required an Enhanced Apple IIe. AppleWIN configuration options can be set to run the emulator in Enhanced Apple IIe mode.

2 comments:

  1. While your method makes it possible to automate the process, you can boot from the monitor with several possibilities. The first is to type c600g at the monitor prompt and press return. Another is to type the number 6 and then hold the control key and type the p key. Replace the number 6 with the actual slot number if using real hardware and the floppy is not in that slot.

    Cheers,
    BluPhoenyx

    ReplyDelete
  2. Thanks for posting these additional techniques!

    ReplyDelete