Jo Engine  9
Jo Sega Saturn Engine
vdp1_command_pipeline.h
Go to the documentation of this file.
1 /*
2 ** Jo Sega Saturn Engine
3 ** Copyright (c) 2012-2017, Johannes Fetz (johannesfetz@gmail.com)
4 ** All rights reserved.
5 **
6 ** Redistribution and use in source and binary forms, with or without
7 ** modification, are permitted provided that the following conditions are met:
8 ** * Redistributions of source code must retain the above copyright
9 ** notice, this list of conditions and the following disclaimer.
10 ** * Redistributions in binary form must reproduce the above copyright
11 ** notice, this list of conditions and the following disclaimer in the
12 ** documentation and/or other materials provided with the distribution.
13 ** * Neither the name of the Johannes Fetz nor the
14 ** names of its contributors may be used to endorse or promote products
15 ** derived from this software without specific prior written permission.
16 **
17 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 ** DISCLAIMED. IN NO EVENT SHALL Johannes Fetz BE LIABLE FOR ANY
21 ** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 ** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
35 #ifndef __JO_VDP1_COMMAND_PIPELINE_H__
36 # define __JO_VDP1_COMMAND_PIPELINE_H__
37 
38 #if !JO_COMPILE_USING_SGL
39 
43 extern unsigned int __jo_vdp1_command_index;
44 
46 typedef enum __attribute__ ((__packed__))
47 {
48  DrawNormalSprite = 0x0,
49  DrawScaledSprite = 0x1,
50  DrawDistortedSprite = 0x2,
51  DrawPolygon = 0x4,
52  DrawPolylines = 0x5,
53  DrawLine = 0x6,
54  SetUserClipping = 0x8,
55  SetSystemClipping = 0x9,
56  SetLocalCoordinates = 0xA,
57  DrawEnd = 0x8000,
58  __force_unsigned_short__ = 0xFFFFU
59 }
61 
63 typedef struct
64 {
66  unsigned short link;
67  unsigned short pmod;
68  unsigned short colr;
69  unsigned short srca;
70  unsigned short size;
71  short xa;
72  short ya;
73  short xb;
74  short yb;
75  short xc;
76  short yc;
77  short xd;
78  short yd;
79  unsigned short grda;
82 
84 {
85  return (link ? (jo_vdp1_command *)(JO_VDP1_VRAM + (unsigned int)link * 0x8) : JO_NULL);
86 }
87 static __jo_force_inline unsigned short jo_vdp1_command_index_to_link(int command_index)
88 {
89  return ((JO_VDP1_VRAM + JO_MULT_BY_32(command_index)) / 0x8);
90 }
92 {
93  return (jo_vdp1_command *)(JO_VDP1_VRAM + JO_MULT_BY_32(command_index));
94 }
96 {
97  return (command ? (((unsigned int)command - (unsigned int)JO_VDP1_VRAM) / 0x8) : 0);
98 }
99 
101 
102 #endif
103 
104 #endif /* !__JO_VDP1_COMMAND_PIPELINE_H__ */
105 
106 /*
107 ** END OF FILE
108 */
short yd
Definition: vdp1_command_pipeline.h:78
jo_vdp1_command_control
Definition: vdp1_command_pipeline.h:60
static __jo_force_inline jo_vdp1_command * jo_vdp1_get_command_entry(int command_index)
Definition: vdp1_command_pipeline.h:91
unsigned int __jo_vdp1_command_index
(internal engine usage)
short xb
Definition: vdp1_command_pipeline.h:73
short yb
Definition: vdp1_command_pipeline.h:74
#define __jo_force_inline
force inline attribute (and prevent Doxygen prototype parsing bug)
Definition: conf.h:154
jo_vdp1_command_control ctrl
Definition: vdp1_command_pipeline.h:65
unsigned short grda
Definition: vdp1_command_pipeline.h:79
short yc
Definition: vdp1_command_pipeline.h:76
unsigned short link
Definition: vdp1_command_pipeline.h:66
static __jo_force_inline unsigned short jo_vdp1_command_to_link(jo_vdp1_command *command)
Definition: vdp1_command_pipeline.h:95
#define JO_MULT_BY_32(X)
Multiply a variable by 32.
Definition: math.h:99
32 byte VDP1 command table entry
Definition: vdp1_command_pipeline.h:63
static __jo_force_inline unsigned short jo_vdp1_command_index_to_link(int command_index)
Definition: vdp1_command_pipeline.h:87
static __jo_force_inline jo_vdp1_command * jo_vdp1_get_command_entry_from_link(unsigned short link)
Definition: vdp1_command_pipeline.h:83
enum __attribute__((__packed__))
VDP1 commands.
Definition: vdp1_command_pipeline.h:46
unsigned short pmod
Definition: vdp1_command_pipeline.h:67
short jo_engine_reserved
Definition: vdp1_command_pipeline.h:80
unsigned short srca
Definition: vdp1_command_pipeline.h:69
jo_vdp1_command * jo_vdp1_create_command(void)
short xd
Definition: vdp1_command_pipeline.h:77
short xa
Definition: vdp1_command_pipeline.h:71
unsigned short size
Definition: vdp1_command_pipeline.h:70
#define JO_NULL
NULL implementation.
Definition: tools.h:150
#define JO_VDP1_VRAM
VDP1 VRAM (512 kilobytes)
Definition: sega_saturn.h:89
unsigned short colr
Definition: vdp1_command_pipeline.h:68
short xc
Definition: vdp1_command_pipeline.h:75
short ya
Definition: vdp1_command_pipeline.h:72