home *** CD-ROM | disk | FTP | other *** search
/ Zine 8 / Zine - Issue 08 (1991-02)(Brainstorm).adf / sources / reqcontrol.S < prev   
Encoding:
Text File  |  1991-01-01  |  4.3 KB  |  189 lines

  1.  
  2. ; ***************************************************
  3. ; ****                                           ****
  4. ; ****              RECONTROL V1.2               ****
  5. ; ****                                           ****
  6. ; ****                                           ****
  7. ; ****       By:   Orlando Budelacci             ****
  8. ; ****             Birmannsgasse 34              ****
  9. ; ****             CH-4055 Basle                 ****
  10. ; ****             Switzerland                   ****
  11. ; ****                                           ****
  12. ; ****    Source published in Zine issue #8      ****
  13. ; ****                                           ****
  14. ; ****             by BRAINSTORM!                ****
  15. ; ****                ­­­­­­­­­­­                ****
  16. ; ****                                           ****
  17. ; ****         Written with AsmOne V1.0          ****
  18. ; ****                                           ****
  19. ; ****                                           ****
  20. ; ****     as always... 100% pc-relative!!!      ****
  21. ; ****      (like every program should be!)      ****
  22. ; ****                                           ****
  23. ; ****                                           ****
  24. ; ****  Note: Don't start the program from the   ****
  25. ; ****        assembler! Write object file 'wo'  ****
  26. ; ****        and start it from the cli!!!       ****
  27. ; ****                                           ****
  28. ; ***************************************************
  29.  
  30.  
  31. Output        = -60
  32. OpenLib        = -408
  33. CloseLib    = -414
  34. Write        = -48
  35.  
  36.     lea    parameter(pc),a3
  37.     move.l    a0,(a3)
  38.     bne.s    go
  39.     lea    optionflag(pc),a4
  40.     move.b    #1,(a4)
  41.  
  42. go:
  43.     move.l    4.w,a6
  44.     lea    dosname(pc),a1
  45.     jsr    OpenLib(a6)
  46.     lea    dosbase(pc),a3
  47.     move.l    d0,(a3)
  48.     beq.w    exit
  49.     move.l    dosbase(pc),a6
  50.     jsr    Output(a6)
  51.     lea    windowhandle(pc),a3
  52.     move.l    d0,(a3)
  53.     beq.b    exit
  54.     lea    optionflag(pc),a4
  55.     tst.b    (a4)
  56.     beq.s    ok
  57.     lea    infotext(pc),a1
  58.     bsr.s    print
  59.     bra.s    end
  60.  
  61. ok:    
  62.     move.l    parameter(pc),a0
  63.     move.b    (a0),d0
  64.     bset    #5,d0
  65.     moveq    #'o',d7
  66.     cmp.b    d7,d0
  67.     bne.w    error
  68.     move.b    1(a0),d0
  69.     bset    #5,d0
  70.     moveq    #'n',d7
  71.     cmp.b    d7,d0
  72.     bne.s    test_off
  73.     moveq    #-1,d5    
  74.     bra.s    do_it
  75.  
  76. test_off:
  77.     cmp.b    #'f',d0
  78.     bne.s    error
  79.     move.b    2(a0),d0
  80.     bset    #5,d0
  81.     moveq    #'f',d7
  82.     cmp.b    d7,d0
  83.     bne.s    error
  84.     moveq    #0,d5
  85.     lea    statustext(pc),a5
  86.     moveq    #'F',d7
  87.     move.b    d7,(a5)
  88.     move.b    d7,1(a5)    
  89.  
  90. do_it:    lea    text(pc),a1
  91.     bsr.s    print
  92.  
  93.     move.l    4.w,a6
  94.     sub.l    a1,a1
  95.     jsr    -294(a6)
  96.     move.l    d0,a0
  97.     beq.s    no_task_found
  98.     move.l    d5,184(a0)    ;pr_windowptr
  99.  
  100. end:
  101.     move.l    4.w,a6
  102.     move.l    dosbase(pc),a1
  103.     jsr    CloseLib(a6)
  104.  
  105. exit:    moveq    #0,d0
  106.     rts
  107.  
  108. no_task_found:
  109.     lea    notasktext(pc),a1
  110.     bsr.s    print
  111.     bra.s    end
  112.  
  113. ; -------------------------------------------
  114. ; ----             SUBROUTINES           ----
  115. ; -------------------------------------------
  116.  
  117. ; *** Prints any ascii text in the current window ***
  118. ; *** Pointer to text must be in >>> a1 <<< ***
  119. ; *** Output handle must be stored in >>> windowhandle <<<<
  120. ; *** all registers saved and written back ***
  121.  
  122. print:
  123.     movem.l    d0-d3/a1/a6,-(sp)
  124.     move.l    a1,d2            ;pointer to text
  125.     moveq    #0,d3            ;counter for chars
  126.  
  127. Endsearch:                ;end of text is $00
  128.     tst.b    (a1)+
  129.     beq.s    EndFound
  130.     addq.l    #1,d3
  131.     dbf    d1,endsearch
  132.  
  133. Endfound:
  134.     move.l    windowhandle(pc),d1
  135.     move.l    dosbase(pc),a6    
  136.     jsr    Write(a6)
  137.     movem.l    (sp)+,d0-d3/a1/a6
  138.     rts
  139.  
  140. Error:
  141.     lea    infotext(pc),a1
  142.     bsr.s    print
  143.     bra.s    end
  144.  
  145. ; -------------------------------------------
  146. ; ----                DATA               ----
  147. ; -------------------------------------------
  148.  
  149. dosname:    dc.b    'dos.library',0
  150.         even
  151.  
  152. parameter:    dc.l    0
  153. windowhandle:    dc.l    0
  154. dosbase:    dc.l    0
  155. optionflag:    dc.b    0
  156.  
  157. ; -------------------------------------------
  158. ; ----           ASCII MESSAGES          ----
  159. ; -------------------------------------------
  160.  
  161. text:
  162.  dc.b $9b,'1;33;40m'
  163.  dc.b 'ReqControl V1.21 '
  164.  dc.b $9b,'0;31;40m'
  165.  dc.b '- by Orlando Budelacci, December 1990, Public domain. ',$a
  166.  dc.b 'Status : O'
  167.  statustext:
  168.  dc.b 'N ',$a,0
  169.  
  170. infotext:
  171.  dc.b 'ReqControl disables the poping up of the windows '
  172.  dc.b 'from the Cli-process',$a
  173.   dc.b 'Usage: Reqcontrol [On] [Off]',$a,$a
  174.  dc.b 'The source of this program was published in '
  175.  dc.b $9b,'0;33;40m'
  176.  dc.b 'ZINE #8 by BRAINSTORM.'
  177.  dc.b $9b,'0;31;40m',$a,$a
  178.  dc.b 'Written by: ',$a
  179.  dc.b ' Orlando Budelacci',$a
  180.  dc.b ' Birmannsgasse 34',$a
  181.  dc.b ' CH-4055 Basle',$a,$a
  182.  dc.b 0
  183.  
  184. notasktext:
  185.  dc.b 'HARD ERROR!!!',$a
  186.  dc.b 'Task not found!!!',$a,$a
  187.  dc.b 0
  188.  
  189.