#COMPILE EXE
#DIM NONE

FUNCTION PBMAIN () AS LONG

    ' Generate Divisiontable

    ' With Fixed Point Math

    OPEN COMMAND$   FOR BINARY AS #1

    DIM p AS INTEGER
    DIM q AS INTEGER

    DIM div AS DOUBLE

    FOR p = 1 TO 256
        FOR q = 0 TO 255

            div = q / p
            PUT$ #1, Fixedpoint(div)

        NEXT q
    NEXT p

    CLOSE

END FUNCTION

FUNCTION FixedPoint (a AS DOUBLE) AS STRING

    DIM i AS INTEGER
    DIM fpret AS STRING
    fpret = fpret + CHR$(INT(a/256))
    fpret = fpret + CHR$(INT(a) AND 255)
    i = INT((a - INT(a)) * 65536)
    fpret = fpret + CHR$(INT(i/256))
    fpret = fpret + CHR$(INT(i) AND 255)

    FixedPoint = fpret

END FUNCTION
