Posts

Showing posts from November, 2024

Using Retro68 on a Mac

I was looking at Retro68 for legacy Macintosh development. It is handy because I can use a modern IDE and compile stuff without coding straight into the emulator. It seems it also supports C++ beyond version 98 and it would include modern optimisations. I don't know. (I'm mediocre, not exceptional, remember? I'll figure out at some point and then I post here.) But there are no guides for this thing anywhere. There's a bloke using Linux and another using... Linux as well, I think. I don't know, it's all wrong, so I had to figure out one step at a time. Tutorial time! I am on macOS 15.1. My mac is an M2 mac. I got the regular developer junk installed, you know, XCode, those xcode tools and Homebrew and all that stuff. So first, we update Homebrew, because this thing is always outdated. (What's up with that? Stop adding shit to this tool! Weirdos.) $ brew upgrade # lots of unnecessary noise here $ brew install boost cmake gmp mpfr libmpc bison texinfo # 26 mi...

Bundles in Mac OS 9

I've skipped the transition from Mac OS 9 to Mac OS X. So while I was following the wyag tutorial to write a GIT my first step into the implementation was to figure out a way of assessing whether a path exists and whether it was a directory or a file. I got a lot of help from some clever people on the 68kmla forum and came up with a neat little code: https://github.com/sentient06/classic-mac-snippets/blob/master/Cpp%20Toolkit/FileFinder.cp Of course, that thing wouldn't work on my emulated mac, no matter what I did. I finally figured out the reason, though: some weird setting caused the generated app to be wrapped inside a bundle, very much like Mac OS X's app bundles. So as the binary lived inside that bundle, it wasn't able to find the files in the current directory because it was lookin at its own wrapper instead. Mystery solved. I shall resume my tutorials from the PowerPC Programmers Toolkit. They are immense and such a bore to write!

Note to self: resource forks on modern macOS

On a modern macOS system, you can investigate and log Type and Creator codes using the mdls (metadata listing) command in Terminal, like so: mdls /path/to/file This command lists all metadata associated with the file. The ones I want are: kMDItemFSTypeCode : This is the file type code. kMDItemFSCreatorCode : This is the creator code. These attributes can be verified on Classic with ResEdit.  

Classilla problems

So every time I download a file on Classilla, it corrupts the metadata. So the type is always "GIFf" and creator is always "ogle", which forces me to change the creator and type manually. Of course, I don't know these by heart, so I need to figure out every time it happens. I've been setting Mac OS 8.6 on SheepShaver to work along with Mac OS 9.2.2 on QEMU. The advantage is that SheepShaver copies the host's clipboard, so it's much easier to edit files. But then on Mac OS 9 I use FileType to address the metadata issues and, naturally, that doesn't work on SheepShaver because it requires Carbon. So now on Mac OS 8 I use BunchTyper. But it's a pain in the arse. I wish Classilla would just leave the metadata alone.

Books books books

 I started reading PowerPC Programmer's Toolkit by Tom Thompson from 1996. It's C. But it has extensive Toolbox information. The sad bit is that I don't have the CD-ROM that should accompany the book, so I have to type every block of code, and there's some seriously long ones. It's a good book. It didn't age well, with all those Copland boxes and comments, but it's almost what I needed. It will take a while to finish this one.

Data Forks

Image
I read that GIT actually doesn't track data forks. So if I create a GIT solution for Mac, I need to deal with that. My research took me into the realms of Rez and DeRez: the tools that Apple created to encode and decode data forks. Apparently these tools made into Mac OS X and might still live in modern systems in the form of a Unix binary. For the good old fashioned Mac OS, however, it can only be used on the Macintosh Programmers Workshop. I downloaded MPW from a mirror of Apple's FTP and got it installed on QEMU. Bloody hell, this thing is not very intuitive! So, the MPW shell is basically a text editor. But by typing commands, then using ⌘+ return, it executes as if it were a Unix shell, by printing the results below. If there's any text in the way, it simply pushes it down. It's kind of neat, but very easy to make a mess of things. So, the plan is... We create an invisible dot-GIT directory with all the standard stuff inside, then we make another invisible dot-Data...

Directory delimiters

So I was reading about GIT. I need to develop some sort of code to check the existence of directories, to create new directories and possibly delete directories. That's not too easy from the little I saw of the Toolbox. Then it downed on me: directory sections are separated on Mac OS with colons. GIT and Unix systems use slashes. Windows uses a backslash. Sure enough, Windows has a translation procedure on its implementation of GIT (which is actually Linux, but.. emulated? I don't know. Don't care.) So I need to translate between Mac OS directory delimiters and Unix as well. I'll just add this to the to-do list.

Write yourself a GIT!

I found a website called "write yourself a Git!", which, as the name suggests, explains how Git is implemented and explains how to replicate it using Python. By looking at the requirements, a few things that are readily available in Python must be addressed first. It requires a parser for Microsoft's INI format, it needs SHA-1, regular expressions, and ZLib. I've decided to start by coding a SHA-1 function in C. It can then be imported as a C++ method. The ZLib should have been implemented somewhere with C++98, so I'll try and find something like that. I think there's regex on C++, but I need a refresher on that language.

For Dummies indeed

The second book I grabbed is 'Mac Programming for Dummies - 3rd Edition' from 1999 by Dan Parks Sydow. This book is seriously slow-paced and repetitive, and it only scratches the surface on the Toolbox. If one ignores most of the extremely simplistic explanations, one can finish that book in a few days. The best takeaway was the tutorial on ResEdit, but that's about it. There's a small Toolbox explanation as well, but very superficial. Also, it's still plain old C even thuog the book is rather recent. I'll have to find other books.

Flashback: 2001

In Brazil the primary school used to take 8 years to come to an end, after which a 3-year long secondary school period took place. They eventually introduced a special kind of secondary school that added a professional training programme, lasting the same 3 years period. It was called something that roughly translates to 'Technical Tuition.' I enrolled on a Technical Tuition school to learn IT. I was excused of English lessons after I suceeded on a proficiency exam. On year one we had basic computing and logic, but we also had Visual Basic and Delphi. Of course, it was all very Windows-centric, no Brazilian school could afford Macintoshes. Apple products were still a niche thing in 2001. I didn't know that Delphi was a version of Object Pascal, and that Pascal was one of the gates for Macintosh programming, otherwise I would put more effort into learning it. Delphi was more attractive than Basic for me in the beginning anyway, so that would have been fun. Because of the sch...

Catching up with C

I've finished reading Learn C on the Macintosh, second edition, by Dave Mark. It's a good refresher on C. I forgot how simple it was. But there's no Toolbox involved in this book, no GUI at all. Also, typing code into the emulator is a major pain in the arse. I've installed CodeWarrior Pro 8 on Mac OS 9. The IDE is version 5. I don't know what these guys had in mind when numbering these things, but it isn't very intuitive. QEMU has no clipboard support. And CodeWarrior is not great for typing. I'm spoiled with newer editors, and I'd like to use multiple cursors, fancy shortcuts and stuff like that. So I figured I could sync a directory with the shared drive on QEMU. But no game, because the thing is broken. The shared drive is a one-way road into classic Mac OS, and I can't save stuff back into it from the guest system. So I've decided to make a DMG or IMG file and put it there. By mounting on the guest and the host, I'd be able to sync the f...

Flashback: 1999 - part 2

Image
Pirates of Sillicon Valley was released in 1999 and it describes how Apple and Microsoft were funded and how this relationship caused Microsoft to supplant IBM in the 1990s. The film ends with Jobs returning to Apple and cutting a deal with Bill Gates, who became the proverbial Big Brother depicted on Apple's iconic Macintosh advertisement in 1984. This is a great film I managed to watch on VHS as it was released on Blockbuster. The story kind of stuck in my head and I eventually copied the whole thing into a new tape. I would see that film again a few times. It introduced me to the Xerox Alto, the Apple Lisa and some of Microsoft's and IBM's history as well. It also led me into learning about Next and some other stories concerning Apple and Steve Jobs. More or less at that time I found out about Macintosh emulators and started playing with them. Fusion, Basilisk II and vMac would be part of my collection of software. I even developed a website in Portuguese with tutorials ...

The epiphany

So, after sorting out Mac OS 9.2.2 on a neat QEMU setup, I asked ChatGPT to suggest 10 modern apps for classic Mac OS. This is the list the AI came up with: Basic Markdown Editor To-Do List App with Simple Sync (Local Sync) Local Weather Forecast App Lightweight Personal Wiki RSS Reader Pomodoro Timer for Productivity File Hashing Utility (MD5, SHA-1) Retro Messenger App Basic Image Viewer with PNG Support USB Drive Explorer There are a few obvious messy ones, like a retro messenger app and a USB drive explorer, and a few that few a bit pointless like an image viewer, an RSS reader (do people still use that?) and a wiki. But overall, it's not too bad. I thought about starting with the markdown editor. Why not? I tell you why not. It's painful, that's why. I soon realised that classic Mac OS has no git support. So I would have to code the old-fashioned way: comment out old code, update code, delete code, duplicate files, save a version with a date, rinse, repeat. Sure, I cou...

Flashback: 1999

My parents were separated, albeit not divorced, and I lived with my mum. One winter in 1999 I spent a winter school break with my dad. He had worked for a publishing house for many years and decided to start his own publishing house, and his business partner had yet another publishing house specialising in maps. Naturally, all design was done in Macintosh machines. I had been using Windows for quite a while then. My mum got an IBM PC when I was about 7 or 8 years old. It ran DOS and Windows 3.11. It was rather boring, there was a few games I enjoyed, but not many as they were hard to come by and expensive. We had an upgrade eventually, and Windows 95. That machine stayed with us for half a decade. In 1996 I used the internet for the first time. I remember sending my first e-mail to my dad and my mum explaining that it was cheaper than making a phone call to my grandma. We used Netscape to browse the web. I didn't see anything interesting about it, so my experience was limited. But ...

Catching up with QEMU

So I was looking for some backed up files when I bumped into my Mac OS Anthology collection. I wondered if those files were complete and whether they worked. I remembered that there was a lot of talk about QEMU a couple of years ago and I had a copy of one of the prototypes somewhere with Mac OS 9.2. It wasn't great. But it worked. I wondered if I could run Mac OS 8.6, as I have this British copy of that version. I know it's silly, but I'm annoyed to see American English everywhere. Seeing the 'wastebasket' instead of 'trash' is nice. Well, it turns out QEMU can't run Mac OS 8.5, nor 8.6. I decided to run 9.2 instead. I was aware of the Mac OS 9 lives community, so I decided to start from there. Maybe they are talking about QEMU as well. Well, they were, but Emaculation was ahead in the curve. Mac OS 9 Lives however, had something nice in store: a bespoke Mac OS 9.2.2 installation and tools. So I downloaded and tested on QEMU and it was good. I then down...

Flashback: 1991

Image
I was born in 1986. I don't know when or how this happened, but I was not yet in school when my dad put me in front of a Macintosh. I was black and white, but like nothing I've ever seen before. There was this game where there seem to be a lounge full of weird characters and I could play air hockey against them. I didn't have enough coordination to win the matches, but I could make the paddle the whole length of the table (well, my dad could), which meant I'd win every single time. I thought that that was terribly clever. Of course, being the dad he is, he was trying to convince me not to cheat, but to no avail. I now know, after some search, that the game was called Shufflepuck Café, it was released in 1989, and as we lived in Brazil, it's very much likely this didn't happen in 1989. More likely 1990 or 1991, which is a point where most of my early childhood memory lie. And that was my first time operating a computer, as far as I know. And it was my first time ...

"I'm sure that in 1996, Macintosh programming is available in every corner drugstore, but in 2024, it's a little hard to come by"

I've decided to make an app for classic Mac OS. Starting in 2024. I have no idea how to do it, but I've decided to document it. Let's see what happens next.