*****************************************************************************
* Project Details                                                           *
* ---------------                                                           *
* Project Name:    WaitReturn                                               *
* Project Version: 1                                                        *
* Copyright:       Anthony N Peck                                           *
* Date:            Sunday 21st May 1995                                     *
*                                                                           *
* Contact:                                                                  *
* 68 Woralul St                                                             *
* Waramanga ACT 2611                                                        *
* Australia                                                                 *
*                                                                           *
*****************************************************************************
* File Summary:                                                             *
* ------------                                                              *
* Inspired by other similar programs, this is my own attempt at a little    *
* program you can use in a script file to halt the progress of the script   *
* until the user presses the RETURN key.  Enjoy!                            *
*                                                                           *
*****************************************************************************

; Some Quick equivalents...

ExecBase                = $04      ; Exec Base...ahem
_LVOOpenlibrary         = -$0228   ; Exec function opens libraries
_LVOCloselibrary        = -$019e   ; Exec function closes libraries
_LVOWrite               = -$30     ; Dos function writes to shell
_LVOOutput              = -$3C     ; Dos function gets output handle
_LVOInput               = -$36     ; Dos function gets input handle
_LVORead                = -$2A     ; Dos function reads from shell

; A couple of Macros...

Exec            Macro
        Move.L  ExecBase,A6        ; Move Exec into a6
        Jsr     _LVO\1(A6)         ; Add Library offset and call function
                Endm

Calldos         Macro
        Move.L  _DosBase,A6        ; Move Dos into a6
        Jsr     _LVO\1(A6)         ; Add Library offset and call function
                Endm

start:

; Program starts here!

        Lea     Dosname,A1         ; Load the dos library
        Clr.L   D0                 ; Any version will do
        Exec    Openlibrary        ; Macro opens library
        Beq     Exit               ; If there's a problem, close down
        Move.L  D0,_DosBase        ; Save the return address
        Calldos Output             ; Call the output function
        Beq     Close              ; No can do so outta here ->
        Move.L  D0,D1              ; Shift output handle to D1
        Move.L  #Message,D2        ; This is the message...
        Move.L  #SZMess,D3         ; ...plus the length of the message...
        Calldos Write              ; ..and write it  
        Calldos Input              ; Call the input function
        Move.L  D0,D1              ; Shift input handle to D1
        Move.L  ReadSpace,D2       ; the memory for a read
        Move.L  #$01,D3            ; One byte or two?
        Calldos Read               ; ..and write it

Close:        

        Move.L   _DosBase,A1       ; Move dos base into a1
        Exec     Closelibrary      ; Macro closes dos

Exit:

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


_DosBase:  

        Dc.L    $1                         ; Memory for Dos Base

ReadSpace:

        Dc.B    $1                         ; Memory for Read

Dosname:

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

Message:

        Dc.B    "     "                    ; The actual text
        Dc.B    "[33mPress Return: [0m"  ;

SZMess  = *-Message                        ; Size of message

        END
