Here's a very short MS-DOS debug "script" that will make the screen flash madly until you hit escape. Very fun when at parties where someone use their win9x computer for playing mp3s.

debug
 a
    mov ax, 13
    int 10
    mov ax, a000
    mov es, ax
    mov cx, ffff
    in al, 40
    rep stosb
    in al, 60
    dec al
    jnz 010a
    ret
  hit enter on a blank line
g

Here's a short explanation of what's going on:

  • The two first lines sets 320x200x256 std vga gfx mode
  • The next two lines sets up es target segment to point to video ram at a000:0000
  • The next line sets the cx register to 65535, which will be the number of pixels we try to fill.
  • in al, 40 reads some motherboard timer which will produce a pseudo-random value
  • rep stosb fills video ram with this value. Since we're coding in 16bit realmode, we will wrap around, so it doesn't matter where in the a000 video ram segment we start and stop filling bytes
  • in al,60/dec al reads the keyboard controller and subtracts one
  • if the result is not zero, keep on looping. The result is zero when the keyboard controller returns 1 (for escape).
  • in which case we terminate our program.