home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Carousel
/
CAROUSEL.cdr
/
mactosh
/
code
/
asm_show.sit
/
ShowInit.asm
Wrap
Assembly Source File
|
1988-08-30
|
6KB
|
203 lines
; File: ShowINIT.a
; Last Modified: Wednesday, July 29, 1987 1:11:16 PM
;------------------------------------------------------------------------------------------------
;
; Simple INIT notification routine
; by Paul Mercer (Applied Logic Systems),
; Darin Adler, and Paul Snively (ICOM Simulations)
; from an idea by Steve Capps
;
; Created: 6/7/87 PM - first version
; Modified: 6/15/87 PM - changed to standard (Pascal) calling conventions
; 6/20/87 PM - fixed color & Finder bug on Mac II
; 6/22/87 DBA - improved handling of QuickDraw
; 6/29/87 DBA - used scratch8 to avoid conflict with REasy AccessS
; 6/30/87 DBA - changed to a 4-byte scheme with RchecksumS
; 6/30/87 PFS - separated into ShowINIT and InnerShowINIT
; 7/1/87 DBA - fixed stack bug and switched to CurApName+
; 7/2/87 PM - added check for old signature in ApplScratch for
; backword compatibility (TMON Startup)
; 7/3/87 PM - removed _SysBeep in ErrorExit since it causes a crash
; also changed ICN# plotter to srcOr mode for Blinker
; 7/13/87 PM - fixed a3 trashing bug in InnerShowINIT - exit code left
; word on stack (reported by D. Dunham)
; 7/21/87 PM - due to popular demand, InitGraf is no longer being called
; this avoids the problem with Startupscreens getting
; Rwashed outS by ShowINIT though someone else is still
; bound to call InitGraf sooner or later (i.e. InitWindows)
; 7/29/87 PM - Put InitGraf back in; this is required (reported by C. Derossi
; at Apple Tech Support). Took out GetPort/SetPort.
;
;------------------------------------------------------------------------------------------------
INCLUDE 'Traps.a'
INCLUDE 'QuickEqu.a'
INCLUDE 'SysEqu.a'
INCLUDE 'ToolEqu.a'
myH equ CurApName+32-4 ; a GREAT place to store 4 bytes
myCheck equ myH+2
oldSig equ ApplScratch ; *** this will be taken out soon
oldH equ oldSig+4+2
iconID equ 10
iconPtr equ 10
moveX equ 8
myVars RECORD 0,DECREMENT
destRect ds.w 4
myBitMap ds bitMapRec
myPort ds portRec
savePort ds.l 1
thePort ds 4 ; my own QuickDraw (required!)
ds grafSize-4 ; other QuickDraw globals (except thePort)
localA5 ds 4
varsSize equ *
ENDR
;------------------------------------------------------------------------------------------------
;
; display the ICN# specified by iconID and move the pen horizontally by moveX
; pass a -1 in moveX to move the standard amount, moveX should be 40 for most ICN#'s
;
; PROCEDURE ShowINIT(iconID: Integer; moveX: Integer); EXTERNAL
;
; pascal void ShowINIT(iconID, moveX)
; short iconID;
; short moveX;
; extern;
;
;------------------------------------------------------------------------------------------------
ShowINIT: PROC EXPORT
IMPORT InnerShowINIT
link a6,#0 ;don't need locals here
move.l a3,-(sp)
clr.l -(sp)
move.l #'ICN#',-(sp)
move iconID(a6),-(sp)
_GetResource
move.l (sp)+,d0
beq.s ErrorExit
move.l d0,a0
_HLock
move.l a0,a3
move.l (a0),-(sp)
move moveX(a6),-(sp)
jsr InnerShowINIT
move.l a3,a0
_HUnlock
move.l a0,-(sp)
_ReleaseResource
Exit:
move.l (sp)+,a3
unlk a6
move.l (sp)+,(sp) ; ditch args
rts ; return
ErrorExit:
; move #8,-(sp) ; ***PM why doesn't this work?
; _SysBeep
bra.s Exit
;------------------------------------------------------------------------------------------------
;
; display the ICN# pointed to by iconPtr and move the pen horizontally by moveX
; pass a -1 in moveX to move the standard amount, moveX should be 40 for most ICN#'s
;
; PROCEDURE InnerShowINIT(iconPtr: ICONListPtr; moveX: Integer); EXTERNAL
;
; pascal void InnerShowINIT(iconPtr, moveX)
; ICONList *iconPtr;
; short moveX;
; extern;
;
;------------------------------------------------------------------------------------------------
InnerShowINIT: PROC EXPORT
WITH myVars
link a6,#varsSize
movem.l d2-d7/a3-a5,-(sp)
lea.l localA5(a6),a5 ; PM7/21 - no longer calling InitGraf
pea thePort(a6)
_InitGraf ; ***fixes color bug as per DA@ICOM
pea myPort(a6)
_OpenPort
move myH,d0
rol #1,d0
eor #$1021,d0
cmp myCheck,d0
beq.s ScratchOK
cmp.l #'Paul',oldSig ; ***check for old ShowINIT compatibility
beq.s OldScratchOK
move #8,myH
bra.s ScratchOK
OldScratchOK:
move oldH,myH ; put the old in the new
ScratchOK:
lea myPort(a6),a0
move portBounds+bottom(a0),d0
sub #8+32,d0
swap d0
move myH,d0
move.l d0,destRect(a6)
move.l d0,destRect+botRight(a6)
add #32,destRect+right(a6)
add #32,destRect+bottom(a6)
move.l iconPtr(a6),a3
bsr.s PlotIcon
move myH,d0
move moveX(a6),d1
bpl.s @1 ; not default
move #40,d1 ; default
@1 add d1,d0 ; move to right
move d0,myH
rol #1,d0
eor #$1021,d0
move d0,myCheck
Exit:
pea myPort(a6)
_ClosePort
movem.l (sp)+,d2-d7/a3-a5
unlk a6
move.l (sp)+,a0 ; PM 7/13, bug reported by D. Dunham
addq.l #6,sp ; ditch args
jmp (a0) ; return
; a3 holds ICN# pointer
PlotIcon:
lea myBitMap(a6),a4
move.l a3,baseAddr(a4) ; fill out the bitmap record
add.l #128,baseAddr(a4) ; skip to mask
move #4,rowBytes(a4) ; 32/8 bits
move.l #0,bounds(a4) ; 0,0 topleft
move.l #$00200020,bounds+botRight(a4) ; 32,32 botright
move.l a4,-(sp) ; punch hole with mask
lea myPort(a6),a2 ; get the desk port
pea portBits(a2) ; for its portbits
pea srcRect
pea destRect(a6)
move #srcBic,-(sp) ; punch a hole
clr.l -(sp) ; no clip region
_CopyBits
sub.l #128,baseAddr(a4)
move.l a4,-(sp) ; now draw (or) icon
pea portBits(a2)
pea srcRect
pea destRect(a6)
move #srcOr,-(sp)
clr.l -(sp)
_CopyBits
rts
srcRect: dc.w 0,0,32,32
ENDPROC
END