| Hi, I don't have an example for you but check the RMS routines
documentation and if that fails...
FABs and RABs are defined in one of the macro libraries
(SYS$SHARE:STARLET.MLB or SYS$SHARE:LIB.MLB) and all you have to
do is allocate some memory (via LIB$GET_VM) and then fill it in
appropriately (maybe using the $FAB_STORE [and $RAB_STORE] macro[s]),
and then you have a FAB (or RAB).
Or...maybe you can just re-use the old FABs and RABs you just happen
to have lying around.
|
| .1 is a good idea, particularly if your files all have similar
characteristics. All you need is one FAB and one RAB, space to save all
the IFIs and ISIs.
When you open a file, you plug the FAB to point to the file name,
open, and save the IFI. Then connect and save the ISI.
For a get or put you plug the RAB with the ISI you saved.
For a close you plug the FAB with the IFI you saved.
Since IFIs and ISIs are 16 bits each this costs you 32 bits per
open file. You could pre-allocate the 4k bytes for 1000 files without
feeling too prodigal of virtual address space.
|
| ;
; create a nice FAB on the stack
;
movl 4(ap),ap
subl2 #fab$c_bln, sp ; get space for a fab
movc5 #0,(sp),#0,#fab$c_bln,(sp) ; clean whole area
movb #fab$c_bid,fab$b_bid(sp) ; init id
movb #fab$c_bln,fab$b_bln(sp) ; and lenght
;
; basic fab done; now set options
;
bisl2 #fab$m_cif!fab$m_ufo,fab$l_fop(sp)
movl #n_blocks,fab$l_alq(sp)
bisb2 #fab$m_put,fab$b_fac(sp)
movb #fab$c_rfm_dflt,fab$b_rfm(sp)
movl filnam+4,fab$l_fna(sp)
movb filnam,fab$b_fns(sp)
pushal (sp) ; go, open it
calls #1,G^sys$create
cmpl r0, #rms$_normal
bneq ...
|