Just wanted to post my experiences with reading the book MPW and Assembly Language Programming for the Macintosh from 1987 (available as pdf online).
Maybe this might help someone else who wants to follow along with the examples in this book.
First note:
The book is written for MPW 2. Macintoshgarden clearly states that version 2.0.2 is the one to select for this book, while other sites that share MPW don't state this, and unless you happen to select Macintoshgarden as your source, you won't know this. (Well, you won't know unless you have read this text, obviously).
However at least MPW 3 is required for System 7.x, while MPW 2 only runs in System 6 (or most likely also earlier versions). I really wanted to run System 7 for two reasons. One is multi finder (being able to switch between running applications) and the other is that Basilisk II can't run System 6 as there seems to be no way to turn off 32-bit addressing, and System 6 can only run with 24-bit addressing. The reason that I want to run Basilisk II rather than mini vMac (that can run System 6 fine) is that mini vMac is fixed at the default 9" mac screen resoultion (or other higher resoultions I assume when running the version for emulating a Mac II?), while Basilisk allows resolutions that are suitable for the screen I'm running it on.
The quick work-around is to take all the files from MPW 2, and replace the MPW Shell application (and possibly some of the script files) with files from MPW 3 (I used 3.x).
The more complicated solution is to update the examples in the book. Currently I have only tried the first "Coin" example in Assembler, Pascal and C.
The Pascal version is the simplest to get going, you just have to add Interface.o to the libraries you link with.
The C version is the second simplest to get going. String constants have to start with a backslash and the letter p right after the first quotation mark, to indicate that it's a Pascal string rather than a C string. Also the function PtInRect should be called with (pt,&r) rather than (&pt,&r).
The Assembler version is the hardest to get going. There is a tech note describing the problem:
https://preterhuman.net/macstuff/techno ... pt_16.html
The tech note suggest taking a look at sample.a that comes with MPW 3.x, and that is exactly what I did.
In particular I had to replace the lines
Code: Select all
MAIN
PEA -4(A5)
with
EXPORT (QD):DATA
QD DS QDGlobals
MAIN
PEQ QD.thePort
A few general words on getting things going:
I use BasiliskII-Windows_19-01-2024.zip, which was the latest when I downloaded it.
I use System 7.5.3, US-American English version.
To get the keyboard working I had to install US-American English keyboard for the host. I'll probably post about this separately in the Basilisk II section of this forum.There is a separate file with some key codes, it seems to be the same file as the one included with Basilisk II and no matter what I do, the keys that produce national characters that aren't in the English alphabet, in my case åäöÅÄÖ, don't work at all in Basilisk II, which prevents me from typing the characters [{,:'" and that obviously makes programming impossible. Unfortunately this makes it necessary to allow pressing the windows key to not only go to Basilisk II but also to the host OS (windows + space bar cycles between keyboard layouts). (Or rather, it's probably possible to enable some systray icon that can be used to switch keyboard layout, but I want to use the keyboard shortcut). This in turn makes some key combinations within the emulation "dangerous". For example option+L is interpreted as Windows+L which locks the screen.
I use Stuffit Expander 6.1.3, A trick worth trying in some cases is to unpack some archive with a disk image within Mac OS, and then copy it to the host file system, and the copy the resource part of that image file over to act as a resource for other image fileBinHex 4.0 and Disk Copy 6.1.3, and those in combination with tools running on the host, and Basilisks ability to mount images and access the host file system, allowed me to open most archives. I can't guarantee that this works for unpacking all versions of MPW though. As a rule of thumb, try to get versions of applications that are in sit or hqx format, and get the iso version of stuffit expander. Attach the stuffit expander iso and install it, and then use the sit or hqx files via the host file system access to install other appliaction. Downloading image files that are packed with non-classic Mac tools might work, but might cause you grief. I'll probably start a separate thread asking a bit about this too.
I also used mini vMac with system 6 to do certain things. System 6 and system 7 can access each others hard disks, so it's easy to add both the mini vMac system 6 hard disk and the Basilisk II system 7 hard disks to both emulators, so they can access each others files. I might misremember but unless I messed things up, it seems like some images work in one but not the other, and/or some images works as added disks to the emulators but not as image files within the emulation using disk copy.
I know that there are plenty of other ways to develop software for vintage Macs, both other tools that run within System 7, and also tools that run on a modern computer where you move the result to an emulator (or real hardware). However I wanted to experience MPW. The anecdote here is that over two decades ago I found the book "On Macintosh Programming: Advanced Techniques" at a thrift store, and over the years I've read it perhaps two or three times, without having much Mac experience (back in the days I used ShapeShifter mostly for running Acrobat Reader and not much else). After reading that book again a few months ago, I decided that I really wanted to try out the MPW experience and whatnot, and here I am