*****************************************************************************
* Project Details                                                           *
* ---------------                                                           *
* Project Name:    CS                                                       *
* Project Version: 1                                                        *
* Copyright:       Anthony N Peck                                           *
* Date:            Sunday 28th May 1995                                     *
* Start DateStamp: 28-May-1995 13.00.40.13                                  *
*                                                                           *
* Contact:                                                                  *
* 68 Woralul St                                                             *
* Waramanga ACT 2611                                                        *
* AUSTRALIA                                                                 *
*                                                                           *
*****************************************************************************
* Project Summary:                                                          *
* ---------------                                                           *
* Simply clears the screen by writing a "CONTROL L" character to the CLI or *
* Shell window.  As opposed to my normal modus operandi, this code contains *
* examples of how to save space so that the executable is small (e.g. no    *
* macros in this code).  Instead of the DosBase being saved to a memory     *
* location, it is stored in the A4 register.  All up these savings change   *
* the executable size from an original 166 bytes to the 116 bytes that you  *
* see now.  There is no real advantage to such a saving, but I thought you  *
* might like to see it anyhow!  The program and the source are FREEWARE!    *
*                                                                           *
*****************************************************************************

; Some Quick equivalents...

ExecBase            = $04          ; Exec Base...ahem
Openlibrary         = -$0228       ; Exec function opens libraries
Closelibrary        = -$019e       ; Exec function closes libraries
Write               = -$30         ; Dos function writes to shell
Output              = -$3C         ; Dos function gets output handle

Start:

; Program really starts here...

        Move.L  ExecBase,A6        ; Move Exec into A6
        Lea     Dosname,A1         ; Load the dos library
        Clr.L   D0                 ; Any version will do
        Jsr     Openlibrary(A6)    ; Jump to open library routine
        Beq     Exit               ; If there's a problem, close down
        Move.L  D0,A4              ; Save DosBase to A4
        Jsr     Output(A4)         ; Jump to output routine
        Move.L  D0,D1              ; Shift output handle to D1
        Move.L  #Clear,D2          ; This is the Clear character
        Move.L  #$01,D3            ; it's only one byte in length
        Jsr     Write(A4)          ; Jump to the Write routine

; Clean up and finish...

Close:        

        Move.L  A4,A1              ; Move Dos Base from A4 to A1
        Jsr     Closelibrary(A6)   ; Jump to Close library routine
                                   ; NB: $04 still in A6 from
                                   ;     previous exec call...

Exit:

        Clr.L   D0                 ; Clear D0
        Rts                        ; Return To System

; Memory Allocations

Dosname:

        Dc.B    "dos.library",$00  ; dos library name

Clear:  Dc.B    $0C                ; Control L (Clear)

        End

