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

