unit CRT

Mad Pascal screen and keyboard handling units

author: Tomasz Biela (Tebe)


http://www.freepascal.org/docs-html/rtl/crt/index-5.html

Constants:

name:value:description:
CN_START_SELECT_OPTION0Consol values
CN_SELECT_OPTION1
CN_START_OPTION2
CN_OPTION3
CN_START_SELECT4
CN_SELECT5
CN_START6
CN_NONE7
BW40040x25 B/W on Color Adapter
CO40140x25 Color on Color Adapter
BW80280x25 B/W on Color Adapter
CO80380x25 Color on Color Adapter
Mono780x25 on Monochrome Adapter
C40CO40
C80CO80
Black0
Blue1
Green2
Cyan3
Red4
Magenta5
Brown6
LightGray7
DarkGray8
LightBlue9
LightGreen10
LightCyan11
LightRed12
LightMagenta13
Yellow14
White15
Blink128

Register Variables:

name:address:type:description:
Consol$d01fbyteCONSOL register

Global Variables:

name:type:description:
TextAttrbyte = 0Text Attribute

Interface:

name:description:
CursorOff

procedure CursorOff;


Hide cursor
    CursorOn

    procedure CursorOn;


    Display cursor
      ClrScr

      procedure ClrScr;


      Clear screen
        DelLine

        procedure DelLine;


        Delete line at cursor position
          InsLine

          procedure InsLine;


          Insert an empty line at cursor position
            ReadKey

            function ReadKey: char; assembler;


            Read key from keybuffer
              returns:
            • char
            TextBackground

            procedure TextBackground(a: byte); assembler;


            Set text background
              parameters:
            • a - color value 0..255
            TextColor

            procedure TextColor(a: byte); assembler;


            Set text color
              parameters:
            • a - color value 0..255
            Delay

            procedure Delay(count: word); assembler;


            Waits a specified number of milliseconds
              parameters:
            • count - number of milliseconds
            Keypressed

            function Keypressed: Boolean; assembler;


            Check if there is a keypress in the keybuffer
              returns:
            • TRUE key has been pressed
            • FALSE otherwise
            GotoXY

            procedure GotoXY(x,y: byte); assembler;


            Set cursor position on screen.

            GotoXY positions the cursor at (X,Y), X in horizontal, Y in vertical direction relative to
            the origin of the current window. The origin is located at (1,1), the upper-left corner of the window.
              parameters:
            • x - horizontal positions (1..40)
            • y - vertical positions (1..24)
            WhereX

            function WhereX: byte; assembler;


            Return X (horizontal) cursor position
              returns:
            • byte (1..40)
            WhereY

            function WhereY: byte; assembler;


            Return Y (vertical) cursor position
              returns:
            • byte (1..24)
            ClrEol

            procedure ClrEol;


            ClrEol clears the current line, starting from the cursor position, to the end of the window.
            The cursor doesn't move.
              NoSound

              procedure NoSound; assembler;


              Reset POKEY
                Sound

                procedure Sound(Chan,Freq,Dist,Vol: byte); assembler;


                Plays sound
                  parameters:
                • Chan - channel (0..3) primary POKEY, (4..7) secondary POKEY
                • Freq - frequency (0..255)
                • Dist - distortion (0,2,4,6,8,10,12,14)
                • Vol - volume (0..15)
                TextMode

                procedure TextMode(Mode: byte); assembler;


                Reset E: device
                  parameters:
                • Mode - unused value