• Updated 2023-07-12: Hello, Guest! Welcome back, and be sure to check out this follow-up post about our outage a week or so ago.

Framework for developing a 68k application w/ serial port communication

ironhalo

Active member
I'm contemplating a small project that would allow me to send/receive serial communication between my SE/30 and an external microcontroller unit (via the serial/modem port). I've written a dozen or so embedded C++ apps in the past that include custom MCU to MCU serial communication protocols, so I've got that side of it thoroughly covered. The new territory for me would be developing a C++ app for 68k.

I've installed copies of the Macintosh Programmer's workshop, and Codewarrior 5 Pro. Between the two, Code Warrior seems to be a clear winner in terms of a modern-ish IDE. From there I installed Apple's "MacApp" framework and the Metroworks "PowerPlant" framework. I'm steadily going through the documentation and tutorials for both of those, but unfortunately I have yet to uncover an example or source code for a 68k application that engages the Mac's serial/modem port.

Can anyone recall seeing and frameworks, libraries, tutorials or anything open source that might show some example code for working with a classic Mac's modem port? Thanks in advance!
 

ironhalo

Active member
Update: It looks like someone has developed a more modern workflow using the CodeLite IDE and Retro68, which seems like a solid option I will defintely investigate. And interestingly enough, there is some code in the following article that reveals some of the syntax used with the Mac's serial ports:


However I would still be very interested to know about any other resources you may remember that could provide further examples. Thanks.
 

Melkhior

Well-known member
MPW was a nightmare, you really want the latest CodeWarrior that will run on and support your Mac. Alternatively, you might run said CodeWarrior on the same version of the system that you run on the SE/30 in a Qemu virtual machine (there's a version that can emulate a Q800), as that will be a *lot* faster than a real SE/30. It's going to be 'old' C++ no matter which Mac-native tools you use. For 'modern' C++, you can try Retro68, but that might not play nice with the vintage C++ application framework...

For the serial port, it might not be supported in the C++ framework of the era. You may need to talk to it in regular C, checking the C headers and the Pascal-oriented documentation for the serial port driver. In the revised edition of Inside Macintosh, that would be 'Devices', chapter 7.
 

cheesestraws

Well-known member
An annoying answer: it depends what you mean by "work with". If you want to just do standard RS232 in a modem-like way, the "proper" way to do this would probably be to use the Communications Toolbox, which abstracts away the hardware. Reference and sample code are in Inside the Macintosh Communications Toolbox. (Ignore the macos8 in the URL, the comm toolbox is available all the way back to 6, though may require an extension for System 6).

If you want to do something more low-level, then use the serial driver. This is documented in Inside Macintosh: Devices, chapter 7.

And interestingly enough, there is some code in the following article that reveals some of the syntax used with the Mac's serial ports

This uses the serial driver, which might (?) not be considered best practice under System 7+ depending on what you're driving. On the other hand, it will also work, so long as nobody wants to run it on a non-standard serial port.

CodeLite IDE and Retro68

I don't get on with retro68, personally, and do all my own development in CodeWarrior. However, that's partly because retro68 is far too much like the toolchains I use for work, and that's depressing. MPW is at best a footnote in the history of UI for development tools at this point, but it's worth trying out both retro68 and CodeWarrior and seeing which you prefer. It could go either way :).

edit: I may be overthinking it about the comms toolbox. I was talking to someone about it earlier and about driving an ADB modem, which is why it's in my mind...
 

Crutch

Well-known member
I would really just use the Serial Driver. I've done it to get an SE/30 running 7.5.5 talking to an Arduino Nano. (At one point I stuck a nano with a thermistor circuit wired to it inside my SE/30 then fed the temp readings into the serial port so I could get a real-time reading of the temperature above my flyback because .... well why not???)

I have code to do this somewhere if you want it. It's not hard really.

I'm not aware of the Serial Driver ever being deprecated but, maybe? I've never done any MacOS 8 development though.
 

cheesestraws

Well-known member
Yeah. On re-thinking I think I was overthinking that. OP, ignore my tangent about the Communications Toolbox and just use the Serial Driver.
 

ironhalo

Active member
MPW was a nightmare, you really want the latest CodeWarrior that will run on and support your Mac. Alternatively, you might run said CodeWarrior on the same version of the system that you run on the SE/30 in a Qemu virtual machine (there's a version that can emulate a Q800), as that will be a *lot* faster than a real SE/30. It's going to be 'old' C++ no matter which Mac-native tools you use. For 'modern' C++, you can try Retro68, but that might not play nice with the vintage C++ application framework...

For the serial port, it might not be supported in the C++ framework of the era. You may need to talk to it in regular C, checking the C headers and the Pascal-oriented documentation for the serial port driver. In the revised edition of Inside Macintosh, that would be 'Devices', chapter 7.
Yeah MPW does not look like it would be enjoyable to use. I landed on CodeWarrior 5 Pro as the latest I could install on a BasiliskII Quadra 68040 running 7.5.5. Thanks for the documentation reference, that's helpful.
 

ironhalo

Active member
(At one point I stuck a nano with a thermistor circuit wired to it inside my SE/30 then fed the temp readings into the serial port so I could get a real-time reading of the temperature above my flyback because .... well why not???)

I have code to do this somewhere if you want it. It's not hard really.
Haha. Yes my project will certainly fall into the "because why not" category.

I'll PM you with a couple of questions. Thanks.
 

Phipli

Well-known member
Hello,
this is an old post, but I wonder if you managed to build your application, as I'm seeking for something similar
Have you considered using HyperCard and the Serial extension apple made?

Would that cover your use case?


I've used it to control external serial devices in the past like this :

 

pfuentes69

Well-known member
Have you considered using HyperCard and the Serial extension apple made?

Would that cover your use case?


I've used it to control external serial devices in the past like this :

I never used HyperCard, but it may be an option... Thanks for the hint.
 

Phipli

Well-known member
I never used HyperCard, but it may be an option... Thanks for the hint.
That's a good enough reason to give it a go, it is interesting to have a play with. There are a huge number of reference books archived online, plus later versions come with a HyperTalk Reference document, which is searchable and has examples and information on how to use commands.
 

pfuentes69

Well-known member
That's a good enough reason to give it a go, it is interesting to have a play with. There are a huge number of reference books archived online, plus later versions come with a HyperTalk Reference document, which is searchable and has examples and information on how to use commands.
Yes, it may be interesting.
Right now I'm considering the option using process-to-process communication (you saw the other post :) ) so Serial communication is more a last option in case I can't figure out how to do it using LocalTalk connection.
 
Top