#COMPILE EXE
#DIM NONE

FUNCTION PBMAIN () AS LONG

    PRINT "sinetwister"
    OPEN ".\SINETWISTER.BIN" FOR BINARY AS #1
    DIM x AS INTEGER
    DIM i AS INTEGER
    DIM a AS INTEGER
    DIM pi AS DOUBLE
    pi = 3.1415926535
    FOR x = 0 TO 3
        FOR i = 0 TO 255
            a = SIN(i/128*pi)*255+256
            PRINT a; " ";
            PUT$ #1, CHR$(INT(a/256)) + CHR$(INT(a MOD 256))
        NEXT i
    NEXT x
    CLOSE
    WAITKEY$

END FUNCTION
