home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
038.lha
/
MacGag
/
support.asm
< prev
next >
Wrap
Assembly Source File
|
1987-05-16
|
2KB
|
56 lines
;support.asm - MacGAG support routines (c) 1987 John Hodgson
;Compile using the Aztec AS assembler with -C and -D options
public _NewOpenWindow
public _NewCloseWindow
;Glue code notes :
; The idea is to be able to call this routine prior to calling the
;original routine, without disturbing the environment. A0 contains the
;New Window ptr as passed to OpenWindow, & A6 contains the library base
;pointer. Since D0 returns the result & A1 is free to be trashed, (see RKM :
;Exec) we don't worry about restoring these values. If this routine was
;compiled using small code/data, we'd have to be concerned with initializing
;and restoring A4, the code's relative base index pointer.
_NewOpenWindow:
movem.l d1-d7/a2-a6,-(sp)
move.l a0,-(sp)
jsr _BoxUp
move.l (sp)+,a0
movem.l (sp)+,d1-d7/a2-a6
move.l _OldOpenWindow,a1
jmp (a1) ;routine will rts for us
;This routine gets a little more complicated. We call BoxDown() AFTER
;CloseWindow() in order to get the proper effect; but, BoxDown requires
;parameters in the (now deallocated) window structure! The cure? Make
;a local copy of the window contents before calling CloseWindow(), and
;pass that information to BoxDown(). Again, all this is performed on the
;stack so we can remain re-entrant.
_NewCloseWindow:
movem.l d1-d7/a2-a6,-(sp)
sub.l #132,sp ;space for one Window struct
move.l a0,a1 ;source=(window *) argument
move.l sp,a2 ;dest=copy on stack
move.l #32,d0 ;size in longwords
.1 move.l (a1)+,(a2)+
dbra d0,.1 ;duplicate window contents
move.l _OldCloseWindow,a1
jsr (a1) ;CloseWindow()
move.l sp,a1
move.l a1,-(sp) ;push C argument
jsr _BoxDown ;BoxDown(windowcopy)
add.l #136,sp ;pop argument & Window struct
movem.l (sp)+,d1-d7/a2-a6
rts
public _OldOpenWindow
public _BoxUp
public _OldCloseWindow
public _BoxDown