/*****************************************************************************\
*                           Systems Research Group                            *
*******************************************************************************


                     ##    ##    ####    ########  ##    ## 
                     ###  ###   ######   ########  ###   ## 
                     ########  ##    ##     ##     ####  ## 
                     ## ## ##  ########     ##     ## ## ## 
                     ##    ##  ##    ##     ##     ##  #### 
                     ##    ##  ##    ##     ##     ##  #### 
                     ##    ##  ##    ##  ########  ##   ### 
                     ##    ##  ##    ##  ########  ##    ## 


*******************************************************************************
*   I. D. Wilson           Last Modified   -   IDW   -   11/02/85             *
\*****************************************************************************/



SECTION "MAIN"



GET "LIBHDR"



LET start()  BE
$(
//  Main routine of the EPROM bootstrap.  We enter here with terminal streams
//  selected, and in buffered mode.

    writes( "HARRIET-I version 1.00 starting*N*N" )

    $(  //  Repeat loop to read characters from the keyboard, and then 
        //  obey the command using OSCLI.

        LET buffer  =  VEC 80/bytesperword
        
        IF  readstring( ">> ", buffer, 80 )  THEN  oscli( buffer )
    $)
    REPEAT
$)



AND readstring( prompt, buffer, size )  =  VALOF
$(
    LET length  =  0

    writef( "%S*E", prompt )

    $(  //  Repeat loop to read characters into the string.
    
        LET ch  =  rdch()
        
        IF  ch = '*N'  |  ch = '*E'  THEN  BREAK

        IF  ch = endstreamch  THEN  RESULTIS  FALSE
        IF  length = size     THEN  RESULTIS  FALSE

        length           :=  length + 1
        buffer % length  :=  ch
    $)
    REPEAT

    buffer % 0  :=  length

    RESULTIS  TRUE
$)


