home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d1xx / d171 / xoper.lha / Xoper / Xoper.a < prev    next >
Text File  |  1988-11-22  |  103KB  |  3,662 lines

  1. ******************************************
  2. *                                        *
  3. * Xoper 1.2 Copyright (C) Werner Gunther *
  4. *                                        *
  5. ******************************************
  6. *    Written for the A68K Assembler      *
  7. *   (Fish 110) by Charlie Gibbs and      *
  8. *          Brian R. Anderson             *
  9. *                                        *
  10. *  Do not use Smallcode/Smalldata when   *
  11. *             linking                    *
  12. ******************************************
  13.  
  14. ;DEBUG SET 1
  15.             XREF    _LVOSwitch
  16.             XDEF    _SysBase
  17. sysbase     equ     4
  18.  
  19. CALL        MACRO
  20.             xref    _LVO\1
  21.             move.l  \2,a6
  22.             jsr     _LVO\1(a6)
  23.             ENDM
  24. LIBCALL     MACRO
  25.             xref    _\1
  26.             jsr     _\1
  27.             ENDM
  28.  
  29. ADDCMD      MACRO
  30. cmdnum      set     cmdnum+1
  31.             dc.b    \1,0
  32.             ENDM
  33.  
  34. ;Program startup. If called from DOS we
  35. ;use segment splitting to detach
  36. ;from our DOS-task.
  37. ;A0 points to parameter area,
  38. ;D0 holds its length.
  39. start       move.l  a0,parmtxt
  40.             move.b  d0,d5
  41.             lea     dosname(PC),a1
  42.             move.l  sysbase,a0
  43.             lea     378(a0),a0
  44.             move.l  a0,-(a7)
  45.             CALL    FindName,sysbase
  46.             move.l  d0,dosbase
  47.             move.l  0(a7),a0
  48.             lea     gfxname(PC),a1
  49.             CALL    FindName,sysbase
  50.             move.l  d0,gfxbase
  51.             move.l  (a7)+,a0
  52.             lea     intuiname(PC),a1
  53.             CALL    FindName,sysbase
  54.             move.l  d0,intuibase
  55.             move.l  d0,a0
  56.             move.l  $38(a0),a0
  57.             move.w  12(a0),d0
  58.             sub.w   #550,d0
  59.             move.w  d0,window_l
  60.  
  61.             move.l  sysbase,a4
  62.             move.l  276(a4),a4
  63.             tst.l   $ac(a4)
  64.             bne.s   notwb
  65.             lea     $5c(a4),a0
  66.             CALL    WaitPort,sysbase
  67.             lea     $5c(a4),a0
  68.             CALL    GetMsg,sysbase
  69.             move.l  d0,wbmsg
  70.             move.w  #$740a,in
  71. notwb:
  72.        IFND  DEBUG
  73.             lea     newname,a1
  74.             CALL    FindTask,sysbase
  75.             tst.l   d0
  76.             bne     oops
  77.        ENDC
  78.             tst.l   wbmsg
  79.             beq.s   fromdos
  80.             jmp     mainprg
  81.  
  82. fromdos     lea     in,a3
  83.             clr.l   d7
  84.             move.b  d5,d7
  85.             move.l  parmtxt,a4
  86. trans       move.b  (a4)+,(a3)+
  87.             dbf     d7,trans
  88.  
  89.             cmpi.b  #1,d5
  90.             bne.s   starttask
  91.             move.w  #$740a,in
  92. starttask:
  93.  
  94.         IFND DEBUG
  95.             lea     start(PC),a1
  96.             suba.l  #4,a1
  97.             move.l  0(a1),d3
  98.             move.l  d3,myseg
  99.             clr.l   0(a1)
  100.             CALL    Forbid,sysbase
  101.             move.l  #newname,d1
  102.             clr.l   d2
  103.             move.l  #3500,d4
  104.             CALL    CreateProc,dosbase
  105.             clr.l   d1
  106.             CALL    Exit,dosbase
  107. oops        suba.l  a0,a0
  108.             CALL    DisplayBeep,intuibase
  109.             CALL    Forbid,sysbase
  110.             move.l  wbmsg,d0
  111.             beq.s   leave
  112.             move.l  d0,a1
  113.             CALL    ReplyMsg,sysbase
  114.             clr.l   d0
  115. leave       rts
  116.  
  117. dosname     dc.b    'dos.library',0
  118. intuiname   dc.b    'intuition.library',0
  119. gfxname     dc.b    'graphics.library',0
  120.             EVEN
  121.  
  122. main        CODE    xoper
  123.         ENDC
  124. mainprg     move.l  sysbase,a0
  125.             move.l  a0,_SysBase
  126.             move.l  276(a0),a0
  127.             move.l  a0,mytask
  128.             move.l  #newname,10(a0)
  129.             pea     0
  130.             pea     0
  131.             LIBCALL CreatePort
  132.             lea     8(a7),a7
  133.             move.l  d0,replyport
  134. ;install a counter to determine the amount of CPU-time each
  135. ;Task uses.
  136.             move.l  _SysBase(PC),a1
  137.             move.l  #_LVOSwitch,a0
  138.             move.l  2(a1,a0),oldswitch
  139.             move.l  #myswitch,d0
  140.             CALL    SetFunction,_SysBase(PC)
  141.  
  142.             cmp.w   #'-b',in
  143.             bne.s   restart
  144.             move.w  #$740a,in
  145.             bra     instback
  146.  
  147. ;This code just opens a CON: Window. Position
  148. ;and size are taken from window_l,window_t,
  149. ;window_w,window_h.
  150.  
  151. restart     move.l  mytask(PC),a0
  152.             clr.l   26(a0)
  153.             lea     fname,a0
  154.             move.l  #'con:',0(a0)
  155.             clr.b   4(a0)
  156.             lea     binarea(PC),a1
  157.             lea     window_l(PC),a2
  158.             move.l  #3,d4
  159. rest1       move.l  #2,d3
  160.             clr.l   d0
  161.             move.w  (a2)+,d0
  162.             bsr     longdec
  163.             bsr     strcat
  164.             move.w  #$2f00,binarea
  165.             bsr     strcat
  166.             dbf     d4,rest1
  167.             lea     windowname(PC),a1
  168.             bsr     strcat
  169.             move.l  a0,d1
  170.             move.l  #1005,d2
  171.             CALL    Open,dosbase(PC)
  172.             move.l  d0,fileptr
  173.             lsl.l   #2,d0
  174.             move.l  d0,a4
  175.             move.l  8(a4),conmsg
  176. ;get a pointer to our window
  177.             move.l  #buffer,d0
  178.             lsr.l   #2,d0
  179.             move.l  d0,dp_Arg1
  180.             move.l  conmsg,a0
  181.             move.l  #25,dp_Type
  182.             bsr     cons1
  183.             lea     buffer,a0
  184.             move.l  28(a0),window
  185.  
  186.             clr.l   ptr
  187.  
  188. ;show a list. The string entered from keyboard is stored
  189. ;in 'in'.Every character is interpreted as one command
  190. ;i.e. 'rip' means 'resources'+'interrupts'+'ports'.
  191. showwhat    bsr     raw
  192.             bsr     clearscr
  193.             tst.b   morefl
  194.             beq.s   swh1
  195. ;if <MORE> is enabled we need to know how many lines can
  196. ;fit into our window
  197.             move.l  #getwin,d2
  198.             move.l  fileptr,d1
  199.             moveq.l #4,d3
  200.             CALL    Write,dosbase(PC)
  201.             move.l  fileptr,d1
  202.             move.l  #9,d3
  203.             move.l  #buffer,d2
  204.             CALL    Read,dosbase(PC)
  205.             lea     buffer,a0
  206.             lea     5(a0),a0
  207.             bsr     isdec
  208.             subq.b  #1,d2
  209.             move.b  d2,rows
  210.             clr.b   row
  211. ;search the command to be executed. If none is found,
  212. ;show a help message
  213. swh1        clr.l   d7
  214. input       lea     in,a0
  215.             move.b  0(a0,d7),d0
  216.             addq.b  #1,d7
  217.             cmpi.b  #' ',d0
  218.             beq.s   input
  219.             cmpi.b  #10,d0
  220.             beq     nomore
  221.             or.b    #32,d0
  222.             cmpi.b  #'q',d0
  223.             beq     exit
  224.             lea     params(PC),a0
  225.             clr.l   d1
  226. i1          cmp.b   0(a0,d1),d0
  227.             beq.s   foundp
  228.             addq.b  #1,d1
  229.             cmpi.b  #parmnum,d1
  230.             bne.s   i1
  231.  
  232.             move.l  #usetxt,d0
  233.             move.b  #1,mnflag
  234.             bsr     putnam
  235.             clr.b   mnflag
  236.             bra     nomore
  237.  
  238. foundp      lsl.b   #2,d1
  239.             lea     subs(PC),a0
  240.             move.b  #1,mnflag
  241.             jsr     0(a0,d1)
  242.             clr.b   mnflag
  243.             bra.s   input
  244.  
  245. ;wait 'timeout' seconds for a kepress
  246.  
  247. nomore      move.l  #prompt,d2
  248.             move.l  fileptr,d1
  249.             moveq.l #7,d3
  250.             CALL    Write,dosbase(PC)
  251.             bsr     con
  252.             move.b  timeout,d6
  253. halt        move.l  #1000000,d4
  254.             bsr     getkey
  255.             move.l  mytask(PC),a0
  256.             move.l  26(a0),d1
  257.             and.l   #$1000,d1
  258.             bne     exit
  259.             tst.l   d0
  260.             bne.s   cli
  261.             subq.b  #1,d6
  262.             bne.s   halt
  263.             clr.l   d4
  264.             bsr     getkey
  265.             tst.l   d0
  266.             bne.s   cli
  267.             bra     showwhat
  268.  
  269. getkey      move.l  fileptr,d1
  270.             moveq.l #1,d3
  271.             move.l  #null,d2
  272.             CALL    Write,dosbase(PC)
  273.             move.l  d4,d2
  274.             move.l  fileptr,d1
  275.             CALL    WaitForChar,dosbase(PC)
  276.             rts
  277. ;read the string from keyboard search and execute
  278. ;the command, if any.
  279. cli         bsr     readline
  280.             lea     dummy,a0
  281.             subq.b  #1,d0
  282. cl2         subq.b  #1,d0
  283.             bmi.s   cl1
  284.             cmp.b   #' ',0(a0,d0)
  285.             beq.s   cl2
  286. cl1         addq.b  #1,d0
  287.             move.b  #10,0(a0,d0)
  288.             bsr     kllblnks
  289.             cmpi.b  #10,0(a0)
  290.             beq     showwhat
  291.             lea     in,a1
  292.             lea     commds(PC),a2
  293.             clr.b   d2
  294. tstcmd      move    #-1,d1
  295. tc2         addq    #1,d1
  296.             move.b  0(a0,d1),d3
  297.             or.b    #32,d3
  298.             tst.b   0(a2,d1)
  299.             beq.s   foundcmd
  300.             cmp.b   0(a2,d1),d3
  301.             beq.s   tc2
  302. nocmd       tst.b   (a2)+
  303.             bne.s   nocmd
  304.             addq.b  #1,d2
  305.             cmpi.b  #cmdnum,d2
  306.             bne     tstcmd
  307.             bra.s   nm1
  308. foundcmd    cmpi.b  #'*',d3
  309.             beq.s   okcmd
  310.             cmpi.b  #' ',d3
  311.             bne.s   nocmd
  312. okcmd       clr.b   procnum
  313.             adda.w  d1,a0
  314.             bsr     kllblnks
  315.             and.l   #$ff,d2
  316.             lsl     #2,d2
  317.             lea     cmdaddr(PC),a1
  318.             clr.b   printed
  319.             jsr     0(a1,d2)
  320.             tst.b   morefl
  321.             beq     nomore
  322.             tst.b   printed
  323.             beq     nomore
  324.             move.l  #10,d3
  325.             move.l  fileptr,d1
  326.             move.l  #waittxt,d2
  327.             CALL    Write,dosbase(PC)
  328.             bsr     readline
  329.             move.l  #4,d3
  330.             move.l  fileptr,d1
  331.             move.l  #thisline,d2
  332.             CALL    Write,dosbase(PC)
  333.             bra     nomore
  334.  
  335. nm1         lea     buffer,a2
  336. nm2         move.b  (a1)+,(a2)+
  337.             cmp.b   #10,-1(a1)
  338.             bne.s   nm2
  339.             lea     in,a1
  340. nm0         move.b  (a0)+,(a1)+
  341.             dbf     d0,nm0
  342.             lea     dummy,a2
  343.             lea     buffer,a1
  344. nm3         move.b  (a1)+,(a2)+
  345.             cmp.b   #10,-1(a1)
  346.             bne.s   nm3
  347.             bra     showwhat
  348.  
  349. subs        bra     showtask
  350.             bra     showaddr
  351.             bra     showdevs
  352.             bra     showlibs
  353.             bra     showres
  354.             bra     showresi
  355.             bra     showmem
  356.             bra     showprt
  357.             bra     showint
  358. cmdaddr     bra     settime
  359.             bra     taskpri
  360.             bra     info
  361.             bra     pri
  362.             bra     flush
  363.             bra     freeze
  364.             bra     warm
  365.             bra     signal
  366.             bra     break
  367.             bra     alert
  368.             bra     lastalert
  369.             bra     hold
  370.             bra     stopall
  371.             bra     clear
  372.             bra     cancel
  373.             bra     moretst
  374.             bra     taskports
  375.             bra     hunks
  376.             bra     devices
  377.             bra     openlib
  378.             bra     closelib
  379.             bra     currentdir
  380.             bra     cd
  381.             bra     mypri
  382.             bra     openfiles
  383.             bra     locks
  384.             bra     unlock
  385.             bra     screens
  386.             bra     windows
  387.             bra     closescreen
  388.             bra     closewindow
  389.             bra     fonts
  390.             bra     windowfonts
  391.             bra     lockdrive
  392.             bra     freedrive
  393.             bra     capture
  394.             bra     clrcold
  395.             bra     clrcool
  396.             bra     clrwarm
  397.             bra     snoop
  398.             bra     usage
  399.  
  400. ;------ Task-Structures-----
  401.  
  402. showaddr    clr.b   tasktyp
  403.             bra.s   startask
  404. showtask    move.b  #1,tasktyp
  405. startask    move.l  #infoh1,d0
  406.             bsr     putstr
  407.             move.l  _SysBase(PC),a6
  408.             move.l  #cpu2,d0
  409.             btst    #1,297(a6)
  410.             bne.s   cpupr
  411.             move.l  #cpu1,d0
  412.             btst    #0,297(a6)
  413.             bne.s   cpupr
  414.             move.l  #cpu0,d0
  415. cpupr       bsr     putstr
  416.             move.l  _SysBase(PC),a6
  417.             btst    #2,297(a6)
  418.             beq.s   no881
  419.             move.l  #cpu3,d0
  420.             bsr     putstr
  421. no881       move.l  #20,d1
  422.             bsr     tab
  423.             move.l  #infoh3,d0
  424.             bsr     putstr
  425.             move.l  _SysBase(PC),a6
  426.             move.w  #$4000,$dff09a
  427.             move.l  280(a6),d0
  428.             move.l  284(a6),d1
  429.             move.l  oldidl,d3
  430.             move.l  d0,oldidl
  431.             sub.l   d3,d0
  432.             move.l  olddisp,d3
  433.             move.l  d1,olddisp
  434.             sub.l   d1,d3
  435.             move.l  d0,d1
  436.             sub.l   d3,d1
  437.             move.l  d1,maxdisp
  438.             move.l  d3,-(a7)
  439.             movem.l d0-d3,-(a7)
  440.             bsr     getaskdat
  441.             move.l  a5,savedat
  442.             movem.l (a7)+,d0-d3
  443.             sub.l   d3,d0
  444.             neg.l   d3
  445.             bsr     prcent
  446.             bsr     newline
  447.             move.l  #infoh2,d0
  448.             bsr     putstr
  449.             move.l  (a7)+,d0
  450.             neg.l   d0
  451.             move.l  d0,dispatches
  452.             clr.l   d3
  453.             bsr     longdec
  454.             move.l  #27,d1
  455.             bsr     tab
  456.             move.l  #infoh6,d0
  457.             bsr     putstr
  458.             move.l  olddisp(PC),d0
  459.             bsr     longdec
  460.  
  461.             bsr     newline
  462.             bsr     newline
  463.             lea     theader(PC),a0
  464.             tst.b   tasktyp
  465.             bne.s   phedder
  466.             lea     t2header(PC),a0
  467. phedder     bsr     puthead
  468.             move.l  savedat(PC),a5
  469.  
  470. pt1         tst.b   entries
  471.             beq     pt2
  472.             lea     -16(a5),a5
  473.             move.l  0(a5),a4
  474.             move.l  a4,d0
  475.             bsr     hexa
  476.             tst.b   tasktyp
  477.             beq.s   pt12
  478.             clr.l   d0
  479.             move.b  8(a4),d0
  480.             bsr     gettype
  481.  
  482. pt12        clr.l   d0
  483.             move.b  9(a5),d0
  484.             subq.b  #1,d0
  485.             mulu    #10,d0
  486.             move.l  #status,d1
  487.             add.l   d1,d0
  488.             bsr     putstr
  489.             tst.b   tasktyp
  490.             bne.s   pt13
  491.  
  492.             move.l  18(a4),d0
  493.             bsr     hex8
  494.             move.l  #ganzlongnix,d0
  495.             cmp.b   #4,9(a5)
  496.             beq.s   pt14
  497.             bsr     putstr
  498.             bra.s   pt15
  499. pt14        move.l  22(a4),d0
  500.             bsr     hex8
  501. pt15        move.l  26(a4),d0
  502.             bsr     hex8
  503.             move.l  54(a4),a1
  504.             move.l  0(a1),d0
  505.             cmp.b   #2,9(a5)
  506.             bne.s   pt16
  507.             move.l  #*,d0
  508. pt16        bsr     hexa
  509.             bra     pt4
  510.  
  511. pt13        move.b  10(a5),d3
  512.             bsr     plusmins
  513.  
  514.             move.l  dispatches(PC),d0
  515.             tst.b   usageflag
  516.             beq.s   pt37
  517.             move.l  maxdisp(PC),d0
  518. pt37        move.l  12(a5),d3
  519.             bsr     prcent
  520.  
  521.             clr.b   d3
  522.             cmpi.b  #13,8(a5)
  523.             bne.s   noproc
  524.             tst.l   172(a4)
  525.             beq.s   noproc
  526.             move.l  140(a4),d3
  527.             bsr     bytedec
  528.             bra.s   pt4
  529. noproc      move.l  #nix,d0
  530.             bsr     putstr
  531. pt4         move.l  4(a5),d0
  532.             bsr     putnam
  533.             subq.b  #1,entries
  534.             bra     pt1
  535. pt2         rts
  536.  
  537. putlist     move.l  0(a4),a4
  538.             tst.l   0(a4)
  539.             beq.s   endlist
  540.             bsr     putdata
  541.             bra.s   putlist
  542. endlist     rts
  543.  
  544. putdata     move.l  a4,0(a5)
  545.             move.l  10(a4),4(a5)
  546.             move.b  8(a4),8(a5)
  547.             move.b  15(a4),9(a5)
  548.             move.b  9(a4),10(a5)
  549.             move.b  143(a4),11(a5)
  550.             clr.l   12(a5)
  551.             lea     cputime,a0
  552.             move.l  tasksnum(PC),d1
  553.             beq.s   pua1
  554. pua3        cmp.l   0(a0),a4
  555.             beq.s   pua2
  556.             lea     8(a0),a0
  557.             dbf     d1,pua3
  558.             bra.s   pua1
  559. pua2        move.l  4(a0),12(a5)
  560. pua1        lea     16(a5),a5
  561.             addq.b  #1,entries
  562.             rts
  563.  
  564. gettype     and.l   #$f,d0
  565.             mulu    #11,d0
  566.             add.l   #type,d0
  567.             bra     putstr
  568.  
  569. getaskdat   lea     buffer,a5
  570.             clr.b   entries
  571.             lea     stplist(PC),a4
  572.             bsr     putlist
  573.             move.l  _SysBase(PC),a4
  574.             lea     420(a4),a4
  575.             bsr     putlist
  576.             move.l  _SysBase(PC),a4
  577.             lea     406(a4),a4
  578.             bsr     putlist
  579.             move.l  _SysBase(PC),a4
  580.             move.l  276(a4),a4
  581.             bsr     putdata
  582.             clr.l   tasksnum
  583.             move.w  #-$4000,$dff09a
  584.             rts
  585.  
  586. prcent      lsl.l   #1,d3
  587.             move.l  d3,d1
  588.             lsl.l   #2,d3
  589.             add.l   d1,d3
  590.             lsl.l   #2,d3
  591.             move.l  d3,d1
  592.             lsl.l   #3,d3
  593.             move.l  d3,d2
  594.             lsl.l   #1,d3
  595.             add.l   d2,d3
  596.             add.l   d1,d3
  597.             move.l  d0,d1
  598.             move.l  d3,d0
  599.             bsr     div
  600.             divu    #10,d0
  601.             move    d0,d3
  602.             swap    d0
  603.             move    d0,d1
  604.             bsr     bytedec
  605.             lea     out,a0
  606.             move.b  #'.',-1(a0,d0)
  607.             or.b    #'0',d1
  608.             move    d1,d0
  609.             bsr     putchar
  610.             move.l  #infoh4,d0
  611.             bra     putstr
  612. *-------- mem-hunks ------------
  613.  
  614. showmem     lea     mheader(PC),a0
  615.             bsr     puthead
  616.             move.l  _SysBase(PC),a5
  617.             lea     322(a5),a5
  618.             clr.l   d5
  619. mem1        move.l  0(a5),a5
  620.             tst.l   0(a5)
  621.             beq.s   mem2
  622.             move.l  20(a5),d0
  623.             bsr     hexa
  624.             move.l  24(a5),d0
  625.             bsr     hexa
  626.             move.l  28(a5),d0
  627.             add.l   d0,d5
  628.             moveq   #1,d3
  629.             bsr     longdec
  630.             move.b  15(a5),d3
  631.             bsr     bytedec
  632.             move.b  9(a5),d3
  633.             bsr     plusmins
  634.             move.l  10(a5),d0
  635.             bsr     putnam
  636.             bra.s   mem1
  637. mem2        move.l  #infoh6,d0
  638.             bsr     putstr
  639.             move.l  #15,d1
  640.             bsr     tab
  641.             move.l  d5,d0
  642.             bsr     longdec
  643. newline     move.l  #nxtline,d0
  644.             bra     putstr
  645.  
  646. *--------- interrupts ------------
  647. showint     lea     iheader(PC),a0
  648.             bsr     puthead
  649.             lea     intnames(PC),a5
  650.             lea     inttyp(PC),a4
  651.             move.l  #15,d5
  652.             move.l  _SysBase(PC),a3
  653.             lea     84(a3),a3
  654.  
  655. si0         tst.b   0(a4)
  656.             bne.s   si4
  657.             move.l  8(a3),a2
  658.             bra.s   si5
  659. si4         move.l  0(a3),a2
  660. si5         cmp.l   #0,a2
  661.             beq.s   nxtint
  662.             tst.b   0(a4)
  663.             beq.s   si1
  664. si2         move.l  0(a2),a2
  665.             tst.l   0(a2)
  666.             beq.s   nxtint
  667. si1         move.l  a2,d0
  668.             bsr     hexa
  669.             move.l  14(a2),d0
  670.             bsr     hexa
  671.             move.l  18(a2),d0
  672.             bsr     hexa
  673.             move.b  9(a2),d0
  674.             move.l  a3,-(a7)
  675.             bsr     plusmins
  676.             move.l  (a7)+,a3
  677.             move.l  a5,d0
  678.             bsr     putstr
  679.             move.l  10(a2),d0
  680.             tst.l   d0
  681.             bne.s   prtintnam
  682.             move.l  #ganzlongnix,d0
  683. prtintnam   bsr     putnam
  684.             tst.b   0(a4)
  685.             bne.s   si2
  686.             tst.l   0(a2)
  687.             beq.s   nxtint
  688.             move.l  0(a4),a4
  689.             bra     si1
  690. nxtint      lea     1(a4),a4
  691.             lea     12(a5),a5
  692.             lea     12(a3),a3
  693.             dbf     d5,si0
  694.             rts
  695.  
  696. *---------    resident ------------
  697.  
  698. showresi    lea     rheader(PC),a0
  699.             bsr     puthead
  700.             move.l  _SysBase(PC),a5
  701.             move.l  300(a5),a5
  702. r1          tst.l   0(a5)
  703.             beq     r2
  704.             move.l  0(a5),a4
  705.             move.l  a4,d0
  706.             bsr     hexa
  707.             move.b  13(a4),d3
  708.             bsr     plusmins
  709.             move.b  10(a4),d0
  710.             bsr     bin
  711.             move.b  11(a4),d3
  712.             bsr     bytedec
  713.             move.b  12(a4),d0
  714.             bsr     gettype
  715.             move.l  14(a4),d0
  716.             bsr     putnam
  717.             lea     4(a5),a5
  718.             bra     r1
  719. r2          rts
  720.  
  721. *---------  ports  -------------
  722.  
  723. showprt     lea     pheader(PC),a0
  724.             bsr     puthead
  725.             move.l  _SysBase(PC),a4
  726.             add.l   #392,a4
  727.             lea     buffer,a5
  728.             clr.l   d5
  729.             CALL    Forbid,_SysBase(PC)
  730. sp2         move.l  0(a4),a4
  731.             tst.l   0(a4)
  732.             beq.s   sp20
  733.             bsr     getpdata
  734.             bra.s   sp2
  735. sp20        tst.b   tports
  736.             beq.s   sp15
  737. sp1         move.w  #$4000,$dff09a
  738.             move.l  _SysBase(PC),a4
  739.             move.l  276(a4),a4
  740.             lea     92(a4),a4
  741.             bsr     getpdata
  742.             move.l  _SysBase(PC),a2
  743.             lea     406(a2),a2
  744. sp11        move.l  0(a2),a2
  745.             tst.l   0(a2)
  746.             beq.s   sp14
  747.             lea     92(a2),a4
  748.             cmp.b   #13,8(a2)
  749.             bne.s   sp11
  750.             bsr     getpdata
  751.             bra     sp11
  752. sp14        move.l  _SysBase(PC),a2
  753.             lea     420(a2),a2
  754. sp12        move.l  0(a2),a2
  755.             tst.l   0(a2)
  756.             beq.s   sp13
  757.             lea     92(a2),a4
  758.             cmp.b   #13,8(a2)
  759.             bne.s   sp12
  760.             bsr     getpdata
  761.             bra     sp12
  762. sp13        move.w  #-$4000,$dff09a
  763. sp15        CALL    Permit,_SysBase(PC)
  764.             lea     buffer,a5
  765. sp3         tst.b   d5
  766.             beq     sp6
  767.             move.l  0(a5),d0
  768.             bsr     hexa
  769.             move.l  4(a5),d0
  770.             bsr     putstr
  771.             move.l  #23,d1
  772.             bsr     tab
  773.             move.b  8(a5),d0
  774.             and.l   #3,d0
  775.             mulu    #9,d0
  776.             add.l   #mp_flags,d0
  777.             bsr     putstr
  778.             move.b  9(a5),d3
  779.             bsr     bytedec
  780.             move.b  14(a5),d3
  781.             bsr     bytedec
  782.             move.l  #ganzlongnix,d0
  783.             move.l  10(a5),a3
  784.             cmp.l   #0,a3
  785.             beq.s   sp8
  786.             move.l  10(a3),d1
  787.             move.l  d1,d2
  788.             andi.l  #$ff000000,d2
  789.             bne.s   sp8
  790.             move.l  d1,d0
  791. sp8         bsr     putnam
  792.             lea     16(a5),a5
  793.             subq.b  #1,d5
  794.             bra     sp3
  795. sp6         rts
  796.  
  797. getpdata    move.l  a4,0(a5)
  798.             move.l  10(a4),4(a5)
  799.             move.b  14(a4),8(a5)
  800.             move.b  15(a4),9(a5)
  801.             move.l  16(a4),10(a5)
  802.             clr.b   d0
  803.             movea.l 20(a4),a3
  804. sp10        movea.l 0(a3),a3
  805.             cmpa.l  #0,a3
  806.             beq.s   sp9
  807.             addq.b  #1,d0
  808.             cmp.b   #255,d0
  809.             bne.s   sp10
  810. sp9         move.b  d0,14(a5)
  811.             lea     16(a5),a5
  812.             addq.b  #1,d5
  813.             rts
  814. *-------- resources ------------
  815.  
  816. showres     lea     lheader(PC),a0
  817.             bsr     puthead1
  818.             lea     resnam(PC),a0
  819.             bsr     puthead2
  820.             move.l  _SysBase(PC),d5
  821.             add.l   #336,d5
  822.             bsr     show
  823.             rts
  824.  
  825. *--------- devices  -------------
  826.  
  827. showdevs    lea     lheader(PC),a0
  828.             bsr     puthead1
  829.             lea     devnam(PC),a0
  830.             bsr     puthead2
  831.             move.l  _SysBase(PC),d5
  832.             add.l   #350,d5
  833.             bsr     show
  834.             rts
  835.  
  836. *-------- libraries -------------
  837.  
  838. showlibs    lea     lheader(PC),a0
  839.             bsr     puthead1
  840.             lea     libnam(PC),a0
  841.             bsr     puthead2
  842.             move.l  _SysBase(PC),d5
  843.             add.l   #378,d5
  844.  
  845. show        lea     buffer,a5
  846.             clr.b   entries
  847.             CALL    Forbid,_SysBase(PC)
  848.             move.l  d5,a4
  849. sl1         move.l  0(a4),a4
  850.             tst.l   0(a4)
  851.             beq.s   sl2
  852.             addq.b  #1,entries
  853.             move.l  a4,0(a5)
  854.             move.l  10(a4),4(a5)
  855.             move.b  33(a4),8(a5)
  856.             move.b  21(a4),9(a5)
  857.             move.b  23(a4),10(a5)
  858.             move.b  14(a4),11(a5)
  859.             lea     12(a5),a5
  860.             bra.s   sl1
  861. sl2         CALL    Permit,_SysBase(PC)
  862.  
  863.             lea     buffer,a5
  864. dl3         tst.b   entries
  865.             beq.s   sl4
  866.             move.l  0(a5),d0
  867.             bsr     hexa
  868.             move.b  8(a5),d3
  869.             bsr     bytedec
  870.             move.b  9(a5),d3
  871.             bsr     bytedec
  872.             move.b  10(a5),d3
  873.             bsr     bytedec
  874.             move.b  11(a5),d0
  875.             bsr     bin
  876.             move.l  4(a5),d0
  877.             bsr     putnam
  878.             lea     12(a5),a5
  879.             subq.b  #1,entries
  880.             bra.s   dl3
  881. sl4         rts
  882.  
  883. ;find the first entry in the device-list
  884. ;returns a1 = pointer to first entry
  885.  
  886. devinfo     move.l  dosbase(PC),a1
  887.             move.l  34(a1),a1
  888.             move.l  24(a1),a1
  889.             adda.l  a1,a1
  890.             adda.l  a1,a1
  891.             move.l  4(a1),a1
  892.             rts
  893.  
  894. ;unlock a file
  895. unlock      bsr     readhex
  896.             tst.b   d7
  897.             beq     syntax
  898.             move.l  d0,remembr
  899.             move.l  d0,-(a7)
  900.             move    #-1,d6
  901.             bsr     of44
  902.             tst.l   remembr
  903.             beq.s   ul1
  904.             move.l  #unlerr,d0
  905.             bsr     putnam
  906.             bra     ul4
  907. ul1         move.l  #unl1,d0
  908.             bsr     putstr
  909.             move.l  0(a7),d0
  910.             bsr     getpath
  911.             move.l  #unltxt2,d0
  912.             bsr     putstr
  913.             bsr     readline
  914.             ori.b   #$20,dummy
  915.             cmp.b   #'y',dummy
  916.             bne.s   ul5
  917.             move.l  0(a7),d1
  918.             CALL    UnLock,dosbase
  919. ul5         bsr     freefinfo
  920. ul4         lea     4(a7),a7
  921.             rts
  922. ;---------- Show all Locks------------
  923. locks       clr.l   d6
  924.             bra.s   of33
  925.  
  926. ;---------- Open Files-----------
  927. openfiles   moveq   #1,d6
  928. of33        lea     ofheader(PC),a0
  929.             bsr     puthead
  930. of44        bsr     allocfinfo
  931.             bsr     devinfo
  932.             move.l  a1,a3
  933. of1         adda.l  a3,a3
  934.             adda.l  a3,a3
  935.             cmp.l   #2,4(a3)
  936.             bne     of2
  937.             move.l  40(a3),d0
  938.             lsl.l   #2,d0
  939.             move.l  d0,a4
  940.             clr.l   d3
  941.             move.b  (a4)+,d3
  942.             subq    #1,d3
  943.             lea     buffer,a5
  944. of22        move.b  (a4)+,(a5)+
  945.             dbf     d3,of22
  946.             move.b  #':',(a5)+
  947.             clr.b   0(a5)
  948.             cmp.l   #'RAM ',buffer
  949.             bne.s   of5
  950.             cmp.l   #'Disk',buffer+4
  951.             bne.s   of5
  952.             move.l  #$4d3a0000,buffer+2
  953. of5         move.l  #buffer,d1
  954.             move.l  #-2,d2
  955.             CALL    Lock,dosbase(PC)
  956.             tst.l   d0
  957.             bne.s   of6
  958.             move.l  #buffer,d0
  959.             bsr     putstr
  960.             move.l  #nomount,d0
  961.             bsr     putnam
  962.             bra     of2
  963.  
  964. of6         move.l  d0,-(a7)
  965.             lsl.l   #2,d0
  966.             move.l  d0,a5
  967. of4         move.l  0(a5),d0
  968.             cmp.l   #50,d0
  969.             ble     of3
  970.             move.l  d0,d5
  971.             lsl.l   #2,d5
  972.             move.l  d5,a5
  973.             move.l  d0,d5
  974.             tst     d6
  975.             bpl.s   of45
  976.  
  977.             cmp.l   remembr(PC),d0
  978.             bne.s   of3
  979.             clr.l   remembr
  980.             move.l  (a7)+,d1
  981.             CALL    UnLock,dosbase(PC)
  982.             rts
  983.  
  984. of45        move.l  8(a5),d4
  985.             bsr     getfinfo
  986.             move.l  finfoptr,a4
  987.  
  988.             tst.l   d6
  989.             beq.s   of8
  990.             bmi.s   of8
  991.             tst.l   4(a4)
  992.             bpl     of4
  993. of8         move.l  d5,d0
  994.             bsr     hexa
  995.             move.l  #access,d0
  996.             cmp     #-2,d4
  997.             beq.s   of7
  998.             add.l   #8,d0
  999. of7         bsr     putstr
  1000.             tst.l   4(a4)
  1001.             bmi.s   of9
  1002.             move.l  #longnix,d0
  1003.             bsr     putstr
  1004.             bra     of10
  1005. of9         move.l  124(a4),d0
  1006.             bsr     longdec
  1007. of10        move.l  d5,d0
  1008.             bsr     getpath
  1009.             bra     of4
  1010.  
  1011.             bsr     newline
  1012. of3         move.l  (a7)+,d1
  1013.             CALL    UnLock,dosbase(PC)
  1014. of2         move.l  0(a3),a3
  1015.             cmpa.l  #0,a3
  1016.             bne     of1
  1017.             bsr     freefinfo
  1018.             rts
  1019.  
  1020. ;---------- Dos Devices ----------
  1021.  
  1022. devices     lea     ddheader(PC),a0
  1023.             bsr     puthead
  1024.             bsr     devinfo
  1025. dev1        adda.l  a1,a1
  1026.             adda.l  a1,a1
  1027.             clr.b   d6
  1028.             tst.l   4(a1)
  1029.             bne     dev2
  1030.             move.l  40(a1),d0
  1031.             bsr     putbcpl
  1032.             move.l  #10,d1
  1033.             bsr     tab
  1034.             cmp.l   #20,28(a1)
  1035.             ble     dev9
  1036.             moveq   #1,d6
  1037.             move.l  28(a1),a3
  1038.             adda.l  a3,a3
  1039.             adda.l  a3,a3
  1040.             cmp.l   #20,8(a3)
  1041.             ble     dev9
  1042.             move.l  8(a3),a2
  1043.             adda.l  a2,a2
  1044.             adda.l  a2,a2
  1045.             move.l  12(a2),d3
  1046.             movem.l a1-a3,-(a7)
  1047.             bsr     bytedec
  1048.             movem.l (a7)+,a1-a3
  1049.             moveq   #1,d3
  1050.             move.l  20(a2),d0
  1051.             bsr     longdec
  1052.             move.l  40(a2),d0
  1053.             beq.s   devs20
  1054.             addq    #1,d0
  1055.             sub.l   36(a2),d0
  1056. devs20      bsr     longdec
  1057.             move.l  44(a2),d0
  1058.             bsr     longdec
  1059.             bra.s   dev8
  1060. dev9        move.l  #notfile,d0
  1061.             bsr     putstr
  1062. dev8        tst.l   8(a1)
  1063.             beq.s   dev6
  1064.             move.l  #devload,d0
  1065.             bra.s   dev5
  1066. dev6        move.l  #devnload,d0
  1067. dev5        bsr     putstr
  1068.             tst.b   d6
  1069.             beq.s   dev7
  1070.             move.l  4(a3),d0
  1071.             bne.s   dev4
  1072. dev7        move.l  16(a1),d0
  1073.             bne.s   dev4
  1074.             tst.l   8(a1)
  1075.             beq.s   dev11
  1076.             move.l  8(a1),a3
  1077.             move.l  -82(a3),d0
  1078.             bsr     putstr
  1079.             bra     dev11
  1080. dev4        bsr     putbcpl
  1081. dev11       bsr     newline
  1082. dev2        move.l  0(a1),a1
  1083.             cmpa.l  #0,a1
  1084.             bne     dev1
  1085.             rts
  1086.  
  1087. ; Check if a named dos-device is mounted
  1088. ; name in 'buffer'.
  1089. ; Result: d0 = 0(false) anything else(true).
  1090.  
  1091. finddev     bsr     devinfo
  1092. fdev1       adda.l  a1,a1
  1093.             adda.l  a1,a1
  1094.             clr.b   d6
  1095.             tst.l   4(a1)
  1096.             bne.s   fdev2
  1097.             move.l  40(a1),a2
  1098.             lea     buffer,a0
  1099.             bsr     strbcmp
  1100.             tst     d0
  1101.             bne.s   fdev3
  1102. fdev2       move.l  0(a1),a1
  1103.             cmpa.l  #0,a1
  1104.             bne.s   fdev1
  1105. fdev3       rts
  1106.  
  1107. ; Re-assign a drive to dos
  1108.  
  1109. freedrive   clr.l   dp_Arg1
  1110.             bra     ldr3
  1111.  
  1112. ; Inhibit a disk drive
  1113.  
  1114. lockdrive   move.l  #1,dp_Arg1
  1115. ldr3        bsr     getstr
  1116.             bsr     finddev
  1117.             bne.s   ldr1
  1118. ldr2        move.l  #buffer,d0
  1119.             bsr     putstr
  1120.             move.l  #nomount,d0
  1121.             bra     putstr
  1122.             move.l  #dishelp,d0
  1123.             bra     putnam
  1124. ldr1        move.l  #buffer,d1
  1125.             CALL    DeviceProc,dosbase(PC)
  1126.             tst.l   d0
  1127.             beq.s   ldr2
  1128.             move.l  d0,a0
  1129.             move.l  #31,dp_Type
  1130.             bra     cons1
  1131.  
  1132. ;display the current directory of all processes,
  1133. ;except Workbench.(Worbench pr_CurrentDir is not a lock)
  1134.  
  1135. currentdir  lea     wbname(PC),a1
  1136.             CALL    FindTask,_SysBase(PC)
  1137.             move.l  d0,wbaddr
  1138.             lea     cdheader(PC),a0
  1139.             bsr     puthead
  1140.             bsr     allocfinfo
  1141.             bsr     getaskdat
  1142.             lea     buffer,a5
  1143. cd2         tst.b   entries
  1144.             beq.s   cd6
  1145.             cmp.b   #13,8(a5)
  1146.             bne.s   cd5
  1147.             move.l  wbaddr(PC),d0
  1148.             cmp.l   0(a5),d0
  1149.             beq.s   cd5
  1150.             move.l  4(a5),d0
  1151.             bsr     putstr
  1152.             move.l  #15,d1
  1153.             bsr     tab
  1154.             move.l  0(a5),a4
  1155.             move.l  152(a4),d0
  1156.             bne.s   cd1
  1157.             move.l  #syst,d0
  1158.             bsr     putnam
  1159.             bra.s   cd5
  1160. cd1         bsr     getpath
  1161. cd5         subq.b  #1,entries
  1162.             lea     12(a5),a5
  1163.             bra.s   cd2
  1164. cd6         bsr     freefinfo
  1165.             rts
  1166.  
  1167. ;Change the current directory setting of a process
  1168.  
  1169. cd          move.l  a0,-(a7)
  1170.             lea     wbname(PC),a1
  1171.             CALL    FindTask,_SysBase(PC)
  1172.             move.l  d0,wbaddr
  1173.             move.l  (a7)+,a0
  1174.             bsr     getstr
  1175.             move.l  a0,-(a7)
  1176.             move.l  #buffer,d1
  1177.             move.l  #-2,d2
  1178.             CALL    Lock,dosbase(PC)
  1179.             move.l  (a7)+,a0
  1180.             tst.l   d0
  1181.             bne     cd16
  1182.             move.l  #dnotf,d0
  1183.             bra     putnam
  1184. cd16        move.l  d0,remembr
  1185.             move.l  a0,-(a7)
  1186.             bsr     allocfinfo
  1187.             move.l  remembr(PC),d0
  1188.             bsr     getfinfo
  1189.             move.l  finfoptr,a5
  1190.             move.l  (a7)+,a0
  1191.             tst.l   4(a5)
  1192.             bpl.s   cd11
  1193.             move.l  #notdir,d0
  1194.             bsr     putnam
  1195.             bra     cd18
  1196. cd11        bsr     nodenam
  1197.             moveq.l #2,d7
  1198.             lea     TRuNode(PC),a4
  1199.             bsr     findnam
  1200.             tst.b   d7
  1201.             beq.s   cd15
  1202.             move.l  d0,a5
  1203.             cmp.b   #13,8(a5)
  1204.             beq.s   cd15
  1205.             bsr     syntax
  1206.             bra     cd18
  1207. cd15        cmp.l   wbaddr,d0
  1208.             bne.s   cd13
  1209.             move.l  #wberr,d0
  1210.             bsr     putnam
  1211.             bra     cd12
  1212. cd13        move.l  152(a5),d1
  1213.             move.l  remembr,152(a5)
  1214.             move.l  d1,remembr
  1215. cd12        tst.l   remembr
  1216.             beq.s   cd14
  1217.             move.l  #unltxt,d0
  1218.             bsr     putstr
  1219.             move.l  remembr(PC),d0
  1220.             bsr     getpath
  1221.             move.l  #unltxt2,d0
  1222.             bsr     putstr
  1223.             bsr     readline
  1224.             ori.b   #$20,dummy
  1225.             cmp.b   #'y',dummy
  1226.             bne.s   cd14
  1227. cd18        move.l  remembr(PC),d1
  1228.             beq.s   cd14
  1229.             CALL    UnLock,dosbase(PC)
  1230. cd14        bsr     freefinfo
  1231. cd10        rts
  1232.  
  1233. ;get all screen pointers.
  1234. ;result: d5=number of screens
  1235. ;        buffer+100 holds pointers.
  1236.  
  1237. getscr      lea     scrheader(PC),a0
  1238.             bsr     puthead
  1239. getscr2     move.l  intuibase(PC),a2
  1240.             move.l  60(a2),a2
  1241.             lea     buffer+100,a1
  1242.             move.w  #$4000,$dff09a
  1243.             clr.l   d5
  1244. sr1         move.l  a2,(a1)+
  1245.             move.l  0(a2),a2
  1246.             addq.l  #1,d5
  1247.             cmpa.l  #0,a2
  1248.             bne.s   sr1
  1249.             subq    #1,d5
  1250.             move.w  #-$4000,$dff09a
  1251.             rts
  1252.  
  1253. ;display screen addresses and titles
  1254.  
  1255. screens     bsr     getscr
  1256.             moveq   #1,d6
  1257.             lea     buffer+100,a1
  1258. sr2         move    d6,d3
  1259.             bsr     bytedec
  1260.             move.l  0(a1),d0
  1261.             bsr     hexa
  1262.             move.l  (a1)+,a2
  1263.             move.l  22(a2),d0
  1264.             bsr     putnam
  1265.             addq    #1,d6
  1266.             dbf     d5,sr2
  1267.             rts
  1268.  
  1269. ;display window addresses and titles
  1270.  
  1271. windows     clr.b   bool
  1272. windows1    bsr     getscr
  1273.             tst.b   bool
  1274.             beq.s   wn20
  1275.             move.l  d5,-(a7)
  1276.             lea     fohead(PC),a0
  1277.             bsr     puthead
  1278.             move.l  (a7)+,d5
  1279. wn20        lea     buffer+100,a4
  1280. wn2         move.l  #onscr,d0
  1281.             bsr     putstr
  1282.             move.l  (a4)+,a2
  1283.             move.l  22(a2),d0
  1284.             bsr     putnam
  1285.             move.l  4(a2),a1
  1286.             clr     d6
  1287. wn1         cmpa.l  #0,a1
  1288.             beq.s   wn3
  1289.             addq    #1,d6
  1290.             move.l  d6,d3
  1291.             bsr     bytedec
  1292.             move.l  a1,d0
  1293.             bsr     hexa
  1294.             move.l  32(a1),d0
  1295.             bsr     putnam
  1296.  
  1297.             tst.b   bool
  1298.             beq.s   wn21
  1299.             move.l  a1,-(a7)
  1300.             move.l  50(a1),a1
  1301.             move.l  52(a1),a1
  1302.             bsr     fontdata
  1303.             move.l  (a7)+,a1
  1304.  
  1305. wn21        move.l  0(a1),a1
  1306.             bra.s   wn1
  1307. wn3         dbf     d5,wn2
  1308.             rts
  1309.  
  1310. ;close a specified screen
  1311.  
  1312. closescreen bsr     getscr2
  1313.             moveq   #1,d6
  1314.             cmp.b   #'$',0(a0)
  1315.             bne.s   cs1
  1316.             bsr     readhex
  1317.             tst     d7
  1318.             beq     syntax
  1319.             move.l  d0,d4
  1320. csin        clr.l   d6
  1321. cs1         lea     buffer+100,a2
  1322. cs5         tst     d6
  1323.             bne.s   cs2
  1324.             cmp.l   (a2)+,d4
  1325.             beq.s   cs3
  1326.             bra.s   cs4
  1327. cs2         move.l  (a2)+,a1
  1328.             move.l  22(a1),a1
  1329.             bsr     strcmp
  1330.             tst     d0
  1331.             beq.s   cs3
  1332. cs4         dbf     d5,cs5
  1333.             move.l  #scnofound,d0
  1334.             bra     putnam
  1335. cs3         move.l  -4(a2),a0
  1336.             CALL    CloseScreen,intuibase(PC)
  1337.             rts
  1338.  
  1339. ;close a specified window
  1340.  
  1341. closewindow bsr     getscr2
  1342.             moveq   #1,d6
  1343.             cmp.b   #'$',0(a0)
  1344.             bne.s   cw1
  1345.             bsr     readhex
  1346.             tst     d7
  1347.             beq     syntax
  1348. cwin        move.l  d0,d4
  1349.             clr.l   d6
  1350. cw1         lea     buffer+100,a2
  1351. cw5         move.l  (a2)+,a4
  1352.             move.l  4(a4),a4
  1353. cw6         cmpa.l  #0,a4
  1354.             beq.s   cw4
  1355.             tst     d6
  1356.             bne.s   cw2
  1357.             cmp.l   a4,d4
  1358.             beq.s   cw3
  1359.             bra.s   cw7
  1360. cw2         move.l  32(a4),a1
  1361.             bsr     strcmp
  1362.             tst     d0
  1363.             beq.s   cw3
  1364. cw7         move.l  0(a4),a4
  1365.             bra.s   cw6
  1366. cw4         dbf     d5,cw5
  1367.             move.l  #winnofound,d0
  1368.             bra     putnam
  1369. cw3         move.l  a4,a0
  1370.             clr.l   d0
  1371.             CALL    ModifyIDCMP,intuibase(PC)
  1372.             move.l  a4,a0
  1373.             CALL    CloseWindow,intuibase(PC)
  1374.             rts
  1375.  
  1376. windowoff   movem.l d1-d7/a0-a6,-(a7)
  1377.             bsr     getscr2
  1378.             bsr     cwin
  1379.             move.l  -(a2),a0
  1380.             move.l  a0,d4
  1381.             tst.l   4(a0)
  1382.             bne.s   woff1
  1383.             bsr     getscr2
  1384.             bsr     csin
  1385. woff1       movem.l (a7)+,d1-d7/a0-a6
  1386.             rts
  1387.  
  1388. closetskwin movem.l d1-d7/a0-a6,-(a7)
  1389. ctw0        bsr     getscr2
  1390.             lea     buffer+100,a2
  1391. ctw1        move.l  (a2)+,a4
  1392.             move.l  4(a4),a4
  1393. ctw6        cmpa.l  #0,a4
  1394.             beq.s   ctw4
  1395.             move.l  86(a4),a0
  1396.             move.l  16(a0),d1
  1397.             cmp.l   d0,d1
  1398.             bne.s   ctw7
  1399.             move.l  d0,d1
  1400.             move.l  a4,d0
  1401.             bsr     windowoff
  1402.             move.l  d1,d0
  1403.             bra     ctw0
  1404. ctw7        move.l  0(a4),a4
  1405.             bra.s   ctw6
  1406. ctw4        dbf     d5,ctw1
  1407.             movem.l (a7)+,d1-d7/a0-a6
  1408.             rts
  1409.  
  1410. ;display windows and associated fonts
  1411.  
  1412. windowfonts move.b  #1,bool
  1413.             bra     windows1
  1414.  
  1415. ;display loaded font names and definitions
  1416.  
  1417. fonts       lea     fohead(PC),a0
  1418.             bsr     puthead
  1419.             move.l  gfxbase(PC),a1
  1420.             move.l  $8c(a1),a1
  1421. fo1         tst.l   0(a1)
  1422.             beq.s   fo3
  1423.             bsr     fontdata
  1424.             move.l  0(a1),a1
  1425.             bra     fo1
  1426. fo3         rts
  1427.  
  1428. fontdata    move.l  a1,d0
  1429.             bsr     hexa
  1430.             move.w  30(a1),d3
  1431.             bsr     bytedec
  1432.             move.w  20(a1),d3
  1433.             bsr     bytedec
  1434.             move.w  24(a1),d3
  1435.             bsr     bytedec
  1436.             move.l  #romfnt,d0
  1437.             btst    #1,23(a1)
  1438.             beq.s   fod1
  1439.             move.l  #diskfnt,d0
  1440. fod1        bsr     putstr
  1441.             move.b  32(a1),d3
  1442.             bsr     bytedec
  1443.             move.b  33(a1),d3
  1444.             bsr     bytedec
  1445.             move.l  10(a1),d0
  1446.             bra     putnam
  1447.  
  1448. ;set update rate
  1449.  
  1450. settime     bsr     getnum
  1451.             tst.b   d7
  1452.             beq.s   syntax
  1453.             tst.w   d2
  1454.             bne.s   st1
  1455.             move.b  #1,d2
  1456. st1         move.b  d2,timeout
  1457.             rts
  1458. syntax      move.l  #synerr,d0
  1459.             bra     putnam
  1460.  
  1461. ;copy a string from input to 'buffer'
  1462. ;a0 = pointer to string
  1463.  
  1464. getstr      lea     buffer,a5
  1465. gst2        cmp.b   #' ',0(a0)
  1466.             beq.s   gst1
  1467.             cmp.b   #10,0(a0)
  1468.             beq.s   gst1
  1469.             move.b  (a0)+,(a5)+
  1470.             bra.s   gst2
  1471. gst1        clr.b   0(a5)
  1472.             bra     kllblnks
  1473.  
  1474. ;read in a nodename or a processname
  1475.  
  1476. nodenam     bsr     isdec
  1477.             move.b  d2,procnum
  1478. nodenam2    bsr     kllblnks
  1479.             move.l  a0,a5
  1480. gno1        cmp.b   #10,(a0)+
  1481.             bne.s   gno1
  1482.             move.b  #0,-1(a0)
  1483.             rts
  1484.  
  1485. ;modify a task's priority
  1486.  
  1487. taskpri     bsr     getnum
  1488.             tst.b   d7
  1489.             beq     syntax
  1490.             move.b  d2,newpri
  1491.             bsr     nodenam
  1492.             moveq.l #2,d7
  1493.             lea     TRuNode(PC),a4
  1494.             bsr     findnam
  1495.             tst.b   d7
  1496.             beq.s   tp1
  1497.             move.l  d0,a1
  1498.             move.b  newpri,d0
  1499.             CALL    SetTaskPri,_SysBase(PC)
  1500. tp1         rts
  1501.  
  1502. ;set the priority of our task
  1503.  
  1504. mypri       bsr     getnum
  1505.             tst.b   d7
  1506.             beq     syntax
  1507.             move.l  _SysBase(PC),a1
  1508.             move.l  276(a1),a1
  1509.             move.l  d2,d0
  1510.             CALL    SetTaskPri,_SysBase(PC)
  1511.             rts
  1512.  
  1513. ;cancel a task or a process. The theory is quite simple:
  1514. ;(Process->ReturnAddr)-4 points to the return address on
  1515. ;the stack. Task->SPReg points to the next instruction
  1516. ;to be executed. We just need a
  1517. ; *(Task->SPReg) = *(Process->ReturnAddr-4).
  1518. ;If the process has been started from Dos (CLI) and
  1519. ;the process is doing disk I/O, the CLI will respond with
  1520. ;a GURU #87000004 (AsyncPKT=unexpected packed received).
  1521. ;Thats why the calling CLI is also canceled.
  1522.  
  1523.  
  1524. cancel      clr.l   remembr         ;used for CLI stdio
  1525.             clr.l   remembr2
  1526.             clr.b   bool
  1527.             bsr     nodenam
  1528. testagain   moveq.l #1,d7
  1529.             lea     TReNode(PC),a4
  1530.             bsr     findnam
  1531.             move.l  a5,pointer
  1532.             tst.b   d7
  1533.             bne.s   canok
  1534.             move.l  #stperr,d0
  1535.             bra     putnam
  1536. canok       move.l  d0,a1          ;d0=task
  1537.             cmp.b   #1,8(a1)       ;TASK ?
  1538.             bne.s   isproc
  1539.             CALL    RemTask,_SysBase(PC)
  1540.             rts
  1541. isproc      movem.l d0-d7/a0-a6,-(a7)
  1542.             move.l  #-1,d0            ;needed for recursive killing tasks
  1543.             CALL    AllocSignal,_SysBase(PC)
  1544.             clr.l   d1
  1545.             bset    d0,d1
  1546.             move.l  d1,cancelbit
  1547.             move.l  d0,cancelbnum
  1548.             movem.l (a7)+,d0-d7/a0-a6
  1549.  
  1550.             clr.l   d5
  1551.             tst.l   $ac(a1)         ;pr_CLI
  1552.             beq.s   wascreproc
  1553.             move.l  $80(a1),a2      ;Seglist
  1554.             adda.l  a2,a2
  1555.             adda.l  a2,a2
  1556.             move.l  12(a2),d1       ;empty ?
  1557.             bne.s   wascreproc
  1558.             move.l  $ac(a1),a2      ;CommandLineInterface
  1559.             adda.l  a2,a2
  1560.             adda.l  a2,a2
  1561.             move.l  60(a2),d5       ;cli_Module
  1562.             tst.l   40(a2)          ;IsInteractive
  1563.             beq     dosreturn
  1564.             move.l  28(a2),remembr  ;yes,get Cli-Window locks
  1565.             move.l  56(a2),remembr2
  1566.             bra     dosreturn
  1567. wascreproc  tst.b   bool            ;it is not a CLI, ask what to do
  1568.             bne.s   unload
  1569.             move.b  #3,bool
  1570.             move.l  #canerr0,d0     ;ask for Workbench
  1571.             bsr     putstr
  1572.             bsr     readline
  1573.             ori.b   #$20,dummy
  1574.             cmp.b   #'y',dummy
  1575.             beq.s   andagain
  1576.             move.b  #2,bool
  1577.             move.l  #canerr1,d0    ;ask for unload
  1578.             bsr     putstr
  1579.             bsr     readline
  1580.             ori.b   #$20,dummy
  1581.             cmp.b   #'y',dummy
  1582.             bne.s   andagain
  1583.             move.b  #1,bool
  1584. andagain    move.l  pointer(PC),a5
  1585.             bra     testagain      ;test if the task still there
  1586.  
  1587. unload      move.l  128(a1),d4 ;get Segmentlist
  1588.             beq.s   unl3
  1589.             lsl.l   #2,d4
  1590.             move.l  d4,a3
  1591.             move.l  12(a3),d4
  1592. unl3        tst.l   d4
  1593.             bne.s   unl4
  1594.             move.l  #unloaderr,d0 ;no Segments !?
  1595.             bra     putnam
  1596.  
  1597. unl4        cmp.b   #3,bool            ;Workbench Task
  1598.             bne.s   unl2
  1599.             move.l  a1,-(a7)
  1600.             move.l  #40,d0             ;build a copy of the
  1601.             move.l  #$10000,d1         ;Worbench startup-message
  1602.             CALL    AllocMem,_SysBase(PC)
  1603.             move.l  d0,startmess
  1604.             move.l  (a7)+,a1
  1605.             move.l  d0,a0
  1606.             move.b  #5,8(a0)
  1607.             move.w  #20,18(a0)
  1608.             move.l  d4,24(a0)
  1609.             move.l  a1,d0
  1610.             add.l   #92,d0
  1611.             move.l  d0,20(a0)
  1612.             movem.l a0-a1,-(a7)
  1613.             lea     wbname(PC),a1
  1614.             CALL    FindPort,_SysBase(PC)
  1615.             movem.l (a7)+,a0-a1
  1616.             move.l  d0,14(a0)
  1617.  
  1618. unl2        cmp.b   #1,bool
  1619.             bne.s   dosreturn
  1620.             move.l  a1,-(a7)           ;unload process manualy
  1621.             move.l  d4,d1
  1622.             CALL    UnLoadSeg,dosbase(PC)
  1623.             move.l  (a7)+,a1
  1624.  
  1625. dosreturn   move.l  140(a1),savedat ;Processnumber
  1626. dosret1     move.w  #$4000,$dff09a
  1627.             move.l  54(a1),a3
  1628.             move.l  #endtask,0(a3)
  1629.             move.l  #2,106(a1)
  1630.             move.l  mytask(PC),108(a1)
  1631.             cmp.b   #4,15(a1)        ;if waiting
  1632.             bne.s   doswait
  1633.             move.l  a1,d4
  1634.             CALL    Remove,_SysBase(PC)
  1635.             move.l  d4,a1
  1636.             lea     406(a6),a0       ; activate the task
  1637.             CALL    AddHead,_SysBase(PC)
  1638.             move.l  d4,a1
  1639. doswait     move.w  #-$4000,$dff09a
  1640.             tst.b   bool
  1641.             bne.s   endnodos
  1642.             tst.l   d5
  1643.             beq     endcanc
  1644.             move.l  $ac(a1),a2
  1645.             adda.l  a2,a2
  1646.             adda.l  a2,a2
  1647. dwa1        movem.l d0-d7/a0-a6,-(a7)
  1648.             move.l  cancelbit(PC),d0
  1649.             CALL    Wait,_SysBase(PC)
  1650.             movem.l (a7)+,d0-d7/a0-a6
  1651.             clr.l   d5
  1652.             bra     dosret1
  1653.  
  1654. endcanc     move.l  a1,-(a7)
  1655.             move.l  remembr(PC),d1    ;close CLI-Window
  1656.             beq.s   ecan1             ;if any
  1657.             CALL    Close,dosbase(PC)
  1658. ecan1       move.l  remembr2(PC),d1
  1659.             beq.s   ecan2
  1660.             CALL    Close,dosbase(PC)
  1661. ecan2       move.l  (a7)+,a1
  1662.  
  1663.             move.l  savedat(PC),d0   ;remove Task from
  1664.             move.l  dosbase(PC),a2   ;TaskArray
  1665.             move.l  34(a2),a2
  1666.             move.l  0(a2),a2
  1667.             adda.l  a2,a2
  1668.             adda.l  a2,a2
  1669.             lsl.l   #2,d0
  1670.             clr.l   0(a2,d0)
  1671.  
  1672. endnodos    move.l  a1,d0
  1673.             bsr     closetskwin
  1674.             move.l  cancelbnum(PC),d0      ;remove our Signal
  1675.             CALL    FreeSignal,_SysBase(PC)
  1676.             rts
  1677.  
  1678. ;This Code is (hopefully) excuted by the Process we want
  1679. ;to kill
  1680.  
  1681. endtask     CALL    Forbid,_SysBase(PC)
  1682.             CALL    Disable,_SysBase(PC)
  1683.             move.l  _SysBase(PC),a1
  1684.             move.l  276(a1),a1
  1685.             move.l  176(a1),a1          ;Process_ReturnAddr
  1686.             lea     -4(a1),a7           ;reset Process Stackptr
  1687.             tst.b   bool
  1688.             bne.s   et0
  1689.             movea.l mytask(PC),a1
  1690.             move.l  cancelbit(PC),d0    ;signal Xoper it
  1691.             CALL    Signal,_SysBase(PC) ;died
  1692. et0         cmp.b   #3,bool             ;Workbench Process ?
  1693.             bne.s   et1
  1694.             move.l  startmess(PC),a1
  1695.             CALL    ReplyMsg,_SysBase(PC) ;reply startup message
  1696. et1         rts
  1697.  
  1698. ;Stop a task (just queue it on a special list)
  1699.  
  1700. freeze      bsr     nodenam
  1701.             moveq.l #1,d7
  1702.             lea     TReNode(PC),a4
  1703.             bsr     findnam
  1704.             tst.b   d7
  1705.             bne.s   frok
  1706.             move.l  #stperr,d0
  1707.             bra     putstr
  1708. frok        move.w  #$4000,$dff09a
  1709.             move.l  d0,a1
  1710.             CALL    Remove,_SysBase(PC)
  1711.             move.w  #-$4000,$dff09a
  1712.             move.l  d0,a1
  1713.             move.l  d0,a5
  1714.             lea     stplist(PC),a0
  1715.             CALL    AddHead,_SysBase(PC)
  1716.             add.b   #4,15(a5)
  1717.             rts
  1718. ;put the task back on its list
  1719. warm        bsr     nodenam
  1720.             lea     stplist(PC),a0
  1721.             movea.l a5,a1
  1722.             clr.l   d7
  1723.             bsr     fn4
  1724.             tst.b   d7
  1725.             bne.s   waok
  1726.             move.l  #waerr,d0
  1727.             bra     putstr
  1728. waok        move.w  #$4000,$dff09a
  1729.             move.l  d0,a1
  1730.             CALL    Remove,_SysBase(PC)
  1731.             move.l  d0,a1
  1732.             move.l  d0,a5
  1733.             move.l  TReNode,a0
  1734.             cmp.b   #8,15(a1)
  1735.             bne.s   wa1
  1736.             move.l  TWaNode,a0
  1737. wa1         adda.l  _SysBase(PC),a0
  1738.             CALL    AddTail,_SysBase(PC)
  1739.             move.l  d0,a1
  1740.             sub.b   #4,15(a5)
  1741.             move.w  #-$4000,$dff09a
  1742.             rts
  1743. ;show the hunks of a process
  1744. hunks       bsr     nodenam
  1745.             moveq.l #2,d7
  1746.             lea     TRuNode(PC),a4
  1747.             bsr     findnam
  1748.             tst.b   d7
  1749.             bne.s   hu1
  1750.             rts
  1751. hu1         move.l  d0,a4
  1752.             cmp.b   #13,8(a4)
  1753.             beq.s   hu2
  1754.             move.l  #noprocs,d0
  1755.             bra     putnam
  1756. hu2         move.l  128(a4),d0
  1757.             beq.s   noprogload
  1758.             lsl.l   #2,d0
  1759.             move.l  d0,a3
  1760.             move.l  12(a3),d1
  1761.             beq.s   hu3
  1762.             move.l  #segloaded,d0
  1763.             bsr     putnam
  1764.             bra     hu5
  1765. hu3         move.l  172(a4),d1
  1766.             bne.s   hu4
  1767. noprogload  move.l  #notload,d0
  1768.             bra     putnam
  1769. hu4         move.l  #cliprocs,d0
  1770.             bsr     putnam
  1771.             lsl.l   #2,d1
  1772.             move.l  d1,a4
  1773.             move.l  60(a4),d1
  1774.             beq.s   noprogload
  1775.             move.l  #procloaded,d0
  1776.             bsr     putstr
  1777.             move.l  16(a4),d0
  1778.             bsr     putbcpl
  1779.             bsr     newline
  1780. hu5         lea     hunkheader(PC),a0
  1781.             bsr     puthead
  1782. hu6         move.l  d1,d0
  1783.             bsr     hexa
  1784.             lsl.l   #2,d1
  1785.             move.l  d1,a4
  1786.             move.l  d1,d0
  1787.             addq.l  #4,d0
  1788.             bsr     hexa
  1789.             move.l  -4(a4),d0
  1790.             bsr     hexa
  1791.             bsr     newline
  1792.             move.l  0(a4),d1
  1793.             bne.s   hu6
  1794.             rts
  1795. ;change the priority of a node
  1796. pri         bsr     getnum
  1797.             tst.b   d7
  1798.             beq     syntax
  1799.             move.b  d2,newpri
  1800.             bsr     nodenam2
  1801.             moveq.l #5,d7
  1802.             lea     DevNode(PC),a4
  1803.             bsr     findnam
  1804.             tst.b   d7
  1805.             beq.s   pi1
  1806.             move.l  d0,a1
  1807.             move.b  newpri,9(a1)
  1808.             cmp.l   #SemNode,a4
  1809.             ble.s   pi2
  1810.             move.l  #listerr,d0
  1811.             bra     putnam
  1812. pi2         CALL    Forbid,_SysBase(PC)
  1813.             CALL    Remove,_SysBase(PC)
  1814.             move.l  d0,a1
  1815.             move.l  a4,a0
  1816.             move.l  0(a0),d6
  1817.             lea     0(a6,d6),a0
  1818.             CALL    Enqueue,_SysBase(PC)
  1819.             CALL    Permit,_SysBase(PC)
  1820. pi1         rts
  1821. ;set all break signals of a task
  1822. break       move.l  #$f000,d0
  1823.             bra     setthem
  1824.  
  1825. signal      bsr     readhex
  1826.             tst.b   d7
  1827.             beq     syntax
  1828. setthem     move.l  d0,savedat
  1829.             bsr     nodenam
  1830.             moveq.l #2,d7
  1831.             lea     TReNode(PC),a4
  1832.             bsr     findnam
  1833.             tst.b   d7
  1834.             beq.s   pi1
  1835.             move.l  d0,a1
  1836.             move.l  savedat,d0
  1837.             and.l   18(a1),d0
  1838.             CALL    Signal,_SysBase(PC)
  1839.             rts
  1840.  
  1841. ;'flushlibs'
  1842. flush       move.l  #$ffffff,d0
  1843.             clr.l   d1
  1844.             CALL    AllocMem,_SysBase(PC)
  1845.             rts
  1846.  
  1847. ;display library->lib_IDString
  1848. info        bsr     nodenam2
  1849.             moveq.l #2,d7
  1850.             lea     DevNode(PC),a4
  1851.             bsr     findnam
  1852.             tst.b   d7
  1853.             beq.s   pi1
  1854.             move.l  d0,a0
  1855.             move.l  24(a0),d0
  1856.             beq.s   if1
  1857.             move.l  d0,d1
  1858.             andi.l  #$ff000000,d1
  1859.             bne.s   if1
  1860.             bra     putnam
  1861. if1         move.l  #noinfo,d0
  1862.             bsr     putstr
  1863.             move.l  a5,d0
  1864.             bra     putnam
  1865.  
  1866. capture     move.l  _SysBase(PC),a1
  1867.             lea     42(a1),a0
  1868.             moveq   #2,d6
  1869.             lea     coldtxt,a4
  1870. cap0        move.l  a4,d0
  1871.             bsr     putstr
  1872.             move.l  0(a0),d0
  1873.             bne.s   cap1
  1874.             move.l  #unset,d0
  1875.             bsr     putstr
  1876.             bra     cap2
  1877. cap1        bsr     hexa
  1878. cap2        bsr     newline
  1879.             lea     15(a4),a4
  1880.             lea     4(a0),a0
  1881.             dbf     d6,cap0
  1882.  
  1883.             move.l  #kicktxt,d0
  1884.             bsr     putstr
  1885.             move.l  546(a1),a0
  1886.             cmpa.l  #0,a0
  1887.             bne.s   kickm3
  1888.             move.l  #unset,d0
  1889.             bra     putnam
  1890. kickm3      move.l  a0,-(a7)
  1891.             bsr     newline
  1892.             lea     kickhead(PC),a0
  1893.             bsr     puthead
  1894.             move.l  (a7)+,a0
  1895. kickm0      cmpa.l  #0,a0
  1896.             bne.s   kickm1
  1897.             rts
  1898. kickm1      move.w  14(a0),d6
  1899.             subq    #1,d6
  1900.             lea     16(a0),a2
  1901. kickm2      move.l  0(a2),d0
  1902.             bsr     hexa
  1903.             move.l  0(a2),d0
  1904.             move.l  4(a2),d4
  1905.             add.l   d4,d0
  1906.             bsr     hexa
  1907.             move.l  d4,d0
  1908.             clr.b   d3
  1909.             bsr     longdec
  1910.             bsr     newline
  1911.             lea     8(a2),a2
  1912.             dbf     d6,kickm2
  1913.             move.l  0(a0),a0
  1914.             bra     kickm0
  1915.             rts
  1916.  
  1917. clrcold     move.l  _SysBase,a0
  1918.             clr.l   42(a0)
  1919.             bra.s   chksum
  1920. clrcool     move.l  _SysBase,a0
  1921.             clr.l   46(a0)
  1922.             bra.s   chksum
  1923. clrwarm     move.l  _SysBase,a0
  1924.             clr.l   50(a0)
  1925.  
  1926. chksum      lea     34(a0),a1
  1927.             move    #22,d0
  1928. addchk      add     (a1)+,d1
  1929.             dbf     d0,addchk
  1930.             not     d1
  1931.             move.w  d1,82(a0)
  1932.             rts
  1933.  
  1934. ;display ExecBase->LastAlert
  1935. lastalert   movem.l $100,d1-d2
  1936.             tst.l   d1
  1937.             bne.s   al1
  1938.             move.l  _SysBase(PC),a0
  1939.             movem.l 514(a0),d1-d2
  1940.             bra.s   al1
  1941. alert       movem.l $100,d1-d2
  1942.             cmp.l   #'HELP',0
  1943.             beq.s   al1
  1944.             move.l  #noguru,d0
  1945.             bra     putnam
  1946.  
  1947. al1         move.l  #gurutxt,d0
  1948.             bsr     putstr
  1949.             move.l  d1,d0
  1950.             bsr     hex8
  1951.             lea     out,a0
  1952.             move.l  ptr(PC),d0
  1953.             move.b  #'.',-1(a0,d0)
  1954.             move.l  d2,d0
  1955.             bsr     hex8
  1956.             bra     newline
  1957.  
  1958. ;toggle '<MORE>' on/off
  1959. moretst     bchg    #0,morefl
  1960.             rts
  1961. ;toggle CPUSE task list
  1962. usage       bchg    #0,usageflag
  1963.             rts
  1964.  
  1965. ;Open a library
  1966. openlib     bsr     nodenam2
  1967.             move.l  a5,a1
  1968.             clr.l   d0
  1969.             CALL    OpenLibrary,_SysBase(PC)
  1970.             tst.l   d0
  1971.             beq     fn5
  1972. opli1       bsr     clearscr
  1973.             bra     showlibs
  1974.  
  1975. ;close it
  1976. closelib    bsr     nodenam2
  1977.             clr.l   d7
  1978.             lea     LibNode(PC),a4
  1979.             bsr     findnam
  1980.             tst.b   d7
  1981.             beq.s   clo1
  1982.             move.l  d0,a1
  1983.             CALL    CloseLibrary,_SysBase(PC)
  1984.             bra     opli1
  1985.  
  1986. ;toggle task-ports display on/off
  1987. taskports   bchg    #0,tports
  1988. clo1        rts
  1989.  
  1990. ;end Xoper but stay in background
  1991. hold        lea     4(a7),a7
  1992.             bra.s   instback
  1993. quithold    lea     in,a0
  1994.             lea     dummy,a1
  1995. qh1         move.b  (a1)+,d0
  1996.             move.b  d0,(a0)+
  1997.             cmp.b   #10,d0
  1998.             bne.s   qh1
  1999.  
  2000. instback    tst.b   background
  2001. \Rogue\Monster\
  2002. else
  2003.   echo "will not over write Xoper.a1"
  2004. fi
  2005. if [ `wc -c Xoper.a1 | awk '{printf $1}'` -ne 54718 ]
  2006. then
  2007. echo `wc -c Xoper.a1 | awk '{print "Got " $1 ", Expected " 54718}'`
  2008. fi
  2009. echo "Finished archive 2 of 2"
  2010. # if you want to concatenate archives, remove anything after this line
  2011. exit
  2012. -- 
  2013. Bob Page, U of Lowell CS Dept.  page@swan.ulowell.edu  ulowell!page
  2014. Have five nice days.
  2015.  
  2016.  
  2017.             bne.s   cleanit
  2018.             move.b  #1,background
  2019.             bsr     installh
  2020. cleanit     tst.l   fileptr
  2021.             beq.s   ib1
  2022.             move.l  window(PC),a0
  2023.             move.w  4(a0),window_l
  2024.             move.w  6(a0),window_t
  2025.             move.w  8(a0),window_w
  2026.             move.w  10(a0),window_h
  2027.             move.l  fileptr(PC),d1
  2028.             CALL    Close,dosbase(PC)
  2029.             clr.l   fileptr
  2030. ib1         clr.b   running
  2031.             move.l  mysignal(PC),d0
  2032.             CALL    Wait,_SysBase(PC)
  2033.             move.b  #1,running
  2034.             bra     restart
  2035.  
  2036. ;fill all unused memory-chunks with a longword
  2037. clear       bsr     readhex
  2038.             tst.b   d7
  2039.             beq     syntax
  2040.             move.l  _SysBase(PC),a0
  2041.             clr.l   parmtxt
  2042.             lea     322(a0),a0
  2043.             move.w  #$4000,$dff09a
  2044. clr1        move.l  0(a0),a0
  2045.             tst.l   0(a0)
  2046.             beq.s   clr4
  2047.             move.l  16(a0),a1
  2048. clr2        tst.l   0(a1)
  2049.             beq.s   clr1
  2050.             add.l   #1,parmtxt
  2051.             move.l  4(a1),d1
  2052.             sub.l   #8,d1
  2053.             beq.s   clr31
  2054.             lsr.l   #2,d1
  2055.             subq.l  #1,d1
  2056.             lea     8(a1),a2
  2057. clr3        move.l  d0,(a2)+
  2058.             dbf     d1,clr3
  2059. clr31       move.l  0(a1),a1
  2060.             bra.s   clr2
  2061. clr4        move.w  #-$4000,$dff09a
  2062.             move.l  parmtxt(PC),d0
  2063.             bsr     bytedec
  2064.             move.l  #clrtxt,d0
  2065.             bra     putnam
  2066.  
  2067. ;find a named node
  2068. ;d7 = number of lists to search through
  2069. ;a4 = pointer to the first entry in the
  2070. ;     list-offset-table
  2071. ;a5 = pointer to name
  2072. ;returns:
  2073. ;d7 = TRUE/FALSE 1/0
  2074. ;d0 = node
  2075.  
  2076. findnam     cmp.b   #'$',0(a5)
  2077.             bne.s   fn2
  2078.             move.l  d7,d2
  2079.             move.l  a5,a0
  2080.             bsr     readhex
  2081.             tst.b   d7
  2082.             beq.s   fn6
  2083.             move.l  d2,d7
  2084.             bsr     tstnode
  2085.             tst.l   d5
  2086.             bne.s   fn3
  2087.             bra     fn5
  2088. fn6         move.l  d2,d7
  2089. fn2         move.l  _SysBase(PC),a0
  2090.             adda.l  0(a4),a0
  2091.             move.l  a5,a1
  2092. fn4         CALL    FindName,_SysBase(PC)
  2093.             tst.l   d0
  2094.             bne.s   fn1
  2095.             lea     4(a4),a4
  2096.             dbf     d7,fn2
  2097. fn5         move.l  #namerr,d0
  2098.             bsr     putstr
  2099.             move.l  a5,d0
  2100.             bsr     putnam
  2101.             clr.b   d7
  2102.             rts
  2103. fn1         move.b  procnum(PC),d2
  2104.             beq.s   fn3
  2105.             move.l  d0,a0
  2106.             cmp.b   143(a0),d2
  2107.             bne.s   fn4
  2108. fn3         moveq.l #1,d7
  2109.             rts
  2110.  
  2111. ;list-offset-table
  2112. TRuNode     dc.l    276
  2113. TReNode     dc.l    406
  2114. TWaNode     dc.l    420
  2115. DevNode     dc.l    350
  2116. LibNode     dc.l    378
  2117. ResNode     dc.l    336
  2118. MemNode     dc.l    322
  2119. PorNode     dc.l    392
  2120. SemNode     dc.l    532
  2121.  
  2122. ;Node has been entered in hex. Check if this node exsists
  2123. tstnode     move.l  d0,d1
  2124.             and.l   #$ff000001,d1
  2125.             beq.s   inrange
  2126.             move.l  #adrerr,d0
  2127.             bsr     putnam
  2128.             clr.l   d5
  2129.             rts
  2130. inrange     movem.l d7/a4,-(a7)
  2131.             cmp.l   #TRuNode,a4
  2132.             bne.s   inrange1
  2133.             move.l  _SysBase(PC),a0
  2134.             cmp.l   276(a0),d0
  2135.             beq.s   nodefound
  2136.             subq    #1,d7
  2137.             lea     4(a4),a4
  2138. inrange1    move.w  #$4000,$dff09a
  2139. getlist     move.l  _SysBase(PC),a0
  2140.             add.l   0(a4),a0
  2141. nxtnode     tst.l   0(a0)
  2142.             beq.s   nxtlist
  2143.             cmp.l   a0,d0
  2144.             beq.s   nodefound
  2145.             move.l  0(a0),a0
  2146.             bra.s   nxtnode
  2147. nxtlist     lea     4(a4),a4
  2148.             dbf     d7,getlist
  2149.             move.w  #-$4000,$dff09a
  2150.             movem.l d0/d7/a4,-(a7)
  2151.             move.l  #noderr,d0
  2152.             bsr     putnam
  2153.             bsr     readline
  2154.             movem.l (a7)+,d0/d7/a4
  2155.             or.b    #32,dummy
  2156.             cmp.b   #'y',dummy
  2157.             beq.s   nodefound1
  2158.             clr.l   d5
  2159.             movem.l (a7)+,d7/a4
  2160.             rts
  2161. nodefound   move.w  #-$4000,$dff09a
  2162. nodefound1  move.b  #1,d5
  2163. etst        movem.l (a7)+,d7/a0
  2164.             rts
  2165.  
  2166. ;clear our window
  2167. clearscr    move.l  #cls,d2
  2168.             move.l  fileptr,d1
  2169.             moveq.l #6,d3
  2170.             CALL    Write,dosbase(PC)
  2171.             rts
  2172. ;allocate FileInfoBlock
  2173. allocfinfo  move.l  #260,d0
  2174.             clr.l   d1
  2175.             CALL    AllocMem,_SysBase(PC)
  2176.             move.l  d0,finfoptr
  2177.             rts
  2178.  
  2179. ;free FileInfoBlock
  2180. freefinfo   move.l  #260,d0
  2181.             move.l  finfoptr,a1
  2182.             CALL    FreeMem,_SysBase(PC)
  2183.             rts
  2184.  
  2185. ;Examine ,d0=Lock
  2186. getfinfo    move.l  d0,d1
  2187.             move.l  finfoptr,d2
  2188.             CALL    Examine,dosbase(PC)
  2189.             rts
  2190.  
  2191. ;construct a Pathname from a lock
  2192. ;d0=Lock ,resulting string is written to window
  2193. getpath     movem.l d1-d7/a0-a6,-(a7)
  2194.             move.l  d0,d1
  2195.             CALL    DupLock,dosbase(PC)
  2196.             lea     out,a4
  2197.             clr.b   -(a4)
  2198. gp0         tst.l   d0
  2199.             beq.s   putall
  2200.             move.l  d0,-(a7)
  2201.             bsr     getfinfo
  2202.             move.l  finfoptr,a0
  2203.             move.l  4(a0),d4
  2204.             lea     8(a0),a0
  2205.             bsr     strlen
  2206.             lea     -1(a4),a5
  2207.             tst.l   d4
  2208.             bmi.s   nodir
  2209.             move.b  #'/',-(a4)
  2210. nodir       subq    #1,d0
  2211.             bmi.s   nofnam
  2212. gp1         move.b  0(a0,d0),-(a4)
  2213.             dbf     d0,gp1
  2214. nofnam      move.l  0(a7),d1
  2215.             CALL    ParentDir,dosbase(PC)
  2216.             move.l  d0,d4
  2217.             move.l  (a7)+,d1
  2218.             CALL    UnLock,dosbase(PC)
  2219.             move.l  d4,d0
  2220.             bra     gp0
  2221. putall      cmp.b   #'/',0(a5)
  2222.             bne.s   gp2
  2223.             move.b  #':',0(a5)
  2224. gp2         move.l  a4,d0
  2225.             bsr     putnam
  2226.             movem.l (a7)+,d1-d7/a0-a6
  2227.             rts
  2228. strlen      move.l  a0,-(a7)
  2229.             move.l  #-1,d0
  2230. strl2       addq.l  #1,d0
  2231.             tst.b   (a0)+
  2232.             bne.s   strl2
  2233.             move.l  (a7)+,a0
  2234.             rts
  2235.  
  2236. ;write a title and underline
  2237. ;a0 = pointer to text
  2238. puthead1    bsr     strlen
  2239.             move.l  d0,d5
  2240.             move.l  a0,d0
  2241.             bra     putstr
  2242.  
  2243. puthead2    bsr     strlen
  2244.             add.l   d0,d5
  2245.             bra.s   ph2
  2246.  
  2247. puthead     bsr     strlen
  2248.             move.l  d0,d5
  2249. ph2         move.l  a0,d0
  2250.             bsr     putnam
  2251.             lea     out,a0
  2252.             move.l  a0,d0
  2253. ph1         move.b  #'-',(a0)+
  2254.             dbf     d5,ph1
  2255.             move.b  #$9b,(a0)+
  2256.             move.b  #'K',(a0)+
  2257.             move.b  #$0a,(a0)+
  2258.             clr.b   0(a0)
  2259.             bra     putstr
  2260.  
  2261. ;move cursor to a column
  2262. ;d0 = current position
  2263. ;d1 = column
  2264. tab         move.l  a3,-(a7)
  2265.             lea     out,a3
  2266. sp5         cmp.b   d1,d0
  2267.             bcc.s   sp4
  2268.             move.b  #' ',0(a3,d0)
  2269.             addq.b  #1,d0
  2270.             bra.s   sp5
  2271. sp4         move.l  d1,ptr
  2272.             move.l  (a7)+,a3
  2273.             rts
  2274.  
  2275. ;convert ascii to byte
  2276. ;a0 = pointer to text
  2277. ;d0 = byte
  2278. getnum      cmp.b   #'$',0(a0)
  2279.             bne.s   isdec
  2280.             bsr     readhex
  2281.             move.l  d0,d2
  2282.             rts
  2283. isdec       clr.w   d2
  2284.             clr.w   d3
  2285.             clr.b   d6
  2286.             clr.b   d7
  2287.             cmp.b   #'-',0(a0)
  2288.             bne.s   gn1
  2289.             lea     1(a0),a0
  2290.             moveq.l #1,d6
  2291. gn1         move.b  (a0)+,d3
  2292.             cmp.b   #'9',d3
  2293.             bhi.s   gn2
  2294.             cmp.b   #'0',d3
  2295.             bcs.s   gn2
  2296.             moveq.l #1,d7
  2297.             and.b   #$f,d3
  2298.             muls    #10,d2
  2299.             add.w   d3,d2
  2300.             bra.s   gn1
  2301. gn2         tst.b   d6
  2302.             beq.s   gn3
  2303.             neg.w   d2
  2304. gn3         tst.b   d7
  2305.             bne.s   gn4
  2306.             lea     -1(a0),a0
  2307. gn4         rts
  2308.  
  2309. ;convert hex to longword
  2310. ;a0 = pointer to text
  2311. ;returns d0=value
  2312. ;d7 = ok/error 1/0
  2313. readhex     movem.l d1-d6/a1-a5,-(a7)
  2314.             moveq.b #1,d7
  2315.             cmp.b   #'$',0(a0)
  2316.             bne.s   rh3
  2317.             lea     1(a0),a0
  2318. rh3         clr.l   d0
  2319.             lea     hextab(pc),a1
  2320. rh0         move.b  (a0)+,d3
  2321.             moveq.l #15,d2
  2322. rh1         cmp.b   0(a1,d2),d3
  2323.             beq.s   rh2
  2324.             dbf     d2,rh1
  2325.             bra     rhend
  2326. rh2         lsl.l   #4,d0
  2327.             or.b    d2,d0
  2328.             bra.s   rh0
  2329. rhend       tst.b   d3
  2330.             beq.s   rhok
  2331.             cmpi.b  #10,d3
  2332.             beq.s   rhok
  2333.             cmpi.b  #' ',d3
  2334.             beq.s   rhok
  2335.             clr.l   d7
  2336. rhok        movem.l (a7)+,d1-d6/a1-a5
  2337.             rts
  2338.  
  2339. ;skip blanks
  2340. ;a0 pointer to text
  2341. ; returns a0 = new pointer position
  2342. kllblnks    cmpi.b  #' ',0(a0)
  2343.             bne.s   gn4
  2344.             lea     1(a0),a0
  2345.             bra.s   kllblnks
  2346.  
  2347. ; exit program. If background flag is set, wait for
  2348. ; amiga-amiga-x
  2349.  
  2350. stopall     lea     4(a7),a7
  2351.             bra     exitall
  2352.  
  2353. exit        tst.b   background
  2354.             bne     quithold
  2355. exitall     move.l  stplist(PC),a3
  2356.             tst.l   0(a3)
  2357.             beq.s   ex0
  2358.             move.l  a3,d0
  2359.             bsr     waok
  2360.             bra.s   exitall
  2361.  
  2362. ex0         tst.b   background
  2363.             beq.s   ex1
  2364.             bsr     removeh
  2365.  
  2366. ex1         move.l  _SysBase(PC),a1
  2367.             move.l  #_LVOSwitch,a0
  2368.             move.l  oldswitch,d0
  2369.             CALL    SetFunction,_SysBase(PC)
  2370.  
  2371.             move.l  replyport,-(a7)
  2372.             LIBCALL DeletePort
  2373.             lea     4(a7),a7
  2374.             move.l  fileptr(PC),d1
  2375.             CALL    Close,dosbase(PC)
  2376.         IFND DEBUG
  2377.             CALL    Forbid,_SysBase(PC)
  2378.             move.l  wbmsg(PC),d0
  2379.             beq.s   todos
  2380.             move.l  d0,a1
  2381.             CALL    ReplyMsg,_SysBase(PC)
  2382.             clr.l   d0
  2383.             rts
  2384.  
  2385. todos       move.l  myseg(PC),d1
  2386.             CALL    UnLoadSeg,dosbase(PC)
  2387.         ENDC
  2388.             clr.l   d1
  2389.             CALL    Exit,dosbase(PC)
  2390.  
  2391. ;print a bcpl-string
  2392. ;d0 = bcpl-pointer to bcpl-string
  2393. putbcpl     movem.l d3/a0-a1,-(a7)
  2394.             tst.l   d0
  2395.             beq.s   pb1
  2396.             lsl.l   #2,d0
  2397.             move.l  d0,a1
  2398.             clr.l   d3
  2399.             move.b  (a1)+,d3
  2400.             move.l  ptr(PC),d0
  2401.             lea     out,a0
  2402. pb2         move.b  (a1)+,0(a0,d0)
  2403.             addq.b  #1,d0
  2404.             dbf     d3,pb2
  2405.             move.l  d0,ptr
  2406. pb1         movem.l (a7)+,d3/a0-a1
  2407.             rts
  2408.  
  2409. ;compare strings
  2410. ;a0/a1 = pointers to string
  2411. ;returns d0 = true(0) false(1)
  2412. strcmp      movem.l a0-a1,-(a7)
  2413.             clr.l   d0
  2414. src2        move.b  (a0)+,d0
  2415.             beq.s   src1
  2416.             cmp.b   #10,d0
  2417.             beq.s   src1
  2418.             cmp.b   (a1)+,d0
  2419.             beq.s   src2
  2420.             bra.s   src3
  2421. src1        move.b  0(a1),d0
  2422. src3        movem.l (a7)+,a0-a1
  2423.             rts
  2424.  
  2425. ;compare bcpl string with string
  2426. ;a0 = pointer to string
  2427. ;a2 = bcpl-pointer to bcpl-string
  2428. ;returns d0 = true(0) false(1)
  2429. strbcmp     movem.l d1/a0/a2,-(a7)
  2430.             clr.l   d0
  2431.             clr.l   d1
  2432.             adda.l  a2,a2
  2433.             adda.l  a2,a2
  2434.             move.b  (a2)+,d1
  2435.             beq.s   stb1
  2436.             subq    #1,d1
  2437. stb2        cmp.b   (a2)+,(a0)+
  2438.             bne.s   stb1
  2439.             dbf     d1,stb2
  2440.             moveq   #1,d0
  2441. stb1        movem.l (a7)+,d1/a0/a2
  2442.             rts
  2443.  
  2444. ;concat strings
  2445. ;a0 = pointer to string
  2446. ;a1 = pointer to string to be appended
  2447. ;returns d0 = strlen
  2448. strcat      movem.l d1/a0-a1,-(a7)
  2449.             bsr     strlen
  2450.             move.l  d0,d1
  2451.             exg     a0,a1
  2452.             bsr     strlen
  2453.             adda.w  d1,a1
  2454. stc1        move.b  (a0)+,(a1)+
  2455.             dbf     d0,stc1
  2456.             move.l  a1,d0
  2457.             movem.l (a7)+,d1/a0-a1
  2458.             sub.l   a0,d0
  2459.             rts
  2460.  
  2461. ;convert long to decimal
  2462. ;d0 = value
  2463. ;d3 bit 0 = left/right justified
  2464. ;d3 bit 1 = write/leave
  2465. ;returns string in 'buffer'
  2466. longdec     movem.l d1-d2/a1-a2,-(a7)
  2467.             lea     binarea+8(PC),a1
  2468.             move.l  #'    ',-8(a1)
  2469.             move.l  #'    ',-4(a1)
  2470.             clr.b   0(a1)
  2471.             lea     -1(a1),a1
  2472.             cmp     #2,d3
  2473.             bne.s   ld5
  2474.             clr.b   0(a1)
  2475. ld5         moveq   #1,d2
  2476. ld2         addq    #1,d2
  2477.             moveq   #$a,d1
  2478.             bsr     div
  2479.             addi.l  #$30,d1
  2480.             move.b  d1,-(a1)
  2481.             tst.l   d0
  2482.             bne.s   ld2
  2483.  
  2484.             btst    #0,d3
  2485.             bne.s   ld1
  2486.             lea     binarea(PC),a2
  2487. ld3         move.b  0(a1),(a2)+
  2488.             move.b  #' ',(a1)+
  2489.             dbf     d2,ld3
  2490. ld1         cmp     #2,d3
  2491.             beq.s   ld4
  2492.             move.l  #binarea,d0
  2493.             bsr     putstr
  2494. ld4         movem.l (a7)+,d1-d2/a1-a2
  2495.             rts
  2496.  
  2497. ;write UBYTE
  2498. ;d3 = value
  2499. bytedec     move.l  #dezimal,d0
  2500. pm1         bsr     dec
  2501.             bra     putstr
  2502.  
  2503. ;write signed byte
  2504. ;d3 = value
  2505. plusmins    move.l  #minus+1,d0
  2506.             move.w  #$2020,minus
  2507.             tst.b   d3
  2508.             bpl.s   pm1
  2509.             neg.b   d3
  2510.             jsr     dec
  2511.             move.b  #'-',-(a3)
  2512.             bra.s   putstr
  2513.  
  2514. dec         move.l  #$20202020,dezimal
  2515.             clr.l   d4
  2516.             and.l   #$ff,d3
  2517.             lea     dezimal+3(PC),a3
  2518. bloop       tst.b   d3
  2519.             beq.s   bend
  2520.             divu    #10,d3
  2521.             swap    d3
  2522.             ori.b   #48,d3
  2523.             move.b  d3,-(a3)
  2524.             clr.w   d3
  2525.             swap    d3
  2526.             bra.s   bloop
  2527. bend        cmpa.l  #dezimal+3,a3
  2528.             bne     nixfirst
  2529.             move.b  #'0',-(a3)
  2530. nixfirst    rts
  2531.  
  2532. ;write a string, move cursor into next line
  2533. ;d0 = pointer to text
  2534. putnam      bsr     putstr
  2535.             tst.b   d0
  2536.             beq.s   ncr
  2537.             bsr     newline
  2538. ncr         rts
  2539.  
  2540. ;write one char
  2541. ;d0 = char
  2542. putchar     movem.l d1/a0,-(a7)
  2543.             move.l  ptr(PC),d1
  2544.             lea     out,a0
  2545.             move.b  d0,0(a0,d1)
  2546.             add.l   #1,ptr
  2547.             movem.l (a7)+,d1/a0
  2548.             rts
  2549.  
  2550. ;write a string, strings are only written when they end with CR
  2551. ;d0 = pointer to string
  2552. ;returns d0 = cursor position
  2553. putstr      movem.l d1-d7/a0-a6,-(a7)
  2554.             move.b  #1,printed
  2555.             move.l  d0,a2
  2556.             lea     out,a3
  2557.             move.l  ptr(PC),d0
  2558.             cmp.l   #0,a2
  2559.             beq     prend
  2560. pst1        move.b  (a2)+,d1
  2561.             cmpi.b  #13,d1
  2562.             beq     pst1
  2563.             move.b  d1,0(a3,d0)
  2564.             beq     prend
  2565.             addq    #1,d0
  2566.             cmpi.b  #$0a,d1
  2567.             bne.s   pst1
  2568.             move.l  d0,d3
  2569.             move.l  a3,d2
  2570.             move.l  fileptr,d1
  2571.             CALL    Write,dosbase(PC)
  2572.             clr.l   d0
  2573.             tst.b   morefl
  2574.             beq.s   pst1
  2575.             tst.b   mnflag
  2576.             beq.s   pst1
  2577.             add.b   #1,row
  2578.             move.b  row(PC),d1
  2579.             cmp.b   rows,d1
  2580.             bne.s   pst1
  2581.             move.l  #6,d3
  2582.             move.l  fileptr,d1
  2583.             move.l  #more,d2
  2584.             CALL    Write,dosbase(PC)
  2585.             bsr     con
  2586.             bsr     readline
  2587.             bsr     raw
  2588.             clr.b   row
  2589.             move.l  #4,d3
  2590.             move.l  fileptr,d1
  2591.             move.l  #thisline,d2
  2592.             CALL    Write,dosbase(PC)
  2593.             clr.l   d0
  2594.             bra     pst1
  2595. prend       move.l  d0,ptr
  2596.             movem.l (a7)+,d1-d7/a0-a6
  2597.             rts
  2598.  
  2599. ;Write 8 byte hex value
  2600. ;d0 = value
  2601. hex8        movem.l d1-d7/a0-a6,-(a7)
  2602.             moveq.l #7,d5
  2603.             lea     hex8area(PC),a1
  2604.             bra     hx1
  2605.  
  2606. ;Write 6 byte hex value
  2607. ;d0 = value
  2608. hexa        movem.l d1-d7/a0-a6,-(a7)
  2609.             moveq.l #5,d5
  2610.             lea     hexarea(PC),a1
  2611. hx1         lea     hextab(PC),a0
  2612.             clr.l   d2
  2613. hexloop     move.b  d0,d2
  2614.             and.b   #15,d2
  2615.             move.b  0(a0,d2),0(a1,d5)
  2616.             lsr.l   #4,d0
  2617.             dbf     d5,hexloop
  2618.             move.l  a1,d0
  2619.             movem.l (a7)+,d1-d7/a0-a6
  2620.             bra     putstr
  2621.  
  2622. ;Convert/write byte into binary string
  2623. ;d0 = value
  2624. bin         movem.l d1-d7/a0-a6,-(a7)
  2625.             moveq.l #7,d4
  2626.             lea     binarea(PC),a0
  2627. binloop     moveq.l #'0'/2,d1
  2628.             roxr.b  #1,d0
  2629.             roxl.b  #1,d1
  2630.             move.b  d1,0(a0,d4)
  2631.             dbf     d4,binloop
  2632.             move.l  a0,d0
  2633.             movem.l (a7)+,d1-d7/a0-a6
  2634.             bra     putstr
  2635.  
  2636. ;read one line of input string
  2637. readline    move.l  fileptr,d1
  2638.             move.l  #dummy,d2
  2639.             moveq.l #80,d3
  2640.             CALL    Read,dosbase(PC)
  2641.             rts
  2642.  
  2643. ;switch console to con: mode & empty input buffer
  2644. con         bsr     cmdcon
  2645.             move.l  #50,d2
  2646.             move.l  fileptr,d1
  2647.             CALL    WaitForChar,dosbase(PC)
  2648.             beq.s   conend
  2649.             bsr     readline
  2650. conend      rts
  2651.  
  2652.  
  2653. cmdcon      clr.l   dp_Arg1
  2654.             move.l  conmsg,a0
  2655.             move.l  #994,dp_Type
  2656.             bra.s   cons1
  2657.  
  2658. ;switch console window to raw mode
  2659. raw         move.l  conmsg,a0
  2660.             move.l  #994,dp_Type
  2661.             move.l  #-1,dp_Arg1
  2662.  
  2663. ;send a packet
  2664. ;a0 = msgport
  2665. ;dp_Type and dp_Arg1 have to be inizialized
  2666. cons1       movem.l d0-d7/a0-a6,-(a7)
  2667.             move.l  #dp_Link,LN_NAME
  2668.             move.l  #mypacket,dp_Link
  2669.             move.l  replyport,dp_Port
  2670.             lea     mypacket,a1
  2671.             CALL    PutMsg,_SysBase(PC)
  2672.             move.l  replyport,a0
  2673.             CALL    WaitPort,_SysBase(PC)
  2674.             movem.l (a7)+,d0-d7/a0-a6
  2675.             rts
  2676.  
  2677. ;32-bit division
  2678. ;d0 / d1
  2679. ;returns d0
  2680. div         movem.l d2-d3,-(a7)
  2681.             swap    d1
  2682.             move.w  d1,d2
  2683.             bne.s   div1
  2684.             swap    d0
  2685.             swap    d1
  2686.             swap    d2
  2687.             move.w  d0,d2
  2688.             beq.s   div2
  2689.             divu    d1,d2
  2690.             move.w  d2,d0
  2691. div2        swap    d0
  2692.             move.w  d0,d2
  2693.             divu    d1,d2
  2694.             move.w  d2,d0
  2695.             swap    d2
  2696.             move.w  d2,d1
  2697.             bra     div8
  2698. div1        moveq   #$10,d3
  2699.             cmpi.w  #$80,d1
  2700.             bcc.s   div3
  2701.             rol.l   #8,d1
  2702.             subq.w  #8,d3
  2703. div3        cmpi.w  #$800,d1
  2704.             bcc.s   div4
  2705.             rol.l   #4,d1
  2706.             subq.w  #4,d3
  2707. div4        cmpi.w  #$2000,d1
  2708.             bcc.s   div5
  2709.             rol.l   #2,d1
  2710.             subq.w  #2,d3
  2711. div5        tst.w   d1
  2712.             bmi.s   div6
  2713.             rol.l   #1,d1
  2714.             subq.w  #1,d3
  2715. div6        move.w  d0,d2
  2716.             lsr.l   d3,d0
  2717.             swap    d2
  2718.             clr.w   d2
  2719.             lsr.l   d3,d2
  2720.             swap    d3
  2721.             divu    d1,d0
  2722.             move.w  d0,d3
  2723.             move.w  d2,d0
  2724.             move.w  d3,d2
  2725.             swap    d1
  2726.             mulu    d1,d2
  2727.             sub.l   d2,d0
  2728.             bcc.s   div7
  2729.             subq.w  #1,d3
  2730.             add.l   d1,d0
  2731. div7        moveq   #0,d1
  2732.             move.w  d3,d1
  2733.             swap    d3
  2734.             rol.l   d3,d0
  2735.             swap    d0
  2736.             exg     d1,d0
  2737. div8        movem.l (a7)+,d2-d3
  2738.             rts
  2739.  
  2740. ;install a input-handler
  2741. installh    pea     0
  2742.             pea     0
  2743.             LIBCALL CreatePort
  2744.             lea     8(a7),a7
  2745.             move.l  d0,InputMsg
  2746.             move.l  d0,-(a7)
  2747.             LIBCALL CreateStdIO
  2748.             lea     4(a7),a7
  2749.             move.l  d0,InRequest
  2750.             move.l  d0,a1
  2751.             lea     devicenam(PC),a0
  2752.             clr.l   d0
  2753.             clr.l   d1
  2754.             CALL    OpenDevice,_SysBase(PC)
  2755.             move.l  d0,devstatus
  2756.             movea.l InRequest(PC),a1
  2757.             move.l  #InInterrupt,40(a1)
  2758.             move.w  #9,28(a1)
  2759.             CALL    DoIO,_SysBase(PC)
  2760.             move.l  d0,iostatus
  2761.             move.l  #-1,d0
  2762.             CALL    AllocSignal,_SysBase(PC)
  2763.             clr.l   d1
  2764.             bset    d0,d1
  2765.             move.l  d1,mysignal
  2766.             rts
  2767.  
  2768. ;remove handler
  2769. removeh     movea.l InRequest(PC),a1
  2770.             move.l  #InInterrupt,40(a1)
  2771.             move.w  #10,28(a1)
  2772.             CALL    DoIO,_SysBase(PC)
  2773.             movea.l InRequest(PC),a1
  2774.             CALL    CloseDevice,_SysBase(PC)
  2775.             move.l  InRequest,-(a7)
  2776.             LIBCALL DeleteStdIO
  2777.             lea     4(a7),a7
  2778.             move.l  InputMsg,-(a7)
  2779.             LIBCALL DeletePort
  2780.             lea     4(a7),a7
  2781.             rts
  2782.  
  2783. ;this is the handler, it checks if amiga-amiga-x
  2784. ;has been pressed and signals it to our task
  2785. Keyhandler  tst.b   running
  2786.             bne.s   endhandler
  2787.             cmp.b   #1,4(a0)
  2788.             bne.s   endhandler
  2789.             move.w  8(a0),d0
  2790.             andi.w  #$c0,d0
  2791.             cmpi.w  #$c0,d0
  2792.             bne.s   endhandler
  2793.             cmp.w   #$32,6(a0)
  2794.             bne.s   endhandler
  2795. wakeup      move.l  a0,-(a7)
  2796.             movea.l mytask(PC),a1
  2797.             move.l  mysignal(PC),d0
  2798.             CALL    Signal,_SysBase(PC)
  2799.             move.l  (a7)+,a0
  2800.             clr.b   4(a0)
  2801. endhandler  move.l  a0,d0
  2802.             rts
  2803.  
  2804. snoop       bsr     nodenam
  2805.             moveq.l #2,d7
  2806.             lea     TRuNode(PC),a4
  2807.             bsr     findnam
  2808.             tst.b   d7
  2809.             beq     tm6
  2810.             move.l  d0,captask
  2811.             pea     0
  2812.             pea     memportname
  2813.             LIBCALL CreatePort
  2814.             lea     8(a7),a7
  2815.             move.l  d0,snoopport
  2816.             beq     tm6
  2817.             lea     snoophead(PC),a0
  2818.             bsr     puthead
  2819.             move.l  _SysBase(PC),a1
  2820.             move.l  -196(a1),oldalloc
  2821.             move.l  -208(a1),oldfree
  2822.             move.l  #capmalloc,d0
  2823.             move.l  #-198,a0
  2824.             CALL    SetFunction,_SysBase(PC)
  2825.             move.l  _SysBase(PC),a1
  2826.             move.l  #capmfree,d0
  2827.             move.l  #-210,a0
  2828.             CALL    SetFunction,_SysBase(PC)
  2829.             clr.b   bool
  2830.             clr.b   cbreak
  2831. waitmem     move.l  snoopport(PC),a0
  2832.             move.l  #$1000,d0
  2833.             clr.l   d1
  2834.             move.b  15(a0),d1
  2835.             bset    d1,d0
  2836.             CALL    Wait,_SysBase(PC)
  2837.             btst    #12,d0
  2838.             beq.s   tm7
  2839.             move.b  #1,cbreak
  2840. tm7         move.l  mytask(PC),a0
  2841.             move.l  snoopport(PC),a0
  2842.             CALL    GetMsg,_SysBase(PC)
  2843.             tst.l   d0
  2844.             bne     tm8
  2845.             tst.b   cbreak
  2846.             bne     snoopend
  2847.             bra     waitmem
  2848. tm8         move.l  d0,a3
  2849.             move.l  20(a3),d3
  2850.             btst    #31,d3
  2851.             beq     freed
  2852.             move.l  #allok,d0
  2853.             bsr     putstr
  2854.             lea     memname(PC),a2
  2855.             lea     membit(PC),a4
  2856.             move.l  #4,d5
  2857. tm2         move.l  0(a4),d4
  2858.             btst    d4,d3
  2859.             beq.s   tm1
  2860.             move.l  0(a2),d0
  2861.             bsr     putstr
  2862. tm1         lea     4(a2),a2
  2863.             lea     4(a4),a4
  2864.             dbf     d5,tm2
  2865.             move.l  #26,d1
  2866.             bsr     tab
  2867.             move.l  24(a3),d0
  2868.             move.l  d0,d3
  2869.             bsr     hexa
  2870.             move.l  28(a3),d0
  2871.             bne.s   tm3
  2872.             move.l  #failed,d0
  2873.             bsr     putstr
  2874.             move.l  #47,d1
  2875.             bsr     tab
  2876.             bra     tm4
  2877. tm3         bsr     hexa
  2878.             move.l  28(a3),d0
  2879.             add.l   d3,d0
  2880.             bsr     hexa
  2881.             bra     tm4
  2882.  
  2883. freed       move.l  #free,d0
  2884.             bsr     putstr
  2885.             move.b  #'-',d0
  2886.             move.l  #18,d1
  2887. tm9         bsr     putchar
  2888.             dbf     d1,tm9
  2889.             move.b  #' ',d0
  2890.             bsr     putchar
  2891.             move.l  d3,d0
  2892.             bsr     hexa
  2893.             move.l  24(a3),d0
  2894.             bsr     hexa
  2895.             move.l  24(a3),d0
  2896.             add.l   d3,d0
  2897.             bsr     hexa
  2898.  
  2899. tm4         move.l  32(a3),d0
  2900.             bsr     hexa
  2901.             bsr     newline
  2902.             move.l  #36,d0
  2903.             move.l  a3,a1
  2904.             CALL    FreeMem,_SysBase(PC)
  2905.             bra     tm7
  2906.  
  2907. snoopend    move.l  _SysBase(PC),a1
  2908.             move.l  oldalloc(PC),d0
  2909.             move.l  #-198,a0
  2910.             CALL    SetFunction,_SysBase(PC)
  2911.             move.l  _SysBase(PC),a1
  2912.             move.l  oldfree,d0
  2913.             move.l  #-210,a0
  2914.             CALL    SetFunction,_SysBase(PC)
  2915.             move.l  snoopport,-(a7)
  2916.             LIBCALL DeletePort
  2917.             lea     4(a7),a7
  2918. tm6         rts
  2919.  
  2920. memname     dc.l    memlarg,memclr,memfast,memchip,mempubl
  2921. membit      dc.l    17,16,2,1,0
  2922.  
  2923. capmalloc   movem.l d0-d7/a0-a6,-(a7)
  2924.             move.l  _SysBase(PC),a6
  2925.             move.l  276(a6),d4
  2926.             cmp.l   captask(PC),d4
  2927.             bne.s   capm1
  2928.             tst.b   bool
  2929.             bne     capm1
  2930.             move.b  #1,bool
  2931.             move.l  d0,d5
  2932.             move.l  d1,d6
  2933.             bsr     allocmsg
  2934.             beq     capm2
  2935.             bset    #31,d6
  2936.             move.l  d6,20(a1)
  2937.             move.l  d5,24(a1)
  2938.             move.l  60(a7),32(a1)
  2939.             move.l  a1,remembr
  2940.             movem.l (a7)+,d0-d7/a0-a6
  2941.             bsr     memalloc
  2942.             movem.l d0-d7/a0-a6,-(a7)
  2943.             move.l  remembr(PC),a1
  2944.             move.l  d0,28(a1)
  2945.             move.l  snoopport,a0
  2946.             move.b  #5,8(a1)
  2947.             CALL    PutMsg,_SysBase(PC)
  2948.             clr.b   bool
  2949.             movem.l (a7)+,d0-d7/a0-a6
  2950.             rts
  2951. capm2       clr.b   bool
  2952. capm1       movem.l (a7)+,d0-d7/a0-a6
  2953. memalloc    dc.w    $4ef9
  2954. oldalloc    dc.l    0
  2955.  
  2956. capmfree    movem.l d0-d7/a0-a6,-(a7)
  2957.             move.l  _SysBase(PC),a6
  2958.             move.l  276(a6),d4
  2959.             cmp.l   captask(PC),d4
  2960.             bne.s   capf1
  2961.             tst.b   bool
  2962.             bne.s   capf1
  2963.             move.b  #1,bool
  2964.             move.l  a1,d5
  2965.             move.l  d0,d6
  2966.             bsr     allocmsg
  2967.             beq.s   capf2
  2968.             move.l  d6,20(a1)
  2969.             move.l  d5,24(a1)
  2970.             move.l  60(a7),32(a1)
  2971.             move.l  snoopport,a0
  2972.             move.b  #5,8(a1)
  2973.             CALL    PutMsg,_SysBase(PC)
  2974. capf2       clr.b   bool
  2975. capf1       movem.l (a7)+,d0-d7/a0-a6
  2976.             dc.w    $4ef9
  2977. oldfree     dc.l    0
  2978.  
  2979. allocmsg    move.l  #36,d0
  2980.             move.l  #65536,d1
  2981.             bsr     memalloc
  2982.             move.l  d0,a1
  2983.             tst.l   d0
  2984.             rts
  2985.  
  2986. myswitch    movem.l d0-d1/a0,-(a7)
  2987.             move.l  _SysBase(PC),a0
  2988.             move.l  276(a0),d0
  2989.             move.l  tasksnum(PC),d1
  2990.             lea     cputime,a0
  2991.             subq.l  #1,d1
  2992.             bmi.s   swadd
  2993. sw0         cmp.l   0(a0),d0
  2994.             beq.s   swi1
  2995.             lea     8(a0),a0
  2996.             dbf     d1,sw0
  2997.             bra.s   swadd
  2998. swi1        add.l   #1,4(a0)
  2999. swgo        movem.l (a7)+,d0-d1/a0
  3000.             dc.w    $4ef9
  3001. oldswitch   dc.l    0
  3002. swadd       cmp.l   #50,tasksnum
  3003.             bge.s   swgo
  3004.             add.l   #1,tasksnum
  3005.             move.l  d0,0(a0)
  3006.             move.l  #1,4(a0)
  3007.             bra.s   swgo
  3008.  
  3009. dosbase     dc.l    0
  3010. intuibase   dc.l    0
  3011. gfxbase     dc.l    0
  3012. window      dc.l    0
  3013. parmtxt     dc.l    0
  3014. fileptr     dc.l    0
  3015. conmsg      dc.l    0
  3016. ptr         dc.l    0
  3017. oldidl      dc.l    0
  3018. olddisp     dc.l    0
  3019. myseg       dc.l    0
  3020. mysignal    dc.l    0
  3021. iostatus    dc.l    -1
  3022. devstatus   dc.l    -1
  3023. cancelbit   dc.l    0
  3024. cancelbnum  dc.l    0
  3025. _SysBase    dc.l    0
  3026. InputMsg    dc.l    0
  3027. InRequest   dc.l    0
  3028. startmess   dc.l    0
  3029. savedat     dc.l    0
  3030. mytask      dc.l    0
  3031. wbmsg       dc.l    0
  3032. pointer     dc.l    0
  3033. replyport   dc.l    0
  3034. finfoptr    dc.l    0
  3035. dispatches  dc.l    0
  3036. maxdisp     dc.l    0
  3037. wbaddr      dc.l    0
  3038. remembr     dc.l    0
  3039. remembr2    dc.l    0
  3040. captask     dc.l    0
  3041. snoopport   dc.l    0
  3042. tasksnum    dc.l    0
  3043.  
  3044. stplist     dc.l    lh_tail
  3045. lh_tail     dc.l    0
  3046.             dc.l    stplist
  3047.             dc.b    1
  3048.             dc.b    0
  3049.  
  3050. InInterrupt dc.l    0           ;ln_Succ
  3051.             dc.l    0           ;ln_Pred
  3052.             dc.b    2           ;ln_Type
  3053.             dc.b    60          ;ln_Pri
  3054.             dc.l    0           ;ln_Name
  3055.             dc.l    0           ;is_Data
  3056.             dc.l    Keyhandler  ;is_Code()
  3057.  
  3058. window_l    dc.w    0
  3059. window_t    dc.w    0
  3060. window_w    dc.w    550
  3061. window_h    dc.w    200
  3062.  
  3063. binarea     dc.b    '         ',0
  3064.             EVEN
  3065. minus       dc.b    '  '
  3066. dezimal     dc.b    '   '
  3067. blnk        dc.b    ' ',0
  3068. entries     dc.b    0
  3069. timeout     dc.b    5
  3070. procnum     dc.b    0
  3071. running     dc.b    0
  3072. newpri      dc.b    0
  3073. tasktyp     dc.b    0
  3074. background  dc.b    0
  3075. bool        dc.b    0
  3076. printed     dc.b    0
  3077. cbreak      dc.b    0
  3078. rows        dc.b    0
  3079. row         dc.b    0
  3080. usageflag   dc.b    0
  3081. morefl      dc.b    1
  3082. mnflag      dc.b    1
  3083. tports      dc.b    1
  3084. params      dc.b    'tsdlrempi'
  3085. parmnum     equ     *-params
  3086. t2header    dc.b    '  ID    STATE   SIGALLOC SIGWAIT  SIGRECVD   PC   TASKNAME',0
  3087. theader     dc.b    '  ID    TYPE      STATE    PRI  CPUSE NUM TASKNAME',0
  3088. lheader     dc.b    ' NODE  CNT VER REV  FLAGS   ',0
  3089. libnam      dc.b    'LIBRARY NAME',0
  3090. devnam      dc.b    'DEVICE NAME',0
  3091. resnam      dc.b    'RESOURCE NAME',0
  3092. mheader     dc.b    'LOWER  UPPER   FREE  ATTR  PRI HUNK NAME',0
  3093. nxtline     dc.b    $9b,'K'
  3094. cr          dc.b    10,0
  3095. iheader     dc.b    ' NODE   DATA   CODE   PRI   TYPE     INTERRUPT NAME',0
  3096. rheader     dc.b    ' ADDR   PRI  FLAGS   VER   TYPE    RESIDENT NAME',0
  3097. pheader     dc.b    ' NODE  PORTNAME        FLAGS SIGBT NUM SIGTASK',0
  3098. hunkheader  dc.b    ' BCPL   DATA  LENGTH',0
  3099. ddheader    dc.b    'DEVICE   HDS SECTORS  TRACKS BUFFERS STATE    HANDLER',0
  3100. cdheader    dc.b    'PROCESSNAME    CURRENT DIRECTORY',0
  3101. ofheader    dc.b    ' LOCK  ACCESS  SIZE   PATH/FILENAME',0
  3102. scrheader   dc.b    'NUM  ADDR  TITLE',0
  3103. fohead      dc.b    ' NODE  CNT  Y   X  TYPE  LO  HI NAME',0
  3104. kickhead    dc.b    'START  END    LENGTH',0
  3105. snoophead   dc.b    'ACTION REQUIREMENTS       LENGTH FROM   TO     CALLER',0
  3106. access      dc.b    ' Read  ',0
  3107.             dc.b    ' Write ',0
  3108. romfnt      dc.b    'Rom  ',0
  3109. diskfnt     dc.b    'Disk ',0
  3110. wbname      dc.b    'Workbench',0
  3111. status      dc.b    'Added    ',0
  3112.             dc.b    'Running  ',0
  3113.             dc.b    'Ready    ',0
  3114.             dc.b    'Waiting  ',0
  3115.             dc.b    'Exeption ',0
  3116.             dc.b    'Removed  ',0
  3117.             dc.b    'Freezed  ',0
  3118.             dc.b    'Freezed  ',0
  3119. type        dc.b    'Unknown   ',0
  3120.             dc.b    'Task      ',0
  3121.             dc.b    'Interrupt ',0
  3122.             dc.b    'Device    ',0
  3123.             dc.b    'Msgport   ',0
  3124.             dc.b    'Message   ',0
  3125.             dc.b    'Freemsg   ',0
  3126.             dc.b    'Replymsg  ',0
  3127.             dc.b    'Resource  ',0
  3128.             dc.b    'Library   ',0
  3129.             dc.b    'Memory    ',0
  3130.             dc.b    'Softint   ',0
  3131.             dc.b    'Font      ',0
  3132.             dc.b    'Process   ',0
  3133.             dc.b    'Semaphore ',0
  3134. mp_flags    dc.b    'Signal  ',0
  3135.             dc.b    'Softint ',0
  3136.             dc.b    'Ignore  ',0
  3137. windowname  dc.b    'Xoper V1.2  ) 1988 Werner Gunther',0
  3138. newname     dc.b    '-Xoper-',0
  3139. memportname dc.b    'MemSnoop',0
  3140.  
  3141. cmdnum      set      0
  3142. commds      ADDCMD  'time'
  3143.             ADDCMD  'taskpri'
  3144.             ADDCMD  'info'
  3145.             ADDCMD  'pri'
  3146.             ADDCMD  'flush'
  3147.             ADDCMD  'freeze'
  3148.             ADDCMD  'warm'
  3149.             ADDCMD  'signal'
  3150.             ADDCMD  'break'
  3151.             ADDCMD  'alert'
  3152.             ADDCMD  'lastalert'
  3153.             ADDCMD  'hold'
  3154.             ADDCMD  'exit'
  3155.             ADDCMD  'clear'
  3156.             ADDCMD  'cancel'
  3157.             ADDCMD  'more'
  3158.             ADDCMD  'taskports'
  3159.             ADDCMD  'hunks'
  3160.             ADDCMD  'devices'
  3161.             ADDCMD  'openlib'
  3162.             ADDCMD  'closelib'
  3163.             ADDCMD  'currentdir'
  3164.             ADDCMD  'cd'
  3165.             ADDCMD  'mypri'
  3166.             ADDCMD  'files'
  3167.             ADDCMD  'locks'
  3168.             ADDCMD  'unlock'
  3169.             ADDCMD  'screens'
  3170.             ADDCMD  'windows'
  3171.             ADDCMD  'closescreen'
  3172.             ADDCMD  'closewindow'
  3173.             ADDCMD  'fonts'
  3174.             ADDCMD  'windowfonts'
  3175.             ADDCMD  'lockdrive'
  3176.             ADDCMD  'freedrive'
  3177.             ADDCMD  'capture'
  3178.             ADDCMD  'clrcold'
  3179.             ADDCMD  'clrcool'
  3180.             ADDCMD  'clrwarm'
  3181.             ADDCMD  'snoop'
  3182.             ADDCMD  'usage'
  3183. hex8area    dc.b    '  '
  3184. hexarea     dc.b    '       ',0
  3185. hextab      dc.b    '0123456789abcdef'
  3186. infoh2      dc.b    'Dispatches:',0
  3187. infoh1      dc.b    'CPU:',0
  3188. infoh3      dc.b    'CPU activity: ',0
  3189. infoh6      dc.b    'Total:',0
  3190. infoh4      dc.b    '% ',0
  3191. cpu0        dc.b    '68000',0
  3192. cpu1        dc.b    '68010',0
  3193. cpu2        dc.b    '68020',0
  3194. cpu3        dc.b    '/68881',0
  3195. syst        dc.b    'DF0:',0
  3196. devload     dc.b    'loaded   ',0
  3197. devnload    dc.b    'unloaded ',0
  3198. prompt      dc.b    $9b,'J','->',$9b,$20,$70
  3199. cls         dc.b    $9b,'0 ',$70,$9b,'H'
  3200. getwin      dc.b    $9b,$30,$20,$71
  3201. thisline    dc.b    $9b,$46,$9b,$4b
  3202. notfile     dc.b    '--- ------- ------- ------- ',0
  3203. ganzlongnix dc.b    '-'
  3204. longnix     dc.b    '----'
  3205. nix         dc.b    '--- ',0
  3206. noinfo      dc.b    'No Info on ',0
  3207. namerr      dc.b    'Unable to find ',0
  3208. adrerr      dc.b    'Address Error!',10,0
  3209. noderr      dc.b    'Can`t find this Node. Continue ? (Y/N)',0
  3210. listerr     dc.b    'Unable to find ListHeader. Sort aborted.',0
  3211. noguru      dc.b    'No Alert, shall I produce one ?',0
  3212. gurutxt     dc.b    'Guru Meditation #',0
  3213. clrtxt      dc.b    'Memory Hunks cleared.',0
  3214. canerr0     dc.b    'Process is not a CLI-task',10
  3215.             dc.b    'Has it been started from Workbench ? (Y/N)',10,0
  3216. canerr1     dc.b    'Process was created by CreateProc()',10
  3217.             dc.b    'Shall I UnLoad() ? (Y/N)',10,0
  3218. unloaderr   dc.b    'Arrrgh.. can`t find segments, aborting',0
  3219. noprocs     dc.b    'Not a Process.',0
  3220. notload     dc.b    'No program loaded.',0
  3221. cliprocs    dc.b    'Cli-Process',0
  3222. procloaded  dc.b    'Loaded as a command: ',0
  3223. segloaded   dc.b    'Created by CreateProc()',0
  3224. coldtxt     dc.b    'Cold Capture: ',0
  3225. cooltxt     dc.b    'Cool Capture: ',0
  3226. warmtxt     dc.b    'Warm Capture: ',0
  3227. kicktxt     dc.b    'KickMem     : ',0
  3228. unset       dc.b    'unset',0
  3229. intnames    dc.b    'Serial Out ',0
  3230.             dc.b    'Disk Block ',0
  3231.             dc.b    'SoftInt    ',0
  3232.             dc.b    'CIAA       ',0
  3233.             dc.b    'Copper     ',0
  3234.             dc.b    'VBeam      ',0
  3235.             dc.b    'Blitter    ',0
  3236.             dc.b    'Audio Ch.0 ',0
  3237.             dc.b    'Audio Ch.1 ',0
  3238.             dc.b    'Audio Ch.2 ',0
  3239.             dc.b    'Audio Ch.3 ',0
  3240.             dc.b    'Serial In  ',0
  3241.             dc.b    'Disk Sync  ',0
  3242.             dc.b    'CIAB       ',0
  3243.             dc.b    'SoftInt    ',0
  3244.             dc.b    'NMI        ',0
  3245. inttyp      dc.b    0,0,1,1,1,1,0,0,0,0,0,0,0,1,1,1
  3246. devicenam   dc.b    'input.device',0
  3247. memlarg     dc.b    'LARGEST ',0
  3248. memclr      dc.b    'CLEAR ',0
  3249. memfast     dc.b    'FAST ',0
  3250. memchip     dc.b    'CHIP ',0
  3251. mempubl     dc.b    'PUBLIC ',0
  3252. failed      dc.b    'Failed !',0
  3253. allok       dc.b    'ALLOC: ',0
  3254. free        dc.b    'FREE: ',0
  3255.  
  3256. synerr      dc.b    'Syntax Error, type "?" for help',10,0
  3257. more        dc.b    '<MORE>'
  3258. waittxt     dc.b    '<RETURN>',$9b,$4a
  3259. wberr       dc.b    'Can`t examine Workbench locks',0
  3260. dnotf       dc.b    'Directory not found',0
  3261. notdir      dc.b    'Not a directory',0
  3262. nomount     dc.b    ' not mounted.',0
  3263. dishelp     dc.b    10,'Names are case sensitive and followd by a ":"',0
  3264. unlerr      dc.b    'Lock not found',0
  3265. unl1        dc.b    'Lock is on ',0
  3266. unltxt      dc.b    'Old lock was: ',0
  3267. unltxt2     dc.b    'Unlock ? (Y/N)',10,0
  3268. scnofound   dc.b    'Screen not found.',0
  3269. winnofound  dc.b    'Window not found.',0
  3270. stperr      dc.b    'Task must be "READY" or "WAITING"',10,0
  3271. waerr       dc.b    'Task must be "FREEZED"',10,0
  3272. onscr       dc.b    'On Screen: ',0
  3273. usetxt      dc.b    $9b,'1mUSAGE:',$9b,'0m Xoper [T] [S] [L] [D] [R] [E] [M] [P] [I]',$9b,'K',10
  3274.             dc.b    'OR     Xoper -b',$9b,'K',10
  3275.             dc.b    $9b,'1mDISPLAY:',$9b,'0m',$9b,'K',10
  3276.             dc.b    '[T]asks [S]=taskstate [L]ibraries [D]evices [R]esources',$9b,'K',10
  3277.             dc.b    'r[E]sident [M]emory [P]orts [I]nterrupts [Q]uit',$9b,'K',10
  3278.             dc.b    $9b,'1mCOMMANDS:',$9b,'0m',$9b,'K',10
  3279.             dc.b    'Time         <secs>',$9b,'K',10
  3280.             dc.b    'Taskpri      <priority>  [processnum] <taskname>',$9b,'K',10
  3281.             dc.b    'Mypri        <priority>',$9b,'K',10
  3282.             dc.b    'Signal       <mask(hex)> [processnum] <taskname>',$9b,'K',10
  3283.             dc.b    'Break        [processnum] <taskname>',$9b,'K',10
  3284.             dc.b    'Freeze|Warm  [processnum] <taskname>',$9b,'K',10
  3285.             dc.b    'Cancel       [processnum] <taskname>',$9b,'K',10
  3286.             dc.b    'Snoop        [processnum] <taskname>',$9b,'K',10
  3287.             dc.b    'Pri          <priority> <nodename>',$9b,'K',10
  3288.             dc.b    'Info         <name>',$9b,'K',10
  3289.             dc.b    'Clear        <longword(hex)>',$9b,'K',10
  3290.             dc.b    'Hunks        [processnum] <procname>',$9b,'K',10
  3291.             dc.b    'CD           <directory> [processnum] <procname>',$9b,'K',10
  3292.             dc.b    'Unlock       <lock>',$9b,'K',10
  3293.             dc.b    'Openlib    | Closelib <libraryname>',$9b,'K',10
  3294.             dc.b    'Closewindow| Closescreen <title>',$9b,'K',10
  3295.             dc.b    'Lockdrive  | Freedrive   <DFn:>',$9b,'K',10
  3296.             dc.b    'Flush,Devices,Currentdir,Files,Locks,Lastalert,More',$9b,'K',10
  3297.             dc.b    'Taskports,Windows,Screens,Fonts,Windowfonts,Capture',$9b,'K',10
  3298.             dc.b    'ClrCool,ClrCold,ClrWarm,Usage,Hold,Exit',$9b,'K',10
  3299. null        dc.b    0
  3300.  
  3301.     IFD DEBUG
  3302. dosname     dc.b    'dos.library',0
  3303. intuiname   dc.b    'intuition.library',0
  3304. gfxname     dc.b    'graphics.library',0
  3305.             EVEN
  3306.     ENDC
  3307.  
  3308.             BSS     blabla
  3309. buffer      ds.b    256
  3310. fname       ds.b    284
  3311. out         ds.b    80
  3312. dummy       ds.b    80
  3313. in          ds.b    80
  3314. cputime     ds.b    400
  3315.  
  3316. mypacket    BSS     standardpacket
  3317.  
  3318. LN_SUCC     ds.l    1
  3319. LN_PRED     ds.l    1
  3320. LN_TYPE     ds.b    1
  3321. LN_PRI      ds.b    1
  3322. LN_NAME     ds.l    1
  3323. MP_FLAGS    ds.b    1
  3324. MP_SIGBIT   ds.b    1
  3325. MP_SIGTASK  ds.l    1
  3326. MN_SIZE     ds.w    1
  3327. LH_HEAD     ds.l    1
  3328. LH_TAIL     ds.l    1
  3329. LH_TAILPRED ds.l    1
  3330. LH_TYPE     ds.b    1
  3331. LH_pad      ds.b    1
  3332. dp_Link     ds.l    1
  3333. dp_Port     ds.l    1
  3334. dp_Type     ds.l    1
  3335. dp_Res1     ds.l    1
  3336. dp_Res2     ds.l    1
  3337. dp_Arg1     ds.l    1
  3338. dp_Arg2     ds.l    1
  3339. dp_Arg3     ds.l    1
  3340. dp_Arg4     ds.l    1
  3341. dp_Arg5     ds.l    1
  3342. dp_Arg6     ds.l    1
  3343. dp_Arg7     ds.l    1
  3344.             END
  3345.  
  3346. \Rogue\Monster\
  3347. else
  3348.   echo "will not over write Xoper.a2"
  3349. fi
  3350. if [ `wc -c Xoper.a2 | awk '{printf $1}'` -ne 38075 ]
  3351. then
  3352. echo `wc -c Xoper.a2 | awk '{print "Got " $1 ", Expected " 38075}'`
  3353. fi
  3354. if `test ! -s Xoper.doc`
  3355. then
  3356. echo "writing Xoper.doc"
  3357. cat > Xoper.doc << '\Rogue\Monster\'
  3358.                                  Xoper V1.0
  3359.  
  3360.                     Copyright (c) Werner Gunther 1988
  3361.  
  3362. Xoper is a freeware program to display and to control system activity.
  3363. Permition is granted to freely distribute this program.
  3364.  
  3365. --------------------------------------------------------------------------
  3366. Changes in V1.2:
  3367. New commands: Snoop, Capture, ClrCool, ClrWarm, ClrCold.
  3368. Added       : CPU usage by task.
  3369.  
  3370. Cancel command has been rewritten, some minor bugs removed.
  3371. -------------------------------------------------------------------------
  3372.  
  3373. Starting Xoper from CLI:
  3374.  
  3375. Xoper [T] [S] [L] [D] [R] [E] [M] [P] [I]
  3376.  
  3377. These parameters are decribed below. For all those who like long
  3378. Startup-Sequences, overcrowded memory and hot-keys enter
  3379.  
  3380. Xoper -b
  3381.  
  3382. This will install Xoper in background waiting for LeftAmiga-RightAmiga-X
  3383. to pop up. In both cases you don't have to RUN or RUNBACK Xoper, it will
  3384. always create its own process.
  3385.  
  3386. Xoper Commands:
  3387. ---------------
  3388.  
  3389.  Commands can be entered after the prompt '->', these are divided into two
  3390. groups:
  3391.  
  3392. Display commands: These are always single character entries and may be
  3393. specified in any order, upper or lower case, with or w/o enbedded blanks,
  3394. after the prompt or from CLI as parameters:
  3395.  
  3396. T = Tasks (Default if Xoper is called without parameters)
  3397. Task node (HEX), Display type, status, priority (decimal), CPU usage
  3398. (percent), processnumber for Dos-Processes (decimal), taskname.
  3399.  
  3400. S = Task Signals
  3401. Task node (HEX), Allocated Signals (HEX), Signals the Task is waiting for
  3402. (HEX), Signals received (HEX), Address of the next instruction to be
  3403. executed (HEX).
  3404.  
  3405. L = Libraries
  3406. Base address (HEX), open count (decimal), version (decimal), revision
  3407. (decimal), flags (binary), libraryname.
  3408.  
  3409. D = Devices
  3410. Base address (HEX), open count (decimal), version (decimal), revision
  3411. (decimal), flags (binary), devicename.
  3412.  
  3413. R = Resident
  3414. Base address (HEX), priority (decimal), flags (binary), version
  3415. (decimal), type, name.
  3416.  
  3417. E = Resources (sorry)
  3418. Base address (HEX), open count (decimal), version (decimal), revision
  3419. (decimal), flags (binary), resource name.
  3420.  
  3421. M = Memory
  3422. Lower and upper bounds (HEX), bytes free (decimal), attributes, priority
  3423. (decimal), hunk name.
  3424.  
  3425. P = Ports
  3426. Node address (HEX), portname, flags, signal bit (decimal), queue length
  3427. [number of messages] (decimal), taskname.
  3428.  
  3429. I = Interrupts
  3430. Node address (HEX), pointer to interrupt data (HEX), pointer to interrupt
  3431. code (HEX), priority (decimal),type [interupt queue the interrupt belongs
  3432. to], interrupt name.
  3433.  
  3434. H = Help ( or ?)
  3435. Show a list of commands.
  3436.  
  3437. Q = Quit
  3438. Same as QUIT (see below).
  3439.  
  3440. Example: Entering TPM would display Tasks, Ports and Memory. The display
  3441. would be updated after a few seconds (5 by default, may be changed
  3442. anytime, see below.)
  3443.  
  3444. Other commands that do not display lists:
  3445. These commands may be entered upper or lower case. Parameters enclosed
  3446. in '<>' must be, enclosed in '[]' may be specified. Names are usualy
  3447. entered as ascii-strings, it can however happen that two or more nodes of
  3448. the same name exist. On tasks you may specify the DOS-Processnumber to
  3449. sort them out. If everything fails, you can enter the Node-Address with a
  3450. leading '$'. This Address will be checked first before the command is being
  3451. executed. If the check fails, you'll get an error message or a warning or
  3452. a prompt, depending on what went wrong. Names are always the last parameter
  3453. to enter. This may seem strange, but it is the simplest way to get rid of
  3454. enbedded blanks.
  3455.  
  3456. Time <seconds>
  3457. Set time between updates. Minimum is 1 second, maximum is 255, default is 5
  3458. seconds.
  3459. Example: Time 1
  3460.  
  3461. Taskpri <priority> [processnumber] <taskname>
  3462. Change the priority of a task. Values may range from -127 to 127, better
  3463. use values between -5 and 5.
  3464. Example: Taskpri 5 New Cli
  3465.  
  3466. Mypri <priority>
  3467. Shortcut for "Taskpri Xoper <priority>"
  3468. Example: Mypri 6
  3469.  
  3470. Pri <priority> <nodename>
  3471. Change the priority of any other node. This commad does not work for Tasks.
  3472. If the specified node has been found, the entire list the node belongs to
  3473. will be resorted.
  3474. Example: Pri 1 Chip Memory        (try to allocate memory in CHIP first)
  3475.  
  3476. Break [processnumber] <taskname>
  3477. Set break signals. Useful for tasks running in background or from Workbench.
  3478. Example: Break 3 New CLI
  3479.  
  3480. Hunks [processnumber] <processname>
  3481. Show location, BCPL-Pointers and length of memory blocks the process uses.
  3482. Example: Hunks RAM
  3483.  
  3484. Snoop [processnumber] <taskname>
  3485. Track memory allocation/deallocation of a task. Press break (CTRL-C) to
  3486. stop. List includes: action (alloc/free), memory requirents (CHIP/ FAST/
  3487. PUBLIC etc), memory size, memory location (start, end) and the address from
  3488. where AllocMem() was called.
  3489.  
  3490. Files
  3491. List lock, access, size and name of open files.
  3492.  
  3493. Locks
  3494. List any lock.
  3495. BUG: Trying to lock the Volume "RAM Disk" crashes the machine sometimes. If
  3496. a Volume "RAM Disk" is found it will be replaced by the devicename "RAM:"
  3497. (this has been fixed on WB 1.3). Make sure you don't have a disk labeled
  3498. "RAM Disk" or you'll never see its locks:-)
  3499.  
  3500. Currentdir
  3501. List current directory settings of all processes.
  3502.  
  3503. Devices
  3504. List name,heads,sectors,tracks,startup-buffers and handler-process of every
  3505. DOS-device.
  3506.  
  3507. Capture
  3508. Show vectors controling the reset, i.e. CoolCapture, ColdCapture and
  3509. WarmCapture pointers, KickMem allocations. Useful when searching
  3510. for Viruses, but remember that the RAD: device in 1.3 uses the KickMem
  3511. pointer to recover from a reset.
  3512.  
  3513. ClrCool
  3514. ClrCold
  3515. ClrWarm
  3516. Clear one of those pointers.
  3517.  
  3518. Lockdrive <drivename:>
  3519. Prevent DOS, Workbench and Disk-Validator from cluttering on the drive.
  3520. This command isn't very useful, but I needed it myself. Please note that
  3521. the drivename is case sensitive and has to end with a ':'.
  3522.  
  3523. Freedrive <drivename:>
  3524. Re-enable a drive.
  3525.  
  3526. Windows
  3527. List address and title of all windows.
  3528.  
  3529. Screens
  3530. List address and title of screens.
  3531.  
  3532. Fonts
  3533. List address,height,width,type,fist character and last character of all
  3534. loaded fonts.
  3535.  
  3536. Windowfonts
  3537. List Windows and associated fonts.
  3538.  
  3539. Freeze [processnumber] <taskname>
  3540. Halt a Task. The task should be READY or WAITING. Frozen tasks are queued in
  3541. a new list called FREEZED. When you leave Xoper, halted Task will be
  3542. released.
  3543. Example: Freeze Killer Graphics Task
  3544.  
  3545. Warm [processnum] <taskname>
  3546. Restart a halted Task. Task must be FREEZED.
  3547. Example: Warm Killer Graphics Task
  3548.  
  3549. Info <librarynode | devicenode>
  3550. Show additional information stored in the lib_IdString field.
  3551. Example: Info arp.library
  3552.  
  3553. Openlib <libraryname>
  3554. Open a library. This is useful if you don't want a specified library being
  3555. 'flushed' out.
  3556. Example: Openlibrary arp.library
  3557.  
  3558. Clear [longword]
  3559. Fill unused memory chunks with pattern, default is 0. Handy for debuggers.
  3560. Example: Clear $66726565
  3561.  
  3562. Flush
  3563. Clean up memory, flush unused libraries, devices and fonts.
  3564.  
  3565. Lastalert
  3566. Show last Guru Meditation code or rubbish.
  3567.  
  3568. Usage
  3569. Toggle CPUSE field on the task display between usage relative to all
  3570. possible dispatches and usage relative to actually dispatched tasks.
  3571. Ahem...not very clear I think. Well, let me try again...
  3572. If you add all CPUSE fields together you get 100 % (more or less 1%). After
  3573. entering "Usage" adding the fields together will give you the same value as
  3574. shown in the 'CPU Activity field'. (I HATE having to write docs)
  3575.  
  3576. Taskports
  3577. Disable / enable a listing of taskports if ports are displayed.
  3578.  
  3579. More
  3580. Stop displaying "<MORE>" and "<RETURN>" if output exceeds window.
  3581.  
  3582. Quit or just Q
  3583. Exit Xoper. If Xoper was started with '-b' or if 'Hold' was specified it
  3584. will stay in background waiting for LeftAmiga-RightAmiga-X.
  3585.  
  3586. Hold
  3587. Exit Xoper but install a key-handler and stay in background. Window
  3588. settings and display commands are saved.
  3589.  
  3590. Exit
  3591. Clean up and quit.
  3592.  
  3593. !!!! WARNING: The next few commands are dangerous and 'dirty' !!!!!
  3594. !!!!!!!!!!!! don't use them if not strictly necessary !!!!!!!!!!!!!
  3595.  
  3596. Cancel [processnumber] <taskname>
  3597. Cancel a task or a process. If the task has been called from CLI, the Task
  3598. itself and the CLI will be killed. Hunks, Windows, Screens  and the
  3599. teminal-window will be freed. Simple tasks are just RemTask()'ed. If it is
  3600. not a CLI Task you'll be asked if it is a Workbench task, if the answer is
  3601. 'Yes' unloading will be done by the Workbench. If not, you will be prompted
  3602. if Xoper should unload the code. Enter 'No' if you don't know how the task
  3603. has been started.
  3604.  
  3605. Closewindow <title>
  3606. Closes a Window. Please, use it only if the corresponding Task has been
  3607. 'Cancel'ed. Use the Window-Structure address if the window has no name.
  3608.  
  3609. Closescreen <title>
  3610. same as above, but for screens.
  3611.  
  3612. Unlock <lock (BPTR)>
  3613. Unlock a file.
  3614.  
  3615. Closelib <libraryname>
  3616. This is exactly the same as CloseLibrary().
  3617.  
  3618. CD [processnumber] <processname>
  3619. Change the current directory of a process. You are prompted if the old
  3620. directory lock should be unlocked.
  3621.  
  3622. Signal <mask> [processnumber] <taskname>
  3623. Set any task-signal. Mask is a hexadecimal value with or w/o leading '$'.
  3624. See task's SIGWAIT field for sensible values. Tasks normaly do not wait for
  3625. signals only, but for messages, that's why this command may not have the
  3626. desired effect, but it is quite useful for tasks hanging around and waiting
  3627. for events that may never happen. Warning: Using Signal without any
  3628. knowledge about what you are going to signal may cause a system-crash!
  3629. Example: Signal 10000000 PopCLI III
  3630.  
  3631. ----------------------------------------------------------------------------
  3632.  
  3633. Please send flames, bug reports and especially a list of features you would
  3634. like to have included in the next version to
  3635.  
  3636.  Werner Gunther
  3637.  Wingertspfad 12
  3638.  D 6900 Heidelberg
  3639.  (Germany)
  3640.  
  3641. or to my EMAIL address for a fast response:
  3642.  
  3643.  G35@DHDURZ1.BITNET
  3644.  
  3645.  
  3646. \Rogue\Monster\
  3647. else
  3648.   echo "will not over write Xoper.doc"
  3649. fi
  3650. if [ `wc -c Xoper.doc | awk '{printf $1}'` -ne 9600 ]
  3651. then
  3652. echo `wc -c Xoper.doc | awk '{print "Got " $1 ", Expected " 9600}'`
  3653. fi
  3654. echo "Finished archive 1 of 2"
  3655. # if you want to concatenate archives, remove anything after this line
  3656. exit
  3657. -- 
  3658. Bob Page, U of Lowell CS Dept.  page@swan.ulowell.edu  ulowell!page
  3659. Have five nice days.
  3660.  
  3661.  
  3662.