;*****  Simple RAW:CSI Output  *****

OpenLib  = -408
closelib = -414
ExecBase = 4

; Amiga DOS Offsets

Open     = -30
Close    = -36
Read     = -42
Write    =-48
Exit     =-144

Mode_old = 1005

run:
     move.l  execbase,a6      ;Pointer to EXEC library
     lea     dosname,a1
     moveq   #0,d0
     jsr     openlib(a6)      ;Open DOS library
     move.l  d0,dosbase
     beq     error            ;Not found

     move.l  dosbase,a6       ;DOS base address in A6

     move.l  #name,d1         ;Pointer to name
     move.l  #mode_old,d2     ;Mode
     jsr     Open(a6)         ;Open window
     move.l  d0,conhandle     ;Reserve handle
     beq     error

     move.l  conhandle,d1     ;Window handle in D1
     move.l  #ttext,d2         ;Text address in D2
     move.l  #tende-ttext,d3   ;Length in D3
     jsr     Write(a6)        ;Display text

     move.l  conhandle,d1     ;Window handle
     move.l  #buffer,d2       ;Buffer address
     move.l  #80,d3           ;max. length
     jsr     Read(a6)         ;Wait for input

     move.l  conhandle,d1
     jsr     Close(a6)        ;Close window

     bra ende                 ;Ready

error:
     move.l  #-1,d0           ;Error status
ende:
     move.l  d0,d1
     move.l  dosbase,a6
     jsr     Exit(a6)         ;End program

     rts                      ;Return to main routine

dosname:     dc.b 'dos.library',0
name:        dc.b 'RAW:20/10/200/100/** Test Window',0
ttext:       dc.b $9b,"4;31;40m"
             dc.b "Underlined!"
             dc.b $9b,"3;33;40m",$9b,"5;20H"
             dc.b "** Hello world!  **",0
tende:
buffer:      blk.b 80
 aligndosbase:     dc.l 0
conhandle:   dc.l 0
 end
