-

Difference between revisions of "LIBRARIES PUBLIC DOCUMENT ESGFXLIB V9990"

From HI-TECH C for CP/M Fan WIKI(EN)
Jump to: navigation, search
(Created page with "ESGFXLIB_V9990_en V9990 Graphic Library for HI-TECH C version0.3 (c) 2002 Airam Rodriguez Rodriguez (airan@vanaga.es) ==USE CONDITIONS== This is not the complete library fo...")
 
 
Line 24: Line 24:
 
==xxxxx==
 
==xxxxx==
  
;#define vdp (int)0x60
+
;<nowiki>#define</nowiki> vdp (int)0x60
  
;#define outreg(x) (outp (vdp + 3, x))
+
;<nowiki>#define</nowiki> outreg(x) (outp (vdp + 3, x))
  
;#define setreg(x) (outp (vdp + 4, x))
+
;<nowiki>#define</nowiki> setreg(x) (outp (vdp + 4, x))
  
;#define c_abort  (int)0x00
+
;<nowiki>#define</nowiki> c_abort  (int)0x00
  
;#define c_lmmc    (int)0x10
+
;<nowiki>#define</nowiki> c_lmmc    (int)0x10
  
;#define c_lmmv    (int)0x20
+
;<nowiki>#define</nowiki> c_lmmv    (int)0x20
  
;#define c_lmcm    (int)0x30
+
;<nowiki>#define</nowiki> c_lmcm    (int)0x30
  
;#define c_lmmm    (int)0x40
+
;<nowiki>#define</nowiki> c_lmmm    (int)0x40
  
;#define c_cmmc    (int)0x50
+
;<nowiki>#define</nowiki> c_cmmc    (int)0x50
  
;#define c_cmmk    (int)0x60
+
;<nowiki>#define</nowiki> c_cmmk    (int)0x60
  
;#define c_cmmm    (int)0x70
+
;<nowiki>#define</nowiki> c_cmmm    (int)0x70
  
;#define c_bmxl    (int)0x80
+
;<nowiki>#define</nowiki> c_bmxl    (int)0x80
  
;#define c_bmlx    (int)0x90
+
;<nowiki>#define</nowiki> c_bmlx    (int)0x90
  
;#define c_bmll    (int)0xa0
+
;<nowiki>#define</nowiki> c_bmll    (int)0xa0
  
;#define c_line    (int)0xb0
+
;<nowiki>#define</nowiki> c_line    (int)0xb0
  
;#define c_srch    (int)0xc0
+
;<nowiki>#define</nowiki> c_srch    (int)0xc0
  
;#define c_point  (int)0xd0
+
;<nowiki>#define</nowiki> c_point  (int)0xd0
  
;#define c_pset    (int)0xe0
+
;<nowiki>#define</nowiki> c_pset    (int)0xe0
  
;#define c_advance (int)0xf0
+
;<nowiki>#define</nowiki> c_advance (int)0xf0
  
 
==V9990 SCREEN MODES==
 
==V9990 SCREEN MODES==
  
;#define P1 1
+
;<nowiki>#define</nowiki> P1 1
;#define P2 2
+
;<nowiki>#define</nowiki> P2 2
;#define B1 3
+
;<nowiki>#define</nowiki> B1 3
;#define B2 4
+
;<nowiki>#define</nowiki> B2 4
;#define B3 5
+
;<nowiki>#define</nowiki> B3 5
;#define B4 6
+
;<nowiki>#define</nowiki> B4 6
;#define B5 7
+
;<nowiki>#define</nowiki> B5 7
;#define B6 8
+
;<nowiki>#define</nowiki> B6 8
  
 
==LOGOP==
 
==LOGOP==
  
;#define PSET  (int)0x0c
+
;<nowiki>#define</nowiki> PSET  (int)0x0c
  
;#define PRESET  (int)0x03
+
;<nowiki>#define</nowiki> PRESET  (int)0x03
  
;#define AND    (int)0x08
+
;<nowiki>#define</nowiki> AND    (int)0x08
  
;#define OR      (int)0x0e
+
;<nowiki>#define</nowiki> OR      (int)0x0e
  
;#define XOR    (int)0x06
+
;<nowiki>#define</nowiki> XOR    (int)0x06
  
 
== SCREEN DATA - IMAGE SPACE (DOTS) ==
 
== SCREEN DATA - IMAGE SPACE (DOTS) ==
  
;#define D256 0
+
;<nowiki>#define</nowiki> D256 0
 
::256 Dots in X direction
 
::256 Dots in X direction
  
;#define D512 4
+
;<nowiki>#define</nowiki> D512 4
 
::512 Dots in X direction
 
::512 Dots in X direction
  
