Changing video mode using the Falcon XBIOS

From Atari Wiki
Jump to navigation Jump to search

back to Programming

Changing video mode.

Changing video mode is relatively simple on the Falcon using the XBIOS calls. XBIOS 89 (Montype) returns the monitor type (as a 16-bit integer). This is encoded as follows :-

0 = ST mono monitor
1 = ST colour monitor
2 = VGA monitor
3 = Television

This value can be used to determine the correct mode required for each monitor type. XBIOS 88 (Vsetmode) accepts an integer (ie 1 word) parameter. This value is a description of the required videomode. It returns an integer, which describes the resolution that the falcon was previously in. This value can then be passed as a parameter again to restore the videomode. The format of the modecode (the mode descriptor) is as follows -

h s o p v 8 n n n
h - vertical height (double line / interlace - dependant on montype)
s - ST compatibility mode
o - overscan (enabled)
p - PAL / NTSC (ie set = 50Hz, clear = 60 Hz)
v - VGA mode 
8 - set 80 column mode
n - Number of colours. This is a 3 bit binary number. 0=2 colours,1=4 colours, 2=16 colours, 3=256 colours, 4=65536 colours.

Thus, if 320x240x65536 on a VGA monitor was wanted, the modecode would be %100010100 NOTE: There seems to be a problem using this call from a ST compat. mode on TOS 4.02 Does anyone know anything about this? XBIOS 5 (Setscreen) has been upgraded on the Falcons TOS to accept an extra value. If you request a video mode of 3 (invalid on ST), and pass a modecode (as defined above) as an extra parameter, it will switch to this video mode. More details soon...

XBIOS 91 (Vgetsize) takes a 16-bit integer value, which is a modecode as described above, and returns the amount of memory that a screen of this mode would take up.

The other method of changing videomode is to manually change the hardware registers. This is a bit risky as, theoretically, you could damage a monitor if you give them the wrong values. The advantage of this method is that you can create custom screensizes, which may be much larger than that allowed by the XBIOS calls. The horizontal control regs. are at address $ff8280 to $ff8290, and the vertical regs. are at $ff82a0 to $ff82ac (inclusive). Other registers are needed, these are (IIRC) $ff820e, $ff8210, $ff8266, $ff82c0 and $ff82c2.