home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / program / compiler / nasm20b / doc / cio.txt < prev    next >
Text File  |  1983-11-23  |  4KB  |  110 lines

  1.    ----------------------------------------------------------------------
  2.                      Copyright (C) 1990 by Natürlich!
  3.                         This file is copyrighted!
  4.                   Refer to the documentation for details.
  5.    ----------------------------------------------------------------------
  6.  
  7. The STD.L65 contains
  8.    CIO.O65   --- include file "CIO.H65"
  9.  
  10.  
  11. CIO --  OPEN  CLOSE  BPUT  BGET  PRINT  INPUT  XIO
  12.  
  13.    *** WARNING --- THESE MACROS DO LITTLE OR NO ERROR CHECKING***
  14.  
  15. Macros:
  16.    OPEN  channel,aux1,aux2,string[,flags]
  17.  
  18. f.e.     OPEN  2,4,0,file
  19. file:    .byte "D:FOOBAR.TXT",0
  20.  
  21.    opens in IOCB #2 the file FOOBAR.TXT for reading.
  22.    The actual assembled code would look something like this:
  23.       ldx   #$20
  24.       lda   #4
  25.       sta   icax1,x
  26.       lda   #0
  27.       sta   icax2,x
  28.       ...
  29.  
  30.    This might not be appropriate in all cases, where you know
  31.    the values only at runtime. In that case you want output
  32.    like this
  33.  
  34.       lda   my_icax1
  35.       sta   icax1,x
  36.       lda   my_icax2
  37.       sta   icax2,x
  38.       ...
  39.  
  40.    That's when the flags come into play. With the flags you can
  41.    specify, which values are supposed to be POKEd  » lda #, sta «
  42.    and which are to be MOVEd » lda, sta «. For that purpose most
  43.    macros have an auxiliary parameter [,flags] as the OPEN macro
  44.    above. If this parameter is omitted the default is usually
  45.    POKE. I F  you supply a parameter which has to be a number,
  46.    then the bits of this number are examined to determine, which
  47.    parameters are to be POKEd and which are to be MOVEd
  48.  
  49.       F E D C B A 9 8 7 6 5 4 3 2 1 0  bit
  50.      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  51.      |x|s|s|s|s|s|s|s|u|p|p|p|p|p|p|p|
  52.      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  53.         7 6 5 4 3 2 1   7 6 5 4 3 2 1  parameter number
  54.  
  55.       x = Special flag                                -- @SPECIAL
  56.       s = String flag (maybe used for other purposes) -- @S1 - @S7
  57.       u = unused
  58.       p = POKE flag, 1 == POKE 0 == MOVE              -- @P1 - @P7
  59.  
  60.   Which basically means:
  61.      IF you supply NO flags parameter the default is POKE
  62.      but IF you DO supply a flags parameter the default (0) is MOVE
  63.  
  64.   Therefore to open like above, but with a variable ICAX1 you would
  65.   call the OPEN macro like this:
  66.  
  67.       OPEN  #2,what,0,file,@p1+@p3
  68.  
  69. file:    .byte "D:FOOBAR.TXT"
  70. what:    .byte  8
  71.  
  72.    Note that if you omit the optional flag parameter, the macro
  73.    assumes the default to be all POKEs not MOVEs!!
  74.    If you set the @SPECIAL flag, in CIO macros, the macro
  75.    assumes that the X register is already correctly loaded and
  76.    does not assemble code that loads the X register.
  77.    If the channel number is greater than 8, it will be used
  78.    directly as the X register value.
  79.    
  80.    IMPORTANT!!
  81.    OPEN by default assumes that the fourth parameter is a string
  82.    parameter (as with PRINT), as if called like this:
  83.                         OPEN  2,8,0,"E:"
  84.    OPEN will generate a .BYTE "E:" inline and jump around it (not
  85.    particularly efficient). This is for quick'n mindless hacks. 
  86.    Not recommended.
  87.    
  88.  
  89.    CLOSE    channel[,flag]
  90.  
  91.    Closes IOCB #channel.
  92.  
  93.  
  94.    BPUT  channel,buffer,len[,flags]
  95.  
  96.    Outputs >len< bytes of the >buffer< on IOCB #channel. Flag usage
  97.    is as in OPEN. Refer to the source for further (implicit) infor-
  98.    mation.
  99.  
  100.  
  101.    BGET    channel,buffer,len[,flags]
  102.    PRINT   channel[,buffer[,len[,flags]]]
  103.    If you omit the length parameter, the macro assumes that the buffer
  104.    parameter given is really a string, which will be assembled in the
  105.    macro. Not recommended technique for serious programs, but occasionally
  106.    useful. If you omit everything but the buffer, a LF will be printed.
  107.    
  108.    INPUT   channel,buffer,len[,flags]
  109.    XIO     cmd,channel,aux1,aux2,string[,flags]
  110.