BBC BASIC VDU string generator

This page takes a simplified BASIC program (just REM, VDU, CLS, CLG, COLOUR, GCOL, MODE, PLOT, MOVE and DRAW) and returns a string that can be tweeted to BBCMicroBot. You can find source for this page on Github. This and other code golf tips can be found in the BBC Micro Bot User Guide.

🚀 Rocket, 🎬 Clapper, ⛔ Disable

Enter BBC BASIC code below

VDU code equivalent


PRINT string equivalent

  Open this code on


VDU code summary

  #   Bytes  Meaning
  0     0    does nothing
  1     1    send next character to printer only
  2     0    enable printer
  3     0    disable printer
  4     0    write text at text cursor
  5     0    write text at graphics cursor
  6     0    enable VDU drivers
  7     0    make a short beep
  8     0    backspace cursor one character
  9     0    forwardspace cursor one character
  10    0    move cursor down one line
  11    0    move cursor up one line
  12    0    clear text area
  13    0    move cursor to start of current line
  14    0    page mode on
  15    0    page mode off
  16    0    clear graphics area
  17    1    define text colour
  18    2    define graphics colour
  19    5    define logical colour
  20    0    restore default logical colours
  21    0    disable VDU drivers or delete current line
  22    1    select screen mode
  23    9    re-program display character
  24    8    define graphics window
  25    5    PLOT K,x,y (see next table)
  26    0    restore default windows
  27    0    does nothing
  28    4    define text window
  29    4    define graphics origin
  30    0    home text cursor to top left
  31    2    move text cursor to x,y
  127   0    Backspace and delete

PLOT codes

The complete list of PLOT codes available with OS 1.20 and the Graphics
Extension ROM is as follows:

Plot code  Effect
&00-&07    Solid line, includes both ends
&08-&0F    Solid line, final point omitted
&10-&17    Dot-dash line, includes both ends, pattern restarted
&18-&1F    Dot-dash line, first point omitted, pattern restarted
&20-&27    Solid line, first point omitted
&28-&2F    Solid line, both points omitted
&30-&37    Dot-dash line, initial point omitted, pattern continued
&38-&3F    Dot-dash line, both ends omitted, pattern continued
&40-&47    Point plot
&48-&4F    Line fill left and right to non-background
&50-&57    Triangle fill
&58-&5F    Line fill right to background
&60-&67    Rectangle fill
&68-&6F    Line fill left and right to foreground
&70-&77    Parallelogram fill
&78-&7F    Line fill right to non-foreground
&80-&87    Flood until non-background
&88-&8F    Flood until foreground
&90-&97    Circle outline
&98-&9F    Circle fill
&A0-&A7    Circular arc
&A8-&AF    Circular segment
&B0-&B7    Circular sector
&B8-&BF    Rectangle copy/move
&B8        Move relative
&B9        Relative rectangle move
&BA/&BB    Relative rectangle copy
&BC        Move absolute
&BD        Absolute rectangle move
&BE/&BF    Absolute rectangle copy
&C0-&C7    Ellipse outline
&C8-&CF    Ellipse fill
&E8-&EF    Sprite plot

Within each group of eight PLOT codes the effects are as follows:

Plot code  Effect
   0       move relative
   1       plot relative in current foreground colour
   2       plot relative in logical inverse colour
   3       plot relative in current background colour
   4       move absolute
   5       plot absolute in current foreground colour
   6       plot absolute in logical inverse colour
   7       plot absolute in current background colour

VDU 23 codes

The effects of the various VDU 23 parameters are as follows:

VDU 23,n,p7,P2,p5,p4,p5,p6,p7,p8

   n        Effect
   0        6845 control
   1        Cursor control
   2        Colour pattern 1 (plot with GCOL 16,c)
   3        Colour pattern 2 (plot with GCOL 32,c)
   4        Colour pattern 3 (plot with GCOL 48,c)
   5        Colour pattern 4 (plot with GCOL 64,c)
   6        Dot-dash pattern (set length with *FX 163,242)

  11        Set default colour patterns
  12        Simple pattern 1 (plot with GCOL 16,c)
  13        Simple pattern 2 (plot with GCOL 32,c)
  14        Simple pattern 3 (plot with GCOL 48,c)
  15        Simple pattern 4 (plot with GCOL 64,c)

  27        Select/pick up sprite
  27,0      Select sprite
  27,1      Pick up sprite