vga_io.bas

Contains IO primitives for VGA based displays, as well as some mode setters.

Author

Marcel Sondaar

License

Public Domain

Summary
vga_io.basContains IO primitives for VGA based displays, as well as some mode setters.
Functions
Write3C0Writes an index/value pair to VGA register 3C0 (Attribute Control Register)
Write3C2Writes to VGA register 3C2 (Miscellaneous Output Register)
Write3C4Writes an index/value pair to VGA register 3C4 (Sequencer Register)
Write3C6Writes to VGA register 3C6 (DAC Mask Register)
Write3CEWrites an index/value pair to VGA register 3CE (Graphics Controller Register)
Write3D4Writes an index/value pair to VGA register 3D4 (CRTC Controller)
Read3C0Reads an value from the indexed VGA register 3C0 (Attribute Control Register)
Read3C2Reads the value from VGA register 3C2 (Miscellaneous Output Register)
Read3C4Reads an value from the indexed VGA register 3C4 (Sequencer Register)
Read3C6Reads the value from VGA register 3C6 (DAC Mask)
Read3CEReads an value from the indexed VGA register 3CE (Graphics Controller Register)
Read3D4Reads an value from the indexed VGA register 3D4 (CRTC Register)
VGAUnlockCRTCunlocks the CRTC registers
VGAEnableDisplayEnables video output on the VGA
VGASet320x200ModeSet the VGA registers to a 320x200 Mode
VGASet320x240ModeSet the VGA registers to a 320x240 Mode
VGASet400x300ModeSet the VGA registers to a 400x300 Mode
VGASet640x480x16ModeSet the VGA registers to 640x480 16 colors
VGASetTextModeSet the VGA registers to standard text mode
VGASetModeXModifies the CRTC and Sequencer to enter planar addressing mode from a linear mode

Functions

Write3C0

Sub Write3C0 Cdecl Alias "Write3C0" (ByVal index as byte,
ByVal value as Unsigned byte)

Writes an index/value pair to VGA register 3C0 (Attribute Control Register)

in

indexthe AC register to access
valuethe value to write

Write3C2

Sub Write3C2 Cdecl Alias "Write3C2" (ByVal value as Unsigned byte)

Writes to VGA register 3C2 (Miscellaneous Output Register)

in

valuethe value to write

Write3C4

Sub Write3C4 Cdecl Alias "Write3C4" (ByVal index as byte,
ByVal value as Unsigned byte)

Writes an index/value pair to VGA register 3C4 (Sequencer Register)

in

indexthe Sequencer register to access
valuethe value to write

Write3C6

Sub Write3C6 Cdecl Alias "Write3C6" (ByVal value as Unsigned byte)

Writes to VGA register 3C6 (DAC Mask Register)

in

valuethe value to write

Write3CE

Sub Write3CE Cdecl Alias "Write3CE" (ByVal index as byte,
ByVal value as Unsigned byte)

Writes an index/value pair to VGA register 3CE (Graphics Controller Register)

in

indexthe Graphics Register to access
valuethe value to write

Write3D4

Sub Write3D4 Cdecl Alias "Write3D4"(ByVal index as byte,
ByVal value as Unsigned byte)

Writes an index/value pair to VGA register 3D4 (CRTC Controller)

in

indexthe CRTC register to access
valuethe value to write

Read3C0

Function Read3C0 Cdecl Alias "Read3C0" (ByVal index As Byte) As Unsigned Byte

Reads an value from the indexed VGA register 3C0 (Attribute Control Register)

in

indexthe AC register to access

out

returnthe value of the register

Read3C2

Function Read3C2 Cdecl Alias "Read3C2" () As Unsigned Byte

Reads the value from VGA register 3C2 (Miscellaneous Output Register)

out

returnthe value of the Miscellaneous Output Register

Read3C4

Function Read3C4 Cdecl Alias "Read3C4" (ByVal index As Byte) As Unsigned Byte

Reads an value from the indexed VGA register 3C4 (Sequencer Register)

in

indexthe Sequencer register to access

out

returnthe value of the register

Read3C6

Function Read3C6 Cdecl Alias "Read3C6" As Unsigned Byte

Reads the value from VGA register 3C6 (DAC Mask)

out

returnthe value of the DAC Mask Register

Read3CE

Function Read3CE Cdecl Alias "Read3CE" (ByVal index As Byte) As Unsigned Byte

Reads an value from the indexed VGA register 3CE (Graphics Controller Register)

in

indexthe GC register to access

out

returnthe value of the register

Read3D4

Function Read3D4 Cdecl Alias "Read3D4" (ByVal index As Byte) As Unsigned Byte

Reads an value from the indexed VGA register 3D4 (CRTC Register)

