Skip to content

VZ200

These paths are relative to units/VZ200/ in the TRSE tree. Reference a unit with @use "<path>" (no .tru extension).

Units

Each section lists procedure and function declarations parsed from the .tru source. Notes come from the block comment immediately above each declaration (/** … */ or /* … */). Line comments (//) are not shown.

Font

Kind Name Signature Notes
procedure SetFont procedure SetFont(currentFont : global pointer); Sets the current font
procedure Draw8x8Font procedure Draw8x8Font(zp:global pointer; text : global pointer; tx, ty : global byte);
procedure DrawTextAt procedure DrawTextAt(text : global pointer; tx, ty : global byte, tran : global boolean); Draws a string in mode(1) graphics mode at x,y Note: Use SetFont() first to configure which to draw. Make sure you use SetPen first or it will draw in the default red. The font is rendered with transparency if the last parameter is true.

Functions

Kind Name Signature Notes
function GetRnd function GetRnd(i : global Integer):Integer; Gets a random integer number 0-65535
function IntToByte function IntToByte(i: global Integer):byte; Converts an Integer to a byte
function ByteToInt function ByteToInt(j: global byte):Integer; Converts a byte to an Integer
procedure Randomize procedure Randomize(); Re-seeds the Randomizer
function getRandFromArray function getRandFromArray(p: global pointer):byte; Takes a pointer to a 256 byte array and returns a random number
procedure IntegerToString procedure IntegerToString(i : global Integer); Converts an Integer number to a string Integer range: -32768 to +32767
procedure ByteToString procedure ByteToString(j : global byte); Converts a Byte number to a string
function SizeOfString function SizeOfString(s: global pointer):byte; Returns the size of a string in byte format
function LastIndexOfChar function LastIndexOfChar(p: global pointer, l: global byte):byte;
function IsBitSet function IsBitSet(Value, BitFlag: global byte): Boolean; Check if a bit is set in a byte eg. if (IsBitSet(flags,16) = false))
function SetBit function SetBit(Value, BitFlag: global byte): Boolean; Set a bit in a byte eg. SetBit(flags,16);
function ResetBit function ResetBit(Value, BitFlag: global byte): Boolean; Reset a bit in a byte eg. ResetBit(flags,16);
function abs function abs(j : global byte):byte; Get the absolute value of a byte eg. v=-123; v=abs(v); v is 123

Input

Kind Name Signature Notes
function ReadKey function ReadKey():byte; Reads the keyboard at this time and returns the value If the value is zero (0) no key was pressed
function WaitChar function WaitChar():byte; Reads the keyboard at this time and returns the value Will loop until any key is pressed
function GetPressedKey function GetPressedKey():byte; Get keyboard key pressed
function GetJoystick function GetJoystick(c : global byte):byte; Get joystick direction/fire pressed

Memory

Kind Name Signature Notes
procedure EnableInterrupts procedure EnableInterrupts() inline; Turns on interrupts. Same as "ei"
procedure DisableInterrupts procedure DisableInterrupts() inline; Turns off interrupts. Same as "di"
procedure PushAll procedure PushAll() inline; Pushes all registers (both pairs) onto the stack. Typically used in interrupts.
procedure PopAll procedure PopAll() inline; Pops all registers (both pairs) from the stack. Typically used in interrupts.

Screen

