Wed, 21 May 2008
The path to the HTML and RSS versions of the weblog has changed. Any URLs like:
www.vitaphone.net/weblog/geek/retro2007/foo...
Are now:
www.vitaphone.net/weblog/geek/hpc/foo...
Everything should re-direct automatically, but if anyone's still reading this, you might want to change your bookmarks or feed URLs.
posted at: 00:55 | path: /geek/hpc | permanent link to this entry
The last update to HappyPlusClock was in January, and the last update to this blog was in November. I have been working since then, however, and I hope to have version 1.0 out before long. Why am I not done yet?
I re-wrote the compositor code (that is, the code that makes sure all the bits (clock, toolbar, date, etc.) get drawn in the correct order at the correct time. It's much cleaner now, but a little slower than it should be. Once it's up to speed, I'm practically done with 1.0.
My dev box (a platinum Power Mac G3 desktop) is being cranky and hasn't powered on in two weeks. It's been flaky ever since I put a USB card in it, but I still hope to bring it around.
I broke off for a while and wrote a video test pattern utility because my Plus's video wasn't square, so the analog clock was stretched vertically. Once I get HappyPlusClock 1.0 out, I'll turn my attention to cleaning up and release the test pattern program.
Work has been busy, and we're entering the very busy summer months. But I'm taking time off around Memorial Day, and I'll see if I can get the G3 going again.
posted at: 00:09 | path: /geek/hpc | permanent link to this entry
Tue, 13 Nov 2007
I found this entry that I'd written 3 Aug. 2007, but never pressed the button to post for some reason.
And one other note on writing retro Mac programs in general. You have a
lot of freedom working on a dead system, because Apple isn't going to
update Classic Mac OS any more. For example, hiding the menu bar
involves fiddling with the GrayRgn and MBarHeight, both low-memory
global variables. (Both of which I accessed through accessors, but
they're still lowmem globals.) Apple finally, round about Mac OS 8.5,
introduced HideMenuBar and ShowMenuBar system routines. I could test
for their availability and use them if so, but why bother? The old way
works on 9.2.2, the last verion of Classic Mac OS, and the unnecessary
test just adds complexity.
You shouldn't take that approach on a live system (the old way, of course, stopped working entirely on OS X), but on a dead system, you can bend the rules a little more because you know things won't change.
Of course, you still need to look at the circumstances your program will be used in and be a good citizen. Classic Mac OS is dead in that there's no further development from Apple, but it's still very much alive in that it's being used by many people. On a Plus, I basically try to get as much CPU time as I can because the routines to draw the clock take a while on a 68000 and I want to be sure that updates are smooth. And on a 68000 system, you typically aren't going to have any other processes going while the clock is up, so it's not unfriendly.
That approach on a modern system just hordes the CPU unnecessarily, and, on a G4 or G5 (especially in Classic mode), probably wastes energy by defeating some of the power-saving measures built into those systems. So I do check for the 68000 case specially, and only run flat-out on a real 68000, allowing the program to sleep for split-second chunks of time on faster processors.
This project has been a wonderful opportunity to geek out in the magical land of Classic Mac OS.
posted at: 20:19 | path: /geek/hpc | permanent link to this entry
Wed, 15 Aug 2007
Version 0.84 is now available.
This fixes another stupid clock drawing bug, which I introduced with 0.83, because I based 0.83 on my development branch rather than directly off of 0.82. I happened to be in the middle of re-factoring the analog clock drawing code, and forgot I wasn't finished. :(
In my present-day development, I'm used to working with version control: RCS, CVS, Git, and so on, and I know enough not to make stupid mistakes like that. (That's what branches are for.) But on this retro program and this retro development environment, I completely forgot all those advances.
I think I have MPW SourceServer laying around someplace. That's going to be a switch from Git...
posted at: 22:07 | path: /geek/hpc | permanent link to this entry
Wed, 08 Aug 2007
Another bug fix: another stupid display bug in the digital clock. Nice little off-by-one error. Please, go download version 0.83 before you discover why I feel as silly as I do.
(Part of the code cleanup is adding better testing mechanisms, BTW.)
posted at: 23:01 | path: /geek/hpc | permanent link to this entry
Mon, 06 Aug 2007
Okay, so one night I was complaining about the Pascal compiler, and I complained that macros didn't work. To my embarrassment and pleasure, I found that's not true. They work on CW Pro 4; I just wasn't using them correctly.
For the record, here's my (working) assertion macros:
{$IFC APH_DEBUG}
{$definec Assert(assertion) begin if not (assertion) then
DebugStr('assertion failed;hc;sc') end}
{$definec AssertStr(assertion, str) begin if not (assertion) then
DebugStr(str + ';hc;sc') end}
{$ELSEC}
{$definec Assert(assertion)}
{$definec AssertStr(assertion, str)}
{$ENDC}
I stumbled across an example of doing it correctly inside some Apple sample code, in the MoreSetup.p file of the MoreIsBetter package, still available at http://developer.apple.com.
posted at: 21:51 | path: /geek/hpc | permanent link to this entry
Wow, you guys liked the clock! HappyPlusClock was named the best creation of Retro Challenge 2007!
As I mentioned, I'm going to continue to improve HappyPlusClock, and as soon as I get a couple bits of code in presentable shape, I'll release the Pascal source as well. I wrote it so I could put this great old Mac back into service doing something useful. As you can see, it's happily running on my Plus.
Thanks again, and I hope I can come up with something worthwhile for next year!
Congratulations to Oliver for winning for the best blog. I'm ashamed to say that I missed his site for most of the month, but it's no wonder he won... a IIgs, a Classic II with grayscale and a logic board transplant, and a "PIKO dat" electronic computer from 1969! And movies for everything.
posted at: 01:36 | path: /geek/hpc | permanent link to this entry
Fri, 03 Aug 2007
Things I've learned while writing HappyPlusClock
In the immortal words of Technote ME 14: "We all know what
_DisposeHandledoes to your data by now; data integrity was not in the list."CW Pascal's
StringOflibrary routine can't handle unsigned values.Don't bother with CW's MacOS.lib on 68K, go find MPW's Interface.o and use it instead. As long as you have the Universal Interfaces, everything will be fine, and you'll get access to a bunch more libraries and routines via glue code.
Update: this is bunk. MacOS.lib does include all the same glue that Interface.o does. Sorry 'bout that, MetroWerks.
Via the magic of said glue code, you can call
BitMapToRegionon machines without Color QuickDraw, even on System 4.2!Less magical but perhaps even more helpful,
HOpenResFileis available in glue, too, even if you aren't on System 7.CopyRgnis defined as possibly moving memory, meaning it can call the Memory Manager to allocate memory. (Looks likeSetHandleSize, in case you're wondering.)CopyRgnis not defined as returning an error, so heaven only knows what happens if the Memory Manager fails for some reason.QuickDraw on Mac OS 9 is remarkably tolerant of programmers doing stupid things like passing invalid pointers to
CopyBits(or invalid handles toCopyRgn). QuickDraw in ROM on a Mac Plus isn't so tolerant. (Side note: I actually made my Mac snap, crackle, and pop entirely through software this way. And the display started wigging out -- not just the displayed bits, but the monitor itself was getting fuzzy and jumping a bit! My guess was that QD had scribbled over some memory-mapped IO addresses. At that point, I shut the thing off before smoke started coming out.)DateStringbad;IUDateStringgood. I don't know why.{$IFC POWERPC}and{$IFC DEFINED POWERPC}are not testing the same thing. I actually knew this already, but it took a couple of hours to figure out why some 68K code was using a PowerPC record layout.
posted at: 14:38 | path: /geek/hpc | permanent link to this entry
Well, July is over and the Retro Challenge 2007 ended with it. But it won't be the end of HappyPlusClock.
Since some of the code was rather rushed, I think what the program needs now is some clean-up. After that, I'll look at new features.
Thanks to everyone who wrote me about HappyPlusClock -- I really appreciate it and your messages have made the challenge fun.
posted at: 13:35 | path: /geek/hpc | permanent link to this entry
Sun, 29 Jul 2007
A bug-fix release is now available for download. Somehow, I'd never noticed the display was incorrect from 12pm to 1pm. Sheesh.
posted at: 17:33 | path: /geek/hpc | permanent link to this entry

