Skip to content

title: "DrawColorTextBox" description: TRSE built-in method (from IDE help)


DrawColorTextBox

Systems: C64, MEGA65, PLUS4, C128, NES, VIC20, PET
Parameters: a,a,a,b,b,b,b,b


DrawColorTextBox( [addresstable], [colorramaddrtable], [chararray], [column], [row], [width], [height], [color] );

  • [addresstable] - Address table for your screen size
  • [colorramaddrtable] - Address table for your color ram
  • [chararray] - Screen character value array in order of TL,T,TR,R,BR,B,BL,L (8 bytes)
  • [column] - Left column, starting from 0
  • [row] - Top row, starting from 0
  • [width] - Box width
  • [height] - Box height
  • [color] - Box color (0..15)

Description

Draws a colored box to screen memory and color RAM, utilizing AddressTable to accomodate different screen sizes.

An array is used to define characters to draw the box (screen values), in order: top left, top, top right, right, bottom right, bottom, bottom left, left.

AddressTable can be created easily with CreateAddressTable().

Example for C64

program ColorTextBoxExample; var // Defines for screen addresses and size @define screen_mem $0400 @define color_mem $D800 @define screen_width 40 @define screen_height 25 s_addr: array[@screen_height] of integer; // Array to hold address table to screen memory c_addr: array[@screen_height] of integer; // Array to hold address table to color memory petsciibox: array[8] of byte = ($55, $43, $49, $5d, $4b, $43, $4a, $5d); begin // Change screen color to black SCREEN_BG_COL := BLACK; SCREEN_FG_COL := BLACK; // Fill screen memory with space clearscreen($20, ^@screen_mem); // Fill color RAM with black clearscreen(BLACK, ^@color_mem); // Create address tables to screen memory and color RAM createaddresstable(s_addr, @screen_mem, @screen_width, @screen_height); createaddresstable(c_addr, @color_mem, @screen_width, @screen_height); // Draw white text box drawcolortextbox(s_addr, c_addr, petsciibox, 10, 5, 20, 15, WHITE); // Draw red text box drawcolortextbox(s_addr, c_addr, petsciibox, 12, 7, 16, 11, RED); // Loop Forever loop(); end.

Example screenshot

Remarks

It is your responsibility to make sure box is not drawn outside screen memory. Minimum width and height is 3. Smaller values will explode galaxies and burn forests :(

See also

DrawTextBox()