Kind Name Signature Notes
procedure Cls procedure Cls(u: global byte); Clears the screen using mode parameter 0 or 1
procedure SetMode procedure SetMode(ga: global byte); Sets the VZ200 resolution mode. 0: Text mode 1: Graphics mode 128x64
procedure SetPen procedure SetPen(c: global byte); Set pen colour (0-3) for plotting pixels in mode(1)
function GetPen function GetPen():byte; Get pen colour in mode(1)
procedure SetPaper procedure SetPaper(c : global byte); Set paper (background) color 0 or 1
function getPixel function getPixel(Data: global ^byte, x,y : global byte) : byte;
procedure PutPixel procedure PutPixel(x, y : global byte);
procedure DrawLine procedure DrawLine( x1, y1, x2, y2: global byte); Draws a line in mode(1) in current colour
procedure DrawLineColor procedure DrawLineColor(x1,y1,x2,y2, x:global byte);
procedure DrawRect procedure DrawRect( rx, ry, w, h: global byte); Draws a rectangle in mode(1) in current colour x,y is top-left corner then width and height.
procedure DrawRectFilled procedure DrawRectFilled( rx, ry, w, h: global byte); Draws a filled rectangle in mode(1) in current colour x,y is top-left corner then width and height.
procedure WaitForVerticalBlank procedure WaitForVerticalBlank(); Wait for Vertical Blank
function Peek function Peek(Loc: global Integer):byte; Look up value at location
procedure Poke procedure Poke(Loc: global Integer, i: global byte); Put value at location
procedure doSmoothScroll procedure doSmoothScroll(Loc: global Integer, h: global byte); 1 pixel smooth scroll in mode(1) First parameter is right-most char onscreen of starting location Second parameter is the height of the scroll
procedure doCoarseScroll procedure doCoarseScroll(Data: global pointer, h: global byte); Coarse scroll in mode(1) First parameter is left-most char onscreen of starting location Second parameter is the height of the scroll
procedure doSmoothScrollWrapL procedure doSmoothScrollWrapL(Data: global pointer, h: global byte); 1 pixel smooth scroll left with wrap-around in mode(1) First parameter is right-most char onscreen of starting location Second parameter is the height of the scroll
procedure doSmoothScrollWrapR procedure doSmoothScrollWrapR(Data: global pointer, h: global byte); 1 pixel smooth scroll right with wrap-around in mode(1) First parameter is left-most char onscreen of starting location Second parameter is the height of the scroll
procedure doCoarseScrollWrapR procedure doCoarseScrollWrapR(Data: global pointer, w, h: global byte); 4 pixel coarse scroll right with wrap-around in mode(1) First parameter is right-most byte of starting location (Data pointer + width - 1) Second parameter is the length of data to scroll (0-128 bytes) Third parameter is the height of the scroll
procedure doCoarseScrollWrapL procedure doCoarseScrollWrapL(Data: global pointer, w, h: global byte); 4 pixel coarse scroll right with wrap-around in mode(1) First parameter is left-most byte of starting location Second parameter is the length of data to scroll (0-128 bytes) Third parameter is the height of the scroll
procedure doLineScroll procedure doLineScroll(Loc: global Integer, h: global byte); Move hires screen up one line First parameter is start location onscreen. Second parameter is number of lines down

Sound

Kind Name Signature Notes
procedure Play procedure Play(freq, dur: global Integer); Makes sound. Parameters are for frequency and duration
procedure Beep procedure Beep(); Makes the VZ keyboard BEEP sound
procedure Shoot procedure Shoot(freq, dur: global Integer); Makes shooting sound. Parameters are for frequency and duration
procedure Explode procedure Explode(); Makes explosion sound

Sprite

Kind Name Signature Notes
procedure SetSize procedure SetSize(spritewidth, spriteheight : global byte); Sets the sprites height and width Note: Width is in 4 bits per pixel So a sprite 8 pixels in width would have a width of 2 here.
procedure SetData procedure SetData(spritedata : global pointer); Sets the sprite data
procedure StampAt procedure StampAt(src:global pointer;spritex, spritey,x,y: global byte);
procedure DrawAt procedure DrawAt(spritex, spritey, no: global byte; tran: global boolean); Draws a sprite at x,y using sprite no The last parameter needs to be true or false to draw in XOR transparent mode or not.

Text

Kind Name Signature Notes
procedure PutChar procedure PutChar(c: global pointer); Prints char c at the current cursor position. Control chars are obeyed not printed.
procedure PrintInv procedure PrintInv(c: global pointer); Prints the string at the current cursor position. By default VZ200 prints in inverse. Control chars are obeyed, not printed.
procedure Print procedure Print(c: global pointer); Prints the string at the current cursor position. Control chars are obeyed, not printed.
procedure CursorHome procedure CursorHome(); Move cursor to 0,0
procedure MoveCursorTo procedure MoveCursorTo(x, y: global byte); Move cursor to x,y location onscreen
procedure PrintNumber procedure PrintNumber(i : global Integer); Prints a number to the mode(0) text screen Number is Integer-sized -32767 to 32768
procedure PrintAt procedure PrintAt(x,y: global byte, c: global pointer, z: global byte); Outputs a string to the screen at position x,y the last parameter is 0 for normal text and 1 for inverse
procedure PrintNumberAt procedure PrintNumberAt(x,y: global byte, i: global Integer, z: global byte);

gfx/tiles

Kind Name Signature Notes
procedure SetTileLoc procedure SetTileLoc(tile: global ^byte);
procedure WriteToScreen procedure WriteToScreen(xx,yy,val,wx,wy : byte);

trsedemo

Kind Name Signature Notes
procedure doScroll procedure doScroll();

trtplayer

Kind Name Signature Notes
procedure Initialize procedure Initialize( zp : global pointer );
procedure Play procedure Play();