;#define D1024 8
+
;<nowiki>#define</nowiki> D1024 8
 
::1024 Dots in X direction
 
::1024 Dots in X direction
  
;#define D2048 12
+
;<nowiki>#define</nowiki> D2048 12
 
::2048 Dots in X direction
 
::2048 Dots in X direction
  
;#define BIT2 4
+
;<nowiki>#define</nowiki> BIT2 4
 
::Up to 4 colors
 
::Up to 4 colors
  
;#define BIT4 16
+
;<nowiki>#define</nowiki> BIT4 16
 
::Up to 16 colors
 
::Up to 16 colors
  
;#define BIT8 256
+
;<nowiki>#define</nowiki> BIT8 256
 
::Up to 256 colors
 
::Up to 256 colors
  

Latest revision as of 17:58, 19 April 2018

ESGFXLIB_V9990_en V9990 Graphic Library for HI-TECH C version0.3

(c) 2002 Airam Rodriguez Rodriguez (airan@vanaga.es)

USE CONDITIONS

This is not the complete library for the control of the v9990, the full version has the use of the sprite and cursor features in the bitmap modes. These functions are implemented but have not been sufficiently tested so they have not been included in this version.

The library v9990 is freeware (free), it is free to be distributed without changes with respect to the original, but if you use these libraries in your programs.

You should:

For personal use: Make mention of the use of this library and its author in any part of the program, as well as the version number in use.
For commercial use: (to be distributed free or for payment) you must send me a copy of your program.

For any advice, question, comment or failure you find in these libraries, please write to: <airan@vanaga.es>.


xxxxx

#define vdp (int)0x60
#define outreg(x) (outp (vdp + 3, x))
#define setreg(x) (outp (vdp + 4, x))
#define c_abort (int)0x00
#define c_lmmc (int)0x10
#define c_lmmv (int)0x20
#define c_lmcm (int)0x30
#define c_lmmm (int)0x40
#define c_cmmc (int)0x50
#define c_cmmk (int)0x60
#define c_cmmm (int)0x70
#define c_bmxl (int)0x80
#define c_bmlx (int)0x90
#define c_bmll (int)0xa0
#define c_line (int)0xb0
#define c_srch (int)0xc0
#define c_point (int)0xd0
#define c_pset (int)0xe0
#define c_advance (int)0xf0

V9990 SCREEN MODES

#define P1 1
#define P2 2
#define B1 3
#define B2 4
#define B3 5
#define B4 6
#define B5 7
#define B6 8

LOGOP

#define PSET (int)0x0c
#define PRESET (int)0x03
#define AND (int)0x08
#define OR (int)0x0e
#define XOR (int)0x06

SCREEN DATA - IMAGE SPACE (DOTS)

#define D256 0
256 Dots in X direction
#define D512 4
512 Dots in X direction
#define D1024 8
1024 Dots in X direction
#define D2048 12
2048 Dots in X direction
#define BIT2 4
Up to 4 colors
#define BIT4 16
Up to 16 colors
#define BIT8 256
Up to 256 colors


Arrays for use with sprites. Not tested yet

typedef struct { unsigned red, green, blue; } colors;

typedef struct { unsigned char ncolors; colors data[63]; } palettes;


Number of colors on screen

extern int nColors;
extern palettes palette;


Functions

