---------------------------------------------------------------------- Copyright (C) 1990 by Natrlich! This file is copyrighted! Refer to the documentation for details. ---------------------------------------------------------------------- The STD.L65 contains CIO.O65 --- include file "CIO.H65" CIO -- OPEN CLOSE BPUT BGET PRINT INPUT XIO *** WARNING --- THESE MACROS DO LITTLE OR NO ERROR CHECKING*** Macros: OPEN channel,aux1,aux2,string[,flags] f.e. OPEN 2,4,0,file file: .byte "D:FOOBAR.TXT",0 opens in IOCB #2 the file FOOBAR.TXT for reading. The actual assembled code would look something like this: ldx #$20 lda #4 sta icax1,x lda #0 sta icax2,x ... This might not be appropriate in all cases, where you know the values only at runtime. In that case you want output like this lda my_icax1 sta icax1,x lda my_icax2 sta icax2,x ... That's when the flags come into play. With the flags you can specify, which values are supposed to be POKEd ¯ lda #, sta ® and which are to be MOVEd ¯ lda, sta ®. For that purpose most macros have an auxiliary parameter [,flags] as the OPEN macro above. If this parameter is omitted the default is usually POKE. I F you supply a parameter which has to be a number, then the bits of this number are examined to determine, which parameters are to be POKEd and which are to be MOVEd F E D C B A 9 8 7 6 5 4 3 2 1 0 bit +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |x|s|s|s|s|s|s|s|u|p|p|p|p|p|p|p| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 7 6 5 4 3 2 1 7 6 5 4 3 2 1 parameter number x = Special flag -- @SPECIAL s = String flag (maybe used for other purposes) -- @S1 - @S7 u = unused p = POKE flag, 1 == POKE 0 == MOVE -- @P1 - @P7 Which basically means: IF you supply NO flags parameter the default is POKE but IF you DO supply a flags parameter the default (0) is MOVE Therefore to open like above, but with a variable ICAX1 you would call the OPEN macro like this: OPEN #2,what,0,file,@p1+@p3 file: .byte "D:FOOBAR.TXT" what: .byte 8 Note that if you omit the optional flag parameter, the macro assumes the default to be all POKEs not MOVEs!! If you set the @SPECIAL flag, in CIO macros, the macro assumes that the X register is already correctly loaded and does not assemble code that loads the X register. If the channel number is greater than 8, it will be used directly as the X register value. IMPORTANT!! OPEN by default assumes that the fourth parameter is a string parameter (as with PRINT), as if called like this: OPEN 2,8,0,"E:" OPEN will generate a .BYTE "E:" inline and jump around it (not particularly efficient). This is for quick'n mindless hacks. Not recommended. CLOSE channel[,flag] Closes IOCB #channel. BPUT channel,buffer,len[,flags] Outputs >len< bytes of the >buffer< on IOCB #channel. Flag usage is as in OPEN. Refer to the source for further (implicit) infor- mation. BGET channel,buffer,len[,flags] PRINT channel[,buffer[,len[,flags]]] If you omit the length parameter, the macro assumes that the buffer parameter given is really a string, which will be assembled in the macro. Not recommended technique for serious programs, but occasionally useful. If you omit everything but the buffer, a LF will be printed. INPUT channel,buffer,len[,flags] XIO cmd,channel,aux1,aux2,string[,flags]