page@swan.ulowell.edu (Bob Page) (10/29/88)
Submitted-by: g35@dhdurz1.bitnet (Guenther Werner) Posting-number: Volume 2, Issue 35 Archive-name: kernel/xoper12.1 Xoper is a freeware program to display and to control system activity. New commands in V1.2: Snoop (mem), Capture, ClrCool, ClrWarm, ClrCold. Added CPU usage by task. Cancel command has been rewritten, some minor bugs removed. [join Xoper.a1 and Xoper.a2 to get the complete source code. ..Bob] # This is a shell archive. Remove anything before this line # then unpack it by saving it in a file and typing "sh file" # (Files unpacked will be owned by you and have default permissions). # This archive contains the following files: # Xoper.a2 # Xoper.doc # if `test ! -s Xoper.a2` then echo "writing Xoper.a2" cat > Xoper.a2 << '\Rogue\Monster\' bne.s cleanit move.b #1,background bsr installh cleanit tst.l fileptr beq.s ib1 move.l window(PC),a0 move.w 4(a0),window_l move.w 6(a0),window_t move.w 8(a0),window_w move.w 10(a0),window_h move.l fileptr(PC),d1 CALL Close,dosbase(PC) clr.l fileptr ib1 clr.b running move.l mysignal(PC),d0 CALL Wait,_SysBase(PC) move.b #1,running bra restart ;fill all unused memory-chunks with a longword clear bsr readhex tst.b d7 beq syntax move.l _SysBase(PC),a0 clr.l parmtxt lea 322(a0),a0 move.w #$4000,$dff09a clr1 move.l 0(a0),a0 tst.l 0(a0) beq.s clr4 move.l 16(a0),a1 clr2 tst.l 0(a1) beq.s clr1 add.l #1,parmtxt move.l 4(a1),d1 sub.l #8,d1 beq.s clr31 lsr.l #2,d1 subq.l #1,d1 lea 8(a1),a2 clr3 move.l d0,(a2)+ dbf d1,clr3 clr31 move.l 0(a1),a1 bra.s clr2 clr4 move.w #-$4000,$dff09a move.l parmtxt(PC),d0 bsr bytedec move.l #clrtxt,d0 bra putnam ;find a named node ;d7 = number of lists to search through ;a4 = pointer to the first entry in the ; list-offset-table ;a5 = pointer to name ;returns: ;d7 = TRUE/FALSE 1/0 ;d0 = node findnam cmp.b #'$',0(a5) bne.s fn2 move.l d7,d2 move.l a5,a0 bsr readhex tst.b d7 beq.s fn6 move.l d2,d7 bsr tstnode tst.l d5 bne.s fn3 bra fn5 fn6 move.l d2,d7 fn2 move.l _SysBase(PC),a0 adda.l 0(a4),a0 move.l a5,a1 fn4 CALL FindName,_SysBase(PC) tst.l d0 bne.s fn1 lea 4(a4),a4 dbf d7,fn2 fn5 move.l #namerr,d0 bsr putstr move.l a5,d0 bsr putnam clr.b d7 rts fn1 move.b procnum(PC),d2 beq.s fn3 move.l d0,a0 cmp.b 143(a0),d2 bne.s fn4 fn3 moveq.l #1,d7 rts ;list-offset-table TRuNode dc.l 276 TReNode dc.l 406 TWaNode dc.l 420 DevNode dc.l 350 LibNode dc.l 378 ResNode dc.l 336 MemNode dc.l 322 PorNode dc.l 392 SemNode dc.l 532 ;Node has been entered in hex. Check if this node exsists tstnode move.l d0,d1 and.l #$ff000001,d1 beq.s inrange move.l #adrerr,d0 bsr putnam clr.l d5 rts inrange movem.l d7/a4,-(a7) cmp.l #TRuNode,a4 bne.s inrange1 move.l _SysBase(PC),a0 cmp.l 276(a0),d0 beq.s nodefound subq #1,d7 lea 4(a4),a4 inrange1 move.w #$4000,$dff09a getlist move.l _SysBase(PC),a0 add.l 0(a4),a0 nxtnode tst.l 0(a0) beq.s nxtlist cmp.l a0,d0 beq.s nodefound move.l 0(a0),a0 bra.s nxtnode nxtlist lea 4(a4),a4 dbf d7,getlist move.w #-$4000,$dff09a movem.l d0/d7/a4,-(a7) move.l #noderr,d0 bsr putnam bsr readline movem.l (a7)+,d0/d7/a4 or.b #32,dummy cmp.b #'y',dummy beq.s nodefound1 clr.l d5 movem.l (a7)+,d7/a4 rts nodefound move.w #-$4000,$dff09a nodefound1 move.b #1,d5 etst movem.l (a7)+,d7/a0 rts ;clear our window clearscr move.l #cls,d2 move.l fileptr,d1 moveq.l #6,d3 CALL Write,dosbase(PC) rts ;allocate FileInfoBlock allocfinfo move.l #260,d0 clr.l d1 CALL AllocMem,_SysBase(PC) move.l d0,finfoptr rts ;free FileInfoBlock freefinfo move.l #260,d0 move.l finfoptr,a1 CALL FreeMem,_SysBase(PC) rts ;Examine ,d0=Lock getfinfo move.l d0,d1 move.l finfoptr,d2 CALL Examine,dosbase(PC) rts ;construct a Pathname from a lock ;d0=Lock ,resulting string is written to window getpath movem.l d1-d7/a0-a6,-(a7) move.l d0,d1 CALL DupLock,dosbase(PC) lea out,a4 clr.b -(a4) gp0 tst.l d0 beq.s putall move.l d0,-(a7) bsr getfinfo move.l finfoptr,a0 move.l 4(a0),d4 lea 8(a0),a0 bsr strlen lea -1(a4),a5 tst.l d4 bmi.s nodir move.b #'/',-(a4) nodir subq #1,d0 bmi.s nofnam gp1 move.b 0(a0,d0),-(a4) dbf d0,gp1 nofnam move.l 0(a7),d1 CALL ParentDir,dosbase(PC) move.l d0,d4 move.l (a7)+,d1 CALL UnLock,dosbase(PC) move.l d4,d0 bra gp0 putall cmp.b #'/',0(a5) bne.s gp2 move.b #':',0(a5) gp2 move.l a4,d0 bsr putnam movem.l (a7)+,d1-d7/a0-a6 rts strlen move.l a0,-(a7) move.l #-1,d0 strl2 addq.l #1,d0 tst.b (a0)+ bne.s strl2 move.l (a7)+,a0 rts ;write a title and underline ;a0 = pointer to text puthead1 bsr strlen move.l d0,d5 move.l a0,d0 bra putstr puthead2 bsr strlen add.l d0,d5 bra.s ph2 puthead bsr strlen move.l d0,d5 ph2 move.l a0,d0 bsr putnam lea out,a0 move.l a0,d0 ph1 move.b #'-',(a0)+ dbf d5,ph1 move.b #$9b,(a0)+ move.b #'K',(a0)+ move.b #$0a,(a0)+ clr.b 0(a0) bra putstr ;move cursor to a column ;d0 = current position ;d1 = column tab move.l a3,-(a7) lea out,a3 sp5 cmp.b d1,d0 bcc.s sp4 move.b #' ',0(a3,d0) addq.b #1,d0 bra.s sp5 sp4 move.l d1,ptr move.l (a7)+,a3 rts ;convert ascii to byte ;a0 = pointer to text ;d0 = byte getnum cmp.b #'$',0(a0) bne.s isdec bsr readhex move.l d0,d2 rts isdec clr.w d2 clr.w d3 clr.b d6 clr.b d7 cmp.b #'-',0(a0) bne.s gn1 lea 1(a0),a0 moveq.l #1,d6 gn1 move.b (a0)+,d3 cmp.b #'9',d3 bhi.s gn2 cmp.b #'0',d3 bcs.s gn2 moveq.l #1,d7 and.b #$f,d3 muls #10,d2 add.w d3,d2 bra.s gn1 gn2 tst.b d6 beq.s gn3 neg.w d2 gn3 tst.b d7 bne.s gn4 lea -1(a0),a0 gn4 rts ;convert hex to longword ;a0 = pointer to text ;returns d0=value ;d7 = ok/error 1/0 readhex movem.l d1-d6/a1-a5,-(a7) moveq.b #1,d7 cmp.b #'$',0(a0) bne.s rh3 lea 1(a0),a0 rh3 clr.l d0 lea hextab(pc),a1 rh0 move.b (a0)+,d3 moveq.l #15,d2 rh1 cmp.b 0(a1,d2),d3 beq.s rh2 dbf d2,rh1 bra rhend rh2 lsl.l #4,d0 or.b d2,d0 bra.s rh0 rhend tst.b d3 beq.s rhok cmpi.b #10,d3 beq.s rhok cmpi.b #' ',d3 beq.s rhok clr.l d7 rhok movem.l (a7)+,d1-d6/a1-a5 rts ;skip blanks ;a0 pointer to text ; returns a0 = new pointer position kllblnks cmpi.b #' ',0(a0) bne.s gn4 lea 1(a0),a0 bra.s kllblnks ; exit program. If background flag is set, wait for ; amiga-amiga-x stopall lea 4(a7),a7 bra exitall exit tst.b background bne quithold exitall move.l stplist(PC),a3 tst.l 0(a3) beq.s ex0 move.l a3,d0 bsr waok bra.s exitall ex0 tst.b background beq.s ex1 bsr removeh ex1 move.l _SysBase(PC),a1 move.l #_LVOSwitch,a0 move.l oldswitch,d0 CALL SetFunction,_SysBase(PC) move.l replyport,-(a7) LIBCALL DeletePort lea 4(a7),a7 move.l fileptr(PC),d1 CALL Close,dosbase(PC) IFND DEBUG CALL Forbid,_SysBase(PC) move.l wbmsg(PC),d0 beq.s todos move.l d0,a1 CALL ReplyMsg,_SysBase(PC) clr.l d0 rts todos move.l myseg(PC),d1 CALL UnLoadSeg,dosbase(PC) ENDC clr.l d1 CALL Exit,dosbase(PC) ;print a bcpl-string ;d0 = bcpl-pointer to bcpl-string putbcpl movem.l d3/a0-a1,-(a7) tst.l d0 beq.s pb1 lsl.l #2,d0 move.l d0,a1 clr.l d3 move.b (a1)+,d3 move.l ptr(PC),d0 lea out,a0 pb2 move.b (a1)+,0(a0,d0) addq.b #1,d0 dbf d3,pb2 move.l d0,ptr pb1 movem.l (a7)+,d3/a0-a1 rts ;compare strings ;a0/a1 = pointers to string ;returns d0 = true(0) false(1) strcmp movem.l a0-a1,-(a7) clr.l d0 src2 move.b (a0)+,d0 beq.s src1 cmp.b #10,d0 beq.s src1 cmp.b (a1)+,d0 beq.s src2 bra.s src3 src1 move.b 0(a1),d0 src3 movem.l (a7)+,a0-a1 rts ;compare bcpl string with string ;a0 = pointer to string ;a2 = bcpl-pointer to bcpl-string ;returns d0 = true(0) false(1) strbcmp movem.l d1/a0/a2,-(a7) clr.l d0 clr.l d1 adda.l a2,a2 adda.l a2,a2 move.b (a2)+,d1 beq.s stb1 subq #1,d1 stb2 cmp.b (a2)+,(a0)+ bne.s stb1 dbf d1,stb2 moveq #1,d0 stb1 movem.l (a7)+,d1/a0/a2 rts ;concat strings ;a0 = pointer to string ;a1 = pointer to string to be appended ;returns d0 = strlen strcat movem.l d1/a0-a1,-(a7) bsr strlen move.l d0,d1 exg a0,a1 bsr strlen adda.w d1,a1 stc1 move.b (a0)+,(a1)+ dbf d0,stc1 move.l a1,d0 movem.l (a7)+,d1/a0-a1 sub.l a0,d0 rts ;convert long to decimal ;d0 = value ;d3 bit 0 = left/right justified ;d3 bit 1 = write/leave ;returns string in 'buffer' longdec movem.l d1-d2/a1-a2,-(a7) lea binarea+8(PC),a1 move.l #' ',-8(a1) move.l #' ',-4(a1) clr.b 0(a1) lea -1(a1),a1 cmp #2,d3 bne.s ld5 clr.b 0(a1) ld5 moveq #1,d2 ld2 addq #1,d2 moveq #$a,d1 bsr div addi.l #$30,d1 move.b d1,-(a1) tst.l d0 bne.s ld2 btst #0,d3 bne.s ld1 lea binarea(PC),a2 ld3 move.b 0(a1),(a2)+ move.b #' ',(a1)+ dbf d2,ld3 ld1 cmp #2,d3 beq.s ld4 move.l #binarea,d0 bsr putstr ld4 movem.l (a7)+,d1-d2/a1-a2 rts ;write UBYTE ;d3 = value bytedec move.l #dezimal,d0 pm1 bsr dec bra putstr ;write signed byte ;d3 = value plusmins move.l #minus+1,d0 move.w #$2020,minus tst.b d3 bpl.s pm1 neg.b d3 jsr dec move.b #'-',-(a3) bra.s putstr dec move.l #$20202020,dezimal clr.l d4 and.l #$ff,d3 lea dezimal+3(PC),a3 bloop tst.b d3 beq.s bend divu #10,d3 swap d3 ori.b #48,d3 move.b d3,-(a3) clr.w d3 swap d3 bra.s bloop bend cmpa.l #dezimal+3,a3 bne nixfirst move.b #'0',-(a3) nixfirst rts ;write a string, move cursor into next line ;d0 = pointer to text putnam bsr putstr tst.b d0 beq.s ncr bsr newline ncr rts ;write one char ;d0 = char putchar movem.l d1/a0,-(a7) move.l ptr(PC),d1 lea out,a0 move.b d0,0(a0,d1) add.l #1,ptr movem.l (a7)+,d1/a0 rts ;write a string, strings are only written when they end with CR ;d0 = pointer to string ;returns d0 = cursor position putstr movem.l d1-d7/a0-a6,-(a7) move.b #1,printed move.l d0,a2 lea out,a3 move.l ptr(PC),d0 cmp.l #0,a2 beq prend pst1 move.b (a2)+,d1 cmpi.b #13,d1 beq pst1 move.b d1,0(a3,d0) beq prend addq #1,d0 cmpi.b #$0a,d1 bne.s pst1 move.l d0,d3 move.l a3,d2 move.l fileptr,d1 CALL Write,dosbase(PC) clr.l d0 tst.b morefl beq.s pst1 tst.b mnflag beq.s pst1 add.b #1,row move.b row(PC),d1 cmp.b rows,d1 bne.s pst1 move.l #6,d3 move.l fileptr,d1 move.l #more,d2 CALL Write,dosbase(PC) bsr con bsr readline bsr raw clr.b row move.l #4,d3 move.l fileptr,d1 move.l #thisline,d2 CALL Write,dosbase(PC) clr.l d0 bra pst1 prend move.l d0,ptr movem.l (a7)+,d1-d7/a0-a6 rts ;Write 8 byte hex value ;d0 = value hex8 movem.l d1-d7/a0-a6,-(a7) moveq.l #7,d5 lea hex8area(PC),a1 bra hx1 ;Write 6 byte hex value ;d0 = value hexa movem.l d1-d7/a0-a6,-(a7) moveq.l #5,d5 lea hexarea(PC),a1 hx1 lea hextab(PC),a0 clr.l d2 hexloop move.b d0,d2 and.b #15,d2 move.b 0(a0,d2),0(a1,d5) lsr.l #4,d0 dbf d5,hexloop move.l a1,d0 movem.l (a7)+,d1-d7/a0-a6 bra putstr ;Convert/write byte into binary string ;d0 = value bin movem.l d1-d7/a0-a6,-(a7) moveq.l #7,d4 lea binarea(PC),a0 binloop moveq.l #'0'/2,d1 roxr.b #1,d0 roxl.b #1,d1 move.b d1,0(a0,d4) dbf d4,binloop move.l a0,d0 movem.l (a7)+,d1-d7/a0-a6 bra putstr ;read one line of input string readline move.l fileptr,d1 move.l #dummy,d2 moveq.l #80,d3 CALL Read,dosbase(PC) rts ;switch console to con: mode & empty input buffer con bsr cmdcon move.l #50,d2 move.l fileptr,d1 CALL WaitForChar,dosbase(PC) beq.s conend bsr readline conend rts cmdcon clr.l dp_Arg1 move.l conmsg,a0 move.l #994,dp_Type bra.s cons1 ;switch console window to raw mode raw move.l conmsg,a0 move.l #994,dp_Type move.l #-1,dp_Arg1 ;send a packet ;a0 = msgport ;dp_Type and dp_Arg1 have to be inizialized cons1 movem.l d0-d7/a0-a6,-(a7) move.l #dp_Link,LN_NAME move.l #mypacket,dp_Link move.l replyport,dp_Port lea mypacket,a1 CALL PutMsg,_SysBase(PC) move.l replyport,a0 CALL WaitPort,_SysBase(PC) movem.l (a7)+,d0-d7/a0-a6 rts ;32-bit division ;d0 / d1 ;returns d0 div movem.l d2-d3,-(a7) swap d1 move.w d1,d2 bne.s div1 swap d0 swap d1 swap d2 move.w d0,d2 beq.s div2 divu d1,d2 move.w d2,d0 div2 swap d0 move.w d0,d2 divu d1,d2 move.w d2,d0 swap d2 move.w d2,d1 bra div8 div1 moveq #$10,d3 cmpi.w #$80,d1 bcc.s div3 rol.l #8,d1 subq.w #8,d3 div3 cmpi.w #$800,d1 bcc.s div4 rol.l #4,d1 subq.w #4,d3 div4 cmpi.w #$2000,d1 bcc.s div5 rol.l #2,d1 subq.w #2,d3 div5 tst.w d1 bmi.s div6 rol.l #1,d1 subq.w #1,d3 div6 move.w d0,d2 lsr.l d3,d0 swap d2 clr.w d2 lsr.l d3,d2 swap d3 divu d1,d0 move.w d0,d3 move.w d2,d0 move.w d3,d2 swap d1 mulu d1,d2 sub.l d2,d0 bcc.s div7 subq.w #1,d3 add.l d1,d0 div7 moveq #0,d1 move.w d3,d1 swap d3 rol.l d3,d0 swap d0 exg d1,d0 div8 movem.l (a7)+,d2-d3 rts ;install a input-handler installh pea 0 pea 0 LIBCALL CreatePort lea 8(a7),a7 move.l d0,InputMsg move.l d0,-(a7) LIBCALL CreateStdIO lea 4(a7),a7 move.l d0,InRequest move.l d0,a1 lea devicenam(PC),a0 clr.l d0 clr.l d1 CALL OpenDevice,_SysBase(PC) move.l d0,devstatus movea.l InRequest(PC),a1 move.l #InInterrupt,40(a1) move.w #9,28(a1) CALL DoIO,_SysBase(PC) move.l d0,iostatus move.l #-1,d0 CALL AllocSignal,_SysBase(PC) clr.l d1 bset d0,d1 move.l d1,mysignal rts ;remove handler removeh movea.l InRequest(PC),a1 move.l #InInterrupt,40(a1) move.w #10,28(a1) CALL DoIO,_SysBase(PC) movea.l InRequest(PC),a1 CALL CloseDevice,_SysBase(PC) move.l InRequest,-(a7) LIBCALL DeleteStdIO lea 4(a7),a7 move.l InputMsg,-(a7) LIBCALL DeletePort lea 4(a7),a7 rts ;this is the handler, it checks if amiga-amiga-x ;has been pressed and signals it to our task Keyhandler tst.b running bne.s endhandler cmp.b #1,4(a0) bne.s endhandler move.w 8(a0),d0 andi.w #$c0,d0 cmpi.w #$c0,d0 bne.s endhandler cmp.w #$32,6(a0) bne.s endhandler wakeup move.l a0,-(a7) movea.l mytask(PC),a1 move.l mysignal(PC),d0 CALL Signal,_SysBase(PC) move.l (a7)+,a0 clr.b 4(a0) endhandler move.l a0,d0 rts snoop bsr nodenam moveq.l #2,d7 lea TRuNode(PC),a4 bsr findnam tst.b d7 beq tm6 move.l d0,captask pea 0 pea memportname LIBCALL CreatePort lea 8(a7),a7 move.l d0,snoopport beq tm6 lea snoophead(PC),a0 bsr puthead move.l _SysBase(PC),a1 move.l -196(a1),oldalloc move.l -208(a1),oldfree move.l #capmalloc,d0 move.l #-198,a0 CALL SetFunction,_SysBase(PC) move.l _SysBase(PC),a1 move.l #capmfree,d0 move.l #-210,a0 CALL SetFunction,_SysBase(PC) clr.b bool clr.b cbreak waitmem move.l snoopport(PC),a0 move.l #$1000,d0 clr.l d1 move.b 15(a0),d1 bset d1,d0 CALL Wait,_SysBase(PC) btst #12,d0 beq.s tm7 move.b #1,cbreak tm7 move.l mytask(PC),a0 move.l snoopport(PC),a0 CALL GetMsg,_SysBase(PC) tst.l d0 bne tm8 tst.b cbreak bne snoopend bra waitmem tm8 move.l d0,a3 move.l 20(a3),d3 btst #31,d3 beq freed move.l #allok,d0 bsr putstr lea memname(PC),a2 lea membit(PC),a4 move.l #4,d5 tm2 move.l 0(a4),d4 btst d4,d3 beq.s tm1 move.l 0(a2),d0 bsr putstr tm1 lea 4(a2),a2 lea 4(a4),a4 dbf d5,tm2 move.l #26,d1 bsr tab move.l 24(a3),d0 move.l d0,d3 bsr hexa move.l 28(a3),d0 bne.s tm3 move.l #failed,d0 bsr putstr move.l #47,d1 bsr tab bra tm4 tm3 bsr hexa move.l 28(a3),d0 add.l d3,d0 bsr hexa bra tm4 freed move.l #free,d0 bsr putstr move.b #'-',d0 move.l #18,d1 tm9 bsr putchar dbf d1,tm9 move.b #' ',d0 bsr putchar move.l d3,d0 bsr hexa move.l 24(a3),d0 bsr hexa move.l 24(a3),d0 add.l d3,d0 bsr hexa tm4 move.l 32(a3),d0 bsr hexa bsr newline move.l #36,d0 move.l a3,a1 CALL FreeMem,_SysBase(PC) bra tm7 snoopend move.l _SysBase(PC),a1 move.l oldalloc(PC),d0 move.l #-198,a0 CALL SetFunction,_SysBase(PC) move.l _SysBase(PC),a1 move.l oldfree,d0 move.l #-210,a0 CALL SetFunction,_SysBase(PC) move.l snoopport,-(a7) LIBCALL DeletePort lea 4(a7),a7 tm6 rts memname dc.l memlarg,memclr,memfast,memchip,mempubl membit dc.l 17,16,2,1,0 capmalloc movem.l d0-d7/a0-a6,-(a7) move.l _SysBase(PC),a6 move.l 276(a6),d4 cmp.l captask(PC),d4 bne.s capm1 tst.b bool bne capm1 move.b #1,bool move.l d0,d5 move.l d1,d6 bsr allocmsg beq capm2 bset #31,d6 move.l d6,20(a1) move.l d5,24(a1) move.l 60(a7),32(a1) move.l a1,remembr movem.l (a7)+,d0-d7/a0-a6 bsr memalloc movem.l d0-d7/a0-a6,-(a7) move.l remembr(PC),a1 move.l d0,28(a1) move.l snoopport,a0 move.b #5,8(a1) CALL PutMsg,_SysBase(PC) clr.b bool movem.l (a7)+,d0-d7/a0-a6 rts capm2 clr.b bool capm1 movem.l (a7)+,d0-d7/a0-a6 memalloc dc.w $4ef9 oldalloc dc.l 0 capmfree movem.l d0-d7/a0-a6,-(a7) move.l _SysBase(PC),a6 move.l 276(a6),d4 cmp.l captask(PC),d4 bne.s capf1 tst.b bool bne.s capf1 move.b #1,bool move.l a1,d5 move.l d0,d6 bsr allocmsg beq.s capf2 move.l d6,20(a1) move.l d5,24(a1) move.l 60(a7),32(a1) move.l snoopport,a0 move.b #5,8(a1) CALL PutMsg,_SysBase(PC) capf2 clr.b bool capf1 movem.l (a7)+,d0-d7/a0-a6 dc.w $4ef9 oldfree dc.l 0 allocmsg move.l #36,d0 move.l #65536,d1 bsr memalloc move.l d0,a1 tst.l d0 rts myswitch movem.l d0-d1/a0,-(a7) move.l _SysBase(PC),a0 move.l 276(a0),d0 move.l tasksnum(PC),d1 lea cputime,a0 subq.l #1,d1 bmi.s swadd sw0 cmp.l 0(a0),d0 beq.s swi1 lea 8(a0),a0 dbf d1,sw0 bra.s swadd swi1 add.l #1,4(a0) swgo movem.l (a7)+,d0-d1/a0 dc.w $4ef9 oldswitch dc.l 0 swadd cmp.l #50,tasksnum bge.s swgo add.l #1,tasksnum move.l d0,0(a0) move.l #1,4(a0) bra.s swgo dosbase dc.l 0 intuibase dc.l 0 gfxbase dc.l 0 window dc.l 0 parmtxt dc.l 0 fileptr dc.l 0 conmsg dc.l 0 ptr dc.l 0 oldidl dc.l 0 olddisp dc.l 0 myseg dc.l 0 mysignal dc.l 0 iostatus dc.l -1 devstatus dc.l -1 cancelbit dc.l 0 cancelbnum dc.l 0 _SysBase dc.l 0 InputMsg dc.l 0 InRequest dc.l 0 startmess dc.l 0 savedat dc.l 0 mytask dc.l 0 wbmsg dc.l 0 pointer dc.l 0 replyport dc.l 0 finfoptr dc.l 0 dispatches dc.l 0 maxdisp dc.l 0 wbaddr dc.l 0 remembr dc.l 0 remembr2 dc.l 0 captask dc.l 0 snoopport dc.l 0 tasksnum dc.l 0 stplist dc.l lh_tail lh_tail dc.l 0 dc.l stplist dc.b 1 dc.b 0 InInterrupt dc.l 0 ;ln_Succ dc.l 0 ;ln_Pred dc.b 2 ;ln_Type dc.b 60 ;ln_Pri dc.l 0 ;ln_Name dc.l 0 ;is_Data dc.l Keyhandler ;is_Code() window_l dc.w 0 window_t dc.w 0 window_w dc.w 550 window_h dc.w 200 binarea dc.b ' ',0 EVEN minus dc.b ' ' dezimal dc.b ' ' blnk dc.b ' ',0 entries dc.b 0 timeout dc.b 5 procnum dc.b 0 running dc.b 0 newpri dc.b 0 tasktyp dc.b 0 background dc.b 0 bool dc.b 0 printed dc.b 0 cbreak dc.b 0 rows dc.b 0 row dc.b 0 usageflag dc.b 0 morefl dc.b 1 mnflag dc.b 1 tports dc.b 1 params dc.b 'tsdlrempi' parmnum equ *-params t2header dc.b ' ID STATE SIGALLOC SIGWAIT SIGRECVD PC TASKNAME',0 theader dc.b ' ID TYPE STATE PRI CPUSE NUM TASKNAME',0 lheader dc.b ' NODE CNT VER REV FLAGS ',0 libnam dc.b 'LIBRARY NAME',0 devnam dc.b 'DEVICE NAME',0 resnam dc.b 'RESOURCE NAME',0 mheader dc.b 'LOWER UPPER FREE ATTR PRI HUNK NAME',0 nxtline dc.b $9b,'K' cr dc.b 10,0 iheader dc.b ' NODE DATA CODE PRI TYPE INTERRUPT NAME',0 rheader dc.b ' ADDR PRI FLAGS VER TYPE RESIDENT NAME',0 pheader dc.b ' NODE PORTNAME FLAGS SIGBT NUM SIGTASK',0 hunkheader dc.b ' BCPL DATA LENGTH',0 ddheader dc.b 'DEVICE HDS SECTORS TRACKS BUFFERS STATE HANDLER',0 cdheader dc.b 'PROCESSNAME CURRENT DIRECTORY',0 ofheader dc.b ' LOCK ACCESS SIZE PATH/FILENAME',0 scrheader dc.b 'NUM ADDR TITLE',0 fohead dc.b ' NODE CNT Y X TYPE LO HI NAME',0 kickhead dc.b 'START END LENGTH',0 snoophead dc.b 'ACTION REQUIREMENTS LENGTH FROM TO CALLER',0 access dc.b ' Read ',0 dc.b ' Write ',0 romfnt dc.b 'Rom ',0 diskfnt dc.b 'Disk ',0 wbname dc.b 'Workbench',0 status dc.b 'Added ',0 dc.b 'Running ',0 dc.b 'Ready ',0 dc.b 'Waiting ',0 dc.b 'Exeption ',0 dc.b 'Removed ',0 dc.b 'Freezed ',0 dc.b 'Freezed ',0 type dc.b 'Unknown ',0 dc.b 'Task ',0 dc.b 'Interrupt ',0 dc.b 'Device ',0 dc.b 'Msgport ',0 dc.b 'Message ',0 dc.b 'Freemsg ',0 dc.b 'Replymsg ',0 dc.b 'Resource ',0 dc.b 'Library ',0 dc.b 'Memory ',0 dc.b 'Softint ',0 dc.b 'Font ',0 dc.b 'Process ',0 dc.b 'Semaphore ',0 mp_flags dc.b 'Signal ',0 dc.b 'Softint ',0 dc.b 'Ignore ',0 windowname dc.b 'Xoper V1.2 ) 1988 Werner Gunther',0 newname dc.b '-Xoper-',0 memportname dc.b 'MemSnoop',0 cmdnum set 0 commds ADDCMD 'time' ADDCMD 'taskpri' ADDCMD 'info' ADDCMD 'pri' ADDCMD 'flush' ADDCMD 'freeze' ADDCMD 'warm' ADDCMD 'signal' ADDCMD 'break' ADDCMD 'alert' ADDCMD 'lastalert' ADDCMD 'hold' ADDCMD 'exit' ADDCMD 'clear' ADDCMD 'cancel' ADDCMD 'more' ADDCMD 'taskports' ADDCMD 'hunks' ADDCMD 'devices' ADDCMD 'openlib' ADDCMD 'closelib' ADDCMD 'currentdir' ADDCMD 'cd' ADDCMD 'mypri' ADDCMD 'files' ADDCMD 'locks' ADDCMD 'unlock' ADDCMD 'screens' ADDCMD 'windows' ADDCMD 'closescreen' ADDCMD 'closewindow' ADDCMD 'fonts' ADDCMD 'windowfonts' ADDCMD 'lockdrive' ADDCMD 'freedrive' ADDCMD 'capture' ADDCMD 'clrcold' ADDCMD 'clrcool' ADDCMD 'clrwarm' ADDCMD 'snoop' ADDCMD 'usage' hex8area dc.b ' ' hexarea dc.b ' ',0 hextab dc.b '0123456789abcdef' infoh2 dc.b 'Dispatches:',0 infoh1 dc.b 'CPU:',0 infoh3 dc.b 'CPU activity: ',0 infoh6 dc.b 'Total:',0 infoh4 dc.b '% ',0 cpu0 dc.b '68000',0 cpu1 dc.b '68010',0 cpu2 dc.b '68020',0 cpu3 dc.b '/68881',0 syst dc.b 'DF0:',0 devload dc.b 'loaded ',0 devnload dc.b 'unloaded ',0 prompt dc.b $9b,'J','->',$9b,$20,$70 cls dc.b $9b,'0 ',$70,$9b,'H' getwin dc.b $9b,$30,$20,$71 thisline dc.b $9b,$46,$9b,$4b notfile dc.b '--- ------- ------- ------- ',0 ganzlongnix dc.b '-' longnix dc.b '----' nix dc.b '--- ',0 noinfo dc.b 'No Info on ',0 namerr dc.b 'Unable to find ',0 adrerr dc.b 'Address Error!',10,0 noderr dc.b 'Can`t find this Node. Continue ? (Y/N)',0 listerr dc.b 'Unable to find ListHeader. Sort aborted.',0 noguru dc.b 'No Alert, shall I produce one ?',0 gurutxt dc.b 'Guru Meditation #',0 clrtxt dc.b 'Memory Hunks cleared.',0 canerr0 dc.b 'Process is not a CLI-task',10 dc.b 'Has it been started from Workbench ? (Y/N)',10,0 canerr1 dc.b 'Process was created by CreateProc()',10 dc.b 'Shall I UnLoad() ? (Y/N)',10,0 unloaderr dc.b 'Arrrgh.. can`t find segments, aborting',0 noprocs dc.b 'Not a Process.',0 notload dc.b 'No program loaded.',0 cliprocs dc.b 'Cli-Process',0 procloaded dc.b 'Loaded as a command: ',0 segloaded dc.b 'Created by CreateProc()',0 coldtxt dc.b 'Cold Capture: ',0 cooltxt dc.b 'Cool Capture: ',0 warmtxt dc.b 'Warm Capture: ',0 kicktxt dc.b 'KickMem : ',0 unset dc.b 'unset',0 intnames dc.b 'Serial Out ',0 dc.b 'Disk Block ',0 dc.b 'SoftInt ',0 dc.b 'CIAA ',0 dc.b 'Copper ',0 dc.b 'VBeam ',0 dc.b 'Blitter ',0 dc.b 'Audio Ch.0 ',0 dc.b 'Audio Ch.1 ',0 dc.b 'Audio Ch.2 ',0 dc.b 'Audio Ch.3 ',0 dc.b 'Serial In ',0 dc.b 'Disk Sync ',0 dc.b 'CIAB ',0 dc.b 'SoftInt ',0 dc.b 'NMI ',0 inttyp dc.b 0,0,1,1,1,1,0,0,0,0,0,0,0,1,1,1 devicenam dc.b 'input.device',0 memlarg dc.b 'LARGEST ',0 memclr dc.b 'CLEAR ',0 memfast dc.b 'FAST ',0 memchip dc.b 'CHIP ',0 mempubl dc.b 'PUBLIC ',0 failed dc.b 'Failed !',0 allok dc.b 'ALLOC: ',0 free dc.b 'FREE: ',0 synerr dc.b 'Syntax Error, type "?" for help',10,0 more dc.b '<MORE>' waittxt dc.b '<RETURN>',$9b,$4a wberr dc.b 'Can`t examine Workbench locks',0 dnotf dc.b 'Directory not found',0 notdir dc.b 'Not a directory',0 nomount dc.b ' not mounted.',0 dishelp dc.b 10,'Names are case sensitive and followd by a ":"',0 unlerr dc.b 'Lock not found',0 unl1 dc.b 'Lock is on ',0 unltxt dc.b 'Old lock was: ',0 unltxt2 dc.b 'Unlock ? (Y/N)',10,0 scnofound dc.b 'Screen not found.',0 winnofound dc.b 'Window not found.',0 stperr dc.b 'Task must be "READY" or "WAITING"',10,0 waerr dc.b 'Task must be "FREEZED"',10,0 onscr dc.b 'On Screen: ',0 usetxt dc.b $9b,'1mUSAGE:',$9b,'0m Xoper [T] [S] [L] [D] [R] [E] [M] [P] [I]',$9b,'K',10 dc.b 'OR Xoper -b',$9b,'K',10 dc.b $9b,'1mDISPLAY:',$9b,'0m',$9b,'K',10 dc.b '[T]asks [S]=taskstate [L]ibraries [D]evices [R]esources',$9b,'K',10 dc.b 'r[E]sident [M]emory [P]orts [I]nterrupts [Q]uit',$9b,'K',10 dc.b $9b,'1mCOMMANDS:',$9b,'0m',$9b,'K',10 dc.b 'Time <secs>',$9b,'K',10 dc.b 'Taskpri <priority> [processnum] <taskname>',$9b,'K',10 dc.b 'Mypri <priority>',$9b,'K',10 dc.b 'Signal <mask(hex)> [processnum] <taskname>',$9b,'K',10 dc.b 'Break [processnum] <taskname>',$9b,'K',10 dc.b 'Freeze|Warm [processnum] <taskname>',$9b,'K',10 dc.b 'Cancel [processnum] <taskname>',$9b,'K',10 dc.b 'Snoop [processnum] <taskname>',$9b,'K',10 dc.b 'Pri <priority> <nodename>',$9b,'K',10 dc.b 'Info <name>',$9b,'K',10 dc.b 'Clear <longword(hex)>',$9b,'K',10 dc.b 'Hunks [processnum] <procname>',$9b,'K',10 dc.b 'CD <directory> [processnum] <procname>',$9b,'K',10 dc.b 'Unlock <lock>',$9b,'K',10 dc.b 'Openlib | Closelib <libraryname>',$9b,'K',10 dc.b 'Closewindow| Closescreen <title>',$9b,'K',10 dc.b 'Lockdrive | Freedrive <DFn:>',$9b,'K',10 dc.b 'Flush,Devices,Currentdir,Files,Locks,Lastalert,More',$9b,'K',10 dc.b 'Taskports,Windows,Screens,Fonts,Windowfonts,Capture',$9b,'K',10 dc.b 'ClrCool,ClrCold,ClrWarm,Usage,Hold,Exit',$9b,'K',10 null dc.b 0 IFD DEBUG dosname dc.b 'dos.library',0 intuiname dc.b 'intuition.library',0 gfxname dc.b 'graphics.library',0 EVEN ENDC BSS blabla buffer ds.b 256 fname ds.b 284 out ds.b 80 dummy ds.b 80 in ds.b 80 cputime ds.b 400 mypacket BSS standardpacket LN_SUCC ds.l 1 LN_PRED ds.l 1 LN_TYPE ds.b 1 LN_PRI ds.b 1 LN_NAME ds.l 1 MP_FLAGS ds.b 1 MP_SIGBIT ds.b 1 MP_SIGTASK ds.l 1 MN_SIZE ds.w 1 LH_HEAD ds.l 1 LH_TAIL ds.l 1 LH_TAILPRED ds.l 1 LH_TYPE ds.b 1 LH_pad ds.b 1 dp_Link ds.l 1 dp_Port ds.l 1 dp_Type ds.l 1 dp_Res1 ds.l 1 dp_Res2 ds.l 1 dp_Arg1 ds.l 1 dp_Arg2 ds.l 1 dp_Arg3 ds.l 1 dp_Arg4 ds.l 1 dp_Arg5 ds.l 1 dp_Arg6 ds.l 1 dp_Arg7 ds.l 1 END \Rogue\Monster\ else echo "will not over write Xoper.a2" fi if [ `wc -c Xoper.a2 | awk '{printf $1}'` -ne 38075 ] then echo `wc -c Xoper.a2 | awk '{print "Got " $1 ", Expected " 38075}'` fi if `test ! -s Xoper.doc` then echo "writing Xoper.doc" cat > Xoper.doc << '\Rogue\Monster\' Xoper V1.0 Copyright (c) Werner Gunther 1988 Xoper is a freeware program to display and to control system activity. Permition is granted to freely distribute this program. -------------------------------------------------------------------------- Changes in V1.2: New commands: Snoop, Capture, ClrCool, ClrWarm, ClrCold. Added : CPU usage by task. Cancel command has been rewritten, some minor bugs removed. ------------------------------------------------------------------------- Starting Xoper from CLI: Xoper [T] [S] [L] [D] [R] [E] [M] [P] [I] These parameters are decribed below. For all those who like long Startup-Sequences, overcrowded memory and hot-keys enter Xoper -b This will install Xoper in background waiting for LeftAmiga-RightAmiga-X to pop up. In both cases you don't have to RUN or RUNBACK Xoper, it will always create its own process. Xoper Commands: --------------- Commands can be entered after the prompt '->', these are divided into two groups: Display commands: These are always single character entries and may be specified in any order, upper or lower case, with or w/o enbedded blanks, after the prompt or from CLI as parameters: T = Tasks (Default if Xoper is called without parameters) Task node (HEX), Display type, status, priority (decimal), CPU usage (percent), processnumber for Dos-Processes (decimal), taskname. S = Task Signals Task node (HEX), Allocated Signals (HEX), Signals the Task is waiting for (HEX), Signals received (HEX), Address of the next instruction to be executed (HEX). L = Libraries Base address (HEX), open count (decimal), version (decimal), revision (decimal), flags (binary), libraryname. D = Devices Base address (HEX), open count (decimal), version (decimal), revision (decimal), flags (binary), devicename. R = Resident Base address (HEX), priority (decimal), flags (binary), version (decimal), type, name. E = Resources (sorry) Base address (HEX), open count (decimal), version (decimal), revision (decimal), flags (binary), resource name. M = Memory Lower and upper bounds (HEX), bytes free (decimal), attributes, priority (decimal), hunk name. P = Ports Node address (HEX), portname, flags, signal bit (decimal), queue length [number of messages] (decimal), taskname. I = Interrupts Node address (HEX), pointer to interrupt data (HEX), pointer to interrupt code (HEX), priority (decimal),type [interupt queue the interrupt belongs to], interrupt name. H = Help ( or ?) Show a list of commands. Q = Quit Same as QUIT (see below). Example: Entering TPM would display Tasks, Ports and Memory. The display would be updated after a few seconds (5 by default, may be changed anytime, see below.) Other commands that do not display lists: These commands may be entered upper or lower case. Parameters enclosed in '<>' must be, enclosed in '[]' may be specified. Names are usualy entered as ascii-strings, it can however happen that two or more nodes of the same name exist. On tasks you may specify the DOS-Processnumber to sort them out. If everything fails, you can enter the Node-Address with a leading '$'. This Address will be checked first before the command is being executed. If the check fails, you'll get an error message or a warning or a prompt, depending on what went wrong. Names are always the last parameter to enter. This may seem strange, but it is the simplest way to get rid of enbedded blanks. Time <seconds> Set time between updates. Minimum is 1 second, maximum is 255, default is 5 seconds. Example: Time 1 Taskpri <priority> [processnumber] <taskname> Change the priority of a task. Values may range from -127 to 127, better use values between -5 and 5. Example: Taskpri 5 New Cli Mypri <priority> Shortcut for "Taskpri Xoper <priority>" Example: Mypri 6 Pri <priority> <nodename> Change the priority of any other node. This commad does not work for Tasks. If the specified node has been found, the entire list the node belongs to will be resorted. Example: Pri 1 Chip Memory (try to allocate memory in CHIP first) Break [processnumber] <taskname> Set break signals. Useful for tasks running in background or from Workbench. Example: Break 3 New CLI Hunks [processnumber] <processname> Show location, BCPL-Pointers and length of memory blocks the process uses. Example: Hunks RAM Snoop [processnumber] <taskname> Track memory allocation/deallocation of a task. Press break (CTRL-C) to stop. List includes: action (alloc/free), memory requirents (CHIP/ FAST/ PUBLIC etc), memory size, memory location (start, end) and the address from where AllocMem() was called. Files List lock, access, size and name of open files. Locks List any lock. BUG: Trying to lock the Volume "RAM Disk" crashes the machine sometimes. If a Volume "RAM Disk" is found it will be replaced by the devicename "RAM:" (this has been fixed on WB 1.3). Make sure you don't have a disk labeled "RAM Disk" or you'll never see its locks:-) Currentdir List current directory settings of all processes. Devices List name,heads,sectors,tracks,startup-buffers and handler-process of every DOS-device. Capture Show vectors controling the reset, i.e. CoolCapture, ColdCapture and WarmCapture pointers, KickMem allocations. Useful when searching for Viruses, but remember that the RAD: device in 1.3 uses the KickMem pointer to recover from a reset. ClrCool ClrCold ClrWarm Clear one of those pointers. Lockdrive <drivename:> Prevent DOS, Workbench and Disk-Validator from cluttering on the drive. This command isn't very useful, but I needed it myself. Please note that the drivename is case sensitive and has to end with a ':'. Freedrive <drivename:> Re-enable a drive. Windows List address and title of all windows. Screens List address and title of screens. Fonts List address,height,width,type,fist character and last character of all loaded fonts. Windowfonts List Windows and associated fonts. Freeze [processnumber] <taskname> Halt a Task. The task should be READY or WAITING. Frozen tasks are queued in a new list called FREEZED. When you leave Xoper, halted Task will be released. Example: Freeze Killer Graphics Task Warm [processnum] <taskname> Restart a halted Task. Task must be FREEZED. Example: Warm Killer Graphics Task Info <librarynode | devicenode> Show additional information stored in the lib_IdString field. Example: Info arp.library Openlib <libraryname> Open a library. This is useful if you don't want a specified library being 'flushed' out. Example: Openlibrary arp.library Clear [longword] Fill unused memory chunks with pattern, default is 0. Handy for debuggers. Example: Clear $66726565 Flush Clean up memory, flush unused libraries, devices and fonts. Lastalert Show last Guru Meditation code or rubbish. Usage Toggle CPUSE field on the task display between usage relative to all possible dispatches and usage relative to actually dispatched tasks. Ahem...not very clear I think. Well, let me try again... If you add all CPUSE fields together you get 100 % (more or less 1%). After entering "Usage" adding the fields together will give you the same value as shown in the 'CPU Activity field'. (I HATE having to write docs) Taskports Disable / enable a listing of taskports if ports are displayed. More Stop displaying "<MORE>" and "<RETURN>" if output exceeds window. Quit or just Q Exit Xoper. If Xoper was started with '-b' or if 'Hold' was specified it will stay in background waiting for LeftAmiga-RightAmiga-X. Hold Exit Xoper but install a key-handler and stay in background. Window settings and display commands are saved. Exit Clean up and quit. !!!! WARNING: The next few commands are dangerous and 'dirty' !!!!! !!!!!!!!!!!! don't use them if not strictly necessary !!!!!!!!!!!!! Cancel [processnumber] <taskname> Cancel a task or a process. If the task has been called from CLI, the Task itself and the CLI will be killed. Hunks, Windows, Screens and the teminal-window will be freed. Simple tasks are just RemTask()'ed. If it is not a CLI Task you'll be asked if it is a Workbench task, if the answer is 'Yes' unloading will be done by the Workbench. If not, you will be prompted if Xoper should unload the code. Enter 'No' if you don't know how the task has been started. Closewindow <title> Closes a Window. Please, use it only if the corresponding Task has been 'Cancel'ed. Use the Window-Structure address if the window has no name. Closescreen <title> same as above, but for screens. Unlock <lock (BPTR)> Unlock a file. Closelib <libraryname> This is exactly the same as CloseLibrary(). CD [processnumber] <processname> Change the current directory of a process. You are prompted if the old directory lock should be unlocked. Signal <mask> [processnumber] <taskname> Set any task-signal. Mask is a hexadecimal value with or w/o leading '$'. See task's SIGWAIT field for sensible values. Tasks normaly do not wait for signals only, but for messages, that's why this command may not have the desired effect, but it is quite useful for tasks hanging around and waiting for events that may never happen. Warning: Using Signal without any knowledge about what you are going to signal may cause a system-crash! Example: Signal 10000000 PopCLI III ---------------------------------------------------------------------------- Please send flames, bug reports and especially a list of features you would like to have included in the next version to Werner Gunther Wingertspfad 12 D 6900 Heidelberg (Germany) or to my EMAIL address for a fast response: G35@DHDURZ1.BITNET \Rogue\Monster\ else echo "will not over write Xoper.doc" fi if [ `wc -c Xoper.doc | awk '{printf $1}'` -ne 9600 ] then echo `wc -c Xoper.doc | awk '{print "Got " $1 ", Expected " 9600}'` fi echo "Finished archive 1 of 2" # if you want to concatenate archives, remove anything after this line exit -- Bob Page, U of Lowell CS Dept. page@swan.ulowell.edu ulowell!page Have five nice days.