home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 3 / CDPDIII.bin / pd / utilities / monitors / xoper / xoper.a < prev    next >
Text File  |  1991-12-15  |  197KB  |  8,437 lines

  1. ******************************************
  2. *                     *
  3. * Xoper 2.3 Copyright (C) Werner Gunther *
  4. *    (68881 code by Lothar English)      *    
  5. *                     *
  6. ******************************************
  7. *  Written for the A68K V2.6 Assembler     *
  8. *      by Charlie Gibbs and         *
  9. *       Brian R. Anderson         *
  10. *                     *
  11. *  Do not use Smallcode/Smalldata when     *
  12. *          linking             *
  13. ******************************************
  14. ;DEBUG SET 1
  15.         XREF    _LVOSwitch
  16.         XREF    _LVOAddTask
  17.         XREF    _LVORemTask
  18.         XREF    _LVOFindTask
  19.         XDEF    _SysBase
  20. sysbase     equ     4
  21. mysignal    equ     17
  22.  
  23. CALL        MACRO
  24.         xref    _LVO\1
  25.         move.l  \2,a6
  26.         jsr     _LVO\1(a6)
  27.         ENDM
  28.  
  29. RECALL        MACRO
  30.         xref    _LVO\1
  31.         jsr     _LVO\1(a6)
  32.         ENDM
  33.  
  34. LIBCALL     MACRO
  35.         xref    _\1
  36.         jsr     _\1
  37.         ENDM
  38.  
  39. ADDCMD        MACRO
  40. cmdnum        set     cmdnum+1
  41.         dc.b    \1,0
  42.         ENDM
  43.  
  44. ;Program startup. If called from DOS we
  45. ;use segment splitting to detach
  46. ;from our DOS-task.
  47. start        lea     dataarea,a4
  48.         moveq   #3,d0
  49.         lea     dummyinput(a4),a1
  50. getparm     move.b  (a0)+,(a1)+
  51.         dbf     d0,getparm
  52.         move.b  #$0a,in
  53.         lea     conname(PC),a1
  54.         move.l  sysbase,a0
  55.         cmp.w   #36,20(a0)
  56.         blt.s   2$
  57.         addq.b  #1,post_V34(a4)
  58. 2$        lea     350(a0),a0
  59.         CALL    FindName,sysbase
  60.         move.l  d0,condev(a4)
  61.         lea     dosname(PC),a1
  62.         move.l  sysbase,a0
  63.         lea     378(a0),a0
  64.         move.l  a0,-(a7)
  65.         CALL    FindName,sysbase
  66.         move.l  d0,dosbase(a4)
  67.         move.l  0(a7),a0
  68.         lea     gfxname(PC),a1
  69.         RECALL  FindName
  70.         move.l  d0,gfxbase(a4)
  71.         move.l  (a7)+,a0
  72.         lea     intuiname(PC),a1
  73.         RECALL  FindName
  74.         move.l  d0,intuibase(a4)
  75.         move.l  d0,a0
  76.         move.l  $38(a0),a0
  77.         move.w  12(a0),d0
  78.         sub.w   #550,d0
  79.         move.w  d0,window_l(a4)
  80.  
  81.         cmp.l   #'kill',dummyinput(a4)
  82.         bne.s   nokill
  83.  
  84. ; This code tries to remove Xoper from the System
  85. ; in case Xoper 'freezes' or crashes.
  86. ; It works as follows: Xoper leaves the address of its cleanup
  87. ; routine in the UserData field of its Task structure. EXEC's
  88. ; context-restore code leaves the current PC of a task in the
  89. ; first longword of the tasks stack. All we have to do is to
  90. ; copy the address of Xoper's cleanup routine to its stack and
  91. ; to rescedule Xoper (using Signal() in this case).
  92.  
  93.         lea     newname(a4),a1
  94.         move.l  sysbase,a6
  95.         jsr     _LVOFindTask(a6)
  96.         tst.l   d0
  97.         beq.s   1$
  98.         move.l  d0,a1
  99.         move.l  $36(a1),d0   ;TC_SPReg: Xoper's stackptr
  100.         jsr     getstackptr
  101.         move.l  d0,a0
  102.         move.l  $58(a1),d0   ;TC_UserData: address of the Exit() routine
  103.         move.l  d0,0(a0)     ;change Xoper's PC (first value on stack)
  104.         moveq   #-1,d0
  105.         move.l  sysbase,a6
  106.         jsr     _LVOSignal(a6)  ;force Xoper to be dispatched
  107.  
  108. 1$        moveq   #0,d0
  109.         rts
  110.  
  111. nokill        move.l  sysbase,a6
  112.         move.l  276(a6),a5
  113.         tst.l   $ac(a5)
  114.         bne.s   notwb
  115.         lea     $5c(a5),a0
  116.         RECALL  WaitPort
  117.         lea     $5c(a5),a0
  118.         RECALL  GetMsg
  119.         move.l  d0,wbmsg(a4)
  120.         move.w  #$740a,in
  121. notwb:
  122.        IFND  DEBUG
  123.         lea     xopcon(a4),a1
  124.         RECALL  FindPort
  125.         tst.l   d0
  126.         bne     oops
  127.        ENDC
  128.         tst.l   wbmsg(a4)
  129.         beq.s   fromdos
  130.         move.l  276(a6),a0          ;ExecBase->ThisTask
  131.         move.l  #newname,10(a0)
  132.         jmp     mainprg
  133.  
  134. fromdos:
  135.     IFND DEBUG
  136.         cmp.w   #'-b',dummyinput(a4)
  137.         bne.s   stt1
  138.         CALL    Output,dosbase(a4)
  139.         move.l  d0,-(a7)
  140.         move.l  #dataarea+windowname,d2
  141.         move.l  d0,d1
  142.         moveq.l #newname-windowname-1,d3
  143.         CALL    Write,dosbase(a4)
  144.         move.l  #cr+dataarea,d2
  145.         move.l  (a7)+,d1
  146.         moveq.l #1,d3
  147.         RECALL  Write
  148. stt1        lea     start(PC),a1
  149.         move.l  -4(a1),d3
  150.         move.l  d3,myseg(a4)
  151.  
  152.         move.l  #mainprg,d3
  153.         subq    #4,d3
  154.         lsr.l   #2,d3
  155.         clr.l   -4(a1)
  156.  
  157.         move.l  4,a0
  158.         move.l  276(a0),a0
  159.         move.l  152(a0),d1
  160.         CALL    DupLock,dosbase(a4)
  161.         move.l  d0,-(a7)
  162.  
  163.         CALL    Forbid,sysbase
  164.         move.l  #newname+dataarea,d1
  165.         clr.l   d2
  166.         move.l  #3500,d4
  167.         CALL    CreateProc,dosbase(a4)
  168.         move.l  d0,a0
  169.         move.l  (a7)+,d0
  170.         move.l  d0,60(a0)
  171.         CALL    Permit,sysbase
  172.  
  173.         moveq   #0,d0
  174.         rts
  175. oops        CALL    Forbid,sysbase
  176.         lea     newname(a4),a1
  177.         move.l  sysbase,a0
  178.         lea     406(a0),a0
  179.         RECALL  FindName
  180.         tst.l   d0
  181.         bne.s   1$
  182.         lea     newname(a4),a1
  183.         move.l  sysbase,a0
  184.         lea     420(a0),a0
  185.         RECALL  FindName
  186.         tst.l   d0
  187.         beq.s   2$
  188. 1$        move.l  d0,a1
  189.         move.l  #(1<<mysignal),d0
  190.         RECALL  Signal
  191. 2$        RECALL  Permit
  192.         move.l  wbmsg(a4),d0
  193.         beq.s   leave
  194.         move.l  d0,a1
  195.         RECALL  ReplyMsg
  196.         moveq   #0,d0
  197. leave        rts
  198.  
  199. dosname     dc.b    'dos.library',0
  200. intuiname   dc.b    'intuition.library',0
  201. gfxname     dc.b    'graphics.library',0
  202. conname     dc.b    'console.device',0
  203.         EVEN
  204.  
  205. main        CODE    xoper
  206.     ENDC
  207. mainprg     lea     dataarea,a4
  208.         tst.b   post_V34(a4)
  209.         beq.s   1$
  210.         jsr     reverseimage
  211. 1$        move.l  sysbase,a0
  212.         move.l  a0,SysBase(a4)
  213.         move.l  a7,realstack(a4)
  214.         move.l  276(a0),a0          ;ExecBase->ThisTask
  215.         move.l  a0,mytask(a4)
  216.         move.l  50(a0),oldproctrap  ;original AmigaDos Trap-Handler
  217.  
  218.         move.l  #exitall,88(a0)     ;leave a message for 'KillXoper'
  219.  
  220.         move.l  #newname+dataarea,10(a0)
  221.         pea     0
  222.         pea     xopcon(a4)
  223.         LIBCALL CreatePort
  224.         addq    #8,a7
  225.         move.l  d0,replyport(a4)
  226.         pea     0
  227.         pea     0
  228.         LIBCALL CreatePort
  229.         addq    #8,a7
  230.         move.l  d0,timerport(a4)
  231.         lea     timerio,a1
  232.         move.l  d0,14(a1)
  233.         move.l  d0,a2
  234.         move.b  15(a2),d0
  235.         ext.w   d0
  236.         move.w  d0,timersig(a4)
  237.         lea     timernam(a4),a0
  238.         moveq   #0,d1
  239.         moveq   #1,d0
  240.         CALL    OpenDevice,SysBase(a4) ;open 'timer.device'
  241.         lea     timerio,a0
  242.         move.l  20(a0),timerbase(a4)
  243.  
  244. ;install a counter to determine the amount of CPU-time each
  245. ;Task uses.
  246.         bsr     starttasktimer
  247.         move.l  SysBase(a4),a1
  248.         move.l  #_LVOSwitch,a0
  249.         move.l  2(a1,a0.w),oldswitch
  250.         move.l  #myswitch,d0
  251.         CALL    SetFunction,SysBase(a4)
  252.  
  253.         move.l  #_LVOAddTask,a0
  254.         move.l  2(a6,a0.w),OldAddTask
  255.         move.l  a6,a1
  256.         move.l  #myaddtask,d0
  257.         RECALL  SetFunction
  258.  
  259. ;install a counter for PORT-Interrupts
  260.         lea     IOCounter(a4),a1
  261.         moveq   #3,d0
  262.         CALL    AddIntServer,SysBase(a4)
  263.  
  264.         pea     256         ;stack
  265.         pea     killidle        ;CODE
  266.         pea     -127        ;pri
  267.         pea     kidlename(a4)       ;name
  268.         LIBCALL CreateTask
  269.         lea     16(a7),a7
  270.         move.l  d0,idletask(a4)
  271.  
  272.         tst.b   post_V34(a4)
  273.         beq.s   12$
  274.         lea     dummy,a0
  275.         move.l  timerbase(a4),a6
  276.         jsr     -$3c(a6)
  277.         lsr.l   #8,d0
  278.         move.l  d0,timerticks(a4)
  279.         move.l  dummy+4,lasttime
  280.         bra.s   11$
  281.  
  282. 12$        move.l  #3906,timerticks(a4)
  283.         pea     0
  284.         pea     0
  285.         LIBCALL CreatePort
  286.         addq    #8,a7
  287.         lea     sampleio(a4),a1
  288.         move.l  d0,14(a1)
  289.         lea     timernam(a4),a0
  290.         moveq   #0,d1
  291.         move.l  d1,d0
  292.         CALL    OpenDevice,SysBase(a4) ;open 'timer.device'
  293.  
  294.         lea     sampleio(a4),a1
  295.         move.l  #3599999,32(a1)
  296.         move.w  #9,28(a1)
  297.         CALL    SendIO,SysBase(a4)
  298.  
  299.         moveq   #mysignal,d0
  300.         CALL    AllocSignal,SysBase(a4)
  301.  
  302. 11$        jsr     gettdtasks
  303.  
  304. ;Attempt to open a startup script
  305.         move.l  mytask(a4),a5      ;disable the 'please insert'
  306.         move.l  184(a5),-(a7)
  307.         move.l  #-1,184(a5)        ;requester
  308.         move.l  #dataarea+startupname+2,d1    ;'Xoper.Startup'
  309.         move.l  #1005,d2
  310.         CALL    Open,dosbase(a4)
  311.         tst.l   d0
  312.         bne.s   7$
  313.         move.l  #startupname+dataarea,d1    ;'S:Xoper.Startup'
  314.         move.l  #1005,d2
  315.         CALL    Open,dosbase(a4)
  316.  
  317. 7$        move.w  #$00ff,16(a5)
  318.         move.l  (a7)+,184(a5)      ;reenable the requester
  319.         move.l  d0,infile(a4)
  320.         beq.s   nostartup
  321.  
  322.         move.b  #1,fromfile(a4)
  323.  
  324. 8$        lea     dummy,a5
  325.         moveq   #-1,d5
  326. 5$        addq.l  #1,d5
  327.         move.l  infile(a4),d1
  328.         move.l  a5,d2
  329.         add.l   d5,d2
  330.         moveq.l #1,d3
  331.         CALL    Read,dosbase(a4)
  332.         tst.l   d0
  333.         bgt.s   10$
  334.  
  335.         move.l  infile(a4),d1
  336.         CALL    Close,dosbase(a4)
  337.         clr.l   infile(a4)
  338.         tst     d5
  339.         beq.s   endstartup
  340.         bra.s   9$
  341.  
  342. 10$        cmp.b   #10,0(a5,d5)
  343.         beq.s   9$
  344.         cmp.b   #13,0(a5,d5)
  345.         bne.s   5$
  346.  
  347. 9$        move.l  d5,d0
  348.         addq    #1,d0
  349.         bsr     cli            ;execute the script as if typed in
  350.         tst.l   infile(a4)
  351.         bne.s   8$
  352.  
  353. endstartup  clr.b   fromfile(a4)
  354.  
  355. nostartup
  356.         tst.l   wbmsg(a4)
  357.         bne.s   noin
  358.         cmp.b   #10,dummyinput(a4)
  359.         beq.s   noin
  360.         cmp.w   #'-b',dummyinput(a4)  ;requested as a background task ?
  361.         beq.s   noin
  362.         move.l  dummyinput(a4),in
  363.         move.b  #10,in+4
  364.         bra.s   nostartup2
  365. noin        cmp.b   #10,in
  366.         beq.s   default
  367.         tst.b   in
  368.         bne.s   nostartup2
  369.  
  370. default     move.w  #$740a,in           ;couldn't find defaults, defaults to
  371.                        ;tasks
  372.  
  373. nostartup2  cmp.w   #'-b',dummyinput(a4)
  374.         beq     instback
  375.  
  376. ;This code just opens a Window. Position
  377. ;and size are taken from window_l,window_t,
  378. ;window_w,window_h.
  379. restart     tst.b   ownscreen(a4)
  380.         beq.s   1$
  381.         bsr     createscreen
  382.         bra.s   2$
  383. 1$        bsr     setupwindow
  384.  
  385. 2$        move.l  mytask(a4),a0
  386.         clr.l   26(a0)              ;clear 'spurious' signals
  387.  
  388.         clr.l   ptr(a4)
  389.         tst.b   gotguru(a4)
  390.  
  391.         beq.s   3$
  392.         bsr     showguru
  393.         clr.b   gotguru(a4)
  394. 3$        bra     processmsgs
  395.  
  396. ;show a list. The string entered from keyboard is stored
  397. ;in 'in'. Every character is interpreted as one command
  398. ;i.e. 'rip' means 'resources'+'interrupts'+'ports'.
  399. ;search the command to be executed. If none is found,
  400. ;show a help message
  401.  
  402. showwhat    tst.b   fromfile(a4)
  403.         bne     endshow
  404.         move.w  cmdptr(a4),d7
  405.  
  406. input        lea     in,a0
  407.         move.b  0(a0,d7.w),d0
  408.         beq     endshow
  409.         addq.b  #1,d7
  410.         cmpi.b  #' ',d0
  411.         bne.s   1$
  412.  
  413.         bsr     testifend
  414.         beq     endshow
  415.         move.w  d2,cmdptr(a4)
  416.         bra     notfinished
  417.  
  418. 1$        cmpi.b  #10,d0
  419.         beq     endshow
  420.         or.b    #32,d0
  421.         cmpi.b  #'q',d0
  422.         beq     exit
  423.         lea     params(a4),a0
  424.         moveq   #0,d1
  425. i1        cmp.b   0(a0,d1),d0
  426.         beq.s   foundp
  427.         addq.b  #1,d1
  428.         cmpi.b  #parmnum,d1
  429.         bne.s   i1
  430.  
  431.         move.w  #usetxt,d0
  432.         move.b  #1,mnflag
  433.         bsr     putnamw
  434.         clr.b   mnflag(a4)
  435.         bra     endshow
  436.  
  437. foundp        lsl.b   #2,d1
  438.         lea     subs(PC),a0
  439.         move.b  #1,mnflag(a4)
  440.         jsr     0(a0,d1)
  441.         clr.b   mnflag(a4)
  442.         bsr     testifend
  443.         beq     input
  444.         bsr     newline
  445.         bra     input
  446.  
  447. testifend   lea     in,a0
  448.         lea     0(a0,d7),a0
  449.         move.w  d7,d2
  450. 2$        move.b  (a0)+,d0
  451.         beq.s   1$
  452.         cmpi.b  #' ',d0
  453.         bne.s   3$
  454.         addq    #1,d2
  455.         bra.s   2$
  456. 3$        cmpi.b  #10,d0
  457. 1$        rts
  458.  
  459.  
  460. endshow     tst.b   fromfile(a4)
  461.         bne.s   nomore
  462.         clr.w   cmdptr
  463. notfinished bsr     starttimer
  464. nomore        tst.b   fromfile(a4)
  465.         bne.s   1$
  466.         clr.l   lastprinted(a4)
  467.         bsr     blastout
  468. 1$        rts
  469.  
  470. ;get the string from inputbuffer; search and execute
  471. ;the command, if any.
  472.  
  473. cli        lea     dummy,a0
  474.         subq    #1,d0
  475. cl2        subq    #1,d0
  476.         bmi.s   cl1
  477.         cmp.b   #' ',0(a0,d0)
  478.         beq.s   cl2
  479. cl1        addq    #1,d0
  480.         move.b  #10,0(a0,d0)
  481.         bsr     kllblnks
  482.         cmpi.b  #10,0(a0)
  483.         beq     showwhat
  484.         cmpi.b  #';',0(a0)
  485.         beq     nomore
  486.  
  487.         bsr     findcmd
  488.         tst.l   d2
  489.         bpl.s   okcmd
  490.         bsr     findalias
  491.         tst.l   d2
  492.         bmi.s   nm1
  493.  
  494. okcmd        clr.b   procnum(a4)
  495.         adda.w  d1,a0
  496.         bsr     kllblnks
  497.         lsl     #2,d2
  498.         lea     cmdaddr(PC),a1
  499.         jsr     0(a1,d2)
  500.         bra     nomore
  501.  
  502. nm1        lea     in,a1
  503.         lea     buffer,a2
  504. nm2        move.b  (a1)+,(a2)+
  505.         cmp.b   #10,-1(a1)
  506.         bne.s   nm2
  507.         lea     in,a1
  508. nm0        move.b  (a0)+,(a1)+
  509.         cmp.b   #10,-1(a1)
  510.         bne.s   nm0
  511.         lea     dummy,a2
  512.         lea     buffer,a1
  513. nm3        move.b  (a1)+,(a2)+
  514.         cmp.b   #10,-1(a1)
  515.         bne.s   nm3
  516.         clr.w   cmdptr(a4)
  517.         bra     showwhat
  518.  
  519. findcmd     bsr     strbuf
  520.         move.l  a0,a5
  521.         lea     commds(a4),a2
  522.         moveq   #0,d2
  523. 1$        lea     buffer,a0
  524.         move.l  a2,a1
  525.         bsr     strcmp
  526.         beq     3$
  527. 2$        tst.b   (a2)+
  528.         bne.s   2$
  529.         addq    #1,d2
  530.         cmp.w   #cmdnum,d2
  531.         bne.s   1$
  532.         moveq   #-1,d2
  533. 3$        move.l  a5,a0
  534.         rts
  535.  
  536. findalias   move.l  a0,a5
  537.         move.l  aliaslist(a4),d4
  538. 1$        beq.s   3$
  539.         move.l  d4,a3
  540.         lea     buffer,a0
  541.         lea     5(a3),a1
  542.         move.b  4(a3),d2
  543.         ext.w   d2
  544.         ext.l   d2
  545.         bsr     strcmp
  546.         beq     4$
  547.         move.l  0(a3),d4
  548.         bra.s   1$
  549. 3$        moveq   #-1,d2
  550. 4$        move.l  a5,a0
  551.         rts
  552.  
  553. subs        bra     showtask
  554.         bra     showaddr
  555.         bra     showdevs
  556.         bra     showlibs
  557.         bra     showres
  558.         bra     showresi
  559.         bra     showmem
  560.         bra     showprt
  561.         bra     showint
  562.         bra     stack
  563.         bra     clicomm
  564.         bra     tasktime
  565.         bra     semaphores
  566. cmdaddr     bra     settime
  567.         bra     taskpri
  568.         bra     info
  569.         bra     pri
  570.         bra     flush
  571.         bra     freeze
  572.         bra     warm
  573.         bra     signal
  574.         bra     break
  575.         bra     alert
  576.         bra     lastalert
  577.         bra     instback
  578.         bra     stopall
  579.         bra     clear
  580.         bra     cancel
  581.         bra     taskports
  582.         bra     hunks
  583.         bra     devices
  584.         bra     openlib
  585.         bra     closelib
  586.         bra     currentdir
  587.         bra     cd
  588.         bra     mypri
  589.         bra     openfiles
  590.         bra     locks
  591.         bra     unlock
  592.         bra     screens
  593.         bra     windows
  594.         bra     closescreen
  595.         bra     closewindow
  596.         bra     fonts
  597.         bra     windowfonts
  598.         bra     lockdrive
  599.         bra     freedrive
  600.         bra     capture
  601.         bra     clrcold
  602.         bra     clrcool
  603.         bra     clrwarm
  604.         bra     snoop
  605.         bra     usage
  606.         bra     inphand
  607.         bra     nohead
  608.         bra     sort
  609.         bra     hide
  610.         bra     hidden
  611.         bra     setwindow
  612.         bra     cancel
  613.         bra     iconifyoff
  614.         bra     historylines
  615.         bra     historylength
  616.         bra     showhistory
  617.         bra     repeatcmd
  618.         bra     remresident
  619.         bra     saveoutput
  620.         bra     killhistory
  621.         bra     iconbackdrp
  622.         bra     setfont
  623.         bra     trapguru
  624.         bra     outputlines
  625.         bra     usescreen
  626.         bra     usewindow
  627.         bra     grabtimerio
  628.         bra     dchange
  629.         bra     alias
  630.         bra     remnode
  631.         bra     setfkey
  632.         bra     clicmd
  633.         bra     taskinfo
  634.         bra     coldreboot
  635.         bra     reboot
  636.         bra     zerotimer
  637.         bra     propgadoff
  638.         bra     iconpos
  639.         bra     remport
  640.         bra     remintserver
  641.         bra     frags
  642.         bra     snoopfiles
  643.         bra     snoop
  644.         bra     tracelocks
  645.  
  646. ;------ Task-Structures-----
  647.  
  648. tasktime    move.b  #-1,tasktyp(a4)
  649.         bra.s   startask
  650. showaddr    clr.b   tasktyp(a4)
  651.         bra.s   startask
  652. showtask    move.b  #1,tasktyp(a4)
  653. startask    bsr     getdevhan
  654.         tst.b   headon(a4)
  655.         beq     noheader1
  656.         move.w  #infoh1,d0
  657.         bsr     putstrw
  658.         move.l  SysBase(a4),a6
  659.         move.w  #cpu3,d0
  660.         btst    #2,297(a6)      ;mc 68030 ?
  661.         bne.s   cpupr
  662.         subq.w  #cpu3-cpu2,d0
  663.         btst    #1,297(a6)      ;mc 68020 ?
  664.         bne.s   cpupr
  665.         subq.w  #cpu2-cpu1,d0
  666.         btst    #0,297(a6)      ;mc 68010 ?
  667.         bne.s   cpupr
  668.         subq.w  #cpu1-cpu0,d0   ;mc 68000
  669. cpupr        bsr     putstrw
  670.         move.l  d0,d1
  671.         move.w  #cpu5,d0
  672.         btst    #5,297(a6)      ;mc 68882 ?
  673.         bne.s   fpupr
  674.         move.l  d1,d0
  675.         btst    #4,297(a6)      ;mc 68881 ?
  676.         beq.s   no881
  677.         subq.w  #cpu5-cpu4,d0
  678. fpupr        bsr     putstrw
  679. no881        moveq   #20,d1
  680.         bsr     tab
  681.         move.w  #infoh3,d0
  682.         bsr     putstrw
  683.  
  684. noheader1   move.l  SysBase(a4),a6
  685.  
  686.         moveq   #1,d5
  687.         bsr     getaskdat
  688.         move.l  a5,savedat(a4)
  689.         bsr     getstdio
  690.  
  691.         moveq   #0,d4
  692.         move.l  d4,d3
  693.         move.l  d4,d1
  694.         lea     usedtime,a0
  695.         move.b  entries(a4),d1
  696.         subq    #1,d1
  697.         move.l  idletask(a4),d2
  698. 1$        lea     -16(a5),a5
  699.         move.l  12(a5),d5
  700.         add.l   d5,d4
  701.         move.l  0(a5),d0
  702.         cmp.l   d0,d2
  703.         bne.s   2$
  704.         move.l  d5,d3
  705. 2$        bsr     gettimeentry
  706.         add.l   d5,0(a0,d0.w)
  707.         dbf.s   d1,1$
  708.         move.l  d4,maxdisp(a4)
  709.         sub.l   d3,d4
  710.         move.l  d4,dispatches(a4)
  711.  
  712.         tst.b   headon(a4)
  713.         beq.s   noheader2
  714.         move.l  maxdisp(a4),d0
  715.         move.l  dispatches(a4),d3
  716.         bsr     prcent
  717.         bsr     newline
  718.         move.w  #infoh2,d0
  719.         bsr     putstrw
  720.  
  721. noheader2   move.l  SysBase(a4),a0
  722.         move.l  284(a0),d0
  723.         move.l  oldswitches(a4),d1
  724.         move.l  d0,oldswitches(a4)
  725.         sub.l   d1,d0
  726.         tst.b   headon(a4)
  727.         beq     noheader3
  728.         mulu    #100,d0
  729.         move.l  d0,-(a7)
  730.  
  731.         lea     secs(a4),a0
  732.         lea     mics(a4),a1
  733.         CALL    CurrentTime,intuibase(a4)
  734.         move.l  secs(a4),d3
  735.         lsl.l   #1,d3
  736.         move.l  d3,d1
  737.         lsl.l   #2,d3
  738.         add.l   d1,d3
  739.         move.l  mics(a4),d0
  740.         move.l  #100000,d1
  741.         bsr     div
  742.         add.l   d0,d3
  743.         move.l  time10(a4),d1
  744.         move.l  d3,time10(a4)
  745.         sub.l   d1,d3
  746.         move.l  (a7)+,d0
  747.         move.l  d3,-(a7)
  748.         move.l  d3,d1
  749.         bsr     div
  750.         moveq   #1,d5
  751.         bsr     putfrac
  752.  
  753.         moveq   #20,d1
  754.         bsr     tab
  755.         move.w  #infoh7,d0
  756.         bsr     putstrw
  757.         move.l  iocount(a4),d0
  758.         clr.l   iocount(a4)
  759.         mulu    #100,d0
  760.         move.l  (a7)+,d3
  761.         move.l  d3,d1
  762.         bsr     div
  763.         moveq   #1,d5
  764.         bsr     putfrac
  765.  
  766.         bsr     newline
  767.         bsr     newline
  768. noheader3   lea     t4header(a4),a0
  769.         tst.b   tasktyp(a4)
  770.         bmi.s   phedder
  771.         lea     theader(a4),a0
  772.         tst.b   tasktyp(a4)
  773.         bne.s   phedder
  774.         lea     t2header(a4),a0
  775.         move.l  SysBase(a4),a6
  776.         btst    #4,297(a6)            ;AttnFlags FPU ?
  777.         bne.s   phedder
  778.         lea     t3header(a4),a0
  779. phedder     bsr     puthead
  780.         move.l  savedat(a4),a5
  781.  
  782. pt1        tst.b   entries(a4)
  783.         beq     pt2
  784.         lea     -16(a5),a5
  785.         bsr     hideit
  786.         tst     d0
  787.         beq     ptend
  788.         move.l  idletask(a4),d0
  789.         cmp.l   0(a5),d0
  790.         beq     ptend
  791.         move.l  0(a5),a3
  792.         move.l  a3,d0
  793.         move.l  d0,node(a4)            ;ID = task address
  794.         bsr     hexa
  795.         tst.b   tasktyp(a4)
  796.         ble.s   pt12
  797.         moveq   #0,d0
  798.         move.b  8(a3),d0
  799.         bsr     gettype
  800.  
  801. pt12        moveq   #0,d0
  802.         move.b  9(a5),d0
  803.         subq.b  #1,d0
  804.         mulu    #9,d0
  805.         move.w  #status,d1
  806.         add.w   d1,d0
  807.         bsr     putstrw          ;state
  808.         tst.b   tasktyp(a4)
  809.         beq     pt345
  810.         bpl     pt13
  811.  
  812.         move.l  0(a5),d0
  813.         bsr     gettimeentry
  814.         lea     taskstamps,a0
  815.         lea     0(a0,d0.w),a0
  816.         move.l  secs(a4),d0
  817.         sub.l   0(a0),d0
  818.         bsr     putstamp
  819.         bsr     putblank
  820.         move.l  usedtime-taskstamps(a0),d0
  821.         move.l  timerticks(a4),d1
  822.         bsr     div
  823.         bsr     putstamp
  824.         moveq   #'.',d0
  825.         bsr     putchar
  826.         move.l  d1,d0
  827.         move.l  timerticks(a4),d1
  828.         addq    #5,d1
  829.         divu    #10,d1
  830.         divu    d1,d0
  831.         or.b    #'0',d0
  832.         bsr     putchar
  833.         bsr     putblank
  834.         bra     pt346
  835.  
  836. pt345        move.l  18(a3),d0             ;SigAlloc
  837.         bsr     hexa
  838.         move.w  #longnix,d0
  839.         cmp.b   #4,9(a5)              ;tc_state waiting ?
  840.         beq.s   pt14
  841.         bsr     putstrw
  842.         bra.s   pt15
  843.  
  844. pt14        move.l  22(a3),d0             ;SigWait
  845.         bsr     hexa
  846. pt15        move.l  26(a3),d0             ;SigRecvd
  847.         bsr     hexa
  848.  
  849.         move.w  #nofpu,d1          ;keine fpu annehmen
  850.         move.l  SysBase(a4),a6
  851.         btst    #4,297(a6)            ;AttnFlags FPU ?
  852.         beq.s   prt154
  853.         move.w  #nullstate,d1      ;fpu im null state annehmen
  854. prt154        move.l  #*,d0
  855.         cmp.b   #2,9(a5)              ;tc_state running ?
  856.         beq.s   pt16          ;kann nur xoper selbst sein
  857.  
  858.         moveq   #0,d0          ;0(sp) -> pc wenn keine fpu
  859.         move.l  54(a3),a1             ;tc_SPReg
  860.         btst    #4,297(a6)            ;AttnFlags FPU
  861.         beq.s   prt151          ;keine FPU
  862.  
  863.         tst.b   (a1)                  ;NULL frame ?
  864.         beq.s   prt150          ;ja
  865.  
  866.         move.w  (a1),d0               ;frame flag / format word
  867.         lea     110(a1),a1            ;offset fuer fpu regs
  868.         cmp.w   #-1,d0
  869.         beq.s   prt153
  870.         lea     12(a1),a1               ;3 longs mehr
  871.  
  872. prt153        moveq   #0,d0
  873.         move.b  1(a1),d0                ;frame size
  874.         move.l  4(a1,d0),d0             ;pc
  875.  
  876.         move.w  #idle,d1
  877.         cmp.b   #$18,1(a1)              ;mc 68881 idle ?
  878.         beq.s   pt16
  879.         addq.w  #busy-idle,d1
  880.         cmp.b   #$b4,1(a1)              ;mc 68881 busy ?
  881.         beq.s   pt16
  882. prt152        addq.l  #weissnicht-busy,d1     ;vielleicht mc 68882 ??
  883.         bra.s   pt16
  884.  
  885. prt150        moveq   #4,d0            ;offset NULL frame
  886. prt151        move.l  0(a1,d0),d0             ;n(sp) -> pc
  887. pt16        bsr     hexa
  888.  
  889.         move.l  SysBase(a4),a6
  890.         btst    #4,297(a6)               ;AttnFlags FPU ?
  891.         beq.s   pt4
  892.  
  893.         move.w  d1,d0             ;fpu state
  894.         bsr     putstrw
  895.         bra.s   pt4
  896.  
  897. pt13        move.b  10(a5),d3
  898.         bsr     plusmins
  899.  
  900.         move.l  dispatches(a4),d0
  901.         tst.b   usageflag(a4)
  902.         beq.s   pt37
  903.         move.l  maxdisp(a4),d0
  904. pt37        move.l  12(a5),d3
  905.         bsr     prcent
  906.  
  907. pt346        cmpi.b  #13,8(a5)
  908.         bne.s   noproc
  909.         tst.l   172(a3)
  910.         beq.s   noproc
  911.         move.b  11(a5),d3
  912.         bsr     bytedec
  913.         bra.s   pt4
  914. noproc        move.w  #nix,d0
  915.         bsr     putstrw
  916.  
  917. pt4        bsr     gettaskname
  918.  
  919.         tst.b   tinfo(a4)
  920.         beq     pt223
  921.  
  922.         tst.b   cliexec(a4)     ;display 'real' taskname if
  923.         beq.s   10$         ;it is a CLI
  924.         bsr     putblank
  925.         move.l  4(a5),d0
  926.         bsr     putstr
  927.  
  928. 10$        lea     tdtasks(a4),a1  ;check if the task is a trackdisk.device
  929.         moveq   #3,d3
  930. 1$        cmp.l   (a1)+,a3
  931.         dbeq.s  d3,1$
  932.         bne.s   pt224
  933.  
  934.         eor.l   #'0'+3,d3       ;print unit#
  935.         move.b  d3,unitmsg+8(a4)
  936.         move.w  #unitmsg,d0
  937.         bsr     putstrw
  938.  
  939. pt224        moveq   #0,d3        ;see if it is a device handler
  940.         lea     buffer+2400,a2
  941.         lea     200(a2),a1
  942.  
  943. 1$        move.l  (a2)+,d0
  944.         beq.s   pt222
  945.         move.l  (a1)+,d2
  946.         cmp.l   0(a5),d0
  947.         bne.s   1$
  948.  
  949. 2$        move.l  #' {',d0        ;print dos devicename
  950.         bsr     putlongascii
  951.         move.l  d2,d0
  952.         bsr     putbcpl
  953.         move.l  #':}',d0
  954.         bsr     putlongascii
  955.  
  956. pt222        lea     buffer+2160,a1  ;is it a device handler for some
  957.         lea     160(a1),a2      ;CLI input/output ?
  958.         moveq   #0,d5
  959.  
  960. 3$        move.l  (a1)+,d0
  961.         beq.s   4$
  962.         move.w  (a2)+,d2
  963.         cmp.l   0(a5),d0
  964.         bne.s   3$
  965.  
  966.         tst     d5
  967.         bne.s   5$
  968.         move.l  #' (',d0        ;print CLI#
  969.         bsr     putlongascii
  970.         bra.s   6$
  971. 5$        move.l  #'& ',d0
  972.         bsr     putlongascii
  973. 6$        moveq   #1,d5
  974.         moveq   #'<',d0
  975.         tst.w   d2
  976.         bmi.s   7$
  977.         moveq   #'>',d0
  978. 7$        bsr     putchar
  979.         move.l  #'CLI ',d0
  980.         bsr     putlongascii
  981.         moveq   #0,d0
  982.         move.b  d2,d0
  983.         moveq   #0,d3
  984.         bsr     longdec
  985.         bra.s   3$
  986.  
  987. 4$        tst     d5
  988.         beq.s   pt223
  989.         subq.l  #1,ptr(a4)
  990.         moveq   #')',d0
  991.         bsr     putchar
  992.  
  993. pt223        bsr     newline
  994.  
  995. ptend        subq.b  #1,entries(a4)
  996.         bra     pt1
  997. pt2        rts
  998.  
  999. putlist     move.l  0(a3),a3
  1000.         tst.l   0(a3)
  1001.         beq.s   endlist
  1002.         bsr     putdata
  1003.         bra.s   putlist
  1004. endlist     rts
  1005.  
  1006. putdata     move.l  a3,0(a5)
  1007.         move.l  10(a3),4(a5)        ;task->ln_Name
  1008.         move.b  8(a3),8(a5)         ;task->ln_Type
  1009.         move.b  15(a3),9(a5)        ;task->tc_State
  1010.         move.b  9(a3),10(a5)        ;task->ln_Pri
  1011.         move.b  143(a3),11(a5)      ;Process->pr_Tasknum
  1012.         clr.l   12(a5)
  1013.         lea     cputime,a0
  1014.         move.l  tasksnum(a4),d1
  1015.         subq    #1,d1
  1016.         bmi.s   pua1
  1017. pua3        cmp.l   (a0)+,a3
  1018.         dbeq    d1,pua3
  1019.         tst     d1
  1020.         bmi.s   pua1
  1021. pua2        move.l  508(a0),d1
  1022.         move.l  d1,12(a5)
  1023. pua1        lea     16(a5),a5
  1024.         addq    #1,d5
  1025.         rts
  1026.  
  1027. gettype     and.l   #$f,d0
  1028.         mulu    #11,d0
  1029.         add.w   #type,d0
  1030.         bra     putstrw
  1031.  
  1032. getaskdat   move.l  d5,-(a7)
  1033.         bsr.s   getaskdat2
  1034.         move.b  d5,entries(a4)
  1035.         move.l  (a7)+,d5
  1036.         beq.s   1$
  1037.         clr.l   tasksnum(a4)
  1038. 1$        moveq   #16,d2
  1039.         lea     -32(a5),a2
  1040.         bsr     sortlist
  1041.         rts
  1042.  
  1043. getaskdat2  lea     buffer,a5
  1044. getaskdat3  moveq   #0,d5
  1045.         move.w  #$4000,$dff09a
  1046.         lea     stplist(a4),a3
  1047.         bsr     putlist
  1048.         move.l  SysBase(a4),a3
  1049.         lea     420(a3),a3          ;SysBase->TaskWait
  1050.         bsr     putlist
  1051.         move.l  SysBase(a4),a3
  1052.         lea     406(a3),a3          ;SysBase->TaskReady
  1053.         bsr     putlist
  1054.         move.l  SysBase(a4),a3
  1055.         move.l  276(a3),a3          ;SysBase->ThisTask
  1056.         bsr     putdata
  1057. 1$        move.w  #-$4000,$dff09a
  1058.         rts
  1059.  
  1060. getaskdat4  move.l  #2800,d0
  1061.         moveq   #0,d1
  1062.         CALL    AllocMem,_SysBase(PC)
  1063.         moveq   #0,d5
  1064.         tst.l   d0
  1065.         beq.s   1$
  1066.         move.l  d0,-(a7)
  1067.         move.l  d0,a5
  1068.         bsr.s   getaskdat3
  1069.         move.l  (a7)+,d0
  1070. 1$        rts
  1071.  
  1072. freetaskbuf move.l  a5,a1
  1073.         move.l  #2800,d0
  1074.         CALL    FreeMem,_SysBase(PC)
  1075.         rts
  1076.  
  1077. cleanuptimers
  1078.         bsr.s   getaskdat4
  1079.         move.l  d0,a6
  1080.         moveq   #0,d1
  1081.         move.l  d1,d4
  1082.         lea     taskstampid,a1
  1083. 1$        lea     -16(a5),a5
  1084.         move.l  0(a5),d0
  1085.         bsr.s   gettimeentry
  1086.         lea     taskstampid,a3
  1087.         lea     0(a3,d0.w),a3
  1088.         move.l  0(a3),d2
  1089.         move.l  0(a1),0(a3)
  1090.         move.l  d2,(a1)
  1091.         move.l  taskstamps-taskstampid(a3),d2
  1092.         move.l  taskstamps-taskstampid(a1),taskstamps-taskstampid(a3)
  1093.         move.l  d2,taskstamps-taskstampid(a1)
  1094.         move.l  usedtime-taskstampid(a3),d2
  1095.         move.l  usedtime-taskstampid(a1),usedtime-taskstampid(a3)
  1096.         move.l  d2,usedtime-taskstampid(a1)
  1097.         addq.l  #4,a1
  1098.         addq    #1,d1
  1099.         subq.b  #1,d5
  1100.         bne.s   1$
  1101.         move.w  d1,numtaskstimed+dataarea
  1102.         bsr     freetaskbuf
  1103.         rts
  1104.  
  1105. gettimeentry
  1106.         movem.l d1/a0,-(a7)
  1107.         lea     taskstampid,a0
  1108.         move.w  numtaskstimed(a4),d1
  1109.         subq    #1,d1
  1110. 1$        cmp.l   (a0)+,d0
  1111.         dbeq.s  d1,1$
  1112.         move.l  a0,d0
  1113.         sub.l   #taskstampid+4,d0
  1114.         movem.l (a7)+,d1/a0
  1115.         rts
  1116.  
  1117. sortlist    tst.b   sorton(a4)
  1118.         beq.s   sort5
  1119.         lea     buffer,a1
  1120. sort1        lea     0(a1,d2),a3
  1121. sort2        move.l  0(a1),d1
  1122.         cmp.l   0(a3),d1
  1123.         bge.s   sort3
  1124.         move.l  d2,d1
  1125.         subq    #1,d1
  1126. sort4        move.b  0(a3,d1),d0
  1127.         move.b  0(a1,d1),0(a3,d1)
  1128.         move.b  d0,0(a1,d1)
  1129.         dbf     d1,sort4
  1130. sort3        lea     0(a3,d2),a3
  1131.         cmp.l   a2,a3
  1132.         ble.s   sort2
  1133.         lea     0(a1,d2),a1
  1134.         cmp.l   a2,a1
  1135.         bne.s   sort1
  1136. sort5        rts
  1137.  
  1138. prcent        lsl.l   #1,d3
  1139.         move.l  d3,d1
  1140.         lsl.l   #2,d3
  1141.         add.l   d1,d3
  1142.         lsl.l   #2,d3
  1143.         move.l  d3,d1
  1144.         lsl.l   #3,d3
  1145.         move.l  d3,d2
  1146.         lsl.l   #1,d3
  1147.         add.l   d2,d3
  1148.         add.l   d1,d3
  1149.         move.l  d0,d1
  1150.         move.l  d3,d0
  1151.         bsr     div
  1152.         moveq   #0,d5
  1153.         bsr     putfrac
  1154.         move.w  #infoh4,d0
  1155.         bra     putstrw
  1156.  
  1157. putfrac     divu    #10,d0
  1158.         move    d0,d3
  1159.         swap    d0
  1160.         move    d0,d1
  1161.         tst     d5
  1162.         bne.s   1$
  1163.         cmp.w   #100,d3
  1164.         ble.s   1$
  1165.         move.w  #whatsthis,d0
  1166.         bra     putstrw
  1167. 1$        bsr     bytedec
  1168.         lea     out,a0
  1169.         move.b  #'.',-1(a0,d0)
  1170.         or.b    #'0',d1
  1171.         move    d1,d0
  1172.         bra     putchar
  1173.  
  1174. hideit        tst.b   hideoff(a4)
  1175.         beq.s   pt73
  1176. pt75        moveq   #1,d0
  1177.         rts
  1178. pt73        lea     hidestart(a4),a3
  1179.         move.l  4(a5),a0
  1180. pt74        tst.l   0(a3)
  1181.         beq.s   pt75
  1182.         move.l  0(a3),a3
  1183.         lea     4(a3),a1
  1184.         bsr     strcmp
  1185.         tst     d0
  1186.         beq     hideend
  1187.         bra.s   pt74
  1188. hideend     rts
  1189.  
  1190. getaskname2 movem.l a3/a5,-(a7)
  1191.         link    a2,#-10
  1192.         move.l  a7,a5
  1193.         move.l  d0,a3
  1194.         tst.l   d0
  1195.         bne.s   2$
  1196.         bsr     putstr
  1197.         bra.s   1$
  1198. 2$        move.b  8(a3),8(a5)
  1199.         move.l  10(a3),4(a5)
  1200.         bsr     gettaskname
  1201. 1$        unlk    a2
  1202.         movem.l (a7)+,a3/a5
  1203.         rts
  1204.  
  1205. gettaskname movem.l a1-a2,-(a7)
  1206.         clr.b   cliexec(a4)
  1207.         tst.b   cmdcli(a4)
  1208.         beq.s   2$
  1209.         cmpi.b  #13,8(a5)
  1210.         bne.s   2$
  1211.  
  1212.         CALL    Forbid,SysBase(a4)
  1213.         tst.l   140(a3)             ;pr_TaskNum
  1214.         beq.s   1$
  1215.         move.l  172(a3),d0          ;pr_CLI
  1216.         beq.s   1$
  1217.         move.l  d0,a1
  1218.         adda.l  a1,a1
  1219.         adda.l  a1,a1
  1220.         tst.l   60(a1)              ;cli_Module
  1221.         beq.s   1$
  1222.         move.l  16(a1),a2
  1223.         adda.l  a2,a2
  1224.         adda.l  a2,a2
  1225.         tst.b   0(a2)
  1226.         beq.s   1$
  1227.         move.w  #openbrak,d0
  1228.         bsr     putstrw
  1229.         move.l  16(a1),d0           ;cli_CommandName
  1230.         CALL    Permit,SysBase(a4)
  1231.         bsr     putbcpl
  1232.         bset.b  #1,cliexec(a4)
  1233.         move.w  #closebrak,d0
  1234.         movem.l (a7)+,a1-a2
  1235.         bra     putstrw
  1236.  
  1237. 1$        CALL    Permit,SysBase(a4)
  1238. 2$        move.l  4(a5),d0
  1239.         movem.l (a7)+,a1-a2
  1240.         bra     putstr
  1241.  
  1242. getstdio    tst.b   tinfo(a4)
  1243.         beq     4$
  1244.         move.l  a5,-(a7)
  1245.         lea     buffer+2160,a0
  1246.         lea     160(a0),a1
  1247.         moveq   #40,d4
  1248.         moveq   #0,d3
  1249.         move.b  entries(a4),d3
  1250.         subq    #1,d3
  1251.  
  1252. 3$        lea     -16(a5),a5
  1253.         cmpi.b  #13,8(a5)
  1254.         bne.s   1$
  1255.         move.l  0(a5),a3
  1256.         CALL    Forbid,SysBase(a4)
  1257.         move.b  143(a3),d2          ;pr_TaskNum
  1258.         ext.w   d2
  1259.         beq.s   2$
  1260.         move.l  172(a3),d0          ;pr_CLI
  1261.         beq.s   2$
  1262.         move.l  160(a3),d0          ;pr_COS
  1263.         beq.s   2$
  1264.         bsr.s   5$
  1265.         or.w    #$8000,d2
  1266. 2$        move.l  156(a3),d0
  1267.         beq.s   6$
  1268.         bsr     5$
  1269.  
  1270. 6$        RECALL  Permit
  1271.         tst     d4
  1272.         ble.s   7$
  1273. 1$        dbf     d3,3$
  1274.  
  1275. 7$        clr.l   (a0)+
  1276.         move.l  (a7)+,a5
  1277. 4$        rts
  1278.  
  1279. 5$        lsl.l   #2,d0
  1280.         move.l  d0,a2
  1281.         move.l  8(a2),d0            ;fh_Type
  1282.         ble.s   8$            ;negative = plain file
  1283.         move.l  d0,a2
  1284.         move.l  16(a2),d0           ;mp_SigTask
  1285.         beq.s   8$
  1286.         move.l  d0,(a0)+
  1287.         move.w  d2,(a1)+
  1288.         subq    #1,d4
  1289. 8$        rts
  1290.  
  1291. getdevhan   tst.b   tinfo(a4)
  1292.         beq.s   4$
  1293.         move.l  a3,-(a7)
  1294.         bsr     devinfo
  1295.         moveq   #49,d3
  1296.         lea     buffer+2400,a2
  1297.         lea     200(a2),a3
  1298. 1$        adda.l  a1,a1
  1299.         adda.l  a1,a1
  1300.         tst.l   4(a1)
  1301.         bne.s   3$
  1302.         move.l  8(a1),d0
  1303.         beq.s   3$
  1304.         sub.l   #92,d0
  1305.         move.l  d0,(a2)+
  1306.         move.l  40(a1),(a3)+
  1307.         subq    #1,d3
  1308.         beq.s   2$
  1309. 3$        move.l  0(a1),d0
  1310.         beq.s   2$
  1311.         move.l  d0,a1
  1312.         bra.s   1$
  1313.  
  1314. 2$        clr.l   (a2)+
  1315.         move.l  (a7)+,a3
  1316. 4$        rts
  1317.  
  1318. *-------- mem-hunks ------------
  1319.  
  1320. showmem     lea     mheader(a4),a0
  1321.         bsr     puthead
  1322.         move.l  SysBase(a4),a5
  1323.         lea     322(a5),a5          ;SysBase->MemList
  1324.         moveq   #0,d5
  1325. mem1        move.l  0(a5),a5            ;MemList->ln_Next
  1326.         tst.l   0(a5)
  1327.         beq.s   mem2
  1328.         move.l  20(a5),d0           ;MemHeader->mh_Lower
  1329.         bsr     hexa
  1330.         move.l  24(a5),d0           ;MemHeader->mh_Upper
  1331.         bsr     hexa
  1332.         move.l  28(a5),d0           ;MemHeader->mh_Free
  1333.         add.l   d0,d5
  1334.         moveq   #1,d3
  1335.         bsr     longdec
  1336.         move.b  15(a5),d3           ;MemHeader->mh_Attributes
  1337.         bsr     bytedec
  1338.         move.b  9(a5),d3            ;MemHeader->ln_pri
  1339.         bsr     plusmins
  1340.         move.l  10(a5),d0           ;MemHeader->ln_Name
  1341.         move.l  a5,node(a4)
  1342.         bsr     putnam
  1343.         bra.s   mem1
  1344. mem2        move.w  #infoh6,d0
  1345.         bsr     putstrw
  1346.         moveq   #19,d1
  1347.         bsr     tab
  1348.         moveq   #0,d3
  1349.         move.l  d5,d0
  1350.         bsr     longdec
  1351. newline     move.w  #cr,d0
  1352.         bra     putstrw
  1353.  
  1354. frags        move.l  SysBase(a4),a5
  1355.         lea     322(a5),a5          ;SysBase->MemList
  1356. 1$        move.l  0(a5),a5            ;MemList->ln_Next
  1357.         tst.l   0(a5)
  1358.         bne.s   10$
  1359.         rts
  1360. 10$        move.w  #memtyp,d0
  1361.         bsr     putstrw
  1362.         move.l  10(a5),d0
  1363.         bsr     putnam
  1364.         lea     fraghead(a4),a0
  1365.         bsr     puthead
  1366.         lea     buffer,a1
  1367.         move.l  a1,a2
  1368.         moveq   #64,d0
  1369. 9$        clr.l   (a2)+
  1370.         dbf     d0,9$
  1371.         lea     128(a1),a2
  1372.         move.l  16(a5),d0           ;MemHeader->mh_First
  1373.         beq.s   5$
  1374.         move.l  d0,a3
  1375.         CALL    Forbid,SysBase(a4)
  1376.  
  1377. 2$        move.l  4(a3),d0
  1378.         move.l  d0,d5
  1379.         moveq   #31,d1
  1380. 3$        lsl.l   #1,d0
  1381.         btst.l  #31,d0
  1382.         dbne    d1,3$
  1383.         lsl.l   #2,d1
  1384.         addq.l  #1,0(a1,d1.w)
  1385.         cmp.l   0(a2,d1.w),d5
  1386.         ble.s   4$
  1387.         move.l  d5,0(a2,d1.w)
  1388. 4$        move.l  0(a3),d0
  1389.         beq.s   5$
  1390.         move.l  d0,a3
  1391.         bra.s   2$
  1392.  
  1393. 5$        CALL    Permit,SysBase(a4)
  1394.         moveq   #0,d1
  1395. 8$        move.l  (a2)+,d5
  1396.         move.l  (a1)+,d2
  1397.         beq.s   6$
  1398.         moveq   #0,d0
  1399.         bset.l  d1,d0
  1400.         lsr.l   #1,d0
  1401.         move.l  d0,d4
  1402.         bsr     hexa
  1403.         move.l  d4,d0
  1404.         moveq   #1,d3
  1405.         bsr     longdec
  1406.         move.l  d2,d0
  1407.         bsr     longdec
  1408.         move.l  d5,d0
  1409.         bsr     longdec
  1410. 7$        bsr     newline
  1411. 6$        addq    #1,d1
  1412.         cmp.w   #31,d1
  1413.         ble.s   8$
  1414.         bsr     newline
  1415.         bra     1$
  1416.  
  1417. *-------- Task-Stack ------------
  1418.  
  1419. stack        lea     stackhead(a4),a0
  1420.         bsr     puthead
  1421.         moveq   #0,d5
  1422.         bsr     getaskdat
  1423.  
  1424. sta1        tst.b   entries(a4)
  1425.         beq     sta8
  1426.         lea     -16(a5),a5
  1427.         bsr     hideit
  1428.         tst     d0
  1429.         beq     sta9
  1430.         move.l  0(a5),a1
  1431.         cmp.b   #13,8(a1)               ;task->ln_Type
  1432.         bne.s   sta6
  1433.         move.l  172(a1),d0              ;pr_CLI
  1434.         beq.s   sta6
  1435.         lsl.l   #2,d0
  1436.         move.l  d0,a0
  1437.         tst.l   60(a0)                  ;cli_Module
  1438.         beq.s   sta6
  1439.         moveq   #1,d3
  1440.         move.l  52(a0),d4               ;cli_DefaultStack
  1441.         lsl.l   #2,d4
  1442.         move.l  176(a1),d0              ;pr_ReturnAddress
  1443.         sub.l   d4,d0
  1444.         bsr     hexa
  1445.         move.l  d4,d0
  1446.         bsr     longdec
  1447.         move.l  176(a1),d0              ;pr_ReturnAddress
  1448.         sub.l   54(a1),d0               ;tc_SPReg
  1449.         bra.s   sta7
  1450.  
  1451. sta6        move.l  58(a1),d0               ;tc_SPLower
  1452.         bsr     hexa
  1453.         moveq   #1,d3
  1454.         move.l  62(a1),d0               ;tc_SPUpper
  1455.         sub.l   58(a1),d0               ;tc_SPLower
  1456.         bsr     longdec
  1457.         move.l  62(a1),d0               ;tc_SPUpper
  1458.         sub.l   54(a1),d0               ;tc_SPReg
  1459. sta7        bsr     longdec
  1460.         move.l  a1,a3
  1461.         bsr     gettaskname
  1462.         bsr     newline
  1463. sta9        subq.b  #1,entries(a4)
  1464.         bra     sta1
  1465. sta8        rts
  1466.  
  1467. clicomm     lea     clicomhead(a4),a0
  1468.         bsr     puthead
  1469.         moveq   #0,d5
  1470.         bsr     getaskdat
  1471. clic1        tst.b   entries(a4)
  1472.         beq     clic8
  1473.         lea     -16(a5),a5
  1474.         bsr     hideit
  1475.         tst     d0
  1476.         beq     clic0
  1477.         move.l  0(a5),a2
  1478.         cmpi.b  #13,8(a2)               ;ln_Type
  1479.         bne     clic0
  1480.         tst.l   172(a2)
  1481.         beq     clic0
  1482.         move.l  140(a2),d3              ;pr_TaskNum
  1483.         beq     clic0
  1484.         move.l  a2,d0
  1485.         move.l  d0,node(a4)
  1486.         bsr     hexa
  1487.         moveq   #0,d0
  1488.         move.b  9(a5),d0
  1489.         subq    #1,d0
  1490.         mulu    #9,d0
  1491.         move.w  #status,d1
  1492.         add.w   d1,d0
  1493.         bsr     putstrw
  1494.         move.l  172(a2),a3              ;pr_CLI
  1495.         adda.l  a3,a3
  1496.         adda.l  a3,a3
  1497.         move.w  #script,d0
  1498.         tst.l   40(a3)                  ;cli_InterActive
  1499.         beq.s   clic5
  1500.         addq.w  #interact-script,d0
  1501. clic5        bsr     putstrw
  1502.         move.w  #backg,d0
  1503.         tst.l   44(a3)                  ;cli_Background
  1504.         bne.s   clic6
  1505.         addq.w  #foreg-backg,d0
  1506. clic6        bsr     putstrw
  1507.         bsr     bytedec
  1508.         move.l  4(a5),d0
  1509.         bsr     putstr
  1510.         moveq   #49,d1
  1511.         bsr     tab
  1512.         bsr     putblank
  1513.         move.l  128(a2),d0              ;pr_SegList
  1514.         beq.s   noprogloadc
  1515. clic3        move.l  172(a2),d1              ;pr_CLI
  1516.         bne.s   clic4
  1517. noprogloadc move.w  #longnix,d0
  1518.         bsr     putnamw
  1519.         bra.s   clic0
  1520. clic4        lsl.l   #2,d1
  1521.         move.l  d1,a2
  1522.         move.l  60(a2),d1               ;cli_Module
  1523.         beq.s   noprogloadc
  1524.         move.l  16(a2),d0               ;cli_CommandName
  1525.         bsr     putbcpl
  1526.         move.l  36(a2),d1               ;cli_CommandFile
  1527.         beq.s   1$
  1528.         move.l  d1,d2
  1529.         lsl.l   #2,d1
  1530.         move.l  d1,a0
  1531.         tst.b   0(a0)
  1532.         beq.s   1$
  1533.         bsr     putblank
  1534.         move.w  #openbrak,d0
  1535.         bsr     putstrw
  1536.         move.l  d2,d0
  1537.         bsr     putbcpl
  1538.         move.w  #closebrak,d0
  1539.         bsr     putstrw
  1540. 1$        bsr     newline
  1541.  
  1542. clic0        subq.b  #1,entries
  1543.         bne     clic1
  1544. clic8        rts
  1545.  
  1546. *--------- interrupts ------------
  1547. showint     lea     iheader(a4),a0
  1548.         bsr     puthead
  1549.         lea     intnames(a4),a5
  1550.         lea     inttyp(a4),a1
  1551.         moveq   #0,d6
  1552. findint     lea     inttyp(a4),a1
  1553.         moveq   #0,d1
  1554.         moveq   #15,d5
  1555.         move.l  SysBase(a4),a3
  1556.         lea     84(a3),a3           ;SysBase->IntVects[16]
  1557.  
  1558. si0        tst.b   0(a1,d1)
  1559.         bne.s   si4
  1560.         move.l  8(a3),a2            ;IntVector->iv_Node
  1561.         bra.s   si5
  1562. si4        move.l  0(a3),a2            ;Interrupt->is_Node
  1563. si5        cmp.l   #0,a2
  1564.         beq     nxtint
  1565.         tst.b   0(a1,d1)
  1566.         beq.s   si1
  1567. si2        move.l  0(a2),a2            ;is_Node->ln_Next
  1568.         tst.l   0(a2)
  1569.         beq     nxtint
  1570. si1        tst     d6
  1571.         beq.s   3$
  1572.         cmp.l   a2,d4
  1573.         bne.s   4$
  1574.         rts
  1575. 3$        move.l  a2,d0
  1576.         move.l  d0,node(a4)
  1577.         bsr     hexa
  1578.         move.l  14(a2),d0           ;Interrupt->is_Data
  1579.         bsr     hexan
  1580.         move.l  18(a2),d0           ;Interrupt->is_Code
  1581.         bsr     hexan
  1582.         move.b  9(a2),d3            ;Interrupt->ln_Pri
  1583.         movem.l d6/a3,-(a7)
  1584.         bsr     plusmins
  1585.         move.w  #intserv,d0
  1586.         tst.b   0(a1,d1)
  1587.         bne.s   1$
  1588.         move.w  #inthand,d0
  1589. 1$        bsr     putstrw
  1590.         move.w  #intdis,d0
  1591.         move.w  $dff01c,d3
  1592.         btst.w  d1,d3
  1593.         beq.s   2$
  1594.         move.w  #inten,d0
  1595. 2$        bsr     putstrw
  1596.         movem.l (a7)+,d6/a3
  1597.         move.l  a5,d0
  1598.         bsr     putstr
  1599.         move.l  10(a2),d0           ;Interrupt->ln_Name
  1600.         bsr     putnam
  1601.         tst.b   0(a1,d1)
  1602.         bne     si2
  1603. 4$        tst.l   0(a2)
  1604.         beq.s   nxtint
  1605.         move.l  0(a2),a2
  1606.         bra     si1
  1607. nxtint        addq    #1,d1
  1608.         lea     12(a5),a5
  1609.         lea     12(a3),a3
  1610.         dbf     d5,si0
  1611.         rts
  1612.  
  1613. *---------    resident ------------
  1614.  
  1615. showresi    lea     rheader(a4),a0
  1616.         bsr     puthead
  1617.         move.l  SysBase(a4),a5
  1618.         move.l  300(a5),a5          ;SysBase->ResModules
  1619.  
  1620. r1        tst.l   0(a5)
  1621.         beq     r2
  1622.         move.l  0(a5),d0            ;Resident->ln_Next
  1623.         tst.l   d0
  1624.         bpl.s   r3
  1625.         bclr    #31,d0
  1626.         movea.l d0,a5
  1627.         bra.s   r1
  1628. r3        movea.l d0,a3
  1629.         move.l  d0,node(a4)
  1630.         bsr     hexa
  1631.         move.b  13(a3),d3           ;rt_Pri
  1632.         bsr     plusmins
  1633.         move.b  10(a3),d0           ;rt_Flags
  1634.         bsr     bin
  1635.         move.b  11(a3),d3           ;rt_Version
  1636.         bsr     bytedec
  1637.         move.b  12(a3),d0           ;rt_Type
  1638.         bsr     gettype
  1639.         move.l  14(a3),d0           ;rt_Name
  1640.         bsr     putnam
  1641. r4        addq    #4,a5
  1642.         bra     r1
  1643. r2        rts
  1644.  
  1645. *---------  ports  -------------
  1646.  
  1647. showprt     lea     pheader(a4),a0
  1648.         bsr     puthead
  1649.         move.l  SysBase(a4),a6
  1650.         lea     392(a6),a3          ;SysBase->PortList
  1651.         lea     buffer,a5
  1652.         moveq   #0,d5
  1653.         RECALL  Forbid
  1654.         move.w  #$4000,$dff09a
  1655. sp2        move.l  0(a3),a3            ;mp_Node.ln_Next
  1656.         tst.l   0(a3)
  1657.         beq.s   sp20
  1658.         bsr     getpdata
  1659.         bra.s   sp2
  1660. sp20        tst.b   tports(a4)
  1661.         beq.s   sp15
  1662.         move.l  SysBase(a4),a3
  1663.         move.l  276(a3),a3          ;sysbase->ThisTask
  1664.         lea     92(a3),a3           ;process->pr_MsgPort
  1665.         bsr     getpdata
  1666.         move.l  SysBase(a4),a2
  1667.         lea     406(a2),a2          ;sysbase->TaskReady
  1668. sp11        move.l  0(a2),a2
  1669.         tst.l   0(a2)
  1670.         beq.s   sp14
  1671.         lea     92(a2),a3           ;pr_MsgPort
  1672.         cmp.b   #13,8(a2)           ;ln_Type
  1673.         bne.s   sp11
  1674.         bsr     getpdata
  1675.         bra     sp11
  1676. sp14        move.l  SysBase(a4),a2
  1677.         lea     420(a2),a2          ;sysbase->TaskWait
  1678. sp12        move.l  0(a2),a2
  1679.         tst.l   0(a2)
  1680.         beq.s   sp15
  1681.         lea     92(a2),a3           ;pr_MsgPort
  1682.         cmp.b   #13,8(a2)           ;ln_Type
  1683.         bne.s   sp12
  1684.         bsr     getpdata
  1685.         bra     sp12
  1686. sp15        move.w  #-$4000,$dff09a
  1687.         CALL    Permit,SysBase(a4)
  1688.         lea     buffer,a5
  1689. sp3        tst.b   d5
  1690.         beq     sp6
  1691.         move.l  0(a5),d0
  1692.         move.l  d0,node(a4)
  1693.         bsr     hexa
  1694.         move.l  4(a5),d0
  1695.         bsr     putstr
  1696.         moveq   #25,d1
  1697.         bsr     tab
  1698.         move.b  8(a5),d0
  1699.         and.l   #3,d0
  1700.         mulu    #9,d0
  1701.         add.w   #mp_flags,d0
  1702.         bsr     putstrw
  1703.         move.b  9(a5),d3
  1704.         bsr     bytedec
  1705.         move.b  14(a5),d3
  1706.         cmp.b   #255,d3
  1707.         bne.s   1$
  1708.         move.w  #toomuch,d0
  1709.         bsr     putstrw
  1710.         bra.s   2$
  1711. 1$        bsr     bytedec
  1712. 2$        move.l  10(a5),d0
  1713.         bsr     getaskname2
  1714.         bsr     newline
  1715.         lea     16(a5),a5
  1716.         subq.b  #1,d5
  1717.         bra     sp3
  1718. sp6        rts
  1719.  
  1720. getpdata    move.l  a3,0(a5)
  1721.         move.l  10(a3),4(a5)        ;ln_Name
  1722.         move.b  14(a3),8(a5)        ;mp_Flags
  1723.         move.b  15(a3),9(a5)        ;mp_SigBit
  1724.         move.l  16(a3),10(a5)       ;mp_SigTask
  1725.         moveq   #0,d0
  1726.         movea.l 20(a3),a1           ;mp_MsgList
  1727. sp10        movea.l 0(a1),a1
  1728.         cmpa.l  #0,a1
  1729.         beq.s   sp9
  1730.         addq.b  #1,d0
  1731.         cmp.b   #255,d0
  1732.         bne.s   sp10
  1733. sp9        move.b  d0,14(a5)
  1734.         lea     16(a5),a5
  1735.         addq.b  #1,d5
  1736.         rts
  1737. *-------- resources ------------
  1738.  
  1739. showres     lea     lheader(a4),a0
  1740.         bsr     puthead1
  1741.         lea     resnam(a4),a0
  1742.         bsr     puthead2
  1743.         move.l  SysBase(a4),d5
  1744.         add.l   #336,d5        ;SysBase->ResourceList
  1745.         bsr     show
  1746.         rts
  1747.  
  1748. *--------- devices  -------------
  1749.  
  1750. showdevs    lea     lheader(a4),a0
  1751.         bsr     puthead1
  1752.         lea     devnam(a4),a0
  1753.         bsr     puthead2
  1754.         move.l  SysBase(a4),d5
  1755.         add.l   #350,d5        ;SysBase->DeviceList
  1756.         bsr     show
  1757.         rts
  1758.  
  1759. *-------- libraries -------------
  1760.  
  1761. showlibs    lea     lheader(a4),a0
  1762.         bsr     puthead1
  1763.         lea     libnam(a4),a0
  1764.         bsr     puthead2
  1765.         move.l  SysBase(a4),d5
  1766.         add.l   #378,d5        ;SysBase->LibList
  1767.  
  1768. show        lea     buffer,a5
  1769.         clr.b   entries(a4)
  1770.         CALL    Forbid,SysBase(a4)
  1771.         move.l  d5,a3
  1772. sl1        move.l  0(a3),a3            ;lib_Node.ln_Next
  1773.         tst.l   0(a3)
  1774.         beq.s   sl2
  1775.         addq.b  #1,entries(a4)
  1776.         move.l  a3,0(a5)
  1777.         move.l  10(a3),4(a5)        ;ln_Name
  1778.         move.b  33(a3),8(a5)        ;lib_OpenCnt
  1779.         move.b  21(a3),9(a5)        ;lib_Version
  1780.         move.b  23(a3),10(a5)       ;lib_Revision
  1781.         move.b  14(a3),11(a5)       ;lib_Flags
  1782.         lea     12(a5),a5
  1783.         bra.s   sl1
  1784. sl2        RECALL  Permit
  1785.  
  1786.         lea     buffer,a5
  1787. dl3        tst.b   entries(a4)
  1788.         beq.s   sl4
  1789.         move.l  0(a5),d0
  1790.         move.l  d0,node(a4)
  1791.         bsr     hexa
  1792.         move.b  8(a5),d3
  1793.         bsr     bytedec
  1794.         move.b  9(a5),d3
  1795.         bsr     bytedec
  1796.         move.b  10(a5),d3
  1797.         bsr     bytedec
  1798.         move.b  11(a5),d0
  1799.         bsr     bin
  1800.         move.l  4(a5),d0
  1801.         bsr     putnam
  1802.         lea     12(a5),a5
  1803.         subq.b  #1,entries(a4)
  1804.         bra.s   dl3
  1805. sl4        rts
  1806.  
  1807. ;--------- Semaphores ---------
  1808. semaphores  lea     semhead(a4),a0
  1809.         bsr     puthead
  1810.         move.l  SysBase(a4),a0
  1811.         move.l  532(a0),a1
  1812.         bsr.s   1$
  1813.         move.l  intuibase(a4),a0
  1814.         cmp.w   #36,20(a0)
  1815.         bge.s   5$
  1816.         move.l  1010(a0),a1
  1817.         bsr.s   1$
  1818. 5$        rts
  1819.  
  1820. 1$        move.w  #$4000,$dff09a
  1821.         moveq   #0,d5
  1822.         lea     buffer,a2
  1823. 8$        tst.l   0(a1)
  1824.         beq.s   4$
  1825.         move.l  a1,(a2)+
  1826.         move.l  $28(a1),(a2)+
  1827.         move.b  $2d(a1),(a2)+
  1828.         move.b  $f(a1),(a2)+
  1829.         move.l  10(a1),(a2)+
  1830.         move.l  0(a1),a1
  1831.         addq    #1,d5
  1832.         bra.s   8$
  1833.  
  1834. 4$        move.w  #-$4000,$dff09a
  1835.         lea     buffer,a2
  1836. 6$        subq    #1,d5
  1837.         bmi.s   7$
  1838.         move.l  (a2)+,d0
  1839.         bsr     hexa
  1840.         move.l  (a2)+,d0
  1841.         bsr     getaskname2
  1842.         moveq   #24,d1
  1843.         bsr     tab
  1844.         move.b  (a2)+,d3
  1845.         addq    #1,d3
  1846.         bsr     plusmins
  1847.         move.b  (a2)+,d3
  1848.         bsr     plusmins
  1849.         move.l  (a2)+,d0
  1850.         bsr     putnam
  1851.         move.l  0(a1),a1
  1852.         bra.s   6$
  1853. 7$        rts
  1854.  
  1855. ;Remove a resident module from the list. Clears the rt_Matchword
  1856. ;to avoid being found and reinserted during the next reset
  1857. remresident bsr     nodenam2
  1858.         cmp.b   #'$',0(a5)
  1859.         bne.s   1$
  1860.         move.l  a5,a0
  1861.         bsr     readhex
  1862.         tst.b   d7
  1863.         bne.s   2$
  1864. 1$        move.l  a5,a1
  1865.         CALL    FindResident,SysBase(a4)
  1866.         tst.l   d0
  1867.         beq     fn5
  1868.  
  1869. 2$        move.l  SysBase(a4),a3
  1870.         move.l  300(a3),a3          ;SysBase->ResModules
  1871.  
  1872. 8$        move.l  (a3)+,d1
  1873.         beq     fn5
  1874.         bpl.s   3$
  1875.         bclr    #31,d1
  1876.         movea.l d1,a3
  1877.         bra.s   8$
  1878. 3$        cmp.l   d1,d0
  1879.         bne.s   8$
  1880.  
  1881. 4$        move.l  a3,a5
  1882. 5$        tst.l   (a5)+
  1883.         bgt.s   5$
  1884.  
  1885. 6$        move.l  d0,a1
  1886.         clr.w   0(a1)               ;rt_MatchTag
  1887.         clr.l   22(a1)              ;rt_Init
  1888.         clr.b   10(a1)              ;rt_Flags
  1889.         move.l  a5,d0
  1890.         sub.l   a3,d0
  1891.         lsr     #2,d0
  1892.         subq    #1,d0
  1893.         lea     -4(a3),a1
  1894. 7$        move.l  (a3)+,(a1)+
  1895.         dbf     d0,7$
  1896.         rts
  1897.  
  1898. ;find the first entry in the device-list
  1899. ;returns a1 = pointer to first entry
  1900.  
  1901. devinfo     move.l  dosbase(a4),a1
  1902.         move.l  34(a1),a1         ;dl_Root
  1903.         move.l  24(a1),a1         ;RootNode->rn_Info
  1904.         adda.l  a1,a1
  1905.         adda.l  a1,a1
  1906.         move.l  4(a1),a1          ;DosInfo->di_DevInfo
  1907.         rts
  1908.  
  1909. ;unlock a file
  1910. unlock        tst.b   fromfile(a4)
  1911.         bne     ul6
  1912.         bsr     readhex
  1913.         tst.b   d7
  1914.         beq     syntax
  1915.         move.l  d0,remembr(a4)
  1916.         move.l  d0,-(a7)
  1917.         moveq   #-1,d6
  1918.         bsr     of44
  1919.         tst.l   remembr(a4)
  1920.         beq.s   ul1
  1921.         move.w  #unlerr,d0
  1922.         bsr     putnamw
  1923.         bra     ul4
  1924. ul1        bsr     ResumeOutput
  1925.         move.w  #unl1,d0
  1926.         bsr     putstrw
  1927.         move.l  0(a7),d0
  1928.         bsr     getpath
  1929.         move.w  #unltxt2,d0
  1930.         bsr     putstrw
  1931.         bsr     readline
  1932.         ori.b   #$20,inputbuffer
  1933.         cmp.b   #'y',inputbuffer
  1934.         bne.s   ul5
  1935.         move.l  0(a7),d1
  1936.         CALL    UnLock,dosbase(a4)
  1937. ul5        bsr     freefinfo
  1938. ul4        addq    #4,a7
  1939. ul6        rts
  1940. ;---------- Show all Locks------------
  1941. locks        moveq   #0,d6
  1942.         bra.s   of33
  1943.  
  1944. ;---------- Open Files-----------
  1945. openfiles   moveq   #1,d6
  1946. of33        lea     ofheader(a4),a0
  1947.         bsr     puthead
  1948. of55        move.l  mytask(a4),a5
  1949.         move.l  184(a5),inputbuffer
  1950.         move.l  #-1,184(a5)         ;disable 'please insert..' requester
  1951. of44        bsr     allocfinfo
  1952.         bsr     devinfo        ;get pointer to devicelist
  1953.         move.l  a1,a3
  1954. of1        move.l  a3,devicelock(a4)
  1955.         adda.l  a3,a3
  1956.         adda.l  a3,a3
  1957.         cmp.l   #2,4(a3)            ;DeviceList->dl_Type
  1958.         bne     of2         ;2 = DLT_VOLUME
  1959.         move.l  40(a3),d0           ;dl_Name
  1960.         lsl.l   #2,d0
  1961.         move.l  d0,a2
  1962.         moveq   #0,d3
  1963.         move.b  (a2)+,d3
  1964.         subq    #1,d3
  1965.         lea     buffer,a5
  1966. of22        move.b  (a2)+,(a5)+         ;hack to access the 'RAM Disk" as
  1967.         dbf     d3,of22        ;'RAM:' as the system may GURU
  1968.         move.b  #':',(a5)+          ;with KS1.2
  1969.         clr.b   0(a5)
  1970.         cmp.l   #'RAM ',buffer
  1971.         bne.s   of5
  1972.         cmp.l   #'Disk',buffer+4
  1973.         bne.s   of5
  1974.         move.l  #$4d3a0000,buffer+2 ;="M:"
  1975. of5        move.l  #buffer,d1
  1976.         move.l  #-2,d2
  1977.         CALL    Lock,dosbase(a4)    ;get a lock to the device
  1978.         tst.l   d0            ;'not mounted' if fails
  1979.         bne.s   of6
  1980.         move.l  #buffer,d0
  1981.         bsr     putstr
  1982.         move.w  #nomount,d0
  1983.         bsr     putnamw
  1984.         bra     of2
  1985.  
  1986. of6        move.l  d0,-(a7)            ;d0 = FileLock
  1987.         lsl.l   #2,d0
  1988.         move.l  d0,a5
  1989.         CALL    Forbid,SysBase(a4)
  1990.         lea     buffer+40,a6    ;where to store the locks we find
  1991. of4        move.l  0(a5),d0            ;fl_Link
  1992.         cmp.l   #50,d0        ;zero or bogus ?
  1993.         ble     1$            ;exit loop
  1994.         tst     d6            ;searching for a lock ?
  1995.         bpl.s   3$
  1996.  
  1997.         cmp.l   remembr(a4),d0      ;yes, compare them
  1998.         bne.s   3$
  1999.         CALL    Permit,SysBase(a4) ;exit if found
  2000.         clr.l   remembr(a4)
  2001. 2$        move.l  (a7)+,d1
  2002.         CALL    UnLock,dosbase(a4)
  2003.         bra     quitof
  2004.  
  2005. 3$        move.l  d0,(a6)+            ;put lock into buffer
  2006.         clr.w   (a6)+
  2007.         tst.b   post_V34(a4)
  2008.         beq.s   5$
  2009.         bsr     IsBcplLock        ;hack for KS2.0, see if BPTR isn't
  2010.         bne.s   5$            ;really an APTR
  2011.         move.w  #1,-2(a6)
  2012.         bra.s   4$
  2013. 5$        lsl.l   #2,d0        ;convert bptr into aptr
  2014. 4$        move.l  d0,a5
  2015.         bra.s   of4         ;get next lock
  2016.  
  2017. 1$        clr.l   (a6)+               ;end of buffer marker
  2018.         CALL    Permit,SysBase(a4)
  2019.         tst     d6            ;just searching for a lock ?
  2020.         bmi     of3         ;skip printing out info
  2021.  
  2022. of45        lea     buffer+40,a2    ;a2-> array of locks
  2023. of46        move.l  (a2)+,d0            ;get a lock
  2024.         beq     of3         ;end of list ?
  2025.         tst.w   (a2)+
  2026.         beq.s   2$
  2027.         lsr.l   #2,d0
  2028. 2$        move.l  d0,d5
  2029.         lsl.l   #2,d0        ;bptr -> aptr
  2030.         move.l  d0,a5
  2031.         move.l  8(a5),d4            ;fl_Access
  2032.         move.l  d5,d0
  2033.         bsr     getfinfo        ;get fileinfo
  2034.         move.l  finfoptr(a4),a5
  2035.  
  2036.         tst.l   d6
  2037.         beq.s   of8
  2038.         bmi.s   of8         ;looking for open files ?
  2039.         tst.l   4(a5)               ;fib_DirEntryType
  2040.         bpl     of46        ;not a file
  2041. of8        move.l  d5,d0
  2042.         move.l  d0,node(a4)
  2043.         bsr     hexa        ;display lock
  2044.         move.w  #access,d0        ;access mode
  2045.         cmp     #-2,d4
  2046.         beq.s   of7
  2047.         addq    #8,d0
  2048. of7        bsr     putstrw
  2049.         tst.l   4(a5)               ;size
  2050.         bmi.s   of9
  2051.         move.w  #longnix,d0
  2052.         bsr     putstrw
  2053.         bra     of10
  2054. of9        move.l  124(a5),d0
  2055.         bsr     longdec
  2056. of10        move.l  d5,d0        ;path and filename
  2057.         bsr     getpath
  2058.         bra     of46
  2059.  
  2060.         bsr     newline
  2061. of3        move.l  (a7)+,d1
  2062.         CALL    UnLock,dosbase(a4)
  2063. of2        move.l  0(a3),a3
  2064.         cmpa.l  #0,a3
  2065.         bne     of1
  2066.         bsr     freefinfo
  2067. quitof        move.l  mytask(a4),a5
  2068.         move.l  inputbuffer,184(a5)
  2069.         rts
  2070.  
  2071. IsBcplLock  movem.l d0/a0,-(a7)
  2072.         btst    #0,d0
  2073.         bne.s   2$
  2074.         move.l  d0,a0
  2075.         move.l  16(a0),d0
  2076.         cmp.l   devicelock(a4),d0
  2077. 2$        movem.l (a7)+,d0/a0
  2078.         rts
  2079.  
  2080. ;---------- Dos Devices ----------
  2081.  
  2082. devices     lea     ddheader(a4),a0
  2083.         bsr     puthead
  2084.         bsr     devinfo
  2085. dev1        adda.l  a1,a1
  2086.         adda.l  a1,a1
  2087.         clr.b   d6
  2088.         tst.l   4(a1)
  2089.         bne     dev2
  2090.         move.l  40(a1),d0
  2091.         bsr     putbcpl
  2092.         moveq   #10,d1
  2093.         bsr     tab
  2094.         cmp.l   #20,28(a1)
  2095.         ble     dev9
  2096.         moveq   #1,d6
  2097.         move.l  28(a1),a3
  2098.         adda.l  a3,a3
  2099.         adda.l  a3,a3
  2100.         cmp.l   #20,8(a3)
  2101.         ble     dev9
  2102.         move.l  8(a3),a2
  2103.         adda.l  a2,a2
  2104.         adda.l  a2,a2
  2105.         move.l  12(a2),d3
  2106.         movem.l a1-a3,-(a7)
  2107.         bsr     bytedec
  2108.         movem.l (a7)+,a1-a3
  2109.         moveq   #1,d3
  2110.         move.l  20(a2),d0
  2111.         bsr     longdec
  2112.         move.l  40(a2),d0
  2113.         beq.s   devs20
  2114.         addq    #1,d0
  2115.         sub.l   36(a2),d0
  2116. devs20        bsr     longdec
  2117.         move.l  44(a2),d0
  2118.         bsr     longdec
  2119.         bra.s   dev8
  2120. dev9        move.w  #notfile,d0
  2121.         bsr     putstrw
  2122. dev8        tst.l   8(a1)
  2123.         beq.s   dev6
  2124.         move.w  #devload,d0
  2125.         bra.s   dev5
  2126. dev6        move.w  #devnload,d0
  2127. dev5        bsr     putstrw
  2128.         tst.b   d6
  2129.         beq.s   dev7
  2130.         move.l  4(a3),d0
  2131.         bne.s   dev4
  2132. dev7        move.l  16(a1),d0
  2133.         bne.s   dev4
  2134.         tst.l   8(a1)
  2135.         beq.s   dev11
  2136.         move.l  8(a1),a3
  2137.         move.l  -82(a3),d0
  2138.         bsr     putstr
  2139.         bra     dev11
  2140. dev4        bsr     putbcpl
  2141. dev11        bsr     newline
  2142. dev2        move.l  0(a1),a1
  2143.         cmpa.l  #0,a1
  2144.         bne     dev1
  2145.         rts
  2146.  
  2147. ; Check if a named dos-device is mounted
  2148. ; name in 'buffer'.
  2149. ; Result: d0 = 0(false) anything else(true).
  2150.  
  2151. finddev     bsr     devinfo
  2152. fdev1        adda.l  a1,a1
  2153.         adda.l  a1,a1
  2154.         clr.b   d6
  2155.         tst.l   4(a1)
  2156.         bne.s   fdev2
  2157.         move.l  40(a1),a2
  2158.         lea     buffer,a0
  2159.         bsr     strbcmp
  2160.         tst     d0
  2161.         bne.s   fdev3
  2162. fdev2        move.l  0(a1),a1
  2163.         cmpa.l  #0,a1
  2164.         bne.s   fdev1
  2165. fdev3        rts
  2166.  
  2167. ; Re-assign a drive to dos
  2168.  
  2169. freedrive   clr.l   dp_Arg1
  2170.         bra     ldr3
  2171.  
  2172. ; Inhibit a disk drive
  2173.  
  2174. lockdrive   move.l  #1,dp_Arg1
  2175. ldr3        bsr     getstr
  2176.         bsr     finddev
  2177.         bne.s   ldr1
  2178. ldr2        move.l  #buffer,d0
  2179.         bsr     putstr
  2180.         move.w  #nomount,d0
  2181.         bsr     putstrw
  2182.         move.w  #dishelp,d0
  2183.         bra     putnamw
  2184. ldr1        move.l  #buffer,d1
  2185.         CALL    DeviceProc,dosbase(a4)
  2186.         tst.l   d0
  2187.         beq.s   ldr2
  2188.         move.l  d0,a0
  2189.         move.l  #31,dp_Type
  2190.         bra     cons1
  2191.  
  2192. ;display the current directory of all processes,
  2193.  
  2194. currentdir  lea     cdheader(a4),a0
  2195.         bsr     puthead
  2196.         bsr     allocfinfo
  2197.         bsr     getaskdat4
  2198.         beq     cd7
  2199.         move.l  d0,a5
  2200.         move.l  a5,-(a7)
  2201.         bsr     getaskdat3
  2202.         move.b  d5,entries(a4)
  2203.         move.l  0(a7),a5
  2204. cd2        tst.b   entries(a4)
  2205.         beq.s   cd6
  2206.         cmp.b   #13,8(a5)
  2207.         bne.s   cd5
  2208.         move.l  0(a5),a3
  2209.         move.l  a5,-(a7)
  2210.         moveq   #-1,d6
  2211.         move.l  152(a3),remembr(a4)
  2212.         bsr     of55
  2213.         move.l  (a7)+,a5
  2214.         tst.l   remembr(a4)
  2215.         bne.s   cd5
  2216.         move.l  0(a5),a3
  2217.         move.l  a3,node(a4)
  2218.         bsr     gettaskname
  2219.         moveq   #21,d1
  2220.         bsr     tab
  2221.         move.l  0(a5),a3
  2222.         move.l  152(a3),d0
  2223. cd1        bsr     getpath
  2224. cd5        subq.b  #1,entries(a4)
  2225.         lea     16(a5),a5
  2226.         bra.s   cd2
  2227. cd6        bsr     freefinfo
  2228.         move.l  (a7)+,a5
  2229.         bsr     freetaskbuf
  2230. cd7        rts
  2231.  
  2232. ;Change the current directory setting of a process
  2233.  
  2234. cd        tst.b   fromfile(a4)
  2235.         bne     cd10
  2236.         bsr     getstr
  2237.         move.l  a0,-(a7)
  2238.         move.l  #buffer,d1
  2239.         move.l  #-2,d2
  2240.         CALL    Lock,dosbase(a4)
  2241.         move.l  (a7)+,a0
  2242.         tst.l   d0
  2243.         bne     cd16
  2244.         move.w  #dnotf,d0
  2245.         bra     putnamw
  2246. cd16        move.l  d0,remembr2(a4)
  2247.         move.l  a0,-(a7)
  2248.         bsr     allocfinfo
  2249.         move.l  remembr2(a4),d0
  2250.         bsr     getfinfo
  2251.         move.l  finfoptr(a4),a5
  2252.         move.l  (a7)+,a0
  2253.         tst.l   4(a5)
  2254.         bpl.s   cd11
  2255.         move.w  #notdir,d0
  2256.         bsr     putnamw
  2257.         bra     cd18
  2258. cd11        bsr     nodenam
  2259.         moveq.l #2,d7
  2260.         lea     TRuNode(PC),a3
  2261.         bsr     findnam
  2262.         tst.b   d7
  2263.         beq.s   cd15
  2264.         move.l  d0,a5
  2265.         cmp.b   #13,8(a5)
  2266.         beq.s   cd15
  2267.         bsr     syntax
  2268.         bra     cd18
  2269. cd15        move.l  152(a5),d0
  2270.         beq.s   cd13
  2271.         movem.l a5,-(a7)
  2272.         moveq   #-1,d6
  2273.         move.l  d0,remembr(a4)
  2274.         bsr     of55
  2275.         move.l  (a7)+,a5
  2276.         tst.l   remembr(a4)
  2277.         bne.s   cd18
  2278. cd13        move.l  152(a5),d1
  2279.         move.l  remembr2(a4),152(a5)
  2280.         move.l  d1,remembr2(a4)
  2281. cd12        beq.s   cd14
  2282.         bsr     ResumeOutput
  2283.         move.w  #unltxt,d0
  2284.         bsr     putstrw
  2285.         move.l  remembr2(a4),d0
  2286.         bsr     getpath
  2287.         move.w  #unltxt2,d0
  2288.         bsr     putstrw
  2289.         bsr     readline
  2290.         ori.b   #$20,inputbuffer
  2291.         cmp.b   #'y',inputbuffer
  2292.         bne.s   cd14
  2293. cd18        move.l  remembr2(a4),d1
  2294.         beq.s   cd14
  2295.         CALL    UnLock,dosbase(a4)
  2296. cd14        bsr     freefinfo
  2297. cd10        rts
  2298.  
  2299. ;Display the list of inputhandlers. It adds a dummy
  2300. ;input handler, grabs the list header, and removes the handler
  2301.  
  2302. inphand     tst.b   background(a4)
  2303.         bne.s   inph1
  2304.         bsr     installh
  2305. inph1        move.l  #500,d4
  2306.         lea     InInterrupt(a4),a0
  2307. inph2        tst.l   4(a0)
  2308.         beq.s   inph3
  2309.         move.l  4(a0),a0
  2310.         dbf     d4,inph2
  2311. inph3        tst.b   background(a4)
  2312.         bne.s   inph4
  2313.         movem.l d4/a0,-(a7)
  2314.         bsr     removeh
  2315.         movem.l (a7)+,d4/a0
  2316. inph4        cmp.w   #-1,d4
  2317.         bne.s   inph5
  2318.         move.w  #failed,d0
  2319.         bra     putnamw
  2320. inph5        move.l  a0,-(a7)
  2321.         lea     inheader(a4),a0
  2322.         bsr     puthead
  2323.         move.l  (a7)+,a5
  2324. inph6        move.l  0(a5),a5
  2325.         tst.l   0(a5)
  2326.         beq.s   inph7
  2327.         move.l  a5,d0
  2328.         move.l  d0,node(a4)
  2329.         bsr     hexa
  2330.         move.l  14(a5),d0
  2331.         bsr     hexa
  2332.         move.l  18(a5),d0
  2333.         bsr     hexa
  2334.         move.b  9(a5),d3
  2335.         bsr     plusmins
  2336.         move.l  10(a5),d0
  2337. inph8        bsr     putnam
  2338.  
  2339.         bra.s   inph6
  2340. inph7        rts
  2341.  
  2342. ;get all screen pointers.
  2343. ;result: d5=number of screens
  2344. ;     buffer+100 holds pointers.
  2345.  
  2346. getscr        lea     scrheader(a4),a0
  2347.         bsr     puthead
  2348. getscr2     move.l  d0,-(a7)
  2349.         moveq   #0,d0
  2350.         CALL    LockIBase,intuibase(a4)
  2351.         move.l  intuibase(a4),a2
  2352.         move.l  60(a2),a2
  2353.         lea     buffer+100,a1
  2354.  
  2355.         moveq   #0,d5
  2356. sr1        move.l  a2,(a1)+
  2357.         move.l  0(a2),a2
  2358.         addq.l  #1,d5
  2359.         cmpa.l  #0,a2
  2360.         bne.s   sr1
  2361.         subq    #1,d5
  2362.         move.l  d0,a0
  2363.         CALL    UnlockIBase,intuibase(a4)
  2364.         move.l  (a7)+,d0
  2365.         rts
  2366.  
  2367. ;display screen addresses and titles
  2368.  
  2369. screens     bsr     getscr
  2370.         moveq   #1,d6
  2371.         lea     buffer+100,a1
  2372. sr2        move    d6,d3
  2373.         bsr     bytedec
  2374.         move.l  0(a1),d0
  2375.         move.l  d0,node(a4)
  2376.         move.l  d0,a2
  2377.         bsr     hexa
  2378.         move.w  12(a2),d0
  2379.         moveq   #4,d3
  2380.         bsr     longdecn
  2381.         moveq   #'X',d0
  2382.         bsr     putchar
  2383.         move.w  14(a2),d0
  2384.         bsr     longdecn
  2385.         move.b  189(a2),d3
  2386.         bsr     bytedec
  2387.         move.l  (a1)+,a2
  2388.         move.l  22(a2),d0
  2389.         bsr     putnam
  2390.         addq    #1,d6
  2391.         dbf     d5,sr2
  2392.         rts
  2393. Screen
  2394. ;display window addresses and titles
  2395.  
  2396. windows     clr.b   bool(a4)
  2397. windows1    bsr     getscr2
  2398.         move.l  d5,-(a7)
  2399.         lea     wnheader(a4),a0
  2400.         bsr     puthead
  2401.         move.l  (a7)+,d5
  2402.         tst.b   bool(a4)
  2403.         beq.s   wn20
  2404.         move.l  d5,-(a7)
  2405.         lea     fohead(a4),a0
  2406.         bsr     puthead
  2407.         move.l  (a7)+,d5
  2408. wn20        lea     buffer+100,a3
  2409. wn2        move.w  #onscr,d0
  2410.         bsr     putstrw
  2411.         move.l  (a3)+,a2
  2412.         move.l  22(a2),d0
  2413.         bsr     putnam
  2414.         move.l  4(a2),a1
  2415. wn1        cmpa.l  #0,a1
  2416.         beq.s   wn3
  2417.         move.l  a1,d0
  2418.         move.l  d0,node(a4)
  2419.         bsr     hexa
  2420.  
  2421.         move.l  86(a1),d0          ;wn->UserPort
  2422.         beq.s   1$
  2423.         move.l  d0,a0
  2424.         move.l  16(a0),d0          ;SigTask
  2425. 1$        bsr     getaskname2
  2426.         moveq   #20,d1
  2427.         bsr     tab
  2428.         bsr     putblank
  2429.  
  2430.         moveq   #4,d3
  2431.         moveq   #2,d2
  2432.         lea     4(a1),a0
  2433. 2$        move.w  (a0)+,d0
  2434.         bsr     longdecn
  2435.         dbf     d2,2$
  2436.         moveq   #'X',d0
  2437.         bsr     putchar
  2438.         move.w  10(a1),d0
  2439.         bsr     longdecn
  2440.  
  2441.         move.l  32(a1),d0
  2442.         bsr     putnam
  2443.  
  2444.         tst.b   bool(a4)
  2445.         beq.s   wn21
  2446.         move.l  a1,-(a7)
  2447.         move.l  50(a1),a1
  2448.         move.l  52(a1),a1
  2449.         bsr     fontdata
  2450.         move.l  (a7)+,a1
  2451.  
  2452. wn21        move.l  0(a1),a1
  2453.         bra.s   wn1
  2454. wn3        dbf     d5,wn2
  2455.         rts
  2456.  
  2457. ;close a specified screen
  2458.  
  2459. closescreen bsr     getscr2
  2460.         moveq   #1,d6
  2461.         cmp.b   #'$',0(a0)
  2462.         bne.s   cs1
  2463.         bsr     readhex
  2464.         tst     d7
  2465.         beq     syntax
  2466.         move.l  d0,d4
  2467. csin        moveq   #0,d6
  2468. cs1        lea     buffer+100,a2
  2469. cs5        tst     d6
  2470.         bne.s   cs2
  2471.         cmp.l   (a2)+,d4
  2472.         beq.s   cs3
  2473.         bra.s   cs4
  2474. cs2        move.l  (a2)+,a1
  2475.         move.l  22(a1),a1
  2476.         bsr     strcmp
  2477.         tst     d0
  2478.         beq.s   cs3
  2479. cs4        dbf     d5,cs5
  2480.         move.w  #scnofound,d0
  2481.         bra     putnamw
  2482. cs3        move.l  -4(a2),a0
  2483.         CALL    CloseScreen,intuibase(a4)
  2484.         rts
  2485.  
  2486. ;close a specified window
  2487. closewindow bsr     getwnptr
  2488. clw        move.l  a3,d0
  2489.         beq.s   cwend
  2490. cw3        tst.l   36(a3)
  2491.         beq.s   cw8
  2492.         move.l  36(a3),a0
  2493.         move.w  28(a0),d0
  2494.         and.w   #$4000,d0
  2495.         beq.s   cw9
  2496.         move.l  a3,a0
  2497.         CALL    FreeSysRequest,intuibase(a4)
  2498.         rts
  2499. cw9        move.l  a3,a1
  2500.         CALL    EndRequest,intuibase(a4)
  2501.         bra.s   cw3
  2502. cw8        move.l  a3,a0
  2503.         moveq   #0,d0
  2504.         CALL    ModifyIDCMP,intuibase(a4)
  2505.         move.l  a3,a0
  2506.         CALL    CloseWindow,intuibase(a4)
  2507. cwend        rts
  2508.  
  2509.  
  2510. getwnptr    bsr     getscr2
  2511.         moveq   #1,d6
  2512.         cmp.b   #'$',0(a0)
  2513.         bne.s   cw1
  2514.         bsr     readhex
  2515.         tst     d7
  2516.         bne.s   cwin
  2517.         bsr     syntax
  2518.         bra.s   cwerr
  2519. cwin        move.l  d0,d4
  2520.         moveq   #0,d6
  2521. cw1        lea     buffer+100,a2
  2522. cw5        move.l  (a2)+,a3
  2523.         move.l  4(a3),a3
  2524. cw6        cmpa.l  #0,a3
  2525.         beq.s   cw4
  2526.         tst     d6
  2527.         bne.s   cw2
  2528.         cmp.l   a3,d4
  2529.         beq.s   cw10
  2530.         bra.s   cw7
  2531. cw2        move.l  32(a3),a1
  2532.         bsr     strcmp
  2533.         tst     d0
  2534.         beq.s   cw10
  2535. cw7        move.l  0(a3),a3
  2536.         bra.s   cw6
  2537. cw4        dbf     d5,cw5
  2538.         move.w  #winnofound,d0
  2539.         bsr     putnamw
  2540. cwerr        suba.l  a3,a3
  2541. cw10        rts
  2542.  
  2543. windowoff   movem.l d1-d7/a0-a6,-(a7)
  2544.         bsr     getscr2
  2545.         bsr     cwin
  2546.         move.l  a3,d1
  2547.         beq.s   woff1
  2548.         bsr     clw
  2549.         move.l  -(a2),a0
  2550.         move.l  a0,d4
  2551.         tst.l   4(a0)
  2552.         bne.s   woff1
  2553.         bsr     getscr2
  2554.         bsr     csin
  2555. woff1        movem.l (a7)+,d1-d7/a0-a6
  2556.         rts
  2557.  
  2558. closetskwin movem.l d1-d7/a0-a6,-(a7)
  2559. ctw0        bsr     getscr2
  2560.         lea     buffer+100,a2
  2561. ctw1        move.l  (a2)+,a3
  2562.         move.l  4(a3),a3
  2563. ctw6        cmpa.l  #0,a3
  2564.         beq.s   ctw4
  2565.         move.l  86(a3),a0
  2566.         move.l  16(a0),d1
  2567.         cmp.l   d0,d1
  2568.         bne.s   ctw7
  2569.         move.l  d0,d1
  2570.         move.l  a3,d0
  2571.         bsr     windowoff
  2572.         move.l  d1,d0
  2573.         bra     ctw0
  2574. ctw7        move.l  0(a3),a3
  2575.         bra.s   ctw6
  2576. ctw4        dbf     d5,ctw1
  2577.         movem.l (a7)+,d1-d7/a0-a6
  2578.         rts
  2579.  
  2580. ;Change the font of a specified Window
  2581.  
  2582. setfont     bsr     nodenam
  2583.         tst.b   0(a5)
  2584.         beq     syntax
  2585.         move.l  a5,a3
  2586. 1$        cmp.b   #33,(a3)+
  2587.         bge.s   1$
  2588.         tst.b   -1(a3)
  2589.         beq     syntax
  2590.         clr.b   -1(a3)
  2591.  
  2592.         lea     dummy,a0
  2593.         move.l  a5,0(a0)
  2594.         move.b  procnum(a4),d0
  2595.         ext.w   d0
  2596.         move.w  d0,4(a0)
  2597.         clr.w   6(a0)
  2598.         CALL    OpenFont,gfxbase(a4)
  2599.         tst.l   d0
  2600.         bne.s   2$
  2601.         lea     diskfont(a4),a1
  2602.         CALL    OpenLibrary,SysBase(a4)
  2603.         move.l  d0,d5
  2604.         beq.s   4$
  2605.         move.l  d0,a6
  2606.         lea     dummy,a0
  2607.         RECALL  OpenDiskFont
  2608.         move.l  d0,d4
  2609.         move.l  d5,a1
  2610.         CALL    CloseLibrary,SysBase(a4)
  2611.         move.l  d4,d0
  2612.         bne.s   2$
  2613. 4$        move.w  #fonterr,d0
  2614.         bsr     putstrw
  2615.         move.l  dummy,d0
  2616.         bra     putnam
  2617. 2$        move.l  d0,-(a7)
  2618.         move.l  a3,a0
  2619.         bsr     kllblnks
  2620.         bsr     getwnptr
  2621.         move.l  (a7)+,a0
  2622.         move.l  a3,d1
  2623.         bne.s   5$
  2624.         move.l  a0,a1
  2625.         CALL    CloseFont,gfxbase(a4)
  2626.         bra.s   3$
  2627. 5$        move.l  50(a3),a1
  2628.         CALL    SetFont,gfxbase(a4)
  2629.         move.l  a3,a0
  2630.         CALL    RefreshWindowFrame,intuibase(a4)
  2631. 3$        rts
  2632.  
  2633.  
  2634. ;display windows and associated fonts
  2635.  
  2636. windowfonts move.b  #1,bool(a4)
  2637.         bra     windows1
  2638.  
  2639. ;display loaded font names and definitions
  2640.  
  2641. fonts        lea     fohead(a4),a0
  2642.         bsr     puthead
  2643.         move.l  gfxbase(a4),a1
  2644.         move.l  $8c(a1),a1
  2645. fo1        tst.l   0(a1)
  2646.         beq.s   fo3
  2647.         bsr     fontdata
  2648.         move.l  0(a1),a1
  2649.         bra     fo1
  2650. fo3        rts
  2651.  
  2652. fontdata    move.l  a1,d0
  2653.         move.l  d0,node(a4)
  2654.         bsr     hexa
  2655.         move.w  30(a1),d3
  2656.         bsr     bytedec
  2657.         move.w  20(a1),d3
  2658.         bsr     bytedec
  2659.         move.w  24(a1),d3
  2660.         bsr     bytedec
  2661.         move.w  #romfnt,d0
  2662.         btst    #1,23(a1)
  2663.         beq.s   fod1
  2664.         addq    #diskfnt-romfnt,d0
  2665. fod1        bsr     putstrw
  2666.         move.w  #ffixed,d0
  2667.         btst    #5,23(a1)
  2668.         beq.s   1$
  2669.         addq    #fprop-ffixed,d0
  2670. 1$        bsr     putstrw
  2671.         move.b  32(a1),d3
  2672.         bsr     bytedec
  2673.         move.b  33(a1),d3
  2674.         bsr     bytedec
  2675.         move.l  10(a1),d0
  2676.         bra     putnam
  2677.  
  2678. ;set update rate
  2679.  
  2680. settime     bsr     getfrac
  2681.         tst.b   d7
  2682.         bne.s   st1
  2683.         move.w  #whattime,d0
  2684.         bsr     putstrw
  2685.         move.l  timeoutm(a4),d0
  2686.         move.l  #100000,d1
  2687.         bsr     div
  2688.         moveq   #0,d1
  2689.         move.b  timeout(a4),d1
  2690.         mulu    #10,d1
  2691.         add.l   d1,d0
  2692.         bne.s   1$
  2693.         move.w  #timenotset,d0
  2694.         bra     putnamw
  2695. 1$        bsr     putfrac
  2696.         bra     newline
  2697.  
  2698. st1        divs    #10,d2
  2699.         move.b  d2,timeout(a4)
  2700.         swap    d2
  2701.         ext.l   d2
  2702.         moveq   #0,d3
  2703.         subq    #1,d2
  2704.         bmi.s   1$
  2705. 2$        add.l   #100000,d3
  2706.         dbf     d2,2$
  2707. 1$        move.l  d3,timeoutm(a4)
  2708.         rts
  2709. syntax        move.w  #synerr,d0
  2710. sy1        bra     putnamw
  2711.  
  2712. ;copy a string from input to 'buffer'
  2713. ;a0 = pointer to string
  2714.  
  2715. getstr        lea     buffer,a5
  2716. gst2        cmp.b   #' ',0(a0)
  2717.         beq.s   gst1
  2718.         cmp.b   #10,0(a0)
  2719.         beq.s   gst1
  2720.         move.b  (a0)+,(a5)+
  2721.         bra.s   gst2
  2722. gst1        clr.b   0(a5)
  2723.         bra     kllblnks
  2724.  
  2725. ;read in a nodename or a processname
  2726.  
  2727. nodenam     bsr     isdec
  2728.         move.b  d2,procnum(a4)
  2729. nodenam2    bsr     kllblnks
  2730.         move.l  a0,a5
  2731. gno1        cmp.b   #10,(a0)+
  2732.         bne.s   gno1
  2733.         move.b  #0,-1(a0)
  2734.         rts
  2735.  
  2736. zerotimer   bsr     nodenam
  2737.         moveq.l #2,d7
  2738.         lea     TRuNode(PC),a3
  2739.         bsr     findnam
  2740.         tst.b   d7
  2741.         beq.s   1$
  2742.         bsr     gettimeentry
  2743.         lea     usedtime,a0
  2744.         clr.l   0(a0,d0)
  2745. 1$        rts
  2746.  
  2747.  
  2748. ;cancel a task or a process. The theory is quite simple:
  2749. ;(Process->ReturnAddr)-4 points to the return address on
  2750. ;the stack. Task->SPReg points to the next instruction
  2751. ;to be executed. We just need a
  2752. ; *(Task->SPReg) = *(Process->ReturnAddr-4).
  2753. ;If the process has been started from Dos (CLI) and
  2754. ;the process is doing disk I/O, the CLI will respond with
  2755. ;a GURU #87000004 (AsyncPKT=unexpected packed received).
  2756. ;Thats why the calling CLI is also canceled.
  2757.  
  2758.  
  2759. cancel        tst.b   fromfile(a4)
  2760.         beq.s   cancel1
  2761.         rts
  2762. cancel1     clr.l   remembr(a4)      ;used for CLI stdio
  2763.         clr.l   remembr2(a4)
  2764.         clr.b   bool(a4)
  2765.         bsr     nodenam
  2766. testagain   moveq.l #1,d7
  2767.         lea     TReNode(PC),a3
  2768.         bsr     findnam
  2769.         tst.b   d7
  2770.         bne.s   canok
  2771. cnerr        move.w  #stperr,d0
  2772.         bra     putnamw
  2773.  
  2774. canok        move.l  d0,a1       ;d0=task
  2775.         move.l  d0,pointer(a4)
  2776.         cmp.b   #1,8(a1)       ;TASK ?
  2777.         bne.s   isproc
  2778.         CALL    RemTask,SysBase(a4)
  2779.         move.l  pointer(a4),d0
  2780.         bsr     closeports
  2781.         move.l  pointer(a4),d0
  2782.         bra     closetskwin
  2783.  
  2784. isproc        movem.l d0-d7/a0-a6,-(a7)
  2785.         moveq   #-1,d0          ;needed for recursive killing tasks
  2786.         CALL    AllocSignal,SysBase(a4)
  2787.         moveq   #0,d1
  2788.         bset    d0,d1
  2789.         move.l  d1,cancelbit(a4)
  2790.         move.l  d0,cancelbnum(a4)
  2791.         movem.l (a7)+,d0-d7/a0-a6
  2792.  
  2793.         moveq   #0,d5
  2794.         tst.l   $ac(a1)         ;pr_CLI
  2795.         beq.s   wascreproc
  2796.         move.l  $80(a1),a2      ;Seglist
  2797.         adda.l  a2,a2
  2798.         adda.l  a2,a2
  2799.         move.l  12(a2),d1       ;empty ?
  2800.         bne.s   wascreproc
  2801.         move.l  $ac(a1),a2      ;CommandLineInterface
  2802.         adda.l  a2,a2
  2803.         adda.l  a2,a2
  2804.         move.l  60(a2),d5       ;cli_Module
  2805.         tst.l   40(a2)          ;IsInteractive
  2806.         beq     dosreturn
  2807.         move.l  28(a2),remembr(a4) ;yes,get Cli-Window locks
  2808.         move.l  56(a2),remembr2(a4)
  2809.         bra     dosreturn
  2810. wascreproc  tst.b   bool(a4)        ;it is not a CLI, ask what to do
  2811.         bne     unload
  2812.         move.b  #3,bool(a4)
  2813.         bsr     ResumeOutput
  2814.         move.w  #canerr0,d0     ;ask for Workbench
  2815.         bsr     putstrw
  2816.         bsr     readline
  2817.         cmp.b   #'y',inputbuffer
  2818.         beq.s   andagain
  2819.         move.b  #2,bool(a4)
  2820.         bsr     ResumeOutput
  2821.         move.w  #canerr1,d0    ;ask for unload
  2822.         bsr     putstrw
  2823.         bsr     readline
  2824.         cmp.b   #'y',inputbuffer
  2825.         bne.s   andagain
  2826.         move.b  #1,bool(a4)
  2827. andagain    move.l  pointer(a4),d0
  2828.         moveq.l #1,d7
  2829.         lea     TReNode(PC),a3
  2830.         bsr     tstnode
  2831.         tst     d5
  2832.         beq     cnerr
  2833.         bra     canok
  2834.  
  2835. unload        move.l  128(a1),d4 ;get Segmentlist
  2836.         beq.s   unl3
  2837.         lsl.l   #2,d4
  2838.         move.l  d4,a3
  2839.         cmp.l   #100,0(a3)
  2840.         bpl.s   ulerr
  2841.         move.l  12(a3),d4
  2842. unl3        tst.l   d4
  2843.         bne.s   unl4
  2844. ulerr        move.w  #unloaderr,d0 ;no Segments !?
  2845.         bra     putnamw
  2846.  
  2847. unl4        cmp.b   #3,bool(a4)        ;Workbench Task
  2848.         bne.s   unl2
  2849.         move.l  a1,-(a7)
  2850.         moveq   #40,d0           ;build a copy of the
  2851.         move.l  #$10000,d1           ;Workbench startup-message
  2852.         CALL    AllocMem,SysBase(a4)
  2853.         move.l  d0,startmess(a4)
  2854.         move.l  (a7)+,a1
  2855.         move.l  d0,a0
  2856.         move.b  #5,8(a0)
  2857.         move.w  #20,18(a0)
  2858.         move.l  d4,24(a0)
  2859.         move.l  a1,d0
  2860.         add.l   #92,d0
  2861.         move.l  d0,20(a0)
  2862.         movem.l a0-a1,-(a7)
  2863.         lea     wbname(a4),a1
  2864.         CALL    FindPort,SysBase(a4)
  2865.         movem.l (a7)+,a0-a1
  2866.         move.l  d0,14(a0)
  2867.         bne.s   unl2
  2868.         move.w  #noworkbench,d0
  2869.         bra     putnamw
  2870.  
  2871. unl2        cmp.b   #1,bool(a4)
  2872.         bne.s   dosreturn
  2873.         move.l  a1,-(a7)           ;unload process manualy
  2874.         move.l  d4,d1
  2875.         CALL    UnLoadSeg,dosbase(a4)
  2876.         move.l  (a7)+,a1
  2877.  
  2878. dosreturn   move.l  140(a1),savedat(a4) ;Processnumber
  2879. dosret1     move.w  #$4000,$dff09a
  2880.         move.l  54(a1),a3
  2881.         move.l  #endtask,0(a3)
  2882.         tst.b   gotguru(a4)
  2883.         bne.s   1$
  2884.         tst.b   bool(a4)
  2885.         bne.s   1$
  2886.         move.b  #2,106(a1)       ;ignore messages
  2887. 1$        cmp.b   #4,15(a1)        ;if waiting
  2888.         bne.s   doswait
  2889.         move.l  a1,d4
  2890.         CALL    Remove,SysBase(a4)
  2891.         move.l  d4,a1
  2892.         lea     406(a6),a0       ; activate the task
  2893.         RECALL  AddHead
  2894.         move.l  d4,a1
  2895.  
  2896. doswait     move.w  #-$4000,$dff09a
  2897.  
  2898.         tst.b   bool(a4)
  2899.         bne.s   endnodos
  2900.         tst.l   d5
  2901.         beq.s   endcanc
  2902.  
  2903.         move.l  $ac(a1),a2
  2904.         adda.l  a2,a2
  2905.         adda.l  a2,a2
  2906. dwa1        movem.l d0-d7/a0-a6,-(a7)
  2907.         move.l  cancelbit(a4),d0
  2908.         CALL    Wait,SysBase(a4)
  2909.         movem.l (a7)+,d0-d7/a0-a6
  2910.         tst.b   gotguru(a4)
  2911.         bne.s   endnodos
  2912.         moveq   #0,d5
  2913.         bra     dosret1
  2914.  
  2915. endcanc     move.l  a1,-(a7)
  2916.         move.l  remembr(a4),d1    ;close CLI-Window
  2917.         beq.s   ecan1          ;if any
  2918.         CALL    Close,dosbase(a4)
  2919. ecan1        move.l  remembr2(a4),d1
  2920.         beq.s   ecan2
  2921.         CALL    Close,dosbase(a4)
  2922. ecan2        move.l  (a7)+,a1
  2923.  
  2924.         move.l  savedat(a4),d0   ;remove Task from
  2925.         move.l  dosbase(a4),a2   ;TaskArray
  2926.         move.l  34(a2),a2
  2927.         move.l  0(a2),a2
  2928.         adda.l  a2,a2
  2929.         adda.l  a2,a2
  2930.         lsl.l   #2,d0
  2931.         clr.l   0(a2,d0)
  2932.  
  2933. endnodos    move.l  a1,d0
  2934.         bsr     closetskwin
  2935.         move.l  a1,d0
  2936.         bsr     closeports
  2937.         move.l  cancelbnum(a4),d0      ;remove our Signal
  2938.         CALL    FreeSignal,SysBase(a4)
  2939.         rts
  2940.  
  2941. ;This Code is (hopefully) executed by the Process we want
  2942. ;to kill
  2943.  
  2944. endtask     move.l  _SysBase(PC),a1
  2945.         move.l  276(a1),a1
  2946.         move.l  176(a1),a1          ;Process_ReturnAddr
  2947.         lea     -4(a1),a7           ;reset Process Stackptr
  2948.         tst.b   bool+dataarea
  2949.         bne.s   et0
  2950.         movea.l mytask+dataarea(PC),a1
  2951.         move.l  cancelbit+dataarea(PC),d0    ;signal Xoper it
  2952.         CALL    Signal,_SysBase(PC)           ;died
  2953. et0        cmp.b   #3,bool+dataarea         ;Workbench Process ?
  2954.         bne.s   et1
  2955.         CALL    Forbid,_SysBase(PC)
  2956.         move.l  startmess(a4),a1
  2957.         CALL    ReplyMsg,_SysBase(PC) ;reply startup message
  2958. et1        rts
  2959.  
  2960. ;Stop a task (just queue it on a special list)
  2961.  
  2962. freeze        bsr     nodenam
  2963.         moveq.l #1,d7
  2964.         lea     TReNode(PC),a3
  2965.         bsr     findnam
  2966.         tst.b   d7
  2967.         bne.s   frok
  2968. frerr        move.w  #stperr,d0
  2969.         bra     putstrw
  2970. frok        move.l  d0,a1
  2971.         cmp.b   #13,8(a1)
  2972.         beq.s   1$
  2973.         cmp.b   #1,8(a1)
  2974.         bne.s   frerr
  2975. 1$        move.w  #$4000,$dff09a
  2976.         CALL    Remove,SysBase(a4)
  2977.         move.w  #-$4000,$dff09a
  2978.         move.l  d0,a1
  2979.         move.l  d0,a5
  2980.         lea     stplist(a4),a0
  2981.         RECALL  AddHead
  2982.         add.b   #4,15(a5)
  2983.         rts
  2984. ;put the task back on its list
  2985. warm        bsr     nodenam
  2986.         cmp.b   #'$',0(a5)
  2987.         bne.s   1$
  2988.         move.l  d7,d2
  2989.         move.l  a5,a0
  2990.         bsr     readhex
  2991.         tst.b   d7
  2992.         beq.s   1$
  2993.         move.l  stplist(a4),a3
  2994. 3$        tst.l   0(a3)
  2995.         beq.s   2$
  2996.         cmp.l   a3,d0
  2997.         beq.s   waok
  2998.         move.l  0(a3),a3
  2999.         bra.s   3$
  3000. 1$        lea     stplist(a4),a0
  3001.         movea.l a5,a1
  3002.         moveq   #0,d7
  3003.         bsr     fn4
  3004.         tst.b   d7
  3005.         bne.s   waok
  3006. 2$        move.w  #waerr,d0
  3007.         bra     putstrw
  3008. waok        move.w  #$4000,$dff09a
  3009.         move.l  d0,a1
  3010.         CALL    Remove,SysBase(a4)
  3011.         move.l  d0,a1
  3012.         move.l  d0,a5
  3013.         move.l  TReNode,a0
  3014.         cmp.b   #8,15(a1)
  3015.         bne.s   wa1
  3016.         move.l  TWaNode,a0
  3017. wa1        adda.l  SysBase(a4),a0
  3018.         RECALL  AddTail
  3019.         move.l  d0,a1
  3020.         subq.b  #4,15(a5)
  3021.         move.w  #-$4000,$dff09a
  3022.         move.l  18(a5),d0
  3023.         and.l   26(a5),d0
  3024.         beq.s   wa2
  3025.         movea.l a5,a1
  3026.         RECALL  Signal
  3027. wa2        rts
  3028.  
  3029. ;show register values of a task
  3030.  
  3031. regs        bsr     nodenam
  3032.         moveq.l #2,d7
  3033.         lea     TRuNode(PC),a3
  3034.         bsr     findnam
  3035.         tst.b   d7
  3036.         bne.s   1$
  3037.         rts
  3038. 1$
  3039.  
  3040.  
  3041.  
  3042.  
  3043. ;show the hunks of a process
  3044. hunks        bsr     nodenam
  3045.         moveq.l #2,d7
  3046.         lea     TRuNode(PC),a3
  3047.         bsr     findnam
  3048.         tst.b   d7
  3049.         bne.s   hu1
  3050.         rts
  3051. hu1        move.l  d0,a5
  3052.         cmp.b   #13,8(a5)
  3053.         beq.s   hu2
  3054.         move.w  #noprocs,d0
  3055.         bra     putnamw
  3056. hu2        move.l  128(a5),d0
  3057.         beq.s   noprogload
  3058.         lsl.l   #2,d0
  3059.         move.l  d0,a3
  3060.         move.l  12(a3),d1
  3061.         beq.s   hu3
  3062.         cmp.l   #100,0(a3)
  3063.         ble.s   1$
  3064.         move.w  #unloaderr,d0
  3065.         bra.s   huxx
  3066. 1$        move.w  #segloaded,d0
  3067.         bsr     putnamw
  3068.         bra     hu5
  3069. hu3        move.l  172(a5),d1
  3070.         bne.s   hu4
  3071. noprogload  move.w  #notload,d0
  3072. huxx        bra     putnam
  3073. hu4        move.w  #cliprocs,d0
  3074.         bsr     putnamw
  3075.         lsl.l   #2,d1
  3076.         move.l  d1,a5
  3077.         move.l  60(a5),d1
  3078.         beq.s   noprogload
  3079.         move.w  #procloaded,d0
  3080.         bsr     putstrw
  3081.         move.l  16(a5),d0
  3082.         bsr     putbcpl
  3083.         bsr     newline
  3084. hu5        lea     hunkheader(a4),a0
  3085.         bsr     puthead
  3086.         moveq   #0,d5
  3087. hu6        move.l  d5,d3
  3088.         bsr     bytedec
  3089.         addq    #1,d5
  3090.         move.l  d1,d0
  3091.         bsr     hexa
  3092.         lsl.l   #2,d1
  3093.         move.l  d1,a5
  3094.         move.l  d1,d0
  3095.         addq.l  #4,d0
  3096.         bsr     hexa
  3097.         move.l  -4(a5),d0
  3098.         moveq   #1,d3
  3099.         bsr     longdec
  3100.         move.l  #'($',d0
  3101.         bsr     putlongascii
  3102.         move.l  -4(a5),d0
  3103.         bsr     hexa
  3104.         moveq   #')',d0
  3105.         bsr     putchar
  3106.         bsr     newline
  3107.         move.l  0(a5),d1
  3108.         bne.s   hu6
  3109.         rts
  3110.  
  3111. ;change the priority of a node
  3112. pri        bsr     getnum
  3113.         tst.b   d7
  3114.         beq     syntax
  3115.         move.b  d2,newpri(a4)
  3116.         bsr     nodenam2
  3117.         moveq.l #8,d7
  3118.         lea     TRuNode(PC),a3
  3119.         bsr     findnam
  3120.         tst.b   d7
  3121.         beq.s   pi1
  3122.         move.l  d0,a1
  3123.         cmp.b   #13,8(a1)
  3124.         beq.s   tp2
  3125.         cmp.b   #1,8(a1)
  3126.         beq.s   tp2
  3127.         move.b  newpri(a4),9(a1)
  3128.         cmp.l   #SemNode,a3
  3129.         ble.s   pi2
  3130.         move.w  #listerr,d0
  3131.         bra     putnamw
  3132. pi2        CALL    Forbid,SysBase(a4)
  3133.         RECALL  Remove
  3134.         move.l  d0,a1
  3135.         move.l  a3,a0
  3136.         move.l  0(a0),d6
  3137.         lea     0(a6,d6),a0
  3138.         RECALL  Enqueue
  3139.         RECALL  Permit
  3140. pi1        rts
  3141.  
  3142. ;modify a task's priority
  3143.  
  3144. taskpri     bsr     getnum
  3145.         tst.b   d7
  3146.         beq     syntax
  3147.         move.b  d2,newpri(a4)
  3148.         bsr     nodenam
  3149.         moveq.l #2,d7
  3150.         lea     TRuNode(PC),a3
  3151.         bsr     findnam
  3152.         tst.b   d7
  3153.         beq.s   tp1
  3154.         move.l  d0,a1
  3155. tp2        move.b  newpri(a4),d0
  3156. tp3        CALL    SetTaskPri,SysBase(a4)
  3157. tp1        rts
  3158.  
  3159. ;set the priority of our task
  3160.  
  3161. mypri        bsr     getnum
  3162.         tst.b   d7
  3163.         beq     syntax
  3164.         move.l  SysBase(a4),a1
  3165.         move.l  276(a1),a1
  3166.         move.l  d2,d0
  3167.         bra.s   tp3
  3168.  
  3169. ;set all break signals of a task
  3170. break        move.l  #$f000,d0
  3171.         bra     setthem
  3172.  
  3173. signal        bsr     readhex
  3174.         tst.b   d7
  3175.         beq     syntax
  3176. setthem     move.l  d0,savedat
  3177.         bsr     nodenam
  3178.         moveq.l #2,d7
  3179.         lea     TReNode(PC),a3
  3180.         bsr     findnam
  3181.         tst.b   d7
  3182.         beq.s   pi1
  3183.         move.l  d0,a1
  3184.         move.l  savedat,d0
  3185.         and.l   18(a1),d0
  3186.         CALL    Signal,SysBase(a4)
  3187.         rts
  3188.  
  3189. ;set up a list of tasknames which should't be displayed
  3190.  
  3191. hide        cmp.b   #10,0(a0)
  3192.         bne.s   hid5
  3193.         bra     syntax
  3194. hid5        lea     hidestart(a4),a2
  3195.         move.l  a2,d3
  3196. hid0        tst.l   0(a2)
  3197.         beq.s   hid1
  3198.         move.l  0(a2),a2
  3199.         lea     4(a2),a1
  3200.         bsr     strcmp
  3201.         tst     d0
  3202.         beq.s   hid2
  3203.         move.l  a2,d3
  3204.         bra.s   hid0
  3205. hid1        move.l  a0,a3
  3206.         bsr     strlen2
  3207.         addq    #5,d0
  3208.         move.l  #65536,d1
  3209.         CALL    AllocMem,SysBase(a4)
  3210.         tst.l   d0
  3211.         beq.s   hid4
  3212.         move.l  d0,a1
  3213.         move.l  d0,0(a2)
  3214.         addq    #4,a1
  3215. hid3        cmp.b   #10,0(a3)
  3216.         beq.s   hid4
  3217.         move.b  (a3)+,(a1)+
  3218.         bra.s   hid3
  3219. hid4        rts
  3220. hid2        move.l  d3,a3
  3221.         move.l  0(a2),0(a3)
  3222. freehidden  lea     4(a2),a0
  3223.         bsr     strlen
  3224.         addq    #5,d0
  3225.         move.l  a2,a1
  3226.         CALL    FreeMem,SysBase(a4)
  3227.         rts
  3228.  
  3229. freehidmem  move.l  hidestart(a4),a3
  3230. fhm0        move.l  a3,d0
  3231.         beq.s   fhm1
  3232.         move.l  a3,a2
  3233.         move.l  0(a2),a3
  3234.         bsr     freehidden
  3235.         bra     fhm0
  3236. fhm1        rts
  3237.  
  3238. ;set up an ALIAS list
  3239. alias        cmp.b   #10,0(a0)
  3240.         beq     showalias
  3241.         bsr     strbuf
  3242.         move.l  a0,a5
  3243.         lea     buffer,a0
  3244.         bsr     strlen
  3245.         tst.l   d0
  3246.         beq     syntax
  3247.  
  3248.         moveq   #1,d1
  3249.         cmp     d1,d0
  3250.         bne.s   5$
  3251.         lea     params(a4),a0
  3252.         moveq   #parmnum-1,d1
  3253.         move.b  buffer,d2
  3254. 6$        cmp.b   (a0)+,d2
  3255.         dbeq    d1,6$
  3256.         tst.w   d1
  3257.         bmi.s   5$
  3258.         move.w  #aliaserr,d0
  3259.         bsr     putstrw
  3260.         move.w  #params,d0
  3261.         bsr     putstrw
  3262.         move.w  #aliaserr2,d0
  3263.         bra     putnamw
  3264.  
  3265. 5$        move.l  d0,d5
  3266.         move.l  a5,a0
  3267.         adda.l  d0,a0
  3268.         bsr     kllblnks
  3269.         move.l  a5,-(a7)
  3270.         bsr     findcmd
  3271.         move.l  (a7)+,a5
  3272.         tst.l   d2
  3273.         bmi     syntax
  3274.         move.l  a5,a0
  3275.         bsr     strbuf
  3276.  
  3277.         addq    #6,d5
  3278.         move.l  d5,d0
  3279.         move.l  #65536,d1
  3280.         CALL    AllocMem,SysBase(a4)
  3281.         tst.l   d0
  3282.         beq.s   1$
  3283.  
  3284.         move.l  aliaslist(a4),d1
  3285.         bne.s   2$
  3286.         move.l  d0,aliaslist(a4)
  3287.         bra.s   3$
  3288. 2$        move.l  d1,a0
  3289.         move.l  0(a0),d1
  3290.         bne.s   2$
  3291.         move.l  d0,0(a0)
  3292.  
  3293. 3$        move.l  d0,a0
  3294.         move.b  d2,4(a0)
  3295.  
  3296.         lea     5(a0),a0
  3297.         lea     buffer,a1
  3298. 4$        move.b  (a1)+,(a0)+
  3299.         bne.s   4$
  3300. 1$        rts
  3301.  
  3302. showalias   lea     alhead(a4),a0
  3303.         bsr     puthead
  3304.         move.l  aliaslist(a4),d0
  3305.         beq.s   1$
  3306. 2$        move.l  d0,a5
  3307.         addq    #5,d0
  3308.         bsr     putstr
  3309.         move.w  #15,d1
  3310.         bsr     tab
  3311.         move.w  #equal,d0
  3312.         bsr     putstrw
  3313.         move.b  4(a5),d0
  3314.         ext.w   d0
  3315.         bsr     getcmdptr
  3316.         bsr     putnam
  3317.         move.l  0(a5),d0
  3318.         bne.s   2$
  3319. 1$        rts
  3320.  
  3321. freealias   move.l  aliaslist(a4),a3
  3322. 1$        move.l  a3,d0
  3323.         beq.s   2$
  3324.         move.l  a3,a2
  3325.         move.l  0(a2),a3
  3326.         lea     5(a2),a0
  3327.         bsr     strlen
  3328.         addq    #6,d0
  3329.         move.l  a2,a1
  3330.         CALL    FreeMem,SysBase(a4)
  3331.         bra     1$
  3332. 2$        rts
  3333.  
  3334. getcmdptr   move.l  a0,-(a7)
  3335.         lea     commds(a4),a0
  3336. 2$        tst     d0
  3337.         beq.s   1$
  3338. 3$        tst.b   (a0)+
  3339.         bne.s   3$
  3340.         subq    #1,d0
  3341.         bra.s   2$
  3342. 1$        move.l  a0,d0
  3343.         move.l  (a7)+,a0
  3344.         rts
  3345.  
  3346.  
  3347. ;'flushlibs'
  3348. flush        move.l  #$ffffff,d0
  3349.         moveq   #0,d1
  3350.         CALL    AllocMem,SysBase(a4)
  3351. flsh1        rts
  3352.  
  3353. ;display library->lib_IDString
  3354. info        bsr     nodenam2
  3355.         moveq.l #2,d7
  3356.         lea     DevNode(PC),a3
  3357.         bsr     findnam
  3358.         tst.b   d7
  3359.         beq.s   flsh1
  3360.         move.l  d0,a0
  3361.         move.l  24(a0),d0
  3362.         beq.s   if1
  3363.  
  3364.         move.l  #160,d1
  3365.         move.l  d0,a0
  3366. if3        tst.b   (a0)+
  3367.         dbeq.s  d1,if3
  3368.         beq.s   if2
  3369.  
  3370. if1        move.w  #noinfo,d0
  3371.         bsr     putstrw
  3372.         move.l  a5,d0
  3373. if2        bra     putnam
  3374.  
  3375. capture     move.l  SysBase(a4),a1
  3376.         lea     42(a1),a0
  3377.         moveq   #2,d6
  3378.         lea     coldtxt(a4),a3
  3379. cap0        move.l  a3,d0
  3380.         bsr     putstr
  3381.         move.l  0(a0),d0
  3382.         bne.s   cap1
  3383.         move.w  #unset,d0
  3384.         bsr     putstrw
  3385.         bra     cap2
  3386. cap1        bsr     hexa
  3387. cap2        bsr     newline
  3388.         lea     15(a3),a3
  3389.         addq    #4,a0
  3390.         dbf     d6,cap0
  3391.  
  3392.         move.w  #kicktxt,d0
  3393.         bsr     putstrw
  3394.         move.l  546(a1),a0
  3395.         cmpa.l  #0,a0
  3396.         bne.s   kickm3
  3397.         move.w  #unset,d0
  3398.         bra     putnamw
  3399. kickm3        move.l  a0,-(a7)
  3400.         bsr     newline
  3401.         lea     kickhead(a4),a0
  3402.         bsr     puthead
  3403.         move.l  (a7)+,a0
  3404. kickm0        move.l  a0,d0
  3405.         beq     kickm4
  3406.         bpl.s   kickm1
  3407.         bclr    #31,d0
  3408.         move.l  d0,a0
  3409.         bra.s   kickm0
  3410. kickm1        move.w  14(a0),d6
  3411.         subq    #1,d6
  3412.         lea     16(a0),a2
  3413. kickm2        move.l  0(a2),d0
  3414.         bsr     hexa
  3415.         move.l  0(a2),d0
  3416.         move.l  4(a2),d4
  3417.         add.l   d4,d0
  3418.         bsr     hexa
  3419.         move.l  d4,d0
  3420.         clr.b   d3
  3421.         bsr     longdec
  3422.         bsr     newline
  3423.         addq    #8,a2
  3424.         dbf     d6,kickm2
  3425.         move.l  0(a0),a0
  3426.         bra     kickm0
  3427. kickm4        rts
  3428.  
  3429. clrcold     move.l  SysBase(a4),a0
  3430.         clr.l   42(a0)
  3431.         bra.s   chksum
  3432. clrcool     move.l  SysBase(a4),a0
  3433.         clr.l   46(a0)
  3434.         bra.s   chksum
  3435. clrwarm     move.l  SysBase(a4),a0
  3436.         clr.l   50(a0)
  3437.  
  3438. chksum        lea     34(a0),a1
  3439.         move    #22,d0
  3440. addchk        add     (a1)+,d1
  3441.         dbf     d0,addchk
  3442.         not     d1
  3443.         move.w  d1,82(a0)
  3444.         rts
  3445.  
  3446. ;Save the command line to be repeated. If this line doesn't produce
  3447. ;any output, don't repeat it at all
  3448. repeatcmd   tst.w   repeat(a4)
  3449.         bne.s   2$
  3450.         move.w  repeatlen(a4),d0
  3451.         subq    #7,d0
  3452.         move.w  d0,repeatlen(a4)
  3453.         lea     repeatbuffer,a1
  3454.         lea     dummy,a2
  3455.         move.w  d0,d1
  3456.         ext.l   d1
  3457. 1$        move.b  0(a0),(a1)+
  3458.         move.b  (a0)+,(a2)+
  3459.         dbf     d1,1$
  3460.  
  3461.         clr.l   lastprinted(a4)
  3462.         clr.b   printed(a4)
  3463.         move.w  #1,repeat(a4)
  3464.         bsr     cli
  3465.         tst.b   printed(a4)
  3466.         beq.s   2$
  3467.         bsr     starttimer
  3468.         rts
  3469. 2$        clr.w   repeat(a4)
  3470.         rts
  3471.  
  3472. ;save the parameters from a 'window x y width height' call
  3473. setwindow   tst.b   fromfile(a4)
  3474.         bne.s   wiw1
  3475. wiw3        move.w  #wiwerr,d0
  3476.         bra     putnamw
  3477. wiw1        lea     window_l(a4),a3
  3478.         moveq   #3,d5
  3479. wiw0        bsr     getnum
  3480.         tst     d7
  3481.         beq.s   wiw2
  3482.         move.w  d2,0(a3)
  3483.         addq    #2,a3
  3484.         dbf     d5,wiw0
  3485. wiw2        rts
  3486.  
  3487. iconpos     bsr     getnum
  3488.         tst     d7
  3489.         beq.s   1$
  3490.         move.w  d2,icnwindow
  3491.         bsr     getnum
  3492.         tst     d7
  3493.         beq.s   1$
  3494.         move.w  d2,icnwindow+2
  3495. 1$        rts
  3496.  
  3497. ;display ExecBase->LastAlert
  3498. lastalert   movem.l $100,d1-d2
  3499.         tst.l   d1
  3500.         bne.s   al1
  3501.         move.l  SysBase(a4),a0
  3502.         movem.l 514(a0),d1-d2
  3503. al1        move.w  #gurutxt,d0
  3504.         bsr     putstrw
  3505.         move.l  d1,d0
  3506.         bsr     hexa
  3507.         subq.l  #1,ptr
  3508.         moveq   #'.',d0
  3509.         bsr     putchar
  3510.         move.l  d2,d0
  3511.         bsr     hexa
  3512.         bra     newline
  3513.  
  3514. ;test if 'on' or 'off' was entered
  3515. onoff        bsr     kllblnks
  3516.         lea     onstr(a4),a1
  3517.         bsr     strcmp
  3518.         tst     d0
  3519.         bne.s   1$
  3520.         bset.b  #0,0(a2)
  3521.         bra.s   3$
  3522. 1$        lea     offstr(a4),a1
  3523.         bsr     strcmp
  3524.         tst     d0
  3525.         bne.s   2$
  3526.         clr.b   0(a2)
  3527.         bra.s   3$
  3528. 2$        bchg.b  #0,0(a2)
  3529. 3$        rts
  3530.  
  3531. ;toggle TaskInfo
  3532. taskinfo    lea     tinfo(a4),a2
  3533.         bra.s   onoff
  3534.  
  3535. ;toggle CLI-Commands
  3536. clicmd        lea     cmdcli(a4),a2
  3537.         bra.s   onoff
  3538.  
  3539. ;toggle task-header display on/off
  3540. nohead        lea     headon(a4),a2
  3541.         bra.s   onoff
  3542.  
  3543. ;toggle hide entries on/off
  3544. hidden        lea     hideoff(a4),a2
  3545.         bra.s   onoff
  3546.  
  3547. ;toggle sort on/off
  3548. sort       lea        sorton(a4),a2
  3549.        bra.s    onoff
  3550.  
  3551. ;toggle task-ports display on/off
  3552. taskports   lea    tports(a4),a2
  3553.         bra.s   onoff
  3554.  
  3555. ;toggle CPUSE task list
  3556. usage        lea     usageflag(a4),a2
  3557.         bra.s   onoff
  3558.  
  3559. ;Open a library
  3560. openlib     bsr     nodenam2
  3561.         move.l  a5,a1
  3562.         moveq   #0,d0
  3563.         CALL    OpenLibrary,SysBase(a4)
  3564.         tst.l   d0
  3565.         beq     fn5
  3566. opli1        rts
  3567.  
  3568.  
  3569. ;close it
  3570. closelib    bsr     nodenam2
  3571.         moveq   #0,d7
  3572.         lea     LibNode(PC),a3
  3573.         bsr     findnam
  3574.         tst.b   d7
  3575.         beq.s   opli1
  3576.         move.l  d0,a1
  3577.         CALL    CloseLibrary,SysBase(a4)
  3578.         rts
  3579.  
  3580. remnode     bsr     nodenam2
  3581.         moveq   #7,d7
  3582.         lea     TReNode(PC),a3
  3583.         bsr     findnam
  3584.         tst.b   d7
  3585.         beq.s   1$
  3586.         CALL    Disable,SysBase(a4)
  3587.         move.l  d0,a1
  3588.         RECALL  Remove
  3589.         RECALL  Enable
  3590. 1$        rts
  3591.  
  3592. remport     bsr     nodenam2
  3593.         moveq   #0,d7
  3594.         lea     PorNode(PC),a3
  3595.         bsr     findnam
  3596.         tst.b   d7
  3597.         beq.s   1$
  3598.         move.l  d0,a1
  3599.         move.b  #2,14(a1)
  3600.         CALL    RemPort,SysBase(a4)
  3601. 1$        rts
  3602.  
  3603. remintserver
  3604.         move.l  a0,-(a7)
  3605.         bsr     readhex
  3606.         tst.b   d7
  3607.         beq     syntax
  3608.         move.l  d0,d4
  3609.         moveq   #1,d6
  3610.         bsr     findint
  3611.         move.l  (a7)+,a5
  3612.         tst     d5
  3613.         bpl.s   1$
  3614.         bra     fn5
  3615. 1$        tst.b   0(a3,d1)
  3616.         bne.s   2$
  3617.         move.w  #nintrserv,d0
  3618.         bra     putnamw
  3619. 2$        move.l  d4,a1
  3620.         move.w  d1,d0
  3621.         CALL    RemIntServer,SysBase(a4)
  3622.         rts
  3623.  
  3624. closeports  movem.l d1-d6/a0-a6,-(a7)
  3625.         move.l  d0,d6
  3626.         move.l  SysBase(a4),a3
  3627.         lea     392(a3),a3
  3628. 1$        move.l  0(a3),a3
  3629.         tst.l   0(a3)
  3630.         beq.s   2$
  3631.         cmp.l   16(a3),d6
  3632.         bne.s   1$
  3633.         move.b  #2,14(a1)
  3634.         move.l  a3,a1
  3635.         CALL    RemPort,SysBase(a4)
  3636.         bra.s   1$
  3637. 2$        movem.l (a7)+,d1-d6/a0-a6
  3638.         rts
  3639.  
  3640. ;end Xoper but stay in background
  3641. quithold    lea     in,a0
  3642.         lea     dummy,a1
  3643. qh1        move.b  (a1)+,d0
  3644.         move.b  d0,(a0)+
  3645.         cmp.b   #10,d0
  3646.         bne.s   qh1
  3647.  
  3648. instback    tst.b   background(a4)
  3649.         bne.s   cleanit
  3650.         move.b  #1,background(a4)
  3651.         bsr     installh
  3652. cleanit     move.l  infile(a4),d1
  3653.         beq.s   ib1
  3654.         CALL    Close,dosbase(a4)
  3655.         clr.l   infile(a4)
  3656.         clr.b   fromfile(a4)
  3657. ib1        clr.b   running(a4)
  3658.         bsr     killpage
  3659.         bsr     freeblank
  3660.         tst.l   wnptr(a4)
  3661.         beq.s   5$
  3662.         tst.b   ownscreen(a4)
  3663.         bne.s   6$
  3664.         move.l  wnptr(a4),a0
  3665.         tst.b   post_V34(a4)
  3666.         beq.s   7$
  3667.         move.l  minwsize(a4),d0
  3668.         cmp.w   10(a0),d0
  3669.         bgt.s   7$
  3670.         swap    d0
  3671.         cmp.w   8(a0),d0
  3672.         beq.s   6$
  3673. 7$        move.l  4(a0),window_l(a4)
  3674.         move.l  8(a0),window_w(a4)
  3675. 6$        move.l  wnptr(a4),a0
  3676.         CALL    CloseWindow,intuibase(a4)
  3677.         clr.l   intuimsg(a4)
  3678.         clr.l   wnptr(a4)
  3679. 5$        move.l  screenptr(a4),d0
  3680.         beq.s   4$
  3681.         move.l  d0,a0
  3682.         CALL    CloseScreen,intuibase(a4)
  3683.         clr.l   screenptr(a4)
  3684.  
  3685.         move.l  realstack(a4),a7
  3686.  
  3687. 4$        tst.b   iconifyon(a4)
  3688.         beq.s   1$
  3689.         jsr     iconify
  3690.         bra.s   2$
  3691.  
  3692. 1$        move.l  #(1<<mysignal),d0
  3693.         or.l    trapsignal(a4),d0
  3694.         CALL    Wait,SysBase(a4)
  3695. 2$        move.b  #1,running(a4)
  3696.         and.l   trapsignal(a4),d0
  3697.         beq.s   3$
  3698.         move.b  #1,gotguru(a4)
  3699. 3$        bra     restart
  3700.  
  3701. ;fill all unused memory-chunks with a longword
  3702. clear        moveq   #0,d0
  3703.         cmp.b   #10,0(a0)
  3704.         beq.s   clr5
  3705.         bsr     readhex
  3706.         tst.b   d7
  3707.         beq     syntax
  3708. clr5        move.l  SysBase(a4),a0
  3709.         clr.l   parmtxt(a4)
  3710.         lea     322(a0),a0
  3711.         move.w  #$4000,$dff09a
  3712. clr1        move.l  0(a0),a0
  3713.         tst.l   0(a0)
  3714.         beq.s   clr6
  3715.         move.l  16(a0),a1
  3716. clr2        tst.l   0(a1)
  3717.         beq.s   clr1
  3718.         addq.l  #1,parmtxt(a4)
  3719.         move.l  4(a1),d1
  3720.         subq.l  #8,d1
  3721.         ble.s   clr31
  3722.         lsr.l   #2,d1
  3723.         subq.l  #1,d1
  3724.         bmi.s   clr31
  3725.         lea     8(a1),a2
  3726. clr3        move.l  d0,(a2)+
  3727.         dbf     d1,clr3
  3728. clr31        move.l  0(a1),a1
  3729.         bra.s   clr2
  3730. clr6        move.w  #-$4000,$dff09a
  3731.         move.l  parmtxt(a4),d0
  3732.         bsr     longdec
  3733.         move.w  #clrtxt,d0
  3734.         bra     putnamw
  3735.  
  3736. ;change the number of maximum lines in the history buffer
  3737. historylines
  3738.         bsr     getnum
  3739.         tst.b   d7
  3740.         beq     syntax
  3741.         move.w  d2,maxhlines(a4)
  3742.         move.w  hnum(a4),d0
  3743. 1$        cmp.w   maxhlines(a4),d0
  3744.         ble.s   2$
  3745.         bsr     remhistline
  3746.         subq    #1,d0
  3747.         bra.s   1$
  3748. 2$        move.l  history+8(a4),curhist(a4)
  3749.         move.w  d0,hnum(a4)
  3750.         rts
  3751.  
  3752. ;set the minimum number of characters a input line
  3753. ;must have to be added to the history buffer
  3754. historylength
  3755.         bsr     getnum
  3756.         tst.b   d7
  3757.         beq     syntax
  3758.         tst.b   d2
  3759.         bne.s   1$
  3760.         addq    #1,d2
  3761. 1$        move.w  d2,minnumchars(a4)
  3762.         rts
  3763. ;display all lines in the history buffer
  3764. showhistory move.l  history(a4),a5
  3765.         moveq   #1,d5
  3766. 1$        tst.l   0(a5)
  3767.         beq.s   2$
  3768.         move.l  d5,d3
  3769.         bsr     bytedec
  3770.         move.w  8(a5),d0
  3771.         ext.l   d0
  3772.         lea     10(a5),a0
  3773.         lea     inputbuffer,a1
  3774.         CALL    CopyMem,SysBase(a4)
  3775.         move.w  8(a5),d0
  3776.         lea     inputbuffer,a1
  3777.         clr.b   0(a1,d0.w)
  3778.         move.l  a1,d0
  3779.         bsr     putnam
  3780.         addq    #1,d5
  3781.         move.l  0(a5),a5
  3782.         bra.s   1$
  3783. 2$        rts
  3784.  
  3785. ;set the maximum lines the output buffer may hold
  3786. outputlines bsr     getnum
  3787.         tst.b   d7
  3788.         beq     syntax
  3789.         moveq   #100,d3
  3790.         tst.l   d2
  3791.         bmi.s   2$
  3792.         cmp.l   d3,d2
  3793.         bge.s   1$
  3794. 2$        move.l  d3,d2
  3795. 1$        move.l  d2,maxlines(a4)
  3796.         rts
  3797.  
  3798. ;find a named node
  3799. ;d7 = number of lists to search through
  3800. ;a3 = pointer to the first entry in the
  3801. ;     list-offset-table
  3802. ;a5 = pointer to name
  3803. ;returns:
  3804. ;d7 = TRUE/FALSE 1/0
  3805. ;d0 = node
  3806.  
  3807. findnam     tst.b   0(a5)
  3808.         bne.s   1$
  3809.         move.w  #nameerr,d0
  3810.         bsr     putnamw
  3811.         bra     fnerr
  3812. 1$        cmp.b   #'$',0(a5)
  3813.         bne.s   fn2
  3814.         move.l  d7,d2
  3815.         move.l  a5,a0
  3816.         bsr     readhex
  3817.         tst.b   d7
  3818.         beq.s   fn6
  3819.         move.l  d2,d7
  3820.         bsr     tstnode
  3821.         tst.l   d5
  3822.         bne.s   fn3
  3823.         bra     fn5
  3824. fn6        move.l  d2,d7
  3825. fn2        move.l  SysBase(a4),a0
  3826.         adda.l  0(a3),a0
  3827.         move.l  a5,a1
  3828. fn4        CALL    FindName,SysBase(a4)
  3829.         tst.l   d0
  3830.         bne.s   fn1
  3831.         addq    #4,a3
  3832.         dbf     d7,fn2
  3833. fn5        move.w  #namerr,d0
  3834.         bsr     putstrw
  3835.         move.l  a5,d0
  3836.         bsr     putnam
  3837. fnerr        clr.b   d7
  3838.         rts
  3839. fn1        move.b  procnum(a4),d2
  3840.         beq.s   fn3
  3841.         move.l  d0,a0
  3842.         cmp.b   143(a0),d2
  3843.         bne.s   fn4
  3844. fn3        moveq.l #1,d7
  3845.         rts
  3846.  
  3847. ;list-offset-table
  3848. TRuNode     dc.l    276
  3849. TReNode     dc.l    406
  3850. TWaNode     dc.l    420
  3851. DevNode     dc.l    350
  3852. LibNode     dc.l    378
  3853. ResNode     dc.l    336
  3854. MemNode     dc.l    322
  3855. PorNode     dc.l    392
  3856. SemNode     dc.l    532
  3857.  
  3858. ;Node has been entered in hex. Check if this node exsists
  3859. tstnode     tst.b   fromfile(a4)
  3860.         bne.s   illegalhex
  3861.         move.l  d0,d1
  3862.         btst    #0,d1
  3863.         beq.s   inrange
  3864.         move.w  #adrerr,d0
  3865.         bsr     putnamw
  3866. illegalhex  moveq   #0,d5
  3867.         rts
  3868. inrange     movem.l d7/a3,-(a7)
  3869.         cmp.l   #TRuNode,a3
  3870.         bne.s   inrange1
  3871.         move.l  SysBase(a4),a0
  3872.         cmp.l   276(a0),d0
  3873.         beq.s   nodefound
  3874.         subq    #1,d7
  3875.         addq    #4,a3
  3876. inrange1    move.w  #$4000,$dff09a
  3877. getlist     move.l  SysBase(a4),a0
  3878.         add.l   0(a3),a0
  3879. nxtnode     tst.l   0(a0)
  3880.         beq.s   nxtlist
  3881.         cmp.l   a0,d0
  3882.         beq.s   nodefound
  3883.         move.l  0(a0),a0
  3884.         bra.s   nxtnode
  3885. nxtlist     addq    #4,a3
  3886.         dbf     d7,getlist
  3887.         move.w  #-$4000,$dff09a
  3888.         movem.l d0/d7/a3,-(a7)
  3889.         bsr     ResumeOutput
  3890.         move.w  #noderr,d0
  3891.         bsr     putnamw
  3892.         bsr     readline
  3893.         movem.l (a7)+,d0/d7/a3
  3894.         cmp.b   #'y',inputbuffer
  3895.         beq.s   nodefound1
  3896.         moveq   #0,d5
  3897.         movem.l (a7)+,d7/a3
  3898.         rts
  3899. nodefound   move.w  #-$4000,$dff09a
  3900. nodefound1  move.b  #1,d5
  3901. etst        movem.l (a7)+,d7/a0
  3902.         rts
  3903.  
  3904. ;allocate FileInfoBlock
  3905. allocfinfo  addq.b  #1,finfopen(a4)
  3906.         bne.s   1$
  3907.         move.l  #260,d0
  3908.         moveq   #0,d1
  3909.         CALL    AllocMem,SysBase(a4)
  3910.         move.l  d0,finfoptr(a4)
  3911. 1$        rts
  3912.  
  3913. ;free FileInfoBlock
  3914. freefinfo   subq.b  #1,finfopen(a4)
  3915.         bpl.s   1$
  3916.         move.l  #260,d0
  3917.         move.l  finfoptr(a4),d1
  3918.         beq.s   1$
  3919.         move.l  d1,a1
  3920.         CALL    FreeMem,SysBase(a4)
  3921.         clr.l   finfoptr(a4)
  3922. 1$        rts
  3923.  
  3924. ;Examine ,d0=Lock
  3925. getfinfo    move.l  d0,d1
  3926.         move.l  finfoptr(a4),d2
  3927.         CALL    Examine,dosbase(a4)
  3928.         rts
  3929.  
  3930. ;construct a Pathname from a lock
  3931. ;d0=Lock ,resulting string is written to window
  3932. getpath     movem.l d1-d7/a0-a6,-(a7)
  3933.         move.l  d0,d1
  3934.         beq.s   1$
  3935.         CALL    DupLock,dosbase(a4)
  3936. 1$        lea     out,a3
  3937.         clr.b   -(a3)
  3938. gp0        move.l  d0,-(a7)
  3939.         bsr     getfinfo
  3940.         move.l  finfoptr(a4),a0
  3941.         move.l  4(a0),d4
  3942.         addq    #8,a0
  3943.         bsr     strlen
  3944.         lea     -1(a3),a5
  3945.         tst.l   d4
  3946.         bmi.s   nodir
  3947.         move.b  #'/',-(a3)
  3948. nodir        subq    #1,d0
  3949.         bmi.s   nofnam
  3950. gp1        move.b  0(a0,d0),-(a3)
  3951.         dbf     d0,gp1
  3952. nofnam        move.l  0(a7),d1
  3953.         CALL    ParentDir,dosbase(a4)
  3954.         move.l  d0,d4
  3955.         move.l  (a7)+,d1
  3956.         beq.s   2$
  3957.         CALL    UnLock,dosbase(a4)
  3958. 2$        move.l  d4,d0
  3959.         bne.s   gp0
  3960.         cmp.b   #'/',0(a5)
  3961.         bne.s   gp2
  3962.         move.b  #':',0(a5)
  3963. gp2        move.l  a3,d0
  3964.         bsr     putnam
  3965.         movem.l (a7)+,d1-d7/a0-a6
  3966.         rts
  3967.  
  3968. strlen        move.l  a0,-(a7)
  3969.         moveq   #-1,d0
  3970. strl2        addq.l  #1,d0
  3971.         tst.b   (a0)+
  3972.         bne.s   strl2
  3973.         move.l  (a7)+,a0
  3974.         rts
  3975. strlen2     move.l  a0,-(a7)
  3976.         move.l  #-1,d0
  3977. strl22        addq.l  #1,d0
  3978.         cmp.b   #10,(a0)+
  3979.         bne.s   strl22
  3980.         move.l  (a7)+,a0
  3981.         rts
  3982.  
  3983. ;write a title and underline
  3984. ;a0 = pointer to text
  3985. puthead1    bsr     strlen
  3986.         move.l  d0,d5
  3987.         move.l  a0,d0
  3988.         bra     putstr
  3989.  
  3990. puthead2    bsr     strlen
  3991.         add.l   d0,d5
  3992.         bra.s   ph2
  3993.  
  3994. puthead     bsr     strlen
  3995.         move.l  d0,d5
  3996. ph2        move.l  a0,d0
  3997.         bsr     putnam
  3998.         lea     out,a0
  3999.         move.l  a0,d0
  4000. ph1        move.b  #'-',(a0)+
  4001.         dbf     d5,ph1
  4002.         move.b  #$0a,(a0)+
  4003.         clr.b   0(a0)
  4004.         bra     putstr
  4005.  
  4006. ;move cursor to a column
  4007. ;d0 = current position
  4008. ;d1 = column
  4009. tab        move.l  a3,-(a7)
  4010.         lea     out,a3
  4011. sp5        cmp.b   d1,d0
  4012.         bcc.s   sp4
  4013.         move.b  #' ',0(a3,d0)
  4014.         addq.b  #1,d0
  4015.         bra.s   sp5
  4016. sp4        move.l  d1,ptr(a4)
  4017.         move.l  (a7)+,a3
  4018.         rts
  4019.  
  4020. ;convert ascii to byte
  4021. ;a0 = pointer to text
  4022. ;d0 = byte
  4023. getnum        cmp.b   #'$',0(a0)
  4024.         bne.s   isdec
  4025.         bsr     readhex
  4026.         move.l  d0,d2
  4027.         rts
  4028. isdec        moveq   #0,d2
  4029.         move.l  d2,d3
  4030.         move.l  d2,d6
  4031.         move.l  d2,d7
  4032.         cmp.b   #'-',0(a0)
  4033.         bne.s   gn1
  4034.         addq    #1,a0
  4035.         moveq.l #1,d6
  4036. gn1        move.b  (a0)+,d3
  4037.         cmp.b   #'9',d3
  4038.         bhi.s   gn2
  4039.         cmp.b   #'0',d3
  4040.         bcs.s   gn2
  4041.         moveq   #1,d7
  4042.         and.b   #$f,d3
  4043.         muls    #10,d2
  4044.         add.l   d3,d2
  4045.         bra.s   gn1
  4046. gn2        tst.b   d6
  4047.         beq.s   gn3
  4048.         neg.l   d2
  4049. gn3        tst.b   d7
  4050.         bne.s   gn4
  4051.         subq    #1,a0
  4052. gn4        rts
  4053.  
  4054. getfrac     cmp.b   #'.',0(a0)
  4055.         bne.s   2$
  4056.         lea     1(a0),a0
  4057.         bra.s   3$
  4058. 2$        bsr     isdec
  4059.         muls    #10,d2
  4060.         cmp.b   #'.',-1(a0)
  4061.         bne.s   1$
  4062. 3$        moveq   #0,d0
  4063.         move.b  (a0)+,d1
  4064.         cmp.b   #10,d1
  4065.         beq.s   1$
  4066.         and.b   #15,d1
  4067.         add.l   d1,d2
  4068. 1$        rts
  4069.  
  4070. ;convert hex to longword
  4071. ;a0 = pointer to text
  4072. ;returns d0=value
  4073. ;d7 = ok/error 1/0
  4074. readhex     movem.l d1-d6/a1-a5,-(a7)
  4075.         moveq   #1,d7
  4076.         cmp.b   #'$',0(a0)
  4077.         bne.s   rh3
  4078.         addq    #1,a0
  4079. rh3        moveq   #0,d0
  4080.         cmpi.b  #10,0(a0)
  4081.         beq.s   rherr
  4082.         lea     hextab(a4),a1
  4083. rh0        move.b  (a0)+,d3
  4084.         moveq.l #15,d2
  4085. rh1        cmp.b   0(a1,d2),d3
  4086.         beq.s   rh2
  4087.         dbf     d2,rh1
  4088.         bra     rhend
  4089. rh2        lsl.l   #4,d0
  4090.         or.b    d2,d0
  4091.         bra.s   rh0
  4092. rhend        tst.b   d3
  4093.         beq.s   rhok
  4094.         cmpi.b  #10,d3
  4095.         beq.s   rhok
  4096.         cmpi.b  #' ',d3
  4097.         beq.s   rhok
  4098. rherr        moveq   #0,d7
  4099. rhok        movem.l (a7)+,d1-d6/a1-a5
  4100.         rts
  4101.  
  4102. ;skip blanks
  4103. ;a0 pointer to text
  4104. ; returns a0 = new pointer position
  4105. kllblnks    cmpi.b  #' ',0(a0)
  4106.         bne.s   gn4
  4107.         addq    #1,a0
  4108.         bra.s   kllblnks
  4109.  
  4110. ; exit program. If background flag is set, wait for
  4111. ; amiga-amiga-x
  4112.  
  4113. stopall     addq    #4,a7
  4114.         bra     exitall
  4115.  
  4116. exit        tst.b   background(a4)
  4117.         bne     quithold
  4118. exitall     bsr     killpage
  4119.         bsr     freeblank
  4120.         bsr     killhistory
  4121.         move.l  stplist(a4),a3
  4122.         tst.l   0(a3)
  4123.         beq.s   ex0
  4124.         move.l  a3,d0
  4125.         bsr     waok
  4126.         bra.s   exitall
  4127.  
  4128. ex0        tst.b   background(a4)
  4129.         beq.s   ex1
  4130.         bsr     removeh
  4131.  
  4132. ex1        move.l  SysBase(a4),a1
  4133.         move.l  #_LVOSwitch,a0
  4134.         move.l  oldswitch,d0
  4135.         CALL    SetFunction,a1
  4136.         moveq   #3,d0
  4137.         lea     IOCounter(a4),a1
  4138.         RECALL  RemIntServer
  4139.  
  4140.         move.l  replyport(a4),-(a7)
  4141.         LIBCALL DeletePort
  4142.         addq    #4,a7
  4143.         bsr     stoptimer
  4144.         lea     timerio,a1
  4145.         CALL    CloseDevice,SysBase(a4)
  4146.         move.l  timerport(a4),-(a7)
  4147.         LIBCALL DeletePort
  4148.         addq    #4,a7
  4149.  
  4150.         tst.b   post_V34(a4)
  4151.         bne.s   1$
  4152.         lea     sampleio(a4),a1
  4153.         CALL    AbortIO,SysBase(a4)
  4154.         lea     sampleio(a4),a1
  4155.         move.l  14(a1),d7
  4156.         CALL    CloseDevice,SysBase(a4)
  4157.         move.l  d7,-(a7)
  4158.         LIBCALL DeletePort
  4159.         addq    #4,a7
  4160.  
  4161. 1$        move.l  idletask(a4),a1
  4162.         CALL    RemTask,SysBase(a4)
  4163.  
  4164.         move.l  #_LVOAddTask,a0
  4165.         move.l  OldAddTask(PC),d0
  4166.         move.l  SysBase(a4),a1
  4167.         CALL    SetFunction,SysBase(a4)
  4168.         bsr     restoretrap
  4169.  
  4170.         tst.l   wnptr(a4)
  4171.         beq.s   5$
  4172.         move.l  wnptr(a4),a0
  4173.         CALL    CloseWindow,intuibase(a4)
  4174. 5$        move.l  screenptr(a4),d0
  4175.         beq.s   6$
  4176.         move.l  d0,a0
  4177.         CALL    CloseScreen,intuibase(a4)
  4178.         clr.l   screenptr(a4)
  4179.  
  4180. 6$        move.l  infile(a4),d1
  4181.         beq.s   ex11
  4182.         CALL    Close,dosbase(a4)
  4183. ex11        bsr     freehidmem
  4184.         bsr     freealias
  4185.         bsr     clrfkeys
  4186.         move.l  realstack(a4),a7
  4187.     IFND DEBUG
  4188.         CALL    Forbid,SysBase(a4)
  4189.         move.l  wbmsg(a4),d0
  4190.         beq.s   todos
  4191.         move.l  d0,a1
  4192.         RECALL  ReplyMsg
  4193.         moveq   #0,d0
  4194.         rts
  4195.  
  4196. todos        move.l  mytask(a4),a0
  4197.         move.l  152(a0),d1
  4198.         CALL    UnLock,dosbase(a4)
  4199.         move.l  myseg(a4),d1
  4200.         CALL    UnLoadSeg,dosbase(a4)
  4201.     ENDC
  4202.         moveq   #0,d0
  4203.         rts
  4204.  
  4205. ;print a bcpl-string
  4206. ;d0 = bcpl-pointer to bcpl-string
  4207. putbcpl     movem.l d3/a0-a1,-(a7)
  4208.         tst.l   d0
  4209.         beq.s   1$
  4210.         lsl.l   #2,d0
  4211.         move.l  d0,a1
  4212.         moveq   #0,d3
  4213.         move.b  (a1)+,d3
  4214.         subq    #1,d3
  4215.         bmi.s   1$
  4216. 2$        move.b  (a1)+,d0
  4217.         beq.s   1$
  4218.         bsr     putchar
  4219.         dbf     d3,2$
  4220. 1$        move.l  ptr(a4),d0
  4221.         movem.l (a7)+,d3/a0-a1
  4222.         rts
  4223.  
  4224. ;compare strings
  4225. ;a0/a1 = pointers to string
  4226. ;returns d0 = true(0) false(1), d1 = length
  4227. strcmp        movem.l a0-a1,-(a7)
  4228.         moveq   #0,d0
  4229.         move.l  d0,d1
  4230. src2        move.b  (a0)+,d0
  4231.         beq.s   src1
  4232.         cmp.b   #10,d0
  4233.         beq.s   src1
  4234.         addq    #1,d1
  4235.         cmp.b   (a1)+,d0
  4236.         beq.s   src2
  4237.         bra.s   src3
  4238. src1        move.b  0(a1),d0
  4239. src3        movem.l (a7)+,a0-a1
  4240.         rts
  4241.  
  4242. strbuf        movem.l d0/a1-a2,-(a7)
  4243.         move.l  a0,a1
  4244.         lea     buffer,a2
  4245. 1$        move.b  (a1)+,d0
  4246.         cmp.b   #10,d0
  4247.         beq.s   2$
  4248.         cmp.b   #' ',d0
  4249.         beq.s   2$
  4250.         or.b    #' ',d0
  4251.         beq.s   2$
  4252.         move.b  d0,(a2)+
  4253.         bra.s   1$
  4254. 2$        clr.b   (a2)+
  4255.         movem.l (a7)+,d0/a1-a2
  4256.         rts
  4257.  
  4258. tolower     movem.l d0-d1/a0,-(a7)
  4259.         subq    #1,d0
  4260.         bmi.s   3$
  4261. 1$        move.b  0(a0),d1
  4262.         cmp.b   #'A',d1
  4263.         blt.s   2$
  4264.         cmp.b   #'Z',d1
  4265.         bgt.s   2$
  4266.         or.b    #' ',d1
  4267. 2$        move.b  d1,(a0)+
  4268.         dbf     d0,1$
  4269. 3$        movem.l (a7)+,d0-d1/a0
  4270.         rts
  4271.  
  4272. ;compare bcpl string with string
  4273. ;a0 = pointer to string
  4274. ;a2 = bcpl-pointer to bcpl-string
  4275. ;returns d0 = true(0) false(1)
  4276. strbcmp     movem.l d1/a0/a2,-(a7)
  4277.         moveq   #0,d0
  4278.         moveq   #0,d1
  4279.         adda.l  a2,a2
  4280.         adda.l  a2,a2
  4281.         move.b  (a2)+,d1
  4282.         beq.s   stb1
  4283.         subq    #1,d1
  4284. stb2        cmp.b   (a2)+,(a0)+
  4285.         bne.s   stb1
  4286.         dbf     d1,stb2
  4287.         moveq   #1,d0
  4288. stb1        movem.l (a7)+,d1/a0/a2
  4289.         rts
  4290.  
  4291.  
  4292. ;add a fkey definition to the fkey list. Each entry
  4293. ;looks like this: long Succ, long Pred, byte Key#, byte length,
  4294. ;          char text[]
  4295.  
  4296. showfkeys   lea     fkhead(a4),a0
  4297.         bsr     puthead
  4298.         lea     fkeys(a4),a1
  4299. 1$        move.l  0(a1),a1
  4300.         tst.l   0(a1)
  4301.         beq.s   2$
  4302.         moveq   #'F',d0
  4303.         bsr     putchar
  4304.         move.b  8(a1),d3
  4305.         bsr     bytedec
  4306.         move.b  9(a1),d1
  4307.         subq    #1,d1
  4308.         lea     10(a1),a2
  4309. 3$        move.b  (a2)+,d0
  4310.         bsr     putchar
  4311.         dbf     d1,3$
  4312.         bsr     newline
  4313.         bra.s   1$
  4314. 2$        rts
  4315.  
  4316. setfkey     bsr     nodenam
  4317.         move.b  procnum(a4),d5
  4318.         beq.s   showfkeys
  4319.         cmp.b   #21,d5
  4320.         bge     syntax
  4321.         subq    #1,d5
  4322.         move.b  d5,procnum(a4)
  4323.         lea     fkeys(a4),a1
  4324. 1$        move.l  0(a1),a1
  4325.         tst.l   0(a1)
  4326.         beq.s   2$
  4327.         cmp.b   8(a1),d5
  4328.         bne.s   1$
  4329.         move.l  a1,d3
  4330.         CALL    Remove,SysBase(a4)
  4331.         move.l  d3,a1
  4332.         bsr     removefkey
  4333. 2$        tst.b   0(a5)
  4334.         beq.s   4$
  4335.         move.l  a5,a0
  4336.         bsr     strlen
  4337.         move.l  d0,d5
  4338.         add.w   #10,d0
  4339.         moveq   #0,d1
  4340.         CALL    AllocMem,SysBase(a4)
  4341.         tst.l   d0
  4342.         beq.s   4$
  4343.         move.l  d0,a1
  4344.         move.l  d0,a3
  4345.         move.b  procnum(a4),8(a1)
  4346.         move.b  d5,9(a1)
  4347.         lea     fkeys(a4),a0
  4348.         CALL    AddHead,SysBase(a4)
  4349.         lea     10(a3),a3
  4350.         subq    #1,d5
  4351. 3$        move.b  (a5)+,(a3)+
  4352.         dbeq    d5,3$
  4353. 4$        rts
  4354.  
  4355. clrfkeys    lea     fkeys(a4),a0
  4356.         CALL    RemHead,SysBase(a4)
  4357.         tst.l   d0
  4358.         beq.s   1$
  4359.         move.l  d0,a1
  4360.         bsr     removefkey
  4361.         bra.s   clrfkeys
  4362. 1$        rts
  4363.  
  4364. removefkey  move.b  0(a1),d0
  4365.         ext.w   d0
  4366.         ext.l   d0
  4367.         add.w   #10,d0
  4368.         CALL    FreeMem,SysBase(a4)
  4369.         rts
  4370.  
  4371. ;convert long to decimal
  4372. ;d0 = value
  4373. ;d3 bit 0 = left/right justified
  4374. ;d3 bit 1 = write/leave
  4375. ;returns string in 'buffer'
  4376. longdec     movem.l d1-d2/a1-a2,-(a7)
  4377.         tst.l   d0
  4378.         bmi.s   2$
  4379.         cmp.l   #9999999,d0
  4380.         ble.s   1$
  4381. 2$        move.w  #smallnix,d0
  4382.         bra.s   ld6
  4383. 1$        lea     binarea+8(a4),a1
  4384.         move.l  #'    ',-8(a1)
  4385.         move.l  #'    ',-4(a1)
  4386.         clr.b   0(a1)
  4387.         subq    #1,a1
  4388.         cmp     #2,d3
  4389.         bne.s   ld5
  4390.         clr.b   0(a1)
  4391. ld5        moveq   #1,d2
  4392. ld2        addq    #1,d2
  4393.         moveq   #$a,d1
  4394.         bsr     div
  4395.         addi.l  #$30,d1
  4396.         move.b  d1,-(a1)
  4397.         tst.l   d0
  4398.         bne.s   ld2
  4399.  
  4400.         btst    #0,d3
  4401.         bne.s   ld1
  4402.         lea     binarea(a4),a2
  4403.         cmpa.l  a2,a1
  4404.         bne.s   ld3
  4405.         subq.l  #1,ptr(a4)
  4406.         bra.s   ld1
  4407. ld3        move.b  0(a1),(a2)+
  4408.         move.b  #' ',(a1)+
  4409.         dbf     d2,ld3
  4410. ld1        btst    #1,d3
  4411.         bne.s   ld4
  4412.         move.w  #binarea,d0
  4413. ld6        bsr     putstrw
  4414. ld4        movem.l (a7)+,d1-d2/a1-a2
  4415.         rts
  4416.  
  4417. ;write UBYTE
  4418. ;d3 = value
  4419. bytedec     bsr     dec
  4420.         move.w  #decimal,d0
  4421.         bra.s   pm1
  4422.  
  4423. ;write signed byte
  4424. ;d3 = value
  4425. plusmins    movem.l d5/a3,-(a7)
  4426.         move.w  #$2020,minus(a4)
  4427.         move.b  d3,d5
  4428.         bpl.s   2$
  4429.         neg.b   d3
  4430. 2$        bsr.s   dec
  4431.         tst.b   d5
  4432.         bpl.s   1$
  4433.         move.l  d0,a3
  4434.         move.b  #'-',-(a3)
  4435. 1$        movem.l (a7)+,d5/a3
  4436.         move.w  #minus+1,d0
  4437. pm1        bra     putstrw
  4438.  
  4439. dec        movem.l d3/a3,-(a7)
  4440.         move.l  #$20202020,decimal(a4)
  4441.         and.l   #$ff,d3
  4442.         lea     decimal+3(a4),a3
  4443. bloop        tst.b   d3
  4444.         beq.s   bend
  4445.         divu    #10,d3
  4446.         swap    d3
  4447.         ori.b   #'0',d3
  4448.         move.b  d3,-(a3)
  4449.         clr.w   d3
  4450.         swap    d3
  4451.         bra.s   bloop
  4452. bend        cmpa.l  #decimal+3+dataarea,a3
  4453.         bne     1$
  4454.         move.b  #'0',-(a3)
  4455. 1$        move.l  a3,d0
  4456.         movem.l (a7)+,d3/a3
  4457.         rts
  4458.  
  4459. ;write a string, move cursor into next line
  4460. ;d0 = pointer to text
  4461. putnamw     bsr     putstrw
  4462.         bra.s   putnam1
  4463. putnam        bsr     putstr
  4464. putnam1     tst.b   d0
  4465.         beq.s   ncr
  4466.         bsr     newline
  4467. ncr        rts
  4468.  
  4469. putblank    moveq   #' ',d0
  4470.  
  4471. ;write one char
  4472. ;d0 = char
  4473. putchar     movem.l d1/a0,-(a7)
  4474.         move.l  ptr(a4),d1
  4475.         lea     out,a0
  4476.         move.b  d0,0(a0,d1)
  4477.         addq.l  #1,ptr(a4)
  4478.         movem.l (a7)+,d1/a0
  4479.         rts
  4480.  
  4481. ;write a string, strings are only put into the output buffer when
  4482. ;a LF is detected
  4483. ;d0 = pointer to string
  4484. ;returns d0 = cursor position
  4485. putstrw     and.l   #$0000ffff,d0
  4486.         add.l   #dataarea,d0
  4487. putstr        movem.l d1-d7/a0-a6,-(a7)
  4488.         move.b  #1,printed(a4)
  4489.         move.l  d0,a2
  4490.         lea     out,a3
  4491.         move.l  ptr(a4),d0
  4492.         move.l  a2,d5
  4493.         bne     pst1
  4494.         lea     longnix(a4),a2
  4495.  
  4496. pst1        move.b  (a2)+,d1
  4497.         cmpi.b  #13,d1
  4498.         beq     pst1
  4499.         cmpi.b  #10,d1
  4500.         beq.s   lineend
  4501.         move.b  d1,0(a3,d0)
  4502.         beq     prend
  4503.         cmp     #100,d0
  4504.         bge.s   pst1
  4505.         addq    #1,d0
  4506.         bra.s   pst1
  4507.  
  4508. lineend     tst.b   fromfile(a4)
  4509.         beq.s   1$
  4510.         moveq   #0,d0
  4511.         bra     prend
  4512.  
  4513. 1$        tst.l   lastprinted(a4)
  4514.         bne.s   2$
  4515.         bsr     killpage
  4516.  
  4517. 2$        addq    #1,d0
  4518.         move.l  d0,-(a7)
  4519.         add     #14,d0
  4520.         moveq   #0,d1
  4521.         CALL    AllocMem,SysBase(a4)
  4522.         move.l  (a7)+,d1
  4523.         tst.l   d0
  4524.         beq     prend
  4525.         move.l  d0,a0
  4526.         move.w  d1,12(a0)
  4527.         cmp.w   maxllength(a4),d1
  4528.         ble.s   7$
  4529.         move.w  d1,maxllength(a4)
  4530. 7$        move.l  node(a4),8(a0)
  4531.         clr.l   node(a4)
  4532.         clr.l   0(a0)
  4533.  
  4534.         move.l  lastprinted(a4),d0
  4535.         move.l  d0,4(a0)
  4536.         bne.s   3$
  4537.         move.l  a0,outchain(a4)
  4538.         bra.s   4$
  4539. 3$        move.l  d0,a1
  4540.         move.l  a0,0(a1)
  4541. 4$        move.l  a0,lastprinted(a4)
  4542.         move.b  #' ',14(a0)
  4543.         subq    #1,d1
  4544.         lea     15(a0),a0
  4545.         lea     out,a1
  4546.         subq    #1,d1
  4547.         bmi.s   6$
  4548. 5$        move.b  (a1)+,(a0)+
  4549.         dbf     d1,5$
  4550. 6$        move.l  numlines(a4),d2
  4551.         cmp.l   maxlines(a4),d2
  4552.         ble.s   8$
  4553.  
  4554.         move.l  outchain(a4),a1
  4555.         move.l  0(a1),a2
  4556.         move.l  a2,outchain(a4)
  4557.         clr.l   4(a2)
  4558.         move.w  12(a1),d0
  4559.         add.w   #14,d0
  4560.         ext.l   d0
  4561.         CALL    FreeMem,SysBase(a4)
  4562.         bra.s   9$
  4563.  
  4564. 8$        addq.l  #1,d2
  4565.         move.l  d2,numlines(a4)
  4566.  
  4567. 9$        moveq   #0,d0
  4568.         move.l  d0,d5
  4569.         tst.b   addlines(a4)
  4570.         beq     pst1
  4571.         bsr     addline
  4572.         bra     pst1
  4573. prend        move.l  d0,ptr(a4)
  4574.         movem.l (a7)+,d1-d7/a0-a6
  4575.         rts
  4576.  
  4577. ;Kill output buffer
  4578. killpage    movem.l d0-d7/a0-a6,-(a7)
  4579.         tst.l   outchain(a4)
  4580.         beq.s   2$
  4581.         move.l  outchain(a4),a1
  4582.         bsr     killlines
  4583.         clr.l   outchain(a4)
  4584.         clr.l   lastprinted(a4)
  4585.         clr.l   numlines(a4)
  4586.         clr.w   maxllength(a4)
  4587. 2$        movem.l (a7)+,d0-d7/a0-a6
  4588.         rts
  4589.  
  4590. ;kill the remainder of the output buffer
  4591. killlines   move.l  0(a1),-(a7)
  4592.         move.w  12(a1),d0
  4593.         ext.l   d0
  4594.         add     #14,d0
  4595.         CALL    FreeMem,SysBase(a4)
  4596.         move.l  (a7)+,a1
  4597.         move.l  a1,d7
  4598.         bne.s   killlines
  4599.         rts
  4600.  
  4601. freeblank   move.l  blanks(a4),d0
  4602.         beq.s   1$
  4603.         move.l  d0,a1
  4604.         move.w  colms(a4),d0
  4605.         ext.l   d0
  4606.         CALL    FreeMem,SysBase(a4)
  4607.         clr.l   blanks(a4)
  4608. 1$        rts
  4609.  
  4610. ;write a portion of the output buffer to the screen
  4611. blastout    move.l  rastport(a4),a1
  4612.         moveq   #1,d0
  4613.         CALL    SetAPen,gfxbase(a4)
  4614.         move.l  rastport(a4),a1
  4615.         moveq   #1,d0
  4616.         CALL    SetDrMd,gfxbase(a4)
  4617.         moveq   #0,d7
  4618.  
  4619.         move.w  loffset(a4),d2
  4620.         beq.s   7$
  4621.         move.w  colms(a4),d4
  4622.         add.w   d4,d2
  4623.         move.w  maxllength(a4),d3
  4624.         cmp.w   d3,d2
  4625.         ble.s   7$
  4626.         move.w  d3,d2
  4627.         sub.w   d4,d2
  4628.         bpl.s   8$
  4629.         moveq   #0,d2
  4630. 8$        move.w  d2,loffset(a4)
  4631.  
  4632. 7$        bsr     tstfirstlin
  4633.  
  4634. 1$        tst.l   outchain(a4)
  4635.         beq.s   3$
  4636.         bsr     findline
  4637.  
  4638. 2$        move.w  colms(a4),d5
  4639.         ext.l   d5
  4640.         move.w  loffset(a4),d4
  4641.         ext.l   d4
  4642.         moveq   #18,d6
  4643. 6$        lea     14(a5,d4),a0
  4644.         move.w  12(a5),d3
  4645.         ext.l   d3
  4646.         bsr     blastline
  4647.         blt.s   9$
  4648.         move.w  rows(a4),currenty(a4)
  4649.         bra.s   5$
  4650. 9$        tst.l   0(a5)
  4651.         beq.s   5$
  4652.         move.l  0(a5),a5
  4653.         bra     6$
  4654. 5$        cmp.w   rows(a4),d7
  4655.         bcc.s   3$
  4656. 10$        moveq   #0,d3
  4657.         bsr     blastline
  4658.         bcs.s   10$
  4659. 3$        bset.b  #1,propupdate(a4)
  4660.         rts
  4661.  
  4662. ;get a pointer to a line  (line # in d0)
  4663. findline    move.l  outchain(a4),d1
  4664.         beq     2$
  4665.         move.l  d1,a5
  4666. 1$        tst     d0
  4667.         beq.s   2$
  4668.         tst.l   0(a5)
  4669.         beq.s   2$
  4670.         move.l  0(a5),a5
  4671.         dbf     d0,1$
  4672. 2$        rts
  4673.  
  4674. ;check if the display is as 'full' as possible
  4675. tstfirstlin move.l  firstline(a4),d0
  4676.         move.l  d0,d2
  4677.         add.w   rows(a4),d2
  4678.         cmp.l   numlines(a4),d2
  4679.         bmi.s   1$
  4680.         move.l  numlines(a4),d2
  4681.         sub.w   rows(a4),d2
  4682.         bpl.s   4$
  4683.         moveq   #0,d2
  4684. 4$        move.l  d2,d0
  4685.         move.l  d2,firstline(a4)
  4686. 1$        rts
  4687.  
  4688. ;display one line, fill the gap between the end of the line and
  4689. ;the end of the window with spaces.
  4690. ;d6 = ypos, d5=colms, d3= linelength, d7= line # in window, a0 = text
  4691.  
  4692. blastline   move    d6,d1
  4693.         moveq   #6,d0
  4694.         move.l  rastport(a4),a1
  4695.         CALL    Move,gfxbase(a4)
  4696.         sub.w   d4,d3
  4697.         bpl.s   7$
  4698.         moveq   #0,d3
  4699.         bra.s   6$
  4700. 7$        cmp.w   d5,d3
  4701.         bmi.s   4$
  4702.         move.w  d5,d3
  4703. 4$        move.l  d3,d0
  4704.         beq.s   6$
  4705.         move.l  rastport(a4),a1
  4706.         CALL    Text,gfxbase(a4)
  4707. 6$        move.l  d5,d0
  4708.         sub.l   d3,d0
  4709.         ble.s   5$
  4710.         move.l  blanks(a4),a0
  4711.         move.l  rastport(a4),a1
  4712.         CALL    Text,gfxbase(a4)
  4713. 5$        addq    #8,d6
  4714.         addq    #1,d7
  4715.         cmp.w   rows(a4),d7
  4716.         rts
  4717.  
  4718. ;Write pointer, display '-------' if empty
  4719. hexan        tst.l   d0
  4720.         beq     putstr
  4721.  
  4722. ;Write 8 byte hex value
  4723. ;d0 = value
  4724. hexa        bsr     gthex
  4725.         bra     putstr
  4726.  
  4727. gthex        movem.l d1-d7/a0-a6,-(a7)
  4728.         moveq.l #7,d5
  4729.         lea     hexarea(a4),a1
  4730.         lea     hextab(a4),a0
  4731.         moveq   #0,d2
  4732. hexloop     move.b  d0,d2
  4733.         and.b   #15,d2
  4734.         move.b  0(a0,d2),0(a1,d5)
  4735.         lsr.l   #4,d0
  4736.         dbf     d5,hexloop
  4737.         move.l  a1,d0
  4738.         movem.l (a7)+,d1-d7/a0-a6
  4739.         rts
  4740.  
  4741. ;Convert/write byte into binary string
  4742. ;d0 = value
  4743. bin        movem.l d1-d7/a0-a6,-(a7)
  4744.         lea     binarea(a4),a0
  4745.         move.w  #$2020,8(a0)
  4746.         moveq.l #7,d4
  4747. binloop     moveq.l #'0'/2,d1
  4748.         roxr.b  #1,d0
  4749.         roxl.b  #1,d1
  4750.         move.b  d1,0(a0,d4)
  4751.         dbf     d4,binloop
  4752.         move.l  a0,d0
  4753.         movem.l (a7)+,d1-d7/a0-a6
  4754.         bra     putstr
  4755.  
  4756. ;send a packet
  4757. ;a0 = msgport
  4758. ;dp_Type and dp_Arg1 have to be inizialized
  4759. cons1        movem.l d0-d7/a0-a6,-(a7)
  4760.         move.l  #dp_Link,LN_NAME
  4761.         move.l  #mypacket,dp_Link
  4762.         move.l  replyport(a4),dp_Port
  4763.         lea     mypacket,a1
  4764.         CALL    PutMsg,SysBase(a4)
  4765.         move.l  replyport(a4),a0
  4766.         CALL    WaitPort,SysBase(a4)
  4767.         move.l  replyport(a4),a0
  4768.         CALL    GetMsg,SysBase(a4)
  4769.         movem.l (a7)+,d0-d7/a0-a6
  4770.         rts
  4771.  
  4772. ;32-bit division
  4773. ;d0 / d1
  4774. ;returns d0
  4775. div        movem.l d2-d3,-(a7)
  4776.         tst.l   d1
  4777.         beq     div8
  4778.         swap    d1
  4779.         move.w  d1,d2
  4780.         bne.s   div1
  4781.         swap    d0
  4782.         swap    d1
  4783.         swap    d2
  4784.         move.w  d0,d2
  4785.         beq.s   div2
  4786.         divu    d1,d2
  4787.         move.w  d2,d0
  4788. div2        swap    d0
  4789.         move.w  d0,d2
  4790.         divu    d1,d2
  4791.         move.w  d2,d0
  4792.         swap    d2
  4793.         move.w  d2,d1
  4794.         bra     div8
  4795. div1        moveq   #$10,d3
  4796.         cmpi.w  #$80,d1
  4797.         bcc.s   div3
  4798.         rol.l   #8,d1
  4799.         subq.w  #8,d3
  4800. div3        cmpi.w  #$800,d1
  4801.         bcc.s   div4
  4802.         rol.l   #4,d1
  4803.         subq.w  #4,d3
  4804. div4        cmpi.w  #$2000,d1
  4805.         bcc.s   div5
  4806.         rol.l   #2,d1
  4807.         subq.w  #2,d3
  4808. div5        tst.w   d1
  4809.         bmi.s   div6
  4810.         rol.l   #1,d1
  4811.         subq.w  #1,d3
  4812. div6        move.w  d0,d2
  4813.         lsr.l   d3,d0
  4814.         swap    d2
  4815.         clr.w   d2
  4816.         lsr.l   d3,d2
  4817.         swap    d3
  4818.         divu    d1,d0
  4819.         move.w  d0,d3
  4820.         move.w  d2,d0
  4821.         move.w  d3,d2
  4822.         swap    d1
  4823.         mulu    d1,d2
  4824.         sub.l   d2,d0
  4825.         bcc.s   div7
  4826.         subq.w  #1,d3
  4827.         add.l   d1,d0
  4828. div7        moveq   #0,d1
  4829.         move.w  d3,d1
  4830.         swap    d3
  4831.         rol.l   d3,d0
  4832.         swap    d0
  4833.         exg     d1,d0
  4834. div8        movem.l (a7)+,d2-d3
  4835.         rts
  4836.  
  4837. ;install a input-handler
  4838. installh    pea     0
  4839.         pea     xopsleep(a4)
  4840.         LIBCALL CreatePort
  4841.         addq    #8,a7
  4842.         move.l  d0,InputMsg(a4)
  4843.         move.l  d0,-(a7)
  4844.         LIBCALL CreateStdIO
  4845.         addq    #4,a7
  4846.         move.l  d0,InRequest(a4)
  4847.         move.l  d0,a1
  4848.         lea     devicenam(a4),a0
  4849.         moveq   #0,d0
  4850.         moveq   #0,d1
  4851.         CALL    OpenDevice,SysBase(a4)
  4852.         move.l  d0,devstatus(a4)
  4853.         movea.l InRequest(a4),a1
  4854.         move.l  #InInterrupt+dataarea,40(a1)
  4855.         move.w  #9,28(a1)
  4856.         CALL    DoIO,SysBase(a4)
  4857.         move.l  d0,iostatus(a4)
  4858.         rts
  4859.  
  4860. ;remove handler
  4861. removeh     movea.l InRequest(a4),a1
  4862.         move.l  #InInterrupt+dataarea,40(a1)
  4863.         move.w  #10,28(a1)
  4864.         CALL    DoIO,SysBase(a4)
  4865.         movea.l InRequest(a4),a1
  4866.         CALL    CloseDevice,SysBase(a4)
  4867.         move.l  InRequest(a4),-(a7)
  4868.         LIBCALL DeleteStdIO
  4869.         addq    #4,a7
  4870.         move.l  InputMsg(a4),-(a7)
  4871.         LIBCALL DeletePort
  4872.         addq    #4,a7
  4873.         rts
  4874.  
  4875. ;this is the handler, it checks if amiga-amiga-x
  4876. ;has been pressed and signals it to our task
  4877. Keyhandler  tst.b   running+dataarea
  4878.         bne.s   endhandler
  4879.         cmp.b   #1,4(a0)
  4880.         bne.s   endhandler
  4881.         move.w  8(a0),d0
  4882.         andi.w  #$c0,d0
  4883.         cmpi.w  #$c0,d0
  4884.         bne.s   endhandler
  4885.         cmp.w   #$32,6(a0)
  4886.         bne.s   endhandler
  4887. wakeup        move.l  a0,-(a7)
  4888.         movea.l mytask+dataarea,a1
  4889.         move.l  #(1<<mysignal),d0
  4890.         CALL    Signal,_SysBase(PC)
  4891.         move.l  (a7)+,a0
  4892.         clr.b   4(a0)
  4893. endhandler  move.l  a0,d0
  4894.         rts
  4895.  
  4896. snoop        bsr     cls
  4897.         bsr     nodenam
  4898.         moveq   #1,d7
  4899.         lea     TReNode(PC),a3
  4900.         bsr     findnam
  4901.         tst.b   d7
  4902.         bne.s   1$
  4903.         move.w  #stperr,d0
  4904.         bra     putnamw
  4905. 1$        move.l  d0,captask(a4)
  4906.         pea     0
  4907.         pea     memportname(a4)
  4908.         LIBCALL CreatePort
  4909.         addq    #8,a7
  4910.         move.l  d0,snoopport(a4)
  4911.         beq     tm6
  4912.  
  4913.         bsr     replyintui
  4914.         move.b  #1,addlines(a4)
  4915.         lea     snoophead(a4),a0
  4916.         bsr     puthead
  4917.         move.l  SysBase(a4),a1
  4918.         move.l  -196(a1),oldalloc
  4919.         move.l  -208(a1),oldfree
  4920.         move.l  #capmalloc,d0
  4921.         move.l  #-198,a0
  4922.         CALL    SetFunction,SysBase(a4)
  4923.         move.l  SysBase(a4),a1
  4924.         move.l  #capmfree,d0
  4925.         move.l  #-210,a0
  4926.         CALL    SetFunction,SysBase(a4)
  4927.         clr.b   bool(a4)
  4928.         clr.b   cbreak(a4)
  4929.         clr.b   capgone(a4)
  4930.         clr.b   capwaiting(a4)
  4931.         clr.l   capiscli(a4)
  4932.  
  4933.         move.l  captask(a4),a1
  4934.         cmp.b   #13,8(a1)     ;ln_Type
  4935.         bne.s   waitmem
  4936.         tst.l   140(a1)
  4937.         beq.s   waitmem
  4938.         move.l  172(a1),d0    ;pr_CLI
  4939.         beq.s   waitmem
  4940.         lsl.l   #2,d0
  4941.         move.l  d0,a0
  4942.         lea     60(a0),a0
  4943.         move.l  a0,capiscli(a4)
  4944.         move.l  0(a0),d0
  4945.         move.l  d0,capseg(a4)
  4946.         bne.s   waitmem
  4947.         move.w  #capwait,d0
  4948.         bsr     putnamw
  4949.         bset.b  #1,capwaiting(a4)
  4950.  
  4951. waitmem     move.l  snoopport(a4),a0
  4952.         moveq   #0,d1
  4953.         move.b  15(a0),d1
  4954.         bset    d1,d0
  4955.         move.l  d0,auxsig(a4)
  4956.         bsr     processmsgs
  4957.  
  4958. tm7        move.l  mytask(a4),a0
  4959.         move.l  snoopport(a4),a0
  4960.         CALL    GetMsg,SysBase(a4)
  4961.         tst.l   d0
  4962.         bne     tm8
  4963.         tst.b   cbreak(a4)
  4964.         bne     snoopend
  4965.         tst.b   capgone(a4)
  4966.         bne     snoopend
  4967.         bra     waitmem
  4968.  
  4969. tm8        move.l  d0,a3
  4970.         tst.b   capwaiting(a4)
  4971.         beq.s   tm15
  4972.         move.l  capiscli(a4),d7
  4973.         beq.s   tm15
  4974.         move.l  d7,a0
  4975.         move.l  0(a0),capseg(a4)
  4976.         beq     tm12
  4977.         clr.b   capwaiting(a4)
  4978.  
  4979. tm15        move.l  20(a3),d3
  4980.         btst    #31,d3
  4981.         beq     freed
  4982.         move.w  #allok,d0
  4983.         bsr     putstrw
  4984.         lea     memname(PC),a2
  4985.         lea     membit(PC),a1
  4986.         moveq   #4,d5
  4987. tm2        move.l  0(a1),d4
  4988.         btst    d4,d3
  4989.         beq.s   tm1
  4990.         move.w  0(a2),d0
  4991.         bsr     putstrw
  4992. tm1        addq    #2,a2
  4993.         addq    #4,a1
  4994.         dbf     d5,tm2
  4995.         moveq   #26,d1
  4996.         bsr     tab
  4997.         move.l  24(a3),d0
  4998.         move.l  d0,d3
  4999.         bsr     hexa
  5000.         move.l  28(a3),d0
  5001.         bne.s   tm3
  5002.         move.w  #failed,d0
  5003.         bsr     putstrw
  5004.         moveq   #53,d1
  5005.         bsr     tab
  5006.         bra     tm4
  5007. tm3        bsr     hexa
  5008.         move.l  28(a3),d0
  5009.         add.l   d3,d0
  5010.         bsr     hexa
  5011.         bra     tm4
  5012.  
  5013. freed        move.w  #free,d0
  5014.         bsr     putstrw
  5015.         move.b  #'-',d0
  5016.         moveq   #18,d1
  5017. tm9        bsr     putchar
  5018.         dbf     d1,tm9
  5019.         bsr     putblank
  5020.         move.l  d3,d0
  5021.         bsr     hexa
  5022.         move.l  24(a3),d0
  5023.         bsr     hexa
  5024.         move.l  24(a3),d0
  5025.         add.l   d3,d0
  5026.         bsr     hexa
  5027.  
  5028. tm4        move.l  32(a3),d0
  5029.         bsr     hexa
  5030.         bsr     newline
  5031. tm12        bsr     freemsg
  5032.         move.l  captask(a4),a1
  5033. tm13        tst.b   capwaiting(a4)
  5034.         bne.s   tm10
  5035.         move.l  capiscli(a4),d0
  5036.         beq.s   1$
  5037.         move.l  d0,a0
  5038.         move.l  0(a0),d0
  5039.         cmp.l   capseg(a4),d0
  5040.         bne.s   tm11
  5041. 1$        move.b  15(a1),d0
  5042.         cmp.b   #5,d0
  5043.         bge.s   tm11
  5044.         cmp.b   #2,d0
  5045.         bge.s   tm10
  5046. tm11        bset.b  #1,capgone(a4)
  5047. tm10        bra     tm7
  5048.  
  5049. snoopend    move.l  SysBase(a4),a1
  5050.         move.l  oldalloc(PC),d0
  5051.         move.l  #-198,a0
  5052.         CALL    SetFunction,SysBase(a4)
  5053.         move.l  SysBase(a4),a1
  5054.         move.l  oldfree,d0
  5055.         move.l  #-210,a0
  5056.         CALL    SetFunction,SysBase(a4)
  5057.         move.l  snoopport(a4),-(a7)
  5058.         LIBCALL DeletePort
  5059.         addq    #4,a7
  5060.         tst.b   cbreak(a4)
  5061.         bne.s   1$
  5062.         move.w  #capexited,d0
  5063.         bra.s   2$
  5064. 1$        move.w  #stoped,d0
  5065. 2$        bsr     putnamw
  5066.         clr.b   addlines(a4)
  5067.         clr.l   auxsig(a4)
  5068. tm6        rts
  5069.  
  5070. memname     dc.w    memlarg,memclr,memfast,memchip,mempubl
  5071. membit        dc.l    17,16,2,1,0
  5072.  
  5073. capmalloc   movem.l d0-d7/a0-a6,-(a7)
  5074.         lea     dataarea(PC),a4
  5075.         move.l  SysBase(a4),a6
  5076.         move.l  276(a6),d4
  5077.         cmp.l   captask(a4),d4
  5078.         bne.s   capm1
  5079.         tst.b   bool(a4)
  5080.         bne     capm1
  5081.         move.b  #1,bool
  5082.         moveq   #36,d6
  5083.         bsr     allocmsg
  5084.         beq     capm2
  5085.         bset    #31,d1
  5086.         move.l  d1,20(a5)
  5087.         move.l  d0,24(a5)
  5088.         move.l  60(a7),32(a5)
  5089.         move.l  a5,remembr(a4)
  5090.         movem.l (a7)+,d0-d7/a0-a6
  5091.         bsr     memalloc
  5092.         movem.l d0-d7/a0-a6,-(a7)
  5093.         lea     dataarea(PC),a4
  5094.         move.l  remembr(a4),a1
  5095.         move.l  d0,28(a1)
  5096.         move.l  snoopport(a4),a0
  5097.         move.b  #5,8(a1)
  5098.         CALL    PutMsg,SysBase(a4)
  5099.         clr.b   bool(a4)
  5100.         movem.l (a7)+,d0-d7/a0-a6
  5101.         rts
  5102. capm2        clr.b   bool(a4)
  5103. capm1        movem.l (a7)+,d0-d7/a0-a6
  5104. memalloc    dc.w    $4ef9
  5105. oldalloc    dc.l    0
  5106.  
  5107. capmfree    movem.l d0-d7/a0-a6,-(a7)
  5108.         lea     dataarea(PC),a4
  5109.         move.l  SysBase(a4),a6
  5110.         move.l  276(a6),d4
  5111.         cmp.l   captask(a4),d4
  5112.         bne.s   capf1
  5113.         tst.b   bool(a4)
  5114.         bne.s   capf1
  5115.         move.b  #1,bool(a4)
  5116.         moveq   #36,d6
  5117.         bsr     allocmsg
  5118.         beq.s   capf2
  5119.         move.l  d0,20(a5)
  5120.         move.l  a1,24(a5)
  5121.         move.l  60(a7),32(a5)
  5122.         move.l  snoopport(a4),a0
  5123.         move.b  #5,8(a5)
  5124.         move.l  a5,a1
  5125.         CALL    PutMsg,SysBase(a4)
  5126. capf2        clr.b   bool(a4)
  5127. capf1        movem.l (a7)+,d0-d7/a0-a6
  5128.         dc.w    $4ef9
  5129. oldfree     dc.l    0
  5130.  
  5131. allocmsg    movem.l d0-d1/a0-a1,-(a7)
  5132.         move.l  d6,d0
  5133.         move.l  #65536,d1
  5134.         tst.l   oldalloc
  5135.         bne.s   1$
  5136.         CALL    AllocMem,_SysBase(PC)
  5137.         bra.s   2$
  5138. 1$        bsr     memalloc
  5139. 2$        tst.l   d0
  5140.         beq.s   alm1
  5141.         move.l  d0,a5
  5142.         move.w  d6,18(a5)
  5143. alm1        movem.l (a7)+,d0-d1/a0-a1
  5144.         move.l  a5,d6
  5145.         rts
  5146.  
  5147. freemsg     move.w  18(a3),d0
  5148.         ext.l   d0
  5149.         move.l  a3,a1
  5150.         CALL    FreeMem,SysBase(a4)
  5151.         rts
  5152.  
  5153. tracelocks  move.l  #_LVOLock,d0
  5154.         moveq   #-11,d1
  5155.         bra.s   tracedos
  5156.  
  5157. snoopfiles  move.l  #_LVOOpen,d0
  5158.         moveq   #-1,d1
  5159. tracedos    move.w  d0,patchwhat(a4)
  5160.         move.w  d1,dosoffset(a4)
  5161.         pea     0
  5162.         pea     memportname(a4)
  5163.         LIBCALL CreatePort
  5164.         addq    #8,a7
  5165.         move.l  d0,snoopport(a4)
  5166.         beq     10$
  5167.  
  5168.         bsr     replyintui
  5169.         move.b  #1,addlines(a4)
  5170.         bsr     cls
  5171.         lea     fileshead(a4),a0
  5172.         bsr     puthead
  5173.  
  5174.         move.w  patchwhat(a4),a0
  5175.         move.l  dosbase(a4),a1
  5176.         tst.b   post_V34(a4)
  5177.         beq.s   1$
  5178.         move.l  2(a1,a0.w),oldopen
  5179.         move.l  #myopen,d0
  5180.         CALL    SetFunction,SysBase(a4)
  5181.         bra.s   2$
  5182.  
  5183. 1$        CALL    Forbid,SysBase(a4)
  5184.         move.w  0(a1,a0.w),-(a7)
  5185.         move.l  2(a1,a0.w),-(a7)
  5186.         move.w  #$4ef9,0(a1,a0.w)
  5187.         move.l  #myopen,2(a1,a0.w)
  5188.         move.l  #$c09d6e-$c09d20,d0
  5189.         add.l   dosbase(a4),d0
  5190.         move.l  d0,oldopen
  5191.         RECALL  Permit
  5192.  
  5193.         clr.b   cbreak(a4)
  5194. 2$        move.l  snoopport(a4),a0
  5195.         moveq   #0,d1
  5196.         move.b  15(a0),d1
  5197.         bset    d1,d0
  5198.         move.l  d0,auxsig(a4)
  5199.         bsr     processmsgs
  5200.  
  5201. 3$        move.l  mytask(a4),a0
  5202.         move.l  snoopport(a4),a0
  5203.         CALL    GetMsg,SysBase(a4)
  5204.         tst.l   d0
  5205.         bne     10$
  5206.         tst.b   cbreak(a4)
  5207.         bne     7$
  5208.         bra.s   2$
  5209.  
  5210. 10$        move.l  d0,a3
  5211.         move.l  20(a3),d0
  5212.         bsr     getaskname2
  5213.         moveq   #11,d1
  5214.         bsr     tab
  5215.         moveq   #' ',d0
  5216.         bsr     putchar
  5217.         move.l  24(a3),d0
  5218.         bne.s   6$
  5219.         move.w  #failed,d0
  5220.         bsr     putstrw
  5221.         moveq   #21,d1
  5222.         bsr     tab
  5223.         bra.s   11$
  5224.  
  5225. 6$        bsr     hexa
  5226. 11$        move.b  28(a3),d0
  5227.         bmi.s   4$
  5228.         cmp.b   #2,d0
  5229.         ble.s   12$
  5230. 4$        move.w  #type,d0
  5231.         bsr     putstrw
  5232.         moveq   #28,d1
  5233.         bsr     tab
  5234.         bra.s   5$
  5235. 12$        ext.w   d0
  5236.         lsl.w   #3,d0
  5237.         add.w   #fmode,d0
  5238.         bsr     putstrw
  5239. 5$        moveq   #29,d0
  5240.         add.l   a3,d0
  5241.         bsr     putnam
  5242.  
  5243.         bsr     freemsg
  5244.         bra     3$
  5245.  
  5246. 7$        move.w  patchwhat(a4),a0
  5247.         move.l  dosbase(a4),a1
  5248.         tst.b   post_V34(a4)
  5249.         beq.s   8$
  5250.         move.l  oldopen,d0
  5251.         CALL    SetFunction,SysBase(a4)
  5252.         bra.s   9$
  5253.  
  5254. 8$        CALL    Forbid,SysBase(a4)
  5255.         move.l  (a7)+,2(a1,a0)
  5256.         move.w  (a7)+,0(a1,a0)
  5257.         RECALL  Permit
  5258.  
  5259. 9$        move.l  snoopport(a4),-(a7)
  5260.         LIBCALL DeletePort
  5261.         addq    #4,a7
  5262.         move.w  #stoped,d0
  5263.         bsr     putnamw
  5264.         clr.b   addlines(a4)
  5265.         clr.l   auxsig(a4)
  5266.         rts
  5267.  
  5268. myopen        movem.l d3-d7/a0-a6,-(a7)
  5269.         movem.l d1-d2,-(a7)
  5270.         move.l  d1,a0
  5271.         bsr     strlen
  5272.         move.l  d0,d6
  5273.         add.l   #30,d6
  5274.         bsr     allocmsg
  5275.         beq.s   1$
  5276.         move.w  .dosoffset(PC),d3
  5277.         addq.w  #1,d3
  5278.         bne.s   2$
  5279.         sub.w   #1004,d2
  5280.         bra.s   3$
  5281. 2$        addq.w  #3,d2
  5282. 3$        move.b  d2,28(a5)
  5283.         move.l  _SysBase(PC),a6
  5284.         move.l  276(a6),20(a5)
  5285.         lea     29(a5),a1
  5286.         move.l  d1,a0
  5287.         RECALL  CopyMem
  5288. 1$        movem.l (a7)+,d1-d2
  5289.         move.l  a5,d6
  5290.         move.w  .dosoffset(PC),d0
  5291.         ext.l   d0
  5292.         move.l  .dosbase(pc),a6
  5293.         jsr     $bababa
  5294. oldopen     equ     *-4
  5295.         move.l  d0,d7
  5296.         movem.l d1-d2,-(a7)
  5297.         tst.l   d6
  5298.         beq.s   1$
  5299.         move.l  d6,a5
  5300.         move.l  d0,24(a5)
  5301.  
  5302.         move.l  snoopport+dataarea(PC),a0
  5303.         move.b  #5,8(a5)
  5304.         move.l  a5,a1
  5305.         CALL    PutMsg,_SysBase(PC)
  5306. 1$        move.l  d7,d0
  5307.         movem.l (a7)+,d1-d2
  5308.         movem.l (a7)+,d3-d7/a0-a6
  5309.         rts
  5310.  
  5311. myswitch    movem.l d0-d1/a0,-(a7)
  5312.         move.l  4,a0
  5313.         move.l  276(a0),d0
  5314.         move.l  .tasksnum(PC),d1
  5315.         lea     cputime,a0
  5316.         subq.l  #1,d1
  5317.         bmi.s   swadd
  5318. sw0        cmp.l   (a0)+,d0
  5319.         dbeq    d1,sw0
  5320.         bne.s   swadd
  5321.  
  5322. swi1        tst.b   .post_V34
  5323.         beq.s   1$
  5324.         bsr     getV2.0time
  5325.         move.l  d0,d1
  5326.         sub.l   lasttime(PC),d0
  5327.         bcs.s   swgo2
  5328.         move.l  d1,lasttime
  5329.         bra.s   2$
  5330.  
  5331. 1$        move.l  #999999,d0
  5332.         move.l  d0,d1
  5333.         sub.l   sampleio+36+dataarea(PC),d0
  5334.         move.l  d1,sampleio+36+dataarea
  5335. 2$        lsr.l   #8,d0
  5336.         add.l   d0,508(a0)
  5337. swgo2        movem.l (a7)+,d0-d1/a0
  5338.         dc.w    $4ef9
  5339. oldswitch   dc.l    0
  5340. swadd        cmp.l   #125,tasksnum+dataarea
  5341.         bge.s   swgo2
  5342.         addq.l  #1,tasksnum+dataarea
  5343.         move.l  d0,0(a0)
  5344.         addq.l  #4,a0
  5345.         clr.l   508(a0)
  5346.         bra.s   swi1
  5347.  
  5348. lasttime    dc.l    0
  5349.  
  5350. getV2.0time movem.l d2/a0,-(a7)
  5351.         move.w  #$4000,$dff09a    ;ReadEClock
  5352.         lea     $bfe001,a0
  5353.         moveq   #0,d0
  5354.         move.l  d0,d1
  5355.         move.l  d1,d2
  5356.         move.b  $700(a0),d0
  5357.         move.b  $600(a0),d1
  5358.         move.b  $700(a0),d2
  5359.  
  5360.         cmp.b   d0,d2
  5361.         beq.s   1$
  5362.         moveq   #-1,d1
  5363. 1$        lsl.w   #8,d2
  5364.         move.b  d1,d2
  5365.         addq    #1,d2
  5366.         neg.w   d2
  5367.         move.l  .timerbase(PC),a0
  5368.         move.l  $50(a0),d0
  5369.         move.w  d2,d0
  5370.         move.w  #-$4000,$dff09a
  5371.         movem.l (a7)+,d2/a0
  5372.         rts
  5373.  
  5374. countio     addq.l #1,iocount+dataarea
  5375.         moveq  #0,d0
  5376.         rts
  5377.  
  5378. iconbackdrp tst.b   iconifyon(a4)
  5379.         beq.s   cio1
  5380.         lea     icnwindow,a0
  5381.         eor.l   #$100,14(a0)    ;wn_Flags
  5382. cio1        rts
  5383.  
  5384. iconifyoff  tst.b   iconifyon(a4)
  5385.         beq.s   cio1
  5386.         clr.b   iconifyon(a4)
  5387.         tst.b   fromfile(a4)
  5388.         bne.s   1$
  5389.         move.l  wnptr(a4),d0
  5390.         beq.s   1$
  5391.         move.l  d0,a0
  5392.         lea     iconifgad,a1
  5393.         CALL    RemoveGadget,intuibase(a4)
  5394.         move.l  wnptr(a4),a0
  5395.         CALL    RefreshWindowFrame,intuibase(a4)
  5396. 1$        move.l  #iconify,d0
  5397.         bra.s   killseg
  5398.  
  5399. propgadoff  tst.b   propgadon(a4)
  5400.         beq.s   cio1
  5401.         clr.b   propgadon(a4)
  5402.         tst.b   fromfile(a4)
  5403.         bne.s   1$
  5404.         move.l  wnptr(a4),d0
  5405.         beq.s   1$
  5406.         move.l  d0,a0
  5407.         lea     sbgadget,a1
  5408.         CALL    RemoveGadget,intuibase(a4)
  5409.         move.l  wnptr(a4),a0
  5410.         CALL    RefreshWindowFrame,intuibase(a4)
  5411.         bsr     setupscreen
  5412. 1$        move.l  #setprop,d0
  5413.  
  5414. killseg     movem.l d1-d2/a0-a5,-(a7)
  5415.         subq    #4,d0
  5416.         move.l  4,a6
  5417.         move.l  276(a6),a5
  5418.         move.l  128(a5),d1
  5419.         lsl.l   #2,d1
  5420.         move.l  d1,a3
  5421.         move.l  12(a3),d1
  5422.         bne.s   2$
  5423.         move.l  172(a5),d1
  5424.         lsl.l   #2,d1
  5425.         move.l  d1,a5
  5426.         move.l  60(a5),d1
  5427.  
  5428. 2$        lsl.l   #2,d1
  5429.         cmp.l   d0,d1
  5430.         beq.s   4$
  5431.         move.l  d1,a5
  5432.         move.l  0(a5),d1
  5433.         beq.s   5$
  5434.         bra.s   2$
  5435.  
  5436. 4$        move.l  d1,a0
  5437.         move.l  0(a0),0(a5)
  5438.         clr.l   0(a0)
  5439.         lsr.l   #2,d1
  5440.         CALL    UnLoadSeg,dosbase(a4)
  5441.         movem.l (a7)+,d1-d2/a0-a5
  5442. 5$        rts
  5443.  
  5444. alert        bsr     stoptimer
  5445.         move.l  excpttask(a4),d0
  5446.         bne.s   alert1
  5447.         move.w  #noguru,d0
  5448.         bra     putnamw
  5449. alert1        move.w  #softfail,d0
  5450.         bsr     putstrw
  5451.         move.l  excpttask(a4),d0
  5452.         bsr     getaskname2
  5453.         bsr     newline
  5454.         cmp.l   #3,excpterror(a4)
  5455.         bne.s   1$
  5456.         move.w  #addrserr,d0
  5457.         bsr     putstrw
  5458.         move.l  excptaddr(a4),d0
  5459.         bsr     hexa
  5460.         bsr     newline
  5461. 1$        move.w  #procount,d0
  5462.         bsr     putstrw
  5463.         move.l  excptpc(a4),d0
  5464.         bsr     hexa
  5465.         bsr     newline
  5466.         move.w  #gurutxt,d0
  5467.         bsr     putstrw
  5468.         move.l  excpterror(a4),d0
  5469.         bsr     hexa
  5470.         lea     out,a0
  5471.         move.l  ptr(a4),d0
  5472.         move.b  #'.',-1(a0,d0)
  5473.         move.l  excpttask(a4),d0
  5474.         bsr     hexa
  5475.         bra     newline
  5476.  
  5477. showguru    bsr     alert
  5478.         tst.b   ownscreen(a4)
  5479.         bne.s   5$
  5480.         move.l  wnptr(a4),a0
  5481.         CALL    WindowToFront,intuibase(a4)
  5482.         bra.s   2$
  5483. 5$        move.l  screenptr,a0
  5484.         CALL    ScreenToFront,intuibase(a4)
  5485. 2$        move.w  #whatnow,d0
  5486.         bsr     putnamw
  5487.         clr.l   oldpageend
  5488.         bsr     readline
  5489.  
  5490.         cmp.b   #'i',inputbuffer
  5491.         beq.s   4$
  5492. 1$        cmp.b   #'k',inputbuffer
  5493.         bne.s   2$
  5494.         move.l  excpttask(a4),a1
  5495.         tst.l   22(a1)
  5496.         bne.s   3$
  5497.         CALL    RemTask,SysBase(a4)
  5498.         bra.s   4$
  5499. 3$        move.l  a1,d0
  5500.         bsr     canok
  5501. 4$        clr.l   lastprinted(a4)
  5502.         rts
  5503.  
  5504. myaddtask   movem.l d0/a0,-(a7)
  5505.         tst.b   wanttraps+dataarea
  5506.         beq.s   2$
  5507.         lea     mytrap(PC),a0
  5508.         move.l  50(a1),d0
  5509.         beq.s   1$
  5510.         cmp.l   oldtrap(PC),d0
  5511.         beq.s   1$
  5512.         lea     myproctrap(PC),a0
  5513.         cmp.l   oldproctrap(PC),d0
  5514.         bne.s   2$
  5515. 1$        move.l  a0,50(a1)
  5516.  
  5517. 2$        movem.l (a7)+,d0/a0
  5518.         move.l  a1,-(a7)
  5519.         jsr     $bababa
  5520. OldAddTask  equ     *-4
  5521.         move.l  (a7)+,d0
  5522.         movem.l d1-d7/a0-a6,-(a7)
  5523.         move.l  d0,d7
  5524.         lea     tsecs+dataarea(PC),a0
  5525.         lea     tmics+dataarea(PC),a1
  5526.         CALL    CurrentTime,intuibase+dataarea(PC)
  5527.         CALL    Forbid,_SysBase(PC)
  5528.         move.w  numtaskstimed+dataarea(PC),d5
  5529.         lsl.w   #2,d5
  5530.         lea     taskstampid,a5
  5531.         lea     0(a5,d5.w),a5
  5532.         move.l  d7,0(a5)
  5533.         move.l  tsecs+dataarea(PC),d0
  5534.         move.l  d0,taskstamps-taskstampid(a5)
  5535.         clr.l   usedtime-taskstampid(a5)
  5536.         addq.w  #1,numtaskstimed+dataarea
  5537.         lea     dataarea(PC),a4
  5538.         bsr     cleanuptimers
  5539.         RECALL  Permit
  5540.         cmp.b   #5,timerio+8
  5541.         bne.s   3$
  5542.         moveq   #0,d0
  5543.         move.w  timersig+dataarea(PC),d1
  5544.         bset    d1,d0
  5545.         move.l  mytask+dataarea(PC),a1
  5546.         RECALL  Signal
  5547. 3$        move.l  d7,d0
  5548.         movem.l (a7)+,d1-d7/a0-a6
  5549.         rts
  5550.  
  5551. myproctrap  bsr     traphandle
  5552.         dc.w    $4ef9
  5553. oldproctrap dc.l    0
  5554.  
  5555. mytrap        bsr     traphandle
  5556.         moveq   #0,d0
  5557.         CALL    Wait,SysBase(a4)
  5558.         dc.w    $4ef9
  5559. oldtrap     dc.l    0
  5560.  
  5561. coldreboot  move.w  #$4000,$dff09a
  5562.         clr.l   sysbase
  5563.  
  5564. reboot        move.l  SysBase(a4),a6
  5565.         tst.b   post_V34(a4)
  5566.         beq.s   1$
  5567.         jmp     -726(a6)        ;_LVOColdReboot
  5568.  
  5569. 1$        lea     2$(PC),a5
  5570.         RECALL  Supervisor
  5571.  
  5572. 2$        move.l  $fc0004,a0
  5573.         subq    #2,a0
  5574.         CNOP    0,4
  5575.         reset
  5576.         jmp     0(a0)
  5577.  
  5578.  
  5579. traphandle  movem.l d0-d7/a0-a6,$180
  5580.         move.l  4,a6
  5581.         move.l  276(a6),.excpttask
  5582.         move.l  4(a7),d0
  5583.         cmp.l   #9,d0
  5584.         beq.s   2$
  5585.         move.l  d0,.excpterror
  5586.         moveq   #10,d1
  5587.         cmp.l   #3,d0
  5588.         bne.s   1$
  5589.         move.l  0(a7,d1.w),.excptaddr
  5590.         moveq   #18,d1
  5591. 1$        move.l  0(a7,d1.w),.excptpc
  5592.         move.l  mytask+dataarea(PC),a1
  5593.         move.l  trapsignal+dataarea(PC),d0
  5594.         RECALL  Signal
  5595. 2$        movem.l $180,d0-d7/a0-a6
  5596.         rts
  5597.  
  5598. trapguru    tst.b   wanttraps(a4)
  5599.         bne     restoretrap
  5600.         move.b  #1,wanttraps(a4)
  5601.  
  5602. addtraps    tst.b   wanttraps(a4)
  5603.         beq     5$
  5604.         move.l  304(a6),oldtrap        ;Original EXEC trap handler
  5605.         moveq   #-1,d0
  5606.         CALL    AllocSignal,SysBase(a4)
  5607.         moveq   #0,d1
  5608.         bset    d0,d1
  5609.         move.l  d1,trapsignal(a4)
  5610.         RECALL  Forbid            ;change the trap handler of
  5611.         moveq   #0,d5            ;aleady running tasks
  5612.         bsr     getaskdat            ;get task stucture pointers
  5613. 1$        tst.b   entries(a4)
  5614.         beq.s   2$
  5615.         lea     -16(a5),a5
  5616.         move.l  0(a5),a3               ;pointer to a task structure
  5617.         lea     myproctrap(PC),a0
  5618.         move.l  50(a3),d0               ;Task->tc_TrapCode
  5619.         cmp.l   oldproctrap(PC),d0      ;AmigaDos Handler ?
  5620.         beq.s   3$
  5621.         lea     mytrap(PC),a0           ;EXEC Handler ?
  5622.         cmp.l   oldtrap(PC),d0
  5623.         bne.s   4$                ;must be a custom one, skip it
  5624. 3$        move.l  a0,50(a3)               ;replace it
  5625. 4$        subq.b  #1,entries(a4)
  5626.         bra.s   1$
  5627. 2$        CALL    Permit,SysBase(a4)
  5628. 5$        rts
  5629.  
  5630. restoretrap tst.b   wanttraps(a4)
  5631.         beq.s   6$
  5632.         tst.b   fromfile(a4)
  5633.         bne.s   5$
  5634.         CALL    Forbid,SysBase(a4)
  5635.         bsr     getaskdat
  5636. 1$        tst.b   entries(a4)
  5637.         beq.s   2$
  5638.         lea     -16(a5),a5
  5639.         move.l  0(a5),a3
  5640.         move.l  oldproctrap(PC),a0
  5641.         move.l  50(a3),d0
  5642.         cmp.l   #myproctrap,d0
  5643.         beq.s   3$
  5644.         move.l  oldtrap(PC),a0
  5645.         cmp.l   #mytrap,d0
  5646.         bne.s   4$
  5647. 3$        move.l  a0,50(a3)
  5648. 4$        subq.b  #1,entries(a4)
  5649.         bra.s   1$
  5650. 2$        CALL    Permit,SysBase(a4)
  5651.         clr.l   trapsignal(a4)
  5652. 5$        clr.b   wanttraps(a4)
  5653. 6$        rts
  5654.  
  5655. ;save the contents of the output buffer
  5656. ;to a file, append the output if the file allready exists
  5657. saveoutput  bsr     nodenam2
  5658.         tst.b   0(a5)
  5659.         beq     syntax
  5660.         move.l  a5,d1
  5661.         move.l  #1004,d2        ;mode_readwrite
  5662.         CALL    Open,dosbase(a4)
  5663.         move.l  d0,d5
  5664.         beq.s   5$
  5665.         moveq   #1,d3
  5666.         moveq   #0,d2
  5667.         move.l  d0,d1
  5668.         CALL    Seek,dosbase(a4)
  5669.         bra.s   1$
  5670. 5$        move.l  a5,d1
  5671.         move.l  #1006,d2        ;mode_newfile
  5672.         CALL    Open,dosbase(a4)
  5673.         move.l  d0,d5
  5674.         bne.s   1$
  5675.         move.w  #openerr,d0
  5676.         bsr     putstrw
  5677.         move.l  a5,d0
  5678.         bra     putnam
  5679. 1$        move.l  outchain(a4),d0
  5680.         beq.s   3$
  5681. 2$        move.l  d0,a5
  5682.         move.w  12(a5),d3
  5683.         beq.s   4$
  5684.         ext.l   d3
  5685.         lea     14(a5),a1
  5686.         move.l  a1,d2
  5687.         move.l  d5,d1
  5688.         CALL    Write,dosbase(a4)
  5689.         tst.l   d0
  5690.         ble.s   3$
  5691. 4$        moveq   #1,d3
  5692.         move.l  d5,d1
  5693.         move.l  #cr+dataarea,d2
  5694.         CALL    Write,dosbase(a4)
  5695.         tst.l   d0
  5696.         ble.s   3$
  5697.         move.l  0(a5),d0
  5698.         bne.s   2$
  5699. 3$        move.l  d5,d1
  5700.         CALL    Close,dosbase(a4)
  5701.         rts
  5702.  
  5703. grabtimerio lea     tiohead(a4),a0
  5704.         bsr     puthead
  5705.         move.b  timeout(a4),d4
  5706.         move.b  #255,timeout(a4)
  5707.         bsr     starttimer
  5708.         move.b  d4,timeout(a4)
  5709.         lea     timerio,a1
  5710.         CALL    Disable,SysBase(a4)
  5711. 2$        move.l  0(a1),d2
  5712.         beq.s   1$
  5713.         move.l  d2,a1
  5714.         bra.s   2$
  5715. 1$        CALL    Enable,SysBase(a4)
  5716.         lea     -4(a1),a5
  5717.         bsr     stoptimer
  5718.         lea     buffer,a3
  5719.         moveq   #1,d4
  5720.         bsr     gettrq
  5721.  
  5722.         lea     timerio,a0
  5723.         lea     dummy,a1
  5724.         moveq   #40,d0
  5725.         CALL    CopyMem,SysBase(a4)
  5726.  
  5727.         lea     dummy,a1
  5728.         lea     timernam(a4),a0
  5729.         moveq   #0,d1
  5730.         moveq   #0,d0
  5731.         CALL    OpenDevice,SysBase(a4)
  5732.  
  5733.         lea     dummy,a1
  5734.         move.l  #1<<30,32(a1)
  5735.         CALL    SendIO,SysBase(a4)
  5736.  
  5737.         lea     dummy,a5
  5738.         CALL    Disable,SysBase(a4)
  5739. 8$        move.l  0(a5),d2
  5740.         beq.s   7$
  5741.         move.l  d2,a5
  5742.         bra.s   8$
  5743. 7$        CALL    Enable,SysBase(a4)
  5744.         lea     -4(a5),a5
  5745.  
  5746.         lea     dummy,a1
  5747.         CALL    AbortIO,SysBase(a4)
  5748.         lea     timerio,a1
  5749.         CALL    WaitIO,SysBase(a4)
  5750.         move.w  timersig(a4),d0
  5751.         moveq   #0,d1
  5752.         bset    d0,d1
  5753.         moveq   #0,d0
  5754.         CALL    SetSignal,SysBase(a4)
  5755.  
  5756.         moveq   #0,d4
  5757.         bsr     gettrq
  5758.  
  5759.         lea     dummy,a1
  5760.         CALL    CloseDevice,SysBase(a4)
  5761.  
  5762.         clr.l   (a3)+
  5763.         lea     -22(a3),a2
  5764.         moveq   #18,d2
  5765.         bsr     sortlist
  5766.  
  5767.         lea     buffer,a5
  5768. 5$        move.l  (a5)+,d0
  5769.         beq.s   6$
  5770.         bsr     hexa
  5771.         move.w  (a5)+,d0
  5772.         ext.l   d0
  5773.         mulu    #9,d0
  5774.         add.w   #timerunits,d0
  5775.         bsr     putstrw
  5776.         move.l  (a5)+,d0
  5777.         bsr     putstamp
  5778.         moveq   #'.',d0
  5779.         bsr     putchar
  5780.         move.l  (a5)+,d0
  5781.         move.l  #100000,d1
  5782.         bsr     div
  5783.         or.l    #'0',d0
  5784.         bsr     putchar
  5785. 10$        bsr     putblank
  5786.         move.l  (a5)+,d0
  5787.         bsr     getaskname2
  5788.         bsr     newline
  5789.         bra.s   5$
  5790. 6$        rts
  5791.  
  5792. gettrq        CALL    Disable,SysBase(a4)
  5793. 3$        move.l  0(a5),a5
  5794.         tst.l   0(a5)
  5795.         beq.s   4$
  5796.         move.l  a5,(a3)+
  5797.         move.w  d4,(a3)+
  5798.         move.l  32(a5),(a3)+
  5799.         move.l  36(a5),(a3)+
  5800.         move.l  14(a5),a1
  5801.         move.l  16(a1),(a3)+
  5802.         bra.s   3$
  5803. 4$        CALL    Enable,SysBase(a4)
  5804.         rts
  5805.  
  5806.  
  5807. ;check if the timer is runnig, start it if not
  5808. starttimer  lea     timerio,a1
  5809.         cmp.b   #5,8(a1)
  5810.         beq.s   1$
  5811.         moveq   #0,d0
  5812.         move.b  timeout(a4),d0
  5813.         bne.s   2$
  5814.         tst.l   timeoutm(a4)
  5815.         beq.s   1$
  5816. 2$        move.l  d0,32(a1)
  5817.         move.l  timeoutm(a4),36(a1)
  5818.         move.w  #9,28(a1)
  5819.         CALL    SendIO,SysBase(a4)
  5820. 1$        rts
  5821. ;Abort a timer request, if pending
  5822. stoptimer   lea     timerio,a1
  5823.         cmp.b   #5,8(a1)
  5824.         bne.s   1$
  5825.         CALL    AbortIO,SysBase(a4)
  5826.         lea     timerio,a1
  5827.         CALL    WaitIO,SysBase(a4)
  5828. 1$        move.w  timersig(a4),d0
  5829.         moveq   #0,d1
  5830.         bset    d0,d1
  5831.         moveq   #0,d0
  5832.         CALL    SetSignal,SysBase(a4)
  5833.         rts
  5834. ;Xoper main loop, process all incoming messages
  5835. processmsgs move.l  wnptr(a4),a0
  5836.         moveq   #0,d0
  5837.         move.w  intuisig(a4),d1
  5838.         bset    d1,d0
  5839.         bset    #mysignal,d0
  5840.         move.w  timersig(a4),d1
  5841.         bset    d1,d0
  5842.         or.w    #4096,d0
  5843.         or.l    auxsig(a4),d0
  5844.         tst.l   auxsig(a4)
  5845.         bne.s   1$
  5846.         or.l    trapsignal(a4),d0
  5847. 1$        CALL    Wait,SysBase(a4)
  5848.  
  5849.         move.l  d0,tasksigs(a4)
  5850.  
  5851.         move.l  trapsignal(a4),d1
  5852.         and.l   d0,d1
  5853.         beq.s   ctrl_c
  5854.         tst.b   gotguru(a4)
  5855.         bne.s   ctrl_c
  5856.         move.b  #1,gotguru(a4)
  5857.         bsr     showguru
  5858.         clr.b   gotguru(a4)
  5859.  
  5860. ctrl_c        moveq   #12,d1
  5861.         bsr     testsig
  5862.         bne     exit
  5863.  
  5864.         moveq   #mysignal,d1
  5865.         bsr     testsig
  5866.         beq.s   timermsg
  5867.         move.l  d0,-(a7)
  5868.         move.l  screenptr(a4),d0
  5869.         beq.s   1$
  5870.         move.l  d0,a0
  5871.         CALL    ScreenToFront,intuibase(a4)
  5872.         bra.s   2$
  5873. 1$        move.l  wnptr(a4),d0
  5874.         beq.s   timermsg
  5875.         move.l  d0,a0
  5876.         CALL    WindowToFront,intuibase(a4)
  5877. 2$        move.l  (a7)+,d0
  5878.  
  5879. timermsg    move.w  timersig(a4),d1
  5880.         bsr     testsig
  5881.         beq     intuimsgs
  5882.         btst.w  #8,propinfo
  5883.         bne.s   3$
  5884.         tst.w   repeat(a4)
  5885.         bne.s   1$
  5886.         bsr     showwhat
  5887.         bra.s   intuimsgs
  5888. 1$        move.w  repeatlen(a4),d0
  5889.         lea     repeatbuffer,a2
  5890.         lea     dummy,a1
  5891.         move.w  d0,d1
  5892. 2$        move.b  (a2)+,(a1)+
  5893.         dbf     d1,2$
  5894.         bsr     cli
  5895. 3$        bsr     starttimer
  5896.  
  5897. intuimsgs   move.w  intuisig(a4),d1
  5898.         bsr     testsig
  5899.         beq     processnxtmsg
  5900. nextimsg    move.l  wnptr(a4),a0
  5901.         move.l  $56(a0),a0
  5902.         CALL    GetMsg,SysBase(a4)
  5903.         tst.l   d0
  5904.         beq     processnxtmsg
  5905.         move.l  d0,intuimsg(a4)
  5906.  
  5907.         move.l  d0,a0
  5908.         move.l  20(a0),d0
  5909.  
  5910.         cmp.l   #$200,d0        ;CloseWindow
  5911.         bne.s   1$
  5912.         tst.b   addlines(a4)
  5913.         beq     exitall
  5914.         move.b  #1,cbreak
  5915.         bra     intuiend
  5916.  
  5917. 1$        cmp.l   #2,d0        ;ResizeWindow
  5918.         bne.s   1010$
  5919.         tst.b   post_V34(a4)
  5920.         beq.s   3443$
  5921.         move.l  wnptr(a4),a0
  5922.         move.l  minwsize(a4),d0
  5923.         cmp.w   10(a0),d0
  5924.         bne.s   3443$
  5925.         swap    d0
  5926.         cmp.w   8(a0),d0
  5927.         bne.s   3443$
  5928.         bsr     replyintui        ;window was 'zipped'
  5929.         bsr     stoptimer
  5930.         bra     instback
  5931.  
  5932. 3443$        bsr     setupscreen
  5933.         bra     intuiend
  5934.  
  5935. 1010$        cmp.l   #$10,d0
  5936.         bne.s   2$
  5937.         btst.w  #8,propinfo
  5938.         beq.s   1002$
  5939.         jsr     proppos
  5940.         bra.s   1002$
  5941.  
  5942. 2$        cmp.l   #4,d0        ;refresh
  5943.         bne.s   22$
  5944.         bsr     putiline
  5945.         bsr     blastout
  5946.         bsr     UpdateIArea
  5947. 1002$        bra     intuiend
  5948.  
  5949. 22$        tst.b   addlines(a4)
  5950.         bne     3$
  5951.         cmp.l   #$20,d0        ;gadgetdown
  5952.         bne.s   1000$
  5953.         tst.w   getanswer(a4)
  5954.         bne.s   3$
  5955.         move.l  28(a0),a1
  5956.         cmp.w   #3,38(a1)           ;Slidebar
  5957.         bne.s   1002$
  5958.         tst.b   propgadon(a4)
  5959.         beq.s   1002$
  5960.         jsr     proppos
  5961. 1004$        bra.s   1002$
  5962.  
  5963. 1000$        cmp.l   #$40,d0        ;gadgetup
  5964.         bne.s   3$
  5965.         move.l  28(a0),a1
  5966.         cmp.w   #3,38(a1)           ;Slidebar ?
  5967.         bne.s   1003$
  5968.         bclr.w  #8,propinfo     ;clear 'knop hit' bit
  5969.         bra.s   1004$
  5970. 1003$        bsr     replyintui        ;iconify
  5971.         bsr     stoptimer
  5972.         bra     instback
  5973.  
  5974. 3$        cmp.l   #$400,d0        ;RawKey
  5975.         bne     notarawkey
  5976.         move.w  #$80,d0
  5977.         and.w   24(a0),d0
  5978.         bne     intuiend
  5979.         and.w   #$7f,24(a0)
  5980.         lea     ievent,a1
  5981.         move.b  #1,4(a1)
  5982.         move.l  24(a0),6(a1)
  5983.         move.w  26(a0),qualifier(a4)
  5984.         move.l  a1,a0
  5985.         lea     outevent,a1
  5986.         moveq   #20,d1
  5987.         suba.l  a2,a2
  5988.         CALL    RawKeyConvert,condev(a4)
  5989.         tst.l   d0
  5990.         beq     intuiend
  5991.         lea     inputbuffer,a1
  5992.         lea     outevent,a2
  5993.         move.w  curpos(a4),d4
  5994.         moveq   #0,d3
  5995.         tst.b   addlines(a4)
  5996.         bne     197$
  5997.  
  5998.         sub.w   #1,cmdcompflag(a4)
  5999.  
  6000.         cmp.b   #$9b,0(a2)          ;SI code
  6001.         bne     110$
  6002.  
  6003.         cmp.b   #'?',1(a2)          ;help
  6004.         bne.s   399$
  6005.         tst.w   getanswer(a4)
  6006.         bne.s   399$
  6007.         bsr     stoptimer
  6008.         tst.w   bottomin(a4)
  6009.         bne.s   398$
  6010.         move.w  #1,bottomin(a4)
  6011.         clr.w   ibufferlen(a4)
  6012.         clr.w   curpos(a4)
  6013.         bsr     UpdateIArea
  6014. 398$        move.w  #usetxt,d0
  6015.         bsr     putnamw
  6016.         clr.l   lastprinted(a4)
  6017.         bsr     blastout
  6018.         bra.s   420$
  6019.  
  6020. 399$        cmp.b   #'C',1(a2)          ;cursor right
  6021.         bne.s   400$
  6022.         cmp.w   ibufferlen(a4),d4
  6023.         bge.s   420$
  6024.         addq    #1,d4
  6025. 421$        move.w  d4,curpos(a4)
  6026. 420$        bra     100$
  6027.  
  6028. 400$        cmp.b   #'D',1(a2)          ;cursor left
  6029.         bne.s   401$
  6030.         subq    #1,d4
  6031.         bpl.s   421$
  6032.         bra.s   420$
  6033.  
  6034. 401$        cmp.b   #' ',1(a2)
  6035.         bne.s   402$
  6036.  
  6037.         cmp.b   #'@',2(a2)          ;shift right
  6038.         bne.s   403$
  6039.  
  6040. 404$        cmp.w   ibufferlen(a4),d4
  6041.         bge.s   421$
  6042.         addq    #1,d4
  6043.         cmp.b   #' ',0(a1,d4)
  6044.         bne.s   404$
  6045. 405$        cmp.w   ibufferlen(a4),d4
  6046.         bge.s   421$
  6047.         addq    #1,d4
  6048.         cmp.b   #' ',0(a1,d4)
  6049.         beq.s   405$
  6050.         bra.s   421$
  6051.  
  6052. 403$        cmp.b   #'A',2(a2)          ;shift left
  6053.         bne.s   420$
  6054. 406$        tst.w   d4
  6055.         beq.s   421$
  6056.         subq    #1,d4
  6057.         cmp.b   #' ',0(a1,d4)
  6058.         beq.s   406$
  6059. 407$        tst.w   d4
  6060.         beq.s   421$
  6061.         subq    #1,d4
  6062.         cmp.b   #' ',0(a1,d4)
  6063.         bne.s   407$
  6064.         addq    #1,d4
  6065.         bra.s   421$
  6066.  
  6067. 402$        cmp.b   #'A',1(a2)          ;cursor up
  6068.         bne.s   408$
  6069.         tst.w   bottomin(a4)
  6070.         bne.s   480$
  6071.         tst.w   curpos(a4)
  6072.         bne.s   480$
  6073.  
  6074.         clr.w   curpos(a4)
  6075.         clr.w   ibufferlen(a4)
  6076.         bsr     UpdateIArea
  6077.         bsr     clrcursor
  6078.         move.w  edline(a4),d3
  6079.         ext.l   d3
  6080.         tst.w   d3
  6081.         beq.s   481$
  6082.         subq    #1,d3
  6083.         cmp.l   firstline(a4),d3
  6084.         bge.s   481$
  6085.         move.l  d3,-(a7)
  6086.         subq.l  #1,firstline(a4)
  6087.         bsr     blastout
  6088.         move.l  (a7)+,d3
  6089. 481$        move.w  d3,edline(a4)
  6090.         bsr     getcurpos
  6091.         bsr     putcursor
  6092.         bra     intuiend
  6093. 480$        move.l  history(a4),a0
  6094.         tst.l   0(a0)
  6095.         beq.s   423$
  6096.         move.l  curhist(a4),a1
  6097.         cmp.l   a0,a1
  6098.         beq.s   409$
  6099.         move.l  4(a1),d0
  6100.         move.l  d0,curhist(a4)
  6101. 409$        move.l  a1,gothline(a4)
  6102.         bsr     copyhistory
  6103. 423$        bra     100$
  6104.  
  6105. 408$        cmp.b   #'B',1(a2)          ;cursor down
  6106.         bne     410$
  6107.         tst.w   bottomin(a4)
  6108.         bne.s   414$
  6109.         tst.w   curpos(a4)
  6110.         bne.s   414$
  6111.  
  6112.         clr.w   curpos(a4)
  6113.         clr.w   ibufferlen(a4)
  6114.         bsr     UpdateIArea
  6115.         bsr     clrcursor
  6116.         move.w  edline(a4),d3
  6117.         ext.l   d3
  6118.         move.l  numlines(a4),d4
  6119.         subq    #1,d4
  6120.         cmp.l   d4,d3
  6121.         beq.s   490$
  6122.         move.l  firstline(a4),d2
  6123.         add.w   rows(a4),d2
  6124.         subq    #1,d2
  6125.         addq    #1,d3
  6126.         cmp.w   d2,d3
  6127.         ble.s   490$
  6128.         move.l  d3,-(a7)
  6129.         addq.l  #1,firstline(a4)
  6130.         bsr     blastout
  6131.         move.l  (a7)+,d3
  6132. 490$        bra     481$
  6133. 414$        move.l  curhist(a4),d0
  6134.         beq.s   423$
  6135.         move.l  d0,a1
  6136.         move.l  0(a1),a1
  6137.         tst.l   0(a1)
  6138.         bne.s   411$
  6139.         clr.l   gothline(a4)
  6140.         clr.w   curpos(a4)
  6141.         clr.w   ibufferlen(a4)
  6142.         bra     423$
  6143. 411$        move.l  a1,curhist(a4)
  6144.         bra     409$
  6145.  
  6146. 410$        cmp.b   #'T',1(a2)          ;shift up
  6147.         bne.s   412$
  6148.         tst.w   hnum(a4)
  6149.         beq     423$
  6150.         move.l  history(a4),a1
  6151.         move.l  a1,curhist(a4)
  6152.         bra     409$
  6153.  
  6154. 412$        cmp.b   #'S',1(a2)          ;shift down
  6155.         bne.s   440$
  6156.         tst.w   hnum(a4)
  6157.         beq     423$
  6158.         move.l  history+8(a4),curhist(a4)
  6159.         bra.s   414$
  6160.  
  6161. 440$        cmp.b   #'0',1(a2)          ;function keys
  6162.         bmi     423$
  6163.         cmp.b   #'9',1(a2)
  6164.         bgt     423$
  6165.         lea     1(a2),a0
  6166.         bsr     getnum
  6167.         lea     fkeys(a4),a0
  6168. 441$        move.l  0(a0),a0
  6169.         tst.l   0(a0)
  6170.         beq     100$
  6171.         cmp.b   8(a0),d2
  6172.         bne.s   441$
  6173.  
  6174.         move.b  9(a0),d5
  6175.         ext.w   d5
  6176.         subq    #1,d5
  6177.         lea     10(a0),a0
  6178.         move.w  curpos(a4),d4
  6179.         lea     inputbuffer,a2
  6180.         moveq   #0,d3
  6181.         lea     0(a2,d4),a2
  6182. 445$        move.b  (a0)+,d0
  6183.         cmp.b   #'^',d0
  6184.         bne.s   442$
  6185.         moveq   #1,d3
  6186.         bra.s   443$
  6187. 442$        cmp.b   #'_',d0
  6188.         bne.s   444$
  6189.         move.b  #' ',d0
  6190. 444$        move.b  d0,(a2)+
  6191.         addq    #1,d4
  6192. 443$        dbf     d5,445$
  6193.         move.w  d4,curpos(a4)
  6194.         cmp.w   ibufferlen(a4),d4
  6195.         ble.s   446$
  6196.         move.w  d4,ibufferlen(a4)
  6197. 446$        tst     d3
  6198.         beq     100$
  6199.         bra     got_fkey
  6200.  
  6201. 110$        moveq   #0,d3
  6202. 101$        move.w  curpos(a4),d4
  6203.         tst     d0
  6204.         beq     100$
  6205.         cmp.b   #13,0(a2,d3)        ;return
  6206.         beq     got_enter
  6207.  
  6208.         cmp.b   #27,0(a2,d3)        ;esc
  6209.         bne     799$
  6210.         tst.w   getanswer(a4)
  6211.         bne     100$
  6212.         clr.b   insmode(a4)
  6213.         clr.w   ibufferlen(a4)
  6214.         move.w  #200,curpos(a4)
  6215.         bsr     UpdateIArea
  6216.         clr.w   curpos(a4)
  6217.         tst.w   bottomin(a4)
  6218.         bne.s   700$
  6219.         move.w  #1,bottomin(a4)
  6220.         bsr     getcurpos
  6221.         cmp.b   #5,timerstate(a4)
  6222.         bne.s   765$
  6223.         bsr     starttimer
  6224. 765$        bra     100$
  6225.  
  6226. 700$        move.b  timerio+8,timerstate(a4)
  6227.         bsr     stoptimer
  6228.         move.w  edline(a4),d0
  6229.         move.l  firstline(a4),d4
  6230.         cmp.w   d4,d0
  6231.         bmi.s   701$
  6232.         move.w  d4,d5
  6233.         add.w   rows(a4),d5
  6234.         cmp.w   d5,d0
  6235.         bmi.s   702$
  6236. 701$        move.w  rows(a4),d0
  6237.         lsr.w   #1,d0
  6238.         add.w   d4,d0
  6239. 702$        move.l  numlines(a4),d3
  6240.         subq    #1,d3
  6241.         cmp.w   d3,d0
  6242.         ble.s   703$
  6243.         move.w  d3,d0
  6244. 703$        move.w  d0,edline(a4)
  6245.         sub.w   d4,d0
  6246.         lsl.w   #3,d0
  6247.         add.w   #18,d0
  6248.         move.w  d0,cposy(a4)
  6249.         clr.w   bottomin(a4)
  6250.         tst.w   loffset(a4)
  6251.         beq.s   704$
  6252.         clr.w   loffset(a4)
  6253.         bsr     blastout
  6254. 704$        bra     100$
  6255.  
  6256. 799$        cmp.b   #8,0(a2,d3)         ;Backspace
  6257.         bne.s   114$
  6258.         tst.w   d4
  6259.         beq     102$
  6260.         bsr     delchar
  6261.         subq    #1,d4
  6262.         move.w  d4,curpos(a4)
  6263.         bra     102$
  6264.  
  6265. 114$        cmp.b   #127,0(a2,d3)       ;del
  6266.         bne.s   150$
  6267. 178$        cmp.w   ibufferlen(a4),d4
  6268.         bge     102$
  6269.         addq    #1,d4
  6270.         bsr     delchar
  6271.         bra     102$
  6272.  
  6273. 150$        cmp.b   #9,0(a2,d3)         ;tab
  6274.         bne     197$
  6275.         move.w  cmdcompflag(a4),d0
  6276.         bpl.s   151$
  6277.         lea     inputbuffer,a0
  6278.         move.w  ibufferlen(a4),d0
  6279.         bsr     tolower
  6280.         move.w  curpos(a4),cmdcomplen(a4)
  6281. 151$        move.w  #1,cmdcompflag(a4)
  6282. 155$        move.w  cmdcompnr(a4),d0
  6283.         bsr     getcmdptr
  6284.         move.l  d0,a0
  6285.         move.w  cmdcomplen(a4),d4
  6286.         lea     inputbuffer,a1
  6287.         subq    #1,d4
  6288. 152$        tst.b   0(a0)
  6289.         beq.s   153$
  6290.         cmp.b   (a0)+,(a1)+
  6291.         bne.s   153$
  6292.         dbf     d4,152$
  6293.         move.l  d0,a1
  6294.         lea     inputbuffer,a0
  6295. 154$        move.b  (a1)+,(a0)+
  6296.         dbeq.s  d4,154$
  6297.         neg.w   d4
  6298.         subq    #1,d4
  6299.         move.w  d4,curpos(a4)
  6300.         move.w  d4,ibufferlen(a4)
  6301.         add.w   #1,cmdcompnr(a4)
  6302.         cmp.w   #cmdnum,cmdcompnr(a4)
  6303.         beq.s   156$
  6304.         bra     100$
  6305. 153$        move.w  cmdcompnr(a4),d0
  6306.         addq    #1,d0
  6307.         move.w  d0,cmdcompnr(a4)
  6308.         cmp.w   #cmdnum,d0
  6309.         bmi.s   155$
  6310. 156$        clr.w   cmdcompnr(a4)
  6311.         bra     100$
  6312.  
  6313. 197$        cmp.b   #3,0(a2,d3)         ;ctrl c
  6314.         bne.s   104$
  6315.         move.b  #1,cbreak(a4)
  6316.  
  6317. 104$        tst.b   addlines(a4)
  6318.         bne     processnxtmsg
  6319.         cmp.b   #$18,0(a2,d3)       ;ctrl x
  6320.         bne.s   300$
  6321.         clr.w   ibufferlen(a4)
  6322.         clr.w   curpos(a4)
  6323.         bra     100$
  6324.  
  6325. 300$        cmp.b   #$19,0(a2,d3)       ;ctrl y
  6326.         bne.s   106$
  6327.         move.w  curpos(a4),ibufferlen(a4)
  6328.         bra     100$
  6329.  
  6330. 106$        move.w  #$100,d5        ;NumPad
  6331.         and.w   qualifier(a4),d5
  6332.         beq     105$
  6333.         move.l  firstline(a4),d5
  6334.  
  6335.         cmp.b   #'7',0(a2,d3)       ;'Home'
  6336.         bne.s   200$
  6337.         moveq   #0,d5
  6338. 199$        cmp.l   firstline(a4),d5
  6339.         beq.s   196$
  6340.         move.l  d5,firstline(a4)
  6341.         bsr     blastout
  6342.         tst.w   bottomin(a4)
  6343.         bne.s   196$
  6344.         move.w  edline(a4),d0
  6345.         move.l  firstline(a4),d1
  6346.         cmp.w   d1,d0
  6347.         bmi.s   190$
  6348.         add.w   rows(a4),d1
  6349.         cmp.w   d1,d0
  6350.         bmi.s   192$
  6351. 190$        clr.w   curpos(a4)
  6352.         clr.w   ibufferlen(a4)
  6353.         move.w  rows(a4),d0
  6354.         lsr.w   #1,d0
  6355.         ext.l   d0
  6356.         add.l   firstline(a4),d0
  6357.         cmp.l   numlines(a4),d0
  6358.         bmi.s   191$
  6359.         move.l  numlines(a4),d0
  6360.         subq    #1,d0
  6361. 191$        move.w  d0,edline(a4)
  6362. 192$        bsr     getcurpos
  6363.         bsr     UpdateIArea
  6364. 196$        bra     100$
  6365.  
  6366. 200$        cmp.b   #'8',0(a2,d3)       ;'up arrow'
  6367.         bne.s   201$
  6368.         tst     d5
  6369.         beq     100$
  6370.         subq    #1,d5
  6371. 1990$        bra.s   199$
  6372.  
  6373. 201$        cmp.b   #'9',0(a2,d3)       ;'PgUp'
  6374.         bne.s   203$
  6375.         sub.w   rows(a4),d5
  6376.         bpl.s   1990$
  6377.         moveq   #0,d5
  6378.         bra.s   1990$
  6379.  
  6380. 203$        cmp.b   #'1',0(a2,d3)       ;'End'
  6381.         bne.s   205$
  6382. 222$        move.l  numlines(a4),d5
  6383.         sub.w   rows(a4),d5
  6384.         bpl     199$
  6385.         moveq   #0,d5
  6386. 204$        bra     199$
  6387.  
  6388. 205$        cmp.b   #'2',0(a2,d3)       ;'down arrow'
  6389.         bne.s   206$
  6390.         move.l  d5,d2
  6391.         add.w   rows(a4),d2
  6392.         cmp.l   numlines(a4),d2
  6393.         bge     100$
  6394.         addq    #1,d5
  6395.         bra     199$
  6396.  
  6397. 206$        cmp.b   #'3',0(a2,d3)       ;'PgDn'
  6398.         bne.s   500$
  6399.         add.w   rows(a4),d5
  6400.         move.l  d5,d2
  6401.         add.w   rows(a4),d2
  6402.         cmp.l   numlines(a4),d2
  6403.         bge.s   222$
  6404.         bra     199$
  6405.  
  6406. 500$        cmp.b   #'4',0(a2,d3)       ;left arrow
  6407.         bne.s   501$
  6408.         tst.w   bottomin(a4)
  6409.         beq     102$
  6410.         move.w  loffset(a4),d2
  6411.         sub.w   colms(a4),d2
  6412.         bpl.s   502$
  6413.         moveq   #0,d2
  6414. 502$        move.w  d2,loffset(a4)
  6415.         bsr     blastout
  6416.         bra     100$
  6417.  
  6418. 501$        cmp.b   #'6',0(a2,d3)       ;right arrow
  6419.         bne.s   170$
  6420.         tst.w   bottomin(a4)
  6421.         beq     102$
  6422.         move.w  loffset(a4),d2
  6423.         add.w   colms(a4),d2
  6424.         bra.s   502$
  6425.  
  6426. 170$        cmp.b   #'0',0(a2,d3)       ;Ins
  6427.         bne.s   177$
  6428.         bchg.b  #0,insmode(a4)
  6429.         bra.s   102$
  6430.  
  6431. 177$        cmp.b   #'.',0(a2,d3)       ;Del
  6432.         beq     178$
  6433.  
  6434. 105$        tst.w   bottomin(a4)
  6435.         bne.s   777$
  6436.         tst.w   curpos(a4)
  6437.         bne.s   777$
  6438.         movem.l d0-d1,-(a7)
  6439.         move.w  edline(a4),d0
  6440.         bsr     findline
  6441.         movem.l (a7)+,d0-d1
  6442.         tst.l   8(a5)
  6443.         beq     intuiend
  6444. 777$        move.w  curpos(a4),d5
  6445.         ext.l   d5
  6446.         moveq   #79,d2
  6447.         cmp.w   d2,d5
  6448.         bge     102$
  6449.         tst.b   insmode(a4)
  6450.         beq.s   172$
  6451.         cmp.w   ibufferlen(a4),d5
  6452.         bmi.s   171$
  6453.         bra.s   173$
  6454. 172$        sub     d5,d2
  6455.         lea     80(a1),a5
  6456.         lea     79(a1),a3
  6457. 103$        move.b  -(a3),-(a5)
  6458.         dbf     d2,103$
  6459. 173$        addq.w  #1,ibufferlen(a4)
  6460. 171$        move.b  0(a2,d3),0(a1,d5)
  6461.         addq.w  #1,curpos(a4)
  6462. 102$        subq    #1,d0
  6463.         addq    #1,d3
  6464.         bra     101$
  6465.  
  6466. 100$        bsr     UpdateIArea
  6467.         bra     intuiend
  6468.  
  6469. got_enter   bsr     puthist
  6470. got_fkey    bsr     stoptimer
  6471.         clr.b   insmode(a4)
  6472.         lea     dummy,a1
  6473.         lea     inputbuffer,a2
  6474.         move.w  ibufferlen(a4),d2
  6475.         beq.s   2$
  6476.         tst.w   bottomin(a4)
  6477.         bne.s   5$
  6478.         movem.l a1-a2,-(a7)
  6479.         move.w  edline(a4),d0
  6480.         bsr     findline
  6481.         move.l  8(a5),d0
  6482.         bsr     gthex
  6483.         lea     hexarea(a4),a0
  6484.         lea     0(a2,d2),a1
  6485.         move.b  #' ',(a1)+
  6486.         move.b  #'$',(a1)+
  6487.         moveq   #8,d0
  6488.         CALL    CopyMem,SysBase(a4)
  6489.         move.w  ibufferlen(a4),d2
  6490.         add.w   #10,d2
  6491.         move.w  d2,ibufferlen(a4)
  6492.         movem.l (a7)+,a1-a2
  6493. 5$        subq    #1,d2
  6494. 1$        move.b  (a2)+,(a1)+
  6495.         dbf     d2,1$
  6496. 2$        move.b  #10,(a1)+
  6497.         move.w  ibufferlen(a4),d0
  6498.         ext.l   d0
  6499.         addq    #1,d0
  6500.         move.l  d0,-(a7)
  6501.         clr.w   ibufferlen(a4)
  6502.         tst.w   bottomin(a4)
  6503.         bne.s   4$
  6504.         move.w  #100,curpos(a4)
  6505.         bsr     UpdateIArea
  6506. 4$        clr.w   curpos(a4)
  6507.         move.w  #1,bottomin(a4)
  6508.         bsr     getcurpos
  6509.         bsr     UpdateIArea
  6510.         move.l  (a7)+,d0
  6511.         move.w  d0,repeatlen(a4)
  6512.         clr.w   repeat(a4)
  6513.         clr.b   printed(a4)
  6514.         tst.w   getanswer(a4)
  6515.         beq.s   6$
  6516.         rts
  6517. 6$        bsr     cli
  6518.         tst.b   printed(a4)
  6519.         bne.s   3$
  6520.         bsr     starttimer
  6521. 3$        bra     intuiend
  6522.  
  6523. notarawkey
  6524.  
  6525. intuiend    bsr.s   replyintui
  6526.         bra     nextimsg
  6527. processnxtmsg
  6528.         tst.b   addlines(a4)
  6529.         beq.s   1$
  6530.         rts
  6531. 1$        tst.b   propupdate(a4)
  6532.         beq.s   2$
  6533.         clr.b   propupdate(a4)
  6534.         tst.b   propgadon(a4)
  6535.         beq.s   2$
  6536.         jsr     setprop
  6537. 2$        bra     processmsgs
  6538.  
  6539. replyintui  move.l  intuimsg(a4),d0
  6540.         beq.s   1$
  6541.         move.l  d0,a1
  6542.         CALL    ReplyMsg,SysBase(a4)
  6543. 1$        clr.l   intuimsg(a4)
  6544.         rts
  6545.  
  6546. ;put an input line into the history buffer
  6547. puthist     move.w  ibufferlen(a4),d5
  6548.         move.l  d5,d0
  6549.         cmp.w   minnumchars(a4),d0
  6550.         bcs     1$
  6551.  
  6552.         move.l  gothline(a4),d1
  6553.         beq.s   5$
  6554.         move.l  d1,a2
  6555.         cmp.w   8(a2),d5
  6556.         bne.s   5$
  6557.         lea     10(a2),a2
  6558.         lea     inputbuffer,a1
  6559.         subq    #1,d0
  6560. 6$        cmp.b   (a2)+,(a1)+
  6561.         bne.s   5$
  6562.         dbf     d0,6$
  6563.         move.l  gothline(a4),curhist(a4)
  6564.         bra.s   1$
  6565.  
  6566. 5$        move.w  d5,d0
  6567.         ext.l   d0
  6568.         add     #10,d0
  6569.         move.l  #$10000,d1         ;MEMF_CLEAR
  6570.         CALL    AllocMem,SysBase(a4)
  6571.         tst.l   d0
  6572.         beq.s   1$
  6573.         move.l  d0,a0
  6574.         move.w  d5,8(a0)
  6575.         lea     10(a0),a2
  6576.         subq    #1,d5
  6577.         lea     inputbuffer,a1
  6578. 2$        move.b  (a1)+,(a2)+
  6579.         dbf     d5,2$
  6580.         move.w  hnum(a4),d5
  6581.         cmp.w   maxhlines(a4),d5
  6582.         bmi.s   3$
  6583.         bsr     remhistline
  6584.         bra.s   4$
  6585. 3$        addq    #1,d5
  6586.         move.w  d5,hnum(a4)
  6587. 4$        move.l  d0,a1
  6588.         move.l  d0,curhist(a4)
  6589.         lea     history(a4),a0
  6590.         CALL    AddTail,SysBase(a4)
  6591. 1$        clr.l   gothline(a4)
  6592.         rts
  6593.  
  6594. ;copy a history line into the input buffer
  6595. copyhistory lea     inputbuffer,a0
  6596.         move.w  8(a1),d3
  6597.         ext.l   d3
  6598.         move.w  d3,curpos(a4)
  6599.         move.w  d3,ibufferlen(a4)
  6600.         subq    #1,d3
  6601.         lea     10(a1),a1
  6602. 1$        move.b  (a1)+,(a0)+
  6603.         dbf     d3,1$
  6604.         rts
  6605. ;remove one line from the history buffer
  6606. ;pointer to the line in A1, returns pointer to the next line in d1
  6607. remhistline move.l  d0,-(a7)
  6608.         lea     history(a4),a0
  6609.         move.l  0(a0),a5
  6610.         tst.l   0(a5)
  6611.         beq.s   1$
  6612.         CALL    RemHead,SysBase(a4)
  6613.         move.l  a5,a1
  6614.         move.w  8(a1),d0
  6615.         add     #10,d0
  6616.         ext.l   d0
  6617.         CALL    FreeMem,SysBase(a4)
  6618. 1$        move.l  (a7)+,d0
  6619.         rts
  6620.  
  6621. ;kill all history lines
  6622. killhistory bsr     remhistline
  6623.         move.l  history(a4),a0
  6624.         tst.l   0(a0)
  6625.         bne.s   killhistory
  6626. 2$        clr.w   hnum(a4)
  6627.         clr.l   curhist(a4)
  6628.         rts
  6629. ;delete one char from the input line
  6630. delchar     lea     inputbuffer,a3
  6631.         lea     0(a3,d4.w),a3
  6632.         lea     -1(a3),a5
  6633.         move    d4,d5
  6634. 1$        cmp.w   #78,d5
  6635.         bge.s   2$
  6636.         move.b  (a3)+,(a5)+
  6637.         addq    #1,d5
  6638.         bra.s   1$
  6639. 2$        subq.w  #1,ibufferlen(a4)
  6640.         rts
  6641.  
  6642. testsig     move.l  tasksigs(a4),d0
  6643.         btst    d1,d0
  6644.         rts
  6645.  
  6646. ;get the position of the input area
  6647. iareapos    move.l  wnptr(a4),a0
  6648.         move.w  10(a0),d0
  6649.         subq    #4,d0
  6650.         move.w  d0,ipos(a4)
  6651.         rts
  6652.  
  6653. ;Update the current position of the input line
  6654. getcurpos   tst.w   bottomin(a4)
  6655.         beq.s   1$
  6656.         move.w  ipos(a4),cposy(a4)
  6657.         rts
  6658. 1$        move.w  edline(a4),d3
  6659.         sub.l   firstline(a4),d3
  6660.         lsl     #3,d3
  6661.         add.w   #18,d3
  6662.         move.w  d3,cposy(a4)
  6663.         rts
  6664. ;refresh the input area
  6665. UpdateIArea move.l  rastport(a4),a1
  6666.         move.l  #1,d0
  6667.         CALL    SetDrMd,gfxbase(a4)
  6668.         moveq   #6,d0
  6669.         move.w  cposy(a4),d1
  6670.         move.l  rastport(a4),a1
  6671.         CALL    Move,gfxbase(a4)
  6672.         lea     inputbuffer,a0
  6673.         move.w  ibufferlen(a4),d0
  6674.         ext.l   d0
  6675.         move.w  colms(a4),d1
  6676.         sub.w   bottomin(a4),d1
  6677.         cmp.w   d1,d0
  6678.         bmi.s   1$
  6679.         move.w  d1,d0
  6680. 1$        move.w  d0,d2
  6681.         move.l  rastport(a4),a1
  6682.         CALL    Text,gfxbase(a4)
  6683.  
  6684.         tst.w   bottomin(a4)
  6685.         bne.s   3$
  6686.         move.w  edline(a4),d0
  6687.         bsr     findline
  6688.         move.w  12(a5),d3
  6689.         sub.w   d2,d3
  6690.         bmi.s   3$
  6691.         move.w  colms(a4),d1
  6692.         sub.w   d2,d1
  6693.         bmi.s   2$
  6694.         cmp.w   d1,d3
  6695.         ble.s   4$
  6696.         move.w  d1,d3
  6697. 4$        move.w  d3,d0
  6698.         lea     14(a5,d2.w),a0
  6699.         move.l  rastport(a4),a1
  6700.         CALL    Text,gfxbase(a4)
  6701.         add.w   ibufferlen(a4),d3
  6702.         move.w  d3,d2
  6703.  
  6704. 3$        move.w  colms(a4),d0
  6705.         sub.w   bottomin(a4),d0
  6706.         move.l  blanks(a4),a0
  6707.         ext.l   d0
  6708.         sub.w   d2,d0
  6709.         bmi.s   2$
  6710.         lea     0(a0,d2.w),a0
  6711.         move.l  rastport(a4),a1
  6712.         CALL    Text,gfxbase(a4)
  6713. 2$        bsr     putcursor
  6714.         rts
  6715.  
  6716. clrcursor   moveq   #1,d7
  6717.         bra.s   ptc1
  6718. putcursor   moveq   #6,d7
  6719. ptc1        move.w  curpos(a4),d0
  6720.         move.w  colms(a4),d1
  6721.         subq    #1,d1
  6722.         sub.w   bottomin(a4),d1
  6723.         cmp.w   d0,d1
  6724.         bmi.s   1$
  6725.         move.l  rastport(a4),a1
  6726.         move.l  d7,d0
  6727.         CALL    SetDrMd,gfxbase(a4)
  6728.         move.w  cposy(a4),d1
  6729.         move.w  curpos(a4),d0
  6730.         lsl.w   #3,d0
  6731.         addq    #6,d0
  6732.         move.l  rastport(a4),a1
  6733.         CALL    Move,gfxbase(a4)
  6734.         lea     oneblank(a4),a0
  6735.         moveq   #1,d0
  6736.         move.l  rastport(a4),a1
  6737.         CALL    Text,gfxbase(a4)
  6738. 1$        rts
  6739. ;rebuild the window from scratch
  6740. setupscreen move.l  rastport(a4),a1
  6741.         moveq   #0,d0
  6742.         CALL    SetRast,gfxbase(a4)
  6743.         move.l  wnptr(a4),a0
  6744.         CALL    RefreshWindowFrame,intuibase(a4)
  6745.         bsr     getwindowsize
  6746.         tst.w   bottomin(a4)
  6747.         bne.s   1$
  6748.         move.w  edline(a4),d0
  6749.         move.l  firstline(a4),d1
  6750.         move.w  rows(a4),d2
  6751.         move.w  d2,d4
  6752.         move.w  numlines(a4),d3
  6753.         add.w   d1,d2
  6754.         cmp.w   d2,d0
  6755.         bmi.s   2$
  6756.         lsr.w   #1,d4
  6757.         sub.w   d4,d0
  6758.         ext.l   d0
  6759.         move.l  d0,firstline(a4)
  6760. 2$        bsr     tstfirstlin
  6761. 1$        bsr     getcurpos
  6762.         bsr     putiline
  6763.         bsr     blastout
  6764.         bsr     UpdateIArea
  6765.         move.w  rows(a4),currenty(a4)
  6766.         rts
  6767.  
  6768. putiline    move.l  rastport(a4),a1
  6769.         clr.l   devicelock(a4)
  6770.         moveq   #1,d0
  6771. 0$        CALL    SetAPen,gfxbase(a4)
  6772.         move.l  rastport(a4),a1
  6773.         moveq   #1,d0
  6774.         CALL    SetDrMd,gfxbase(a4)
  6775.         move.l  wnptr(a4),a5
  6776.         move.w  10(a5),d1
  6777.         sub.w   #12,d1
  6778.         sub.l   devicelock(a4),d1
  6779.         moveq   #0,d0
  6780.         move.l  rastport(a4),a1
  6781.         CALL    Move,gfxbase(a4)
  6782.         move.w  8(a5),d0
  6783.         move.w  d1,-(a7)
  6784.         move.l  rastport(a4),a1
  6785.         CALL    Draw,gfxbase(a4)
  6786.         move.w  (a7)+,d1
  6787.         tst.b   ownscreen(a4)
  6788.         bne.s   1$
  6789.         tst.b   post_V34(a4)
  6790.         beq.s   2$
  6791.         tst.l   devicelock(a4)
  6792.         bne.s   1$
  6793.         addq.l  #1,devicelock(a4)
  6794.         moveq   #2,d0
  6795.         bra.s   0$
  6796.  
  6797. 2$        move.w  8(a5),d0
  6798.         addq    #1,d1
  6799.         move.l  rastport(a4),a1
  6800.         CALL    Move,gfxbase(a4)
  6801.         sub.w   #16,d0
  6802.         move.w  d1,-(a7)
  6803.         move.l  rastport(a4),a1
  6804.         CALL    Draw,gfxbase(a4)
  6805.         move.w  (a7)+,d1
  6806.         move.w  8(a5),d0
  6807.         addq    #1,d1
  6808.         move.l  rastport(a4),a1
  6809.         CALL    Move,gfxbase(a4)
  6810.         sub.w   #16,d0
  6811.         move.l  rastport(a4),a1
  6812.         CALL    Draw,gfxbase(a4)
  6813. 1$        rts
  6814.  
  6815. getwindowsize
  6816.         bsr     freeblank
  6817.         move.l  wnptr(a4),a0
  6818.         move.w  10(a0),d0
  6819.         sub.w   #26,d0
  6820.         lsr.w   #3,d0
  6821.         move.w  d0,rows(a4)
  6822.         move.w  8(a0),d0
  6823.         sub.w   #12,d0
  6824.         move.b  post_V34(a4),d1
  6825.         ext.w   d1
  6826.         sub.w   d1,d0
  6827.         lsr.w   #3,d0
  6828.         sub.b   propgadon(a4),d0
  6829.         sub.w   d1,d0
  6830.         move.w  d0,colms(a4)
  6831.         ext.l   d0
  6832.         moveq   #0,d1
  6833.         move.l  d0,d6
  6834.         CALL    AllocMem,SysBase(a4)
  6835.         move.l  d0,blanks(a4)
  6836.         move.l  d0,a0
  6837.         subq    #1,d6
  6838. 1$        move.b  #' ',(a0)+
  6839.         dbf     d6,1$
  6840.         bsr     iareapos
  6841.         rts
  6842.  
  6843. readline    move.b  #'n',inputbuffer
  6844.         tst.b   fromfile(a4)
  6845.         bne.s   1$
  6846.         move.l  #31000,firstline(a4)
  6847.         bsr     blastout
  6848.         move.w  #1,getanswer(a4)
  6849.         bsr     replyintui
  6850. 5$        bsr     processmsgs
  6851.         move.w  d0,d5
  6852.         bsr     replyintui
  6853.         subq    #1,d5
  6854.         beq.s   5$
  6855.         ori.b   #$20,inputbuffer
  6856.         clr.w   getanswer(a4)
  6857.         bsr     RestoreOutput
  6858. 1$        rts
  6859.  
  6860. ResumeOutput
  6861.         move.l  outchain(a4),d0
  6862.         move.l  d0,a1
  6863.         beq.s   2$
  6864.         move.l  numlines(a4),oldnumlines(a4)
  6865.         move.l  firstline(a4),oldfirstline(a4)
  6866. 4$        tst.l   0(a1)
  6867.         beq.s   3$
  6868.         move.l  0(a1),a1
  6869.         bra.s   4$
  6870. 3$        move.l  a1,lastprinted(a4)
  6871. 2$        move.l  a1,oldpageend(a4)
  6872.         rts
  6873.  
  6874. RestoreOutput
  6875.         move.l  oldpageend(a4),d3
  6876.         beq.s   1$
  6877.         move.l  oldnumlines(a4),numlines(a4)
  6878.         move.l  oldfirstline(a4),firstline(a4)
  6879.         move.l  oldlastprinted(a4),lastprinted(a4)
  6880.         move.l  d3,a1
  6881.         move.l  0(a1),a1
  6882.         bsr     killlines
  6883.         move.l  d3,a1
  6884.         clr.l   0(a1)
  6885.         bsr     blastout
  6886. 1$        rts
  6887.  
  6888. addline     movem.l d0-d6/a0-a3,-(a7)
  6889.         move.l  rastport(a4),a1
  6890.         moveq   #1,d0
  6891.         CALL    SetAPen,gfxbase(a4)
  6892.         move.l  rastport(a4),a1
  6893.         moveq   #1,d0
  6894.         CALL    SetDrMd,gfxbase(a4)
  6895.         move.w  currenty(a4),d6
  6896.         cmp.w   rows(a4),d6
  6897.         bmi.s   1$
  6898.         bsr     cls
  6899. 1$        move.l  lastprinted(a4),a0
  6900.         move.w  colms(a4),d5
  6901.         move.w  12(a0),d3
  6902.         lea     14(a0),a0
  6903.         move.w  currenty(a4),d6
  6904.         move    d6,d7
  6905.         lsl     #3,d6
  6906.         add.w   #18,d6
  6907.         moveq   #0,d4
  6908.         bsr     blastline
  6909.         addq.w  #1,currenty(a4)
  6910.         move.l  #31000,firstline(a4)
  6911.         movem.l (a7)+,d0-d6/a0-a3
  6912.         rts
  6913.  
  6914. cls        movem.l d0-d6/a0-a3,-(a7)
  6915.         move.l  rastport(a4),a1
  6916.         moveq   #1,d0
  6917.         CALL    SetAPen,gfxbase(a4)
  6918.         move.l  rastport(a4),a1
  6919.         moveq   #1,d0
  6920.         move.l  rastport(a4),a1
  6921.         CALL    SetDrMd,gfxbase(a4)
  6922.         move.w  colms(a4),d5
  6923.         clr.w   d2
  6924. 1$        move.w  d2,d6
  6925.         move    d5,d7
  6926.         lsl     #3,d6
  6927.         add.w   #18,d6
  6928.         moveq   #0,d3
  6929.         move.l  blanks(a4),a0
  6930.         bsr     blastline
  6931.         addq    #1,d2
  6932.         cmp.w   rows(a4),d2
  6933.         bmi.s   1$
  6934.         clr.w   currenty(a4)
  6935.         movem.l (a7)+,d0-d6/a0-a3
  6936.         rts
  6937.  
  6938. createscreen moveq  #1,d1
  6939.         moveq   #80,d0
  6940.         lea     buffer,a0
  6941.         sub.l   a1,a1
  6942.         CALL    GetScreenData,intuibase(a4)
  6943.         move.w  buffer+76,nsviewmode(a4)
  6944.         move.l  buffer+12,nssize(a4)
  6945.         lea     newscreen(a4),a0
  6946.         CALL    OpenScreen,intuibase(a4)
  6947.         move.l  d0,screenptr(a4)
  6948.         move.l  d0,nwscreen(a4)
  6949.         move.w  #$f,nwtype(a4)
  6950.         beq.s   setupwindow
  6951.         tst.l   wnptr(a4)
  6952.         beq.s   1$
  6953.         move.l  wnptr(a4),a0
  6954.         move.l  4(a0),window_l(a4)
  6955.         move.l  8(a0),window_w(a4)
  6956.         CALL    CloseWindow,intuibase(a4)
  6957.         clr.l   intuimsg(a4)
  6958.         clr.l   wnptr(a4)
  6959. 1$        clr.l   newwindow(a4)
  6960.         move.l  buffer+12,newwindow+4(a4)
  6961.         move.l  wnscrflags(a4),nwflgs(a4)
  6962.         move.l  wnscrflags+4(a4),nwflgs+4(a4)
  6963.         move.b  #1,ownscreen(a4)
  6964.  
  6965. setupwindow tst.b   ownscreen(a4)
  6966.         bne.s   3$
  6967.         move.l  window_l(a4),newwindow(a4)
  6968.         move.l  window_w(a4),newwindow+4(a4)
  6969.         move.w  #1,nwtype(a4)
  6970.         move.l  wnnormflgs(a4),nwflgs(a4)
  6971.         move.l  wnnormflgs+4(a4),nwflgs+4(a4)
  6972. 3$        lea     newwindow(a4),a0
  6973.         CALL    OpenWindow,intuibase(a4)
  6974.         move.l  d0,wnptr(a4)
  6975.         beq     exit
  6976.         move.l  d0,a0
  6977.         move.l  50(a0),rastport(a4)    ;wn->RPort
  6978.         move.l  86(a0),a1          ;wn->UserPort
  6979.         move.b  15(a1),d1          ;MsgPort->SigBit
  6980.         ext.w   d1
  6981.         move.w  d1,intuisig(a4)
  6982.  
  6983.         tst.b   ownscreen(a4)
  6984.         bne.s   1$
  6985.         tst.b   iconifyon(a4)
  6986.         beq.s   1$
  6987.         tst.b   post_V34(a4)
  6988.         bne.s   1$
  6989.         lea     iconifgad,a1
  6990.         moveq   #0,d0
  6991.         CALL    AddGadget,intuibase(a4)
  6992. 1$        tst.b   propgadon(A4)
  6993.         beq.s   4$
  6994.         lea     sbgadget,a1
  6995.         move.l  wnptr(a4),a0
  6996.         moveq   #0,d0
  6997.         CALL    AddGadget,intuibase(a4)
  6998.  
  6999. 4$        move.l  wnptr(a4),a0
  7000.         CALL    RefreshWindowFrame,intuibase(a4)
  7001.  
  7002.         lea     tattr(a4),a0
  7003.         CALL    OpenFont,gfxbase(a4)
  7004.         tst.l   d0
  7005.         beq.s   2$
  7006.         move.l  d0,a0
  7007.         move.l  rastport(a4),a1
  7008.         CALL    SetFont,gfxbase(a4)
  7009. 2$        bsr     getwindowsize
  7010.         bsr     getcurpos
  7011.  
  7012.         bsr     putiline
  7013.         bsr     UpdateIArea
  7014.         bsr     starttimer
  7015.         bsr     showwhat
  7016.         rts
  7017.  
  7018. usescreen   tst.b   fromfile(a4)
  7019.         bne.s   1$
  7020.         tst.b   ownscreen(a4)
  7021.         bne.s   1$
  7022.         bsr     createscreen
  7023. 1$        move.b  #1,ownscreen(a4)
  7024.         rts
  7025.  
  7026. usewindow   tst.b   fromfile(a4)
  7027.         beq.s   1$
  7028.         clr.b   ownscreen(a4)
  7029.         rts
  7030. 1$        tst.b   ownscreen(a4)
  7031.         beq.s   2$
  7032.         move.l  wnptr(a4),d0
  7033.         beq.s   3$
  7034.         move.l  d0,a0
  7035.         CALL    CloseWindow,intuibase(a4)
  7036.         clr.l   wnptr(a4)
  7037.         clr.l   intuimsg(a4)
  7038. 3$        move.l  screenptr(a4),d0
  7039.         beq.s   4$
  7040.         move.l  d0,a0
  7041.         CALL    CloseScreen,intuibase(a4)
  7042.         clr.l   screenptr(a4)
  7043.         clr.b   ownscreen(a4)
  7044. 4$        bra     setupwindow
  7045. 2$        rts
  7046.  
  7047. dchange     lea     dchead(a4),a0
  7048.         bsr     puthead
  7049.         lea     tdd(a4),a1
  7050.         move.l  SysBase(a4),a0
  7051.         lea     350(a0),a0
  7052.         CALL    FindName,SysBase(a4)
  7053.         tst.l   d0
  7054.         beq     R_T_S
  7055.         move.l  d0,a2
  7056.         lea     32(a2),a2
  7057.         moveq   #0,d5
  7058. 2$        lea     4(a2),a2
  7059.         move.l  0(a2),d0
  7060.         beq     3$
  7061.         move.l  d0,a0
  7062.         lea     $18e(a0),a0
  7063.         CALL    Disable,SysBase(a4)
  7064. 5$        tst.l   0(a0)
  7065.         beq.s   6$
  7066.         move.l  0(a0),a0
  7067.         bra.s   5$
  7068. 6$        lea     -4(a0),a5
  7069.         lea     buffer+100,a3
  7070. 9$        move.l  0(a5),a5
  7071.         tst.l   0(a5)
  7072.         beq.s   11$
  7073.         move.l  a5,(a3)+
  7074.         bne.s   9$
  7075. 11$        clr.l   (a3)+
  7076.         CALL    Enable,SysBase(a4)
  7077.         lea     buffer+100,a3
  7078. 7$        move.l  (a3)+,d0
  7079.         beq.s   3$
  7080.         move.l  d0,a5
  7081.         cmp.w   #20,28(a5)
  7082.         bne.s   7$
  7083.         move.l  40(a5),a3
  7084.         move.l  a3,d0
  7085.         move.l  d0,node(a4)
  7086.         bsr     hexan
  7087.         move.l  a3,d0
  7088.         beq.s   10$
  7089.         move.l  14(a3),d0
  7090.         bsr     hexan
  7091.         move.l  18(a3),d0
  7092.         bsr     hexan
  7093. 10$        move.l  d5,d3
  7094.         or.b    #48,d3
  7095.         move.b  d3,tddrives+2(a4)
  7096.         move.w  #tddrives,d0
  7097.         bsr     putstrw
  7098.         move.l  14(a5),d0
  7099.         beq.s   8$
  7100.         move.l  d0,a0
  7101.         move.l  16(a0),d0
  7102. 8$        bsr     getaskname2
  7103.         bsr     newline
  7104.         bra.s   7$
  7105. 3$        addq    #1,d5
  7106.         cmp.w   #4,d5
  7107.         bmi     2$
  7108. R_T_S        rts
  7109.  
  7110. gettdtasks  lea     tdd(a4),a1
  7111.         move.l  SysBase(a4),a0
  7112.         lea     350(a0),a0
  7113.         CALL    FindName,SysBase(a4)
  7114.         tst.l   d0
  7115.         beq.s   2$
  7116.         move.l  d0,a3
  7117.         lea     36(a3),a3
  7118.         lea     tdtasks(a4),a5
  7119. 1$        move.l  (a3)+,d0
  7120.         beq.s   2$
  7121.         move.l  d0,a2
  7122.         move.l  16(a2),(a5)+
  7123.         bra.s   1$
  7124. 2$        rts
  7125.  
  7126. putlongascii
  7127.         movem.l d1/d2,-(a7)
  7128.         moveq   #2,d2
  7129.         move.b  d0,d1
  7130. 3$        lsr.l   #8,d0
  7131.         lsl.l   #8,d1
  7132.         move.b  d0,d1
  7133.         dbf     d2,3$
  7134.         moveq   #3,d2
  7135. 1$        move.b  d1,d0
  7136.         beq.s   4$
  7137.         bsr     putchar
  7138. 4$        lsr.l   #8,d1
  7139.         dbf     d2,1$
  7140. 2$        movem.l (a7)+,d1/d2
  7141.         rts
  7142.  
  7143. putstamp    movem.l d0-d1,-(a7)
  7144.         move.l  #3600,d1
  7145.         bsr     div
  7146.         moveq   #3,d3
  7147.         bsr     longdec
  7148.         move.l  binarea+4(a4),d0
  7149.         lsr.l   #8,d0
  7150.         bsr.s   putlongascii
  7151.         moveq   #':',d0
  7152.         bsr     putchar
  7153.         move.l  d1,d0
  7154.         moveq   #60,d1
  7155.         bsr     div
  7156.         bsr.s   write2digs
  7157.         moveq   #':',d0
  7158.         bsr     putchar
  7159.         move.l  d1,d0
  7160.         bsr     write2digs
  7161.         movem.l (a7)+,d0-d1
  7162.         rts
  7163.  
  7164. write2digs  movem.l d0-d1,-(a7)
  7165.         divu    #10,d0
  7166.         move.l  d0,d1
  7167.         or.b    #'0',d0
  7168.         bsr     putchar
  7169.         swap    d1
  7170.         or.b    #'0',d1
  7171.         move.b  d1,d0
  7172.         bsr     putchar
  7173.         movem.l (a7)+,d0-d1
  7174.         rts
  7175.  
  7176. starttasktimer
  7177.         lea     tsecs(a4),a0
  7178.         lea     tmics(a4),a1
  7179.         CALL    CurrentTime,intuibase(a4)
  7180.         bsr     getaskdat2
  7181.         move.l  tsecs(a4),d0
  7182.         lea     taskstampid,a0
  7183.         lea     taskstamps,a1
  7184.         lea     usedtime,a2
  7185.         moveq   #0,d1
  7186. 1$        subq.b  #1,d5
  7187.         bmi.s   2$
  7188.         lea     -16(a5),a5
  7189.         move.l  0(a5),(a0)+
  7190.         move.l  d0,(a1)+
  7191.         clr.l   (a2)+
  7192.         addq.w  #1,d1
  7193.         cmp.w   #128,d1
  7194.         bmi.s   1$
  7195. 2$        move.w  d1,numtaskstimed(a4)
  7196.         rts
  7197.  
  7198. longdecn    move.l  d3,-(a7)
  7199.         moveq   #3,d3
  7200.         bsr     longdec
  7201.         move.l  (a7)+,d3
  7202.         move.l  #binarea+7+dataarea,d0
  7203.         sub.l   d3,d0
  7204.         bra     putstr
  7205.  
  7206. getstackptr move.l  a1,-(a7)
  7207.         move.l  sysbase,a6
  7208.  
  7209.         move.l  d0,a1            ;original stackpointer
  7210.         moveq   #0,d0            ;offset 0 if no FPU
  7211.         btst    #4,297(a6)              ;AttnFlags FPU
  7212.         beq.s   1$                ;no FPU
  7213.  
  7214.         tst.b   (a1)                    ;NULL frame ?
  7215.         beq.s   0$                ;yes
  7216.  
  7217.         move.w  (a1),d0                 ;frame flag / format word
  7218.         lea     110(a1),a1              ;offset to fpu regs
  7219.         cmp.w   #-1,d0
  7220.         beq.s   3$
  7221.         lea     12(a1),a1               ;add 3 longs
  7222.  
  7223. 3$        moveq   #0,d0
  7224.         move.b  1(a1),d0                ;frame size
  7225.         lea     4(a1,d0),a1             ;680xx frame
  7226.         bra.s   2$
  7227.  
  7228. 0$        moveq   #4,d0            ;offset NULL frame
  7229. 1$        lea     0(a1,d0),a1             ;680xx frame
  7230.  
  7231. 2$        move.l  a1,d0
  7232.         move.l  (a7)+,a1
  7233.         rts
  7234.  
  7235.  
  7236. killidle    bra.s   killidle
  7237.  
  7238. dataarea:
  7239. dosbase     EQU *-dataarea
  7240. .dosbase    dc.l    0
  7241. intuibase   EQU *-dataarea
  7242. .intuibase  dc.l    0
  7243. gfxbase     EQU *-dataarea
  7244. .gfxbase    dc.l    0
  7245. condev        EQU *-dataarea
  7246. .condev     dc.l    0
  7247. parmtxt     EQU *-dataarea
  7248. .parmtxt    dc.l    0
  7249. infile        EQU *-dataarea
  7250. .infile     dc.l    0
  7251. ptr        EQU *-dataarea
  7252. .ptr        dc.l    0
  7253. auxsig        EQU *-dataarea
  7254. .auxsig     dc.l    0
  7255. trapsignal  EQU *-dataarea
  7256. .trapsignal dc.l    0
  7257. iostatus    EQU *-dataarea
  7258. .iostatus   dc.l    -1
  7259. devstatus   EQU *-dataarea
  7260. .devstatus  dc.l    -1
  7261. tasksigs    EQU *-dataarea
  7262. .tasksigs   dc.l    0
  7263. cancelbit   EQU *-dataarea
  7264. .cancelbit  dc.l    0
  7265. cancelbnum  EQU *-dataarea
  7266. .cancelbnum dc.l    0
  7267. SysBase    EQU *-dataarea
  7268. _SysBase    dc.l    0
  7269. InputMsg    EQU *-dataarea
  7270. .InputMsg   dc.l    0
  7271. InRequest   EQU *-dataarea
  7272. .InRequest  dc.l    0
  7273. startmess   EQU *-dataarea
  7274. .startmess  dc.l    0
  7275. savedat     EQU *-dataarea
  7276. .savedat    dc.l    0
  7277. wnptr        EQU *-dataarea
  7278. .wnptr        dc.l    0
  7279. aliaslist   EQU *-dataarea
  7280. .aliaslist  dc.l    0
  7281. screenptr   EQU *-dataarea
  7282. .screenptr  dc.l    0
  7283. intuimsg    EQU *-dataarea
  7284. .intuimsg   dc.l    0
  7285. mytask        EQU *-dataarea
  7286. .mytask     dc.l    0
  7287. wbmsg        EQU *-dataarea
  7288. .wbmsg        dc.l    0
  7289. pointer     EQU *-dataarea
  7290. .pointer    dc.l    0
  7291. replyport   EQU *-dataarea
  7292. .replyport  dc.l    0
  7293. timerport   EQU *-dataarea
  7294. .timerport  dc.l    0
  7295. finfoptr    EQU *-dataarea
  7296. .finfoptr   dc.l    0
  7297. myseg        EQU *-dataarea
  7298. .myseg        dc.l    0
  7299. dispatches  EQU *-dataarea
  7300. .dispatches dc.l    0
  7301. maxdisp     EQU *-dataarea
  7302. .maxdisp    dc.l    0
  7303. deltadisp   EQU *-dataarea
  7304. .deltadisp  dc.l    0
  7305. node        EQU *-dataarea
  7306. .node        dc.l    0
  7307. remembr     EQU *-dataarea
  7308. .remembr    dc.l    0
  7309. remembr2    EQU *-dataarea
  7310. .remembr2   dc.l    0
  7311. captask     EQU *-dataarea
  7312. .captask    dc.l    0
  7313. snoopport   EQU *-dataarea
  7314. .snoopport  dc.l    0
  7315. tasksnum    EQU *-dataarea
  7316. .tasksnum   dc.l    0
  7317. blanks        EQU *-dataarea
  7318. .blanks     dc.l    0
  7319. hidestart   EQU *-dataarea
  7320. .hidestart  dc.l    0
  7321. iocount     EQU *-dataarea
  7322. .iocount    dc.l    0
  7323. dummyinput  EQU *-dataarea
  7324. .dummyinput dc.l    0
  7325. rastport    EQU *-dataarea
  7326. .rastport   dc.l    0
  7327. outchain    EQU *-dataarea
  7328. .outchain   dc.l    0
  7329. firstline   EQU *-dataarea
  7330. .firstline  dc.l    0
  7331. oldfirstline EQU *-dataarea
  7332. .oldfirstline dc.l   0
  7333. timeoutm    EQU *-dataarea
  7334. .timeoutm   dc.l    0
  7335. numlines    EQU *-dataarea
  7336. .numlines   dc.l    0
  7337. oldnumlines EQU *-dataarea
  7338. .oldnumlines dc.l    0
  7339. gothline    EQU *-dataarea
  7340. .gothline   dc.l    0
  7341. lastprinted EQU *-dataarea
  7342. .lastprinted dc.l    0
  7343. oldlastprinted EQU *-dataarea
  7344. .oldlastprinted  dc.l 0
  7345. oldpageend  EQU *-dataarea
  7346. .oldpageend dc.l    0
  7347. maxlines    EQU *-dataarea
  7348. .maxlines   dc.l    500
  7349. realstack   EQU *-dataarea
  7350. .realstack  dc.l    0
  7351. capiscli    EQU *-dataarea
  7352. .capiscli   dc.l    0
  7353. capseg        EQU *-dataarea
  7354. .capseg     dc.l    0
  7355. tdtasks     EQU *-dataarea
  7356. .tdtasks    ds.l    4
  7357. idletask    EQU *-dataarea
  7358. .idletask   dc.l    0
  7359. oldswitches EQU *-dataarea
  7360. .oldswitches dc.l    0
  7361. tsecs        EQU *-dataarea
  7362. .tsecs        dc.l    0
  7363. tmics        EQU *-dataarea
  7364. .tmics        dc.l    0
  7365. devicelock  EQU *-dataarea
  7366. .devicelock dc.l    0
  7367. timerbase   EQU *-dataarea
  7368. .timerbase  dc.l    0
  7369. timerticks  EQU *-dataarea
  7370. .timerticks dc.l    0
  7371.  
  7372. wnnormflgs  EQU *-dataarea
  7373. .wnnormflgs dc.l    $646+$20+$10
  7374.         dc.l    $1104f
  7375.  
  7376. wnscrflags  EQU *-dataarea
  7377. .wnscrflags dc.l    $640+$20+$10
  7378.         dc.l    $31948
  7379.  
  7380. fkeys        EQU *-dataarea
  7381. .fkeys        dc.l    *+4
  7382.         dc.l    0
  7383.         dc.l    .fkeys
  7384.  
  7385. history     EQU *-dataarea
  7386. .history    dc.l    *+4
  7387.         dc.l    0
  7388.         dc.l    .history
  7389. curhist     EQU *-dataarea
  7390. .curhist    dc.l    0
  7391.  
  7392. secs        EQU *-dataarea
  7393. .secs        dc.l    0
  7394. mics        EQU *-dataarea
  7395. .mics        dc.l    0
  7396. time10        EQU *-dataarea
  7397. .time10     dc.l    0
  7398.  
  7399. tattr        EQU *-dataarea
  7400. .tattr        dc.l    fontname+dataarea
  7401.         dc.w    8
  7402.         dc.w    0
  7403.  
  7404. stplist     EQU *-dataarea
  7405. .stplist    dc.l    lh_tail
  7406. lh_tail     EQU *-dataarea
  7407. .lh_tail    dc.l    0
  7408.         dc.l    .stplist
  7409.         dc.b    1
  7410.         dc.b    0
  7411.  
  7412. InInterrupt EQU *-dataarea
  7413. .InInterrupt dc.l    0        ;ln_Succ
  7414.         dc.l    0        ;ln_Pred
  7415.         dc.b    2        ;ln_Type
  7416.         dc.b    60        ;ln_Pri
  7417.         dc.l    xopsleep+dataarea     ;ln_Name
  7418.         dc.l    0        ;is_Data
  7419.         dc.l    Keyhandler    ;is_Code()
  7420.  
  7421. IOCounter   EQU *-dataarea
  7422. .IOCounter  dc.l    0        ;ln_Succ
  7423.         dc.l    0        ;ln_Pred
  7424.         dc.b    2        ;ln_Type
  7425.         dc.b    -1        ;ln_Pri
  7426.         dc.l    IOcntname+dataarea     ;ln_Name
  7427.         dc.l    0        ;is_Data
  7428.         dc.l    countio    ;is_Code()
  7429.  
  7430. newwindow   EQU *-dataarea
  7431. .newwindow  dc.w    0,0
  7432.         dc.w    500,100
  7433.         dc.b    0,1
  7434. nwflgs        EQU *-dataarea
  7435. .nwflgs     dc.l    $646|$20
  7436.         dc.l    $1104f
  7437. wn_firstgad EQU *-dataarea
  7438. .wn_firstgad dc.l    0
  7439.         dc.l    0
  7440.         dc.l    windowname+dataarea
  7441. nwscreen    EQU *-dataarea
  7442. .nwscreen   dc.l    0
  7443.         dc.l    0
  7444. minwsize    EQU *-dataarea
  7445. .minwsize   dc.w    110,50
  7446.         dc.w    808,-1
  7447. nwtype        EQU *-dataarea
  7448. .nwtype     dc.w    1
  7449.  
  7450. newscreen   EQU *-dataarea
  7451. .newscreen  dc.w    0,0
  7452. nssize        EQU *-dataarea
  7453. .nssize     dc.w    0,0
  7454.         dc.w    1
  7455.         dc.b    0
  7456.         dc.b    1
  7457. nsviewmode  EQU *-dataarea
  7458. .nsviewmode dc.w    0
  7459.         dc.w    $1f
  7460.         dc.l    0
  7461.         dc.l    windowname+dataarea
  7462.         dc.l    0,0
  7463.  
  7464. excpterror  EQU *-dataarea
  7465. .excpterror dc.l    0
  7466. excpttask   EQU *-dataarea
  7467. .excpttask  dc.l    0
  7468. excptaddr   EQU *-dataarea
  7469. .excptaddr  dc.l    0
  7470. excptpc     EQU *-dataarea
  7471. .excptpc    dc.l    0
  7472.  
  7473. window_l    EQU *-dataarea
  7474. .window_l   dc.w    0
  7475. window_t    EQU *-dataarea
  7476. .window_t   dc.w    0
  7477. window_w    EQU *-dataarea
  7478. .window_w   dc.w    550
  7479. window_h    EQU *-dataarea
  7480. .window_h   dc.w    200
  7481.  
  7482. colms        EQU *-dataarea
  7483. .colms        dc.w    0
  7484. timersig    EQU *-dataarea
  7485. .timersig   dc.w    0
  7486. intuisig    EQU *-dataarea
  7487. .intuisig   dc.w    0
  7488. ibufferlen  EQU *-dataarea
  7489. .ibufferlen dc.w    0
  7490. cposy        EQU *-dataarea
  7491. .cposy        dc.w    0
  7492. curpos        EQU *-dataarea
  7493. .curpos     dc.w    0
  7494. bottomin    EQU *-dataarea
  7495. .bottomin   dc.w    1
  7496. ipos        EQU *-dataarea
  7497. .ipos        dc.w    0
  7498. hnum        EQU *-dataarea
  7499. .hnum        dc.w    0
  7500. minnumchars EQU *-dataarea
  7501. .minnumchars dc.w    2
  7502. maxhlines   EQU *-dataarea
  7503. .maxhlines  dc.w    10
  7504. qualifier   EQU *-dataarea
  7505. .qualifier  dc.w    0
  7506. rows        EQU *-dataarea
  7507. .rows        dc.w    0
  7508. maxllength  EQU *-dataarea
  7509. .maxllength dc.w    0
  7510. loffset     EQU *-dataarea
  7511. .loffset    dc.w    0
  7512. repeat        EQU *-dataarea
  7513. .repeat     dc.w    0
  7514. repeatlen   EQU *-dataarea
  7515. .repeatlen  dc.w    0
  7516. edline        EQU *-dataarea
  7517. .edline     dc.w    999
  7518. cmdptr        EQU *-dataarea
  7519. .cmdptr     dc.w    0
  7520. getanswer   EQU *-dataarea
  7521. .getanswer  dc.w    0
  7522. currenty    EQU *-dataarea
  7523. .currenty   dc.w    0
  7524. cmdcompnr   EQU *-dataarea
  7525. .cmdcompnr  dc.w    0
  7526. cmdcomplen  EQU *-dataarea
  7527. .cmdcomplen dc.w    -1
  7528. cmdcompflag EQU *-dataarea
  7529. .cmdcompflag dc.w    0
  7530. numtaskstimed EQU *-dataarea
  7531. .numtaskstimed dc.w  0
  7532. patchwhat   EQU *-dataarea
  7533. .patchwhat  dc.w    0
  7534. dosoffset   EQU *-dataarea
  7535. .dosoffset  dc.w    0
  7536.  
  7537. sampleio    EQU *-dataarea
  7538. .sampleio   ds.b    40
  7539.  
  7540. binarea     EQU *-dataarea
  7541. .binarea    dc.b    '          ',0
  7542.         EVEN
  7543. minus        EQU *-dataarea
  7544. .minus        dc.b    '  '
  7545. decimal     EQU *-dataarea
  7546. .decimal    dc.b    '    ',0
  7547. entries     EQU *-dataarea
  7548. .entries    dc.b    0
  7549. timeout     EQU *-dataarea
  7550. .timeout    dc.b    5
  7551. procnum     EQU *-dataarea
  7552. .procnum    dc.b    0
  7553. timerstate  EQU *-dataarea
  7554. .timerstate dc.b    0
  7555. running     EQU *-dataarea
  7556. .running    dc.b    0
  7557. newpri        EQU *-dataarea
  7558. .newpri     dc.b    0
  7559. tasktyp     EQU *-dataarea
  7560. .tasktyp    dc.b    0
  7561. background  EQU *-dataarea
  7562. .background dc.b    0
  7563. bool        EQU *-dataarea
  7564. .bool        dc.b    0
  7565. printed     EQU *-dataarea
  7566. .printed    dc.b    0
  7567. cbreak        EQU *-dataarea
  7568. .cbreak     dc.b    0
  7569. usageflag   EQU *-dataarea
  7570. .usageflag  dc.b    0
  7571. mnflag        EQU *-dataarea
  7572. .mnflag     dc.b    1
  7573. tports        EQU *-dataarea
  7574. .tports     dc.b    0
  7575. headon        EQU *-dataarea
  7576. .headon     dc.b    1
  7577. hideoff     EQU *-dataarea
  7578. .hideoff    dc.b    0
  7579. sorton        EQU *-dataarea
  7580. .sorton     dc.b    1
  7581. wanttraps   EQU *-dataarea
  7582. .wanttraps  dc.b    0
  7583. addlines    EQU *-dataarea
  7584. .addlines   dc.b    0
  7585. fromfile    EQU *-dataarea
  7586. .fromfile   dc.b    0
  7587. iconifyon   EQU *-dataarea
  7588. .iconifyon  dc.b    1
  7589. gotguru     EQU *-dataarea
  7590. .gotguru    dc.b    0
  7591. ownscreen   EQU *-dataarea
  7592. .ownscreen  dc.b    0
  7593. insmode     EQU *-dataarea
  7594. .insmode    dc.b    0
  7595. cmdcli        EQU *-dataarea
  7596. .cmdcli     dc.b    1
  7597. capgone     EQU *-dataarea
  7598. .capgone    dc.b    0
  7599. capwaiting  EQU *-dataarea
  7600. .capwaiting dc.b    0
  7601. tinfo        EQU *-dataarea
  7602. .tinfo        dc.b    1
  7603. cliexec     EQU *-dataarea
  7604. .cliexec    dc.b    0
  7605. propgadon   EQU *-dataarea
  7606. .propgadon  dc.b    1
  7607. propupdate  EQU *-dataarea
  7608. .propupdate dc.b    1
  7609. finfopen    EQU *-dataarea
  7610. .finfopen   dc.b    -1
  7611. post_V34    EQU *-dataarea
  7612. .post_V34   dc.b    0
  7613.  
  7614. params        EQU *-dataarea
  7615. .params     dc.b    'tfdlrempiscua'
  7616. parmnum     equ     *-dataarea-params
  7617. .parmnum    dc.b    0
  7618.  
  7619. t2header    EQU *-dataarea
  7620. .t2header   dc.b    '   ID     STATE  SIGALLOC SIGWAIT  SIGRECVD    PC    FPU  TASKNAME',0
  7621. t3header    EQU *-dataarea
  7622. .t3header   dc.b    '   ID     STATE  SIGALLOC SIGWAIT  SIGRECVD    PC    TASKNAME',0
  7623. t4header    EQU *-dataarea
  7624. .t4header   dc.b    '   ID     STATE    RUNNING    ACTIVE   NUM TASKNAME',0
  7625. theader     EQU *-dataarea
  7626. .theader    dc.b    '   ID     TYPE      STATE   PRI  CPUSE NUM TASKNAME',0
  7627. lheader     EQU *-dataarea
  7628. .lheader    dc.b    '  NODE   CNT VER REV  FLAGS    ',0
  7629. libnam        EQU *-dataarea
  7630. .libnam     dc.b    'LIBRARY NAME',0
  7631. devnam        EQU *-dataarea
  7632. .devnam     dc.b    'DEVICE NAME',0
  7633. resnam        EQU *-dataarea
  7634. .resnam     dc.b    'RESOURCE NAME',0
  7635. mheader     EQU *-dataarea
  7636. .mheader    dc.b    ' LOWER   UPPER      FREE ATTR  PRI HUNK NAME',0
  7637. cr        EQU *-dataarea
  7638. .cr        dc.b    10,0
  7639. iheader     EQU *-dataarea
  7640. .iheader    dc.b    '  NODE     DATA     CODE    PRI T S   TYPE     INTERRUPT NAME',0
  7641. inheader    EQU *-dataarea
  7642. .inheader   dc.b    '  NODE     DATA     CODE    PRI NAME',0
  7643. rheader     EQU *-dataarea
  7644. .rheader    dc.b    '  ADDR    PRI  FLAGS     VER  TYPE    RESIDENT NAME',0
  7645. pheader     EQU *-dataarea
  7646. .pheader    dc.b    '  NODE   PORTNAME        FLAGS SIGBT NUM SIGTASK',0
  7647. hunkheader  EQU *-dataarea
  7648. .hunkheader dc.b    ' NUM  BCPL    DATA     LENGTH',0
  7649. ddheader    EQU *-dataarea
  7650. .ddheader   dc.b    'DEVICE    HDS SECTORS  TRACKS BUFFERS STATE    HANDLER',0
  7651. cdheader    EQU *-dataarea
  7652. .cdheader   dc.b    'PROCESSNAME          CURRENT DIRECTORY',0
  7653. ofheader    EQU *-dataarea
  7654. .ofheader   dc.b    '  LOCK   ACCESS  SIZE   PATH/FILENAME',0
  7655. scrheader   EQU *-dataarea
  7656. .scrheader  dc.b    'NUM   ADDR      SIZE   DPTH TITLE',0
  7657. wnheader    EQU *-dataarea
  7658. .wnheader   dc.b    ' ADDR    OWNERTASK     X    Y     SIZE    TITLE',0
  7659. fohead        EQU *-dataarea
  7660. .fohead     dc.b    '  NODE   CNT  Y   X  TYPE        LO  HI NAME',0
  7661. kickhead    EQU *-dataarea
  7662. .kickhead   dc.b    'START    END      LENGTH',0
  7663. snoophead   EQU *-dataarea
  7664. .snoophead  dc.b    'ACTION REQUIREMENTS        LENGTH   FROM    TO       CALLER',0
  7665. stackhead   EQU *-dataarea
  7666. .stackhead  dc.b    'SPLower     SIZE    USED TASKNAME',0
  7667. clicomhead  EQU *-dataarea
  7668. .clicomhead dc.b    '   ID    STATE   TYPE  MODE NUM PROCESSNAME       COMMAND',0
  7669. tiohead     EQU *-dataarea
  7670. .tiohead    dc.b    'IORQUEST  UNIT        SECS   REQUESTING TASK',0
  7671. dchead        EQU *-dataarea
  7672. .dchead     dc.b    '  NODE     DATA     CODE   UNIT TASK',0
  7673. alhead        EQU *-dataarea
  7674. .alhead     dc.b    'ALIAS NAME        COMMAND',0
  7675. semhead     EQU *-dataarea
  7676. .semhead    dc.b    '  NODE   OWNER         QUEUE NEST NAME',0
  7677. fraghead    EQU *-dataarea
  7678. .fraghead   dc.b    'HEX   SIZE   DEC    COUNT  LARGEST',0
  7679. fkhead        EQU *-dataarea
  7680. .fkhead     dc.b    'KEY  STRING',0
  7681. fileshead   EQU *-dataarea
  7682. .fileshead  dc.b    '   TASK      HANDLE   MODE  FILENAME',0
  7683. tdd        EQU *-dataarea
  7684. .tdd        dc.b    'trackdisk.device',0
  7685. tddrives    EQU *-dataarea
  7686. .tddrives   dc.b    'DF : ',0
  7687. onstr        EQU *-dataarea
  7688. .onstr        dc.b    'on',0
  7689. offstr        EQU *-dataarea
  7690. .offstr     dc.b    'off',0
  7691. unitmsg     EQU *-dataarea
  7692. .unitmsg    dc.b    ' (Unit # )',0
  7693. timerunits  EQU *-dataarea
  7694. .timerunits dc.b    'MicroHz ',0
  7695.         dc.b    'VBlank  ',0
  7696. fmode        EQU *-dataarea
  7697.         dc.b    '  R/W  ',0
  7698. access        EQU *-dataarea
  7699. .access     dc.b    ' Read  ',0
  7700.         dc.b    ' Write ',0
  7701. romfnt        EQU *-dataarea
  7702. .romfnt     dc.b    'Rom  ',0
  7703. diskfnt     EQU *-dataarea
  7704. .diskfnt    dc.b    'Disk ',0
  7705. ffixed        EQU *-dataarea
  7706. .ffixed     dc.b    'Fixed ',0
  7707. fprop        EQU *-dataarea
  7708. .fprop        dc.b    'Propl ',0
  7709. status        EQU *-dataarea
  7710. .status     dc.b    'Added   ',0
  7711.         dc.b    'Running ',0
  7712.         dc.b    'Ready   ',0
  7713.         dc.b    'Waiting ',0
  7714.         dc.b    'Exeption',0
  7715.         dc.b    'Removed ',0
  7716.         dc.b    'Frozen  ',0
  7717.         dc.b    'Frozen  ',0
  7718. type        EQU *-dataarea
  7719. .type        dc.b    'Unknown   ',0
  7720. tasktype    EQU *-dataarea
  7721. .tasktype   dc.b    'Task      ',0
  7722.         dc.b    'Interrupt ',0
  7723.         dc.b    'Device    ',0
  7724.         dc.b    'Msgport   ',0
  7725.         dc.b    'Message   ',0
  7726.         dc.b    'Freemsg   ',0
  7727.         dc.b    'Replymsg  ',0
  7728.         dc.b    'Resource  ',0
  7729.         dc.b    'Library   ',0
  7730.         dc.b    'Memory    ',0
  7731. softinttype EQU *-dataarea
  7732. .softinttype dc.b    'Softint   ',0
  7733.         dc.b    'Font      ',0
  7734. proctype    EQU *-dataarea
  7735. .proctype   dc.b    'Process   ',0
  7736.         dc.b    'Semaphore ',0
  7737. mp_flags    EQU *-dataarea
  7738. .mp_flags   dc.b    'Signal  ',0
  7739.         dc.b    'Softint ',0
  7740.         dc.b    'Ignore  ',0
  7741. windowname  EQU *-dataarea
  7742. .windowname dc.b    'Xoper V2.3',$a9,' 1991 Werner G',$fc,'nther',0
  7743. newname     EQU *-dataarea
  7744. .newname    dc.b    'Xoper ',0
  7745. memportname EQU *-dataarea
  7746. .memportname dc.b    'SnoopPort',0
  7747. xopcon        EQU *-dataarea
  7748. .xopcon     dc.b    'XopPackets',0
  7749. xopsleep    EQU *-dataarea
  7750. .xopsleep   dc.b    'Xop-A-A-x',0
  7751. IOcntname   EQU *-dataarea
  7752. .IOcntname  dc.b    'Xop-I/O-counter',0
  7753. kidlename   EQU *-dataarea
  7754. .kidlename  dc.b    'Xop-Idle-Killer',0
  7755.  
  7756. cmdnum        set      0
  7757. commds        EQU *-dataarea
  7758. .commds     ADDCMD  'time'
  7759.         ADDCMD  'taskpri'
  7760.         ADDCMD  'info'
  7761.         ADDCMD  'pri'
  7762.         ADDCMD  'flush'
  7763.         ADDCMD  'freeze'
  7764.         ADDCMD  'warm'
  7765.         ADDCMD  'signal'
  7766.         ADDCMD  'break'
  7767.         ADDCMD  'alert'
  7768.         ADDCMD  'lastalert'
  7769.         ADDCMD  'hold'
  7770.         ADDCMD  'exit'
  7771.         ADDCMD  'clear'
  7772.         ADDCMD  'cancel'
  7773.         ADDCMD  'taskports'
  7774.         ADDCMD  'hunks'
  7775.         ADDCMD  'devices'
  7776.         ADDCMD  'openlib'
  7777.         ADDCMD  'closelib'
  7778.         ADDCMD  'currentdir'
  7779.         ADDCMD  'cd'
  7780.         ADDCMD  'mypri'
  7781.         ADDCMD  'files'
  7782.         ADDCMD  'locks'
  7783.         ADDCMD  'unlock'
  7784.         ADDCMD  'screens'
  7785.         ADDCMD  'windows'
  7786.         ADDCMD  'closescreen'
  7787.         ADDCMD  'closewindow'
  7788.         ADDCMD  'fonts'
  7789.         ADDCMD  'windowfonts'
  7790.         ADDCMD  'lockdrive'
  7791.         ADDCMD  'freedrive'
  7792.         ADDCMD  'capture'
  7793.         ADDCMD  'clrcold'
  7794.         ADDCMD  'clrcool'
  7795.         ADDCMD  'clrwarm'
  7796.         ADDCMD  'snoop'
  7797.         ADDCMD  'usage'
  7798.         ADDCMD  'inputhandler'
  7799.         ADDCMD  'header'
  7800.         ADDCMD  'sort'
  7801.         ADDCMD  'hide'
  7802.         ADDCMD  'hidden'
  7803.         ADDCMD  'window'
  7804.         ADDCMD  'kill'
  7805.         ADDCMD  'iconifyoff'
  7806.         ADDCMD  'historylines'
  7807.         ADDCMD  'minimumchars'
  7808.         ADDCMD  'showhistory'
  7809.         ADDCMD  'repeat'
  7810.         ADDCMD  'remresident'
  7811.         ADDCMD  'saveoutput'
  7812.         ADDCMD  'killhistory'
  7813.         ADDCMD  'backdropicon'
  7814.         ADDCMD  'setfont'
  7815.         ADDCMD  'trapguru'
  7816.         ADDCMD  'outputlines'
  7817.         ADDCMD  'usescreen'
  7818.         ADDCMD  'usewindow'
  7819.         ADDCMD  'timerio'
  7820.         ADDCMD  'diskchange'
  7821.         ADDCMD  'alias'
  7822.         ADDCMD  'remnode'
  7823.         ADDCMD  'setfkey'
  7824.         ADDCMD  'clicmd'
  7825.         ADDCMD  'taskinfo'
  7826.         ADDCMD  'coldreboot'
  7827.         ADDCMD  'reboot'
  7828.         ADDCMD  'zerotimer'
  7829.         ADDCMD  'propgadoff'
  7830.         ADDCMD  'iconpos'
  7831.         ADDCMD  'remport'
  7832.         ADDCMD  'remintserver'
  7833.         ADDCMD  'frags'
  7834.         ADDCMD  'traceopen'
  7835.         ADDCMD  'snoopmem'
  7836.         ADDCMD  'tracelock'
  7837.  
  7838.         IFNE    ((tasktime-cmdaddr)/4)-cmdnum
  7839.         ERROR   !! COMMAND NAME OR JUMP VECTOR MISSING !!
  7840.         ENDIF
  7841.  
  7842. hexarea     EQU *-dataarea
  7843. .hexarea    dc.b    '         ',0
  7844. hextab        EQU *-dataarea
  7845. .hextab     dc.b    '0123456789abcdef'
  7846. infoh2        EQU *-dataarea
  7847. .infoh2     dc.b    'Dispat/Sec:',0
  7848. infoh1        EQU *-dataarea
  7849. .infoh1     dc.b    'CPU:',0
  7850. infoh3        EQU *-dataarea
  7851. .infoh3     dc.b    'CPU activity: ',0
  7852. infoh6        EQU *-dataarea
  7853. .infoh6     dc.b    'Total:',0
  7854. infoh4        EQU *-dataarea
  7855. .infoh4     dc.b    '% ',0
  7856. infoh7        EQU *-dataarea
  7857. .infoh7     dc.b    'I/O Ints/Sec: ',0
  7858. cpu0        EQU *-dataarea
  7859. .cpu0        dc.b    '68000',0
  7860. cpu1        EQU *-dataarea
  7861. .cpu1        dc.b    '68010',0
  7862. cpu2        EQU *-dataarea
  7863. .cpu2        dc.b    '68020',0
  7864. cpu3        EQU *-dataarea
  7865. .cpu3        dc.b    '68030',0
  7866. cpu4        EQU *-dataarea
  7867. .cpu4        dc.b    '/68881',0
  7868. cpu5        EQU *-dataarea
  7869. .cpu5        dc.b    '/68882',0
  7870. nofpu        EQU *-dataarea
  7871. .nofpu        dc.b    '---- ',0
  7872. nullstate   EQU *-dataarea
  7873. .nullstate  dc.b    'NULL ',0
  7874. idle        EQU *-dataarea
  7875. .idle        dc.b    'IDLE ',0
  7876. busy        EQU *-dataarea
  7877. .busy        dc.b    'BUSY ',0
  7878. weissnicht  EQU *-dataarea
  7879. .weissnicht dc.b    '???? ',0
  7880. devload     EQU *-dataarea
  7881. .devload    dc.b    'loaded   ',0
  7882. devnload    EQU *-dataarea
  7883. .devnload   dc.b    'unloaded ',0
  7884. inten        EQU *-dataarea
  7885. .inten        dc.b    'E ',0
  7886. intdis        EQU *-dataarea
  7887. .intdis     dc.b    'D ',0
  7888. intserv     EQU *-dataarea
  7889. .intserv    dc.b    'S ',0
  7890. inthand     EQU *-dataarea
  7891. .inthand    dc.b    'H ',0
  7892. notfile     EQU *-dataarea
  7893. .notfile    dc.b    '--- ------- ------- ------- ',0
  7894. longnix     EQU *-dataarea
  7895. .longnix    dc.b    '-'
  7896. smallnix    EQU *-dataarea
  7897. .smallnix   dc.b    '----'
  7898. nix        EQU *-dataarea
  7899. .nix        dc.b    '--- ',0
  7900. noinfo        EQU *-dataarea
  7901. .noinfo     dc.b    'No Info on'
  7902. oneblank    EQU *-dataarea
  7903. .oneblank   dc.b    ' ',0
  7904. equal        EQU *-dataarea
  7905. .equal        dc.b    '=  ',0
  7906. openbrak    EQU *-dataarea
  7907. .openbrak   dc.b    '[ ',0
  7908. closebrak   EQU *-dataarea
  7909. .closebrak  dc.b    ' ]',0
  7910. namerr        EQU *-dataarea
  7911. .namerr     dc.b    'Unable to find ',0
  7912. fonterr     EQU *-dataarea
  7913. .fonterr    dc.b    "Can't open ",0
  7914. adrerr        EQU *-dataarea
  7915. .adrerr     dc.b    'Address Error!',0
  7916. aliaserr    EQU *-dataarea
  7917. .aliaserr   dc.b    'Single character alias names using "',0
  7918. aliaserr2   EQU *-dataarea
  7919. .aliaserr2  dc.b    '"',10,'are not allowed.',0
  7920. noworkbench EQU *-dataarea
  7921. .noworkbench dc.b    "Workbench isn't active !",0
  7922. openerr     EQU *-dataarea
  7923. .openerr    dc.b    'Could not open file ',0
  7924. noderr        EQU *-dataarea
  7925. .noderr     dc.b    "Can't find this Node. Continue anyway ? (Y/N)",0
  7926. listerr     EQU *-dataarea
  7927. .listerr    dc.b    'Unable to find ListHeader. Sort aborted.',0
  7928. wiwerr        EQU *-dataarea
  7929. .wiwerr     dc.b    'Script file only',0
  7930. gurutxt     EQU *-dataarea
  7931. .gurutxt    dc.b    'Guru Meditation #',0
  7932. clrtxt        EQU *-dataarea
  7933. .clrtxt     dc.b    'Memory Hunks cleared.',0
  7934. canerr0     EQU *-dataarea
  7935. .canerr0    dc.b    'Process is not a CLI-task',10
  7936.         dc.b    'Has it been started from Workbench ? (Y/N)',10,0
  7937. canerr1     EQU *-dataarea
  7938. .canerr1    dc.b    'Process was created by CreateProc()',10
  7939.         dc.b    'Shall I UnLoad() ? (Y/N)',10,0
  7940. unloaderr   EQU *-dataarea
  7941. .unloaderr  dc.b    "Arrrgh.. can't find segments, aborting",0
  7942. noprocs     EQU *-dataarea
  7943. .noprocs    dc.b    'Not a Process.',0
  7944. notload     EQU *-dataarea
  7945. .notload    dc.b    'No program loaded.',0
  7946. cliprocs    EQU *-dataarea
  7947. .cliprocs   dc.b    'Cli-Process',0
  7948. procloaded  EQU *-dataarea
  7949. .procloaded dc.b    'Loaded as a command: ',0
  7950. segloaded   EQU *-dataarea
  7951. .segloaded  dc.b    'Created by CreateProc()',0
  7952. coldtxt     EQU *-dataarea
  7953. .coldtxt    dc.b    'Cold Capture: ',0
  7954. cooltxt     EQU *-dataarea
  7955. .cooltxt    dc.b    'Cool Capture: ',0
  7956. warmtxt     EQU *-dataarea
  7957. .warmtxt    dc.b    'Warm Capture: ',0
  7958. kicktxt     EQU *-dataarea
  7959. .kicktxt    dc.b    'KickMem     : ',0
  7960. unset        EQU *-dataarea
  7961. .unset        dc.b    'unset',0
  7962. wbname        EQU *-dataarea
  7963. .wbname     dc.b    'Workbench',0
  7964. intnames    EQU *-dataarea
  7965. .intnames   dc.b    'Serial Out ',0
  7966.         dc.b    'Disk Block ',0
  7967.         dc.b    'SoftInt    ',0
  7968.         dc.b    'Ports      ',0
  7969.         dc.b    'Coper      ',0
  7970.         dc.b    'Vert.Blank ',0
  7971.         dc.b    'Blitter    ',0
  7972.         dc.b    'Audio Ch.0 ',0
  7973.         dc.b    'Audio Ch.1 ',0
  7974.         dc.b    'Audio Ch.2 ',0
  7975.         dc.b    'Audio Ch.3 ',0
  7976.         dc.b    'Serial In  ',0
  7977.         dc.b    'Disk Sync  ',0
  7978.         dc.b    'External   ',0
  7979.         dc.b    'SoftInt    ',0
  7980.         dc.b    'NMI        ',0
  7981. inttyp        EQU *-dataarea
  7982. .inttyp     dc.b    0,0,1,1,1,1,0,0,0,0,0,0,0,1,1,1
  7983. fontname    EQU *-dataarea
  7984. .fontname   dc.b    'topaz.font',0
  7985. devicenam   EQU *-dataarea
  7986. .devicenam  dc.b    'input.device',0
  7987. timernam    EQU *-dataarea
  7988. .timernam   dc.b    'timer.device',0
  7989. memlarg     EQU *-dataarea
  7990. .memlarg    dc.b    'LARGEST ',0
  7991. memclr        EQU *-dataarea
  7992. .memclr     dc.b    'CLEAR ',0
  7993. memfast     EQU *-dataarea
  7994. .memfast    dc.b    'FAST ',0
  7995. memchip     EQU *-dataarea
  7996. .memchip    dc.b    'CHIP ',0
  7997. mempubl     EQU *-dataarea
  7998. .mempubl    dc.b    'PUBLIC ',0
  7999. failed        EQU *-dataarea
  8000. .failed     dc.b    'Failed !',0
  8001. allok        EQU *-dataarea
  8002. .allok        dc.b    'ALLOC: ',0
  8003. free        EQU *-dataarea
  8004. .free        dc.b    'FREE: ',0
  8005. backg        EQU *-dataarea
  8006. .backg        dc.b    'Bckg ',0
  8007. foreg        EQU *-dataarea
  8008. .foreg        dc.b    'Frgr ',0
  8009. script        EQU *-dataarea
  8010. .script     dc.b    'Batch ',0
  8011. interact    EQU *-dataarea
  8012. .interact   dc.b    'Intct ',0
  8013.  IFND DEBUG
  8014. startupname EQU *-dataarea
  8015. .startupname dc.b    'S:Xoper.Startup',0
  8016.  ENDC
  8017.  IFD  DEBUG
  8018. startupname EQU *-dataarea
  8019. .startupname dc.b    'S:Test.Startup',0
  8020.  ENDC
  8021. nameerr     EQU *-dataarea
  8022. .nameerr    dc.b    'Name or address is missing.',10
  8023. synerr        EQU *-dataarea
  8024. .synerr     dc.b    'Syntax Error, type "?" for help',10,0
  8025. dnotf        EQU *-dataarea
  8026. .dnotf        dc.b    'Directory not found',0
  8027. notdir        EQU *-dataarea
  8028. .notdir     dc.b    'Not a directory',0
  8029. nomount     EQU *-dataarea
  8030. .nomount    dc.b    ' not mounted.',0
  8031. dishelp     EQU *-dataarea
  8032. .dishelp    dc.b    10,'Names are case sensitive and followed by a ":"',0
  8033. unlerr        EQU *-dataarea
  8034. .unlerr     dc.b    'Lock not found',0
  8035. unl1        EQU *-dataarea
  8036. .unl1        dc.b    'Lock is on ',0
  8037. unltxt        EQU *-dataarea
  8038. .unltxt     dc.b    'Old lock was: ',0
  8039. unltxt2     EQU *-dataarea
  8040. .unltxt2    dc.b    'Unlock ? (Y/N)',10,0
  8041. scnofound   EQU *-dataarea
  8042. .scnofound  dc.b    'Screen not found.',0
  8043. winnofound  EQU *-dataarea
  8044. .winnofound dc.b    'Window not found.',0
  8045. stperr        EQU *-dataarea
  8046. .stperr     dc.b    'Task must be "READY" or "WAITING"',10,0
  8047. waerr        EQU *-dataarea
  8048. .waerr        dc.b    'Task must be "FROZEN"',10,0
  8049. whatsthis   EQU *-dataarea
  8050. .whatsthis  dc.b    '???.?',0
  8051. toomuch     EQU *-dataarea
  8052. .toomuch    dc.b    '??? ',0
  8053. timenotset  EQU *-dataarea
  8054. .timenotset dc.b    ' disabled.',0
  8055. whattime    EQU *-dataarea
  8056. .whattime   dc.b    'Refresh time in secs:',0
  8057. stoped        EQU *-dataarea
  8058. .stoped     dc.b    '<Break>',0
  8059. capexited   EQU *-dataarea
  8060. .capexited  dc.b    'Task ended',0
  8061. capwait     EQU *-dataarea
  8062. .capwait    dc.b    'Waiting for startup...',0
  8063. onscr        EQU *-dataarea
  8064. .onscr        dc.b    'On Screen: ',0
  8065. whatnow     EQU *-dataarea
  8066. .whatnow    dc.b    'Kill, ignore (K/I)?',0
  8067. noguru        EQU *-dataarea
  8068. .noguru     dc.b    'None found.',0
  8069. softfail    EQU *-dataarea
  8070. .softfail   dc.b    'Software failure!',10,'Task: ',0
  8071. addrserr    EQU *-dataarea
  8072. .addrserr   dc.b    'Bad aligned address was: ',0
  8073. procount    EQU *-dataarea
  8074. .procount   dc.b    'PC: ',0
  8075. memtyp        EQU *-dataarea
  8076. .memtyp     dc.b    'Memory type: ',0
  8077. diskfont    EQU *-dataarea
  8078. .diskfont   dc.b    'diskfont.library',0
  8079. nintrserv   EQU *-dataarea
  8080. .nintrserv  dc.b    "Not a server. Can't restore vectors",0
  8081. regnam        EQU *-dataarea
  8082. .regnam     dc.b    "PCD0D1D2D3D4D5D6D7A0A1A2A3A4A5A6SP"
  8083. usetxt        EQU *-dataarea
  8084. .usetxt     dc.b    'USAGE: Xoper [T] [F] [L] [D] [R] [E] [M] [P] [I] [S] [C] [U] [A]',10
  8085.         dc.b    'OR     Xoper -b',10
  8086.         dc.b    'DISPLAY:',10
  8087.         dc.b    '[T]asks    task[F]lags   [L]ibraries  [D]evices    [R]esources',10
  8088.         dc.b    'r[E]sident [M]emory      [P]orts      [I]nterrupts [S]tack',10
  8089.         dc.b    '[C]litasks task[U]sage   sem[A]phores [Q]uit',10,10
  8090.         dc.b    'OTHER SYSTEM LISTS:',10
  8091.         dc.b    'Windows    Screens      Fonts       WindowFonts  CurrentDir',10
  8092.         dc.b    'Files      Locks        Devices     InputHandler Capture',10
  8093.         dc.b    'TimerIO    DiskChange   Frags       TraceOpen    TraceLock',10,10
  8094.         dc.b    'COMMANDS:',10
  8095.         dc.b    'Time         <secs>',10
  8096.         dc.b    'Taskpri      <priority>  [processnum] <taskname>',10
  8097.         dc.b    'Mypri        <priority>',10
  8098.         dc.b    'Signal       <mask(hex)> [processnum] <taskname>',10
  8099.         dc.b    'Break        [processnum] <taskname>',10
  8100.         dc.b    'Freeze|Warm  [processnum] <taskname>',10
  8101.         dc.b    'Kill         [processnum] <taskname>',10
  8102.         dc.b    'SnoopMem     [processnum] <taskname>',10
  8103.         dc.b    'ZeroTimer    [processnum] <taskname>',10
  8104.         dc.b    'Hide         <taskname>',10
  8105.         dc.b    'Pri          <priority> <nodename>',10
  8106.         dc.b    'Info         <name>',10
  8107.         dc.b    'RemResident  <resident module name>',10
  8108.         dc.b    'RemIntServer <interrupt address>',10
  8109.         dc.b    'Clear        <longword(hex)>',10
  8110.         dc.b    'Hunks        [processnum] <procname>',10
  8111.         dc.b    'CD           <directory> [processnum] <procname>',10
  8112.         dc.b    'UnLock       <lock>',10
  8113.         dc.b    'OpenLib    | Closelib <libraryname>',10
  8114.         dc.b    'CloseWindow| Closescreen <title>',10
  8115.         dc.b    'SetFont      [size] <fontname> <windowtitle>',10
  8116.         dc.b    'LockDrive  | Freedrive   <drivename:>',10
  8117.         dc.b    'Window       <leftedge topedge width height> (scriptfile only) ',10
  8118.         dc.b    'IconPos      <leftedge topedge>',10
  8119.         dc.b    'OutputLines  <maximum # of lines>',10
  8120.         dc.b    'HistoryLines <maximum # of lines>',10
  8121.         dc.b    'MinimumChars <minimum # of characters>',10
  8122.         dc.b    'SaveOutput   <filename>',10
  8123.         dc.b    'Repeat       <Command line>',10
  8124.         dc.b    'SetFKey      <number> <string>',10
  8125.         dc.b    'Alias        [<aliasname> <commandname>]',10,10
  8126.         dc.b    'COMMANDS WITHOUT PARAMETERS:',10
  8127.         dc.b    'Flush      LastAlert    ClrCool     ClrCold      ClrWarm',10
  8128.         dc.b    'TrapGuru',10,10
  8129.         dc.b    'OPTIONS:',10
  8130.         dc.b    'Sort       TaskPorts    Hidden      Usage        Header',10
  8131.         dc.b    'IconifyOff BackDropIcon ShowHistory KillHistory  UseScreen',10
  8132.         dc.b    'UseWindow  CLICmd       TaskInfo    PropGadOff',10
  8133.         dc.b    'Hold       Exit'
  8134. null        EQU *-dataarea
  8135. .null        dc.b    0
  8136.  
  8137.     IFD DEBUG
  8138. dosname
  8139. .dosname    dc.b    'dos.library',0
  8140. intuiname
  8141. .intuiname  dc.b    'intuition.library',0
  8142. gfxname
  8143. .gfxname    dc.b    'graphics.library',0
  8144. conname
  8145. .conname    dc.b    'console.device',0
  8146.         EVEN
  8147.     ENDC
  8148.  
  8149.         BSS     Data
  8150. mypacket
  8151. LN_SUCC     ds.l    1
  8152. LN_PRED     ds.l    1
  8153. LN_TYPE     ds.b    1
  8154. LN_PRI        ds.b    1
  8155. LN_NAME     ds.l    1
  8156. MP_FLAGS    ds.b    1
  8157. MP_SIGBIT   ds.b    1
  8158. MP_SIGTASK  ds.l    1
  8159. MN_SIZE     ds.w    1
  8160. LH_HEAD     ds.l    1
  8161. LH_TAIL     ds.l    1
  8162. LH_TAILPRED ds.l    1
  8163. LH_TYPE     ds.b    1
  8164. LH_pad        ds.b    1
  8165. dp_Link     ds.l    1
  8166. dp_Port     ds.l    1
  8167. dp_Type     ds.l    1
  8168. dp_Res1     ds.l    1
  8169. dp_Res2     ds.l    1
  8170. dp_Arg1     ds.l    1
  8171. dp_Arg2     ds.l    1
  8172. dp_Arg3     ds.l    1
  8173. dp_Arg4     ds.l    1
  8174. dp_Arg5     ds.l    1
  8175. dp_Arg6     ds.l    1
  8176. dp_Arg7     ds.l    1
  8177.  
  8178. buffer        ds.b    2800
  8179. out        ds.b    100
  8180. dummy        ds.b    80
  8181. in        ds.b    80
  8182. cputime     ds.b    1000
  8183. taskstampid ds.l    128
  8184. taskstamps  ds.l    128
  8185. usedtime    ds.l    128
  8186. ievent        ds.b    32
  8187. outevent    ds.b    20
  8188. inputbuffer ds.b    88
  8189. timerio     ds.b    40
  8190. repeatbuffer ds.b   81
  8191.  
  8192.         CODE ICONIFY,CHIP
  8193.  
  8194. iconify     lea     icnwindow(PC),a0
  8195.         CALL    OpenWindow,intuibase(a4)
  8196.         move.l  d0,iconwindow
  8197.  
  8198. waitforcall move.l  iconwindow(PC),a0
  8199.         move.l  $56(a0),a0              ;wn->UserPort
  8200.  
  8201.         moveq   #0,d1
  8202.         move.l  d1,d0
  8203.         move.b  15(a0),d1               ;UserPort->SigBit
  8204.         bset    d1,d0
  8205.         move.l  d0,d6
  8206.         or.l    #(1<<mysignal),d0
  8207.         or.l    trapsignal(a4),d0
  8208.         CALL    Wait,SysBase(a4)
  8209.         and.l   d0,d6
  8210.         bne.s   fromwindow
  8211.         move.l  #(1<<mysignal),d1
  8212.         and.l   d0,d1
  8213.         bne     icondone
  8214.         and.l   trapsignal(a4),d0
  8215.         beq.s   waitforcall
  8216.         move.b  #1,gotguru(a4)
  8217.         bra.s   icondone
  8218.  
  8219. fromwindow  move.l  iconwindow,a0
  8220.         move.l  $56(a0),a0              ;wn->UserPort
  8221.         CALL    GetMsg,SysBase(a4)
  8222.         tst.l   d0
  8223.         beq.s   waitforcall
  8224.         move.l  d0,a1
  8225.         CALL    ReplyMsg,SysBase(a4)
  8226.  
  8227.         move.l  iconwindow(PC),a0
  8228.         move.l  4(a0),d5
  8229.         cmp.l   icnwindow(PC),d5
  8230.         bne.s   1$
  8231.         lea     nsecs(PC),a0
  8232.         lea     nmics(PC),a1
  8233.         CALL    CurrentTime,intuibase(a4)
  8234.         movem.l osecs,d0-d3
  8235.         CALL    DoubleClick,intuibase(a4)
  8236.         tst.l   d0
  8237.         bne.s   icondone
  8238.         move.l  nsecs(PC),osecs
  8239.         move.l  nmics(PC),omics
  8240. 1$        move.l  d5,icnwindow
  8241.         bra     waitforcall
  8242. icondone    move.l  iconwindow(PC),a0
  8243.         move.l  4(a0),icnwindow         ;LeftEdge+TopEdge
  8244.         tst.l   iconwindow
  8245.         beq.s   1$
  8246.         CALL    CloseWindow,intuibase(a4)
  8247. 1$        rts
  8248.  
  8249. reverseimage
  8250.         move    #((imageend-imagedata)/4)-1,d0
  8251.         lea     imagedata(PC),a3
  8252. 2$        eor.l   #-1,(a3)+
  8253.         dbf     d0,2$
  8254.         rts
  8255.  
  8256. osecs        dc.l    0
  8257. omics        dc.l    0
  8258. nsecs        dc.l    0
  8259. nmics        dc.l    0
  8260.  
  8261. iconwindow  dc.l    0
  8262. icnwindow   dc.w    40,170,72,28
  8263.         dc.b    0,1
  8264.         dc.l    $20,$800
  8265.         dc.l    gadget,0,0,0,0
  8266.         dc.w    72,28,72,28
  8267.         dc.w    1
  8268.  
  8269. gadget        dc.l    0
  8270.         dc.w    0,0,72,28,4,2,$20
  8271.         dc.l    image
  8272.         dc.l    0,0,0,0
  8273.         dc.w    0
  8274.         dc.l    0
  8275.  
  8276. image        dc.w    0,0,72,28,2
  8277.         dc.l    imagedata
  8278.         dc.b    3,0
  8279.         dc.l    0
  8280.  
  8281. imagedata   dc.w    $000F,$FFFF,$FFFF,$FFF8,$0000,$001F,$FFFF,$FFFF
  8282.         dc.w    $FFFC,$0000,$001F,$0000,$0000,$007C,$0000,$001F
  8283.         dc.w    $7FFF,$FFFF,$FF7C,$0000,$001F,$4A46,$0244,$557C
  8284.         dc.w    $0000,$001F,$5108,$D411,$817C,$0000,$001F,$7FFF
  8285.         dc.w    $FFFF,$FF7C,$0000,$001F,$0000,$0000,$007C,$0000
  8286.         dc.w    $001F,$30C0,$0000,$007C,$0000,$001F,$1980,$0000
  8287.         dc.w    $007C,$0000,$001F,$0F0F,$1F0F,$1F7C,$0000,$001F
  8288.         dc.w    $0619,$9999,$997C,$0000,$001F,$0F19,$999F,$987C
  8289.         dc.w    $0000,$001F,$1999,$9F18,$187C,$0000,$001F,$30CF
  8290.         dc.w    $180F,$187C,$0000,$001F,$0000,$1800,$007C,$0000
  8291.         dc.w    $001F,$0000,$0000,$007C,$0000,$001F,$FFFF,$FFFF
  8292.         dc.w    $FFFC,$0000,$000F,$FFFF,$FFFF,$FF18,$0000,$0000
  8293.         dc.w    $0000,$0000,$0000,$0000,$3FFF,$FFFF,$FFFF,$FFFF
  8294.         dc.w    $FC00,$FDFF,$FFFF,$FFFF,$FFFF,$FF00,$EBFF,$FFFF
  8295.         dc.w    $FFFF,$FFFF,$FF00,$F7FF,$FFFF,$FFFF,$F800,$0700
  8296.         dc.w    $FFFF,$FFFF,$FFFF,$FFFF,$FF00,$FFFF,$FFFF,$FFFF
  8297.         dc.w    $FFFF,$FF00,$FFFF,$FFFF,$FFFF,$FFFF,$FF00,$3FFF
  8298.         dc.w    $FFFF,$FFFF,$FFFF,$FC00,$0000,$0000,$0000,$0000
  8299.         dc.w    $0000,$0000,$0000,$0000,$0000,$0000,$0000,$FFFF
  8300.         dc.w    $FFFF,$FF80,$0000,$0000,$FFFF,$FFFF,$FF80,$0000
  8301.         dc.w    $0000,$FFFF,$FFFF,$FF80,$0000,$0000,$FFFF,$FFFF
  8302.         dc.w    $FF80,$0000,$0000,$FFFF,$FFFF,$FF80,$0000,$0000
  8303.         dc.w    $FFFF,$FFFF,$FF80,$0000,$0000,$8000,$0000,$0080
  8304.         dc.w    $0000,$0000,$8000,$0000,$0080,$0000,$0000,$8000
  8305.         dc.w    $0000,$0080,$0000,$0000,$8000,$0000,$0080,$0000
  8306.         dc.w    $0000,$8000,$0000,$0080,$0000,$0000,$8000,$0000
  8307.         dc.w    $0080,$0000,$0000,$8000,$0000,$0080,$0000,$0000
  8308.         dc.w    $8000,$0000,$0080,$0000,$0000,$FFFF,$FFFF,$FF80
  8309.         dc.w    $0000,$0000,$0000,$0000,$00E0,$0000,$0000,$0000
  8310.         dc.w    $0000,$00E0,$0000,$0000,$1FFF,$FFFF,$F800,$0000
  8311.         dc.w    $0000,$0080,$0040,$0000,$0000,$0200,$0080,$0040
  8312.         dc.w    $0000,$0000,$1400,$0080,$0040,$003F,$0000,$0800
  8313.         dc.w    $0080,$0040,$07FF,$F800,$0000,$0080,$0040,$003F
  8314.         dc.w    $0000,$0000,$0080,$0040,$0000,$3800,$FFFF,$FFFF
  8315.         dc.w    $FFFF,$FFFF,$FE00,$0000,$0080,$0040,$0000,$0000
  8316. imageend
  8317. iconifgad   dc.l    0
  8318.         dc.w    -83,0
  8319.         dc.w    31,10
  8320.         dc.w    $14
  8321.         dc.w    $41
  8322.         dc.w    1
  8323.         dc.l    iconifimg
  8324.         dc.l    0
  8325.         dc.l    0
  8326.         dc.l    0
  8327.         dc.l    0
  8328.         dc.w    0
  8329.         dc.l    0
  8330.  
  8331. iconifimg   dc.w    0,0
  8332.         dc.w    31,10
  8333.         dc.w    2
  8334.         dc.l    iconifdata
  8335.         dc.b    $0003,$0000
  8336.         dc.l    0
  8337.  
  8338. iconifdata  dc.w    $7FFF,$FFFC,$601F,$FFFC,$6000,$000C,$607F,$FFCC
  8339.         dc.w    $6060,$00CC,$6067,$FCCC,$7E60,$00CC,$7E7F,$FFCC
  8340.         dc.w    $7E00,$000C,$7FFF,$FFFC,$0000,$0000,$1FE0,$0000
  8341.         dc.w    $1FFF,$FFF0,$1F80,$0030,$1F9F,$FF30,$1F98,$0330
  8342.         dc.w    $019F,$FF30,$0180,$0030,$01FF,$FFF0,$0000,$0000
  8343.  
  8344.         CODE    SCROLLBAR
  8345. setprop     btst.w  #8,propinfo     ;update slider position and
  8346.         bne.s   8$            ;and size
  8347.         moveq   #0,d0
  8348.         CALL    LockIBase,intuibase(a4)
  8349.         move.l  d0,d5
  8350.         move.l  wnptr(a4),d0    ;see if the user hit the
  8351.         beq.s   7$            ;scrollbar in the meantime
  8352.         move.l  d0,a0
  8353.         move.l  86(a0),a0       ;wn->UserPort
  8354.         lea     20(a0),a0       ;Userport->MsgList
  8355. 5$        move.l  0(a0),d0
  8356.         beq.s   6$            ;no more pending messages
  8357.         move.l  d0,a0
  8358.         cmp.l   #$20,20(a0)     ;gadgetdown ?
  8359.         bne.s   5$
  8360.         move.l  28(a0),a1
  8361.         cmp.w   #3,38(a1)       ;scrollbar ?
  8362.         beq.s   7$
  8363.         bra.s   5$
  8364.  
  8365. 7$        move.l  d5,a0
  8366.         CALL    UnlockIBase,intuibase(a4)
  8367. 8$        rts
  8368.  
  8369. 6$        move.l  d5,a0
  8370.         CALL    UnlockIBase,intuibase(a4)
  8371.         moveq   #0,d2     ;VertPot = firstline*MAXPOT/(numlines-rows)
  8372.         move.l  numlines(a4),d3
  8373.         sub.w   rows(a4),d3
  8374.         ble.s   1$
  8375.         move.l  firstline(a4),d2
  8376.         mulu    #65535,d2
  8377.         divu    d3,d2
  8378.  
  8379. 1$        moveq   #-1,d4     ;VertBody = rows*MAXBODY/numlines
  8380.         move.w  rows(a4),d5
  8381.         ext.l   d5
  8382.         cmp.l   numlines(a4),d5
  8383.         bge.s   2$
  8384.         mulu    #$ffff,d5
  8385.         move.l  numlines(a4),d0
  8386.         divu    d0,d5
  8387.         move.l  d5,d4
  8388.  
  8389. 2$        cmp.w   propinfo+8(PC),d4   ;did something change ?
  8390.         bne.s   3$
  8391.         cmp.w   propinfo+4(PC),d2
  8392.         beq.s   4$
  8393.  
  8394. 3$        lea     sbgadget(PC),a0
  8395.         move.l  wnptr(a4),d0
  8396.         beq.s   4$
  8397.         move.l  d0,a1
  8398.         suba.l  a2,a2
  8399.         moveq   #-1,d3
  8400.         moveq   #0,d1
  8401.         moveq   #1|4,d0
  8402.         moveq   #1,d5
  8403.         CALL    NewModifyProp,intuibase(a4)
  8404. 4$        rts
  8405.  
  8406. proppos     move.w  propinfo+4(PC),d0   ;get slider position and update
  8407.         move.l  numlines(a4),d1     ;our window if necessary
  8408.         sub.w   rows(a4),d1
  8409.         ble.s   1$
  8410.         move.l  #$ffff,d3    ;firstline=VertPot/(MAXPOT/numlines-rows)
  8411.         divu    d1,d3
  8412.         divu    d3,d0
  8413.         ext.l   d0
  8414.         cmp.l   firstline(a4),d0
  8415.         beq.s   1$
  8416.         move.l  d0,firstline(a4)
  8417.         jsr     blastout
  8418. 1$        rts
  8419.  
  8420. sbgadget    dc.l    0
  8421.         dc.w    -14,9
  8422.         dc.w    14,-20
  8423.         dc.w    $10|$40
  8424.         dc.w    1|2|8|$10
  8425.         dc.w    3
  8426.         dc.l    sbdata,0,0,0,propinfo
  8427.         dc.w    3
  8428.         dc.l    0
  8429.  
  8430. propinfo    dc.w    1|4
  8431.         dc.w    0,0
  8432.         dc.w    -1,-1
  8433.         dc.w    0,0,0,0,0,0
  8434.  
  8435. sbdata        ds.l    4
  8436.         END
  8437.