36h FL$SIZE get pack and file statistics
Input - none -
Output

UTW_S1= number of bytes free on datapack (high byte)
D= number of bytes free on datapack (low bytes)
X = number of records of current record type
UTW_S1+1 = address of first free byte (high byte)
UTW_S0 = address of first free byte (low bytes)

Description Returns statistics about the current datapack, and current file or current record type. Counts the number of records of the current type, finds the end of the current datapack and returns the amount of free space.

Used in various OPL commands including SPACE, LAST, COUNT.

See also FL$RSET, FL$OPEN, FL$SETP, and FL$RECT.

Example Get statistics of device B: :
        LDAB    #1              ; A=0, B=1 etc.
        OS      FL$SETP         ; select device to be used by file system
        BCS     ERROR

        OS      FL$SIZE         ; get device info
        BCS     ERROR
                                ; store 3-byte number of bytes free
        STD     BYTES_FREE+1    ; low word
        LDAA    UTW_S1          ; high byte
        STAA    BYTES_FREE

        LDAA    UTW_S1+1        ; store 3 byte address
        STAA    FREE_ADDRESS
        LDD     UTW_S0
        STD     FREE_ADDRESS+1
To count the number of records in A:MAIN :
FILENAME:
        ASCIC   "A:MAIN"

        LDX     #FILE_NAME
        OS      FL$OPEN         ; open "A:MAIN"
        BCS     ERROR

        OS      FL$SIZE         ; get file info
        BCS     ERROR
Errors 194 - battery too low
200 - read pack err
240 - unknown pack
241 - pack not blank
243 - bad device name
244 - read only pack
245 - write pack err
246 - no pack