home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 2
/
fishmore-publicdomainlibraryvol.ii1991xetec.iso
/
dirs
/
popupmenu_422.lzh
/
PopUpMenu
/
Source
/
Startup.a
< prev
next >
Wrap
Text File
|
1990-12-31
|
3KB
|
125 lines
INCLUDE "exec/types.i"
INCLUDE "libraries/dos.i"
INCLUDE "libraries/dosextens.i"
INCLUDE "exec/execbase.i"
INCLUDE "exec/funcdef.i"
INCLUDE "exec/exec_lib.i"
INCLUDE "libraries/dos_lib.i"
AbsExecBase EQU 4
POPUPPRI EQU 5
POPUPSTACK EQU 2000
* Must use Kickstart 1.2 or higher
LIBVERSION EQU 33
xref _LinkerDB
xref @InitPopUpMenu
section Startup,code
Startup: MOVEM.L D2-D4/A2-A4/A6,-(SP)
LEA _LinkerDB,A4
* ------------ Open dos.
LEA DosName(PC),A1
MOVEQ.L #LIBVERSION,D0
MOVEA.L AbsExecBase.W,A6
JSR _LVOOpenLibrary(A6)
MOVE.L D0,_DOSBase(A4)
BEQ.W NoDos
* ------------ Get pointer to our Process.
MOVEA.L ThisTask(A6),A3
* ------------ Run from Workbench ?
TST.L pr_CLI(A3)
BEQ.B FromWorkbench
* ------------ Get address to this segment.
LEA Startup-4(PC),A2
* ------------ Get address to PopUpMenu code segment.
MOVE.L #@InitPopUpMenu-4,D3
* ------------ Convert to BCPL.
ASR.L #2,D3
* ------------ Find current output window.
LEA CurrWindow(PC),A0
MOVE.L #MODE_OLDFILE,D2
BSR.B GetStdOut
BEQ.B NoStdOut
* ------------ Save start of segments.
MOVE.L (A2),_PopUpSeg(A4)
* ------------ Remove this segment.
CLR.L (A2)
* ------------ Create PopUpMenu process.
LEA PopUpTaskName(PC),A0
MOVE.L A0,D1
MOVEQ.L #POPUPPRI,D2
MOVE.L #POPUPSTACK,D4
JSR _LVOCreateProc(A6)
BRA.B Done
* ------------ Wait for Workbench startup-message.
FromWorkbench: LEA pr_MsgPort(A3),A0
JSR _LVOWaitPort(A6)
LEA pr_MsgPort(A3),A0
JSR _LVOGetMsg(A6)
MOVE.L D0,D3
* ------------ Open window on Workbench screen.
LEA WbWindow(PC),A0
MOVE.L #MODE_NEWFILE,D2
BSR.B GetStdOut
MOVEA.L AbsExecBase.W,A6
BEQ.B NoWbStdOut
* ------------ No need to unload segments (Workbench takes care of that).
CLR.L _PopUpSeg(A4)
* ------------ Set task priority.
MOVEA.L A3,A1
MOVEQ #POPUPPRI,D0
JSR _LVOSetTaskPri(A6)
* ------------ Start PopUpMenu-program.
JSR @InitPopUpMenu
* ------------ Forbid so Workbench can't unload us before we are done.
NoWbStdOut: JSR _LVOForbid(A6)
MOVEA.L D3,A1
JSR _LVOReplyMsg(A6)
Done:
NoStdOut:
NoDos: MOVEQ #00,D0
MOVEM.L (SP)+,D2-D4/A2-A4/A6
RTS
GetStdOut: MOVE.L A0,D1
MOVEA.L _DOSBase(A4),A6
JSR _LVOOpen(A6)
MOVE.L D0,_StdOut(A4)
RTS
* Put these data in our code-segment.
CurrWindow: dc.b '*',0
WbWindow: dc.b 'CON:200/75/310/45/'
PopUpTaskName: dc.b 'PopUpMenu',0
DosName: dc.b 'dos.library',0
section __MERGED,bss
xref _DOSBase
xref _StdOut
xref _PopUpSeg
END