GRTEXT - Graphics and Text Libraries

GRTEXT is sort of like a library for graphics and sound routines. It is specific to the DTV and only the 256 color mode. It is fairly crude right now, but it works reliably. THe main features it has right now which are usefull are these subroutines:

  • i256mod - This initializes the 256 color mode for the DTV
  • clrscr - Clears the screen with whatever the current PC (pixel color) is set to
  • plot - Plots a pixel. Needs PC (pixel color) XCORH/XCORL (x coordinate) and YCOR set first.
  • cplot - Plots a character. Needs PC (in this case Plot Character) set, along with XCORL and YCORL. You will also need to set CSIZE which tells it how wide the character font is and FONTL/FONTM/FONTH which contains the location in memory of the font. This plots screen-codes, just like the original C64's text screen memory.
  • HLINE/VLINE - Draw a straight horizontal or vertical line in the color of your choice.
  • FBOX - Draw a filled box with the color of your choice.
  • CHROUT - Basically plots a character (in PC) and advances the cursor. It also converts PETSCII to screencodes, detects the end of a line, deals with return and cursor up (currently). For this to work, you will need most of the same settings as cplot, but also need MCOL, which can be calculated automatically by running the subroutine SETUP.
  • TYPE - And lastly a small demonstration routine, which allows you to type at the computer's keyboard and have it show up on the display. Press the left-arrow (not the cursor key, but the Commodore arrow key, which on a PS/2 keyboard is the ` or ~ key right under ESC) to exit the program.

    To make much use of this, you'll need a font installed. The latest version includes code to copy the 8-pixel wide font stored in the kernal ROM for use here. If you want any other sized font, You'll need to download my FONTEDIT program and an example font. You can use the font edit program to copy the font into high-memory, or use the flash utility to copy it to flashram somewhere. The program defaults to $006000 for the font location, which is the area the the font-editor actually stores it in while editing. You'll know the font isn't in the right place if you type garbage characters on the screen.

    Note that the garbage pixels on the right of the screen shown in the example picture above was from an older version. The new clrscrn routine works better and faster.

    Download the source: grtext.asm
    Download the binary: grtext.prg

    Back to main DTV Hacking Page