.title PDPRW cut/patse and help read/write routines .ident /1.0.01/ .library /lb:[1,1]rmsmac.mlb/ ; 20-Jun-85 16:38:04 Brian Nelson ; ; For proper documentation, see DISKIO.MAR (the VMS version) ; for detailed explanations of functions. .macro save list .if b , .ift save .iff .irp x, mov x,-(sp) .endr .endc .endm save .macro unsave list .if b , .ift unsave .iff .irp x, mov (sp)+,x .endr .endc .endm unsave .macro print s,l .print s,l .endm print .MACRO GLOBAL LIST .GLOBL LIST .ENDM GLOBAL .MACRO .ASSUME ARG1,COND,ARG2 .IF COND - .IFF .ERROR ARG1 ;"COND ARG2" FAILS .ENDC .ENDM .ASSUME .macro .chksp arg .ntype $$5 ,arg .iif eq,<$$5 & 7>-6, .error arg ; Illegal use of SP(r6) in call .endm .chksp cr = 15 lf = 12 ff = 14 soh = 1 .enabl gbl .psect rmscod ,ro,i,lcl,rel,con .psect rmsdat ,rw,d,lcl,rel,con .even rwfunc: .word 0 .mcall fabof$ .mcall rabof$ .mcall xabof$ fabof$ RMS$L rabof$ RMS$L xabof$ RMS$L .mcall $compar ,$fetch ,$store ,$rewin .mcall $close ,$creat ,$erase ,$open .mcall $connec ,$delet ,$discon,$find .mcall $get ,$put ,$updat ,$flush .mcall $read ,$write ,$off ,$set .mcall $testbit,$parse .sbttl read help file .psect rmscod reahlp::save mov #rab$hl ,r2 ; the rab for help file mov 2+4(sp) ,o$bkt(r2) ; the vbn to read clr o$bkt+2(r2) ; msw of vbn mov 2+2(sp) ,o$ubf(r2) ; buffer address mov 2+2(sp) ,o$rbf(r2) ; buffer address mov #1000 ,o$usz(r2) ; buffer size mov #1000 ,o$rsz(r2) ; buffer size $read r2 mov o$sts(r2),r0 ; get the status bmi 90$ ; oops mov #1 ,r0 ; success br 100$ ; exit 90$: mov r0 ,tedsyserror ; save error clr r0 ; failure 100$: unsave ; pop reg return ; exit ; REACBUFFER(buffer_address,vbn,window) ; WRICBUFFER(buffer_address,vbn,window) ; ; Decus C conventions: ; ; Passed: ; 2(sp) buffer address ; 4(sp) vbn ; 6(sp) window ; ; Return: r0 zero for error, one for success ; $save1 = 10 reacbuffer:: clr rwfunc br ctreawri wricbuffer:: mov sp ,rwfunc br ctreawri ctreawri: save ; save temp registers please mov 6+$save1(sp),r4 ; copy the window number over asl r4 ; word addressing mov cutmap(r4),r3 ; get the map into internal lun beq 90$ ; nothing to map (invalid channel) asl r3 ; word addressing tst cutopen(r4) ; is this file open yet ? bne 30$ ; yes mov fablst(r3),r2 ; no, get the fab address for it $create r2 ; try hard to create the file mov o$sts(r2),tedsyserror ; get the i/o status bmi 90$ ; failed mov rablst(r3),r2 ; get the record access block address $connec r2 ; connect access stream also mov o$sts(r2),tedsyserror ; get the i/o status bmi 90$ ; failed mov sp ,cutopen(r4) ; flag that we created the file 30$: mov rablst(r3),r2 ; get RAB address mov 4+$save1(sp),o$bkt(r2) ; stuff the desired vbn to read/write clr o$bkt+2(r2) ; never use the high vnb word mov 2+$save1(sp),o$ubf(r2) ; stuff the user buffer address mov 2+$save1(sp),o$rbf(r2) ; the user record buffer address mov #1000 ,o$usz(r2) ; and the user buffer size mov #1000 ,o$rsz(r2) ; and size tst rwfunc ; read or write today? bne 40$ ; write $read r2 ; read br 50$ ; exit 40$: $write r2 ; 50$: mov o$sts(r2),tedsyserror ; get the io status bmi 90$ ; success mov #1 ,r0 ; return(1) br 100$ ; and exit 90$: clr r0 ; return(0) 100$: unsave ; pop registers and exit return .end