home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 17
/
amigaformatcd17.iso
/
-look_here_1st!-
/
handy_tools
/
multicx2
/
handlecx.asm
< prev
next >
Wrap
Assembly Source File
|
1997-06-23
|
8KB
|
250 lines
; HandleCX 1.3 (19.3.95)
; (c) 1995 by Martin Berndt
;
; for DevPac v3 assembler using system.gs
_LVOCopyBrokerList equ -186
_LVOFreeBrokerList equ -192
_LVOBrokerCommand equ -198
STRUCTURE BrokerCopy,LN_SIZE
STRUCT bc_Name,CBD_NAMELEN
STRUCT bc_Title,CBD_TITLELEN
STRUCT bc_Descr,CBD_DESCRLEN
ULONG bc_Task
ULONG bc_Dummy1
ULONG bc_Dummy2
UWORD bc_Flags
LABEL BrokerCopy_SIZEOF
move.l $4.w,a6
lea VarBase,a4
lea cxname(pc),a1
moveq #37,d0
jsr _LVOOpenLibrary(a6)
move.l d0,_CXBase(a4)
beq.s quit
lea dosname(pc),a1
moveq #0,d0
jsr _LVOOpenLibrary(a6)
move.l d0,_DOSBase(a4)
beq.s quit
lea _CXList(a4),a0
move.l a0,LH_TAILPRED(a0)
addq.w #4,a0
clr.l (a0)
move.l a0,-(a0)
move.l _CXBase(a4),a6
jsr _LVOCopyBrokerList(a6)
move.l _DOSBase(a4),a6
move.l #template,d1
lea Argument(a4),a5
move.l a5,d2
moveq #0,d3
jsr _LVOReadArgs(a6)
move.l d0,_Args(a4)
bne.s ArgsOK
jsr _LVOIoErr(a6)
move.l d0,d1
move.l d3,d2
jsr _LVOPrintFault(a6)
quit lea _CXList(a4),a0
tst.l LH_TAILPRED(a0)
beq.s quit0
move.l _CXBase(a4),a6
jsr _LVOFreeBrokerList(a6)
quit0 move.l $4.w,a6
move.l _DOSBase(a4),d0
beq.s quit1
bsr.s quit2
quit1 move.l _CXBase(a4),d0
beq.s quit3
quit2 move.l d0,a1
jsr _LVOCloseLibrary(a6)
quit3 moveq #0,d0
rts
Error moveq #ERROR_REQUIRED_ARG_MISSING,d1
moveq #0,d2
move.l _DOSBase(a4),a6
jsr _LVOPrintFault(a6)
NoCMD move.l _Args(a4),d1
move.l _DOSBase(a4),a6
jsr _LVOFreeArgs(a6)
bra.s quit
ArgsOK move.l (a5)+,a2
movem.l (a5)+,d4-d5
moveq #0,d7
lea CXCMD_Table(pc),a1
moveq #5,d1
.loop move.w (a1)+,d7
tst.l (a5)+
bne.s DoCMD
dbf d1,.loop
move.w d4,d0
or.w d5,d0
beq.s Error
move.l a2,d0
beq ListCXA
moveq #-1,d7
DoCMD move.l $4.w,a6
move.l _Parsed(a4),d0
beq.s .cont
move.l d0,a1
jsr _LVOFreeVec(a6)
clr.l _Parsed(a4)
.cont move.l (a2)+,d6
beq.s NoCMD
lea _CXList(a4),a3
move.l d6,a0
moveq #-1,d0
.count addq.l #1,d0
tst.b (a0)+
bne.s .count
move.l d0,d3
add.l d3,d3
add.l d0,d3
move.l d3,d0
moveq #MEMF_PUBLIC,d1
jsr _LVOAllocVec(a6)
move.l d0,_Parsed(a4)
beq.s .cont
move.l _DOSBase(a4),a6
move.l d6,d1
move.l d0,d2
jsr _LVOParsePatternNoCase(a6)
tst.l d0
bmi.s DoCMD
.loop move.l LN_SUCC(a3),d0
beq.s DoCMD
move.l d0,a3
tst.l LN_SUCC(a3)
beq.s DoCMD
move.l _Parsed(a4),d1
lea bc_Name(a3),a0
move.l a0,d2
jsr _LVOMatchPatternNoCase(a6)
tst.l d0
beq.s .loop
tst.l d7
bmi.s .skip3
tst.w d7
bpl.s .skip0
moveq #CXCMD_ENABLE,d7
btst #1,bc_Flags+1(a3)
beq.s .skip0
moveq #CXCMD_DISABLE,d7
.skip0 move.l d7,d0
lea bc_Name(a3),a0
move.l _CXBase(a4),a6
jsr _LVOBrokerCommand(a6)
move.l _DOSBase(a4),a6
tst.w d5
bne.s .skip1
tst.w d4
beq.s .loop
.skip1 cmpi.w #CXCMD_DISABLE,d7
bne.s .skip2
bclr #1,bc_Flags+1(a3)
bra.s .skip3
.skip2 cmpi.w #CXCMD_ENABLE,d7
bne.s .skip3
bset #1,bc_Flags+1(a3)
.skip3 move.l a3,a5
bsr.s ListCX
bra.s .loop
ListCXA moveq #0,d7
lea _CXList(a4),a5
prtloop move.l LN_SUCC(a5),d0
beq NoCMD
move.l d0,a5
tst.l LN_SUCC(a5)
beq NoCMD
bsr.s ListCX
bra.s prtloop
ListCX cmpi.w #CXCMD_KILL,d7
bne.s .skip0
pea NullStr(pc)
pea KillStr(pc)
bra.s .skip3
.skip0 move.w bc_Flags(a5),d0
lea GuiStr(pc),a0
btst #2,d0
bne.s .skip1
lea NoGuiStr(pc),a0
.skip1 move.l a0,-(sp)
lea ActiveStr(pc),a0
btst #1,d0
bne.s .skip2
lea InactiveStr(pc),a0
.skip2 move.l a0,-(sp)
.skip3 pea bc_Name(a5)
move.l a5,-(sp)
lea StringFmt1(pc),a0
move.l a0,d1
move.l sp,d2
jsr _LVOVPrintf(a6)
addq.w #8,sp
addq.w #8,sp
tst.w d5
beq.s .exit
pea bc_Descr(a5)
pea bc_Title(a5)
lea StringFmt2(pc),a0
move.l a0,d1
move.l sp,d2
jsr _LVOVPrintf(a6)
addq.w #8,sp
.exit rts
CXCMD_Table dc.w CXCMD_APPEAR
dc.w CXCMD_DISAPPEAR
dc.w CXCMD_ENABLE
dc.w CXCMD_DISABLE
dc.w CXCMD_KILL
dc.w -1
dosname dc.b "dos.library",0
even
cxname dc.b "commodities.library",0
even
template dc.b "CX_NAME/M,L=LIST/S,V=VERBOSE/S,P=POPUP/S,H=HIDE/S,E=ENABLE/S,D=DISABLE/S,R=REMOVE/S,T=TOGGLE/S",0
even
dc.b "$VER: HandleCX 1.3 (19.3.95) by Martin Berndt",0
even
StringFmt1 dc.b "$%08lx: %-24s %-8s %s",10,0
even
StringFmt2 dc.b ": %s (%s)",10,0
even
ActiveStr dc.b "ACTIVE",0
even
InactiveStr dc.b "INACTIVE",0
even
GuiStr dc.b "GUI",0
even
NoGuiStr dc.b "NOGUI",0
even
KillStr dc.b "KILLED"
NullStr dc.b 0
even
section Vars,BSS
rsreset
_DOSBase rs.l 1
_CXBase rs.l 1
_Args rs.l 1
_CXList rs.b LH_SIZE
_Parsed rs.l 1
Argument rs.l 9
SIZEOF_Vars rs.w 0
VarBase ds.b SIZEOF_Vars
end