in

indexthe CRTC register to access

out

returnthe value of the register

VGAUnlockCRTC

Sub VGAUnlockCRTC Cdecl Alias "VGAUnlockCRTC" ()

unlocks the CRTC registers

VGAEnableDisplay

Sub VGAEnableDisplay Cdecl Alias "VGAEnableDisplay" ()

Enables video output on the VGA

VGASet320x200Mode

Sub VGASet320x200Mode Cdecl Alias "VGASet320x200Mode" ()

Set the VGA registers to a 320x200 Mode

VGASet320x240Mode

Sub VGASet320x240Mode Cdecl Alias "VGASet320x240Mode"()

Set the VGA registers to a 320x240 Mode

VGASet400x300Mode

Sub VGASet400x300Mode Cdecl Alias "VGASet400x300Mode"()

Set the VGA registers to a 400x300 Mode

VGASet640x480x16Mode

Sub VGASet640x480x16Mode Cdecl Alias "VGASet640x480x16Mode"()

Set the VGA registers to 640x480 16 colors

VGASetTextMode

Sub VGASetTextMode Cdecl Alias "VGASetTextMode" ()

Set the VGA registers to standard text mode

VGASetModeX

Sub VGASetModeX Cdecl Alias "VGASetModeX"()

Modifies the CRTC and Sequencer to enter planar addressing mode from a linear mode

To avoid confusion, some only consider “Mode X” to be unchained 320x240x8, but in general it can apply to any 256-color mode

Sub Write3C0 Cdecl Alias "Write3C0" (ByVal index as byte,
ByVal value as Unsigned byte)
Writes an index/value pair to VGA register 3C0 (Attribute Control Register)
Sub Write3C2 Cdecl Alias "Write3C2" (ByVal value as Unsigned byte)
Writes to VGA register 3C2 (Miscellaneous Output Register)
Sub Write3C4 Cdecl Alias "Write3C4" (ByVal index as byte,
ByVal value as Unsigned byte)
Writes an index/value pair to VGA register 3C4 (Sequencer Register)
Sub Write3C6 Cdecl Alias "Write3C6" (ByVal value as Unsigned byte)
Writes to VGA register 3C6 (DAC Mask Register)
Sub Write3CE Cdecl Alias "Write3CE" (ByVal index as byte,
ByVal value as Unsigned byte)
Writes an index/value pair to VGA register 3CE (Graphics Controller Register)
Sub Write3D4 Cdecl Alias "Write3D4"(ByVal index as byte,
ByVal value as Unsigned byte)
Writes an index/value pair to VGA register 3D4 (CRTC Controller)
Function Read3C0 Cdecl Alias "Read3C0" (ByVal index As Byte) As Unsigned Byte
Reads an value from the indexed VGA register 3C0 (Attribute Control Register)
Function Read3C2 Cdecl Alias "Read3C2" () As Unsigned Byte
Reads the value from VGA register 3C2 (Miscellaneous Output Register)
Function Read3C4 Cdecl Alias "Read3C4" (ByVal index As Byte) As Unsigned Byte
Reads an value from the indexed VGA register 3C4 (Sequencer Register)
Function Read3C6 Cdecl Alias "Read3C6" As Unsigned Byte
Reads the value from VGA register 3C6 (DAC Mask)
Function Read3CE Cdecl Alias "Read3CE" (ByVal index As Byte) As Unsigned Byte
Reads an value from the indexed VGA register 3CE (Graphics Controller Register)
Function Read3D4 Cdecl Alias "Read3D4" (ByVal index As Byte) As Unsigned Byte
Reads an value from the indexed VGA register 3D4 (CRTC Register)
Sub VGAUnlockCRTC Cdecl Alias "VGAUnlockCRTC" ()
unlocks the CRTC registers
Sub VGAEnableDisplay Cdecl Alias "VGAEnableDisplay" ()
Enables video output on the VGA
Sub VGASet320x200Mode Cdecl Alias "VGASet320x200Mode" ()
Set the VGA registers to a 320x200 Mode
Sub VGASet320x240Mode Cdecl Alias "VGASet320x240Mode"()
Set the VGA registers to a 320x240 Mode
Sub VGASet400x300Mode Cdecl Alias "VGASet400x300Mode"()
Set the VGA registers to a 400x300 Mode
Sub VGASet640x480x16Mode Cdecl Alias "VGASet640x480x16Mode"()
Set the VGA registers to 640x480 16 colors
Sub VGASetTextMode Cdecl Alias "VGASetTextMode" ()
Set the VGA registers to standard text mode
Sub VGASetModeX Cdecl Alias "VGASetModeX"()
Modifies the CRTC and Sequencer to enter planar addressing mode from a linear mode