* == hogger.asm ========================================================
*
* Written 1988 by William S. Hawes >>> Freely Distributable <<<
*
* ======================================================================
* A prompt-string command to check and clear any hanging "forbid" counts.
* Usage: hogger

         INCLUDE  "exec/types.i"
         INCLUDE  "exec/macros.i"
         INCLUDE  "exec/tasks.i"

TDNestCnt EQU     295                  ; task-disable count

         XLIB     CloseLibrary
         XLIB     OpenLibrary
         XLIB     Permit

         XLIB     Output
         XLIB     Write

start    movea.l  4,a6                 ; load ExecBase

         moveq    #0,d0                ; clear return
         cmpi.b   #-1,TDNestCnt(a6)    ; forbidden?
         beq.s    1$                   ; no

         lea      DOSLib(pc),a1
         CALLSYS  OpenLibrary
         move.l   d0,d5

         ; Report our message ...

         lea      Hogger(pc),a0        ; message
         move.l   a0,d2
         moveq    #HOGCNT,d3           ; count
         exg      d5,a6
         CALLSYS  Output               ; D0=stream
         move.l   d0,d1
         CALLSYS  Write
         exg      d5,a6

         ; ... and restore task switching.

         clr.b    TDNestCnt(a6)        ; clear count
         CALLSYS  Permit               ; ... and reenable

         movea.l  d5,a1
         CALLSYS  CloseLibrary
         moveq    #5,d0                ; return code

1$:      rts

DOSLib   dc.b     'dos.library',0
Hogger   dc.b     'Hogger! '
HOGCNT   EQU      *-Hogger

         END
