A Library for the Gameduino shield
Dependents: Gameduino_Asteroids_game Gameduino_Ball_demo Gameduino_Bitmap_demo Gameduino_chessboard_demo ... more
This is a library for the Gameduino, a shield for the Arduino. It uses a secondary library to recreate the arduino functionality. This is to keep this library as close to the original as possible. The original was released by James Bowman, who designed the Gameduino. His webpage (http://excamera.com/sphinx/gameduino/) has tutorials and plenty of other information on the Gameduino. I have published a lot of the demos on his page and they can be found here:
Asteroids:
Import programGameduino_Asteroids_game
Asteroids game using a Gameduino
Ball demo:
Import programGameduino_Ball_demo
Bouncing ball demo for the Gameduino
Bitmap demo:
Import programGameduino_Bitmap_demo
Bitmap demo for the Gameduino
Chessboard demo:
Import programGameduino_chessboard_demo
Chessboard demo for the Gameduino
Collision demo:
Import programGameduino_collision_demo
Collision demo for the Gameduino
Frogger game:
Import programGameduino_Frogger_game
Frogger game for the Gameduino
jkcollision demo:
Import programGameduino_jkcollision_demo
jkcollision demo for the Gameduino
Joystick test:
Import programGameduino_Joystick_test
Joystick test program for the Gameduino
Manic miner game:
Import programGameduino_Manic_Miner_game
Manic miner game for the Gameduino
Palettes demo:
Import programGameduino_Palettes_demo
Palettes demo for the Gameduino
Rotate demo:
Import programGameduino_Rotate_demo
Sprite rotation demo for the Gameduino
Screenshot demo:
Import programGameduino_screenshot_test
Screen shot demo and test program for the Gameduino
This needs to run a python script, more information and the script can be found on the gameduino site.
Scroll demo:
Import programGameduino_Scroll_demo
Scroll demo for the Gameduino
snow demo:
Import programGameduino_Snow_demo
White noise demo for the Gameduino
spinning dna demo:
Import programGameduino_Spinning_DNA_demo
Spinning dna graphics demo for the Gameduino
split screen demo:
Import programGameduino_Split_Screen_demo
Split screen graphics demo for the Gameduino
256 sprites demo:
Import programGameduino_Sprites256_demo
Sprite control demo for the Gameduino
I've also ported Invaders, written for the arduino by Colin (couldn't find his surname) and can be found at http://www.artlum.com/gameduino/gameduino.html:
Import programGameduino_Invaders_game
Invaders game for the Gameduino
and made a template for gameduino based projects. I have used an mbeduino board and have included a a file shield.h which contains the pinouts for this board. This can easily be modified to your needs. As a default I have chosen to use pull ups on the joystick inputs and switch down to 0V. This can be quickly altered and this is at the top of most main.c files, with the exception of invaders. This has more configuration options in the joystick files.
GD.h@1:f9c070a33214, 2012-10-21 (annotated)
- Committer:
- TheChrisyd
- Date:
- Sun Oct 21 17:51:49 2012 +0000
- Revision:
- 1:f9c070a33214
- Parent:
- 0:c9523256df08
- Child:
- 2:c0acce0a98e3
corrected documentation
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
TheChrisyd | 1:f9c070a33214 | 1 | /* |
TheChrisyd | 1:f9c070a33214 | 2 | * LICENSE |
TheChrisyd | 0:c9523256df08 | 3 | * Copyright (c) 2012 James Bowman, Chris Dick |
TheChrisyd | 0:c9523256df08 | 4 | * |
TheChrisyd | 0:c9523256df08 | 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
TheChrisyd | 0:c9523256df08 | 6 | * of this software and associated documentation files (the "Software"), to deal |
TheChrisyd | 0:c9523256df08 | 7 | * in the Software without restriction, including without limitation the rights |
TheChrisyd | 0:c9523256df08 | 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
TheChrisyd | 0:c9523256df08 | 9 | * copies of the Software, and to permit persons to whom the Software is |
TheChrisyd | 0:c9523256df08 | 10 | * furnished to do so, subject to the following conditions: |
TheChrisyd | 0:c9523256df08 | 11 | * |
TheChrisyd | 0:c9523256df08 | 12 | * The above copyright notice and this permission notice shall be included in |
TheChrisyd | 0:c9523256df08 | 13 | * all copies or substantial portions of the Software. |
TheChrisyd | 0:c9523256df08 | 14 | * |
TheChrisyd | 0:c9523256df08 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
TheChrisyd | 0:c9523256df08 | 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
TheChrisyd | 0:c9523256df08 | 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
TheChrisyd | 0:c9523256df08 | 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
TheChrisyd | 0:c9523256df08 | 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
TheChrisyd | 0:c9523256df08 | 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
TheChrisyd | 0:c9523256df08 | 21 | * THE SOFTWARE. |
TheChrisyd | 0:c9523256df08 | 22 | * |
TheChrisyd | 1:f9c070a33214 | 23 | * DESCRIPTION |
TheChrisyd | 0:c9523256df08 | 24 | * Copyright (c) 2011 by James Bowman <jamesb@excamera.com> |
TheChrisyd | 0:c9523256df08 | 25 | * Gameduino library for mbed. Ported from Arduino by Chris Dick |
TheChrisyd | 0:c9523256df08 | 26 | * |
TheChrisyd | 0:c9523256df08 | 27 | * |
TheChrisyd | 0:c9523256df08 | 28 | */ |
TheChrisyd | 0:c9523256df08 | 29 | |
TheChrisyd | 0:c9523256df08 | 30 | |
TheChrisyd | 0:c9523256df08 | 31 | #ifndef _GD_H_INCLUDED |
TheChrisyd | 0:c9523256df08 | 32 | #define _GD_H_INCLUDED |
TheChrisyd | 0:c9523256df08 | 33 | #include "mbed.h" |
TheChrisyd | 0:c9523256df08 | 34 | #include "arduino.h" |
TheChrisyd | 0:c9523256df08 | 35 | |
TheChrisyd | 0:c9523256df08 | 36 | struct sprplot |
TheChrisyd | 0:c9523256df08 | 37 | { |
TheChrisyd | 0:c9523256df08 | 38 | signed char x, y; |
TheChrisyd | 0:c9523256df08 | 39 | byte image, palette; |
TheChrisyd | 0:c9523256df08 | 40 | }; |
TheChrisyd | 0:c9523256df08 | 41 | |
TheChrisyd | 1:f9c070a33214 | 42 | /** Gameduino library ported form the arduino |
TheChrisyd | 0:c9523256df08 | 43 | * |
TheChrisyd | 0:c9523256df08 | 44 | * Example: |
TheChrisyd | 0:c9523256df08 | 45 | * @code |
TheChrisyd | 0:c9523256df08 | 46 | * // |
TheChrisyd | 0:c9523256df08 | 47 | * #include "mbed.h" |
TheChrisyd | 0:c9523256df08 | 48 | * #include "GD.h" |
TheChrisyd | 0:c9523256df08 | 49 | * |
TheChrisyd | 0:c9523256df08 | 50 | * |
TheChrisyd | 0:c9523256df08 | 51 | * GDClass gd(p5, p6, p7, p8, USBTX, USBRX) ; |
TheChrisyd | 0:c9523256df08 | 52 | * |
TheChrisyd | 0:c9523256df08 | 53 | * int main() { |
TheChrisyd | 0:c9523256df08 | 54 | * // initialise Gameduino |
TheChrisyd | 0:c9523256df08 | 55 | * GD.begin(); |
TheChrisyd | 0:c9523256df08 | 56 | * // load ascii characters |
TheChrisyd | 0:c9523256df08 | 57 | * GD.ascii(); |
TheChrisyd | 0:c9523256df08 | 58 | * } |
TheChrisyd | 0:c9523256df08 | 59 | * @endcode |
TheChrisyd | 0:c9523256df08 | 60 | */ |
TheChrisyd | 0:c9523256df08 | 61 | class GDClass { |
TheChrisyd | 0:c9523256df08 | 62 | private: |
TheChrisyd | 0:c9523256df08 | 63 | SPI gameduino_spi; |
TheChrisyd | 0:c9523256df08 | 64 | DigitalOut gameduino_cs; |
TheChrisyd | 0:c9523256df08 | 65 | Serial pc; |
TheChrisyd | 0:c9523256df08 | 66 | public: |
TheChrisyd | 1:f9c070a33214 | 67 | /** Create a Gameduino Object with the specified spi pins and uart pins. |
TheChrisyd | 0:c9523256df08 | 68 | * |
TheChrisyd | 1:f9c070a33214 | 69 | * @param mosi name of pin for spi mosi connection. |
TheChrisyd | 1:f9c070a33214 | 70 | * @param miso name of pin for spi moso connection. |
TheChrisyd | 1:f9c070a33214 | 71 | * @param sclk name of pin for spi sclk connection. |
TheChrisyd | 1:f9c070a33214 | 72 | * @param cs name of pin for spi cs connection. |
TheChrisyd | 1:f9c070a33214 | 73 | * @param utx name of pin for uart tx. |
TheChrisyd | 1:f9c070a33214 | 74 | * @param urx name of pin for uart rx. |
TheChrisyd | 0:c9523256df08 | 75 | */ |
TheChrisyd | 0:c9523256df08 | 76 | GDClass(PinName mosi, PinName miso, PinName sclk, PinName cs, PinName utx, PinName urx); |
TheChrisyd | 0:c9523256df08 | 77 | /** Initialize the connection to the adapter, and reset the adapter. |
TheChrisyd | 0:c9523256df08 | 78 | * |
TheChrisyd | 1:f9c070a33214 | 79 | * @param void. |
TheChrisyd | 0:c9523256df08 | 80 | */ |
TheChrisyd | 0:c9523256df08 | 81 | void begin(); |
TheChrisyd | 1:f9c070a33214 | 82 | /** end the spi transaction. |
TheChrisyd | 0:c9523256df08 | 83 | * |
TheChrisyd | 1:f9c070a33214 | 84 | * @param void. |
TheChrisyd | 0:c9523256df08 | 85 | */ |
TheChrisyd | 0:c9523256df08 | 86 | void end(); |
TheChrisyd | 1:f9c070a33214 | 87 | /** start an spi transaction to addr. |
TheChrisyd | 0:c9523256df08 | 88 | * |
TheChrisyd | 1:f9c070a33214 | 89 | * @param addr: address of memory location. |
TheChrisyd | 0:c9523256df08 | 90 | */ |
TheChrisyd | 0:c9523256df08 | 91 | void __start(unsigned int addr); |
TheChrisyd | 1:f9c070a33214 | 92 | /** start an spi write transaction to addr. |
TheChrisyd | 0:c9523256df08 | 93 | * |
TheChrisyd | 1:f9c070a33214 | 94 | * @param addr: address of memory location. |
TheChrisyd | 0:c9523256df08 | 95 | */ |
TheChrisyd | 0:c9523256df08 | 96 | void __wstart(unsigned int addr); |
TheChrisyd | 1:f9c070a33214 | 97 | /** end the spi transaction. |
TheChrisyd | 0:c9523256df08 | 98 | * |
TheChrisyd | 1:f9c070a33214 | 99 | * @param void. |
TheChrisyd | 0:c9523256df08 | 100 | */ |
TheChrisyd | 0:c9523256df08 | 101 | void __end(void); |
TheChrisyd | 1:f9c070a33214 | 102 | /** Read a byte from memory location addr. |
TheChrisyd | 0:c9523256df08 | 103 | * |
TheChrisyd | 1:f9c070a33214 | 104 | * @param addr: address of memory location. |
TheChrisyd | 0:c9523256df08 | 105 | */ |
TheChrisyd | 0:c9523256df08 | 106 | byte rd(unsigned int addr); |
TheChrisyd | 0:c9523256df08 | 107 | /** Write byte v to memory location addr. |
TheChrisyd | 0:c9523256df08 | 108 | * |
TheChrisyd | 1:f9c070a33214 | 109 | * @param addr: address of memory location. |
TheChrisyd | 1:f9c070a33214 | 110 | * @param v: data to write. |
TheChrisyd | 0:c9523256df08 | 111 | */ |
TheChrisyd | 0:c9523256df08 | 112 | void wr(unsigned int addr, byte v); |
TheChrisyd | 1:f9c070a33214 | 113 | /** Read a 16-bit word from memory locations addr and addr+1. |
TheChrisyd | 0:c9523256df08 | 114 | * |
TheChrisyd | 1:f9c070a33214 | 115 | * @param addr: address of first memory location. |
TheChrisyd | 0:c9523256df08 | 116 | */ |
TheChrisyd | 0:c9523256df08 | 117 | unsigned int rd16(unsigned int addr); |
TheChrisyd | 1:f9c070a33214 | 118 | /** Write 16-bit word v to memory locations addr and addr+1. |
TheChrisyd | 0:c9523256df08 | 119 | * |
TheChrisyd | 1:f9c070a33214 | 120 | * @param addr: address of first memory location. |
TheChrisyd | 1:f9c070a33214 | 121 | * @param v: data to write. |
TheChrisyd | 0:c9523256df08 | 122 | */ |
TheChrisyd | 0:c9523256df08 | 123 | void wr16(unsigned int addr, unsigned int v); |
TheChrisyd | 1:f9c070a33214 | 124 | /** Fill count memory locations starting at addr with value v. |
TheChrisyd | 0:c9523256df08 | 125 | * |
TheChrisyd | 1:f9c070a33214 | 126 | * @param addr: address of first memory location. |
TheChrisyd | 1:f9c070a33214 | 127 | * @param v: data to write. |
TheChrisyd | 1:f9c070a33214 | 128 | * @param count: number of memory location to fill. |
TheChrisyd | 0:c9523256df08 | 129 | */ |
TheChrisyd | 0:c9523256df08 | 130 | void fill(int addr, byte v, unsigned int count); |
TheChrisyd | 0:c9523256df08 | 131 | /** Copy count bytes from AVR flash memory location src to addr. |
TheChrisyd | 0:c9523256df08 | 132 | * |
TheChrisyd | 1:f9c070a33214 | 133 | * @param addr: address of first destination memory location. |
TheChrisyd | 1:f9c070a33214 | 134 | * @param *src: address of first flash memory. |
TheChrisyd | 1:f9c070a33214 | 135 | * @param count: number of memory location to copy. |
TheChrisyd | 0:c9523256df08 | 136 | */ |
TheChrisyd | 0:c9523256df08 | 137 | void copy(unsigned int addr, PROGMEM prog_uchar *src, int count); |
TheChrisyd | 0:c9523256df08 | 138 | /** Set character palette entry pal to color rgb. |
TheChrisyd | 0:c9523256df08 | 139 | * |
TheChrisyd | 1:f9c070a33214 | 140 | * @param pal: address of palatte. |
TheChrisyd | 1:f9c070a33214 | 141 | * @param rgb: colour value. |
TheChrisyd | 0:c9523256df08 | 142 | */ |
TheChrisyd | 0:c9523256df08 | 143 | void setpal(int pal, unsigned int rgb); |
TheChrisyd | 0:c9523256df08 | 144 | /** Set attributes of sprite spr, can also use RGB(r,g,b) Macro. |
TheChrisyd | 0:c9523256df08 | 145 | * |
TheChrisyd | 1:f9c070a33214 | 146 | * @param spr: sprite number, 0-255. |
TheChrisyd | 0:c9523256df08 | 147 | * @param x: x coordinate, 0-511. 0 is left edge of screen. |
TheChrisyd | 0:c9523256df08 | 148 | * @param y: y coordinate, 0-511. 0 is top edge of screen. |
TheChrisyd | 0:c9523256df08 | 149 | * @param image: image number, 0-63. |
TheChrisyd | 0:c9523256df08 | 150 | * @param palette: palette control 0-15. |
TheChrisyd | 0:c9523256df08 | 151 | * @param rot: rotate/flip control 0-7. |
TheChrisyd | 0:c9523256df08 | 152 | * @param jk: J/K collision select, 0-1. |
TheChrisyd | 0:c9523256df08 | 153 | */ |
TheChrisyd | 0:c9523256df08 | 154 | void sprite(int spr, int x, int y, byte image, byte palette, byte rot = 0, byte jk = 0); |
TheChrisyd | 0:c9523256df08 | 155 | /** Set attributes of four sprites in a 2x2 configuration. (x,y) specifies the center of the group. |
TheChrisyd | 0:c9523256df08 | 156 | * |
TheChrisyd | 0:c9523256df08 | 157 | * @param spr: sprite number, 0-255. |
TheChrisyd | 0:c9523256df08 | 158 | * @param x: x center coordinate , 0-511. 0 is left edge of screen. |
TheChrisyd | 0:c9523256df08 | 159 | * @param y: y center coordinate, 0-511. 0 is top edge of screen. |
TheChrisyd | 0:c9523256df08 | 160 | * @param image: image number, 0-63. |
TheChrisyd | 0:c9523256df08 | 161 | * @param palette: palette control 0-15. |
TheChrisyd | 0:c9523256df08 | 162 | * @param rot: rotate/flip control 0-7. |
TheChrisyd | 0:c9523256df08 | 163 | * @param jk: J/K collision select, 0-1. |
TheChrisyd | 0:c9523256df08 | 164 | */ |
TheChrisyd | 0:c9523256df08 | 165 | void sprite2x2(int spr, int x, int y, byte image, byte palette, byte rot = 0, byte jk = 0); |
TheChrisyd | 1:f9c070a33214 | 166 | /** Waits for the start of the vertical blanking period. By waiting for vertical blanking: any animation is guaranteed to be smooth, the sprite collision RAM is valid. |
TheChrisyd | 0:c9523256df08 | 167 | * |
TheChrisyd | 0:c9523256df08 | 168 | * @param void |
TheChrisyd | 0:c9523256df08 | 169 | */ |
TheChrisyd | 0:c9523256df08 | 170 | void waitvblank(); |
TheChrisyd | 0:c9523256df08 | 171 | /** Copy count bytes from AVR flash memory location src into the coprocessor’s instruction RAM, and restart the coprocessor. |
TheChrisyd | 0:c9523256df08 | 172 | * |
TheChrisyd | 0:c9523256df08 | 173 | * @param *src: address of first flash memory. |
TheChrisyd | 0:c9523256df08 | 174 | * @param count: number of memory location to copy. |
TheChrisyd | 0:c9523256df08 | 175 | */ |
TheChrisyd | 0:c9523256df08 | 176 | void microcode(PROGMEM prog_uchar *src, int count); |
TheChrisyd | 0:c9523256df08 | 177 | /** uncompression algorithm for use with online tools |
TheChrisyd | 0:c9523256df08 | 178 | * |
TheChrisyd | 0:c9523256df08 | 179 | * @param addr first address of gameduino memory to store to. |
TheChrisyd | 0:c9523256df08 | 180 | * @param *src pointer to compressed data in program memory. |
TheChrisyd | 0:c9523256df08 | 181 | */ |
TheChrisyd | 0:c9523256df08 | 182 | void uncompress(unsigned int addr, PROGMEM prog_uchar *src); |
TheChrisyd | 0:c9523256df08 | 183 | /** Set audio voice waveform, frequency and amplitude. The 64 audio voices are summed for final output. So to guarantee no audio clipping, the sum of all voices’ amplitudes should be 255 or less. |
TheChrisyd | 0:c9523256df08 | 184 | * |
TheChrisyd | 0:c9523256df08 | 185 | * @param voice: hardware voice number, 0-63. |
TheChrisyd | 0:c9523256df08 | 186 | * @param wave: waveform, 0 is sine wave, 1 is noise. |
TheChrisyd | 0:c9523256df08 | 187 | * @param freq: frequency in quarter-Hz, e.g. 100 Hz is 400. |
TheChrisyd | 0:c9523256df08 | 188 | * @param lamp: left amplitude, 0-255. |
TheChrisyd | 0:c9523256df08 | 189 | * @param ramp: right amplitude, 0-255. |
TheChrisyd | 0:c9523256df08 | 190 | */ |
TheChrisyd | 0:c9523256df08 | 191 | void voice(int v, byte wave, unsigned int freq, byte lamp, byte ramp); |
TheChrisyd | 0:c9523256df08 | 192 | /** Load a standard 8x8 ASCII font into character RAM. This is useful for debugging and status display. |
TheChrisyd | 0:c9523256df08 | 193 | * |
TheChrisyd | 0:c9523256df08 | 194 | * @param void |
TheChrisyd | 0:c9523256df08 | 195 | * |
TheChrisyd | 0:c9523256df08 | 196 | */ |
TheChrisyd | 0:c9523256df08 | 197 | void ascii(); |
TheChrisyd | 0:c9523256df08 | 198 | /** Draw string s at character screen position (x,y). Assumes that a standard character set has been loaded, e.g. by ascii(). |
TheChrisyd | 0:c9523256df08 | 199 | * |
TheChrisyd | 0:c9523256df08 | 200 | * @param x: x coordinate, 0-511. 0 is left edge of screen. |
TheChrisyd | 0:c9523256df08 | 201 | * @param y: y coordinate, 0-511. 0 is top edge of screen. |
TheChrisyd | 0:c9523256df08 | 202 | * @param *s: pointer to string. |
TheChrisyd | 0:c9523256df08 | 203 | */ |
TheChrisyd | 0:c9523256df08 | 204 | void putstr(int x, int y, const char *s); |
TheChrisyd | 0:c9523256df08 | 205 | /** grab a screen shot and dump to uart. Python script availiable from http://excamera.com/sphinx/gameduino/samples/screenshot/index.html to save recieved data. |
TheChrisyd | 0:c9523256df08 | 206 | * |
TheChrisyd | 0:c9523256df08 | 207 | * @param frame number to added to saved filename. |
TheChrisyd | 0:c9523256df08 | 208 | */ |
TheChrisyd | 0:c9523256df08 | 209 | void screenshot(unsigned int frame); |
TheChrisyd | 0:c9523256df08 | 210 | /** start an spi write transaction to sprite. |
TheChrisyd | 0:c9523256df08 | 211 | * |
TheChrisyd | 0:c9523256df08 | 212 | * @param spr: sprite number to write to. |
TheChrisyd | 0:c9523256df08 | 213 | */ |
TheChrisyd | 0:c9523256df08 | 214 | void __wstartspr(unsigned int spr = 0); |
TheChrisyd | 0:c9523256df08 | 215 | /** controls sprite chosen with __wstartspr with position (x,y), offset (ox,oy), rotation rot, collision class jk and palette and image. |
TheChrisyd | 0:c9523256df08 | 216 | * |
TheChrisyd | 0:c9523256df08 | 217 | * @param ox: x offset. |
TheChrisyd | 0:c9523256df08 | 218 | * @param oy: y offset. |
TheChrisyd | 0:c9523256df08 | 219 | * @param x: x coordinate, 0-511. 0 is left edge of screen. |
TheChrisyd | 0:c9523256df08 | 220 | * @param y: y coordinate, 0-511. 0 is top edge of screen. |
TheChrisyd | 0:c9523256df08 | 221 | * @param image: SpriteImageSelect. 0-63. slects which source image to use. |
TheChrisyd | 0:c9523256df08 | 222 | * @param palette: sprite palette select, 4 bits Controls how pixel data is converted to colour. |
TheChrisyd | 0:c9523256df08 | 223 | * @param rot: rotation of sprite, 3 bits rotates sprites by quarter turns. |
TheChrisyd | 0:c9523256df08 | 224 | * @param jk: collision class. 0 is J, 1 is K. |
TheChrisyd | 0:c9523256df08 | 225 | */ |
TheChrisyd | 0:c9523256df08 | 226 | void xsprite(int ox, int oy, signed char x, signed char y, byte image, byte palette, byte rot = 0, byte jk = 0); |
TheChrisyd | 0:c9523256df08 | 227 | /** hide current sprite by moving it off visible screen area |
TheChrisyd | 0:c9523256df08 | 228 | * |
TheChrisyd | 0:c9523256df08 | 229 | * @param void |
TheChrisyd | 0:c9523256df08 | 230 | */ |
TheChrisyd | 0:c9523256df08 | 231 | void xhide(); |
TheChrisyd | 0:c9523256df08 | 232 | /** plots count sprites at using xsprite method |
TheChrisyd | 0:c9523256df08 | 233 | * |
TheChrisyd | 0:c9523256df08 | 234 | * @param void |
TheChrisyd | 0:c9523256df08 | 235 | */ |
TheChrisyd | 0:c9523256df08 | 236 | void plots(int ox, int oy, PROGMEM sprplot *psp, byte count, byte rot, byte jk); |
TheChrisyd | 0:c9523256df08 | 237 | |
TheChrisyd | 0:c9523256df08 | 238 | byte spr; // Current sprite, incremented by xsprite/xhide above |
TheChrisyd | 0:c9523256df08 | 239 | }; |
TheChrisyd | 0:c9523256df08 | 240 | |
TheChrisyd | 0:c9523256df08 | 241 | #define GD_HAS_PLOTS 1 // have the 'GD.plots' method |
TheChrisyd | 0:c9523256df08 | 242 | |
TheChrisyd | 0:c9523256df08 | 243 | //extern GDClass GD; |
TheChrisyd | 0:c9523256df08 | 244 | |
TheChrisyd | 0:c9523256df08 | 245 | #define RGB(r,g,b) ((((r) >> 3) << 10) | (((g) >> 3) << 5) | ((b) >> 3)) |
TheChrisyd | 0:c9523256df08 | 246 | #define TRANSPARENT (1 << 15) // transparent for chars and sprites |
TheChrisyd | 0:c9523256df08 | 247 | |
TheChrisyd | 0:c9523256df08 | 248 | #define RAM_PIC 0x0000 // Screen Picture, 64 x 64 = 4096 bytes |
TheChrisyd | 0:c9523256df08 | 249 | #define RAM_CHR 0x1000 // Screen Characters, 256 x 16 = 4096 bytes |
TheChrisyd | 0:c9523256df08 | 250 | #define RAM_PAL 0x2000 // Screen Character Palette, 256 x 8 = 2048 bytes |
TheChrisyd | 0:c9523256df08 | 251 | |
TheChrisyd | 0:c9523256df08 | 252 | #define IDENT 0x2800 |
TheChrisyd | 0:c9523256df08 | 253 | #define REV 0x2801 |
TheChrisyd | 0:c9523256df08 | 254 | #define FRAME 0x2802 |
TheChrisyd | 0:c9523256df08 | 255 | #define VBLANK 0x2803 |
TheChrisyd | 0:c9523256df08 | 256 | #define SCROLL_X 0x2804 |
TheChrisyd | 0:c9523256df08 | 257 | #define SCROLL_Y 0x2806 |
TheChrisyd | 0:c9523256df08 | 258 | #define JK_MODE 0x2808 |
TheChrisyd | 0:c9523256df08 | 259 | #define J1_RESET 0x2809 |
TheChrisyd | 0:c9523256df08 | 260 | #define SPR_DISABLE 0x280a |
TheChrisyd | 0:c9523256df08 | 261 | #define SPR_PAGE 0x280b |
TheChrisyd | 0:c9523256df08 | 262 | #define IOMODE 0x280c |
TheChrisyd | 0:c9523256df08 | 263 | |
TheChrisyd | 0:c9523256df08 | 264 | #define BG_COLOR 0x280e |
TheChrisyd | 0:c9523256df08 | 265 | #define SAMPLE_L 0x2810 |
TheChrisyd | 0:c9523256df08 | 266 | #define SAMPLE_R 0x2812 |
TheChrisyd | 0:c9523256df08 | 267 | |
TheChrisyd | 0:c9523256df08 | 268 | #define MODULATOR 0x2814 |
TheChrisyd | 0:c9523256df08 | 269 | |
TheChrisyd | 0:c9523256df08 | 270 | #define SCREENSHOT_Y 0x281e |
TheChrisyd | 0:c9523256df08 | 271 | |
TheChrisyd | 0:c9523256df08 | 272 | #define PALETTE16A 0x2840 // 16-color palette RAM A, 32 bytes |
TheChrisyd | 0:c9523256df08 | 273 | #define PALETTE16B 0x2860 // 16-color palette RAM B, 32 bytes |
TheChrisyd | 0:c9523256df08 | 274 | #define PALETTE4A 0x2880 // 4-color palette RAM A, 8 bytes |
TheChrisyd | 0:c9523256df08 | 275 | #define PALETTE4B 0x2888 // 4-color palette RAM A, 8 bytes |
TheChrisyd | 0:c9523256df08 | 276 | #define COMM 0x2890 // Communication buffer |
TheChrisyd | 0:c9523256df08 | 277 | #define COLLISION 0x2900 // Collision detection RAM, 256 bytes |
TheChrisyd | 0:c9523256df08 | 278 | #define VOICES 0x2a00 // Voice controls |
TheChrisyd | 0:c9523256df08 | 279 | #define J1_CODE 0x2b00 // J1 coprocessor microcode RAM |
TheChrisyd | 0:c9523256df08 | 280 | #define SCREENSHOT 0x2c00 // screenshot line RAM |
TheChrisyd | 0:c9523256df08 | 281 | #define RAM_SPR 0x3000 // Sprite Control, 512 x 4 = 2048 bytes |
TheChrisyd | 0:c9523256df08 | 282 | #define RAM_SPRPAL 0x3800 // Sprite Palettes, 4 x 256 = 2048 bytes |
TheChrisyd | 0:c9523256df08 | 283 | #define RAM_SPRIMG 0x4000 // Sprite Image, 64 x 256 = 16384 bytes |
TheChrisyd | 0:c9523256df08 | 284 | |
TheChrisyd | 0:c9523256df08 | 285 | #define GET_FAR_ADDRESS(var) (var) |
TheChrisyd | 0:c9523256df08 | 286 | #endif //_GD_H_INCLUDED |