sys7.1-doc-wip/QuickDraw/Patches/PackBitsPatch.a
2019-07-27 22:37:48 +08:00

185 lines
7.5 KiB
Plaintext

;EASE$$$ READ ONLY COPY of file “PackBitsPatch.a”
; 1.0 CCH 11/16/1988 Added to EASE.
; END EASE MODIFICATION HISTORY
;
; File PackBitsPatch.a
;
; Copyright © 1987 Apple Computer, Inc. All rights reserved.
;
; PMA207 17Jul87 EHB Fixed PackBits to work for scanlines > 127 bytes.
;________________________________________________________________________________
; NOTICE: When entering patches use the format that is described below...
;
; Please read the following description for
; the Patch Collator. Patch Collator will
; aid us in finding out where system
; patches are located. Therefore, making
; it a little easier to track down rodents!
;
;
; Patch Collator for the Macintosh System Disk
; ============================================
;
; File: patch.c
; Language: "C"
;
; Date: April 16, 1987
; Revision: 1.0
; Author: Charlton E. Lui
;
; Patch collator is a simple program that scans through files looking for Apple System Patches.
; It finds a patch comment by finding a header that looks like this...
;
; *** One to one mapping of a fix ***
; Fix File Date Patch# Fix Routine(s) Routine(s) Fixed
;*AppleSystemPatch DrawPicturePatch.a 08Jul85 #0 (InstallRDrivers) (InstallRDrivers)
;
; *** One to many mapping of a fix ***
; Fix File Date Patch# Fix Routine(s) Routine(s) Fixed
;*AppleSystemPatch DrawPicturePatch.a 09Dec85 #13 (SoundVBLAddress) (RecoverHandle,ROMBMap)
;
; *** Many to one mapping of a fix ***
; Fix File Date Patch# Fix Routine(s) Routine(s) Fixed
;*AppleSystemPatch DrawPicturePatch.a 17May86 #47 (FontMgr,DialogMgr) (GetRsrc)
;
; *** One to many mapping of a fix ***
; Fix File Date Patch# Fix Routine(s) Routine(s) Fixed
;*AppleSystemPatch DrawPicturePatch.a 23Apr86 #43 (BTFlush,BTClose) (BTFlush,BTClose)
;
;
;
; The examples show the many mappings a fix may have. Each file should have the appropiate ROM
; version already inserted atop the file so it does not need be entered.
;
; WARNING: To make sure the scan works properly, use parenthesis around the routine field(s).
;
; This header will be inserted atop of each patch file. Whenever a new patch is entered the person
; who is entering the patch will copy the header down to the place where they are making the fix
; and enter the pertinent information.
;
; IMPORTANT! Make sure to take out the asterix before the AppleSystemPatch symbol.
; The "*" was added so that Patch Collator would not mistake the comments above as
; an actual patch. So delete the "*" before. Also, make sure that there is no
; space between the ";"(semicolon) and the "AppleSystemPatch" symbol. It should look like this
; ";AppleSystemPatch".
;
; A file will contain a list of names of the main patch files. Patch collator will use
; MPW's funnel facility to feed the names into the patch collator.
;
; PatchCollator < PatchFiles
;
; The files will also be scanned for other patch file includes. The included patch files will
; be added to the list of patch files.
;
; Each file will be scanned for patch information and then entered into a binary tree.
; The binary tree is used to sort the patch list alpabetically. After it finishes,
; it disposes of all of the nodes of the tree.
;
; Patch Collator uses simple parsing techniques. It does not check whether or not the information
; is correct or not. Patch Collator will leave that for the AI group.
;
; Output will contain the information something like this...
;
; Files working on...
; ===================
; #1) Reading file PatchPlusROM.a
; Includes patch files for PatchPlusROM.a are as follows...
; #3) DrawPicturePatch.a
; #4) TEPatch.a
; #5) FontMgrPatch.a
; #6) MenuMgr.a
; #7) HMenuPatch.Install
; #2) Reading file PatchSEROM.a
; Includes patch files for PatchSEROM.a are as follows...
; #3) DrawPicturePatch.a
; #6) MenuMgr.a
; #7) HMenuPatch.Install
; #3) **Warning - could not open DrawPicturePatch.a
; #4) **Warning - could not open TEPatch.a
; #5) **Warning - could not open FontMgrPatch.a
; #6) **Warning - could not open MenuMgr.a
; #7) **Warning - could not open HMenuPatch.Install
; ====================================================================================================
; *****PATCH COLLATOR*****
; ====================================================================================================
;
; ** Column Condition:
; ** X means this trap is patched to fix another trap.
; Y means that this trap is being fixed by a trap ( possibly itself ).
;
; Patch List Condition Patch# Fix File Line# Date
; ====================================================================================================
;
; AsynchDrvrs Y #3 PatchPlusROM.a 2348 14Oct85
; AsynchDrvrs Y #42 PatchPlusROM.a 2302 14Oct85
; atalk:lap.a X #P019 PatchSEROM.a 2273 23Dec86
; atalk:nonres.a X #PA073 PatchSEROM.a 2276 2Mar87
; AutoInt1 X #21 PatchPlusROM.a 1700 01Jan1904
; BasicIO X #50 PatchPlusROM.a 2540 11Sep86
; BasicIO Y #50 PatchPlusROM.a 2540 11Sep86
; BTClose X #43 PatchPlusROM.a 2404 23Apr86
; BTClose Y #43 PatchPlusROM.a 2404 23Apr86
;
; Notice: The files that couldn't be opened will give a warning. This could have resulted in
; a typo or perhaps the file was not found in the directory.
;
;_______________________________________________________________________________________
IF (&TYPE('onMac') = 'UNDEFINED') THEN
onMac EQU 0
ENDIF
IF (&TYPE('onMacPP') = 'UNDEFINED') THEN
onMacPP EQU 0
ENDIF
;
; Common base addresses
;
IF onMac THEN
ROMPackBits EQU $0040CF8C
ELSEIF onMacPP THEN
ROMPackBits EQU $00417708
ENDIF
NewPackBits PROC EXPORT
; Fix File Date Patch# Fix Routine(s) Routine(s) Fixed
;AppleSystemPatch PackBitsPatch.a 01Jan1904 #??? (PackBits) (PackBits)
;
;----------------------------------------------------------------
; This patch to PackBits allows scanlines passed to packBits to be
; longer than the 127 byte limit that currently exists on all machines
; except the Mac II.
;
; Note that this patch does not pack images exactly the same as a Mac II.
; (To do so would have taken more code.)
;
; STACK: 0:D3(2) 2:RTS(4) 6:count(2) 8:dst(4) 12:src(4)
MOVE D3,-(SP) ; save work register
MOVE 6(SP),D3 ; get number of bytes to pack
@nextchunk MOVE D3,D0 ; get size
MOVEQ #127,D1 ; get max chunk size
SUB D1,D3 ; is chunk too big?
BLS.S @lastchunk ; => no, do last chunk
BSR.S @callROM ; and pack last chunk
BRA.S @nextchunk ; => repeat for next chunk
@lastchunk MOVE D0,D1 ; get size of last chunk
BSR.S @callROM ; and pack last chunk
MOVE (SP)+,D3 ; restore work register
MOVE.L (SP)+,A0 ; get return address
ADD #10,SP ; strip params
JMP (A0) ; and return
@callROM MOVE.L 12+4(SP),-(SP) ; push src
MOVE.L 8+8(SP),-(SP) ; push dst
MOVE D1,-(SP) ; push count
JSR ROMPackBits ; call the ROM
RTS ; return to caller
ENDPROC