• Hello MLAers! We've re-enabled auto-approval for accounts. If you are still waiting on account approval, please check this thread for more information.

Change to csCode 22 with Mac OS 8

Playing around in ROM code again, and I noticed a difference in behavior with System 7 and OS 8. Starting with Mac OS 8, the operating system no longer issued control code 22 to my ROM disk driver. (22 = get icon)

I found Apple's Tech Note 1102, which has a very interesting mention about this almost in passing:

The File System Manager's _Control csCode #22 patch no longer affects non-disk drivers.

So in order to get the driver to work in similarly in OS 8, I suppose I now need to research how the operating system interprets a disk driver from a non-disk driver. Just interested if anyone has stumbled into this before?
 
Did you lookup kdgMediaIconSuite for DriverGestalt?

csCode 22 is kMediaIcon "Return media icon"

Some notes for kMediaIcon, "Return media icon", and kdgMediaIconSuite :
https://developer.apple.com/library/archive/technotes/dv/dv_05.html Jun 1, 1985 - June 1, 1995 "Drive Queue Elements"
https://developer.apple.com/library/archive/technotes/dv/dv_17.html April 1, 1990 "Sony Driver: What Your Sony Drives For You"
https://developer.apple.com/library/archive/qa/dv/dv28.html Mar 14, 1997 - Jul 11, 1997 "Serial Flow Control Bug"
https://developer.apple.com/library/archive/technotes/tn/tn1102.html Sep 11, 1997 - Mar 29, 1999 "Mac OS 8"
https://developer.apple.com/library/archive/technotes/tn/tn1189.html Nov 22, 1999 "The Monster Disk Driver Technote"
https://developer.apple.com/library/archive/samplecode/Disk_Icons/Introduction/Intro.html Jan 14, 2003 "Disk Icons"

The patch mentioned by tn1102 is supposed to fix the problem with dv28?

A disk driver should have a drive number in the drive element queue?

It appears the supermario source code doesn't have code for the File System Manager patch?
 
Great info as usual @joevt! Yes, I dug through some of that material. From "The Monster Disk Driver Technote", I found this information. It could be possible that 8.0 and 8.1 are just stuck right in the middle- between the legacy kMediaIcon (7.X) and new (8.5) kdgMediaIconSuite.

A classic problem with disk drivers is that the mechanism for returning icons from a disk driver (Control requests kDriveIcon (21) and kMediaIcon (22), documented in Technote DV 17, "Sony Driver: What Your Sony Drives for You") is limited to black-and-white icons. In Mac OS 8, the Finder was changed to look at the drive and apply special-case color icons, but there was still no generic way for a disk driver to return a color icon.

Mac OS 8.5 and later allow disk drivers to return color icons. This is done through two new Driver Gestalt selectors, kdgPhysDriveIconSuite (equivalent to the kDriveIcon (21) Control request) and kdgMediaIconSuite (equivalent to the kMediaIcon (22) Control request). To give your drives a color icon, you must respond to these Driver Gestalt requests by putting a pointer to an icon family ('icns') in driverGestaltResponse. The icon family allows you to return any number of icon sizes and depths in one data structure.

I'm digging through the 8.0/8.1 System and Finder files now to see if I can find the patch referenced by TN1102.
 
I'm digging through the 8.0/8.1 System and Finder files now to see if I can find the patch referenced by TN1102.
Maybe you can find the patch by tracing through a call to _Control in MacsBug or Jasik's The Debugger.

Does a _Control call from an app (see the linked "Disk Icons" sample code) get the icon from your driver or is the control call intercepted by a patch that overrides your driver as described by the dv28 note (though here we are talking about the fix described for Mac OS 8 in that note)?
 
That's a good idea, I'll try stepping through this in MacsBug next time I boot up that OS 8 machine.

On a side note, I used quickdraw.h to paint a message on the screen each time either the kDriveIcon or the kMediaIcon control call came into the driver. Sure enough on any flavor of System 7, the dialog box appeared for each call. But when booted into OS 8, the dialog box never came up. (And I can confirm, the icon displayed in OS 8 is not from the driver).

So, I think you may be right. The control call is probably being interrupted by the OS 8 patch. But I'll step through this in MacsBug and report back.
 
Last edited:
OK I have an update on this. I did some more tracing with OS 8.0/8.1. It seems csCode 22 (kMediaIcon) does in fact execute correctly, and the ICN# gets applied. But csCode 21 (kDriveIcon) does not apply the ICN# on the drive in the Finder.

I was able to get around this in OS 8.0/8.1 by changing the return value (csParam) for csCode 23 (kDriveInfo). Here is my specific code below:

// Reference IM Vol 4 Pg 473 & PB 150 Dev Notes Pg 38
// byte 3 unused = bin(00000000) hex(00)
// byte 2 unused = bin(00000000) hex(00)
// byte 1 attributes = bin(00000110) hex(06) primary + fixed + SCSI + internal
// byte 0 type = bin(00000001) hex(01) unspecified
*(long*)p->csParam = 0x00000601;

Originally I was returning 0x0000411. But changing the bytes as indicated by the comments seems to work well. OS 8.0 and 8.1 both automatically execute the control call csCode 23 (kDriveInfo) when displaying drive icons in the Finder.
 
Last edited:
Back
Top