1 //---------------------------------------------------------------------------
2 // NEOPOP : Emulator as in Dreamland
3 //
4 // Copyright (c) 2001-2002 by neopop_uk
5 //---------------------------------------------------------------------------
6 
7 //---------------------------------------------------------------------------
8 //	This program is free software; you can redistribute it and/or modify
9 //	it under the terms of the GNU General Public License as published by
10 //	the Free Software Foundation; either version 2 of the License, or
11 //	(at your option) any later version. See also the license.txt file for
12 //	additional informations.
13 //---------------------------------------------------------------------------
14 
15 #ifndef __GFX__
16 #define __GFX__
17 
18 #include <stdint.h>
19 
20 #define ZDEPTH_BACK_SPRITE          2
21 #define ZDEPTH_BACKGROUND_SCROLL    3
22 #define ZDEPTH_MIDDLE_SPRITE        4
23 #define ZDEPTH_FOREGROUND_SCROLL    5
24 #define ZDEPTH_FRONT_SPRITE			6
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 extern uint16_t cfb_scanline[256];	// __attribute__ ((aligned (8)));
31 
32 typedef struct ngpgfx
33 {
34    uint8_t winx, winw;
35    uint8_t winy, winh;
36    uint8_t scroll1x, scroll1y;
37    uint8_t scroll2x, scroll2y;
38    uint8_t scrollsprx, scrollspry;
39    uint8_t planeSwap;
40    uint8_t bgc, oowc, negative;
41 
42    uint8_t ScrollVRAM[4096];       /* 9000-9fff */
43    uint8_t CharacterRAM[8192];     /* a000-bfff */
44    uint8_t SpriteVRAM[256];        /* 8800-88ff */
45    uint8_t SpriteVRAMColor[0x40];  /* 8C00-8C3F */
46    uint8_t ColorPaletteRAM[0x200]; /* 8200-83ff */
47 
48    uint8_t SPPLT[6];
49    uint8_t SCRP1PLT[6];
50    uint8_t SCRP2PLT[6];
51 
52    uint8_t raster_line;
53    uint8_t S1SO_H, S1SO_V, S2SO_H, S2SO_V;
54    uint8_t WBA_H, WBA_V, WSI_H, WSI_V;
55    bool C_OVR, BLNK;
56    uint8_t PO_H, PO_V;
57    uint8_t P_F;
58    uint8_t BG_COL;
59    uint8_t CONTROL_2D;
60    uint8_t CONTROL_INT;
61    uint8_t SCREEN_PERIOD;
62    uint8_t K2GE_MODE;
63 
64    uint32_t ColorMap[4096];
65 
66    int layer_enable;
67 } ngpgfx_t;
68 
69 void ngpgfx_set_pixel_format(ngpgfx_t *fx, int depth);
70 
71 void ngpgfx_SetLayerEnableMask(ngpgfx_t *gfx, uint64_t mask);
72 
73 int ngpgfx_StateAction(ngpgfx_t *gfx, void *data, int load, int data_only);
74 
75 void ngpgfx_power(ngpgfx_t *gfx);
76 
77 bool ngpgfx_hint(ngpgfx_t *gfx);
78 
79 bool ngpgfx_draw(ngpgfx_t *gfx, void *data, bool skip);
80 
81 uint8_t ngpgfx_read8(ngpgfx_t *gfx, uint32_t address);
82 
83 uint16_t ngpgfx_read16(ngpgfx_t *gfx, uint32_t address);
84 
85 void ngpgfx_write16(ngpgfx_t *gfx, uint32_t address, uint16_t data);
86 
87 void ngpgfx_write8(ngpgfx_t *gfx, uint32_t address, uint8_t data);
88 
89 extern ngpgfx_t *NGPGfx;
90 
91 #ifdef __cplusplus
92 }
93 #endif
94 
95 #endif
96 
97