Mac68k Forums

Home


Welcome, Guest
Guest Settings
Help

Mac68k Forums » Development » Software Hacking

Thread: Color happymac icons


Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 4 - Pages: 1 - Last Post: Feb 24, 2013 2:49 PM Last Post By: bbraun
bbraun


Posts: 493
Registered: 7/25/12
Color happymac icons
Posted: Jan 2, 2013 8:41 PM
Click to report abuse...   Click to reply to this thread Reply
Attachment happymac.tiff (33.2 K)
68k macs have always had the black & white happymac, and PPC's got a colorized happymac.
The PPC ROM uses the Color QuickDraw traps GetCIcon() to get a 'cicn' resource from the ROM's resource map and PlotCIcon() to actually draw it.
So basically any mac that had (32bit?) Color QuickDraw in ROM has been able to do what the PPC ROMs do. The IIsi has 32bit Color QuickDraw in ROM.

I've modified the ROMDisk IIsi ROM to more or less do what the PPC ROM does and is able to boot using a color happymac.



Here's what was involved:
First, get some code that retrieves the 'cicn' resource and displays it in the center of the main screen. I started with some C code that I ended up hand-massaging to work. The ROM already has a routine to put a centered 32x32 Rect on the stack, so I'm using that. Here's the code (disassembled using FDisasm):
0      4E56 FFF8      E_0:       Link      A6, $-8
4      2F0A                      Move.L    A2, -(A7)
6      247C 0000 0B9E            Move.L    $B9E, A2 
C      34BC FFFF                 Move      $-1, (A2) ; put 0xFFFF in low mem global ROMMapInsert so GetCIcon gets the 'cicn' from ROM
10     594F                      SubQ.L    $4, A7
12     3F3C B1CC                 Move      $-4E34, -(A7) ; push the 'cicn' resource id
16     AA1E                      DC.W      $AA1E ; _GetCIcon
18     2448                      Move.L    A0, A2 ; move A0 to A2, since A0 gets trashed by PushIconRect
1A     2F0A                      Move.L    A2, -(A7) ; push CIconHandle
1C     4EB9 4080 177E            Jsr       ($4080177E) ; PushIconRect
22     2F0F                      Move.L    A7, -(A7) ; push a pointer to the Rect
24     2F0A                      Move.L    A2, -(A7) ; push the CIconHandle
26     AA1F                      DC.W      $AA1F ; _PlotCIcon
28     504F                      AddQ      $8, A7
2A     AA25                      DC.W      $AA25 ; _DisposeCIcon
NOPs...
3A     245F                      Move.L    (A7)+, A2
3C     4E5E                      Unlk      A6
3E     4E75                      Rts


I put the code into ROM in place of the memory test, located at $467E2 ($467E0 contains a jmp (A6) to immediately return from the memory test, so everything after that is safe to use). To get the code working, I modified the happy mac display code (located at $1750) to jsr to this code.

Finally, the ROM's resource map had to be modified for the cicn resource. The .ATBOOT driver is currently unused, so I added an entry to the ROM map at the end of the .ATBOOT driver. At location $56630, I put a ROM entry header:
00056630  78 00 00 00 00 00 00 00  00 05 25 30 00 05 66 60  |x.........%0..f`|
00056640  63 69 63 6e b1 cc 58 00  6b 63 6b 63 6b 63 6b 63  |cicn..X.kckckckc|
00056650  4b 75 72 74 c0 a0 00 00  00 00 03 d2 00 00 02 3c  |Kurt...........<|


The header is mostly copied from the 'cicn' resource of a PowerBook Duo 2300 ROM. The important bits here:
$56638 is the offset of the next resource (in this case, .ATBOOT's header)
$5663C is the offset of the data contained in this resource entry.
$56644 is the 2 byte quantity $b1cc. This is the resource ID, and has to match the resource ID being passed to GetCIcon above.
$5665A is the 2 byte length of the resource entry. If you change the 'cicn' resource, you'll need to update this length since 'cicn's can be variable length.
And the previous resource in the rom map needed its header adjusted to point to this new resource (offset of next resource -> us).

So, if anyone is interested in changing out the icon, it's not entirely straightforward. The steps are:
1) Create a 'cicn' resource, ResEdit has an editor for them. They contain a color icon, a B&W icon, and an icon mask. The B&W icon is necessary and is used on B&W displays.
2) Separate out the actual data of the 'cicn' resource into a separate file. I personally use netatalk, and then grab the information out of the .AppleDouble directory (you still need to find the relevant data in that file, but normal file manipulation tools at least work, instead of being in a resource fork).
3) Place the contents of the 'cicn' at $56660. If the resource is larger than 1152 bytes, it won't fit, and the header will need to be adjusted upwards (and the previous entry's link to it).
4) Update the length of the resource in the entry's header.

Try it out here
tt


Posts: 144
Registered: 8/25/12
Re: Color happymac icons
Posted: Jan 4, 2013 3:07 AM   in response to: bbraun in response to: bbraun
Click to report abuse...   Click to reply to this thread Reply
Very cool. Thanks for sharing. I am wondering if it will show a greyscale icon for an SE/30 with internal greyscale via a Micron Xceed rig. I think before the happy mac icon appears, the Xceed card is initialized since there is an extra click or two and the monitor seems to switch to the greyscale mode.
bbraun


Posts: 493
Registered: 7/25/12
Re: Color happymac icons
Posted: Jan 8, 2013 9:14 PM   in response to: tt in response to: tt
Click to report abuse...   Click to reply to this thread Reply
I'm not sure what will happen with the Xceed, I don't have one to test.
When I set the IIsi for 256 grayscale, the color boot icon still displays
in color, so I suspect it isn't put into 256 grayscale until after the
system boots. As a result I'm not sure what will happen on a true
grayscale framebuffer.
tt


Posts: 144
Registered: 8/25/12
Re: Color happymac icons
Posted: Feb 24, 2013 2:39 PM   in response to: bbraun in response to: bbraun
Click to report abuse...   Click to reply to this thread Reply
I can confirm the color "happy mac", or in this case, "jack-in-the-mac" displays as grayscale with an Xceed-SE/30. Great work!!
bbraun


Posts: 493
Registered: 7/25/12
Re: Color happymac icons
Posted: Feb 24, 2013 2:49 PM   in response to: tt in response to: tt
Click to report abuse...   Click to reply to this thread Reply
Awesome! Thanks for the report!

Point your RSS reader here for a feed of the latest messages in all forums