PVcollib  1.5.0
A devkit for ColecoVision
video.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------------
2 
3  Generic video functions
4 
5  Copyright (C) 2018-2019
6  Alekmaul
7 
8  This software is provided 'as-is', without any express or implied
9  warranty. In no event will the authors be held liable for any
10  damages arising from the use of this software.
11 
12  Permission is granted to anyone to use this software for any
13  purpose, including commercial applications, and to alter it and
14  redistribute it freely, subject to the following restrictions:
15 
16  1. The origin of this software must not be misrepresented; you
17  must not claim that you wrote the original software. If you use
18  this software in a product, an acknowledgment in the product
19  documentation would be appreciated but is not required.
20  2. Altered source versions must be plainly marked as such, and
21  must not be misrepresented as being the original software.
22  3. This notice may not be removed or altered from any source
23  distribution.
24 
25 ---------------------------------------------------------------------------------*/
39 #ifndef COL_VIDEO_INCLUDE
40 #define COL_VIDEO_INCLUDE
41 
42 #include <coleco/coltypes.h>
43 
44 #define FNTNORMAL 0
45 #define FNTITALIC 1
46 #define FNTBOLD 2
47 #define FNTBOLD_ITALIC (FNTITALIC | FNTBOLD)
48 
49 #define chrgen 0x0000
50 #define coltab 0x2000
51 #define chrtab 0x1800
52 #define chrtab2 0x1B00
53 #define sprtab 0x3800
54 #define sprgen 0x1f00
55 
56 #define COLTRANSP 0
57 #define COLBLACK 1
58 #define COLMEDGREEN 2
59 #define COLLITGREEN 3
60 #define COLDRKBLUE 4
61 #define COLLITBLUE 5
62 #define COLDRKRED 6
63 #define COLCYAN 7
64 #define COLMEDRED 8
65 #define COLLITRED 9
66 #define COLDRKYELLOW 10
67 #define COLLITYELLOW 11
68 #define COLDRKGREEN 12
69 #define COLMAGENTA 13
70 #define COLGREY 14
71 #define COLWHITE 15
72 
80 void vdp_setreg(u8 reg,u8 val);
81 
88 void vdp_waitvblank(u16 numtime);
89 
95 void vdp_enablenmi(void);
96 
101 void vdp_disablenmi(void);
102 
107 void vdp_enablevdp(void);
108 
113 void vdp_disablevdp(void);
114 
119 void vdp_enablescr(void);
120 
125 void vdp_disablescr(void);
126 
134 void vdp_setmode1txt(void);
135 
142 void vdp_setmode2txt(void);
143 
150 void vdp_setmode2bmp(void);
151 
165 void vdp_setcharex(u8 first,u8 count, unsigned offset,u8 flags);
166 
175 void vdp_putchar (u8 x, u8 y, char value);
176 
185 u8 vdp_getchar (u8 x, u8 y);
186 
197 void vdp_getarea (void *table, u8 x, u8 y, u8 width, u8 height);
198 
209 void vdp_putarea (void *table, u8 x, u8 y, u8 width, u8 height);
210 
221 void vdp_setdefaultchar(u8 flags);
222 
231 void vdp_putstring(u8 x, u8 y, char* text);
232 
241 void vdp_fillvram(u16 offset,u8 value,u16 count);
242 
252 void vdp_putvram_repeat(unsigned offset,void *table, u8 count, u8 times);
253 
258 void vdp_duplicatevram(void);
259 
268 void vdp_putvram (unsigned offset,void *data,unsigned count);
269 
278 void vdp_getvram (unsigned offset,void *data,unsigned count);
279 
287 void *vdp_rle2vram (void *rledata,unsigned offset);
288 
296 void vdp_ple2vram(void *pledata, unsigned offset);
297 
305 void vdp_dan2vram(void *dandata, unsigned offset);
306 
307 
311 #define vdp_blocknmi() { __asm__("\tpush hl\n\tld hl,#_no_nmi\n\tset 0,(hl)\n\tpop hl"); }
312 
316 #define vdp_releasenmi() { __asm__("\tpush hl\n\tld hl,#_no_nmi\n\tbit 7,(hl)\n\tjp z,.+6\n\tcall _nmi_direct\n\tres 0,(hl)\n\tpop hl"); }
317 
318 #endif
void vdp_putvram_repeat(unsigned offset, void *table, u8 count, u8 times)
Repeat n times an area of chars to screen.
void vdp_enablevdp(void)
Allows VDP to work (so screen is now active)
void vdp_fillvram(u16 offset, u8 value, u16 count)
Change VRAM with a specific value.
void vdp_enablescr(void)
Allows VDP to work and NMI to be catch.
void vdp_waitvblank(u16 numtime)
Waits for a vertical blank interrupt a number of time.
void vdp_setcharex(u8 first, u8 count, unsigned offset, u8 flags)
Put some chars of default font.
void vdp_setreg(u8 reg, u8 val)
Set a value to a TMS9918 register.
void vdp_setmode1txt(void)
Activate mode 1 in text mode Activate Mode 1 of TMS in text mode, 16K of VRAM, sprites 16x16 1 VRAM...
void vdp_putstring(u8 x, u8 y, char *text)
Put a string on screen at coordinates x,y.
void * vdp_rle2vram(void *rledata, unsigned offset)
Fill the VRAM with some RLE compressed data.
void vdp_disablescr(void)
Disallows VDP to work and NMI to occur.
void vdp_enablenmi(void)
Enable NMI interruption.
void vdp_disablevdp(void)
Disallows VDP to work (so screen is not active)
Custom types used by pvcollib.
void vdp_duplicatevram(void)
Put 1st area of pattern vram to the 2nd and 3rd one.
void vdp_putarea(void *table, u8 x, u8 y, u8 width, u8 height)
Put an area of chars to screen.
void vdp_getarea(void *table, u8 x, u8 y, u8 width, u8 height)
Get an area of chars from screen.
void vdp_setdefaultchar(u8 flags)
Put default font.
void vdp_putchar(u8 x, u8 y, char value)
Put a single char on screen.
void vdp_ple2vram(void *pledata, unsigned offset)
Put data in VRAM with some Pletter compressed data.
void vdp_setmode2txt(void)
Activate mode 2 in text mode Activate Mode 2 of TMS in text mode, 16K of VRAM, sprites 16x16 3 VRAM...
u8 vdp_getchar(u8 x, u8 y)
Get a single char from screen.
void vdp_disablenmi(void)
Disable NMI interruption.
void vdp_dan2vram(void *dandata, unsigned offset)
Put data in VRAM with some DAN1 compressed data.
void vdp_putvram(unsigned offset, void *data, unsigned count)
Fill the VRAM with some non compressed data.
void vdp_setmode2bmp(void)
Activate mode 2 in bitmap mode Activate Mode 2 of TMS in bitmap mode, 16K of VRAM, sprites 16x16 1 VRAM area (complete screen of 24 lines) that can be populate