#COMPILE EXE
#DIM ALL

FUNCTION PBMAIN () AS LONG

    ' fixregenvram

    PRINT "fixregenvram v1.0  (C) 2012 oerg866"
    IF COMMAND$ = "" THEN
    PRINT ""
    PRINT "usage:"
    PRINT "fixregenvram <file>"
    EXIT FUNCTION
    END IF

    OPEN COMMAND$(1) FOR BINARY AS #1

        DIM a AS BYTE
        DIM b AS BYTE
        DIM c AS LONG
        a=0
        b=0
        c=1

        PRINT LOF(1)

        WAITKEY$


    WHILE c <= LOF(1)


        GET #1, c, a
        GET #1, c+1, b
        PUT #1, c, b
        PUT #1, c+1, a
        c = c + 2
        PRINT c

    WEND

    CLOSE

END FUNCTION
