User Tools

Site Tools


writing_20to_20vdu_20variables

Writing to VDU variables

by Richard Russell, April 2009

The main Help documentation recommends that the VDU variables be treated as read-only values, which are modified only by means of the related VDU commands or associated keywords. However, to achieve certain special effects, or in advanced applications, it may be appropriate to write to those variables. This should be done with care, if unwanted side-effects are not to result.

The table below lists the VDU variables, why you might want to write to them, and the main precautions which need to be considered when doing so:

Variable(s)
Reason(s) to write
Precautions
@vdu.o.x%, @vdu.o.y%
Overcome the 16-bit limitation of VDU coordinates
Values are BBC BASIC units (positive Y upwards)
@vdu.l.x%, @vdu.l.y%
Overcome the 16-bit limitation of VDU coordinates
Values are Windows units (pixels), origin at top-left
@vdu.p.x%, @vdu.p.y%
Overcome the 16-bit limitation of VDU coordinates
Values are Windows units (pixels), origin at top-left
@vdu.tl%, @vdu.tr%
Position text viewport horizontally with pixel accuracy
Values must be >=0 and <1920; ensure text cursor is inside new viewport (e.g. using VDU 30)
@vdu.tt%, @vdu.tb%
Position text viewport vertically with pixel accuracy
Values must be >=0 and <1440; ensure text cursor is inside new viewport (e.g. using VDU 30)
@vdu.d.x%, @vdu.d.y%
Set size of graphics 'dot' independently of character cell size
Will upset drawing of user-defined characters if 'dot' size is not 1/8 of character cell width and height
@vdu.c.x%, @vdu.c.y%
Position text cursor with pixel accuracy in VDU 4 mode
Values are Windows units (pixels); ensure they are within current text viewport
@vdu.hf%
Select special font attributes (e.g. strikeout)
Ensure previous font handle is deleted (“SYS “DeleteObject””); select font into @memhdc% before use (“SYS “SelectObject””)
@vdu.hr%
Overcome the 16-bit limitation of VDU coordinates; Use non-rectangular graphics viewport
Ensure previous region handle is deleted (“SYS “DeleteObject””)
@vdu.g.a&, @vdu.g.c&
Set non-standard logical plotting mode
Value is Windows ROP2 code
@vdu.g.b&, @vdu.g.d&
Select from 16 palette entries, irrespective of MODE
Values should be 0-15 (but see Using larger colour palettes)
@vdu.t.a&, @vdu.t.b&
Change cursor (caret) shape in INPUT replacement, e.g. see NOWAIT.BBC
Must do “SYS “SendMessage”,@hwnd%,&402,0,0” after changing; if @vdu.t.a& >= 32 caret is hidden
@vdu.t.c&, @vdu.t.d&
Select from 16 palette entries, irrespective of MODE
Values should be 0-15 (but see Using larger colour palettes)
@vdu.m.a&
Switch teletext emulation on/off without clearing screen
Setting to 7 when not in MODE 7 may cause problems
@vdu.m.b&
Change colour mask without clearing screen
Normally set only to 1, 3, 7 or 15 (but see Using larger colour palettes)
@vdu.m.c&
Set insert/overtype mode (bit 0) in INPUT replacement, e.g. see NOWAIT.BBC
Change bit(s) 'atomically' using OR= or AND= (or assembler equivalents)
@vdu.m.d&
Set scrolls-until-pause independently of text viewport height
0 = no paging, &80+n = pause after n scrolls

This article is not intended to be exhaustive; side-effects not mentioned here may be experienced when writing to VDU variables. Do so at your own risk.

This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information
writing_20to_20vdu_20variables.txt · Last modified: 2018/04/16 14:39 by richardrussell