25h FL$BSAV save block file header
Input

B = block file type.
X = addresse of block file name (leading byte count).
UTW_S0 = length of code to be saved by PK$SAVE.

Output - none -
Description

Called in preparation for saving a block file, FL$BSAV saves a block filename followed by the first four bytes of a long record : $0280 and the length word given in UTW_S0.

Then a call to PK$SAVE must be made to save the data. FL$BSAV checks that there is sufficient room on the pack for both the filename and the long record before writing to the datapack.

If PK$SAVE fails, the user is responsible for any error recovery. The file name is a leading byte count string at X in the form <pack>:<name>.

Example
;       To save an OPL procedure :
        LDX     PROCSIZE        ; UTW_S0 = length of data to be saved
        STX     UTW_S0:
        LDX     #PROCNAME       ; address of procedure name
        LDAB    #83h            ; block file type for OPL procedures
        OS      FL$BSAV
        BCS     ERROR

        LDD     PROCSIZE        ; length of data to be saved
        LDX     #PROCSTART      ; start of data in OPL procedure
        OS      PK$SAVE         ; save the block data
        BCC     DONE            ; branch if all ok

;       if error in PK$SAVE
        CMPB    #245            ; B = error code from PK$SAVE
        BNE     ERROR

;       if WRITE PACK ERROR :
        PSHB                    ; preserve error code
        LDX     #PROCNAME       ; address of procedure name
        LDAB    #83h            ; block file type for OPL procedures
        OS      FL$BDEL         ; try to delete the block file
        PULB
ERROR:  SEC                     ; set carry again
        ...                     ; report error

DONE:
        ...
Errors 194 - battery too low
200 - read pack err
235 - file exists
236 - bad file name
239 - pack full
240 - unknown pack
241 - pack not blank
243 - bad device name
244 - read only pack
245 - write pack err
246 - no pack