#COMPILE EXE
#DIM NONE

FUNCTION PBMAIN () AS LONG

    PRINT "sinetwister"
    OPEN ".\SINE.BIN" FOR BINARY AS #1
    DIM x AS INTEGER
    DIM i AS WORD
    DIM a AS INTEGER
    DIM pi AS DOUBLE
    pi = 3.1415926535
    FOR x = 0 TO 1
        FOR i = 0 TO 256
            a = SIN(i/128*pi)*15
            ROTATE LEFT a, 8

            PRINT a; " ";
            PUT #1, ,a
        NEXT i
    NEXT x
    CLOSE
    OPEN ".\COSINE.BIN" FOR BINARY AS #1
    FOR x = 0 TO 1
        FOR i = 0 TO 256
            a = COS(i/128*pi)*15
            ROTATE LEFT a, 8

            PRINT a; " ";
            PUT #1, ,a
        NEXT i
    NEXT x
    CLOSE

    WAITKEY$

END FUNCTION
