[comp.sys.atari.8bit] ACTION! BLOCK I/O ROUTINE

curzon@kaoa01.dec.com (05/01/87)

For John Sangster and any others interested, here is a short Action! module
for block i/o  (originally posted by Clint Parker on his BBS system)

NOTE: re prior bugsheet posting: the Action! BBS is no longer up... 

---------------------------------------------------------------------------

MODULE ; BLKIO.ACT

; Copyright (c) 1983, 1984, 1985
; by Action Computer Services (ACS)
;
; This software may be incorporated in
; other software packages providing
; that this copyright notice is also
; incorporated as well.

; version 1.1
; last modified May 8, 1985

BYTE CIO_status


CHAR FUNC CIO=*(BYTE dev, CARD addr,
          size, BYTE cmd, aux1, aux2)
; see hardware manual for description
; of CIOV.
;   IOCB# = dev
;   ICCOM = cmd
;   ICBA  = addr
;   ICBL  = size
;   ICAX1 = aux1
;   ICAX2 = aux2
; ICAX1 and ICAX2 are not set if aux1=0
; The first byte of addr is passed to
; CIO in the A register.  The status
; on return from CIO is stored in
; CIO_status.  If status=$88 then
; EOF(dev) is set to a non-zero value.
; No other error checking is performed
; and the result of the CIOV call is
; returned as the result of this FUNC.
[$29$F$85$A0$86$A1$A$A$A$A$AA$A5$A5
$9D$342$A5$A3$9D$348$A5$A4$9D$349
$A5$A6$F0$8$9D$34A$A5$A7$9D$34B$98
$9D$345$A5$A1$9D$344$20$E456
$8C CIO_status$C0$88$D0$6$98$A4$A0
$99 EOF$A085$60]


CARD FUNC ReadBlock=*(BYTE dev,
                    CARD addr, size)
; Reads size bytes from dev into addr.
; Returns number of bytes read (may
; be < size if EOF).  Set EOF flag if
; EOF is encountered.  Status is  
; saved in CIO_status.
[$48$A9$7$85$A5$A9$0$85$A6$A5$A3$5$A4
$D0$6$85$A0$85$A1$68$60$68$20 CIO
$BD$348$85$A0$BD$349$85$A1$60]


PROC WriteBlock=*(BYTE dev,
                    CARD addr, size)
; Writes size bytes from addr to dev.
; Status is saved in CIO_status.
[$48$A9$B$85$A5$A9$0$85$A6$A5$A3$5$A4
$D0$2$68$60$68$4C CIO]


PROC PutCD=*(BYTE chan, CARD n)
  BYTE c=$AA, lo=$AB, hi=$AC

; save args
  [
    $85 c
    $86 lo
    $84 hi
  ]

; PutD(c, lo)
; PutD(c, hi)
  CIO(c,lo,0,11,0)
  CIO(c,hi,0,11,0)
RETURN


CARD FUNC GetCD(BYTE chan)
  CARD out
  BYTE lo=out, hi=out+1

; lo = GetD(chan)
; hi = GetD(chan)
  lo = CIO(chan,0,0,7,0)
  hi = CIO(chan,0,0,7,0)
RETURN(out)

MODULE ; for user

---------------------------------------------------------------------------


				Dick Curzon
				Digital Equipment of Canada
                                PO Box 13000
                                Kanata Ontario      K2K 2A6
                                Canada.

(DEC E-NET)	KAOA01::CURZON
(UUCP)		{decvax, ucbvax, allegra}!decwrl!kaoa01.dec.com!curzon
(ARPA)		curzon%kaoa01.DEC@decwrl.ARPA