home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 364b.lha / PCQ_v1.1 / Runtime / PCQ / openstandards.asm < prev    next >
Encoding:
Assembly Source File  |  1990-04-08  |  921 b   |  52 lines

  1.  
  2.  
  3. *    OpenStandards
  4. *    When a program is run from the Workbench, it does not have
  5. *    standard input and output.  If the program tries a write() or
  6. *    read(), therefore, these files must be created.  This does that.
  7.  
  8.     XREF    _p%DOSBase
  9.  
  10.     XDEF    _p%OpenStandards
  11.  
  12.     XREF    _stdin
  13.     XREF    _stdout
  14.     XREF    _p%wrapitup
  15.     XREF    _LVOOpen
  16.     XREF    filekey
  17.  
  18. _p%OpenStandards
  19.  
  20. *    This routine should return a file handle in d1, but should
  21. *    preserve all other registers.
  22.  
  23.     movem.l    d0/d2/d3/a0/a1/a6,-(sp)    ; save at least these
  24.     move.l    #StdName,d1
  25.     move.l    #1006,d2    ; new file
  26.     move.l    _p%DOSBase,a6
  27.     jsr    _LVOOpen(a6)
  28.     move.l    d0,d1
  29.     bne.s    1$
  30.     jmp    _p%wrapitup    ; can't do it.
  31. 1$
  32.     lea    FileRec,a0
  33.     move.l    filekey,14(a0)
  34.     move.l    a0,filekey    ; attach to file list
  35.     move.l    d0,(a0)
  36.     move.l    d0,_stdin
  37.     move.l    d0,_stdout
  38.  
  39.     movem.l    (sp)+,d0/d2/d3/a0/a1/a6
  40.  
  41.     rts
  42.  
  43.     SECTION    TWO,DATA
  44.  
  45. StdName    dc.b    'CON:0/0/640/200/',0
  46.  
  47.     SECTION OpenStandards3,BSS
  48.  
  49. FileRec    ds.b    18
  50.  
  51.     END
  52.