Pab Posted September 25, 2022 Share Posted September 25, 2022 (edited) Going through some of my old floppies, at least that haven't succumbed to bit rot, I came across this and thought I'd share it just in case anyone can make use of it. This is a set of routines I used in ACTION! programming for I/O. While the BGET and BPUT are nothing special, there are two routines I found particularly useful in my time. DOPEN is a function that opens the first available IOCB as the specified file and mode and returns the IOCB it used as the result. When juggling multiple files or opening the keyboard or printer for some quick use, I found it more convenient to just take whatever was "next in line" rather than map out which IOCB's I wanted to use and when. Similarly, CLOSEALL goes through all IOCB's (other than #0) and closes them. Handy to just call one routine to close everything. Again, these are old, and probably little more than a curiosity, but I thought it might be fun to share. MODULE ; Extended I/O routines for ACTION! ; ; By Pab Sungenis 18 Je 93 ; Released to the public domain ; ; Type definition for IOCB layout. ; TYPE IOCB=[BYTE id,num,cmd,stat CARD badr,padr,blen BYTE a1,a2,a3,a4,a5,a6] ; ; CIO vector call ; PROC CIOV=$E456(BYTE a,BYTE x) ; DOPEN - Open the next available ; IOCB ; ; This routine looks through IOCB's ; from #1 through #7, and OPENs the ; file at the first available IOCB, ; which is returned by the function. ; BYTE FUNC DOpen(BYTE POINTER fn BYTE ax1,ax2) BYTE ctr,ret,done IOCB POINTER ic ctr=1 ; Ignore IOCB #0 done=0 WHILE (ctr<7) AND (done=0) DO ic=$340+(ctr LSH 4) IF ic.id=$FF THEN done=1 ELSE ctr==+1 FI OD ic.cmd=3 ic.badr=fn+1 ic.blen=fn(0) ic.a1=ax1 ic.a2=ax2 CIOV(0,ctr LSH 4) ret=ctr IF ic.stat>128 THEN ret=ic.stat ic.cmd=$0C CIOV(0,ctr LSH 4) FI RETURN(ret) ; ; CLOSEALL - Close all open IOCB's ; ; Closes any open IOCB other than #0 ; PROC CloseAll() IOCB POINTER ic BYTE ctr ctr=1 ; Ignore IOCB #0 WHILE (ctr<7) DO ic=$340+(ctr LSH 4) IF ic.id#$FF THEN ic.cmd=$0C CIOV(0,ctr LSH 4) FI ctr==+1 OD RETURN ; ; BGET and BPUT - Burst read and write ; CARD FUNC BGet(BYTE i, BYTE POINTER bp, CARD l) IOCB POINTER ic ic=$340+(i LSH 4) ic.cmd=7 ic.badr=bp ic.blen=l CIOV(0,i LSH 4) RETURN(ic.blen) CARD FUNC BPut(BYTE i, BYTE POINTER bp, CARD l) IOCB POINTER ic ic=$340+(i LSH 4) ic.cmd=$D ic.badr=bp ic.blen=l CIOV(0,i LSH 4) RETURN(ic.blen) Edited September 25, 2022 by Pab Correcting errors in original source code. Apparently this was the non-debugged copy. 7 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.