Generate a random black and white   320x240   image continuously,
showing FPS (frames per second).



A sample image
 


      dx% = 320
      dy% = 240
      images% = 100000
      VDU 23,22,dx%;dy%;8,8,16,0
 
      REM Create a block of random data in memory:
      DIM random% dx%*dy%+images%
      FOR R% = random% TO random%+dx%*dy%+images%
        ?R% = RND(256)-1
      NEXT
 
      REM Create a BMP file structure:
      DIM bmpfile{bfType{l&,h&}, bfSize%, bfReserved%, bfOffBits%, \
      \   biSize%, biWidth%, biHeight%, biPlanes{l&,h&}, biBitCount{l&,h&}, \
      \   biCompression%, biSizeImage%, biXPelsPerMeter%, biYPelsPerMeter%, \
      \   biClrUsed%, biClrImportant%, biPalette%(255)}
      bmpfile.biSize% = 40
      bmpfile.biWidth% = dx%
      bmpfile.biHeight% = dy%
      bmpfile.biPlanes.l& = 1
      bmpfile.biBitCount.l& = 8
      FOR C% = 0 TO 255
        bmpfile.biPalette%(C%) = C% OR C%<<8 OR C%<<16
      NEXT
 
      REM Display image at a random offset into the data:
      frame% = 0
      TIME = 0
      REPEAT
        bmpfile.bfOffBits% = random% - bmpfile{} + RND(images%)
        OSCLI "MDISPLAY " + STR$~bmpfile{}
        frame% += 1
        IF TIME>10 THEN
          SYS "SetWindowText", @hwnd%, "BBC BASIC: " + STR$(frame%*100 DIV TIME) + " fps"
        ENDIF
      UNTIL FALSE