mac-rom/Drivers/Sony/SonyIcon.a
Elliot Nunn 4325cdcc78 Bring in CubeE sources
Resource forks are included only for .rsrc files. These are DeRezzed into their data fork. 'ckid' resources, from the Projector VCS, are not included.

The Tools directory, containing mostly junk, is also excluded.
2017-12-26 09:52:23 +08:00

324 lines
15 KiB
Plaintext

;
; File: SonyIcon.a
;
; Contains: Sony Driver Icon & Drive Physical Characteristics support
;
; Written by: Tom Jennings 11 Aug 86
;
; Copyright: © 1986-1993 by Apple Computer, Inc. All rights reserved.
;
; Change History (most recent first):
;
; <SM12> 5/19/93 GMR Moved Icon tables to UniversalTables.a, modified Icon routines
; to use those tables, so we don't have to change the Sony driver
; for each new machine.
; <SM11> 01-11-93 jmp Updated various BoxFlag names.
; <SM10> 12/23/92 RC Added Support for Smurf on Wombat
; <SM9> 12/14/92 RC Restore Pre-PDM d2 with Horror Roll in
; <SM7> 12/8/92 HY Added LC II icon support.
; <SM6> 12/7/92 rab Roll in Horror changes. Comments followÉ
; <H9> 6/26/92 SWC Updated box names to use shipping product names.
; <H8> 6/3/92 SWC Call the Docking Manager (if supported) to get a custom drive
; icon for a connected docking module. Moved the IconLookup table
; to SonyPatches.a since we'd run out of expansion space. Changed
; floppy drive type in tables from 800K to SuperDrive.
; <H7> 4/15/92 CMP Added support for vail25.
; <H6> 3/17/92 SWC Renamed boxDBLite->boxDBLite25 and boxDBLiteLC->boxDBLite33, and
; added boxDBLite16 and boxDBLite20 to the table. Cleaned up
; header comments.
; <H5> 1/14/92 SWC Added support for DB-Lite LC. Conditionalized out the
; non-existant machines we have boxflags reserved for to make more
; space in the table (adjusted padding as well). Updated boxFlag
; labels to use shipping product names.
; <H4> 11/14/91 SWC Added support for DB-Lite.
; <SM1> 10/25/92 HY Added support for boxMacLCII boxflag.
; <11> 7/14/92 CSS Fixed the comment below so an exact version of this
; file could be copied into SuperMario.
; <10> 4/27/92 JSM Get rid of conditionals: supportsPWM, supportsDCD, and
; has3rdFloppy are always false, forROM, supportsMFM, forDiskDup,
; isUniversal, hasPowerMgr, and hasPwrControls are always true
; (although hasPowerMgr currently isnÕt for the ROM, it will be
; and was always ORed with hasPwrControls here anyway). Nuke a lot
; of stuff that was specifically for older ROMs, including support
; for unreleased machines like the Four Square and some Aurora
; style products. This file now has no conditionals.
; <9> 3/24/92 JSM Nuke more code names: boxAuroraCX25 is boxMacIIci, boxF19 is
; boxMacIIfx.
; <8> 10/1/91 JSM DonÕt use onMvMac conditional, Modern Victorian never existed.
; <7> 1/21/91 SWC Fixed a conditional in the IconLookup list that was causing
; undefined references (IIsi and LC) for a NuMac build.
; <6> 9/25/90 SAM Changed boxElsie/Erickson to boxMacLC/IIsi.
; <5> 6/19/90 JJ Replace Elsie Sony icons with those suggested by user interface
; group in order to improve consistency with other machines. Add
; Erickson Sony icons.
; <4> 5/30/90 JJ Reverse left and right Sony icons for Elsie.
; <3> 5/17/90 JJ Reverse left and right Sony icons for Elsie.
; <2> 5/11/90 JJ Add Sony icons for Elsie.
; <2.5> 6/10/89 GGD Added Icon info for new Aurora box flag names.
; <2.4> 5/23/89 GGD Added conditionals so that code and ICONs can be shared with IOP
; based driver. Changed interface to InitIcon so that it doesn't
; use SonyVars, and can be shared with the IOP based driver. Added
; Mac SE/30 Icon information. Re-wrote InitIcon to be more general
; and expandable, using a table to search for the correct Icon
; info. Re-named several labels to be more meaningful and to
; prevent assembly errors when assembling for universal rom.
; <2.3> 4/29/89 GGD No changes to this file, entire Sony Driver is checked out and
; in as a group.
; <2.2> 4/10/89 gmr Added official drive icons for HcMac, from HIF
; <2.1> 2/21/89 GGD No changes to this file, entire Sony Driver is checked out and
; in as a group.
; <2.0> 12/15/88 GGD Fixed ICONs for Cobra2. Fixed tables when onNuMacDCD.
; <1.1> 11/11/88 CCH Fixed Header.
; <1.0> 11/9/88 CCH Adding to EASE.
; <1.9> 9/29/88 GGD No changes to this file, entire Sony Driver is checked out and
; in as a group.
; <1.8> 9/19/88 GGD WC Made driveXLAT and DrvTblPtr conditional for everyone but
; onMac.
; <1.8> 8/19/88 SWC Made driveXLAT and DrvTblPtr conditional for everyone but onMac.
; <1.7> 8/16/88 GGD Added Icons for HcMac
; <1.7> 8/9/88 ggd Added Icons for HcMac
; <1.6> 7/15/88 GGD No changes to this file, entire Sony Driver is checked out and
; in as a group.
; <1.5> 6/15/88 GGD rwh added new Avanti icons
; <S049> 6/14/88 rwh new Avanti icons
; <1.4> 5/25/88 GGD No changes to this file, entire Sony Driver is checked out and
; in as a group.
; <1.3> 5/24/88 GGD No changes to this file, entire Sony Driver is checked out and
; in as a group.
; <1.2> 5/3/88 GGD Incorporated the real InitIcon stuff from RWH.
; <1.1> 4/18/88 GGD Merged in MFM support <C437> by Steve Christensen rwh: added
; InitIcon for new 'patcheable' disk icons <S008><S020><S024><1.1>
; <S037> 3/31/88 rwh In InitIcon, correct test on BoxFlag
; <S035> 3/29/88 rwh In InitIcon, change 'BoxType' to 'BoxFlag'
; <S034> 3/23/88 rwh Made InitIcon check BoxType global instead of reading VIA bit
; directly.
; <S032> 3/21/88 rwh fixed Stingray icon bug where internal drive would get external
; icon. Also changed all DC.L's in icon data to dc.w's to make
; rez/derez easier. Put in Avril Hodges' (Hunan Interface) new
; Stingray icons.
; <S031> 3/15/88 rwh Better small box icons (renamed to ExtStingray, IntStingray).
; Moved icons to be next to table, so offsets won't change (makes
; it easier to use patched icons, since RAM version of DrvTbl must
; have offsets from ROM DrvTbl for icons that are NOT patched).
; Moved DrvTblPlus to before DrvTbl, and made it use 'patched'
; offsets (from DrvTbl, with LSBit set). This will allow a System
; File patch to get (DisketteIcon-DrvTbl) offset on either Stratos
; or Stingray by masking the low bit of the word that DrvTblPtr
; points to.
; <S025> 2/25/88 rwh Document register usage in InitIcon
; <S020> 2/24/88 rwh Roll S008, S009, S013 into mainstream ROM sources (Sxxx is a
; Stratos overpatch change number).
; <S013> 2/15/88 rwh Fix bug in small box icons - offset must be from DrvTblPlus, not
; DrvTbl.
; <1.0> 2/12/88 BBM Adding file for the first time into EASEÉ
; <S009> 2/12/88 rwh Added DrvTblPlus w/new icons for smaller footprint box.
; <S008> 2/11/88 rwh Added initialization of DrvTblPtr to Open routine (for
; box-dependent icon support, and icon patchability)
; <C437> 1/28/88 SWC Tossed the 1600K/3200K/6400K drive info entries and made
; SuperDrive #4.
; <C907> 10/8/87 MSH Port to HcMac (Laguna)
; <C437> 9/18/87 SWC Made ExtSony conditional for Mac Plus and Mac SE only. Took
; valid drive checking out of GetDrvTbl (already done by
; DiskControl). Text clean-up.
; <C437> 11/21/86 SWC Test for and modify drive info if MFM drive. Changed MacSony to
; ExtSony for Mac+ external drive icon.
; <A414> 11/17/86 TJ Removed garbage line from Sony diskette icon
; <A351> 11/5/86 TJ Text cleanup and remove HD-20 icon
; <C216> 10/14/86 TJ Put Reno/Alladin icons in the right order
; <C123> 9/25/86 TJ Icon support code: new this revision
;
;_____________________________________________________________________
;
; There are three seperate but related status calls here.
;
; csCode= 21 Get Physical Icon Pointer (the disk drive)
; csCode= 22 Get Logical Icon pointer (the media)
; csCode= 23 Get Drive Info
;
; The icon calls return a pointer to an icon image; this
;is the icon used to represent the logical or physical device.
;Input is the drive number.
;
; The drive info call returns a 32 bit integer composed of
;various bit fields and small integers; see below for details. This
;defines the drive's physical location and other characteristics.
;
;NOTE: For DCD's, only the Get Info call is supported. (The icon
;code is there, but the icon itself is not present.)
;
; lea ParamBlk,A0
; CLR.L ioCompletion(A0) ;no completion routine,
; move.w n,ioVRefNum(A0) ;n= drive number,
; move.w #-5,ioRefNum(A0) ;Sony ref number,
; move.w #theCode,csCode(A0) ;see above
; _Control
;
; move.l CSParam(A0),n ;n= icon pointer or info bits
; ... ...
;
;
; -- DRIVE INFO --
;
; +--------------- 1=secondary/0=primary
; |+-------------- 1=fixed/0=removable
; ||+------------- 1=SCSI/0=IWM
; |||+------------ 1=external/0=internal
; ||||
; ||||
; ||||
; (not in table) ||||
; 00000000 00000000 0000bbbb 0000dddd
;
; bbbb = attribs dddd = drive type
; 0 int removable 0 NO SUCH DRIVE
; 1 ext removable 1 unspecified "drive"
; 2 int SCSI removable 2 400K Sony
; 3 ext SCSI removable 3 800K Sony
; 4 int fixed 4 SuperDrive: 800K GCR, 720K/1440K MFM
; 5 ext fixed 5 reserved
; 6 int SCSI fixed 6 reserved
; 7 ext SCSI fixed 7 HD-20
; 8 2nd int removable
; 9 2nd ext removable
; 10 2nd int SCSI removable
; 11 2nd ext SCSI removable
; 12 2nd int fixed
; 13 2nd ext fixed
; 14 2nd int SCSI fixed
; 15 2nd ext SCSI fixed
;
;Primary/secondary means upper vs. lower or left vs. right drives; this
;is mainly for Genesis/Alladin/Ikki. And who knows what else later.
;
; IMPORTANT! The offsets to the icons MUST be even. In order to be able to
; 'patch' icons in RAM, the DrvTblPtr (added to SonyVars) points to the
; 'DrvTbl' of choice (possibly in RAM). Since the table has offsets to the
; icons, and we don't want to have to duplicate correct icons in our RAM
; table, we use the least significant bit set to signal that the offset is from
; the DrvTbl in ROM. If the bit is clear, the offset if from the table pointed
; to by DrvTblPtr.
;
; ALSO IMPORTANT! The table for the Mac Plus must come first, since it doesn't
; have the DrvTblPtr variable, and assumes that offsets are relative to DrvTbl.
TITLE 'File: SonyIcon.a'
;___________________________________________________________________
;
; Routine: ctlLogIcon, ctlPhysIcon, ctlDrvInfo
;
; Inputs: A0.L -- pointer to parameter block
; A1.L -- pointer to SonyVars
; D1.W -- offset to drive's local variables
; drive(A1) -- desired logical drive number
; CCR -- BNE if bad drive number of drive not installed (from DiskControl)
;
; Outputs: D0.W -- <>0: bad drive number or drive not installed
; =0: successful
;
; Function: Returns a pointer to an icon or the drive characteristic
; bits in CSParam(A0).
;
;___________________________________________________________________
; Return a pointer to the logical icon.
ctlLogIcon BNE.S ctlRet ;-> bad/no drive <C437/18sep87>
bsr.s getDrvTbl ;get table ptr for this drive
move.l (A3),D0 ;D0= icon ptr offset <SM12>
move.l DrvTblPtr(a1),a3 ;A3= base of current 'DrvTbl' <S009>
; (possibly in RAM!!) <S009>
bclr #0,d0 ;test & clear 'use ROM table' bit <S009>
beq.s @1 ;branch if should use current table <S009>
move.l UnivInfoPtr,a3 ; <SM12>
adda.l ProductInfo.IconInfoPtr(a3),a3 ; point to icon info table <SM12>
@1 add.l A3,D0 ;D0= icon address
bra.s ctlParam ;return it
; Return a pointer to the physical icon.
ctlPhysIcon BNE.S ctlRet ;-> bad/no drive <C437/18sep87>
BSR.W GetDockingIcon ; get the icon from the docking bar's config ROM (if any) <SM2>
BNE.S CtlParam ; -> got it, so just exit <SM2>
bsr.s getDrvTbl ;get table ptr for this drive
move.l 4(A3),D0 ;D0= icon ptr offset <SM12>
move.l DrvTblPtr(a1),a3 ;A3= base of current 'DrvTbl' <S009>
; (possibly in RAM!!) <S009>
bclr #0,d0 ;test & clear 'use ROM table' bit <S009>
beq.s @1 ;branch if should use current table <S009>
move.l UnivInfoPtr,a3 ; <SM12>
adda.l ProductInfo.IconInfoPtr(a3),a3 ; point to icon info table <SM12>
@1 add.l A3,D0 ;D0= icon address
bra.s ctlParam ;return it
; Return drive characteristics. For Sony type drives, we have to check
; what is actually installed. The drive type is conveniently in D0.B.
ctlDrvInfo BNE.S ctlRet ;-> bad/no drive <C437/18sep87>
bsr.s getDrvTbl ;get table pointer,
move.w 8(A3),D0 ;D0.L= drive characteristics <SM12>
; Since someone might have put old 400K drives on (old interface), we have
; to see what was found at install time, since the table assumes 800K drives.
TST.B mfmDrive(A1,D1) ;Is this a SuperDrive? <C437/21nov86>
BPL.S CtlParam ;-> no <C437/21nov86>
MOVE.B #4,D0 ;Yes, mark it as such <C437/28jan88>
; Put D0 into CSParam for return to the caller, and put noErr into
; D0 to indicate success.
CtlParam move.l D0,CSParam(A0) ;set CSParam
moveq #noErr,D0 ;nice return code
ctlRet bra DiskDone
;------------------------------------------------------------------------
; Return A3 pointing to the table entry for the correct logical drive.
; This accepts logical drive number and returns the table entry for
; the actual physical drive it supports.
;
; The address of this drive's items is:
; (drive# * 10) + DrvTbl address <SM12>
;
getDrvTbl move.w Drive(A1),D0 ;D0= logical drive number,
subq #1,D0 ;make drive 0 - N,
add.w D0,D0 ;d0 * 2 <C437/21nov86>
move.w D0,A3 ;table entry length,
lsl.w #2,d0 ;d0 * 8 <SM12>
add.w A3,D0 ;d0*(2+8) = d0*10
move.l DrvTblPtr(a1),A3 ;A3= table base <S009>
adda.w D0,A3 ;A3= Icon Table entry ptr
rts
GetDockingIcon ; <H19><SM2> begin
MOVEM.L D1/A0-A1,-(SP)
MOVE.W #$A89F,D0 ; does the _DockingDispatch trap exist?
_GetTrapAddress ,NEWTOOL
MOVE.L A0,-(SP)
MOVE.W @DockTrap,D0
_GetTrapAddress ,NEWTOOL
CMPA.L (SP)+,A0
BEQ.S @Done ; -> no, use the built-in icon
MOVE.W drive(A1),D0 ; get the logical drive number
CLR.L -(SP) ; result
MOVE.L #dockFloppyDriveIcon,-(SP) ; selector = return floppy disk icon
MOVE.L D0,-(SP) ; params = drive number
@DockTrap _DockingDispatch ; call the docking handler to get the icon (if any)
MOVE.L (SP)+,D0 ; return it in D0 (also sets CCR)
@Done MOVEM.L (SP)+,D1/A0-A1
RTS ; <SM2> end