1 /*****************************************************************************/
5 /* Gamate system specific definitions */
9 /* (w) 2015 Groepaz/Hitmen (groepaz@gmx.net) */
10 /* based on technical reference by PeT (mess@utanet.at) */
12 /* This software is provided 'as-is', without any expressed or implied */
13 /* warranty. In no event will the authors be held liable for any damages */
14 /* arising from the use of this software. */
16 /* Permission is granted to anyone to use this software for any purpose, */
17 /* including commercial applications, and to alter it and redistribute it */
18 /* freely, subject to the following restrictions: */
20 /* 1. The origin of this software must not be misrepresented; you must not */
21 /* claim that you wrote the original software. If you use this software */
22 /* in a product, an acknowledgment in the product documentation would be */
23 /* appreciated but is not required. */
24 /* 2. Altered source versions must be plainly marked as such, and must not */
25 /* be misrepresented as being the original software. */
26 /* 3. This notice may not be removed or altered from any source */
29 /*****************************************************************************/
34 /* Check for errors */
35 #if !defined(__GAMATE__)
36 # error This module may only be used when compiling for the Gamate!
39 #define AUDIO_BASE 0x4000
42 base clock cpu clock/32 ?
44 0/1: 1. channel(right): 12 bit frequency: right frequency 0 nothing, 1 high; 3 23khz; 4 17,3; 10 6,9; 15 4.6; $60 720hz; $eff 18,0; $fff 16,9 hz)
46 2/3: 2. channel(left): 12 bit frequency
47 4/5: 3. channel(both): 12 bit frequency
48 6: 0..5 noise frequency 0 fast 1f slow (about 500us) 15.6ns--> clock/32 counts
49 7 control (hinibble right)
50 bit 0: right channel high (full cycle, else square pulse/tone)
51 bit 1: left channel high
52 bit 2: both channel high
53 bit 3: set right tone (else noise)
54 bit 4: set left channel normal
55 bit 5: set both normal
56 bits 30: 11 high, 10 square, 01 noise, 00 noise only when square high
57 noise means switches channel to ad converter based noise algorithmen
58 (white noise shift register 17bit wide, repeats after about 130000 cycles)
59 probably out=!bit16, bit0=bit16 xor bit13; runs through, so start value anything than 0
60 8: 1st volume: 0..3 square volume; bit 4 envelope (higher priority)
63 11/12: envelope delay time 0 fast, 0xffff slow/nearly no effect (2 22us, 4 56us)
64 frequency $800, envelope $10 2 times in pulse high time (4*16*16)
70 a starts with down falling, rising; same falling time, but double/longer cycle
71 b one time falling, on
74 e rising, falling (double cycle before restart)
78 bit 2: start rising (else falling)
82 #define JOY_DATA 0x4400
84 #define JOY_DATA_UP 0x01
85 #define JOY_DATA_DOWN 0x02
86 #define JOY_DATA_LEFT 0x04
87 #define JOY_DATA_RIGHT 0x08
88 #define JOY_DATA_FIRE_A 0x10
89 #define JOY_DATA_FIRE_B 0x20
90 #define JOY_DATA_START 0x40
91 #define JOY_DATA_SELECT 0x80
95 resolution 160x152 in 4 greys/greens
96 2 256x256 sized bitplanes (2x 8kbyte ram)
98 #define LCD_BASE 0x5000
100 #define LCD_MODE 0x5001
102 bit 3..0 (from zeropage 15)
103 bit 0 set no normal screen display, seldom scrolling effects on screen;
104 bytes written to somewhat actual display refresh position!?
107 bit 4 swaps plane intensity
108 bit 5 ? display effect
109 bit 6 on y auto increment (else auto x increment), reading
110 bit 7 ? lcd flickering
112 #define LCD_MODE_INC_Y 0x40
114 #define LCD_XPOS 0x5002 /* smooth scrolling X */
115 #define LCD_YPOS 0x5003 /* smooth scrolling Y */
117 smooth scrolling until $c8 with 200 limit
118 after 200 display if ((value & 0xf) < 8) display of (value & 0xf) - 8
119 chaos lines from value + current line from plane 2 only then lines starting
120 with zero (problematic 200 limit/overrun implementation!?)
122 #define LCD_X 0x5004 /* x-addr */
125 bit 7 0 1st/1 2nd bitplane
127 #define LCD_XPOS_PLANE1 0x00
128 #define LCD_XPOS_PLANE2 0x80
130 #define LCD_Y 0x5005 /* y-addr */
132 #define LCD_READ 0x5006 /* read from RAM (no auto inc?) */
133 #define LCD_DATA 0x5007 /* write to RAM */
136 /* constants for the conio implementation */
137 #define COLOR_BLACK 0x03
138 #define COLOR_WHITE 0x00
143 #define CH_ULCORNER 4
144 #define CH_URCORNER 5
145 #define CH_LLCORNER 6
146 #define CH_LRCORNER 7
160 /* No support for dynamically loadable drivers */
163 /* The addresses of the static drivers */
164 extern void gamate_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
170 void waitvblank (void);
171 /* Wait for the vertical blanking */
173 /* NOTE: all Gamate are "NTSC" */
174 #define get_tv() TV_NTSC
175 /* Return the video mode the machine is using. */
177 /* End of gamate.h */