Video Functions
From Archaic Pixels
Contents
Video Functions
disp_off
void disp_off(void); |
---|
Blank the display. |
disp_on
void disp_on(void); |
---|
Enable display output. |
cls
void cls(void); |
---|
void cls(int val); |
Clear all the screen. Without parameters the screen is filled with a space character, else it's filled with the bat-value given as argument. |
vsync
void vsync(void); |
---|
void vsync(char nb_frame); |
Synchronize your program to the video vertical blanking signal (VBL), which is 1/60th of a second. Without parameters this function return as soon as a VBL signal has been received, else your program will be synchronized to the number of frame you requested. So for example to run your game at 20fps, just use vsync(3) at the end of your game loop. |
vreg
void vreg(char idx); |
---|
void vreg(char idx, int val); |
This function gives you direct access to the video processor (VDC) registers. The first form of this function is used to just select a VDC register (for custom accesses), and the second is used to set the value of a register (it also selects this register). |
vram_addr
char vram_addr(char x, char y); |
---|
Simple function to return the screen video memory address of the character located at position x/y. |
set_screen_size
void set_screen_size(char size); |
---|
Change the virtual screen size. By default the startup code initialize a virtual screen of 64 characters wide and 32 character tall, but other values are possible, namely : 32x32, 128x32, 32x64, 64x64, or 128x64. More the virtual screen is big, less video memory you have for your graphics (font, tiles, sprites). |
load_vram
void load_vram(int vaddr, int *data, int nb); |
---|
Generic function to load data (BAT, CG, sprites) in video memory, at address 'vaddr'. 'nb' is the number of 16-bit words to load. |
load_bat
void load_bat(int vaddr, int *bat_data, char w, char h); |
---|
Load a rectangular character attribute table (BAT) of width 'w' and of height 'h' in video memory, at address 'vaddr'. |
load_background
void load_background(char *gfx, int *pal, int *bat, char width, char height); |
---|
This function is an all-in-one function, it is used to display a whole background image on the screen, like a game title image. It will load BG character data, it will load the palette, and finaly if will load the BAT. Use it with directives #incchr, #incpal and #incbat to manage the different type of data. The BG character data will be stored at address 0x1000 to 0x5000 in video memory. |
set_xres
void set_xres(int xres); [ 1.5+ ] |
---|
void set_xres(int x_resolution, int color_correct_flag); [ 3.11+ ] |
Change the horizontal resolution to 'xres' (in pixels). This changes the video controller's registers to display more pixels on the screen; it does not affect virtual calculations. color_correct_flag indicates what kind of smoothing must be used, XRES_SHARP or XRES_SOFT. The 5MHz pixel clock will be used up to horizontal resolutions of 268. 7 MHz pixel clok will be used up to 356. 10MHz pixel clock will be used beyond this. Maximum visible resolution seems to be about 512. |