         PLEN 60
**********************************************************************
*    Program: LACETOGL- A CLI program to force interlace mode on/off.
*    Author:  Robert Rethemeyer, Sunnyvale, CA  (thru BBS-HT)
*    Date:    07/22/86
*    Status:  RELEASED TO THE PUBLIC DOMAIN, "AS-IS"
**********************************************************************
* This program is modeled after the "SETLACE" C program by
* Bob Pariseau on Fish disk #9.  The advantage of LACETOGL is its
* small size: 248 bytes instead of 15504 for SETLACE.  It takes up only
* one block of space on your workbench disk.  This program works with
* either DOS 1.1 or 1.2, however with 1.2 it has no effect if the
* Workbench Interlace preference is already on.  For more information,
* refer to the documentation accompanying the SETLACE program.
*
* To use this program, just execute it from a CLI.  If interlace mode
* is off, it will be turned on; if it is already on, it is turned off.
* It prints the message "Interlace Toggled" if successful.
**********************************************************************
         NOLIST
  INCLUDE "exec/types.i"
  INCLUDE "libraries/dos_lib.i"
  INCLUDE "graphics/gfxbase.i"
  INCLUDE "graphics/display.i"
         LIST
ExecBase EQU  4
         XREF  _LVOOpenLibrary
         XREF  _LVOCloseLibrary
         XREF  _LVORemakeDisplay
**********************************************************************
LaceTogl:
         MOVE.L  ExecBase,a6
*                                   OPEN DOS LIBRARY
         LEA     doslib(pc),a1
         MOVEQ   #0,d0
         JSR     _LVOOpenLibrary(a6)
         MOVE.L  d0,a4
         BEQ.S   broke1
*                                   OPEN GRAPHICS LIBRARY
         LEA     gfxlib(pc),a1
         MOVEQ   #0,d0
         JSR     _LVOOpenLibrary(a6)
         MOVE.L  d0,a5
         BEQ.S   broke2
*                                   OPEN INTUITION LIBRARY
         LEA     intlib(pc),a1
         MOVEQ   #0,d0
         JSR     _LVOOpenLibrary(a6)
         MOVE.L  d0,a3
         BEQ.S   broke3
*                                   TOGGLE INTERLACE MODE
         EOR.W   #INTERLACE,gb_system_bplcon0(a5)
         MOVE.L  a3,a6
         JSR     _LVORemakeDisplay(a6)
         MOVE.L  ExecBase,a6
*                                   PRINT SUCCESS MESSAGE
         JSR     _LVOOutput(a4)
         MOVE.L  d0,d1
         LEA     mesg(pc),a2
         MOVE.L  a2,d2
         MOVEQ   #18,d3
         JSR     _LVOWrite(a4)
*                                   CLEAN UP AND RETURN
         MOVE.L  a3,a1
         JSR     _LVOCloseLibrary(a6)
broke3   MOVE.L  a5,a1
         JSR     _LVOCloseLibrary(a6)
broke2   MOVE.L  a4,a1
         JSR     _LVOCloseLibrary(a6)
broke1   MOVEQ   #0,d0
         RTS                        ALL DONE
************************************************************       
         CNOP    0,2
mesg     DC.B    'Interlace Toggled',10
         CNOP    0,2
doslib   DC.B    'dos.library',0
         CNOP    0,2
gfxlib   DC.B    'graphics.library',0
         CNOP    0,2
intlib   DC.B    'intuition.library',0
         END
