
*****************************************************************************
* 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                                                                 *
*                                                                           *
* E-Mail: Anthony.Peck@Radford.act.edu.au                                   *
*                                                                           *
*****************************************************************************
* File Summary:                                                             *
* ------------                                                              *
*                                                                           *
* Usage: WaitReturn                                                         *
*                                                                           *
* 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
SZMess                  = $1C      ; Size of message
_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"   ;

        END

