home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
492.lha
/
AmiCron_v4.2
/
start.a
< prev
Wrap
Text File
|
1991-04-06
|
2KB
|
121 lines
INCLUDE "macros.i"
INCLUDE "exec/types.i"
INCLUDE "exec/ables.i"
INCLUDE "exec/execbase.i"
INCLUDE "libraries/dosextens.i"
INCLUDE "libraries/arpbase.i"
ExecBase EQU 4
xref LinkerDB,_BSSBAS,_BSSLEN
xref run,cmdline,cmdlen
csect _STARTUP,0,0,0,4
start RESIDENT 2000
lea LinkerDB,a4
tst.l d0
beq.s nocmd
move.l d0,cmdlen
lea cmdline,a1
bra.s cpy1
cpy_cmd move.b (a0)+,(a1)+
cpy1 dbf d0,cpy_cmd
bra.s cont
nocmd move.w $1000,cmdline
moveq.l #1,d0
move.l d0,cmdlen
cont lea _BSSBAS,a3
moveq.l #0,d1
move.l #_BSSLEN,d0
bra.s clr_lp
clr_bss move.l d1,(a3)+
clr_lp dbf d0,clr_bss
move.l ExecBase.w,a6
lea Arp,a1
moveq.l #ArpVersion,d0
Call OpenLibrary
move.l d0,ArpBase(a4)
beq noarp
move.l d0,a0
move.l ab_IntuiBase(a0),IntuitionBase(a4)
move.l ab_DosBase(a0),d0
move.l d0,DOSBase(a4)
move.l ThisTask(a6),a3
move.l pr_CurrentDir(a3),d1
move.l d0,a6
Call DupLock
move.l d0,curdir(a4)
lea pcb,a2
move.l #2000,pcb_StackSize(a2)
move.b LN_PRI(a3),pcb_Pri(a2)
move.b #PRF_CLOSESPLAT,pcb_Control(a2)
move.l #CON,d1
move.l #MODE_OLDFILE,d2
move.l DOSBase(a4),a6
Call Open
move.l d0,pcb_Output(a2)
move.l d0,pcb_Input(a2)
lea start-4(pc),a3
move.l (a3),pcb_LoadedCode(a2)
move.l (a3),seglist(a4)
move.l ExecBase.w,a6
FORBID
suba.l a1,a1
lea name(pc),a0
move.l ArpBase(a4),a6
Call ASyncRun
lea args(pc),a1
tst.l d0
bmi.s starterr
clr.l (a3)
move.w d0,4(a1)
lea startmess(pc),a0
Call Printf
bra.s noclose
starterr lea error(pc),a0
Call Printf
move.l curdir(a4),d1
Call UnLock
movea.l a6,a1
move.l ExecBase.w,a6
Call CloseLibrary
noclose move.l ExecBase.w,a6
; Call Permit
noarp rts
args dc.l name
num dc.w 0
pcb ds.b pcb_SIZEOF
name dc.b "AmiCron",0
CON dc.b "NIL:",0
Arp dc.b "arp.library",0
error dc.b "Could not create %s-process!",10,0
startmess dc.b "%s started at background shell %d",10,0
csect __MERGED,1,0,0,4
xdef IntuitionBase,ArpBase,DOSBase,curdir,seglist
seglist dc.l 0
curdir dc.l 0
ArpBase dc.l 0
DOSBase dc.l 0
IntuitionBase
dc.l 0
END