boot3/Patches/PatchSEROM.a

5397 lines
212 KiB
Plaintext
Raw Permalink Normal View History

;
; File: PatchSEROM.a
;
; Contains: patches for the first ROMs shipped in a Macintosh SE ($0276)
;
; Copyright: <09> 1985-1992 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <60> 1/19/92 DTY Look at emAppleTalkInactiveOnBoot before getting the AppleTalk
; version. If AppleTalk is inactive, don<6F>t set up the serial port
; for use by AppleTalk. This is part of a large conspiracy to
; convince the universe that AppleTalk really isn<73>t around if it
; is inactive.
; <59> 8/30/91 DTY Define onMacPP & has3rdFloppy in this file now that they<65>re no
; longer available features in BBSStartup. onMacPP is 1 because
; this patch files applies to the SE ROM. has3rdFloppy is true
; because this file used to use {DefsPP}. If this file is ever
; used in a ROM build (which it probably won<6F>t), has3rdFloppy is
; false because our new ROMs don<6F>t do that kind of thing any more.
; <58> 6/12/91 LN removed #include 'HardwareEqu.a'
; <57> 3/17/91 eh Serial driver status calls 9 and $8000 now return hardcoded
; driver version instead of getting it from DCE. This obviates the
; need for the linked patch to _Open to patch the version number
; in the DCE, a fix which was causing FileShare to crash.
; <56> 3/4/91 dba dty: get rid of SysVers conditionals
; <55> 2/21/91 eh (djw) Fixed bug in serial driver that was preventing use of one
; port when Nike was printing on the other.
; <54> 1/30/91 dnf csd/dba, #dnf003: For 7.0, remove the patch that ensured that
; BTCBs for the catalog and extents files were deallocated on
; _Eject and _Offline. We no longer close the b*tree control
; files on _Eject and _Offline, so we no longer need to
; deallocate their BTCBs.
; <53> 1/19/91 mbs (jg) Include new ATalkPrivateEQU.a to get AGBHandle equates
; since they were removed from ATalkEQU.a
; <52> 1/19/91 eh (djw) Patch portA async serial driver headers to insert
; signature long word for use in serial driver linked patch.
; Insert signature before already patched port B driver headers.
; Change port arbitration code to call new 'atkv' Gestalt call
; instead of old 'atlk' call.
; <51> 1/14/91 eh (djw) Added external clocking support for Nike Printer to the
; Async Serial Driver.
; <50> 12/15/90 djw (jwk) Add SCSI Mgr support for Quantum 7.9 ROM problem by adding
; a separate TIB interpreter and replacing blind write
; <49> 12/14/90 dnf (jsm) Turn all patches on the ExtFSHook off for 7.0. They are
; now linked patches in LaterFileMgrPatches.a
; <48> 12/13/90 BBM (stb) move the patch to compactmem into memorymgrpatches.a.
; <47> 11/26/90 JSM <bbm> Delete come-from patch on _StackSpace inside RgnOp since
; it never worked (see QuickDrawPatches.a for details), move
; come-from patches on _DisposeHandle inside CloseDialog and
; _ValidRect inside SetIText to DialogMgrPatches.a.
; <46> 11/20/90 JSM <dba> Move come-from patch on _GetResource inside GetNextEvent
; to disable FKEYs from the keypad to ToolboxEventMgrPatches.a,
; which means the entire _GetResource patch here is unneeded for
; 7.0.
; <45> 11/14/90 JSM <bbm> Move come-from patch on _TEAutoView to fix dialog manager
; bug to DialogManagerPatches.a.
; <44> 11/9/90 dba & gbm; Move LoadResource patch that checks for errors while
; loading WDEFs and CDEFs to WindowMgrPatches.a and
; ControlMgrPatches.a <20> one more step towards the obsolescence of
; this file
; <43> 9/25/90 KIP Change Sound Mgr. to a linked patch.
; <42> 9/22/90 dba get rid of Time Mgr. patching here since we now use the real
; TimeMgr.a to make a linked patch; get rid of obsolete ADB
; patches
; <41> 9/21/90 KON Make stdBits patch a linked patch and moved it to
; AllB&WPatches.a
; <40> 8/18/90 dba get rid of ptchInst 7 and 8 (Sony Format and Eject patches) as
; they are now linked patches
; <39> 8/14/90 DTY Removed PtchInst 0 since TextEdit is now a linked patch.
; <38> 8/8/90 SAM Changing DispatchHelper & ProcHelper into an old style ptch.
; <09><><EFBFBD>--> Temporary <--<2D><><EFBFBD> Remove when the Sound ptch get converted
; into an Lptch.
; <37> 8/7/90 DTY ADBMgrPatch (ptch 34) is a linked patch now.
; <36> 7/30/90 dnf Remove installation of ptch 18 (File Manager) and ptch 6 (Btree
; Manager), now linked patches
; <35> 7/23/90 dba get rid of ptch 1 since Menu Mgr. is now a linked patch
; <34> 7/23/90 dba get rid of ptch 25 for 7.0; it is covered by DialogMgrPatches;
; get rid of extraneous pre-6.0.6 SysVers conditionals; removed
; ptchInst 16 since PrGlue is a linked patch
; <33> 7/20/90 DTY Remove ptchInst 10 & 11 since Bass is a linked patch now.
; <32> 7/20/90 CCH NEEDED FOR SIXPACK: Removed HwPriv patch since it is now a
; linked patch.
; <31> 7/20/90 GMR Install ptch 7 on SuperDrive ROMS as well now.
; <30> 7/16/90 gbm Kill a few warnings
; <29> 7/16/90 DDG NEEDED FOR SIXPACK: I disabled the patch I made to fix the
; button CDEF, since it causes much more problems than it fixes.
; At some point (when I have more time) I may come back and fix
; this patch for real.
; <28> 7/2/90 DTY Removed ptchInst 21 since Resource Manager extensions are now a
; linked patch.
; <27> 6/29/90 DDG NEEDED FOR SIXPACK: Added patches to SectRgn and DrawText in
; order to fix a bug in the button CDEF.
; <26> 6/26/90 DTY Removed ptchInst 2 since Notification Manager is now a linked
; patch.
; <25> 6/25/90 DTY Removed ptchInst 9 since ScrollSpeedFix now in a linked patch.
; <24> 6/19/90 VL Get rid of ptchinst 29 since MiscPatches is a linked patch.
; <23> 6/12/90 JSM Remove PtchInst 33 since PPC Toolbox is a linked patch now.
; <22> 6/11/90 EMT Moved alternate trap dispatcher loading to boot blocks.
; <21> 6/7/90 EMT Remove PtchInst 17 since Layer Manager is a linked patch now.
; <20> 6/7/90 VL Help Mgr is now a linked patch. Get rid of ptch 28.
; <19> 5/29/90 DDG NEEDED FOR SIXPACK: Changed all the sixpack conditionals from
; six-point-oh-seven to six-point-oh-six.
; <18> 5/10/90 JSM AliasMgr now a linked patch, don't install it here anymore.
; <17> 5/2/90 BBM add makesysfree for 6.0 systems
; <16> 4/16/90 SMB Changed 'ptch' 27 conditionals to include it for 6.0.6 builds.
; <15> 4/16/90 csd moved ptch 29 (misc including Shutdown Manager) before ptch 33
; (PPC) because the PPC loader calls ShutdownInstall.
; <14> 4/16/90 DDG Rolled over some bug fixes from the system 6 split off sources
; back into the main ones: we now install patch 25 (generic
; patches for all systems) and we added a hwPriv patch. Helpers:
; BBM, djw
; <13> 4/11/90 dba get rid of patch to InitApplZone for 7.0; move PPC after B-Tree
; Manager
; <12> 4/4/90 KON get rid of ptch 44 and ptch 35 since they are now linked ptches.
; <11> 3/29/90 KON Added ptch 44, a QD patch for all B&W machines.
; <10> 3/23/90 NC Added ptch 43 for System 6.0.6 on up. This is for Sound.
; <9> 3/20/90 PWD Changed install of ATP SendRequest patch to check to see if
; AGBHandle is already allocated.
; <8> 3/7/90 dba change MyDisposHandle to use BackToTrap
; <7> 2/5/90 DDG Fix SysBeep by including it in the sound manager patch instead
; of the individual patches for each ROM. (Neil [NC] actually did
; the fix)
; <6> 2/4/90 dba get rid of SysBeepPatch because it is in the Sound Mgr. patch
; <5> 1/31/90 SMB NEEDED FOR Scripts604 and 6.0.5 - Fixed Dialog Mgr bug that
; didn't get rolled into rom. Have to do a come-from patch in
; TEAutoView to fix a rect for R-to-L text.
; <4> 1/22/90 PKE Used new InstallGestaltEarly symbol to control whether Gestalt's
; ptch 5 installation is done earlier (needed for TextEdit 3.0),
; and made it happen for SysVers>=$605 instead of SysVers>=$700.
; (This is already in the System6Proj sources).
; <3> 1/12/90 CCH Added include of <20>HardwarePrivateEqu.a<>.
; <2> 1/4/90 dba conditionalized out WaitNextEvent for 7.0 since we always have
; MultiFinder; install BadTrap patch for DebugStr as well as
; Debugger for 7.0, since we have a large trap table; get rid of
; Launch patch for Radius for 7.0 because Ed Tecot sez, and
; because it just makes some Radius features go away, it doesn<73>t
; crash (we told Radius this would happen); got rid of pre-HMenus
; Menu Mgr. patches and got rid of the HMenus conditional; got rid
; of the patch and setup that was used to do the override of the
; MBDF for switch-launching since 7.0 does not switch launch
; (MultiFinder-only); renamed some symbols and got rid of some
; extraneous equates to avoid warnings
; <1> 12/17/89 CCH Adding for the first time into BBS.
; <6.0> 12/11/89 GMR Added ptchInst 8; Sony Format patch is now in it's own patch
; file (FormatPatch.a).
; <5.9> 11/29/89 GGD NEEDED FOR 6.0.5 Enabled the Extended Time Manager (which
; matches the code that is in the IIci/Portable ROMs) Enabled the
; New ADB Manager (which matches the code that is in the IIci ROM)
; Initialized the new LowMem TimeViaDB which was introduced with
; the IIci ROM
; <5.8> 11/21/89 EMT NEEDED FOR 6.0.5: Added humane scrolling.
; <5.7> 11/10/89 rwh NICE FOR 6.0.5: for ptch38, remove check for hwPriv already
; <5.6> 10/25/89 rwh NICE FOR 6.0.5: add ptch38, backpatch hwPriv for accelerated
; SE's.
; <5.5> 10/16/89 csd Moved the code that installs the expanded trap dispatcher to the
; start of the install section, above all other patches.
; <5.4> 10/15/89 BAL Added support for 32-Bit QuickDraw pictures via ptch 35
; <5.3> 10/14/89 GMR Re-added ptch34 - ADB manager patch, for system 7.0
; <5.2> 10/10/89 GMR Backed out ptch 34, until it can be cleaned up
; <5.1> 10/6/89 JSM Removed SnarfMan 'ptch', now PACK 13.
; <5.0> 10/3/89 GMR Added ptch 34, Gary D's new ADB manager, for 7.0.
; <4.9> 9/26/89 CVC Added the PPC Toolbox as a 'ptch'.
; <4.8> 9/4/89 PKE Install Script Manager 7.0 extensions, ptch 27.
; <4.7> 8/28/89 SES Removed references to nFiles.
; <4.6> 8/22/89 PKE NEEDED FOR 6.0.4 (SCRIPTS BUILD) & 7.0: Conditionalize 4.5 for
; Scripts604 OR (SysVers >= $700)
; <4.5> 8/19/89 PKE NEEDED FOR 6.0.4 (SCRIPTS BUILD) & 7.0: Moved PtchInst 5
; (Gestalt) ahead of (most) other PtchInsts so they can use
; Gestalt.
; <4.4> 8/9/89 GMR Added ptch 29 - BigBang only patches for all ROMs
; <4.3> 8/1/89 BG Modified the conditional in <4.1> to be (SysVers >= $700) to
; make sure that this patch never appears in a 6.0.x build.
; <4.2> 7/25/89 GMR Needed for 6.0.4: Added Sony Eject patch (ptch 7)
; <4.1> 7/7/89 BG Added Gary D.'s optimized A-Trap dispatcher (which adds an
; extended Toolbox trap table) to the Mac SE.
; <4.0> 6/30/89 BBM Added resource mgr extensions ('ptch' 21)
; <3.9> 6/29/89 RLC Added HelpMgr PtchInst #28
; <3.8> 6/21/89 NJC Added a ptchinst 3 to if it wasn't already there and added in a
; commented-out ptchinst 23 for the sound dispatcher,DJ, and S.M.
; enhancements.
; <3.7> 6/13/89 dnf Moved btree ptch install after hfs70 ptch install.
; <<3C>3.6> 6/10/89 CEL Moved Private.a QuickDraw Equates into proper QuickDraw private
; file (colorequ.a), got rid of QuickDraw nFiles dependencies and
; fixed up necessary files<65>
; <3.5> 5/31/89 CEL Only defined Spline_Font variable if it is undefined - makes it
; easier to build test 6.0.4 systems
; <3.4> 5/31/89 prp Added Alias Manager Support
; <3.3> 5/30/89 dnf Added HFS 7.0 Enhancements (ptch 18)
; <3.2> 5/26/89 CCH Conditionalized out install of 6.0.4 PrGlue.
; <3.1> 5/25/89 CCH Re-added PrGlue patch taken out in v2.4 for 6.0.4.
; <3.0> 5/23/89 EVA SysVers conditional is $700 for deferred task patch
; <2.9> 5/23/89 jaz Change version conditionals to check for $700 instead of $604
; <2.8> 5/19/89 jaz Add code to patch in Gary D's new Extended Time Manager
; <2.7> 5/18/89 ggd (Really EH) Add Deferred Task Manager and patched Level 1 thru 3
; interrupt handlers.
; <2.6> 5/16/89 EMT Moved include of ToolTrapFix so that it would be executed at
; installation time.
; <2.5> 5/13/89 EMT Added Window Manager extensions (Layers).
; <2.4> 5/8/89 NMB Replaced PrGlue with Ginsu's PrGlue.
; <2.3> 5/3/89 CEL Rolling in Bass for the first time into EASE<53>
; <2.2> 4/18/89 JSM Install SnarfMan 'ptch'.
; <2.1> 4/17/89 CCH Rolled out Altair changes.
; <2.0> 3/22/89 CCH Now looks for DiskCachePriv.a in {AIncludes}.
; <1.9> 3/21/89 KST Added install code to bring in Btree Manager.
; <1.8> 3/17/89 CCH Fixed install of Cache Control Trap so that it installs on
; 6.0.4.
; <1.7> 2/22/89 CCH Added install code to bring in Gestalt patch.
; <1.6> 2/21/89 JB (DNF, actually) These files seems to work, so I'm checking them
; back in.
; <1.5> 2/20/89 JB Cleaned up revision history comments.
; <1.4> 2/20/89 JB Moved MapFBlock and "not a Mac disk" ExtFSHook patches from
; BeforePatches.a
; <<3C>1.3> 2/20/89 JB Moved cache control trap from BeforePatches.a
; <1.2> 1/31/89 CCH Merged changes from 6.0.3.
; <1.1> 1/16/89 CCH Merged 6.0.3 final sources into 7.0.
; <1.0> 11/16/88 CCH Added to EASE.
; PMAB581> 10/16/88 GGD Installed latest version of TimeMgr, which also includes work
; around for bug with Rockwell VIAs (6.0.3 and Altair) Replaces
; PMAB564
; PMAB574> 9/25/88 jwk Rolled enhancements to old SCSI Mgr to support new SCSI Mgr
; trap.
; <PMA572> 9/22/88 jwk Added Deferred Task Mgr to the Plus and SE.
; PMAB564> 8/18/88 ggd Patched in the New Improved Time Manager for all CPUs,
; Completely replaces old Time Manager, and replaces patches on
; MacPlus and MacSE.
; <PA511> 6/24/88 JB Added patch to fix UpdAltMDB to use correct disk address on
; 1440k disks
; <S497> 6/7/88 med Changed Script Manager to ptch resource
; <PA489> 5/4/88 EMT Addition to PA419 - Remove Radius SetTrapAddress patch.
; <s481> 4/27/88 bbm There was a small window after the vremove where a timer
; interrupt could happen. Since the sound driver services the
; timer in the vbl task, the code to reinstall the vbl task would
; never happen.
; PMAB466> 4/13/88 JWK Fixed SCSIGet to perform cleaner arbitration.
; PMAB457> 4/7/88 RWW Fixed CloseDialog to properly dispose TERecord
; PMAB449> 3/30/88 rwh replace SysEnvirons code w/INCLUDE SysEnvirons.a (Version 2!)
; PMAB442> 3/25/88 EKH Fixed 'PatchInstall' fail bug. (Wasn't calling SysErr
; correctly).
; <PA419> 3/4/88 EMT Radius FPD SE disables PMA314 - patch PA176 to reassert.
; <PMA418> 3/4/88 EMT Fix bug in PMA314 which left ROMMapInsert set.
; PMAB407> 2/26/88 DAF Removed PMAB370 (UprStr). I didn't know that you could use
; UprStr to just strip diacriticals. My post processing was
; causing AppleShare to get grave accents accidentally when
; stripping names. This can still be fixed, it just requires a
; deeper fix rather than post processing.
; PMAB401> 2/23/88 djw Bug in async driver - killIO did not set reg D0 to good return
; status. Combine with patch PMAB372
; <PMA399> 2/21/88 DAF Fixed StdBits to use (corrected) PackBits (for Scanner app).
; PMAB372> 1/26/88 djw Fixed DTR bug in async serial driver - a jump to the wrong label
; PMAB370> 1/25/88 DAF UprStr had an "a" instead of a "`" in it's case table, so I
; added a post-call scan of the string to fix this.
; <PMA361> 1/18/88 AWC Add fast polygon stuff to PatchPlusROM.a, PatchSEROM.a
; PMAB354> 1/7/88 EMT Unimplemented Toolbox versions of 12 bisexual traps
; PMAB344> 12/22/87 JSP Modified to not install sony driver patches if version number of
; driver is greater than one.
; PMAB340> 12/17/87 EMT Miscellaneous fixes to NMgr + System Alarm uses NMgr.
; PMAB335> 12/15/87 EMT ptchInstall now calls SysError on failure
; PMAB329> 12/10/87 JWK Fixed PMAB295 to avoid 10 sec delay when booting with no SCSI
; devices attached.
; <PMA325> 12/8/87 jw new SysBeep, calls SndPlay like on Mac II
; PMAB318> 11/30/87 jw Added new improved sound manager.
; PMAB317> 11/28/87 EMT Added Notification Manager.
; PMAB315> 11/25/87 RWW Err, GetResource doesn't return resNotFound? Fixed ptchInstall
; <PMA314> 11/25/87 EMT Patch GetResource to get MBDF instead of ROM override on Plus,
; SE
; PMAB308> 11/24/87 RWW Added ptchInstall, which installs 'ptch' resources. This saves
; keeping duplicate copies of identical code in several patch
; files.
; <PMA311> 11/24/87 EMT Install Menu Manager using 'ptchInstall' method. Undoes PMA097.
; PMAB309> 11/24/87 RWW Massive, world-shattering change - yank TE patches and do this
; whizzy new installation. This one patch, in one fell swoop,
; replaces the following old, sometimes ugly patches: P001, P002,
; P003, P004, P013, P016, P017, P018, P024, P025, P026, PO31,
; P032, P033, P034, P035, P036, P037, P038, P039, P040, P041,
; PA064, PA065, PA066, PA070, PA085, PABM139, PABM197, PABM198,
; PA199, PA200, PABM201, PABM202, PABM203, PABM250
; PMAB305> 11/22/87 DAF Fixed RgnOp buffer calculation bug.
; PMAB301> 11/15/87 ABO Fix ATP delayed duplicate response bug
; <PMA299> 10/27/87 NMB Fixed DrText using _StdTxMeas so that QuickDraw could cope with
; fonts >128Kb.
; <PM298> 10/27/87 NMB Replaced FMSwapFont since the Font Manager couldn't cope with
; fonts >128Kb. That has been fixed.
; PMAB295> 10/20/87 SHF Modified last call to SCSILoad -- increased patched select
; timeout to 25 msec (was 5); made more robust for CD ROM.
; <PAB291> 9/26/87 DBG Changed mouse button debounce time back to 20 msec, and changed
; code so that mouse downs always get noticed. The code will now
; never discard a down/up pair, only up/down pairs.
; <PAB288> 9/24/87 CSL Reduced the mouse button delayed time from 20 msec. to 10 msec.
; PMAB284> 9/21/87 JTC Fix patch to MoveHHi to prevent dinky free blocks from being
; created. Patch involves just adding to the part of the loop
; already patched.
; <pma287> 9/18/87 bbm sound manager uses sound manager uses soundactive different than
; sound driver. Thus soundactive could be true with no sound vbl
; task installed. So now we check for an error from vremove, which
; we should have done in the first place. (This is the same patch
; as S278, which got deleted when PMAB284 was checked in.)
; PMAB270> 9/13/87 FJL Fix DrawPicture patch (in DrawPicturePatch.a) to first check for
; valid picture handle and pointer, then do GetState, lock, and
; SetState on return. At the request of Sheila, Phil and Scott.
; <PA267> 9/8/87 CRC Fixed silly bug in GetMaskTab (FMSwapFont) patch.
; <s263> 9/7/87 bbm The current sound driver uses low memory as a vbl queue element.
; A bug occurs if sound is active. The low memory queue element is
; zeroed regardless if there is a next element in the queue or
; not. Thus the machine may hang. The fix forces the sound vbl
; queue element to be last in the queue always.
; PMAB253> 8/27/87 CRC Fixed MaxSizeRsrc in FontMgr for Radius (once again)
; PABM250> 8/25/87 MBK TextEdit: Patched DisposPtr and StackSpace to fix Pixel2Char
; dispose bug
; PMAB241> 8/25/87 RDC Added patch for BadTrap handler routine to save registers before
; exiting to SysError routine - needed for new MacsBug.
; <PAB229> 7/23/87 WRL MouseDrvr MouseDrvr New, improved mouse button debouncing code
; for ADB machines.
; <PMA218> 7/22/87 JTC InitApplZone InitApplZone Patch InitApplZone to base
; ApplLimit/HiHeapMark on SP not BufPtr. This helps at start time
; when the stack world is in the middle of RAM and some hoggish
; apps want to do a MaxApplZone on the miniheap.
; PMAB226> 7/21/87 GWN Backout PMAB216.
; PMAB216> 7/21/87 GWN Patch Read, Write, Control and Status to fix Async problem.
; <PMA211> 7/20/87 SHF SCSIRead,SCSIWrite,SCSIRBlind,SCSIWBlind SCSIMgr.a SCSI Mgr:
; fixed scLoop bug in TIB interpreter.
; PMAB210> 7/20/87 DAF LoadResource CallWindow,CallControl Improved handling of CDEFs
; and WDEFs for Juggler
; <PMA207> 7/17/87 EHB PackBits PackBits Patched packBits to allow scanlines > 127
; bytes
; <PA199> 7/9/87 MBK GetFontInfo TESetStyle TextEdit: Fix to SE patch that set point
; size of 0 to 1 (should leave it)
; PABM203> 7/9/87 MBK FindLine RecalLines TextEdit: Fix to deletion bug (display would
; get messed up)
; PABM202> 7/9/87 MBK FindLine RecalLines TextEdit: Fix to recalibration bomb when
; text length = 32,767
; PABM201> 7/9/87 MBK FindLine SetLineHite TextEdit: Fix to allow fixed line heights
; to work
; <PA200> 7/9/87 MBK TextWidth Char2Pixel TextEdit: Fix to check if style record
; before accessing style handle
; PABM197> 7/9/87 MBK HLock TEStylInsert TextEdit: Fix to TEStylInsert call when
; record is deactivated
; PABM198> 7/9/87 MBK HLock,HUnlock,TEDispose,TESetSelect,TEClick,TEDispatch,TEKey
; TextEdit: Fix to allow styles to be set at null selection
; <PAB191> 7/2/87 CSL ADBReInit Kbd.a Added pre- and post- processing routine hook for
; ADBReinit.
; <PAB192> 7/2/87 EMT ADBProc KbdDrvr Use JADBProc to clean up on ADBReInit
; PABM186> 7/1/87 CRC GetResource RealFont Took out PA165 and replaced GetHandleSize
; with MaxSizeRsrc. also added part of underline fractEnable bug
; fix below.
; PABM187> 7/1/87 CRC GetMaskTable FMSwapFont two bugs: if fractEnable is false, do
; not use style widths w/o strike underline measures wrong with
; fractEnable true: pesky BEQ should have been a BMI
; <PAB185> 6/29/87 ABO Fix NBP write-to-zero on lookup bug.
; <PA182> 5/21/87 CSL DiskSelect DiskSelect Fixed the performance problem of the upper
; internal floppy drive.
; <s483> 4/27/87 bbm changed a hardwired number to HiIntMask (see s481).
; <PA176> 4/13/87 JTC Launch Launch Add diagnostic vector for last-chance patching
; before Finder launch.
; PABM139> 3/26/87 MBK FindLine TextEdit.a: RecalLines Fixed recal deletion bug.
; <PAB117> 3/19/87 CRC LoadResource FMSwapFont if fast path fails because of disk
; switch, recover with panache.
; PBAM109> 3/17/87 CRC ValidRect GetIText patched ValidRect to restore register
; clobbered by DrawItem in SetIText
; <PMA100> 3/10/87 DAF FindWindow wmgr InitWindows wmgr Patched InitWindows and
; FindWindow to use mbdf (PMA097)
; PMAB102> 3/10/87 EMT GetResource GetNextEvent Fixed all patches to not use FKEYs when
; code came from keypad.
; <PMA097> 3/10/87 FJL Back-patch hierarchical menus.
; <PA088> 3/9/87 JTC CompactMem mem mgr: MoveHHi Stop creating bogus tiny blocks.
; <PAB87> 3/6/87 CSL Patch JcrsrTask to support absolute cursor position.
; <PA085> 3/5/87 MBK HUnlock TextEdit.a:InsertRecal fixed obscure recal bug
; <PA077> 3/3/87 CRC FreeMem font manager changed to MaxBlock (better call)
; <PA077> 3/3/87 CRC FixMul font manager fix rounding bug in scaling
; <PA077> 3/3/87 CRC FixRound font manager allow font sizes greater than 127
; <PA077> 3/3/87 CRC GetResource font manager look for empty FONDs, too small fonts,
; etc.
; <PA081> 3/3/87 SHF SCSICmd SCSIMgr.a:SCSICmd fix too short a timeout waiting for
; cmd phase
; <P023> 1/13/87 JNP Print trap ($A8FD) patch. A bug was fixed after the Maui ROMs
; were frozen. Hence this patch. The bugfix was as follows: If the
; GetResource call to get a PDEF fails, don't give up. The printer
; resfile may not be in the resource search path. Save and restore
; the user resource map around the GetResource (for PDEF) call.
; Get the printer resfile refnum from the low memory print var
; ($944+$E) or open the printer resource file to get it. After
; opening the printer resource file, save the refnum in low
; memory. The code to get the printer resfile refnum is now in a
; procedure called OpenRF. Check the print error after _PrDrvrOpen
; call in PrintOpen. Added includes for PrEqu.a and PrPrivate.a
; <P015> 12/12/86 EMT GetOSEvent OSEventMgr.a:GetOSEvent OSEventAvail
; OSEventMgr.a:OSEventAvail KbdDrvr kbd.a:KbdDrvr Keyboard global
; shuffle for Excel
; <P014> 12/10/86 TJ WakeUp SonyQDUtil.a Recursion path via PrimeTime PrimeTime
; TimeMgr.a inconsistencies at some boundary conditions
; <C480> 12/1/86 Fixed FOutExtra set up for Laserwriter fonts in cache
;
IF (&TYPE('SPLINE_FONT') = 'UNDEFINED') THEN
SPLINE_FONT: EQU hasSplineFonts
ENDIF
IF (&TYPE('USE_MAKESYSFREE') = 'UNDEFINED') THEN
USE_MAKESYSFREE: EQU 1 ; need to expand the system heap for 6.0 systems
ENDIF
IF (&TYPE('Scripts604') = 'UNDEFINED') THEN
Scripts604: EQU 0
ENDIF
if (&type('onMacPP') = 'UNDEFINED') then
onMacPP: equ 1
endif
;
; has3rdFloppy was defined for {DefsPP}. Make it so for System builds.
;
if (&type('has3rdFloppy') = 'UNDEFINED') then
if forROM then
has3rdFloppy: equ 0
else
has3rdFloppy: equ 1
endif
endif
STRING ASIS
LOAD 'StandardEqu.d'
include 'ATalkEqu.a' ; <PABM150>
include 'ATalkPrivateEqu.a' ; <53>
include 'ApplDeskBus.a'
include 'AppleDeskBusPriv.a'
include 'HardwarePrivateEqu.a'
include 'PrEqu.a'
include 'PrPrivate.a'
include 'ColorEqu.a'
include 'SCSIEqu.a'
include 'SonyEqu.a'
include 'PrintCallsEqu.a'
include 'DiskCachePriv.a' ; P003 <21Feb89><2.0>
INCLUDE 'PatchMacros.a'
INCLUDE 'ScriptPriv.a' ; <16>
INCLUDE 'GestaltEqu.a'
SONYVERLOC EQU $434709 ; location for checking sony version number
ROM76Fix MAIN EXPORT
IMPORT RamSysInit
EXPORT SysBase,CutBack
; Cut back Code:
;
; SysBase is the entry point for ROM76Fix. Upon entry D1.L contains our handle.
;
; Once the patches have been installed, this code is cut back to exclude the patch
; installation code.
SysBase
BRA RamSysInit ; do the patch installation.
DC.L ('PTCH') ; resource type
DC.W $0276 ; patch ID $76 machine $02.
DC.W 0 ; current version number.
; cut back the ram-based system code to exclude this initialization code
CutBack
_SetHandleSize ; adjust our size
MOVEQ #$7F,D0 ; a soon to be large number
SWAP D0
_CompactMem ,SYS ; optional comma
RTS ; all done
;################################ PATCH CODE GOES HERE #######################################
;___________________________________________________________________________
;
; P014 TJ 09dec86 TJ WakeUp SonyQDUtil.a
; Raised int level to prevent recursion through PrimeTime.
;
; A patch to the Sony Driver's wakeup routine to prevent driver re-entry.
; Symptoms are that the file server crashes or hangs randomly when accessing
; the HD-20, every few weeks.
;
; Derived from ROM75FIX patch #52.
;
;___________________________________________________________________________
SonyWakeUp PROC EXPORT
;
;Special addresses:
;
ROMWakeup EQU $4351a0 ; ROM wakeup entry point
or.w #$0300,sr ; lock out VIA interrupts,
jmp ROMWakeup ; And enter normal wakeup routine
ENDPROC
;___________________________________________________________________________
; P015 12Dec86 EMT GetOSEvent OSEventMgr.a:GetOSEvent
; OSEventAvail OSEventMgr.a:OSEventAvail
; KbdDrvr kbd.a:KbdDrvr
;
; Fix File Date Patch# Fix Routine(s) Routine(s) Fixed
;AppleSystemPatch PatchSEROM.a 12Dec86 #P015 (GetOSEvent) (GetOSEvent)
;
; Fix File Date Patch# Fix Routine(s) Routine(s) Fixed
;AppleSystemPatch PatchSEROM.a 12Dec86 #P015 (OSEventAvail) (OSEventAvail)
;
; Fix File Date Patch# Fix Routine(s) Routine(s) Fixed
;AppleSystemPatch PatchSEROM.a 12Dec86 #P015 (KbdDrvr) (KbdDrvr)
;
; This patch is to shuffle around some globals used for autokey events.
;
; Microsoft Excel expects KeyLast to be 0 if no auto key events are pending.
; When ADB was introduced, it became necessary to use the entire event message,
; not just the low word. KeyLast was thus too small to contain the repeat
; event message. KeyLast was relocated to KbdVars and given the name NewKeyLast.
; KeyLast became KbdLast and held the ADB address of the last keyboard typed on.
; This caused Excel to thrash when calculating. Thus, KeyLast has been restored
; to its original meaning; NewKeyLast becomes HiKeyLast and contains the high
; word of the repeating event message. KbdLast is relocated to KbdVars+2
; (HiKeyLast+2). All these changes have been reflected in nSysEqu.a.
;_______________________________________________________________________
GetOSEvent PROC EXPORT
EXPORT OSEventAvail,KbdDrvr
PostEvent EQU $403EE6
OsEventTail EQU $403FEA ; Address of rest of GetOSEvent
PEA OsEventTail
;_______________________________________________________________________
;
; Routine: OSEventavail
;
; Arguments: A0 (input) -- pointer to user event record (32-bit)
; D0 (input) -- set of events desired (event mask)
; D0 (output) -- 0=non-null event returned, -1=null event
; returned
; A0 (output) -- pointer to user event record
; A1 (output) -- pointer to event queue element when D0=0
; (used internally by GetNextEvent)
;
; Function: This routine polls for availability of certain types of events.
; The user-specified event record format is identical to that of
; the queue element, except for the queue header fields. If no
; events are available, the null event is returned along with
; a -1 result code in D0.
;
; EventAvail is also called by GetNextEvent.
;
; Calling sequence: MOVE.W #EventMask,D0
; LEA EventBuffer,A0
; _EventAvail
;
; Other: uses D0,D1,D2,A0,A1
;_______________________________________________________________________
NoEvtAvail EQU -1 ; (moved from SysErr.Text)
EvtOffset EQU 6 ; event record offset from start of
; event queue element
OSEventAvail LEA EventQueue,A1 ; get address of event queue
; Since PostEvent could dequeue the first element at any time, the event you
; are on may suddenly be recycled and you may end up dequeueing a different event
; or suddenly find yourself at the end of the queue when you were just at the
; beginning. By disabling interrupts during the search, this is avoided.
MOVE SR,-(SP) ; save interrupt state
ORI #HiIntMask,SR ; no event-generating interrupts <C173 24Sep86>
MOVE.L QHead(A1),D1 ; get address of 1st element
BEQ.S TstAutoEvent ; if nil, check for auto events
EventALoop MOVE.L D1,A1 ; get pointer into A-reg
MOVE EvtNum+EvtOffset(A1),D1 ; get its event number
BTST D1,D0 ; is it one we want?
BNE.S GotEventAvail ; if so, we got one!
MOVE.L QLink(A1),D1 ; follow the link to the next one
BNE.S EventALoop ; if we got one, check it out
; there wasn't an event in the queue for us, so check for auto events
TstAutoEvent AND.W SysEvtMask,D0 ; figure in system mask for pseudo-evts
BTST #AutoKeyEvt,D0 ; do we want this kind?
BEQ.S NoEventAvail ; go on if not
MOVE.W HiKeyLast, D0
SWAP D0
MOVE.W KeyLast, D0
TST.L D0 ; Key down to auto-repeat?
BEQ.S NoEventAvail ; if not, return null event
MOVE.L Ticks,D1 ; check first threshold
MOVE.L D1,D2
SUB.L KeyTime,D1
CMP KeyThresh,D1
BLT.S NoEventAvail ; br if not time yet
SUB.L KeyRepTime,D2 ; check second threshold
CMP KeyRepThresh,D2
BLT.S NoEventAvail ; br if not time yet
MOVE.L Ticks,KeyRepTime ; repeat it: first note the time
MOVE.L A0,-(SP) ; save pointer to user's buffer
MOVE #AutoKeyEvt,A0 ; get event number
JSR PostEvent ; go post it (event message already in D0)
MOVE.L A0,A1 ; get pointer to event queue element
MOVE.L (SP)+,A0 ; restore pointer to user's buffer
; and return the event
GotEventAvail MOVE (SP)+,SR ; restore interrupt state
MOVEQ #(EvtBlkSize/4),D0 ; get size of evt record in longwords
MOVEM.L A0-A1,-(SP) ; preserve regs
ADD.L #EvtOffset,A1 ; bump to record part of event element
@1 MOVE.L (A1)+,(A0)+ ; move it into user's buffer
SUBQ #1,D0
BNE.S @1 ; loop till done
MOVEM.L (SP)+,A0-A1 ; get regs back
RTS ; D0 is zero
; there wasn't any event available so return the null event in the users event
; record and a flag in D0
NoEventAvail BSR.S FillRecord ; fill in record for null events
MOVE (SP)+,SR ; restore interrupt state
CLR.W EvtNum(A0) ; return the null event
CLR.L EvtMessage(A0) ; zero message for null events
MOVEQ #NoEvtAvail,D0 ; and D0 non-zero
RTS
; FillRecord fills out the standard fields in an event record pointed to by A0
FillRecord MOVE.L Ticks,EvtTicks(A0) ; fill in the current time
MOVE.L Mouse,EvtMouse(A0) ; and the current mouse point
MOVE KeyMap+6,D1 ; get meta-key states
ROL.W #1,D1 ; rotate around
MOVE.B D1,EvtMeta(A0) ; update metakey field
MOVE.B MBState,EvtMBut(A0) ; get mouse button state
RTS
;______________________________________________________________________
;
; Routine: KbdDrvr
; Arguments: D0.B ADB Command
; A0 ADB Buffer address
; A1 ADB Completion Routine Address (= KbdServ)
; A2 ADB Data Address
; Output: None
; Function: Reads buffer and posts keyboard events as appropriate.
; Side Effects: Trashes A0, A1, D0, D1, D2, D3
;
; Modification History:
; 26 Jun 86 EMT Created
; 15 Jul 86 EMT Updated to use KCHR resource
; 21 Jul 86 EMT Complete rewrite - to use new _KeyTrans
; 3 Oct 86 EMT Added LED bells & whistles
;<A230/17Oct86> EMT D1 is no longer a parameter to this routine. Must get ADB Address from D0
;______________________________________________________________________
; Keyboard driver data
KBufCount EQU 2 ; <C201/07Oct86>
KBufLen EQU 10 ; 8 bytes + length + inuse <C201/07Oct86>
KMAPPtr EQU $00
KeyBits EQU KMAPPtr+4
KCHRPtr EQU KeyBits+(128/8)
DeadKey EQU KCHRPtr+4
KNoADBOp EQU DeadKey+4 ; <C201/07Oct86>
KNumBufs EQU KNoADBOp+1 ; <C201/07Oct86>
KFirstBuf EQU KNumBufs+1 ; <C201/07Oct86>
KbdDSize EQU KFirstBuf+(KBufCount*KBufLen) ; <C201/07Oct86>
; KMAP offsets
KMid EQU $00
KMtype EQU $01
KMvers EQU KMid+2
KMstart EQU KMvers+2
KMnumEx EQU KMstart+128
KMstEx EQU KMnumEx+2
KbdDrvr ; <C93/29Jul86>
MOVE.L A2, D3 ; See if A2 actually contains a pointer
BEQ KbdDone ; If not, can't go on.
MOVE.L A0, A1 ; Save A0 in A1 <A230/17Oct86>
LSR.W #4, D0 ; Shift ADB Address down to low nibble <A230/17Oct86>
MOVEQ #$F, D1 ; Mask for ADB Address <A230/17Oct86>
AND.L D1, D0 ; D0 now contains ADB Address <A230/17Oct86>
MOVE.L D0, D3 ; Save it in D3 <A274/27Oct86>
LEA -10(SP), SP ; Build parameter block on stack <A230/17Oct86>
MOVE.L SP, A0 ; Point to it <A230/17Oct86>
_GetADBInfo ; <A230/17Oct86>
ROR.L #8, D3 ; Rotate ADB Address to high byte <A230/17Oct86>
MOVE.W (SP)+, D3 ; Put Device Type, Orig Addr in low word<A230/17Oct86>
ADDQ.L #8, SP ; Clear off the rest of the stack <A230/17Oct86>
SWAP D3 ; D3 is now Device Type, Orig Addr, ADB Addr, Unused <A230/17Oct86>
MOVE.B 1(A1), D0 ; Get first stroke <A230/17Oct86>
MOVE.B 2(A1), -(SP) ; Save second one on stack <A230/17Oct86>
BSR.S KeyIn
MOVE.B (SP)+, D0 ; Get second stroke
;______________________________________________________________________
;
; Routine: KeyIn
; Arguments: D0.B Raw Keycode
; D3.L Device Type, Orig Addr, ADB Addr, Unused
; A2 Private data area
; Output: None
; Function Translates keycode and posts event as appropriate.
; Side Effects: Trashes A0, A1, D0, D1, D2, D3
; Called From: KbdDrvr twice, (1 BSR, 1 fall-through)
;______________________________________________________________________
KeyIn
CMP.B #$FF, D0 ; Is it not a key?
BEQ KbdDone ; Skip if so
CLR.W KeyLast ; Stop repeating <***>
CLR.W HiKeyLast ; Stop repeating <***>
MOVEQ #$7F, D1 ; Mask = 01111111 binary
AND.B D0, D1 ; Clear all but low 7 bits
MOVE.L KMAPPtr(A2), A1 ; Get KMAP table address
MOVE.B KMstart(A1, D1), D3 ; Get device independent keycode <C201/07Oct86>
BPL.S NoExcept ; Handle normally if high bit clear <C201/07Oct86>
; An exception has been indicated. Find the correct entry in the exception
; table and handle as appropriate.
BCLR #7, D3 ; Clear the high bit <C201/07Oct86>
LEA KMnumEx(A1), A0 ; Get to the beginning of the exceptions<C201/07Oct86>
MOVE.W (A0)+, D2 ; Number of entries in table <C201/07Oct86>
BEQ.S NoExcept ; Skip if none <C201/07Oct86>
SUBQ.W #1, D2 ; Turn it into a zero-based count <C201/07Oct86>
ExLoop
CMP.B (A0)+, D0 ; See if this is the one <C201/07Oct86>
BEQ FoundEx ; Skip if so <C201/07Oct86>
MOVE.B 1(A0), D1 ; Get the string length <C201/07Oct86>
LEA 2(A0, D1), A0 ; Point to the next entry <C201/07Oct86>
DBRA D2, ExLoop ; Go around again <C201/07Oct86>
NoExcept
MOVEQ #0, D2 ; Clear out D2 <C201/07Oct86>
MOVE.B D3, D2 ; Copy virtual keycode to D2 <C201/07Oct86>
LSR.W #3, D2 ; Divide by 8 for byte offset
TST.B D0 ; Up or down key?
BMI.S KeyUp ; Skip around if key up
BSET D3, KeyBits(A2, D2) ; Set it for key down
BRA.S Hammer
KeyUp
BCLR D3, KeyBits(A2, D2) ; Clear it for key up
BSET #7, D3 ; Remember key up for raw key.
Hammer
MOVEM.L KeyBits(A2), D0-D2/A0
MOVEM.L D0-D2/A0, KeyMap ; Hammer in the correct keymap
MOVE.L D3, D0 ; Bits 15-8 contain ADB address
LSR.L #8, D0 ; Put it in the low byte <C219/14Oct86>
MOVE.B D0, KbdLast ; Stuff it down
SWAP D0 ; Now get DeviceType
MOVE.B D0, KbdType ; Update KbdType to show last one used
; The next two instructions build the byte of modifier flags from the
; global key state information. This works because the modifier flags
; exist in bits $37 to $3E, which appear in the following manner:
; Byte | 6 | 7 |
; Bit |37 36 35 34 33 32 31 30|3F 3E 3D 3C 3B 3A 39 38|
; |^^ | ^^ ^^ ^^ ^^ ^^ ^^ ^^|
MOVE.W KeyBits+6(A2), D0 ; Get modifier word
ROL.W #1, D0 ; Rotate in command key
SUBQ.L #4, SP ; Make room for result
MOVE.L KCHRPtr(A2), -(SP) ; Push address of KCHR resource
MOVE.W D3, -(SP) ; Push keycode (w/o modifiers)
MOVE.B D0, (SP) ; Put modifiers where they belong
PEA DeadKey(A2) ; Push address of dead key state
_KeyTrans
MOVE.W (SP)+, D0 ; Get the high word first
BEQ.S NextWord ; Skip if null
BSR.S PostIt ; Otherwise post the event
NextWord
MOVE.W (SP)+, D0 ; Get the other word
BEQ.S KbdDone ; If null, we're done
;______________________________________________________________________
;
; Routine: PostIt
; Arguments: D0.W ASCII Code
; D3.W ADB Address in high byte and raw keycode in low byte
; Output: None
; Function Posts the keyboard event as appropriate.
; Side Effects: Trashes A0, D0, D1
; Called From: KeyIn twice, (1 BSR, 1 fall-through)
;
; Modification History:
; 25 Jun 86 EMT Created
; 22 Jul 86 EMT Changed order of event data (FHRL -> HFRL)
;<A230/17Oct86> EMT Clear the up/down bit in the event message
;______________________________________________________________________
PostIt
ROR.W #8, D0 ; Swap ASCII high and low byte (xxLH)
SWAP D0 ; Move to high word (LHxx)
MOVE.W D3, D0 ; Move in ADB address and raw keycode (LHFR)
ROL.L #8, D0 ; Rotate around (HFRL)
TST.B D3 ; Key up or down?
BMI.S PostKeyUp ; Skip if key up
MOVE.L Ticks, D1
MOVE.L D1, KeyTime ; Mark the time for auto repeat
MOVE.L D1, KeyRepTime
MOVE.W D0, KeyLast ; Save event message <***>
SWAP D0
MOVE.W D0, HiKeyLast ; Save high word too <***>
SWAP D0
MOVE #KeyDwnEvt, A0 ; Get event number
_PostEvent ; Post it
KbdDone
RTS ; And leave
PostKeyUp
MOVE #KeyUpEvt, A0 ; Get event number
BCLR #15, D0 ; Clear the up/down bit in the raw keycode <A230/17Oct86>
_PostEvent ; Post it
RTS ; And leave
; End KbdDrvr <C93/29Jul86>
;______________________________________________________________________
;
; FoundEx
; An exception exists for this particular keystroke. Process it appropriately.
;______________________________________________________________________
FoundEx ; <C201/07Oct86>
MOVE.B (A0)+, D1 ; Get the operand
BPL.S @notXORKey ; Skip if not <A274/27Oct86>
MOVEQ #0, D2 ; Clear out D2
MOVE.B D3, D2 ; Copy virtual keycode to D2
LSR.W #3, D2 ; Divide by 8 for byte offset
BTST D3, KeyBits(A2, D2) ; Get current key state
SEQ D0 ; Invert and put in D0
@notXORKey ; <A274/27Oct86>
MOVEQ #$F, D2 ; Prepare mask for ADB op
AND.B D1, D2 ; D2 is ADB op w/o net address
BEQ.S KbdDone ; If ADB op = 0 (Bus Reset), ignore key
TST.B KNoADBOp(A2) ; See if we should even do this
BNE NoExcept ; Skip if not
MOVEM.L D0/A1, -(SP) ; Save D0 & A1
MOVE.L A0, -(SP) ; Data address = mask
CMP.B #TalkCmd, D2 ; Is it a talk command?
BGE.S @kbdTalk ; Skip if so <A274/27Oct86>
PEA KbdBufFree ; Completion routine = KbdBufFree
BRA.S @kbdBufAlloc ; <A274/27Oct86>
@kbdTalk ; <A274/27Oct86>
PEA KbdListen ; Completion Routine = KbdListen
@kbdBufAlloc ; <A274/27Oct86>
LEA KNumBufs(A2), A1 ; Point to the number of available buffers
MOVE.B (A1)+, D1 ; Get the number of buffers
BEQ.S @kNoBufAvail ; Skip if none available <A274/27Oct86>
SUBQ.W #1, D1 ; Turn it into a zero based count
@kBufLoop ; <A274/27Oct86>
TST.B (A1)+ ; Is the buffer busy?
BEQ.S @kGotABuf ; No, Go use it <A274/27Oct86>
LEA KBufLen-1(A1), A1 ; Point to the next one
DBRA D1, @kBufLoop ; Go around again <A274/27Oct86>
BRA.S @kNoBufAvail ; It's a loss <A274/27Oct86>
@kGotABuf ; <A274/27Oct86>
MOVE.B D0, -1(A1) ; Store the up/down state in the busy info
BSET #1, -1(A1) ; Make sure it shows up as busy
MOVE.L A1, -(SP) ; Buffer Address
MOVE.B (A0), D1 ; Get length of source string
CMP.B #8, D1 ; Greater than 8?
BLS.S @kStrCopyLoop ; If not, no problem <A274/27Oct86>
MOVEQ #8, D1 ; Copy only the first 8 to avoid trashing mem
@kStrCopyLoop ; <A274/27Oct86>
MOVE.B (A0)+, (A1)+ ; Start copying the string
DBRA D1, @kStrCopyLoop ; Repeat D1+1 times <A274/27Oct86>
MOVE.W D3, D0 ; Get the FDB Address
CLR.B D0 ; Clear out the low byte
LSR.W #4, D0 ; Shift it down to form high nibble of ADB Command
OR.B D2, D0 ; Include low op nibble
MOVE.L SP, A0 ; Point to parameter block
_ADBOp ; Pray that everything is OK
BNE.S @kOpFailed ; Branch if not <A274/27Oct86>
ADDQ.L #4, SP ; Pop Buffer Address
@kNoBufAvail ; <A274/27Oct86>
ADDQ.L #8, SP ; Pop Completion and Data Address
MOVEM.L (SP)+, D0/A1 ; Restore D0 & A1
BRA NoExcept ; Finish dealing with the keystroke
@kOpFailed ; <A274/27Oct86>
MOVE.L (SP)+, A1 ; Get the buffer address
CLR.B -1(A1) ; Mark it as not busy
BRA.S @kNoBufAvail ; Punt <A274/27Oct86>
; End FoundEx <C201/07Oct86>
;______________________________________________________________________
;
; Routine: KbdListen
; Arguments: D0.B ADB Command
; D1.L DeviceType, OrigAddr, ADBAddr, Unused (byte order)
; A0 ADB Buffer Address
; A1 ADB Completion Routine Address (= KbdListen)
; A2 ADB Data Address
; Output: None
; Function: Sets or clears bits in mask pointed to by A2 in buffer pointed
; to by A0. Used to alter values of registers in ADB devices.
; Side Effects: Trashes A0, A1, A2, D0, D1, D2
;
; Modification history:
; 3 Oct 86 EMT Created
;______________________________________________________________________
KbdListen ; <C201/07Oct86>
MOVE.L A0, A1 ; Copy A0 into A1 so as to avoid trashing A2
MOVEQ #0, D1 ; Clear out D1
MOVE.B (A1)+, D1 ; Get length of buffer
MOVE.B (A2)+, D2 ; Get length of mask
CMP.B D2, D1 ; Is mask length smaller?
BLS.S @notSmall ; Skip if not <A274/27Oct86>
MOVE.B D2, D1 ; Use the mask length instead
@notSmall ; <A274/27Oct86>
; (A2) is a mask for (A0), 0 meaning don't change, 1 meaning clear or set
; depending upon the value of -1(A0).
TST.B -1(A0) ; PL = clear, MI = set
BPL.S @endClrLoop ; <A274/27Oct86>
BRA.S @endSetLoop ; <A274/27Oct86>
@setLoop ; <A274/27Oct86>
MOVE.B (A2)+, D2 ; Get the mask byte
OR.B D2, (A1)+ ; Set the correct bits
@endSetLoop ; <A274/27Oct86>
DBRA D1, @setLoop ; Go around again <A274/27Oct86>
BRA.S @kLoopDone ; <A274/27Oct86>
@clrLoop ; <A274/27Oct86>
MOVE.B (A2)+, D2 ; Get the mask byte
NOT.B D2 ; Invert it
AND.B D2, (A1)+ ; Clear the correct bits
@endClrLoop ; <A274/27Oct86>
DBRA D1, @clrLoop ; Go around again <A274/27Oct86>
@kLoopDone ; <A274/27Oct86>
CLR.L -(SP) ; No data address needed
PEA KbdBufFree ; Completion routine = KbdBufFree
MOVE.L A0, -(SP) ; Use the buffer one more time
MOVE.L SP, A0 ; Point to parameter block
BCLR #2, D0 ; Turn the talk into a listen command
_ADBOp
BNE.S @kLSuccess ; Branch on success <A274/27Oct86>
MOVE.L (SP), A0 ; Get the buffer address
CLR.B -1(A0) ; Mark it as not busy
@kLSuccess ; <A274/27Oct86>
LEA 12(SP), SP ; Pop the parameter block
RTS
; End KbdListen <C201/07Oct86>
;______________________________________________________________________
;
; Routine: KbdBufFree
; Arguments: D0.B ADB Command
; D1.L DeviceType, OrigAddr, ADBAddr, Unused (byte order)
; A0 ADB Buffer Address
; A1 ADB Completion Routine Address (= KbdListen)
; A2 ADB Data Address
; Output: None
; Function: Marks the buffer pointed to by A0 as free.
; Side Effects: None
;
; Modification history:
; 3 Oct 86 EMT Created
;______________________________________________________________________
KbdBufFree ; <C201/07Oct86>
CLR.B -1(A0)
RTS
; End KbdBufFree <C201/07Oct86>
;___________________________________________________________________________
;
;____________________________________________________________________________________
; P019 C570 23Dec86 ABO VInstall atalk:lap.a
; PA073 2Mar87 ABO VInstall atalk:nonres.a
; PAB185 29Jun87 ABO VInstall atalk:nonres.a
; s263 7sep87 bbm VInstall sounddriver
;
; P019 is to fix a rare(!!) bug in lap.a within the MPP driver.
; PB073 Fixes a re-entrancy problem in nonres.a within MPP.
; PAB185 Fixes an NBP lookup bug where if the response comes back too quickly it
; is written to location zero.
;
; If we're doing a VInstall to install MPP's VBL task, change the address to
; one in RAM, where we disable interrupts and then call the real VBL task.
; This makes the test-and-decrement atomic, preventing VBLDeferCnt from ever
; going negative.
;
; If we're doing a VInstall from Nonres, and the queue element we're installing
; is already there, don't install. If we're doing a lookup, skip the first write.
;
; s263 The current sound driver uses low memory as a vbl queue element. A bug occurs
; if sound is active. The low memory queue element is zeroed regardless if there is a
; next element in the queue or not. Thus the machine may hang. The fix forces the
; sound vbl queue element to be last in the queue always.
; pma287 sound manager uses sound manager uses soundactive different than sound driver.
; Thus soundactive could be true with no sound vbl task installed. So now we check for
; an error from vremove, which we should have done in the first place. (This is the
; same patch as S278, which got deleted when PMAB284 was checked in.)
; s481 there was a small window after the vremove where a timer interrupt could happen.
; Since the sound driver services the timer in the vbl task, the code to reinstall the
; vbl task would never happen.
; s483 changed a hardwired number to HiIntMask (see s481).
NewVInstall PROC EXPORT
CalledFrom EQU $1C ; Where we were called from (return addr)
SkipBytes EQU 18 ; No. of bytes to skip write (PAB185)
VBLHnd EQU $43375C ; MPP VBL task address in ROM
ROMVInstall EQU $402C50 ; ROM VInstall address
NRVBLHnd EQU $434232 ; Nonres VBL task address in ROM
tst.b SoundActive ; sound playing? fixes trashed vbl queue <s263>
beq.s @TruVinst ; if not, just do real vinstall <s263>
move.w sr,-(sp) ; Save sr <s481>
ori.w #HiIntMask,sr ; Disable interrupts <s483>
move.l a0,-(sp) ; save new vbl element on stack <s263>
lea SoundVBL,a0 ; point at hertzfeld<6C>s vbl element <s263>
_VRemove ; remove sound vbl element <s263>
move.l (sp)+,a0 ; get new vbl element back in a0 <s263>
tst.w d0 ; check for error from vremove <pma287>
bne.s @popstatus ; if error then don<6F>t reinstall sound vbl <s481>
bsr.s @TruVinst ; install new vbl element back in queue <s263>
lea SoundVBL,a0 ; get sound vbl element, and install it <s263>
bsr.s @TruVinst ; install sound vbl element back in queue <s481>
move.w (sp)+,sr ; Restore interrupts <s481>
rts ; <s481>
@popstatus ; <s481>
move.w (sp)+,sr ; Restore interrupts <s481>
@TruVinst ; <s263>
MOVE.L VBLAddr(A0),D1 ; D1 = VBL task address
AND.L MaskBC,D1 ; Mask off high bits to be sure
CMP.L #VBLHnd,D1 ; Called from MPP VBL task?
BNE.S @1 ; Branch if not
PEA NewVBLHnd ; Push address of patch
MOVE.L (SP)+,VBLAddr(A0) ; Set it
@1 CMP.L #NRVBLHnd,D1 ; Called from NBP VBL task?
BNE.S @30 ; Branch if not
; PAB185 start
MOVE.L -4(A0),A2 ; A2 -> queue element from call
CMP #LookupName,CSCode(A2) ; Was it a lookup request?
BNE.S @5 ; Branch if not
TST.B Count(A2) ; Check count
BEQ.S @3 ; Branch if zero (leave alone)
ADDQ.B #1,Count(A2) ; Need to add one since aren't sending now
@3 ADD.L #SkipBytes,CalledFrom(SP) ; Skip past the write
MOVE #1,VBLCount(A0) ; Set to send out real soon
; PAB185 end
@5 MOVE SR,-(SP) ; Save SR
MOVE #$2600,SR ; Disable interrupts
LEA VBLQueue+QHead,A2 ; A2 -> Head of VBL queue
@10 TST.L (A2) ; Done?
BEQ.S @20 ; Branch if so
MOVE.L (A2),A2 ; A2 -> next element
CMP.L A2,A0 ; Matches the one we're installing?
BNE.S @10 ; Loop if not
MOVE (SP)+,SR ; Restore SR
MOVEQ #0,D0 ; Indicate no error
RTS ; Return (already installed)
@20 MOVE (SP)+,SR ; Restore SR
@30 JMP ROMVInstall ; Jump to ROM VInstall code
NewVBLHnd MOVE SR,-(SP) ; Save interrupt status
MOVE #$2600,SR ; Interrupts off (SCCLockout)
JSR VBLHnd ; Call VBL task
MOVE (SP)+,SR ; Restore interrupts
RTS ; That's it
;___________________________________________________________________________
; P021 C491 08Dec86 DAF GetWVariant WindowMgr2.a:GetWVariant
;
; Fix File Date Patch# Fix Routine(s) Routine(s) Fixed
;AppleSystemPatch PatchSEROM.a 08Dec86 #P021 (GetWVariant) (GetWVariant)
;
;
; function GetWVariant ( someWindow : WindowPtr ) : integer;
;
; GetWVariant returns the variant code of the windowRecord pointed at by
; someWindow. The value returned is an integer even though variants
; are currently only 4 bits as word params on the stack are easier to
; handle
;
GetWVariant PROC EXPORT
MOVE.L (SP)+,A0 ; get the return address
MOVE.L (SP)+,A1 ; get windowPtr
MOVEQ #$0F,D0 ; trim to 4 bits, word length
AND.B WindowDef(A1),D0 ; get the variant code
MOVE.W D0,(SP) ; return the result
JMP (A0) ; return to caller
;___________________________________________________________________________
; P022 C491 08Dec86 DAF GetCVariant ControlMgr1.a:GetCVariant
;
; Fix File Date Patch# Fix Routine(s) Routine(s) Fixed
;AppleSystemPatch PatchSEROM.a 08Dec86 #P022 (GetCVariant) (GetCVariant)
;
;
; function GetCVariant ( whichControl : controlHandle ) : integer;
;
; GetCVariant returns the control variant code of the control whose
; handle is whichControl. Variant codes are 4-bit values returned
; right-justified in the word result. In case you are wondering
; the result is word rather than byte because it's less complicated
; for this stack-based routine, and the variant is passed to the
; defprocs as a word.
GetCVariant PROC EXPORT
MOVE.L (SP)+,A1 ; get the return address
MOVE.L (SP)+,A0 ; get windowPtr
MOVE.L (A0),A0 ; get ctl ptr
MOVEQ #$0F,D0 ; lo nybble only
AND.B ContrlDefHandle(A0),D0 ; get selector parameter
MOVE.W D0,(SP) ; return result
JMP (A1) ; and return to caller
;___________________________________________________________________________
; PMA207 Cxxx 17Jul87 EHB PackBits
;
; Fix File Date Patch# Fix Routine(s) Routine(s) Fixed
;AppleSystemPatch PatchSEROM.a 17Jul87 #PMA207 (PackBits) (PackBits)
;
; This patch allows scanLines > 127 bytes to be packed using packBits.
PatchPMA207 PROC EXPORT
ENDPROC ; Important: PackBitsPatch.a contains globals which must be
; outside of any PROC.
INCLUDE 'PackBitsPatch.a'
;___________________________________________________________________________
; PA061 C628 25feb87 bbm added new trap rGetResource.
;
; Fix File Date Patch# Fix Routine(s) Routine(s) Fixed
;AppleSystemPatch PatchSEROM.a 25feb87 #PA061 (rGetResource) (rGetResource)
;
; Routine: FUNCTION rGetResource(theType: ResType; theID: INTEGER): Handle; <C628>
;
; Arguments: 10(A6) (input.L) resource type
; 8(A6),A0(input.W) resource ID
; 14(A6) (output.L) resource handle
;
; Called By: A-trap through dispatcher
; Calls: GetResource
;
; Function: do a normal GetResource without the rom map; if that fails,