void vsync(void);
vsync - Wait for the vertical screen refresh.
Variables:
Any.
void setreg (unsigned char reg);
setreg - Sets the register in which to write.
Variables:
reg - Register number.
void regvdp (unsigned char reg, unsigned char data);
regvdp - sends a data to a specified vdp register.
Variables:
reg - Register number.
data - Data to send.
unsigned char regStatus (unsigned char reg);
regStatus - Returns the value of the specified status register.
Variables:
reg - Status register number
void setBgColor (unsigned char color);
setBgColor - Sets the background color.
Variables:
color - Color index in color palette.
void setAddress (unsigned address);
setAddress - Sets the pointer in a given direction with auto increment
Variables:
color - Color index in color palette.
void vpoke (unsigned address, unsigned char data);
vpoke - Sets the value of a VRAM memory address.
Variables:
address - Memory address.
data - Bytes to send.
unsigned char vpeek (unsigned address);
vpeek - Gets the value of a particular VRAM memory address
Variables:
address - Memory adress.
void v9scroll (unsigned scax, unsigned scay, unsigned scbx, unsigned scby, unsigned roll);
v9scroll - Generate scrolls on screen A and B.
Variables:
scax - Line on the x axis of the screen A
scay - Line on the y axis of the screen A
scbx - Line on the x axis of the screen B
scby - Line on the y axis of the screen B
roll - Image roll (
void scroll (unsigned char line);
scroll - Sets the upper display line
Variables:
line - Actual number of the top line.
void setLogop(unsigned char logop);
setLogop - Sets the default logical operation (PSET).
Variables:
logop - Logical operation(PSET, AND, OR, XOR, PRESET)
void setMasks (unsigned char mask0, unsigned char mask1);
Set masks to command for default (0xFF,0xFF)
Variables:
mask0 - mask 0
mask1 - mask 1
void outcmd (int command);
outcmd - Execute a VDP command.
Variables:
command - Number of command.
void pset (unsigned x, unsigned y, unsigned char color);
pset - Illuminates a point on the screen
Variables:
x, y - Coordinate of the point.
color - Color index of the point in the color palette.
Basic:
pset (x,y),color
unsigned char point (int x, int y);
point - Gets the color of a point on the screen.
Variables:
x, y - Coordinates of the point.
Basic:
color = point (x,y)
void line (unsigned x, unsigned y, unsigned xd, unsigned yd, unsigned char color);
line - Draw a line between two points.
Variables:
x, y - Coordinates of the initial point.
xd, yd - Coordinates of the final point.
color - Color index of the point in the color palette.
Basic:
line (x,y)-(xd,yd),color
void box (unsigned x, unsigned y, unsigned xd, unsigned yd, unsigned char color);
box - Draw a rectangle between two points.
Variables:
x, y - Coordinates of the initial vertex.
xd, yd - Coordinates of the final vertex.
color - Color index of the line in the color palette.
Basic:
line (x,y)-(xd,yd),color,b
void copy (unsigned sx, unsigned sy, unsigned dx, unsigned dy, unsigned sp, unsigned x, unsigned y, unsigned dp);
copy - Copy a rectangular area given by a coordinate from a particular screen point.
Variables:
sx, sy - Coordinates of the initial vertex.
dx, dy - Coordinates of the final vertex.
sp - Image source page.
x, y - Starting Area Coordinates.
dp - Image destination page.
- Coordinates related to screen ([256 | 512] x 212)
Basic:
copy (sx,sy)-(dx,dy),sp to (x,y),dp
void copyAbs (unsigned sx, unsigned sy, unsigned dx, unsigned dy, unsigned x, unsigned y) ;
copyAbs - Copy a rectangular area given by a coordinate from a given point on the screen.
Variables:
sx, sy - Coordinates of the initial vertex.
dx, dy - Coordinates of the final vertex.
sp - Image source page.
x, y - Starting Area Coordinates.
dp - Image destination page.
- Absolute coordinates to memory ([256 | 512] x 1024) (128 kb VRAM)
Basic:
copy (sx,sy)-(dx,dy),sp to (x,y),dp
void paint (unsigned sx, unsigned sy, unsigned dx, unsigned dy, unsigned char color);
paint - fills a rectangular surface of a certain color.
Variables:
sx, sy - Coordinates of the initial vertex.
dx, dy - Coordinates of the final vertex.
color - Color index of the point in the color palette.
Basic:
line (sx,sy)-(dx,dy),color,bf
void setAdjust (int x, int y);
setAdjust - set initial of visualized area of the screen
Variables:
x, y - Initial coordinates of the screen start area.
Basic:
set adjust x, y
void setPalette (palettes *pal);
setPalette - set specified color palette
Variables:
pal - palettes of palettes type.
void setColor (unsigned char color, unsigned char red, unsigned char green,unsigned char blue);

setColor - Sets the RGB components of an index of the color palette.

Variables:
color - Color index in color palette.
red - Value of the red component.
green - Value of the green component.
blue - Value of the blue component.
Basic:
set color (color,red,green,blue)
colors getColor (unsigned char ncolor);
GetColor - Gets the RGB components of an index of the color palette.
Variables:
ncolor - Specify the color of color palettes
void v9screen (unsigned char nscreen, unsigned char wide, unsigned char ncolors);
v9screen - Initialize determined v9990 graphic mode
Variables:
nscreen: Number of screen (P1 - B6)
wide: virtual screen width (D256, D512, D1024)
ncolors: depth of color (BIT2 - BIT16)
Note: See v9990 datasheets for different possibilities.
void screen (unsigned char mode);
screen - Initialize the graphic mode compatible with MSX(V9938/9958).
Variables:
mode: Screen mode (4 - 12)
void cpu2vdp (unsigned x, unsigned y, unsigned xd, unsigned yd, unsigned dir);
cpu2vdp - transfer of a ram block to vdp
Variables:
x,y,xd,yd : final coordenates.
dir: start RAM address.
Basic:
Any -- not tested
unsigned char v9Detect(void);
v9Detect - detect connection of gfx9000
1 - Yes, connected.
0 - No, not connected.