Tag: Disk Utility
Using an emulation development enviroment for the Apple IIgs presents some unique problems when dealing with files.
First things first, you’ll want a transfer disk to get things from the Mac to the IIgs emulator and back again. This can be simply done by going to Applications/Utilities/Disk Uility on you Mac and click “New Image”. Make the “Save as” and “Volume name” the same thing as in this example “transfer”. Use a volume size of 100Meg.. nice round figure. Volume Format should be Mac OS Extended (journaled). Encryption: none, Partitions: single partition and Image format: read/write disk image. Once these settings are made click “Create” and a transfer.dmg will be created in the location you specified by setting the “Save as”. If that image got mounted somehow, unmount it.
You’re done with this phase so close down Disk Utility and open up your emulator, mount your GSOS, start it up and mount the transfer.dmg you just created. GSOS will complain that it can not read the disk and it want’s to format it. Select HFS and Format the disk. It will now appear as a 3.5″ disk on the GSOS desktop even though it’s 100meg.
You can now drag and drop files to it or from it in either GSOS or OSX as long as only one of the OS’s have it mounted and any given time. Having both GSOS and OSX mount the dmg at the same time causes havoc!
Source to TextMate, TextMate to Source
TextMate is the main text editor used in this configuration and a few simple things need to be addressed. On the GS/OS side of things we are using APW/ORCA for the generation of binaries and executables used by the Apple IIgs.
The first transfer (Source to TextMate) is pretty simple, From the AppleIIgs, mount the transfer disk and drag and drop the sourcefile(s) into it, drag the disk to the AppleIIgs trash to eject (unmount) the disk. From the Mac, mount the transfer disk and drag and drop the sourcefile to your working directory. That’s about it, you can now open this file with TextMate and edit away.
The second transfer (TextMate to Source) is a little more complicated. The default Line ending in TextMate is a line feed (LF – $0A), APW/ORCA on the other hand uses carriage returns (CR – $0D). If you attempt to open up a line feed version with the APW Editor it thinks it’s a single long string of characters and will fail. In TextMate, select “TextMate/Preferences/Advanced” and in this dialog you will see a selector for “Line Endings”. Set this selector to “CR (Mac OS Classic)”. This will solve this little problem. To make sure this is happening you can open up the file in HexEdit, look for the $0A or $0D at the end of text lines. If you find $0A then you can search for $0A and replace with $0D globally to fix the difference.
In the Mac, mount the transfer disk and drag and drop the source file in it, then unmount the transfer disk then from the AppleIIgs, mount the transfer disk and drag and drop the file to the APW sourcecode folder. At this point you would think your all done but this is not the case. This file is not a filetype $B0(SRC), auxtype $0003(ASM65816) identified file and APW will not recognize it. You need to change the filetype and auxtype on the file before it’s official. I use the File Utility in Call Box to accomplish this, there are other file utilities and byte zappers that can do this as well, that’s up to you.
A simpler but much slower method is to copy the source in TextMate (select all) and with Sweet16 up and running the APW Editor, with a new blank document named the same as the sourcefile, you can use the File/Paste function of Sweet16 to write the file into the blank document. Once the APW Editor saves this file, the type and subtype will be the correct kinds and you will not have to worry about the line feeds and carriage returns.
You can also use the Sweet16 paste command to great advantage with Applesoft code. Copy the Applesoft code you have in TextMate and have the emulator up and running. Goto Applesoft BASIC environment (once again I use the Call Box Launchung Shell for this purpose). From the ProDOS8 command line type “NEW” and then use the Sweet16 paste command to write the Applesoft into the interpreter. Once done, “SAVE” the file and that’s it!
Going the other way however is not as easy. Applesoft is a tokenized language where all it’s commands are not the text of the command but are instead single byte values (the tokens) not to mention the linked list bytes. A straight binary copy as I have been discussing so far will result in a whacky, mostly unreadable file in TextMate. This is because you would be looking at the encoded version that only Applesoft interpreters can read. Sweet16 has a command that can overcome this conundrum. It’s the “Capture Text Screen” command in the File menu. What you do is LIST the file on the screen, Capture the text and then paster into TextMate. This is easier to say than it is in practice.
What gets pasted into TextMate is the characters that make up the screen display of the IIgs including all the trailing spaces and whatnot, a rectangle of characters. You need to carefully use the LIST command to limit what’s displayed because even modest Applesoft programs are more than the screen height and scroll by if LISTed without limits. In textMate you will need to remove all those trailing spaces but TextMate is good at things like that.
Next post – Chapter 3: Disassembly