home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Carousel
/
CAROUSEL.cdr
/
mactosh
/
code
/
asm_noqu.sit
< prev
next >
Wrap
Text File
|
1988-05-14
|
7KB
|
308 lines
11-May-88 21:23:56-MDT,6973;000000000000
Return-Path: <u-lchoqu%sunset@cs.utah.edu>
Received: from cs.utah.edu by SIMTEL20.ARPA with TCP; Wed, 11 May 88 21:23:42 MDT
Received: by cs.utah.edu (5.54/utah-2.0-cs)
id AA03530; Wed, 11 May 88 21:24:11 MDT
Received: by sunset.utah.edu (5.54/utah-2.0-leaf)
id AA29264; Wed, 11 May 88 21:24:08 MDT
Date: Wed, 11 May 88 21:24:08 MDT
From: u-lchoqu%sunset@cs.utah.edu (Lee Choquette)
Message-Id: <8805120324.AA29264@sunset.utah.edu>
To: rthum@simtel20.arpa
Subject: NoQuiche.asm
;Real ROMs don't eat Quiche: The INIT resource that makes the 128K ROM
; into the nasty beast it could have been.
;
;Copyright 1986 Darin Adler
;
;A System file that contains this resource is very nasty and will only
;work with the 128K ROM. It might screw up with many applications!
;
;As long as you are messing up a System file by putting this in it, you
;may as well remove the following from the System file:
;
;CURS 1-4 * (standard cursors, in ROM)
;DRVR 2 '.Print' (in ROM)
;DRVR 9 '.MPP' (AppleTalk, in ROM)
;DRVR 10 '.ATP' (AppleTalk, in ROM)
;FONT 0,12 (Chicago font, in ROM)
;MDEF 0 (standard MDEF, in ROM)
;PACK 4-5 (floating point packages, in ROM)
;PACK 7 (binary-decimal package, in ROM)
;PTCH 105 (patch for old ROM)
;PTCH 28927 (patch for MacWorks)
;WDEF 0 (standard WDEF, in ROM)
;all named FONT resources (FONDs used by new ROM)
;
;* Do not remove the CURS resources unless you have already put in
; this patch. The other resources can be removed even without the
; "No Quiche" resource.
;
;The resources must be removed BEFORE you re-boot with the patch active.
;ResEdit will be unable to remove these resources from the currently
;active System file, once you have made the patch.
;
;----------
;
;Currently, this resource does the following:
;
; The ROM resources are always present for all Resource Manager.
; This does not keep ResEdit from working ... a good sign.
;
; Scaling of fonts is disabled by default (FScaleDisable<>0).
;
; DrawControls(window) is replaced by
; UpdateControls(window,window^.visRgn).
; DrawDialog(dialog) is replaced by
; UpdateDialog(dialog,dialog^.visRgn).
;
; The DrawDialog fix has a wonderful effect on ResEdit's TMPL
; resource editors, e.g. the MENU editor, which is MUCH faster!
;INCLUDE the necessary system globals:
INCLUDE ::Library.D
toolbox EQU $600
ROM85 EQU $28E
;The following macro is for word aligned, long word values.
MACRO LONG value =
DC {value}>>16,{value}&$FFFF
|
;Here we go!
RESOURCE 'INIT' 20 'NoQuiche' 80
CountResources EQU $19C
GetIndResource EQU $19D
CountTypes EQU $19E
GetIndType EQU $19F
UniqueID EQU $1C1
GetResource EQU $1A0
GetNamedResource EQU $1A1
InitFonts EQU $FE
DrawControls EQU $169
UpdtControl EQU $153
DrawDialog EQU $181
UpdtDialog EQU $178
;First, set up the patches-to-be.
TST.W ROM85 ;Do nothing for the old ROM.
BPL.S NewROM
RTS
NewROM
MOVE.W #CountResources,D0
LEA OldCountResources,A1
_GetTrapAddress,toolbox
MOVE.L A0,(A1)
MOVE.W #GetIndResource,D0
LEA OldGetIndResource,A1
_GetTrapAddress,toolbox
MOVE.L A0,(A1)
MOVE.W #CountTypes,D0
LEA OldCountTypes,A1
_GetTrapAddress,toolbox
MOVE.L A0,(A1)
MOVE.W #GetIndType,D0
LEA OldGetIndType,A1
_GetTrapAddress,toolbox
MOVE.L A0,(A1)
MOVE.W #UniqueID,D0
LEA OldUniqueID,A1
_GetTrapAddress,toolbox
MOVE.L A0,(A1)
MOVE.W #GetResource,D0
LEA OldGetResource,A1
_GetTrapAddress,toolbox
MOVE.L A0,(A1)
MOVE.W #GetNamedResource,D0
LEA OldGetNamedResource,A1
_GetTrapAddress,toolbox
MOVE.L A0,(A1)
MOVE.W #InitFonts,D0
LEA OldInitFonts,A1
_GetTrapAddress,toolbox
MOVE.L A0,(A1)
MOVE.W #UpdtControl,D0
LEA OldUpdtControl,A1
_GetTrapAddress,toolbox
MOVE.L A0,(A1)
MOVE.W #UpdtDialog,D0
LEA OldUpdtDialog,A1
_GetTrapAddress,toolbox
MOVE.L A0,(A1)
;Create the heap block.
MOVE.L #HeapBlockEnd-HeapBlock,D1
MOVE.L D1,D0
_NewPtr,sys
MOVE.L A0,A1
LEA HeapBlock,A0
MOVE.L D1,D0
_BlockMove
;Install the patches.
MOVE.W #CountResources,D0
LEA PatchCountResources-HeapBlock(A1),A0
_SetTrapAddress,toolbox
MOVE.W #GetIndResource,D0
LEA PatchGetIndResource-HeapBlock(A1),A0
_SetTrapAddress,toolbox
MOVE.W #CountTypes,D0
LEA PatchCountTypes-HeapBlock(A1),A0
_SetTrapAddress,toolbox
MOVE.W #GetIndType,D0
LEA PatchGetIndType-HeapBlock(A1),A0
_SetTrapAddress,toolbox
MOVE.W #UniqueID,D0
LEA PatchUniqueID-HeapBlock(A1),A0
_SetTrapAddress,toolbox
MOVE.W #GetResource,D0
LEA PatchGetResource-HeapBlock(A1),A0
_SetTrapAddress,toolbox
MOVE.W #GetNamedResource,D0
LEA PatchGetNamedResource-HeapBlock(A1),A0
_SetTrapAddress,toolbox
MOVE.W #InitFonts,D0
LEA PatchInitFonts-HeapBlock(A1),A0
_SetTrapAddress,toolbox
MOVE.W #DrawControls,D0
LEA PatchDrawControls-HeapBlock(A1),A0
_SetTrapAddress,toolbox
MOVE.W #DrawDialog,D0
LEA PatchDrawDialog-HeapBlock(A1),A0
_SetTrapAddress,toolbox
;Finally, do any one-shot stuff
;Done
RTS
HeapBlock
;This block contains the patches to the ROM.
;Each one contains a short explanation of what it is.
;----------
;The following patches make sure that the ROM map is inserted for all
;resource manager calls. The one-deep calls are not modified because
;that would not be desirable.
AddROMMap
TST.B ROMMapInsert ;if ROM not explicitly included
BNE.S AddedROMMap
ST ROMMapInsert ;ROM implicitly included
MOVE.B ResLoad,TmpResLoad ;without changing ResLoad
AddedROMMap
RTS
PatchCountResources
BSR.S AddROMMap
DC.W $4EF9
OldCountResources
LONG 0
PatchGetIndResource
BSR.S AddROMMap
DC.W $4EF9
OldGetIndResource
LONG 0
PatchCountTypes
BSR.S AddROMMap
DC.W $4EF9
OldCountTypes
LONG 0
PatchGetIndType
BSR.S AddROMMap
DC.W $4EF9
OldGetIndType
LONG 0
PatchUniqueID
BSR.S AddROMMap
DC.W $4EF9
OldUniqueID
LONG 0
PatchGetResource
BSR.S AddROMMap
DC.W $4EF9
OldGetResource
LONG 0
PatchGetNamedResource
BSR.S AddROMMap
DC.W $4EF9
OldGetNamedResource
LONG 0
;----------
;This makes font scale disabling the default!
PatchInitFonts
DC.W $4EB9 ;Call InitFonts.
OldInitFonts
LONG 0
ST FScaleDisable ;Disable scaling.
RTS
;----------
;This makes DrawControls a lot smarter!
PatchDrawControls
MOVE.L (SP)+,A0
MOVE.L (SP),A1
MOVE.L visRgn(A1),-(SP) ;Add a visRgn parameter.
MOVE.L A0,-(SP)
DC.W $4EF9 ;Call UpdtControl.
OldUpdtControl
LONG 0
;----------
;This makes DrawDialog a lot smarter!
PatchDrawDialog
MOVE.L (SP)+,A0
MOVE.L (SP),A1
MOVE.L visRgn(A1),-(SP) ;Add a visRgn parameter.
MOVE.L A0,-(SP)
DC.W $4EF9 ;Call UpdtDialog.
OldUpdtDialog
LONG 0
;----------
HeapBlockEnd
END