trunk/src/emu/tilemap.h
| r241918 | r241919 | |
| 36 | 36 | |
| 37 | 37 | category (optional): specifies one of 16 categories for the |
| 38 | 38 | pixels in the tile; the category controls which tiles are |
| 39 | | rendered during a tilemap_draw() call |
| 39 | rendered during a tilemap::draw() call |
| 40 | 40 | |
| 41 | 41 | group (optional): specifies one of 256 groups for pen mapping; |
| 42 | 42 | each pen in the tile is looked up in a table to determine |
| r241918 | r241919 | |
| 81 | 81 | all tiles rendered. |
| 82 | 82 | |
| 83 | 83 | Flagsmap = an 8bpp bitmap containing per-pixel flags, |
| 84 | | specifically the category (specified in bits 0-3) and |
| 85 | | the layer (specified in bits 4-6). |
| 84 | specifically the category (specified in bits 0-3) and the |
| 85 | layer (specified in bits 4-6). |
| 86 | 86 | |
| 87 | 87 | **************************************************************************** |
| 88 | 88 | |
| 89 | 89 | How to use a tilemap: |
| 90 | 90 | |
| 91 | | 1. First create a new tilemap by calling tilemap_create(). The |
| 92 | | parameters are as follows: |
| 91 | 1. First create a new tilemap by calling tilemap_manager::create(). |
| 92 | The parameters are as follows: |
| 93 | 93 | |
| 94 | | tile_get_info = pointer to a callback function which accepts a |
| 95 | | memory index and in return fills in a tile_info structure |
| 96 | | that describes the characteristics of a tile; this function |
| 97 | | will be called whenever a dirty tile needs to be rendered |
| 94 | decoder = reference to your device_gfx_interface |
| 98 | 95 | |
| 99 | | mapper = pointer to a callback function which maps the logical |
| 100 | | column and row to a memory index; several standard mappers |
| 101 | | are provided, with tilemap_scan_rows being the most common |
| 96 | tile_get_info = callback function which accepts a memory index |
| 97 | and in return fills in a tile_data structure that describes |
| 98 | the characteristics of a tile; this function will be called |
| 99 | whenever a dirty tile needs to be rendered |
| 102 | 100 | |
| 101 | mapper = callback function which maps the logical column and row |
| 102 | to a memory index; several standard mappers are provided, |
| 103 | with TILEMAP_SCAN_ROWS being the most common |
| 104 | |
| 103 | 105 | tilewidth = the width, in pixels, of each individual tile |
| 104 | 106 | |
| 105 | 107 | tileheight = the height, in pixels, of each individual tile |
| r241918 | r241919 | |
| 112 | 114 | Common configuration tasks include: |
| 113 | 115 | |
| 114 | 116 | * marking one of the pens as transparent via |
| 115 | | tilemap_set_transparent_pen() |
| 117 | tilemap_t::set_transparent_pen() |
| 116 | 118 | |
| 117 | 119 | * performing more complex pen-to-layer mapping via |
| 118 | | tilemap_map_pen_to_layer() or |
| 119 | | tilemap_map_pens_to_layer() |
| 120 | tilemap_t::map_pen_to_layer() or |
| 121 | tilemap_t::map_pens_to_layer() |
| 120 | 122 | |
| 121 | 123 | * configuring global scroll offsets via |
| 122 | | tilemap_set_scrolldx() and tilemap_set_scrolldy() |
| 124 | tilemap_t::set_scrolldx() and tilemap_t::set_scrolldy() |
| 123 | 125 | |
| 124 | | * specifying a pointer that is passed to your tile_get_info |
| 125 | | callback via tilemap_set_user_data() |
| 126 | * specifying a pointer that can be read back later (e.g. in |
| 127 | your tile_get_info callback) via |
| 128 | tilemap_t::set_user_data() |
| 126 | 129 | |
| 127 | 130 | * setting a global palette offset via |
| 128 | | tilemap_set_palette_offset() |
| 131 | tilemap_t::set_palette_offset() |
| 129 | 132 | |
| 130 | 133 | 3. In your memory write handlers for the tile memory, anytime tile |
| 131 | 134 | data is modified, you need to mark the tile dirty so that it is |
| 132 | 135 | re-rendered with the new data the next time the tilemap is drawn. |
| 133 | | Use tilemap_mark_tile_dirty() and pass in the memory index. |
| 136 | Use tilemap_t::mark_tile_dirty() and pass in the memory index. |
| 134 | 137 | |
| 135 | 138 | 4. In your handlers for scrolling, update the scroll values for the |
| 136 | | tilemap via tilemap_set_scrollx() and tilemap_set_scrolly(). |
| 139 | tilemap via tilemap_t::set_scrollx() and tilemap_t::set_scrolly(). |
| 137 | 140 | |
| 138 | 141 | 5. If any other major characteristics of the tilemap change (generally |
| 139 | 142 | any global state that is used by the tile_get_info callback but |
| 140 | 143 | which is not reported via other calls to the tilemap code), you |
| 141 | 144 | should invalidate the entire tilemap. You can do this by calling |
| 142 | | tilemap_mark_all_tiles_dirty(). |
| 145 | tilemap_t::mark_all_dirty(). |
| 143 | 146 | |
| 144 | 147 | 6. In your VIDEO_UPDATE callback, render the tiles by calling |
| 145 | | tilemap_draw() or tilemap_draw_roz(). If you need to do custom |
| 146 | | rendering and want access to the raw pixels, call |
| 147 | | tilemap_get_pixmap() to get a pointer to the updated bitmap_ind16 |
| 148 | tilemap_t::draw() or tilemap_t::draw_roz(). If you need to do |
| 149 | custom rendering and want access to the raw pixels, call |
| 150 | tilemap_t::pixmap() to get a reference to the updated bitmap_ind16 |
| 148 | 151 | containing the tilemap graphics. |
| 149 | 152 | |
| 150 | 153 | **************************************************************************** |
| r241918 | r241919 | |
| 157 | 160 | |
| 158 | 161 | tilemap_t *tmap; |
| 159 | 162 | UINT16 *my_tmap_memory; |
| 163 | required_device<gfxdecode_device> gfxdecode; |
| 160 | 164 | |
| 161 | | TILE_GET_INFO( my_get_info ) |
| 165 | TILE_GET_INFO_MEMBER( my_state::my_get_info ) |
| 162 | 166 | { |
| 163 | | UINT8 tiledata = my_tmap_memory[tile_index]; |
| 167 | UINT16 tiledata = my_tmap_memory[tile_index]; |
| 164 | 168 | UINT8 code = tiledata & 0xff; |
| 165 | 169 | UINT8 color = (tiledata >> 8) & 0x1f; |
| 166 | 170 | UINT8 flipx = (tiledata >> 13) & 1; |
| r241918 | r241919 | |
| 168 | 172 | UINT8 category = (tiledata >> 15) & 1; |
| 169 | 173 | |
| 170 | 174 | // set the common info for the tile |
| 171 | | SET_TILE_INFO( |
| 172 | | 1, // use m_gfxdecode->gfx(1) for tile graphics |
| 175 | tileinfo.set( |
| 176 | 1, // use gfxdecode->gfx(1) for tile graphics |
| 173 | 177 | code, // the index of the graphics for this tile |
| 174 | 178 | color, // the color to use for this tile |
| 175 | 179 | (flipx ? TILE_FLIPX : 0) | // flags for this tile; also |
| 176 | | (flipy ? TILE_FLIPY : 0); // see the FLIP_YX macro |
| 180 | (flipy ? TILE_FLIPY : 0) // see the FLIP_YX macro |
| 177 | 181 | ); |
| 178 | 182 | |
| 179 | 183 | // set the category of each tile based on the high bit; this |
| r241918 | r241919 | |
| 181 | 185 | tileinfo.category = category; |
| 182 | 186 | } |
| 183 | 187 | |
| 184 | | VIDEO_START( mydriver ) |
| 188 | VIDEO_START_MEMBER( my_state, my_driver ) |
| 185 | 189 | { |
| 186 | 190 | // first create the tilemap |
| 187 | | tmap = tilemap_create(machine, |
| 188 | | my_get_info, // pointer to your get_info |
| 189 | | tilemap_scan_rows, // standard row-major mapper |
| 191 | tmap = &machine().tilemap().create( |
| 192 | gfxdecode, |
| 193 | tilemap_get_info_delegate(FUNC(my_state::my_get_info), this), |
| 194 | TILEMAP_SCAN_ROWS, // standard row-major mapper |
| 190 | 195 | 8,8, // 8x8 tiles |
| 191 | 196 | 64,32); // 64 columns, 32 rows |
| 192 | 197 | |
| 193 | 198 | // then set the transparent pen; all other pens will default |
| 194 | 199 | // to being part of layer 0 |
| 195 | | tilemap_set_transparent_pen(tmap, 0); |
| 200 | tmap.set_transparent_pen(0); |
| 196 | 201 | } |
| 197 | 202 | |
| 198 | | SCREEN_UPDATE( mydriver ) |
| 203 | UINT32 my_state::screen_update_mydriver( |
| 204 | screen_device &screen, |
| 205 | bitmap_ind16 &bitmap, |
| 206 | const rectangle &cliprect) |
| 199 | 207 | { |
| 200 | 208 | // draw the tilemap first, fully opaque since it needs to |
| 201 | 209 | // erase all previous pixels |
| 202 | | tilemap_draw( |
| 210 | tmap->draw( |
| 211 | screen, // destination screen |
| 203 | 212 | bitmap, // destination bitmap |
| 204 | 213 | cliprect, // clipping rectangle |
| 205 | | tmap, // tilemap to draw |
| 206 | | TILEMAP_DRAW_OPAQUE, // flags |
| 207 | | 0); // don't use priority_bitmap |
| 214 | TILEMAP_DRAW_OPAQUE); // flags |
| 208 | 215 | |
| 209 | 216 | // next draw the sprites |
| 210 | 217 | my_draw_sprites(); |
| 211 | 218 | |
| 212 | 219 | // then draw the tiles which have priority over sprites |
| 213 | | tilemap_draw( |
| 220 | tmap->draw( |
| 221 | screen, // destination screen |
| 214 | 222 | bitmap, // destination bitmap |
| 215 | 223 | cliprect, // clipping rectangle |
| 216 | | tmap, // tilemap to draw |
| 217 | | TILEMAP_DRAW_CATEGORY(1),// flags: draw category 1 |
| 218 | | 0); // don't use priority_bitmap |
| 224 | TILEMAP_DRAW_CATEGORY(1));// flags: draw category 1 |
| 219 | 225 | |
| 220 | 226 | return 0; |
| 221 | 227 | } |
| r241918 | r241919 | |
| 237 | 243 | |
| 238 | 244 | TILEMAP_TRANSPARENT: This described a tilemap with a single |
| 239 | 245 | transparent pen. To create the same effect, call |
| 240 | | tilemap_set_transparent_pen() to specify which pen is |
| 246 | tilemap_t::set_transparent_pen() to specify which pen is |
| 241 | 247 | transparent; all other pens will map to layer 0. |
| 242 | 248 | |
| 243 | 249 | TILEMAP_BITMASK: This type is no longer special; with the new |
| r241918 | r241919 | |
| 250 | 256 | also allowed for you to choose one of 4 mappings on a per-tile |
| 251 | 257 | basis. All of this functionality is now expanded: you can |
| 252 | 258 | specify one of 3 layers and can choose from one of 256 mappings |
| 253 | | on a per-tile basis. You just call tilemap_set_transmask(), |
| 259 | on a per-tile basis. You just call tilemap_t::set_transmask(), |
| 254 | 260 | which still exists but maps onto the new behavior. The "front" |
| 255 | 261 | layer is now "layer 0" and the "back" layer is now "layer 1". |
| 256 | 262 | |
| r241918 | r241919 | |
| 275 | 281 | TILEMAP_DRAW_LAYER0 is assumed. |
| 276 | 282 | |
| 277 | 283 | * If you want to render with alpha blending, you can call |
| 278 | | tilemap_draw() with the TILEMAP_DRAW_ALPHA flag. |
| 284 | tilemap_t::draw() with the TILEMAP_DRAW_ALPHA flag. |
| 279 | 285 | |
| 280 | 286 | * To configure more complex pen-to-layer mapping, use the |
| 281 | | tilemap_map_pens_to_layer() call. This call takes a group number |
| 282 | | so that you can configure 1 of the 256 groups independently. |
| 283 | | It also takes a pen and a mask; the mapping is updated for all |
| 284 | | pens where ((pennum & mask) == pen). To set all the pens in a |
| 285 | | group to the same value, pass a mask of 0. To set a single pen in |
| 286 | | a group, pass a mask of ~0. The helper function |
| 287 | | tilemap_map_pen_to_layer() does this for you. |
| 287 | tilemap_t::map_pens_to_layer() call. This call takes a group |
| 288 | number so that you can configure 1 of the 256 groups |
| 289 | independently. It also takes a pen and a mask; the mapping is |
| 290 | updated for all pens where ((pennum & mask) == pen). To set all |
| 291 | the pens in a group to the same value, pass a mask of 0. To set |
| 292 | a single pen in a group, pass a mask of ~0. The helper function |
| 293 | tilemap_t::map_pen_to_layer() does this for you. |
| 288 | 294 | |
| 289 | 295 | ***************************************************************************/ |
| 290 | 296 | |
| r241918 | r241919 | |
| 306 | 312 | #define TILEMAP_NUM_GROUPS 256 |
| 307 | 313 | |
| 308 | 314 | |
| 309 | | // these flags control tilemap_draw() behavior |
| 315 | // these flags control tilemap_t::draw() behavior |
| 310 | 316 | const UINT32 TILEMAP_DRAW_CATEGORY_MASK = 0x0f; // specify the category to draw |
| 311 | 317 | const UINT32 TILEMAP_DRAW_LAYER0 = 0x10; // draw layer 0 |
| 312 | 318 | const UINT32 TILEMAP_DRAW_LAYER1 = 0x20; // draw layer 1 |
| r241918 | r241919 | |
| 329 | 335 | const UINT8 TILE_FORCE_LAYER1 = TILEMAP_PIXEL_LAYER1; // force all pixels to be layer 1 (no transparency) |
| 330 | 336 | const UINT8 TILE_FORCE_LAYER2 = TILEMAP_PIXEL_LAYER2; // force all pixels to be layer 2 (no transparency) |
| 331 | 337 | |
| 332 | | // tilemap global flags, used by tilemap_set_flip() |
| 338 | // tilemap global flags, used by tilemap_t::set_flip() |
| 333 | 339 | const UINT32 TILEMAP_FLIPX = TILE_FLIPX; // draw the tilemap horizontally flipped |
| 334 | 340 | const UINT32 TILEMAP_FLIPY = TILE_FLIPY; // draw the tilemap vertically flipped |
| 335 | 341 | |
| r241918 | r241919 | |
| 767 | 773 | // MACROS |
| 768 | 774 | //************************************************************************** |
| 769 | 775 | |
| 770 | | // macros to help form flags for tilemap_draw |
| 776 | // macros to help form flags for tilemap_t::draw |
| 771 | 777 | #define TILEMAP_DRAW_CATEGORY(x) (x) // specify category to draw |
| 772 | 778 | #define TILEMAP_DRAW_ALPHA(x) (TILEMAP_DRAW_ALPHA_FLAG | (rgb_t::clamp(x) << 24)) |
| 773 | 779 | |
trunk/src/lib/util/plaparse.c
| r241918 | r241919 | |
| 4 | 4 | |
| 5 | 5 | plaparse.h |
| 6 | 6 | |
| 7 | | Parser for Berkeley standard PLA files into raw fusemaps. |
| 7 | Simple parser for Berkeley standard PLA files into raw fusemaps. |
| 8 | It supports no more than one output matrix, and is limited to |
| 9 | keywords: i, o, p, phase, e |
| 8 | 10 | |
| 9 | 11 | ***************************************************************************/ |
| 10 | 12 | |
| r241918 | r241919 | |
| 31 | 33 | |
| 32 | 34 | struct parse_info |
| 33 | 35 | { |
| 34 | | UINT32 inputs; |
| 35 | | UINT32 outputs; |
| 36 | | UINT32 terms; |
| 36 | UINT32 inputs; /* number of input columns */ |
| 37 | UINT32 outputs; /* number of output columns */ |
| 38 | UINT32 terms; /* number of terms */ |
| 39 | UINT32 xorval[JED_MAX_FUSES/64]; /* output polarity */ |
| 40 | UINT32 xorptr; |
| 37 | 41 | }; |
| 38 | 42 | |
| 39 | 43 | |
| r241918 | r241919 | |
| 57 | 61 | character stream |
| 58 | 62 | -------------------------------------------------*/ |
| 59 | 63 | |
| 60 | | static UINT32 suck_number(const UINT8 **psrc) |
| 64 | static UINT32 suck_number(const UINT8 **cursrc, const UINT8 *srcend) |
| 61 | 65 | { |
| 62 | | const UINT8 *src = *psrc; |
| 63 | 66 | UINT32 value = 0; |
| 67 | (*cursrc)++; |
| 68 | |
| 69 | // find first digit |
| 70 | while (*cursrc < srcend && !iscrlf(**cursrc) && !isdigit(**cursrc)) |
| 71 | (*cursrc)++; |
| 72 | if (*cursrc >= srcend) |
| 73 | return 0; |
| 64 | 74 | |
| 65 | 75 | // loop over and accumulate digits |
| 66 | | while (isdigit(*src)) |
| 76 | while (isdigit(**cursrc)) |
| 67 | 77 | { |
| 68 | | value = value * 10 + *src - '0'; |
| 69 | | src++; |
| 78 | value = value * 10 + (**cursrc) - '0'; |
| 79 | (*cursrc)++; |
| 70 | 80 | } |
| 71 | 81 | |
| 72 | | // return a pointer to the string afterwards |
| 73 | | *psrc = src; |
| 74 | 82 | return value; |
| 75 | 83 | } |
| 76 | 84 | |
| r241918 | r241919 | |
| 81 | 89 | ***************************************************************************/ |
| 82 | 90 | |
| 83 | 91 | /*------------------------------------------------- |
| 84 | | process_field - process a single field |
| 92 | process_terms - process input/output matrix |
| 85 | 93 | -------------------------------------------------*/ |
| 86 | 94 | |
| 87 | | static void process_field(jed_data *data, const UINT8 *cursrc, const UINT8 *srcend, parse_info *pinfo) |
| 95 | static bool process_terms(jed_data *data, const UINT8 **cursrc, const UINT8 *srcend, parse_info *pinfo) |
| 88 | 96 | { |
| 89 | | cursrc++; |
| 97 | UINT32 curinput = 0; |
| 98 | UINT32 curoutput = 0; |
| 99 | bool outputs = false; |
| 90 | 100 | |
| 91 | | // switch off of the field type |
| 92 | | switch (*cursrc) |
| 101 | while (*cursrc < srcend && **cursrc != '.' && **cursrc != '#') |
| 93 | 102 | { |
| 94 | | // number of inputs |
| 95 | | case 'i': |
| 96 | | cursrc += 2; |
| 97 | | pinfo->inputs = suck_number(&cursrc); |
| 98 | | if (LOG_PARSE) printf("Inputs: %u\n", pinfo->inputs); |
| 99 | | break; |
| 100 | | |
| 101 | | // number of outputs |
| 102 | | case 'o': |
| 103 | | cursrc += 2; |
| 104 | | pinfo->outputs = suck_number(&cursrc); |
| 105 | | if (LOG_PARSE) printf("Outputs: %u\n", pinfo->outputs); |
| 106 | | break; |
| 107 | | |
| 108 | | // number of product terms |
| 109 | | case 'p': |
| 103 | switch (**cursrc) |
| 110 | 104 | { |
| 111 | | cursrc += 2; |
| 112 | | pinfo->terms = suck_number(&cursrc); |
| 113 | | if (LOG_PARSE) printf("Terms: %u\n", pinfo->terms); |
| 105 | case '-': |
| 106 | if (!outputs) |
| 107 | { |
| 108 | curinput++; |
| 109 | jed_set_fuse(data, data->numfuses++, 1); |
| 110 | jed_set_fuse(data, data->numfuses++, 1); |
| 114 | 111 | |
| 115 | | UINT32 curfuse = 0; |
| 116 | | bool outputs = false; |
| 112 | if (LOG_PARSE) printf("11"); |
| 113 | } |
| 114 | break; |
| 117 | 115 | |
| 118 | | cursrc++; |
| 119 | | while (cursrc < srcend && *cursrc != '.') |
| 120 | | { |
| 121 | | switch (*cursrc) |
| 116 | case '~': |
| 117 | if (!outputs) |
| 122 | 118 | { |
| 123 | | case '-': |
| 124 | | if (!outputs) |
| 125 | | { |
| 126 | | jed_set_fuse(data, curfuse++, 1); |
| 127 | | jed_set_fuse(data, curfuse++, 1); |
| 119 | curinput++; |
| 120 | // this product term is inhibited |
| 121 | jed_set_fuse(data, data->numfuses++, 0); |
| 122 | jed_set_fuse(data, data->numfuses++, 0); |
| 128 | 123 | |
| 129 | | if (LOG_PARSE) printf("11"); |
| 130 | | } |
| 131 | | break; |
| 124 | if (LOG_PARSE) printf("00"); |
| 125 | } |
| 126 | break; |
| 132 | 127 | |
| 133 | | case '1': |
| 134 | | if (outputs) |
| 135 | | { |
| 136 | | jed_set_fuse(data, curfuse++, 0); |
| 128 | case '1': |
| 129 | if (outputs) |
| 130 | { |
| 131 | curoutput++; |
| 132 | jed_set_fuse(data, data->numfuses++, 0); |
| 137 | 133 | |
| 138 | | if (LOG_PARSE) printf("0"); |
| 139 | | } |
| 140 | | else |
| 141 | | { |
| 142 | | jed_set_fuse(data, curfuse++, 1); |
| 143 | | jed_set_fuse(data, curfuse++, 0); |
| 134 | if (LOG_PARSE) printf("0"); |
| 135 | } |
| 136 | else |
| 137 | { |
| 138 | curinput++; |
| 139 | jed_set_fuse(data, data->numfuses++, 1); |
| 140 | jed_set_fuse(data, data->numfuses++, 0); |
| 144 | 141 | |
| 145 | | if (LOG_PARSE) printf("10"); |
| 146 | | } |
| 147 | | break; |
| 142 | if (LOG_PARSE) printf("10"); |
| 143 | } |
| 144 | break; |
| 148 | 145 | |
| 149 | | case '0': |
| 150 | | if (outputs) |
| 151 | | { |
| 152 | | jed_set_fuse(data, curfuse++, 1); |
| 146 | case '0': |
| 147 | if (outputs) |
| 148 | { |
| 149 | curoutput++; |
| 150 | jed_set_fuse(data, data->numfuses++, 1); |
| 153 | 151 | |
| 154 | | if (LOG_PARSE) printf("1"); |
| 155 | | } |
| 156 | | else |
| 157 | | { |
| 158 | | jed_set_fuse(data, curfuse++, 0); |
| 159 | | jed_set_fuse(data, curfuse++, 1); |
| 152 | if (LOG_PARSE) printf("1"); |
| 153 | } |
| 154 | else |
| 155 | { |
| 156 | curinput++; |
| 157 | jed_set_fuse(data, data->numfuses++, 0); |
| 158 | jed_set_fuse(data, data->numfuses++, 1); |
| 160 | 159 | |
| 161 | | if (LOG_PARSE) printf("01"); |
| 162 | | } |
| 163 | | break; |
| 160 | if (LOG_PARSE) printf("01"); |
| 161 | } |
| 162 | break; |
| 164 | 163 | |
| 165 | | case ' ': |
| 164 | case ' ': case '\t': |
| 165 | if (curinput > 0 && !outputs) |
| 166 | { |
| 166 | 167 | outputs = true; |
| 167 | 168 | if (LOG_PARSE) printf(" "); |
| 168 | | break; |
| 169 | 169 | } |
| 170 | break; |
| 171 | |
| 172 | default: |
| 173 | break; |
| 174 | } |
| 170 | 175 | |
| 171 | | if (iscrlf(*cursrc) && outputs) |
| 176 | if (iscrlf(**cursrc) && outputs) |
| 177 | { |
| 178 | outputs = false; |
| 179 | if (LOG_PARSE) printf("\n"); |
| 180 | |
| 181 | if (curinput != pinfo->inputs || curoutput != pinfo->outputs) |
| 182 | return false; |
| 183 | |
| 184 | curinput = 0; |
| 185 | curoutput = 0; |
| 186 | } |
| 187 | |
| 188 | (*cursrc)++; |
| 189 | } |
| 190 | |
| 191 | return true; |
| 192 | } |
| 193 | |
| 194 | |
| 195 | |
| 196 | /*------------------------------------------------- |
| 197 | process_field - process a single field |
| 198 | -------------------------------------------------*/ |
| 199 | |
| 200 | static bool process_field(jed_data *data, const UINT8 **cursrc, const UINT8 *srcend, parse_info *pinfo) |
| 201 | { |
| 202 | (*cursrc)++; |
| 203 | |
| 204 | switch (**cursrc) |
| 205 | { |
| 206 | // number of inputs |
| 207 | case 'i': case 'I': |
| 208 | pinfo->inputs = suck_number(cursrc, srcend); |
| 209 | if (pinfo->inputs == 0 || pinfo->inputs >= (JED_MAX_FUSES/2)) |
| 210 | return false; |
| 211 | |
| 212 | if (LOG_PARSE) printf("Inputs: %u\n", pinfo->inputs); |
| 213 | break; |
| 214 | |
| 215 | // number of outputs |
| 216 | case 'o': case 'O': |
| 217 | pinfo->outputs = suck_number(cursrc, srcend); |
| 218 | if (pinfo->outputs == 0 || pinfo->outputs >= (JED_MAX_FUSES/2)) |
| 219 | return false; |
| 220 | |
| 221 | if (LOG_PARSE) printf("Outputs: %u\n", pinfo->outputs); |
| 222 | break; |
| 223 | |
| 224 | case 'p': case 'P': |
| 225 | // output polarity (optional) |
| 226 | if (tolower((*cursrc)[1]) == 'h' && tolower((*cursrc)[2]) == 'a' && tolower((*cursrc)[3]) == 's' && tolower((*cursrc)[4]) == 'e') |
| 227 | { |
| 228 | if (LOG_PARSE) printf("Phase...\n"); |
| 229 | while (*cursrc < srcend && !iscrlf(**cursrc) && pinfo->xorptr < (JED_MAX_FUSES/2)) |
| 172 | 230 | { |
| 173 | | outputs = false; |
| 174 | | if (LOG_PARSE) printf("\n"); |
| 231 | if (**cursrc == '0' || **cursrc == '1') |
| 232 | { |
| 233 | // 0 is negative |
| 234 | if (**cursrc == '0') |
| 235 | pinfo->xorval[pinfo->xorptr/32] |= 1 << (pinfo->xorptr & 31); |
| 236 | pinfo->xorptr++; |
| 237 | } |
| 238 | |
| 239 | (*cursrc)++; |
| 175 | 240 | } |
| 241 | } |
| 242 | |
| 243 | // or number of product terms (optional) |
| 244 | else |
| 245 | { |
| 246 | pinfo->terms = suck_number(cursrc, srcend); |
| 247 | if (pinfo->terms == 0 || pinfo->terms >= (JED_MAX_FUSES/2)) |
| 248 | return false; |
| 176 | 249 | |
| 177 | | cursrc++; |
| 250 | if (LOG_PARSE) printf("Terms: %u\n", pinfo->terms); |
| 178 | 251 | } |
| 179 | | |
| 180 | | data->numfuses = curfuse; |
| 181 | 252 | break; |
| 182 | | } |
| 183 | 253 | |
| 184 | | // end of file |
| 185 | | case 'e': |
| 254 | // end of file (optional) |
| 255 | case 'e': case 'E': |
| 186 | 256 | if (LOG_PARSE) printf("End of file\n"); |
| 187 | 257 | break; |
| 258 | |
| 259 | default: |
| 260 | return false; |
| 188 | 261 | } |
| 189 | | |
| 190 | | cursrc++; |
| 262 | |
| 263 | return true; |
| 191 | 264 | } |
| 192 | 265 | |
| 193 | 266 | |
| r241918 | r241919 | |
| 201 | 274 | { |
| 202 | 275 | const UINT8 *cursrc = (const UINT8 *)data; |
| 203 | 276 | const UINT8 *srcend = cursrc + length; |
| 204 | | const UINT8 *scan; |
| 277 | |
| 205 | 278 | parse_info pinfo; |
| 279 | memset(&pinfo, 0, sizeof(pinfo)); |
| 206 | 280 | |
| 207 | 281 | result->numfuses = 0; |
| 208 | | memset(result->fusemap, 0x00, sizeof(result->fusemap)); |
| 282 | memset(result->fusemap, 0, sizeof(result->fusemap)); |
| 209 | 283 | |
| 210 | 284 | while (cursrc < srcend) |
| 211 | 285 | { |
| 212 | | if (*cursrc == '#') |
| 286 | switch (*cursrc) |
| 213 | 287 | { |
| 214 | | cursrc++; |
| 215 | | while (cursrc < srcend && !iscrlf(*cursrc)) |
| 288 | // comment line |
| 289 | case '#': |
| 290 | while (cursrc < srcend && !iscrlf(*cursrc)) |
| 291 | cursrc++; |
| 292 | break; |
| 293 | |
| 294 | // keyword |
| 295 | case '.': |
| 296 | if (!process_field(result, &cursrc, srcend, &pinfo)) |
| 297 | return JEDERR_INVALID_DATA; |
| 298 | break; |
| 299 | |
| 300 | // terms |
| 301 | case '0': case '1': case '-': case '~': |
| 302 | if (!process_terms(result, &cursrc, srcend, &pinfo)) |
| 303 | return JEDERR_INVALID_DATA; |
| 304 | break; |
| 305 | |
| 306 | default: |
| 216 | 307 | cursrc++; |
| 308 | break; |
| 217 | 309 | } |
| 218 | | else if (*cursrc == '.') |
| 310 | } |
| 311 | |
| 312 | // write output polarity |
| 313 | if (pinfo.xorptr > 0) |
| 314 | { |
| 315 | if (LOG_PARSE) printf("Polarity: "); |
| 316 | |
| 317 | for (int i = 0; i < pinfo.outputs; i++) |
| 219 | 318 | { |
| 220 | | scan = cursrc; |
| 221 | | while (scan < srcend && !iscrlf(*scan)) |
| 222 | | scan++; |
| 223 | | if (scan >= srcend) |
| 224 | | return JEDERR_INVALID_DATA; |
| 225 | | |
| 226 | | process_field(result, cursrc, srcend, &pinfo); |
| 227 | | |
| 228 | | cursrc = scan + 1; |
| 319 | int bit = pinfo.xorval[i/32] >> (i & 31) & 1; |
| 320 | jed_set_fuse(result, result->numfuses++, bit); |
| 321 | if (LOG_PARSE) printf("%d", bit); |
| 229 | 322 | } |
| 230 | | |
| 231 | | cursrc++; |
| 323 | if (LOG_PARSE) printf("\n"); |
| 232 | 324 | } |
| 233 | 325 | |
| 234 | 326 | return JEDERR_NONE; |
trunk/src/mame/drivers/dooyong.c
| r241918 | r241919 | |
| 84 | 84 | #include "sound/okim6295.h" |
| 85 | 85 | #include "includes/dooyong.h" |
| 86 | 86 | |
| 87 | | WRITE8_MEMBER(dooyong_state::lastday_bankswitch_w) |
| 87 | WRITE8_MEMBER(dooyong_z80_state::bankswitch_w) |
| 88 | 88 | { |
| 89 | 89 | membank("bank1")->set_entry(data & 0x07); |
| 90 | 90 | |
| 91 | 91 | if (data & 0xf8) popmessage("bankswitch %02x",data); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | | MACHINE_START_MEMBER(dooyong_state,lastday) |
| 94 | MACHINE_START_MEMBER(dooyong_z80_state, cpu_z80) |
| 95 | 95 | { |
| 96 | 96 | membank("bank1")->configure_entries(0, 8, memregion("maincpu")->base() + 0x10000, 0x4000); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | | WRITE8_MEMBER(dooyong_state::flip_screen_w) |
| 99 | WRITE8_MEMBER(dooyong_z80_state::flip_screen_w) |
| 100 | 100 | { |
| 101 | 101 | flip_screen_set(data); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | | MACHINE_RESET_MEMBER(dooyong_state,sound_ym2203) |
| 104 | MACHINE_RESET_MEMBER(dooyong_z80_ym2203_state, sound_ym2203) |
| 105 | 105 | { |
| 106 | | m_interrupt_line_1=0; |
| 107 | | m_interrupt_line_2=0; |
| 106 | m_interrupt_line_1 = 0; |
| 107 | m_interrupt_line_2 = 0; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /*************************************************************************** |
| r241918 | r241919 | |
| 113 | 113 | |
| 114 | 114 | ***************************************************************************/ |
| 115 | 115 | |
| 116 | | static ADDRESS_MAP_START( lastday_map, AS_PROGRAM, 8, dooyong_state ) |
| 116 | static ADDRESS_MAP_START( lastday_map, AS_PROGRAM, 8, dooyong_z80_ym2203_state ) |
| 117 | 117 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 118 | 118 | AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") |
| 119 | | AM_RANGE(0xc000, 0xc007) AM_WRITE(dooyong_bgscroll8_w) |
| 120 | | AM_RANGE(0xc008, 0xc00f) AM_WRITE(dooyong_fgscroll8_w) |
| 119 | AM_RANGE(0xc000, 0xc007) AM_WRITE(bgscroll_w) |
| 120 | AM_RANGE(0xc008, 0xc00f) AM_WRITE(fgscroll_w) |
| 121 | 121 | AM_RANGE(0xc010, 0xc010) AM_READ_PORT("SYSTEM") |
| 122 | 122 | AM_RANGE(0xc010, 0xc010) AM_WRITE(lastday_ctrl_w) /* coin counter, flip screen */ |
| 123 | 123 | AM_RANGE(0xc011, 0xc011) AM_READ_PORT("P1") |
| 124 | | AM_RANGE(0xc011, 0xc011) AM_WRITE(lastday_bankswitch_w) |
| 124 | AM_RANGE(0xc011, 0xc011) AM_WRITE(bankswitch_w) |
| 125 | 125 | AM_RANGE(0xc012, 0xc012) AM_READ_PORT("P2") |
| 126 | 126 | AM_RANGE(0xc012, 0xc012) AM_WRITE(soundlatch_byte_w) |
| 127 | 127 | AM_RANGE(0xc013, 0xc013) AM_READ_PORT("DSWA") |
| 128 | 128 | AM_RANGE(0xc014, 0xc014) AM_READ_PORT("DSWB") |
| 129 | 129 | AM_RANGE(0xc800, 0xcfff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") |
| 130 | | AM_RANGE(0xd000, 0xdfff) AM_RAM_WRITE(dooyong_txvideoram8_w) AM_SHARE("txvideoram") |
| 130 | AM_RANGE(0xd000, 0xdfff) AM_RAM_WRITE(txvideoram_w) AM_SHARE("txvideoram") |
| 131 | 131 | AM_RANGE(0xe000, 0xefff) AM_RAM |
| 132 | 132 | AM_RANGE(0xf000, 0xffff) AM_RAM AM_SHARE("spriteram") |
| 133 | 133 | ADDRESS_MAP_END |
| 134 | 134 | |
| 135 | | static ADDRESS_MAP_START( pollux_map, AS_PROGRAM, 8, dooyong_state ) |
| 135 | static ADDRESS_MAP_START( pollux_map, AS_PROGRAM, 8, dooyong_z80_ym2203_state ) |
| 136 | 136 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 137 | 137 | AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") |
| 138 | 138 | AM_RANGE(0xc000, 0xcfff) AM_RAM |
| 139 | 139 | AM_RANGE(0xd000, 0xdfff) AM_RAM AM_SHARE("spriteram") |
| 140 | | AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(dooyong_txvideoram8_w) AM_SHARE("txvideoram") |
| 141 | | AM_RANGE(0xf000, 0xf000) AM_READ_PORT("DSWA") AM_WRITE(lastday_bankswitch_w) |
| 140 | AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(txvideoram_w) AM_SHARE("txvideoram") |
| 141 | AM_RANGE(0xf000, 0xf000) AM_READ_PORT("DSWA") AM_WRITE(bankswitch_w) |
| 142 | 142 | AM_RANGE(0xf001, 0xf001) AM_READ_PORT("DSWB") |
| 143 | 143 | AM_RANGE(0xf002, 0xf002) AM_READ_PORT("P1") |
| 144 | 144 | AM_RANGE(0xf003, 0xf003) AM_READ_PORT("P2") |
| 145 | 145 | AM_RANGE(0xf004, 0xf004) AM_READ_PORT("SYSTEM") |
| 146 | 146 | AM_RANGE(0xf008, 0xf008) AM_WRITE(pollux_ctrl_w) /* coin counter, flip screen */ |
| 147 | 147 | AM_RANGE(0xf010, 0xf010) AM_WRITE(soundlatch_byte_w) |
| 148 | | AM_RANGE(0xf018, 0xf01f) AM_WRITE(dooyong_bgscroll8_w) |
| 149 | | AM_RANGE(0xf020, 0xf027) AM_WRITE(dooyong_fgscroll8_w) |
| 148 | AM_RANGE(0xf018, 0xf01f) AM_WRITE(bgscroll_w) |
| 149 | AM_RANGE(0xf020, 0xf027) AM_WRITE(fgscroll_w) |
| 150 | 150 | AM_RANGE(0xf800, 0xffff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") |
| 151 | 151 | ADDRESS_MAP_END |
| 152 | 152 | |
| 153 | | static ADDRESS_MAP_START( gulfstrm_map, AS_PROGRAM, 8, dooyong_state ) |
| 153 | static ADDRESS_MAP_START( gulfstrm_map, AS_PROGRAM, 8, dooyong_z80_ym2203_state ) |
| 154 | 154 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 155 | 155 | AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") |
| 156 | 156 | AM_RANGE(0xc000, 0xcfff) AM_RAM |
| 157 | 157 | AM_RANGE(0xd000, 0xdfff) AM_RAM AM_SHARE("spriteram") |
| 158 | | AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(dooyong_txvideoram8_w) AM_SHARE("txvideoram") |
| 158 | AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(txvideoram_w) AM_SHARE("txvideoram") |
| 159 | 159 | AM_RANGE(0xf000, 0xf000) AM_READ_PORT("DSWA") |
| 160 | | AM_RANGE(0xf000, 0xf000) AM_WRITE(lastday_bankswitch_w) |
| 160 | AM_RANGE(0xf000, 0xf000) AM_WRITE(bankswitch_w) |
| 161 | 161 | AM_RANGE(0xf001, 0xf001) AM_READ_PORT("DSWB") |
| 162 | 162 | AM_RANGE(0xf002, 0xf002) AM_READ_PORT("P2") |
| 163 | 163 | AM_RANGE(0xf003, 0xf003) AM_READ_PORT("P1") |
| 164 | 164 | AM_RANGE(0xf004, 0xf004) AM_READ_PORT("SYSTEM") |
| 165 | 165 | AM_RANGE(0xf008, 0xf008) AM_WRITE(pollux_ctrl_w) /* coin counter, flip screen */ |
| 166 | 166 | AM_RANGE(0xf010, 0xf010) AM_WRITE(soundlatch_byte_w) |
| 167 | | AM_RANGE(0xf018, 0xf01f) AM_WRITE(dooyong_bgscroll8_w) |
| 168 | | AM_RANGE(0xf020, 0xf027) AM_WRITE(dooyong_fgscroll8_w) |
| 167 | AM_RANGE(0xf018, 0xf01f) AM_WRITE(bgscroll_w) |
| 168 | AM_RANGE(0xf020, 0xf027) AM_WRITE(fgscroll_w) |
| 169 | 169 | AM_RANGE(0xf800, 0xffff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") |
| 170 | 170 | ADDRESS_MAP_END |
| 171 | 171 | |
| 172 | | static ADDRESS_MAP_START( bluehawk_map, AS_PROGRAM, 8, dooyong_state ) |
| 172 | static ADDRESS_MAP_START( bluehawk_map, AS_PROGRAM, 8, dooyong_z80_state ) |
| 173 | 173 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 174 | 174 | AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") |
| 175 | 175 | AM_RANGE(0xc000, 0xc000) AM_READ_PORT("DSWA") |
| r241918 | r241919 | |
| 178 | 178 | AM_RANGE(0xc002, 0xc002) AM_READ_PORT("P1") |
| 179 | 179 | AM_RANGE(0xc003, 0xc003) AM_READ_PORT("P2") |
| 180 | 180 | AM_RANGE(0xc004, 0xc004) AM_READ_PORT("SYSTEM") |
| 181 | | AM_RANGE(0xc008, 0xc008) AM_WRITE(lastday_bankswitch_w) |
| 181 | AM_RANGE(0xc008, 0xc008) AM_WRITE(bankswitch_w) |
| 182 | 182 | AM_RANGE(0xc010, 0xc010) AM_WRITE(soundlatch_byte_w) |
| 183 | | AM_RANGE(0xc018, 0xc01f) AM_WRITE(dooyong_fg2scroll8_w) |
| 184 | | AM_RANGE(0xc040, 0xc047) AM_WRITE(dooyong_bgscroll8_w) |
| 185 | | AM_RANGE(0xc048, 0xc04f) AM_WRITE(dooyong_fgscroll8_w) |
| 183 | AM_RANGE(0xc018, 0xc01f) AM_WRITE(fg2scroll_w) |
| 184 | AM_RANGE(0xc040, 0xc047) AM_WRITE(bgscroll_w) |
| 185 | AM_RANGE(0xc048, 0xc04f) AM_WRITE(fgscroll_w) |
| 186 | 186 | AM_RANGE(0xc800, 0xcfff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") |
| 187 | | AM_RANGE(0xd000, 0xdfff) AM_RAM_WRITE(dooyong_txvideoram8_w) AM_SHARE("txvideoram") |
| 187 | AM_RANGE(0xd000, 0xdfff) AM_RAM_WRITE(txvideoram_w) AM_SHARE("txvideoram") |
| 188 | 188 | AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE("spriteram") |
| 189 | 189 | AM_RANGE(0xf000, 0xffff) AM_RAM |
| 190 | 190 | ADDRESS_MAP_END |
| 191 | 191 | |
| 192 | | static ADDRESS_MAP_START( flytiger_map, AS_PROGRAM, 8, dooyong_state ) |
| 192 | static ADDRESS_MAP_START( flytiger_map, AS_PROGRAM, 8, dooyong_z80_state ) |
| 193 | 193 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 194 | 194 | AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") |
| 195 | 195 | AM_RANGE(0xc000, 0xcfff) AM_RAM AM_SHARE("spriteram") |
| 196 | 196 | AM_RANGE(0xd000, 0xdfff) AM_RAM |
| 197 | 197 | AM_RANGE(0xe000, 0xe000) AM_READ_PORT("P1") |
| 198 | | AM_RANGE(0xe000, 0xe000) AM_WRITE(lastday_bankswitch_w) |
| 198 | AM_RANGE(0xe000, 0xe000) AM_WRITE(bankswitch_w) |
| 199 | 199 | AM_RANGE(0xe002, 0xe002) AM_READ_PORT("P2") |
| 200 | 200 | AM_RANGE(0xe004, 0xe004) AM_READ_PORT("SYSTEM") |
| 201 | 201 | AM_RANGE(0xe006, 0xe006) AM_READ_PORT("DSWA") |
| 202 | 202 | AM_RANGE(0xe008, 0xe008) AM_READ_PORT("DSWB") |
| 203 | 203 | AM_RANGE(0xe010, 0xe010) AM_WRITE(flytiger_ctrl_w) /* coin counter, flip screen */ |
| 204 | 204 | AM_RANGE(0xe020, 0xe020) AM_WRITE(soundlatch_byte_w) |
| 205 | | AM_RANGE(0xe030, 0xe037) AM_WRITE(dooyong_bgscroll8_w) |
| 206 | | AM_RANGE(0xe040, 0xe047) AM_WRITE(dooyong_fgscroll8_w) |
| 205 | AM_RANGE(0xe030, 0xe037) AM_WRITE(bgscroll_w) |
| 206 | AM_RANGE(0xe040, 0xe047) AM_WRITE(fgscroll_w) |
| 207 | 207 | AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(paletteram_flytiger_w) AM_SHARE("flytiger_palram") |
| 208 | | AM_RANGE(0xf000, 0xffff) AM_RAM_WRITE(dooyong_txvideoram8_w) AM_SHARE("txvideoram") |
| 208 | AM_RANGE(0xf000, 0xffff) AM_RAM_WRITE(txvideoram_w) AM_SHARE("txvideoram") |
| 209 | 209 | ADDRESS_MAP_END |
| 210 | 210 | |
| 211 | | static ADDRESS_MAP_START( primella_map, AS_PROGRAM, 8, dooyong_state ) |
| 211 | static ADDRESS_MAP_START( primella_map, AS_PROGRAM, 8, dooyong_z80_state ) |
| 212 | 212 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 213 | 213 | AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") |
| 214 | 214 | AM_RANGE(0xc000, 0xcfff) AM_RAM |
| 215 | 215 | AM_RANGE(0xd000, 0xd3ff) AM_RAM /* what is this? looks like a palette? scratchpad RAM maybe? */ |
| 216 | | AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(dooyong_txvideoram8_w) AM_SHARE("txvideoram") |
| 216 | AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(txvideoram_w) AM_SHARE("txvideoram") |
| 217 | 217 | AM_RANGE(0xf000, 0xf7ff) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") |
| 218 | 218 | AM_RANGE(0xf800, 0xf800) AM_READ_PORT("DSWA") |
| 219 | 219 | AM_RANGE(0xf800, 0xf800) AM_WRITE(primella_ctrl_w) /* bank switch, flip screen etc */ |
| r241918 | r241919 | |
| 222 | 222 | AM_RANGE(0xf820, 0xf820) AM_READ_PORT("P1") |
| 223 | 223 | AM_RANGE(0xf830, 0xf830) AM_READ_PORT("P2") |
| 224 | 224 | AM_RANGE(0xf840, 0xf840) AM_READ_PORT("SYSTEM") |
| 225 | | AM_RANGE(0xfc00, 0xfc07) AM_WRITE(dooyong_bgscroll8_w) |
| 226 | | AM_RANGE(0xfc08, 0xfc0f) AM_WRITE(dooyong_fgscroll8_w) |
| 225 | AM_RANGE(0xfc00, 0xfc07) AM_WRITE(bgscroll_w) |
| 226 | AM_RANGE(0xfc08, 0xfc0f) AM_WRITE(fgscroll_w) |
| 227 | 227 | ADDRESS_MAP_END |
| 228 | 228 | |
| 229 | | static ADDRESS_MAP_START( rshark_map, AS_PROGRAM, 16, dooyong_state ) |
| 229 | static ADDRESS_MAP_START( rshark_map, AS_PROGRAM, 16, dooyong_68k_state ) |
| 230 | 230 | ADDRESS_MAP_GLOBAL_MASK(0xfffff) /* super-x needs this and is similar */ |
| 231 | 231 | AM_RANGE(0x000000, 0x03ffff) AM_ROM |
| 232 | 232 | AM_RANGE(0x040000, 0x04cfff) AM_RAM |
| 233 | | AM_RANGE(0x04d000, 0x04dfff) AM_RAM AM_SHARE("spriteram16") |
| 233 | AM_RANGE(0x04d000, 0x04dfff) AM_RAM AM_SHARE("spriteram") |
| 234 | 234 | AM_RANGE(0x04e000, 0x04ffff) AM_RAM |
| 235 | 235 | AM_RANGE(0x0c0002, 0x0c0003) AM_READ_PORT("DSW") |
| 236 | 236 | AM_RANGE(0x0c0004, 0x0c0005) AM_READ_PORT("P1_P2") |
| 237 | 237 | AM_RANGE(0x0c0006, 0x0c0007) AM_READ_PORT("SYSTEM") |
| 238 | | AM_RANGE(0x0c4000, 0x0c400f) AM_WRITE(dooyong_bgscroll16_w) |
| 239 | | AM_RANGE(0x0c4010, 0x0c401f) AM_WRITE(dooyong_bg2scroll16_w) |
| 238 | AM_RANGE(0x0c4000, 0x0c400f) AM_WRITE8(bgscroll_w, 0x00ff) |
| 239 | AM_RANGE(0x0c4010, 0x0c401f) AM_WRITE8(bg2scroll_w, 0x00ff) |
| 240 | 240 | AM_RANGE(0x0c8000, 0x0c8fff) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") |
| 241 | 241 | AM_RANGE(0x0c0012, 0x0c0013) AM_WRITE(soundlatch_word_w) |
| 242 | | AM_RANGE(0x0c0014, 0x0c0015) AM_WRITE(rshark_ctrl_w) /* flip screen + unknown stuff */ |
| 243 | | AM_RANGE(0x0cc000, 0x0cc00f) AM_WRITE(dooyong_fgscroll16_w) |
| 244 | | AM_RANGE(0x0cc010, 0x0cc01f) AM_WRITE(dooyong_fg2scroll16_w) |
| 242 | AM_RANGE(0x0c0014, 0x0c0015) AM_WRITE(ctrl_w) /* flip screen + unknown stuff */ |
| 243 | AM_RANGE(0x0cc000, 0x0cc00f) AM_WRITE8(fgscroll_w, 0x00ff) |
| 244 | AM_RANGE(0x0cc010, 0x0cc01f) AM_WRITE8(fg2scroll_w, 0x00ff) |
| 245 | 245 | ADDRESS_MAP_END |
| 246 | 246 | |
| 247 | | static ADDRESS_MAP_START( superx_map, AS_PROGRAM, 16, dooyong_state ) |
| 247 | static ADDRESS_MAP_START( superx_map, AS_PROGRAM, 16, dooyong_68k_state ) |
| 248 | 248 | ADDRESS_MAP_GLOBAL_MASK(0xfffff) |
| 249 | 249 | AM_RANGE(0x000000, 0x03ffff) AM_ROM |
| 250 | 250 | AM_RANGE(0x0d0000, 0x0dcfff) AM_RAM |
| 251 | | AM_RANGE(0x0dd000, 0x0ddfff) AM_RAM AM_SHARE("spriteram16") |
| 251 | AM_RANGE(0x0dd000, 0x0ddfff) AM_RAM AM_SHARE("spriteram") |
| 252 | 252 | AM_RANGE(0x0de000, 0x0dffff) AM_RAM |
| 253 | 253 | AM_RANGE(0x080002, 0x080003) AM_READ_PORT("DSW") |
| 254 | 254 | AM_RANGE(0x080004, 0x080005) AM_READ_PORT("P1_P2") |
| 255 | 255 | AM_RANGE(0x080006, 0x080007) AM_READ_PORT("SYSTEM") |
| 256 | | AM_RANGE(0x084000, 0x08400f) AM_WRITE(dooyong_bgscroll16_w) |
| 257 | | AM_RANGE(0x084010, 0x08401f) AM_WRITE(dooyong_bg2scroll16_w) |
| 256 | AM_RANGE(0x084000, 0x08400f) AM_WRITE8(bgscroll_w, 0x00ff) |
| 257 | AM_RANGE(0x084010, 0x08401f) AM_WRITE8(bg2scroll_w, 0x00ff) |
| 258 | 258 | AM_RANGE(0x088000, 0x088fff) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") |
| 259 | 259 | AM_RANGE(0x080012, 0x080013) AM_WRITE(soundlatch_word_w) |
| 260 | | AM_RANGE(0x080014, 0x080015) AM_WRITE(rshark_ctrl_w) /* flip screen + unknown stuff */ |
| 261 | | AM_RANGE(0x08c000, 0x08c00f) AM_WRITE(dooyong_fgscroll16_w) |
| 262 | | AM_RANGE(0x08c010, 0x08c01f) AM_WRITE(dooyong_fg2scroll16_w) |
| 260 | AM_RANGE(0x080014, 0x080015) AM_WRITE(ctrl_w) /* flip screen + unknown stuff */ |
| 261 | AM_RANGE(0x08c000, 0x08c00f) AM_WRITE8(fgscroll_w, 0x00ff) |
| 262 | AM_RANGE(0x08c010, 0x08c01f) AM_WRITE8(fg2scroll_w, 0x00ff) |
| 263 | 263 | ADDRESS_MAP_END |
| 264 | 264 | |
| 265 | | static ADDRESS_MAP_START( popbingo_map, AS_PROGRAM, 16, dooyong_state ) |
| 265 | static ADDRESS_MAP_START( popbingo_map, AS_PROGRAM, 16, dooyong_68k_state ) |
| 266 | 266 | ADDRESS_MAP_GLOBAL_MASK(0xfffff) |
| 267 | 267 | AM_RANGE(0x000000, 0x03ffff) AM_ROM |
| 268 | 268 | AM_RANGE(0x040000, 0x04cfff) AM_RAM |
| 269 | | AM_RANGE(0x04d000, 0x04dfff) AM_RAM AM_SHARE("spriteram16") |
| 269 | AM_RANGE(0x04d000, 0x04dfff) AM_RAM AM_SHARE("spriteram") |
| 270 | 270 | AM_RANGE(0x04e000, 0x04ffff) AM_RAM |
| 271 | 271 | AM_RANGE(0x0c0002, 0x0c0003) AM_READ_PORT("DSW") |
| 272 | 272 | AM_RANGE(0x0c0004, 0x0c0005) AM_READ_PORT("P1_P2") |
| 273 | 273 | AM_RANGE(0x0c0006, 0x0c0007) AM_READ_PORT("SYSTEM") |
| 274 | 274 | AM_RANGE(0x0c0012, 0x0c0013) AM_WRITE(soundlatch_word_w) |
| 275 | | AM_RANGE(0x0c0014, 0x0c0015) AM_WRITE(rshark_ctrl_w) |
| 275 | AM_RANGE(0x0c0014, 0x0c0015) AM_WRITE(ctrl_w) |
| 276 | 276 | AM_RANGE(0x0c0018, 0x0c001b) AM_WRITENOP // ? |
| 277 | | AM_RANGE(0x0c4000, 0x0c400f) AM_WRITE(dooyong_bgscroll16_w) |
| 278 | | AM_RANGE(0x0c4010, 0x0c401f) AM_WRITE(dooyong_bg2scroll16_w) // not used atm |
| 277 | AM_RANGE(0x0c4000, 0x0c400f) AM_WRITE8(bgscroll_w, 0x00ff) |
| 278 | AM_RANGE(0x0c4010, 0x0c401f) AM_WRITE8(bg2scroll_w, 0x00ff) // not used atm |
| 279 | 279 | AM_RANGE(0x0c8000, 0x0c8fff) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") |
| 280 | | AM_RANGE(0x0cc000, 0x0cc00f) AM_WRITE(dooyong_fgscroll16_w) // not used atm |
| 281 | | AM_RANGE(0x0cc010, 0x0cc01f) AM_WRITE(dooyong_fg2scroll16_w) // not used atm |
| 280 | AM_RANGE(0x0cc000, 0x0cc00f) AM_WRITE8(fgscroll_w, 0x00ff) // not used atm |
| 281 | AM_RANGE(0x0cc010, 0x0cc01f) AM_WRITE8(fg2scroll_w, 0x00ff) // not used atm |
| 282 | 282 | AM_RANGE(0x0dc000, 0x0dc01f) AM_RAM // registers of some kind? |
| 283 | 283 | ADDRESS_MAP_END |
| 284 | 284 | |
| 285 | | static ADDRESS_MAP_START( lastday_sound_map, AS_PROGRAM, 8, dooyong_state ) |
| 285 | static ADDRESS_MAP_START( lastday_sound_map, AS_PROGRAM, 8, dooyong_z80_ym2203_state ) |
| 286 | 286 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 287 | 287 | AM_RANGE(0xc000, 0xc7ff) AM_RAM |
| 288 | 288 | AM_RANGE(0xc800, 0xc800) AM_READ(soundlatch_byte_r) |
| r241918 | r241919 | |
| 290 | 290 | AM_RANGE(0xf002, 0xf003) AM_DEVREADWRITE("ym2", ym2203_device, read, write) |
| 291 | 291 | ADDRESS_MAP_END |
| 292 | 292 | |
| 293 | | static ADDRESS_MAP_START( pollux_sound_map, AS_PROGRAM, 8, dooyong_state ) |
| 293 | static ADDRESS_MAP_START( pollux_sound_map, AS_PROGRAM, 8, dooyong_z80_ym2203_state ) |
| 294 | 294 | AM_RANGE(0x0000, 0xefff) AM_ROM |
| 295 | 295 | AM_RANGE(0xf000, 0xf7ff) AM_RAM |
| 296 | 296 | AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_byte_r) |
| r241918 | r241919 | |
| 772 | 772 | GFXDECODE_ENTRY( "gfx2", 0, popbingo_tilelayout, 256, 1 ) |
| 773 | 773 | GFXDECODE_END |
| 774 | 774 | |
| 775 | | READ8_MEMBER(dooyong_state::unk_r) |
| 775 | READ8_MEMBER(dooyong_z80_ym2203_state::unk_r) |
| 776 | 776 | { |
| 777 | 777 | return 0; |
| 778 | 778 | } |
| 779 | 779 | |
| 780 | | WRITE_LINE_MEMBER(dooyong_state::irqhandler_2203_1) |
| 780 | WRITE_LINE_MEMBER(dooyong_z80_ym2203_state::irqhandler_2203_1) |
| 781 | 781 | { |
| 782 | 782 | m_interrupt_line_1=state; |
| 783 | 783 | m_audiocpu->set_input_line(0, (m_interrupt_line_1 | m_interrupt_line_2) ? ASSERT_LINE : CLEAR_LINE); |
| 784 | 784 | } |
| 785 | 785 | |
| 786 | | WRITE_LINE_MEMBER(dooyong_state::irqhandler_2203_2) |
| 786 | WRITE_LINE_MEMBER(dooyong_z80_ym2203_state::irqhandler_2203_2) |
| 787 | 787 | { |
| 788 | 788 | m_interrupt_line_2=state; |
| 789 | 789 | m_audiocpu->set_input_line(0, (m_interrupt_line_1 | m_interrupt_line_2) ? ASSERT_LINE : CLEAR_LINE); |
| r241918 | r241919 | |
| 800 | 800 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 801 | 801 | |
| 802 | 802 | MCFG_SOUND_ADD("ym1", YM2203, 1500000) |
| 803 | | MCFG_YM2203_IRQ_HANDLER(WRITELINE(dooyong_state,irqhandler_2203_1)) |
| 804 | | MCFG_AY8910_PORT_A_READ_CB(READ8(dooyong_state, unk_r)) |
| 803 | MCFG_YM2203_IRQ_HANDLER(WRITELINE(dooyong_z80_ym2203_state, irqhandler_2203_1)) |
| 804 | MCFG_AY8910_PORT_A_READ_CB(READ8(dooyong_z80_ym2203_state, unk_r)) |
| 805 | 805 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) |
| 806 | 806 | |
| 807 | 807 | MCFG_SOUND_ADD("ym2", YM2203, 1500000) |
| 808 | | MCFG_YM2203_IRQ_HANDLER(WRITELINE(dooyong_state, irqhandler_2203_2)) |
| 809 | | MCFG_AY8910_PORT_A_READ_CB(READ8(dooyong_state, unk_r)) |
| 808 | MCFG_YM2203_IRQ_HANDLER(WRITELINE(dooyong_z80_ym2203_state, irqhandler_2203_2)) |
| 809 | MCFG_AY8910_PORT_A_READ_CB(READ8(dooyong_z80_ym2203_state, unk_r)) |
| 810 | 810 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) |
| 811 | 811 | MACHINE_CONFIG_END |
| 812 | 812 | |
| r241918 | r241919 | |
| 834 | 834 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60) |
| 835 | 835 | MACHINE_CONFIG_END |
| 836 | 836 | |
| 837 | | static MACHINE_CONFIG_START( lastday, dooyong_state ) |
| 837 | static MACHINE_CONFIG_START( lastday, dooyong_z80_ym2203_state ) |
| 838 | 838 | |
| 839 | 839 | /* basic machine hardware */ |
| 840 | 840 | MCFG_CPU_ADD("maincpu", Z80, 8000000) /* ??? */ |
| r241918 | r241919 | |
| 844 | 844 | MCFG_CPU_ADD("audiocpu", Z80, 8000000) /* ??? */ |
| 845 | 845 | MCFG_CPU_PROGRAM_MAP(lastday_sound_map) |
| 846 | 846 | |
| 847 | | MCFG_MACHINE_START_OVERRIDE(dooyong_state,lastday) |
| 848 | | MCFG_MACHINE_RESET_OVERRIDE(dooyong_state,sound_ym2203) |
| 847 | MCFG_MACHINE_START_OVERRIDE(dooyong_z80_state, cpu_z80) |
| 848 | MCFG_MACHINE_RESET_OVERRIDE(dooyong_z80_ym2203_state, sound_ym2203) |
| 849 | 849 | |
| 850 | 850 | |
| 851 | 851 | /* video hardware */ |
| r241918 | r241919 | |
| 856 | 856 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 857 | 857 | MCFG_SCREEN_SIZE(64*8, 32*8) |
| 858 | 858 | MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 ) |
| 859 | | MCFG_SCREEN_UPDATE_DRIVER(dooyong_state, screen_update_lastday) |
| 859 | MCFG_SCREEN_UPDATE_DRIVER(dooyong_z80_ym2203_state, screen_update_lastday) |
| 860 | 860 | MCFG_SCREEN_VBLANK_DEVICE("spriteram", buffered_spriteram8_device, vblank_copy_rising) |
| 861 | 861 | MCFG_SCREEN_PALETTE("palette") |
| 862 | 862 | |
| r241918 | r241919 | |
| 864 | 864 | MCFG_PALETTE_ADD("palette", 1024) |
| 865 | 865 | MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR) |
| 866 | 866 | |
| 867 | | MCFG_VIDEO_START_OVERRIDE(dooyong_state,lastday) |
| 867 | MCFG_VIDEO_START_OVERRIDE(dooyong_z80_ym2203_state, lastday) |
| 868 | 868 | |
| 869 | 869 | /* sound hardware */ |
| 870 | 870 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 871 | 871 | |
| 872 | 872 | MCFG_SOUND_ADD("ym1", YM2203, 4000000) |
| 873 | | MCFG_YM2203_IRQ_HANDLER(WRITELINE(dooyong_state,irqhandler_2203_1)) |
| 874 | | MCFG_AY8910_PORT_A_READ_CB(READ8(dooyong_state, unk_r)) |
| 873 | MCFG_YM2203_IRQ_HANDLER(WRITELINE(dooyong_z80_ym2203_state, irqhandler_2203_1)) |
| 874 | MCFG_AY8910_PORT_A_READ_CB(READ8(dooyong_z80_ym2203_state, unk_r)) |
| 875 | 875 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) |
| 876 | 876 | |
| 877 | 877 | MCFG_SOUND_ADD("ym2", YM2203, 4000000) |
| 878 | | MCFG_YM2203_IRQ_HANDLER(WRITELINE(dooyong_state, irqhandler_2203_2)) |
| 879 | | MCFG_AY8910_PORT_A_READ_CB(READ8(dooyong_state, unk_r)) |
| 878 | MCFG_YM2203_IRQ_HANDLER(WRITELINE(dooyong_z80_ym2203_state, irqhandler_2203_2)) |
| 879 | MCFG_AY8910_PORT_A_READ_CB(READ8(dooyong_z80_ym2203_state, unk_r)) |
| 880 | 880 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) |
| 881 | 881 | |
| 882 | 882 | MACHINE_CONFIG_END |
| 883 | 883 | |
| 884 | | static MACHINE_CONFIG_START( gulfstrm, dooyong_state ) |
| 884 | static MACHINE_CONFIG_START( gulfstrm, dooyong_z80_ym2203_state ) |
| 885 | 885 | |
| 886 | 886 | /* basic machine hardware */ |
| 887 | 887 | MCFG_CPU_ADD("maincpu", Z80, 8000000) /* ??? */ |
| r241918 | r241919 | |
| 891 | 891 | MCFG_CPU_ADD("audiocpu", Z80, 8000000) /* ??? */ |
| 892 | 892 | MCFG_CPU_PROGRAM_MAP(lastday_sound_map) |
| 893 | 893 | |
| 894 | | MCFG_MACHINE_START_OVERRIDE(dooyong_state,lastday) |
| 895 | | MCFG_MACHINE_RESET_OVERRIDE(dooyong_state,sound_ym2203) |
| 894 | MCFG_MACHINE_START_OVERRIDE(dooyong_z80_state, cpu_z80) |
| 895 | MCFG_MACHINE_RESET_OVERRIDE(dooyong_z80_ym2203_state, sound_ym2203) |
| 896 | 896 | |
| 897 | 897 | /* video hardware */ |
| 898 | 898 | MCFG_BUFFERED_SPRITERAM8_ADD("spriteram") |
| r241918 | r241919 | |
| 902 | 902 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) |
| 903 | 903 | MCFG_SCREEN_SIZE(64*8, 32*8) |
| 904 | 904 | MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 ) |
| 905 | | MCFG_SCREEN_UPDATE_DRIVER(dooyong_state, screen_update_gulfstrm) |
| 905 | MCFG_SCREEN_UPDATE_DRIVER(dooyong_z80_ym2203_state, screen_update_gulfstrm) |
| 906 | 906 | MCFG_SCREEN_VBLANK_DEVICE("spriteram", buffered_spriteram8_device, vblank_copy_rising) |
| 907 | 907 | MCFG_SCREEN_PALETTE("palette") |
| 908 | 908 | |
| r241918 | r241919 | |
| 910 | 910 | MCFG_PALETTE_ADD("palette", 1024) |
| 911 | 911 | MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) |
| 912 | 912 | |
| 913 | | MCFG_VIDEO_START_OVERRIDE(dooyong_state,gulfstrm) |
| 913 | MCFG_VIDEO_START_OVERRIDE(dooyong_z80_ym2203_state, gulfstrm) |
| 914 | 914 | |
| 915 | 915 | /* sound hardware */ |
| 916 | 916 | MCFG_FRAGMENT_ADD( sound_2203 ) |
| 917 | 917 | MACHINE_CONFIG_END |
| 918 | 918 | |
| 919 | | static MACHINE_CONFIG_START( pollux, dooyong_state ) |
| 919 | static MACHINE_CONFIG_START( pollux, dooyong_z80_ym2203_state ) |
| 920 | 920 | |
| 921 | 921 | /* basic machine hardware */ |
| 922 | 922 | MCFG_CPU_ADD("maincpu", Z80, 8000000) /* ??? */ |
| r241918 | r241919 | |
| 926 | 926 | MCFG_CPU_ADD("audiocpu", Z80, 8000000) /* ??? */ |
| 927 | 927 | MCFG_CPU_PROGRAM_MAP(pollux_sound_map) |
| 928 | 928 | |
| 929 | | MCFG_MACHINE_START_OVERRIDE(dooyong_state,lastday) |
| 930 | | MCFG_MACHINE_RESET_OVERRIDE(dooyong_state,sound_ym2203) |
| 929 | MCFG_MACHINE_START_OVERRIDE(dooyong_z80_state, cpu_z80) |
| 930 | MCFG_MACHINE_RESET_OVERRIDE(dooyong_z80_ym2203_state, sound_ym2203) |
| 931 | 931 | |
| 932 | 932 | /* video hardware */ |
| 933 | 933 | MCFG_BUFFERED_SPRITERAM8_ADD("spriteram") |
| r241918 | r241919 | |
| 937 | 937 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 938 | 938 | MCFG_SCREEN_SIZE(64*8, 32*8) |
| 939 | 939 | MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 ) |
| 940 | | MCFG_SCREEN_UPDATE_DRIVER(dooyong_state, screen_update_pollux) |
| 940 | MCFG_SCREEN_UPDATE_DRIVER(dooyong_z80_ym2203_state, screen_update_pollux) |
| 941 | 941 | MCFG_SCREEN_VBLANK_DEVICE("spriteram", buffered_spriteram8_device, vblank_copy_rising) |
| 942 | 942 | MCFG_SCREEN_PALETTE("palette") |
| 943 | 943 | |
| r241918 | r241919 | |
| 945 | 945 | MCFG_PALETTE_ADD("palette", 1024) |
| 946 | 946 | MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) |
| 947 | 947 | |
| 948 | | MCFG_VIDEO_START_OVERRIDE(dooyong_state,pollux) |
| 948 | MCFG_VIDEO_START_OVERRIDE(dooyong_z80_ym2203_state, pollux) |
| 949 | 949 | |
| 950 | 950 | /* sound hardware */ |
| 951 | 951 | MCFG_FRAGMENT_ADD( sound_2203 ) |
| 952 | 952 | MACHINE_CONFIG_END |
| 953 | 953 | |
| 954 | | static MACHINE_CONFIG_START( bluehawk, dooyong_state ) |
| 954 | static MACHINE_CONFIG_START( bluehawk, dooyong_z80_state ) |
| 955 | 955 | |
| 956 | 956 | /* basic machine hardware */ |
| 957 | 957 | MCFG_CPU_ADD("maincpu", Z80, 8000000) /* ??? */ |
| r241918 | r241919 | |
| 961 | 961 | MCFG_CPU_ADD("audiocpu", Z80, 4000000) /* ??? */ |
| 962 | 962 | MCFG_CPU_PROGRAM_MAP(bluehawk_sound_map) |
| 963 | 963 | |
| 964 | | MCFG_MACHINE_START_OVERRIDE(dooyong_state,lastday) |
| 964 | MCFG_MACHINE_START_OVERRIDE(dooyong_z80_state, cpu_z80) |
| 965 | 965 | |
| 966 | 966 | /* video hardware */ |
| 967 | 967 | MCFG_BUFFERED_SPRITERAM8_ADD("spriteram") |
| r241918 | r241919 | |
| 971 | 971 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 972 | 972 | MCFG_SCREEN_SIZE(64*8, 32*8) |
| 973 | 973 | MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 ) |
| 974 | | MCFG_SCREEN_UPDATE_DRIVER(dooyong_state, screen_update_bluehawk) |
| 974 | MCFG_SCREEN_UPDATE_DRIVER(dooyong_z80_state, screen_update_bluehawk) |
| 975 | 975 | MCFG_SCREEN_VBLANK_DEVICE("spriteram", buffered_spriteram8_device, vblank_copy_rising) |
| 976 | 976 | MCFG_SCREEN_PALETTE("palette") |
| 977 | 977 | |
| r241918 | r241919 | |
| 979 | 979 | MCFG_PALETTE_ADD("palette", 1024) |
| 980 | 980 | MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) |
| 981 | 981 | |
| 982 | | MCFG_VIDEO_START_OVERRIDE(dooyong_state,bluehawk) |
| 982 | MCFG_VIDEO_START_OVERRIDE(dooyong_z80_state, bluehawk) |
| 983 | 983 | |
| 984 | 984 | /* sound hardware */ |
| 985 | 985 | MCFG_FRAGMENT_ADD( sound_2151 ) |
| 986 | 986 | MACHINE_CONFIG_END |
| 987 | 987 | |
| 988 | | static MACHINE_CONFIG_START( flytiger, dooyong_state ) |
| 988 | static MACHINE_CONFIG_START( flytiger, dooyong_z80_state ) |
| 989 | 989 | |
| 990 | 990 | /* basic machine hardware */ |
| 991 | 991 | MCFG_CPU_ADD("maincpu", Z80, 8000000) /* ??? */ |
| r241918 | r241919 | |
| 995 | 995 | MCFG_CPU_ADD("audiocpu", Z80, 4000000) /* ??? */ |
| 996 | 996 | MCFG_CPU_PROGRAM_MAP(bluehawk_sound_map) |
| 997 | 997 | |
| 998 | | MCFG_MACHINE_START_OVERRIDE(dooyong_state,lastday) |
| 998 | MCFG_MACHINE_START_OVERRIDE(dooyong_z80_state, cpu_z80) |
| 999 | 999 | |
| 1000 | 1000 | /* video hardware */ |
| 1001 | 1001 | MCFG_BUFFERED_SPRITERAM8_ADD("spriteram") |
| r241918 | r241919 | |
| 1005 | 1005 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 1006 | 1006 | MCFG_SCREEN_SIZE(64*8, 32*8) |
| 1007 | 1007 | MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 ) |
| 1008 | | MCFG_SCREEN_UPDATE_DRIVER(dooyong_state, screen_update_flytiger) |
| 1008 | MCFG_SCREEN_UPDATE_DRIVER(dooyong_z80_state, screen_update_flytiger) |
| 1009 | 1009 | MCFG_SCREEN_VBLANK_DEVICE("spriteram", buffered_spriteram8_device, vblank_copy_rising) |
| 1010 | 1010 | MCFG_SCREEN_PALETTE("palette") |
| 1011 | 1011 | |
| r241918 | r241919 | |
| 1013 | 1013 | MCFG_PALETTE_ADD("palette", 1024) |
| 1014 | 1014 | MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) |
| 1015 | 1015 | |
| 1016 | | MCFG_VIDEO_START_OVERRIDE(dooyong_state,flytiger) |
| 1016 | MCFG_VIDEO_START_OVERRIDE(dooyong_z80_state, flytiger) |
| 1017 | 1017 | |
| 1018 | 1018 | /* sound hardware */ |
| 1019 | 1019 | MCFG_FRAGMENT_ADD( sound_2151 ) |
| 1020 | 1020 | MACHINE_CONFIG_END |
| 1021 | 1021 | |
| 1022 | | static MACHINE_CONFIG_START( primella, dooyong_state ) |
| 1022 | static MACHINE_CONFIG_START( primella, dooyong_z80_state ) |
| 1023 | 1023 | |
| 1024 | 1024 | /* basic machine hardware */ |
| 1025 | 1025 | MCFG_CPU_ADD("maincpu", Z80, 8000000) /* ??? */ |
| r241918 | r241919 | |
| 1029 | 1029 | MCFG_CPU_ADD("audiocpu", Z80, 4000000) /* ??? */ |
| 1030 | 1030 | MCFG_CPU_PROGRAM_MAP(bluehawk_sound_map) |
| 1031 | 1031 | |
| 1032 | | MCFG_MACHINE_START_OVERRIDE(dooyong_state,lastday) |
| 1032 | MCFG_MACHINE_START_OVERRIDE(dooyong_z80_state, cpu_z80) |
| 1033 | 1033 | |
| 1034 | 1034 | /* video hardware */ |
| 1035 | 1035 | MCFG_SCREEN_ADD("screen", RASTER) |
| r241918 | r241919 | |
| 1037 | 1037 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 1038 | 1038 | MCFG_SCREEN_SIZE(64*8, 32*8) |
| 1039 | 1039 | MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 0*8, 32*8-1 ) |
| 1040 | | MCFG_SCREEN_UPDATE_DRIVER(dooyong_state, screen_update_primella) |
| 1040 | MCFG_SCREEN_UPDATE_DRIVER(dooyong_z80_state, screen_update_primella) |
| 1041 | 1041 | MCFG_SCREEN_PALETTE("palette") |
| 1042 | 1042 | |
| 1043 | 1043 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", primella) |
| 1044 | 1044 | MCFG_PALETTE_ADD("palette", 1024) |
| 1045 | 1045 | MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) |
| 1046 | 1046 | |
| 1047 | | MCFG_VIDEO_START_OVERRIDE(dooyong_state,primella) |
| 1047 | MCFG_VIDEO_START_OVERRIDE(dooyong_z80_state, primella) |
| 1048 | 1048 | |
| 1049 | 1049 | /* sound hardware */ |
| 1050 | 1050 | MCFG_FRAGMENT_ADD( sound_2151 ) |
| 1051 | 1051 | MACHINE_CONFIG_END |
| 1052 | 1052 | |
| 1053 | | TIMER_DEVICE_CALLBACK_MEMBER(dooyong_state::rshark_scanline) |
| 1053 | |
| 1054 | TIMER_DEVICE_CALLBACK_MEMBER(dooyong_68k_state::scanline) |
| 1054 | 1055 | { |
| 1055 | 1056 | int scanline = param; |
| 1056 | 1057 | |
| 1057 | | if(scanline == 248) // vblank-out irq |
| 1058 | if (scanline == 248) // vblank-out irq |
| 1058 | 1059 | m_maincpu->set_input_line(5, HOLD_LINE); |
| 1059 | 1060 | |
| 1060 | | if(scanline == 120) // timer irq? |
| 1061 | if (scanline == 120) // timer irq? |
| 1061 | 1062 | m_maincpu->set_input_line(6, HOLD_LINE); |
| 1062 | 1063 | } |
| 1063 | 1064 | |
| 1064 | 1065 | |
| 1065 | | static MACHINE_CONFIG_START( rshark, dooyong_state ) |
| 1066 | static MACHINE_CONFIG_START( rshark, dooyong_68k_state ) |
| 1066 | 1067 | |
| 1067 | 1068 | /* basic machine hardware */ |
| 1068 | 1069 | MCFG_CPU_ADD("maincpu", M68000, 8000000) /* measured on super-x */ |
| 1069 | 1070 | MCFG_CPU_PROGRAM_MAP(rshark_map) |
| 1070 | | MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", dooyong_state, rshark_scanline, "screen", 0, 1) |
| 1071 | MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", dooyong_68k_state, scanline, "screen", 0, 1) |
| 1071 | 1072 | |
| 1072 | 1073 | MCFG_CPU_ADD("audiocpu", Z80, 4000000) /* measured on super-x */ |
| 1073 | 1074 | MCFG_CPU_PROGRAM_MAP(bluehawk_sound_map) |
| 1074 | 1075 | |
| 1075 | 1076 | /* video hardware */ |
| 1076 | | MCFG_BUFFERED_SPRITERAM16_ADD("spriteram16") |
| 1077 | MCFG_BUFFERED_SPRITERAM16_ADD("spriteram") |
| 1077 | 1078 | |
| 1078 | 1079 | MCFG_SCREEN_ADD("screen", RASTER) |
| 1079 | 1080 | MCFG_SCREEN_REFRESH_RATE(60) |
| 1080 | 1081 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 1081 | 1082 | MCFG_SCREEN_SIZE(64*8, 32*8) |
| 1082 | 1083 | MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 ) |
| 1083 | | MCFG_SCREEN_UPDATE_DRIVER(dooyong_state, screen_update_rshark) |
| 1084 | | MCFG_SCREEN_VBLANK_DEVICE("spriteram16", buffered_spriteram16_device, vblank_copy_rising) |
| 1084 | MCFG_SCREEN_UPDATE_DRIVER(dooyong_68k_state, screen_update_rshark) |
| 1085 | MCFG_SCREEN_VBLANK_DEVICE("spriteram", buffered_spriteram16_device, vblank_copy_rising) |
| 1085 | 1086 | MCFG_SCREEN_PALETTE("palette") |
| 1086 | 1087 | |
| 1087 | 1088 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", rshark) |
| 1088 | 1089 | MCFG_PALETTE_ADD("palette", 2048) |
| 1089 | 1090 | MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) |
| 1090 | 1091 | |
| 1091 | | MCFG_VIDEO_START_OVERRIDE(dooyong_state,rshark) |
| 1092 | MCFG_VIDEO_START_OVERRIDE(dooyong_68k_state, rshark) |
| 1092 | 1093 | |
| 1093 | 1094 | /* sound hardware */ |
| 1094 | 1095 | MCFG_FRAGMENT_ADD( sound_2151_m68k ) |
| 1095 | 1096 | MACHINE_CONFIG_END |
| 1096 | 1097 | |
| 1097 | | static MACHINE_CONFIG_START( superx, dooyong_state ) // dif mem map |
| 1098 | static MACHINE_CONFIG_START( superx, dooyong_68k_state ) // dif mem map |
| 1098 | 1099 | |
| 1099 | 1100 | /* basic machine hardware */ |
| 1100 | 1101 | MCFG_CPU_ADD("maincpu", M68000, 8000000) /* measured on super-x */ |
| 1101 | 1102 | MCFG_CPU_PROGRAM_MAP(superx_map) |
| 1102 | | MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", dooyong_state, rshark_scanline, "screen", 0, 1) |
| 1103 | MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", dooyong_68k_state, scanline, "screen", 0, 1) |
| 1103 | 1104 | |
| 1104 | 1105 | MCFG_CPU_ADD("audiocpu", Z80, 4000000) /* measured on super-x */ |
| 1105 | 1106 | MCFG_CPU_PROGRAM_MAP(bluehawk_sound_map) |
| 1106 | 1107 | |
| 1107 | 1108 | /* video hardware */ |
| 1108 | | MCFG_BUFFERED_SPRITERAM16_ADD("spriteram16") |
| 1109 | MCFG_BUFFERED_SPRITERAM16_ADD("spriteram") |
| 1109 | 1110 | |
| 1110 | 1111 | MCFG_SCREEN_ADD("screen", RASTER) |
| 1111 | 1112 | MCFG_SCREEN_REFRESH_RATE(60) |
| 1112 | 1113 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 1113 | 1114 | MCFG_SCREEN_SIZE(64*8, 32*8) |
| 1114 | 1115 | MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 ) |
| 1115 | | MCFG_SCREEN_UPDATE_DRIVER(dooyong_state, screen_update_rshark) |
| 1116 | | MCFG_SCREEN_VBLANK_DEVICE("spriteram16", buffered_spriteram16_device, vblank_copy_rising) |
| 1116 | MCFG_SCREEN_UPDATE_DRIVER(dooyong_68k_state, screen_update_rshark) |
| 1117 | MCFG_SCREEN_VBLANK_DEVICE("spriteram", buffered_spriteram16_device, vblank_copy_rising) |
| 1117 | 1118 | MCFG_SCREEN_PALETTE("palette") |
| 1118 | 1119 | |
| 1119 | 1120 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", rshark) |
| 1120 | 1121 | MCFG_PALETTE_ADD("palette", 2048) |
| 1121 | 1122 | MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) |
| 1122 | 1123 | |
| 1123 | | MCFG_VIDEO_START_OVERRIDE(dooyong_state,rshark) |
| 1124 | MCFG_VIDEO_START_OVERRIDE(dooyong_68k_state, rshark) |
| 1124 | 1125 | |
| 1125 | 1126 | /* sound hardware */ |
| 1126 | 1127 | MCFG_FRAGMENT_ADD( sound_2151_m68k ) |
| 1127 | 1128 | MACHINE_CONFIG_END |
| 1128 | 1129 | |
| 1129 | | static MACHINE_CONFIG_START( popbingo, dooyong_state ) |
| 1130 | static MACHINE_CONFIG_START( popbingo, dooyong_68k_state ) |
| 1130 | 1131 | |
| 1131 | 1132 | /* basic machine hardware */ |
| 1132 | 1133 | MCFG_CPU_ADD("maincpu", M68000, 10000000) |
| 1133 | 1134 | MCFG_CPU_PROGRAM_MAP(popbingo_map) |
| 1134 | | MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", dooyong_state, rshark_scanline, "screen", 0, 1) |
| 1135 | MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", dooyong_68k_state, scanline, "screen", 0, 1) |
| 1135 | 1136 | |
| 1136 | 1137 | MCFG_CPU_ADD("audiocpu", Z80, 4000000) /* measured on super-x */ |
| 1137 | 1138 | MCFG_CPU_PROGRAM_MAP(bluehawk_sound_map) |
| 1138 | 1139 | |
| 1139 | 1140 | /* video hardware */ |
| 1140 | | MCFG_BUFFERED_SPRITERAM16_ADD("spriteram16") |
| 1141 | MCFG_BUFFERED_SPRITERAM16_ADD("spriteram") |
| 1141 | 1142 | |
| 1142 | 1143 | MCFG_SCREEN_ADD("screen", RASTER) |
| 1143 | 1144 | MCFG_SCREEN_REFRESH_RATE(60) |
| 1144 | 1145 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 1145 | 1146 | MCFG_SCREEN_SIZE(64*8, 32*8) |
| 1146 | 1147 | MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 ) |
| 1147 | | MCFG_SCREEN_UPDATE_DRIVER(dooyong_state, screen_update_popbingo) |
| 1148 | | MCFG_SCREEN_VBLANK_DEVICE("spriteram16", buffered_spriteram16_device, vblank_copy_rising) |
| 1148 | MCFG_SCREEN_UPDATE_DRIVER(dooyong_68k_state, screen_update_popbingo) |
| 1149 | MCFG_SCREEN_VBLANK_DEVICE("spriteram", buffered_spriteram16_device, vblank_copy_rising) |
| 1149 | 1150 | MCFG_SCREEN_PALETTE("palette") |
| 1150 | 1151 | |
| 1151 | 1152 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", popbingo) |
| 1152 | 1153 | MCFG_PALETTE_ADD("palette", 2048) |
| 1153 | 1154 | MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) |
| 1154 | 1155 | |
| 1155 | | MCFG_VIDEO_START_OVERRIDE(dooyong_state,popbingo) |
| 1156 | MCFG_VIDEO_START_OVERRIDE(dooyong_68k_state, popbingo) |
| 1156 | 1157 | |
| 1157 | 1158 | /* sound hardware */ |
| 1158 | 1159 | MCFG_FRAGMENT_ADD( sound_2151_m68k ) |
trunk/src/mame/includes/dooyong.h
| r241918 | r241919 | |
| 5 | 5 | public: |
| 6 | 6 | dooyong_state(const machine_config &mconfig, device_type type, const char *tag) |
| 7 | 7 | : driver_device(mconfig, type, tag), |
| 8 | | m_spriteram(*this, "spriteram"), |
| 9 | | m_spriteram16(*this, "spriteram16") , |
| 10 | | m_txvideoram(*this, "txvideoram"), |
| 11 | | m_paletteram_flytiger(*this, "flytiger_palram"), |
| 12 | 8 | m_maincpu(*this, "maincpu"), |
| 13 | 9 | m_audiocpu(*this, "audiocpu"), |
| 14 | 10 | m_gfxdecode(*this, "gfxdecode"), |
| 15 | | m_palette(*this, "palette") { } |
| 11 | m_palette(*this, "palette") |
| 12 | { } |
| 16 | 13 | |
| 17 | | optional_device<buffered_spriteram8_device> m_spriteram; |
| 18 | | optional_device<buffered_spriteram16_device> m_spriteram16; |
| 19 | | optional_shared_ptr<UINT8> m_txvideoram; |
| 20 | | optional_shared_ptr<UINT8> m_paletteram_flytiger; |
| 21 | | UINT8 m_sprites_disabled; |
| 22 | | UINT8 m_flytiger_palette_bank; |
| 23 | | UINT8 m_flytiger_pri; |
| 24 | | UINT8 m_tx_pri; |
| 25 | | UINT16 m_rshark_pri; |
| 14 | DECLARE_WRITE8_MEMBER(bgscroll_w); |
| 15 | DECLARE_WRITE8_MEMBER(bg2scroll_w); |
| 16 | DECLARE_WRITE8_MEMBER(fgscroll_w); |
| 17 | DECLARE_WRITE8_MEMBER(fg2scroll_w); |
| 18 | TILE_GET_INFO_MEMBER(get_bg_tile_info); |
| 19 | TILE_GET_INFO_MEMBER(get_bg2_tile_info); |
| 20 | TILE_GET_INFO_MEMBER(get_fg_tile_info); |
| 21 | TILE_GET_INFO_MEMBER(get_fg2_tile_info); |
| 22 | inline void get_tile_info(tile_data &tileinfo, int tile_index, UINT8 const *tilerom, UINT8 const *scroll, int graphics); |
| 23 | inline void scroll8_w(offs_t offset, UINT8 data, UINT8 *scroll, tilemap_t *map); |
| 24 | |
| 26 | 25 | tilemap_t *m_bg_tilemap; |
| 27 | 26 | tilemap_t *m_bg2_tilemap; |
| 28 | 27 | tilemap_t *m_fg_tilemap; |
| r241918 | r241919 | |
| 36 | 35 | UINT8 *m_bg2_tilerom; |
| 37 | 36 | UINT8 *m_fg_tilerom; |
| 38 | 37 | UINT8 *m_fg2_tilerom; |
| 39 | | UINT8 *m_bg_tilerom2; |
| 40 | | UINT8 *m_bg2_tilerom2; |
| 41 | | UINT8 *m_fg_tilerom2; |
| 42 | | UINT8 *m_fg2_tilerom2; |
| 43 | 38 | int m_bg_gfx; |
| 44 | 39 | int m_bg2_gfx; |
| 45 | 40 | int m_fg_gfx; |
| 46 | 41 | int m_fg2_gfx; |
| 47 | | int m_tx_tilemap_mode; |
| 48 | 42 | |
| 49 | | int m_interrupt_line_1; |
| 50 | | int m_interrupt_line_2; |
| 43 | required_device<cpu_device> m_maincpu; |
| 44 | required_device<cpu_device> m_audiocpu; |
| 45 | required_device<gfxdecode_device> m_gfxdecode; |
| 46 | required_device<palette_device> m_palette; |
| 47 | }; |
| 51 | 48 | |
| 52 | | DECLARE_WRITE8_MEMBER(lastday_bankswitch_w); |
| 49 | class dooyong_z80_state : public dooyong_state |
| 50 | { |
| 51 | public: |
| 52 | dooyong_z80_state(const machine_config &mconfig, device_type type, const char *tag) |
| 53 | : dooyong_state(mconfig, type, tag), |
| 54 | m_txvideoram(*this, "txvideoram"), |
| 55 | m_paletteram_flytiger(*this, "flytiger_palram"), |
| 56 | m_spriteram(*this, "spriteram") |
| 57 | { } |
| 58 | |
| 59 | enum |
| 60 | { |
| 61 | SPRITE_12BIT = 0x01, |
| 62 | SPRITE_HEIGHT = 0x02, |
| 63 | SPRITE_YSHIFT_BLUEHAWK = 0x04, |
| 64 | SPRITE_YSHIFT_FLYTIGER = 0x08 |
| 65 | }; |
| 66 | |
| 53 | 67 | DECLARE_WRITE8_MEMBER(flip_screen_w); |
| 54 | | DECLARE_WRITE8_MEMBER(dooyong_bgscroll8_w); |
| 55 | | DECLARE_WRITE8_MEMBER(dooyong_bg2scroll8_w); |
| 56 | | DECLARE_WRITE8_MEMBER(dooyong_fgscroll8_w); |
| 57 | | DECLARE_WRITE8_MEMBER(dooyong_fg2scroll8_w); |
| 58 | | DECLARE_WRITE16_MEMBER(dooyong_bgscroll16_w); |
| 59 | | DECLARE_WRITE16_MEMBER(dooyong_bg2scroll16_w); |
| 60 | | DECLARE_WRITE16_MEMBER(dooyong_fgscroll16_w); |
| 61 | | DECLARE_WRITE16_MEMBER(dooyong_fg2scroll16_w); |
| 62 | | DECLARE_WRITE8_MEMBER(dooyong_txvideoram8_w); |
| 63 | | DECLARE_WRITE8_MEMBER(lastday_ctrl_w); |
| 64 | | DECLARE_WRITE8_MEMBER(pollux_ctrl_w); |
| 68 | DECLARE_WRITE8_MEMBER(bankswitch_w); |
| 69 | DECLARE_WRITE8_MEMBER(txvideoram_w); |
| 65 | 70 | DECLARE_WRITE8_MEMBER(primella_ctrl_w); |
| 66 | 71 | DECLARE_WRITE8_MEMBER(paletteram_flytiger_w); |
| 67 | 72 | DECLARE_WRITE8_MEMBER(flytiger_ctrl_w); |
| 68 | | DECLARE_WRITE16_MEMBER(rshark_ctrl_w); |
| 69 | | DECLARE_READ8_MEMBER(unk_r); |
| 70 | | TILE_GET_INFO_MEMBER(get_bg_tile_info); |
| 71 | | TILE_GET_INFO_MEMBER(get_bg2_tile_info); |
| 72 | | TILE_GET_INFO_MEMBER(get_fg_tile_info); |
| 73 | | TILE_GET_INFO_MEMBER(get_fg2_tile_info); |
| 74 | | TILE_GET_INFO_MEMBER(flytiger_get_fg_tile_info); |
| 75 | 73 | TILE_GET_INFO_MEMBER(get_tx_tile_info); |
| 76 | | inline void lastday_get_tile_info(tile_data &tileinfo, int tile_index, const UINT8 *tilerom, UINT8 *scroll, int graphics); |
| 77 | | inline void rshark_get_tile_info(tile_data &tileinfo, int tile_index, const UINT8 *tilerom1, const UINT8 *tilerom2, UINT8 *scroll, int graphics); |
| 78 | | DECLARE_MACHINE_START(lastday); |
| 79 | | DECLARE_MACHINE_RESET(sound_ym2203); |
| 80 | | DECLARE_VIDEO_START(lastday); |
| 81 | | DECLARE_VIDEO_START(gulfstrm); |
| 82 | | DECLARE_VIDEO_START(pollux); |
| 74 | void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, unsigned extensions = 0); |
| 75 | UINT32 screen_update_bluehawk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 76 | UINT32 screen_update_flytiger(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 77 | UINT32 screen_update_primella(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 78 | DECLARE_MACHINE_START(cpu_z80); |
| 83 | 79 | DECLARE_VIDEO_START(bluehawk); |
| 84 | 80 | DECLARE_VIDEO_START(flytiger); |
| 85 | 81 | DECLARE_VIDEO_START(primella); |
| 86 | | DECLARE_VIDEO_START(rshark); |
| 87 | | DECLARE_VIDEO_START(popbingo); |
| 82 | |
| 83 | required_shared_ptr<UINT8> m_txvideoram; |
| 84 | optional_shared_ptr<UINT8> m_paletteram_flytiger; |
| 85 | UINT8 m_sprites_disabled; |
| 86 | UINT8 m_flytiger_palette_bank; |
| 87 | UINT8 m_flytiger_pri; |
| 88 | UINT8 m_tx_pri; |
| 89 | int m_tx_tilemap_mode; |
| 90 | |
| 91 | optional_device<buffered_spriteram8_device> m_spriteram; |
| 92 | }; |
| 93 | |
| 94 | class dooyong_z80_ym2203_state : public dooyong_z80_state |
| 95 | { |
| 96 | public: |
| 97 | dooyong_z80_ym2203_state(const machine_config &mconfig, device_type type, const char *tag) |
| 98 | : dooyong_z80_state(mconfig, type, tag) |
| 99 | { } |
| 100 | |
| 101 | DECLARE_WRITE8_MEMBER(lastday_ctrl_w); |
| 102 | DECLARE_WRITE8_MEMBER(pollux_ctrl_w); |
| 103 | DECLARE_WRITE_LINE_MEMBER(irqhandler_2203_1); |
| 104 | DECLARE_WRITE_LINE_MEMBER(irqhandler_2203_2); |
| 105 | DECLARE_READ8_MEMBER(unk_r); |
| 106 | DECLARE_MACHINE_RESET(sound_ym2203); |
| 88 | 107 | UINT32 screen_update_lastday(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 89 | 108 | UINT32 screen_update_gulfstrm(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 90 | 109 | UINT32 screen_update_pollux(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 91 | | UINT32 screen_update_bluehawk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 92 | | UINT32 screen_update_flytiger(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 93 | | UINT32 screen_update_primella(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 110 | DECLARE_VIDEO_START(lastday); |
| 111 | DECLARE_VIDEO_START(gulfstrm); |
| 112 | DECLARE_VIDEO_START(pollux); |
| 113 | |
| 114 | int m_interrupt_line_1; |
| 115 | int m_interrupt_line_2; |
| 116 | }; |
| 117 | |
| 118 | class dooyong_68k_state : public dooyong_state |
| 119 | { |
| 120 | public: |
| 121 | dooyong_68k_state(const machine_config &mconfig, device_type type, const char *tag) |
| 122 | : dooyong_state(mconfig, type, tag), |
| 123 | m_spriteram(*this, "spriteram") |
| 124 | { } |
| 125 | |
| 126 | DECLARE_WRITE16_MEMBER(ctrl_w); |
| 127 | TIMER_DEVICE_CALLBACK_MEMBER(scanline); |
| 128 | TILE_GET_INFO_MEMBER(rshark_get_bg_tile_info); |
| 129 | TILE_GET_INFO_MEMBER(rshark_get_bg2_tile_info); |
| 130 | TILE_GET_INFO_MEMBER(rshark_get_fg_tile_info); |
| 131 | TILE_GET_INFO_MEMBER(rshark_get_fg2_tile_info); |
| 132 | inline void rshark_get_tile_info(tile_data &tileinfo, int tile_index, UINT8 const *tilerom1, UINT8 const *tilerom2, UINT8 const *scroll, int graphics); |
| 133 | void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 94 | 134 | UINT32 screen_update_rshark(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 95 | 135 | UINT32 screen_update_popbingo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 96 | | TIMER_DEVICE_CALLBACK_MEMBER(rshark_scanline); |
| 97 | | inline void dooyong_scroll8_w(offs_t offset, UINT8 data, UINT8 *scroll, tilemap_t *map); |
| 98 | | void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pollux_extensions); |
| 99 | | void rshark_draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 100 | | DECLARE_WRITE_LINE_MEMBER(irqhandler_2203_1); |
| 101 | | DECLARE_WRITE_LINE_MEMBER(irqhandler_2203_2); |
| 102 | | required_device<cpu_device> m_maincpu; |
| 103 | | required_device<cpu_device> m_audiocpu; |
| 104 | | required_device<gfxdecode_device> m_gfxdecode; |
| 105 | | required_device<palette_device> m_palette; |
| 136 | DECLARE_VIDEO_START(rshark); |
| 137 | DECLARE_VIDEO_START(popbingo); |
| 138 | |
| 139 | UINT8 *m_bg_tilerom2; |
| 140 | UINT8 *m_bg2_tilerom2; |
| 141 | UINT8 *m_fg_tilerom2; |
| 142 | UINT8 *m_fg2_tilerom2; |
| 143 | UINT16 m_bg2_priority; |
| 144 | |
| 145 | required_device<buffered_spriteram16_device> m_spriteram; |
| 106 | 146 | }; |
trunk/src/mame/video/dooyong.c
| r241918 | r241919 | |
| 2 | 2 | #include "includes/dooyong.h" |
| 3 | 3 | |
| 4 | 4 | |
| 5 | | inline void dooyong_state::dooyong_scroll8_w(offs_t offset, UINT8 data, UINT8 *scroll, tilemap_t *map) |
| 5 | inline void dooyong_state::scroll8_w(offs_t offset, UINT8 data, UINT8 *scroll, tilemap_t *map) |
| 6 | 6 | { |
| 7 | 7 | UINT8 old = scroll[offset]; |
| 8 | 8 | if (old != data) |
| r241918 | r241919 | |
| 18 | 18 | break; |
| 19 | 19 | case 3: /* Low byte of y scroll */ |
| 20 | 20 | case 4: /* High byte of y scroll */ |
| 21 | | map->set_scrolly(0, (int)scroll[3] | ((int)scroll[4] << 8)); |
| 21 | map->set_scrolly(0, (unsigned)scroll[3] | ((unsigned)scroll[4] << 8)); |
| 22 | 22 | break; |
| 23 | 23 | case 6: /* Tilemap enable and mode control */ |
| 24 | 24 | map->enable(!(data & 0x10)); |
| r241918 | r241919 | |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | |
| 46 | | /* These handle writes to the tilemap scroll registers in 8-bit machines. |
| 46 | /* These handle writes to the tilemap scroll registers. |
| 47 | 47 | There is one per tilemap, wrapping the above function that does the work. */ |
| 48 | 48 | |
| 49 | | WRITE8_MEMBER(dooyong_state::dooyong_bgscroll8_w) |
| 49 | WRITE8_MEMBER(dooyong_state::bgscroll_w) |
| 50 | 50 | { |
| 51 | | dooyong_scroll8_w(offset, data, m_bgscroll8, m_bg_tilemap); |
| 51 | scroll8_w(offset, data, m_bgscroll8, m_bg_tilemap); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | | WRITE8_MEMBER(dooyong_state::dooyong_bg2scroll8_w) |
| 54 | WRITE8_MEMBER(dooyong_state::bg2scroll_w) |
| 55 | 55 | { |
| 56 | | dooyong_scroll8_w(offset, data, m_bg2scroll8, m_bg2_tilemap); |
| 56 | scroll8_w(offset, data, m_bg2scroll8, m_bg2_tilemap); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | | WRITE8_MEMBER(dooyong_state::dooyong_fgscroll8_w) |
| 59 | WRITE8_MEMBER(dooyong_state::fgscroll_w) |
| 60 | 60 | { |
| 61 | | dooyong_scroll8_w(offset, data, m_fgscroll8, m_fg_tilemap); |
| 61 | scroll8_w(offset, data, m_fgscroll8, m_fg_tilemap); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | | WRITE8_MEMBER(dooyong_state::dooyong_fg2scroll8_w) |
| 64 | WRITE8_MEMBER(dooyong_state::fg2scroll_w) |
| 65 | 65 | { |
| 66 | | dooyong_scroll8_w(offset, data, m_fg2scroll8, m_fg2_tilemap); |
| 66 | scroll8_w(offset, data, m_fg2scroll8, m_fg2_tilemap); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | |
| 70 | | /* These handle writes to the tilemap scroll registers in 16-bit machines. |
| 71 | | This is just an 8-bit peripheral in a 16-bit machine. */ |
| 72 | | |
| 73 | | WRITE16_MEMBER(dooyong_state::dooyong_bgscroll16_w) |
| 70 | WRITE8_MEMBER(dooyong_z80_state::txvideoram_w) |
| 74 | 71 | { |
| 75 | | if (ACCESSING_BITS_0_7) dooyong_bgscroll8_w(space, offset, data & 0x00ff); |
| 76 | | } |
| 77 | | |
| 78 | | WRITE16_MEMBER(dooyong_state::dooyong_bg2scroll16_w) |
| 79 | | { |
| 80 | | if (ACCESSING_BITS_0_7) dooyong_bg2scroll8_w(space, offset, data & 0x00ff); |
| 81 | | } |
| 82 | | |
| 83 | | WRITE16_MEMBER(dooyong_state::dooyong_fgscroll16_w) |
| 84 | | { |
| 85 | | if (ACCESSING_BITS_0_7) dooyong_fgscroll8_w(space, offset, data & 0x00ff); |
| 86 | | } |
| 87 | | |
| 88 | | WRITE16_MEMBER(dooyong_state::dooyong_fg2scroll16_w) |
| 89 | | { |
| 90 | | if (ACCESSING_BITS_0_7) dooyong_fg2scroll8_w(space, offset, data & 0x00ff); |
| 91 | | } |
| 92 | | |
| 93 | | |
| 94 | | WRITE8_MEMBER(dooyong_state::dooyong_txvideoram8_w) |
| 95 | | { |
| 96 | 72 | if (m_txvideoram[offset] != data) |
| 97 | 73 | { |
| 98 | 74 | m_txvideoram[offset] = data; |
| r241918 | r241919 | |
| 106 | 82 | |
| 107 | 83 | /* Control registers seem to be different on every game */ |
| 108 | 84 | |
| 109 | | WRITE8_MEMBER(dooyong_state::lastday_ctrl_w) |
| 85 | WRITE8_MEMBER(dooyong_z80_ym2203_state::lastday_ctrl_w) |
| 110 | 86 | { |
| 111 | 87 | /* bits 0 and 1 are coin counters */ |
| 112 | 88 | coin_counter_w(machine(), 0, data & 0x01); |
| r241918 | r241919 | |
| 121 | 97 | flip_screen_set(data & 0x40); |
| 122 | 98 | } |
| 123 | 99 | |
| 124 | | WRITE8_MEMBER(dooyong_state::pollux_ctrl_w) |
| 100 | WRITE8_MEMBER(dooyong_z80_ym2203_state::pollux_ctrl_w) |
| 125 | 101 | { |
| 126 | 102 | /* bit 0 is flip screen */ |
| 127 | 103 | flip_screen_set(data & 0x01); |
| r241918 | r241919 | |
| 136 | 112 | /* bit 4 is used but unknown */ |
| 137 | 113 | } |
| 138 | 114 | |
| 139 | | WRITE8_MEMBER(dooyong_state::primella_ctrl_w) |
| 115 | WRITE8_MEMBER(dooyong_z80_state::primella_ctrl_w) |
| 140 | 116 | { |
| 141 | 117 | /* bits 0-2 select ROM bank */ |
| 142 | 118 | membank("bank1")->set_entry(data & 0x07); |
| r241918 | r241919 | |
| 152 | 128 | // logerror("%04x: bankswitch = %02x\n",space.device().safe_pc(),data&0xe0); |
| 153 | 129 | } |
| 154 | 130 | |
| 155 | | WRITE8_MEMBER(dooyong_state::paletteram_flytiger_w) |
| 131 | WRITE8_MEMBER(dooyong_z80_state::paletteram_flytiger_w) |
| 156 | 132 | { |
| 157 | 133 | if (m_flytiger_palette_bank) |
| 158 | 134 | { |
| r241918 | r241919 | |
| 163 | 139 | } |
| 164 | 140 | } |
| 165 | 141 | |
| 166 | | WRITE8_MEMBER(dooyong_state::flytiger_ctrl_w) |
| 142 | WRITE8_MEMBER(dooyong_z80_state::flytiger_ctrl_w) |
| 167 | 143 | { |
| 168 | 144 | /* bit 0 is flip screen */ |
| 169 | 145 | flip_screen_set(data & 0x01); |
| r241918 | r241919 | |
| 177 | 153 | m_flytiger_pri = data & 0x10; |
| 178 | 154 | } |
| 179 | 155 | |
| 180 | | WRITE16_MEMBER(dooyong_state::rshark_ctrl_w) |
| 181 | 156 | |
| 182 | | { |
| 183 | | if (ACCESSING_BITS_0_7) |
| 184 | | { |
| 185 | | /* bit 0 flips screen */ |
| 186 | | flip_screen_set(data & 0x0001); |
| 187 | | |
| 188 | | /* bit 4 changes tilemaps priority */ |
| 189 | | m_rshark_pri = data & 0x0010; |
| 190 | | |
| 191 | | /* bit 5 used but unknown */ |
| 192 | | } |
| 193 | | } |
| 194 | | |
| 195 | | |
| 196 | 157 | /* These games all have ROM-based tilemaps for the backgrounds, title |
| 197 | 158 | screens and sometimes "bosses" and special attacks. There are three |
| 198 | 159 | schemes for tilemap encoding. The scheme is chosen based on the |
| r241918 | r241919 | |
| 203 | 164 | when the x scroll moves out of range (trying to decode the whole lot |
| 204 | 165 | at once uses hundreds of megabytes of RAM). */ |
| 205 | 166 | |
| 206 | | inline void dooyong_state::lastday_get_tile_info(tile_data &tileinfo, int tile_index, |
| 207 | | const UINT8 *tilerom, UINT8 *scroll, int graphics) |
| 167 | inline void dooyong_state::get_tile_info(tile_data &tileinfo, int tile_index, |
| 168 | UINT8 const *tilerom, UINT8 const *scroll, int graphics) |
| 208 | 169 | { |
| 209 | | int offs = (tile_index + ((int)scroll[1] << 6)) * 2; |
| 210 | | int attr = tilerom[offs]; |
| 170 | int const offs = (tile_index + ((int)scroll[1] << 6)) * 2; |
| 171 | int const attr = tilerom[offs]; |
| 211 | 172 | int code, color, flags; |
| 212 | 173 | if (scroll[6] & 0x20) |
| 213 | 174 | { /* lastday/gulfstrm/pollux/flytiger */ |
| r241918 | r241919 | |
| 221 | 182 | Y = y flip */ |
| 222 | 183 | code = tilerom[offs + 1] | ((attr & 0x01) << 8) | ((attr & 0x80) << 2); |
| 223 | 184 | color = (attr & 0x78) >> 3; |
| 224 | | flags = ((attr & 0x02) ? TILE_FLIPX : 0) | ((attr & 0x04) ? TILE_FLIPY : 0); |
| 185 | flags = TILE_FLIPYX((attr & 0x06) >> 1); |
| 225 | 186 | } |
| 226 | 187 | else |
| 227 | | { |
| 228 | | /* primella */ |
| 188 | { /* primella/popbingo */ |
| 229 | 189 | /* Tiles take two bytes in ROM: |
| 230 | 190 | MSB LSB |
| 231 | 191 | [offs + 0x00] YXCC CCcc (Y flip, X flip, bits 3-0 of color code, bits 9-8 of gfx code) |
| r241918 | r241919 | |
| 245 | 205 | |
| 246 | 206 | code = tilerom[offs + 1] | ((attr & codemask) << 8); |
| 247 | 207 | color = (attr & palmask) >> 2; |
| 248 | | flags = ((attr & 0x40) ? TILE_FLIPX : 0) | ((attr & 0x80) ? TILE_FLIPY : 0); |
| 208 | flags = TILE_FLIPYX((attr & 0xC0) >> 6); |
| 249 | 209 | } |
| 250 | 210 | |
| 251 | | SET_TILE_INFO_MEMBER(graphics, code, color, flags); |
| 211 | tileinfo.set(graphics, code, color, flags); |
| 252 | 212 | } |
| 253 | 213 | |
| 254 | | inline void dooyong_state::rshark_get_tile_info(tile_data &tileinfo, int tile_index, |
| 255 | | const UINT8 *tilerom1, const UINT8 *tilerom2, UINT8 *scroll, int graphics) |
| 256 | | { |
| 257 | | /* Tiles take two bytes in tile ROM 1: |
| 258 | | MSB LSB |
| 259 | | [offs + 0x00] YX?c cccc (Y flip, X flip, bits 12-8 of gfx code) |
| 260 | | [offs + 0x01] cccc cccc (bits 7-0 of gfx code) |
| 261 | | ? = unused/unknown |
| 262 | | c = gfx code |
| 263 | | X = x flip |
| 264 | | Y = y flip */ |
| 265 | | int offs = tile_index + ((int)scroll[1] << 9); |
| 266 | | int attr = tilerom1[offs * 2]; |
| 267 | | int code = tilerom1[(offs * 2) + 1] | ((attr & 0x1f) << 8); |
| 268 | | int color = tilerom2[offs] & 0x0f; |
| 269 | | int flags = ((attr & 0x40) ? TILE_FLIPX : 0) | ((attr & 0x80) ? TILE_FLIPY : 0); |
| 270 | | |
| 271 | | SET_TILE_INFO_MEMBER(graphics, code, color, flags); |
| 272 | | } |
| 273 | | |
| 274 | 214 | TILE_GET_INFO_MEMBER(dooyong_state::get_bg_tile_info) |
| 275 | 215 | { |
| 276 | | if (m_bg_tilerom2 != NULL) |
| 277 | | rshark_get_tile_info(tileinfo, tile_index, m_bg_tilerom, m_bg_tilerom2, m_bgscroll8, m_bg_gfx); |
| 278 | | else |
| 279 | | lastday_get_tile_info(tileinfo, tile_index, m_bg_tilerom, m_bgscroll8, m_bg_gfx); |
| 216 | get_tile_info(tileinfo, tile_index, m_bg_tilerom, m_bgscroll8, m_bg_gfx); |
| 280 | 217 | } |
| 281 | 218 | |
| 282 | 219 | TILE_GET_INFO_MEMBER(dooyong_state::get_bg2_tile_info) |
| 283 | 220 | { |
| 284 | | if (m_bg2_tilerom2 != NULL) |
| 285 | | rshark_get_tile_info(tileinfo, tile_index, m_bg2_tilerom, m_bg2_tilerom2, m_bg2scroll8, m_bg2_gfx); |
| 286 | | else |
| 287 | | lastday_get_tile_info(tileinfo, tile_index, m_bg2_tilerom, m_bg2scroll8, m_bg2_gfx); |
| 221 | get_tile_info(tileinfo, tile_index, m_bg2_tilerom, m_bg2scroll8, m_bg2_gfx); |
| 288 | 222 | } |
| 289 | 223 | |
| 290 | 224 | TILE_GET_INFO_MEMBER(dooyong_state::get_fg_tile_info) |
| 291 | 225 | { |
| 292 | | if (m_fg_tilerom2 != NULL) |
| 293 | | rshark_get_tile_info(tileinfo, tile_index, m_fg_tilerom, m_fg_tilerom2, m_fgscroll8, m_fg_gfx); |
| 294 | | else |
| 295 | | lastday_get_tile_info(tileinfo, tile_index, m_fg_tilerom, m_fgscroll8, m_fg_gfx); |
| 226 | get_tile_info(tileinfo, tile_index, m_fg_tilerom, m_fgscroll8, m_fg_gfx); |
| 296 | 227 | } |
| 297 | 228 | |
| 298 | 229 | TILE_GET_INFO_MEMBER(dooyong_state::get_fg2_tile_info) |
| 299 | 230 | { |
| 300 | | if (m_fg2_tilerom2 != NULL) |
| 301 | | rshark_get_tile_info(tileinfo, tile_index, m_fg2_tilerom, m_fg2_tilerom2, m_fg2scroll8, m_fg2_gfx); |
| 302 | | else |
| 303 | | lastday_get_tile_info(tileinfo, tile_index, m_fg2_tilerom, m_fg2scroll8, m_fg2_gfx); |
| 231 | get_tile_info(tileinfo, tile_index, m_fg2_tilerom, m_fg2scroll8, m_fg2_gfx); |
| 304 | 232 | } |
| 305 | 233 | |
| 306 | | /* flytiger uses some palette banking technique or something maybe a trash protection */ |
| 307 | | |
| 308 | | TILE_GET_INFO_MEMBER(dooyong_state::flytiger_get_fg_tile_info) |
| 234 | TILE_GET_INFO_MEMBER(dooyong_z80_state::get_tx_tile_info) |
| 309 | 235 | { |
| 310 | | const UINT8 *tilerom = m_fg_tilerom; |
| 311 | | |
| 312 | | int offs = (tile_index + (m_fgscroll8[1] << 6)) * 2; |
| 313 | | int attr = tilerom[offs]; |
| 314 | | int code = tilerom[offs + 1] | ((attr & 0x01) << 8) | ((attr & 0x80) << 2); |
| 315 | | int color = (attr & 0x78) >> 3; |
| 316 | | int flags = ((attr & 0x02) ? TILE_FLIPX : 0) | ((attr & 0x04) ? TILE_FLIPY : 0); |
| 317 | | |
| 318 | | SET_TILE_INFO_MEMBER(m_fg_gfx, code, color, flags); |
| 319 | | } |
| 320 | | |
| 321 | | TILE_GET_INFO_MEMBER(dooyong_state::get_tx_tile_info) |
| 322 | | { |
| 323 | 236 | /* Each tile takes two bytes of memory: |
| 324 | 237 | MSB LSB |
| 325 | 238 | [offs + 0x00] cccc cccc (bits 7-0 of gfx code) |
| 326 | 239 | [offs + 0x01] CCCC cccc (bits 3-0 of color code, bits 11-8 of gfx code) |
| 327 | 240 | c = gfx code |
| 328 | 241 | C = color code */ |
| 329 | | int offs, attr, code, color; |
| 242 | unsigned offs, attr; |
| 330 | 243 | if (m_tx_tilemap_mode == 0) |
| 331 | 244 | { /* lastday/gulfstrm/pollux/flytiger */ |
| 332 | 245 | offs = tile_index; |
| r241918 | r241919 | |
| 337 | 250 | offs = tile_index * 2; |
| 338 | 251 | attr = m_txvideoram[offs + 1]; |
| 339 | 252 | } |
| 340 | | code = m_txvideoram[offs] | ((attr & 0x0f) << 8); |
| 341 | | color = (attr & 0xf0) >> 4; |
| 253 | int const code = m_txvideoram[offs] | ((attr & 0x0f) << 8); |
| 254 | int const color = (attr & 0xf0) >> 4; |
| 342 | 255 | |
| 343 | | SET_TILE_INFO_MEMBER(0, code, color, 0); |
| 256 | tileinfo.set(0, code, color, 0); |
| 344 | 257 | } |
| 345 | 258 | |
| 346 | 259 | |
| 347 | | void dooyong_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pollux_extensions) |
| 260 | void dooyong_z80_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, unsigned extensions) |
| 348 | 261 | { |
| 349 | 262 | /* Sprites take 32 bytes each in memory: |
| 350 | 263 | MSB LSB |
| r241918 | r241919 | |
| 364 | 277 | w = width |
| 365 | 278 | X = x flip |
| 366 | 279 | Y = y flip |
| 367 | | * = alters y position in pollux and flytiger - see code below |
| 280 | * = alters y position in bluehawk and flytiger - see code below |
| 368 | 281 | bit 11 of gfx code only used by gulfstrm, pollux, bluehawk and flytiger |
| 369 | 282 | height only used by pollux, bluehawk and flytiger |
| 370 | 283 | x flip and y flip only used by pollux and flytiger */ |
| 371 | 284 | |
| 372 | | UINT8 *buffered_spriteram = m_spriteram->buffer(); |
| 373 | | int offs; |
| 374 | | |
| 375 | | for (offs = 0; offs < m_spriteram->bytes(); offs += 32) |
| 285 | UINT8 const *const buffered_spriteram = m_spriteram->buffer(); |
| 286 | for (int offs = 0; offs < m_spriteram->bytes(); offs += 32) |
| 376 | 287 | { |
| 377 | | int sx, sy, code, color, pri; |
| 378 | | int flipx = 0, flipy = 0, height = 0, y; |
| 379 | | |
| 380 | | sx = buffered_spriteram[offs+3] | ((buffered_spriteram[offs+1] & 0x10) << 4); |
| 381 | | sy = buffered_spriteram[offs+2]; |
| 382 | | code = buffered_spriteram[offs] | ((buffered_spriteram[offs+1] & 0xe0) << 3); |
| 383 | | color = buffered_spriteram[offs+1] & 0x0f; |
| 288 | int sx = buffered_spriteram[offs+3] | ((buffered_spriteram[offs+1] & 0x10) << 4); |
| 289 | int sy = buffered_spriteram[offs+2]; |
| 290 | int code = buffered_spriteram[offs] | ((buffered_spriteram[offs+1] & 0xe0) << 3); |
| 291 | int const color = buffered_spriteram[offs+1] & 0x0f; |
| 384 | 292 | //TODO: This priority mechanism works for known games, but seems a bit strange. |
| 385 | 293 | //Are we missing something? (The obvious spare palette bit isn't it.) |
| 386 | | pri = (((color == 0x00) || (color == 0x0f)) ? 0xfc : 0xf0); |
| 294 | int const pri = (((color == 0x00) || (color == 0x0f)) ? 0xfc : 0xf0); |
| 387 | 295 | |
| 388 | | if (pollux_extensions) |
| 296 | bool flipx = false, flipy = false; |
| 297 | int height = 0; |
| 298 | if (extensions) |
| 389 | 299 | { |
| 390 | | /* gulfstrm, pollux, bluehawk, flytiger */ |
| 391 | | code |= ((buffered_spriteram[offs+0x1c] & 0x01) << 11); |
| 300 | UINT8 const ext = buffered_spriteram[offs+0x1c]; |
| 392 | 301 | |
| 393 | | if (pollux_extensions >= 2) |
| 302 | if (extensions & SPRITE_12BIT) |
| 303 | code |= ((ext & 0x01) << 11); |
| 304 | |
| 305 | if (extensions & SPRITE_HEIGHT) |
| 394 | 306 | { |
| 395 | | /* pollux, bluehawk, flytiger */ |
| 396 | | height = (buffered_spriteram[offs+0x1c] & 0x70) >> 4; |
| 307 | height = (ext & 0x70) >> 4; |
| 397 | 308 | code &= ~height; |
| 398 | 309 | |
| 399 | | flipx = buffered_spriteram[offs+0x1c] & 0x08; |
| 400 | | flipy = buffered_spriteram[offs+0x1c] & 0x04; |
| 310 | flipx = ext & 0x08; |
| 311 | flipy = ext & 0x04; |
| 312 | } |
| 401 | 313 | |
| 402 | | if (pollux_extensions == 3) |
| 403 | | { |
| 404 | | /* bluehawk */ |
| 405 | | sy += 6 - ((~buffered_spriteram[offs+0x1c] & 0x02) << 7); |
| 406 | | } |
| 314 | if (extensions & SPRITE_YSHIFT_BLUEHAWK) |
| 315 | sy += 6 - ((~ext & 0x02) << 7); |
| 407 | 316 | |
| 408 | | if (pollux_extensions == 4) |
| 409 | | { |
| 410 | | /* flytiger */ |
| 411 | | sy -=(buffered_spriteram[offs+0x1c] & 0x02) << 7; |
| 412 | | } |
| 413 | | } |
| 317 | if (extensions & SPRITE_YSHIFT_FLYTIGER) |
| 318 | sy -=(ext & 0x02) << 7; |
| 414 | 319 | } |
| 415 | 320 | |
| 416 | 321 | if (flip_screen()) |
| r241918 | r241919 | |
| 421 | 326 | flipy = !flipy; |
| 422 | 327 | } |
| 423 | 328 | |
| 424 | | for (y = 0; y <= height; y++) |
| 329 | for (int y = 0; y <= height; y++) |
| 425 | 330 | { |
| 426 | 331 | m_gfxdecode->gfx(1)->prio_transpen(bitmap,cliprect, |
| 427 | 332 | code + y, |
| r241918 | r241919 | |
| 434 | 339 | } |
| 435 | 340 | } |
| 436 | 341 | |
| 437 | | void dooyong_state::rshark_draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 438 | | { |
| 439 | | UINT16 *buffered_spriteram16 = m_spriteram16->buffer(); |
| 440 | 342 | |
| 441 | | /* Sprites take 8 16-bit words each in memory: |
| 442 | | MSB LSB |
| 443 | | [offs + 0] ???? ???? ???? ???E |
| 444 | | [offs + 1] ???? ???? hhhh wwww |
| 445 | | [offs + 2] ???? ???? ???? ???? |
| 446 | | [offs + 3] cccc cccc cccc cccc |
| 447 | | [offs + 4] ???? ???x xxxx xxxx |
| 448 | | [offs + 5] ???? ???? ???? ???? |
| 449 | | [offs + 6] ???? ???y yyyy yyyy |
| 450 | | [offs + 7] ???? ???? ???? CCCC |
| 451 | | ? = unused/unknown |
| 452 | | E = enable |
| 453 | | c = gfx code |
| 454 | | x = x offset |
| 455 | | y = y offset (signed) |
| 456 | | C = color code |
| 457 | | w = width |
| 458 | | h = height */ |
| 459 | | |
| 460 | | int offs; |
| 461 | | |
| 462 | | for (offs = (m_spriteram16->bytes() / 2) - 8; offs >= 0; offs -= 8) |
| 463 | | { |
| 464 | | if (buffered_spriteram16[offs] & 0x0001) /* enable */ |
| 465 | | { |
| 466 | | int sx, sy, code, color, pri; |
| 467 | | int flipx = 0, flipy = 0, width, height, x, y; |
| 468 | | |
| 469 | | sx = buffered_spriteram16[offs+4] & 0x01ff; |
| 470 | | sy = (INT16)buffered_spriteram16[offs+6] & 0x01ff; |
| 471 | | if (sy & 0x0100) sy |= ~(int)0x01ff; // Correctly sign-extend 9-bit number |
| 472 | | code = buffered_spriteram16[offs+3]; |
| 473 | | color = buffered_spriteram16[offs+7] & 0x000f; |
| 474 | | //TODO: This priority mechanism works for known games, but seems a bit strange. |
| 475 | | //Are we missing something? (The obvious spare palette bit isn't it.) |
| 476 | | pri = (((color == 0x00) || (color == 0x0f)) ? 0xfc : 0xf0); |
| 477 | | width = buffered_spriteram16[offs+1] & 0x000f; |
| 478 | | height = (buffered_spriteram16[offs+1] & 0x00f0) >> 4; |
| 479 | | |
| 480 | | if (flip_screen()) |
| 481 | | { |
| 482 | | sx = 498 - (16 * width) - sx; |
| 483 | | sy = 240 - (16 * height) - sy; |
| 484 | | flipx = !flipx; |
| 485 | | flipy = !flipy; |
| 486 | | } |
| 487 | | |
| 488 | | for (y = 0; y <= height; y++) |
| 489 | | { |
| 490 | | int _y = sy + (16 * (flipy ? (height - y) : y)); |
| 491 | | for (x = 0; x <= width; x++) |
| 492 | | { |
| 493 | | int _x = sx + (16 * (flipx ? (width - x) : x)); |
| 494 | | m_gfxdecode->gfx(0)->prio_transpen(bitmap,cliprect, |
| 495 | | code, |
| 496 | | color, |
| 497 | | flipx, flipy, |
| 498 | | _x, _y, |
| 499 | | screen.priority(), |
| 500 | | pri, 15); |
| 501 | | code++; |
| 502 | | } |
| 503 | | } |
| 504 | | } |
| 505 | | } |
| 506 | | } |
| 507 | | |
| 508 | | |
| 509 | | UINT32 dooyong_state::screen_update_lastday(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 343 | UINT32 dooyong_z80_ym2203_state::screen_update_lastday(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 510 | 344 | { |
| 511 | 345 | bitmap.fill(m_palette->black_pen(), cliprect); |
| 512 | 346 | screen.priority().fill(0, cliprect); |
| r241918 | r241919 | |
| 516 | 350 | m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 4); |
| 517 | 351 | |
| 518 | 352 | if (!m_sprites_disabled) |
| 519 | | draw_sprites(screen, bitmap, cliprect, 0); |
| 353 | draw_sprites(screen, bitmap, cliprect); |
| 354 | |
| 520 | 355 | return 0; |
| 521 | 356 | } |
| 522 | 357 | |
| 523 | | UINT32 dooyong_state::screen_update_gulfstrm(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 358 | UINT32 dooyong_z80_ym2203_state::screen_update_gulfstrm(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 524 | 359 | { |
| 525 | 360 | bitmap.fill(m_palette->black_pen(), cliprect); |
| 526 | 361 | screen.priority().fill(0, cliprect); |
| r241918 | r241919 | |
| 529 | 364 | m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 2); |
| 530 | 365 | m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 4); |
| 531 | 366 | |
| 532 | | draw_sprites(screen, bitmap, cliprect, 1); |
| 367 | draw_sprites(screen, bitmap, cliprect, SPRITE_12BIT); |
| 368 | |
| 533 | 369 | return 0; |
| 534 | 370 | } |
| 535 | 371 | |
| 536 | | UINT32 dooyong_state::screen_update_pollux(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 372 | UINT32 dooyong_z80_ym2203_state::screen_update_pollux(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 537 | 373 | { |
| 538 | 374 | bitmap.fill(m_palette->black_pen(), cliprect); |
| 539 | 375 | screen.priority().fill(0, cliprect); |
| r241918 | r241919 | |
| 542 | 378 | m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 2); |
| 543 | 379 | m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 4); |
| 544 | 380 | |
| 545 | | draw_sprites(screen, bitmap, cliprect, 2); |
| 381 | draw_sprites(screen, bitmap, cliprect, SPRITE_12BIT | SPRITE_HEIGHT); |
| 382 | |
| 546 | 383 | return 0; |
| 547 | 384 | } |
| 548 | 385 | |
| 549 | | UINT32 dooyong_state::screen_update_flytiger(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 386 | UINT32 dooyong_z80_state::screen_update_flytiger(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 550 | 387 | { |
| 551 | 388 | bitmap.fill(m_palette->black_pen(), cliprect); |
| 552 | 389 | screen.priority().fill(0, cliprect); |
| r241918 | r241919 | |
| 563 | 400 | } |
| 564 | 401 | m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 4); |
| 565 | 402 | |
| 566 | | draw_sprites(screen, bitmap, cliprect, 4); |
| 403 | draw_sprites(screen, bitmap, cliprect, SPRITE_12BIT | SPRITE_HEIGHT | SPRITE_YSHIFT_FLYTIGER); |
| 404 | |
| 567 | 405 | return 0; |
| 568 | 406 | } |
| 569 | 407 | |
| 570 | 408 | |
| 571 | | UINT32 dooyong_state::screen_update_bluehawk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 409 | UINT32 dooyong_z80_state::screen_update_bluehawk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 572 | 410 | { |
| 573 | 411 | bitmap.fill(m_palette->black_pen(), cliprect); |
| 574 | 412 | screen.priority().fill(0, cliprect); |
| r241918 | r241919 | |
| 578 | 416 | m_fg2_tilemap->draw(screen, bitmap, cliprect, 0, 4); |
| 579 | 417 | m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 4); |
| 580 | 418 | |
| 581 | | draw_sprites(screen, bitmap, cliprect, 3); |
| 419 | draw_sprites(screen, bitmap, cliprect, SPRITE_12BIT | SPRITE_HEIGHT | SPRITE_YSHIFT_BLUEHAWK); |
| 420 | |
| 582 | 421 | return 0; |
| 583 | 422 | } |
| 584 | 423 | |
| 585 | | UINT32 dooyong_state::screen_update_primella(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 424 | UINT32 dooyong_z80_state::screen_update_primella(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 586 | 425 | { |
| 587 | 426 | bitmap.fill(m_palette->black_pen(), cliprect); |
| 588 | 427 | |
| r241918 | r241919 | |
| 590 | 429 | if (m_tx_pri) m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0); |
| 591 | 430 | m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); |
| 592 | 431 | if (!m_tx_pri) m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0); |
| 593 | | return 0; |
| 594 | | } |
| 595 | 432 | |
| 596 | | UINT32 dooyong_state::screen_update_rshark(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 597 | | { |
| 598 | | bitmap.fill(m_palette->black_pen(), cliprect); |
| 599 | | screen.priority().fill(0, cliprect); |
| 600 | | |
| 601 | | m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 1); |
| 602 | | m_bg2_tilemap->draw(screen, bitmap, cliprect, 0, (m_rshark_pri ? 2 : 1)); |
| 603 | | m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 2); |
| 604 | | m_fg2_tilemap->draw(screen, bitmap, cliprect, 0, 2); |
| 605 | | |
| 606 | | rshark_draw_sprites(screen, bitmap, cliprect); |
| 607 | 433 | return 0; |
| 608 | 434 | } |
| 609 | 435 | |
| 610 | | UINT32 dooyong_state::screen_update_popbingo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 436 | VIDEO_START_MEMBER(dooyong_z80_ym2203_state, lastday) |
| 611 | 437 | { |
| 612 | | bitmap.fill(m_palette->black_pen(), cliprect); |
| 613 | | screen.priority().fill(0, cliprect); |
| 614 | | |
| 615 | | m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 1); |
| 616 | | |
| 617 | | rshark_draw_sprites(screen, bitmap, cliprect); |
| 618 | | return 0; |
| 619 | | } |
| 620 | | |
| 621 | | |
| 622 | | VIDEO_START_MEMBER(dooyong_state,lastday) |
| 623 | | { |
| 624 | 438 | /* Configure tilemap callbacks */ |
| 625 | 439 | m_bg_tilerom = memregion("gfx5")->base(); |
| 626 | 440 | m_fg_tilerom = memregion("gfx6")->base(); |
| 627 | | m_bg_tilerom2 = NULL; |
| 628 | | m_fg_tilerom2 = NULL; |
| 629 | 441 | m_bg_gfx = 2; |
| 630 | 442 | m_fg_gfx = 3; |
| 631 | 443 | m_tx_tilemap_mode = 0; |
| r241918 | r241919 | |
| 635 | 447 | 32, 32, 32, 8); |
| 636 | 448 | m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS, |
| 637 | 449 | 32, 32, 32, 8); |
| 638 | | m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS, |
| 450 | m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS, |
| 639 | 451 | 8, 8, 64, 32); |
| 640 | 452 | |
| 641 | 453 | /* Configure tilemap transparency */ |
| r241918 | r241919 | |
| 658 | 470 | save_item(NAME(m_interrupt_line_2)); |
| 659 | 471 | } |
| 660 | 472 | |
| 661 | | VIDEO_START_MEMBER(dooyong_state,gulfstrm) |
| 473 | VIDEO_START_MEMBER(dooyong_z80_ym2203_state, gulfstrm) |
| 662 | 474 | { |
| 663 | 475 | /* Configure tilemap callbacks */ |
| 664 | 476 | m_bg_tilerom = memregion("gfx5")->base(); |
| 665 | 477 | m_fg_tilerom = memregion("gfx6")->base(); |
| 666 | | m_bg_tilerom2 = NULL; |
| 667 | | m_fg_tilerom2 = NULL; |
| 668 | 478 | m_bg_gfx = 2; |
| 669 | 479 | m_fg_gfx = 3; |
| 670 | 480 | m_tx_tilemap_mode = 0; |
| r241918 | r241919 | |
| 674 | 484 | 32, 32, 32, 8); |
| 675 | 485 | m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS, |
| 676 | 486 | 32, 32, 32, 8); |
| 677 | | m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS, |
| 487 | m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS, |
| 678 | 488 | 8, 8, 64, 32); |
| 679 | 489 | |
| 680 | 490 | /* Configure tilemap transparency */ |
| r241918 | r241919 | |
| 696 | 506 | save_item(NAME(m_interrupt_line_2)); |
| 697 | 507 | } |
| 698 | 508 | |
| 699 | | VIDEO_START_MEMBER(dooyong_state,pollux) |
| 509 | VIDEO_START_MEMBER(dooyong_z80_ym2203_state, pollux) |
| 700 | 510 | { |
| 701 | 511 | /* Configure tilemap callbacks */ |
| 702 | 512 | m_bg_tilerom = memregion("gfx5")->base(); |
| 703 | 513 | m_fg_tilerom = memregion("gfx6")->base(); |
| 704 | | m_bg_tilerom2 = NULL; |
| 705 | | m_fg_tilerom2 = NULL; |
| 706 | 514 | m_bg_gfx = 2; |
| 707 | 515 | m_fg_gfx = 3; |
| 708 | 516 | m_tx_tilemap_mode = 0; |
| r241918 | r241919 | |
| 712 | 520 | 32, 32, 32, 8); |
| 713 | 521 | m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS, |
| 714 | 522 | 32, 32, 32, 8); |
| 715 | | m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS, |
| 523 | m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS, |
| 716 | 524 | 8, 8, 64, 32); |
| 717 | 525 | |
| 718 | 526 | /* Configure tilemap transparency */ |
| r241918 | r241919 | |
| 731 | 539 | save_item(NAME(m_interrupt_line_2)); |
| 732 | 540 | } |
| 733 | 541 | |
| 734 | | VIDEO_START_MEMBER(dooyong_state,bluehawk) |
| 542 | VIDEO_START_MEMBER(dooyong_z80_state, bluehawk) |
| 735 | 543 | { |
| 736 | 544 | /* Configure tilemap callbacks */ |
| 737 | 545 | m_bg_tilerom = memregion("gfx3")->base() + 0x78000; |
| 738 | 546 | m_fg_tilerom = memregion("gfx4")->base() + 0x78000; |
| 739 | 547 | m_fg2_tilerom = memregion("gfx5")->base() + 0x38000; |
| 740 | | m_bg_tilerom2 = NULL; |
| 741 | | m_fg_tilerom2 = NULL; |
| 742 | | m_fg2_tilerom2 = NULL; |
| 743 | 548 | m_bg_gfx = 2; |
| 744 | 549 | m_fg_gfx = 3; |
| 745 | 550 | m_fg2_gfx = 4; |
| r241918 | r241919 | |
| 752 | 557 | 32, 32, 32, 8); |
| 753 | 558 | m_fg2_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg2_tile_info),this), TILEMAP_SCAN_COLS, |
| 754 | 559 | 32, 32, 32, 8); |
| 755 | | m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS, |
| 560 | m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS, |
| 756 | 561 | 8, 8, 64, 32); |
| 757 | 562 | |
| 758 | 563 | /* Configure tilemap transparency */ |
| r241918 | r241919 | |
| 771 | 576 | save_item(NAME(m_fg2scroll8)); |
| 772 | 577 | } |
| 773 | 578 | |
| 774 | | VIDEO_START_MEMBER(dooyong_state,flytiger) |
| 579 | VIDEO_START_MEMBER(dooyong_z80_state, flytiger) |
| 775 | 580 | { |
| 776 | 581 | /* Configure tilemap callbacks */ |
| 777 | 582 | m_bg_tilerom = memregion("gfx3")->base() + 0x78000; |
| 778 | 583 | m_fg_tilerom = memregion("gfx4")->base() + 0x78000; |
| 779 | | m_bg_tilerom2 = NULL; |
| 780 | | m_fg_tilerom2 = NULL; |
| 781 | 584 | m_bg_gfx = 2; |
| 782 | 585 | m_fg_gfx = 3; |
| 783 | 586 | m_tx_tilemap_mode = 0; |
| r241918 | r241919 | |
| 785 | 588 | /* Create tilemaps */ |
| 786 | 589 | m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS, |
| 787 | 590 | 32, 32, 32, 8); |
| 788 | | m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::flytiger_get_fg_tile_info),this), TILEMAP_SCAN_COLS, |
| 591 | m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS, |
| 789 | 592 | 32, 32, 32, 8); |
| 790 | | m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS, |
| 593 | m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS, |
| 791 | 594 | 8, 8, 64, 32); |
| 792 | 595 | |
| 793 | 596 | /* Configure tilemap transparency */ |
| r241918 | r241919 | |
| 806 | 609 | save_item(NAME(m_flytiger_pri)); |
| 807 | 610 | } |
| 808 | 611 | |
| 809 | | VIDEO_START_MEMBER(dooyong_state,primella) |
| 612 | VIDEO_START_MEMBER(dooyong_z80_state, primella) |
| 810 | 613 | { |
| 811 | 614 | /* Configure tilemap callbacks */ |
| 812 | 615 | m_bg_tilerom = memregion("gfx2")->base() + memregion("gfx2")->bytes() - 0x8000; |
| 813 | 616 | m_fg_tilerom = memregion("gfx3")->base() + memregion("gfx3")->bytes() - 0x8000; |
| 814 | | m_bg_tilerom2 = NULL; |
| 815 | | m_fg_tilerom2 = NULL; |
| 816 | 617 | m_bg_gfx = 1; |
| 817 | 618 | m_fg_gfx = 2; |
| 818 | 619 | m_tx_tilemap_mode = 1; |
| r241918 | r241919 | |
| 822 | 623 | 32, 32, 32, 8); |
| 823 | 624 | m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS, |
| 824 | 625 | 32, 32, 32, 8); |
| 825 | | m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS, |
| 626 | m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS, |
| 826 | 627 | 8, 8, 64, 32); |
| 827 | 628 | |
| 828 | 629 | /* Configure tilemap transparency */ |
| r241918 | r241919 | |
| 840 | 641 | save_item(NAME(m_tx_pri)); |
| 841 | 642 | } |
| 842 | 643 | |
| 843 | | VIDEO_START_MEMBER(dooyong_state,rshark) |
| 644 | |
| 645 | WRITE16_MEMBER(dooyong_68k_state::ctrl_w) |
| 844 | 646 | { |
| 647 | if (ACCESSING_BITS_0_7) |
| 648 | { |
| 649 | /* bit 0 flips screen */ |
| 650 | flip_screen_set(data & 0x0001); |
| 651 | |
| 652 | /* bit 4 changes tilemaps priority */ |
| 653 | m_bg2_priority = data & 0x0010; |
| 654 | |
| 655 | /* bit 5 used but unknown */ |
| 656 | } |
| 657 | } |
| 658 | |
| 659 | |
| 660 | inline void dooyong_68k_state::rshark_get_tile_info(tile_data &tileinfo, int tile_index, |
| 661 | UINT8 const *tilerom1, UINT8 const *tilerom2, UINT8 const *scroll, int graphics) |
| 662 | { |
| 663 | /* Tiles take two bytes in tile ROM 1: |
| 664 | MSB LSB |
| 665 | [offs + 0x00] YX?c cccc (Y flip, X flip, bits 12-8 of gfx code) |
| 666 | [offs + 0x01] cccc cccc (bits 7-0 of gfx code) |
| 667 | ? = unused/unknown |
| 668 | c = gfx code |
| 669 | X = x flip |
| 670 | Y = y flip */ |
| 671 | int const offs = tile_index + ((int)scroll[1] << 9); |
| 672 | int const attr = tilerom1[offs * 2]; |
| 673 | int const code = tilerom1[(offs * 2) + 1] | ((attr & 0x1f) << 8); |
| 674 | int const color = tilerom2[offs] & 0x0f; |
| 675 | int const flags = TILE_FLIPYX((attr & 0xC0) >> 6); |
| 676 | |
| 677 | tileinfo.set(graphics, code, color, flags); |
| 678 | } |
| 679 | |
| 680 | TILE_GET_INFO_MEMBER(dooyong_68k_state::rshark_get_bg_tile_info) |
| 681 | { |
| 682 | rshark_get_tile_info(tileinfo, tile_index, m_bg_tilerom, m_bg_tilerom2, m_bgscroll8, m_bg_gfx); |
| 683 | } |
| 684 | |
| 685 | TILE_GET_INFO_MEMBER(dooyong_68k_state::rshark_get_bg2_tile_info) |
| 686 | { |
| 687 | rshark_get_tile_info(tileinfo, tile_index, m_bg2_tilerom, m_bg2_tilerom2, m_bg2scroll8, m_bg2_gfx); |
| 688 | } |
| 689 | |
| 690 | TILE_GET_INFO_MEMBER(dooyong_68k_state::rshark_get_fg_tile_info) |
| 691 | { |
| 692 | rshark_get_tile_info(tileinfo, tile_index, m_fg_tilerom, m_fg_tilerom2, m_fgscroll8, m_fg_gfx); |
| 693 | } |
| 694 | |
| 695 | TILE_GET_INFO_MEMBER(dooyong_68k_state::rshark_get_fg2_tile_info) |
| 696 | { |
| 697 | rshark_get_tile_info(tileinfo, tile_index, m_fg2_tilerom, m_fg2_tilerom2, m_fg2scroll8, m_fg2_gfx); |
| 698 | } |
| 699 | |
| 700 | |
| 701 | void dooyong_68k_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 702 | { |
| 703 | /* Sprites take 8 16-bit words each in memory: |
| 704 | MSB LSB |
| 705 | [offs + 0] ???? ???? ???? ???E |
| 706 | [offs + 1] ???? ???? hhhh wwww |
| 707 | [offs + 2] ???? ???? ???? ???? |
| 708 | [offs + 3] cccc cccc cccc cccc |
| 709 | [offs + 4] ???? ???x xxxx xxxx |
| 710 | [offs + 5] ???? ???? ???? ???? |
| 711 | [offs + 6] ???? ???y yyyy yyyy |
| 712 | [offs + 7] ???? ???? ???? CCCC |
| 713 | ? = unused/unknown |
| 714 | E = enable |
| 715 | c = gfx code |
| 716 | x = x offset |
| 717 | y = y offset (signed) |
| 718 | C = color code |
| 719 | w = width |
| 720 | h = height */ |
| 721 | |
| 722 | UINT16 const *const buffered_spriteram = m_spriteram->buffer(); |
| 723 | for (int offs = (m_spriteram->bytes() / 2) - 8; offs >= 0; offs -= 8) |
| 724 | { |
| 725 | if (buffered_spriteram[offs] & 0x0001) /* enable */ |
| 726 | { |
| 727 | int code = buffered_spriteram[offs+3]; |
| 728 | int const color = buffered_spriteram[offs+7] & 0x000f; |
| 729 | //TODO: This priority mechanism works for known games, but seems a bit strange. |
| 730 | //Are we missing something? (The obvious spare palette bit isn't it.) |
| 731 | int const pri = (((color == 0x00) || (color == 0x0f)) ? 0xfc : 0xf0); |
| 732 | int const width = buffered_spriteram[offs+1] & 0x000f; |
| 733 | int const height = (buffered_spriteram[offs+1] & 0x00f0) >> 4; |
| 734 | |
| 735 | bool const flip = flip_screen(); |
| 736 | int sx = buffered_spriteram[offs+4] & 0x01ff; |
| 737 | int sy = (INT16)buffered_spriteram[offs+6] & 0x01ff; |
| 738 | if (sy & 0x0100) sy |= ~(int)0x01ff; // Correctly sign-extend 9-bit number |
| 739 | if (flip) |
| 740 | { |
| 741 | sx = 498 - (16 * width) - sx; |
| 742 | sy = 240 - (16 * height) - sy; |
| 743 | } |
| 744 | |
| 745 | for (int y = 0; y <= height; y++) |
| 746 | { |
| 747 | int const _y = sy + (16 * (flip ? (height - y) : y)); |
| 748 | for (int x = 0; x <= width; x++) |
| 749 | { |
| 750 | int const _x = sx + (16 * (flip ? (width - x) : x)); |
| 751 | m_gfxdecode->gfx(0)->prio_transpen(bitmap,cliprect, |
| 752 | code, |
| 753 | color, |
| 754 | flip, flip, |
| 755 | _x, _y, |
| 756 | screen.priority(), |
| 757 | pri, 15); |
| 758 | code++; |
| 759 | } |
| 760 | } |
| 761 | } |
| 762 | } |
| 763 | } |
| 764 | |
| 765 | UINT32 dooyong_68k_state::screen_update_rshark(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 766 | { |
| 767 | bitmap.fill(m_palette->black_pen(), cliprect); |
| 768 | screen.priority().fill(0, cliprect); |
| 769 | |
| 770 | m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 1); |
| 771 | m_bg2_tilemap->draw(screen, bitmap, cliprect, 0, (m_bg2_priority ? 2 : 1)); |
| 772 | m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 2); |
| 773 | m_fg2_tilemap->draw(screen, bitmap, cliprect, 0, 2); |
| 774 | |
| 775 | draw_sprites(screen, bitmap, cliprect); |
| 776 | |
| 777 | return 0; |
| 778 | } |
| 779 | |
| 780 | UINT32 dooyong_68k_state::screen_update_popbingo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 781 | { |
| 782 | bitmap.fill(m_palette->black_pen(), cliprect); |
| 783 | screen.priority().fill(0, cliprect); |
| 784 | |
| 785 | m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 1); |
| 786 | |
| 787 | draw_sprites(screen, bitmap, cliprect); |
| 788 | |
| 789 | return 0; |
| 790 | } |
| 791 | |
| 792 | |
| 793 | VIDEO_START_MEMBER(dooyong_68k_state, rshark) |
| 794 | { |
| 845 | 795 | /* Configure tilemap callbacks */ |
| 846 | 796 | m_bg_tilerom = memregion("gfx5")->base(); |
| 847 | 797 | m_bg2_tilerom = memregion("gfx4")->base(); |
| r241918 | r241919 | |
| 857 | 807 | m_fg2_gfx = 1; |
| 858 | 808 | |
| 859 | 809 | /* Create tilemaps */ |
| 860 | | m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS, |
| 810 | m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_68k_state::rshark_get_bg_tile_info),this), TILEMAP_SCAN_COLS, |
| 861 | 811 | 16, 16, 64, 32); |
| 862 | | m_bg2_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_bg2_tile_info),this), TILEMAP_SCAN_COLS, |
| 812 | m_bg2_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_68k_state::rshark_get_bg2_tile_info),this), TILEMAP_SCAN_COLS, |
| 863 | 813 | 16, 16, 64, 32); |
| 864 | | m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS, |
| 814 | m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_68k_state::rshark_get_fg_tile_info),this), TILEMAP_SCAN_COLS, |
| 865 | 815 | 16, 16, 64, 32); |
| 866 | | m_fg2_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg2_tile_info),this), TILEMAP_SCAN_COLS, |
| 816 | m_fg2_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_68k_state::rshark_get_fg2_tile_info),this), TILEMAP_SCAN_COLS, |
| 867 | 817 | 16, 16, 64, 32); |
| 868 | 818 | |
| 869 | 819 | /* Configure tilemap transparency */ |
| r241918 | r241919 | |
| 881 | 831 | save_item(NAME(m_bg2scroll8)); |
| 882 | 832 | save_item(NAME(m_fgscroll8)); |
| 883 | 833 | save_item(NAME(m_fg2scroll8)); |
| 884 | | save_item(NAME(m_rshark_pri)); |
| 834 | save_item(NAME(m_bg2_priority)); |
| 885 | 835 | } |
| 886 | 836 | |
| 887 | | VIDEO_START_MEMBER(dooyong_state,popbingo) |
| 837 | VIDEO_START_MEMBER(dooyong_68k_state, popbingo) |
| 888 | 838 | { |
| 889 | 839 | /* Configure tilemap callbacks */ |
| 890 | 840 | m_bg_tilerom = memregion("gfx2")->base(); |
| r241918 | r241919 | |
| 905 | 855 | save_item(NAME(m_bg2scroll8)); // Not used atm |
| 906 | 856 | save_item(NAME(m_fgscroll8)); // Not used atm |
| 907 | 857 | save_item(NAME(m_fg2scroll8)); // Not used atm |
| 908 | | save_item(NAME(m_rshark_pri)); |
| 858 | save_item(NAME(m_bg2_priority)); |
| 909 | 859 | } |
trunk/src/mame/video/prehisle.c
| r241918 | r241919 | |
| 27 | 27 | switch (offset) |
| 28 | 28 | { |
| 29 | 29 | case 0x08: return ioport("P2")->read(); // Player 2 |
| 30 | | case 0x10: return ioport("COIN")->read(); // Coins, Tilt, Service |
| 31 | | case 0x20: return ioport("P1")->read() ^ m_invert_controls; // Player 1 |
| 32 | | case 0x21: return ioport("DSW0")->read(); // DIPs |
| 33 | | case 0x22: return ioport("DSW1")->read(); // DIPs + VBLANK |
| 30 | case 0x10: return ioport("COIN")->read(); // Coins, Tilt, Service |
| 31 | case 0x20: return ioport("P1")->read() ^ m_invert_controls; // Player 1 |
| 32 | case 0x21: return ioport("DSW0")->read(); // DIPs |
| 33 | case 0x22: return ioport("DSW1")->read(); // DIPs + VBLANK |
| 34 | 34 | default: return 0; |
| 35 | 35 | } |
| 36 | 36 | } |
| r241918 | r241919 | |
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | /* tile layout |
| 58 | 0 xxxx.... color |
| 59 | 0 ....x... flip x |
| 60 | 0 .....xxx gfx code high bits |
| 61 | 1 xxxxxxxx gfx code low bits |
| 62 | */ |
| 57 | 63 | TILE_GET_INFO_MEMBER(prehisle_state::get_bg2_tile_info) |
| 58 | 64 | { |
| 59 | | UINT8 *tilerom = memregion("gfx5")->base(); |
| 65 | UINT8 const *const tilerom = memregion("gfx5")->base(); |
| 60 | 66 | |
| 61 | | int offs = tile_index * 2; |
| 62 | | int attr = tilerom[offs + 1] + (tilerom[offs] << 8); |
| 63 | | int code = (attr & 0x7ff) | 0x800; |
| 64 | | int color = attr >> 12; |
| 65 | | int flags = (attr & 0x800) ? TILE_FLIPX : 0; |
| 67 | int const offs = tile_index * 2; |
| 68 | int const attr = tilerom[offs + 1] + (tilerom[offs] << 8); |
| 69 | int const code = (attr & 0x7ff) | 0x800; |
| 70 | int const color = attr >> 12; |
| 71 | int const flags = (attr & 0x800) ? TILE_FLIPX : 0; |
| 66 | 72 | |
| 67 | 73 | SET_TILE_INFO_MEMBER(1, code, color, flags); |
| 68 | 74 | } |
| 69 | 75 | |
| 76 | /* tile layout |
| 77 | 0 xxxx.... ........ color |
| 78 | 0 ....x... ........ flip y |
| 79 | 0 .....xxx xxxxxxxx gfx code |
| 80 | */ |
| 70 | 81 | TILE_GET_INFO_MEMBER(prehisle_state::get_bg_tile_info) |
| 71 | 82 | { |
| 72 | | int attr = m_bg_videoram16[tile_index]; |
| 73 | | int code = attr & 0x7ff; |
| 74 | | int color = attr >> 12; |
| 75 | | int flags = (attr & 0x800) ? TILE_FLIPY : 0; |
| 83 | int const attr = m_bg_videoram16[tile_index]; |
| 84 | int const code = attr & 0x7ff; |
| 85 | int const color = attr >> 12; |
| 86 | int const flags = (attr & 0x800) ? TILE_FLIPY : 0; |
| 76 | 87 | |
| 77 | 88 | SET_TILE_INFO_MEMBER(2, code, color, flags); |
| 78 | 89 | } |
| 79 | 90 | |
| 91 | /* tile layout |
| 92 | 0 xxxx.... ........ color |
| 93 | 0 ....xxxx xxxxxxxx gfx code |
| 94 | */ |
| 80 | 95 | TILE_GET_INFO_MEMBER(prehisle_state::get_fg_tile_info) |
| 81 | 96 | { |
| 82 | | int attr = m_videoram[tile_index]; |
| 83 | | int code = attr & 0xfff; |
| 84 | | int color = attr >> 12; |
| 97 | int const attr = m_videoram[tile_index]; |
| 98 | int const code = attr & 0xfff; |
| 99 | int const color = attr >> 12; |
| 85 | 100 | |
| 86 | 101 | SET_TILE_INFO_MEMBER(0, code, color, 0); |
| 87 | 102 | } |
| 88 | 103 | |
| 89 | 104 | void prehisle_state::video_start() |
| 90 | 105 | { |
| 91 | | m_bg2_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(prehisle_state::get_bg2_tile_info),this), TILEMAP_SCAN_COLS, |
| 92 | | 16, 16, 1024, 32); |
| 106 | // ROM-based background layer |
| 107 | m_bg2_tilemap = &machine().tilemap().create( |
| 108 | m_gfxdecode, |
| 109 | tilemap_get_info_delegate(FUNC(prehisle_state::get_bg2_tile_info), this), |
| 110 | TILEMAP_SCAN_COLS, // scan order |
| 111 | 16, 16, // tile size |
| 112 | 1024, 32); // tilemap size |
| 93 | 113 | |
| 94 | | m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(prehisle_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS, |
| 95 | | 16, 16, 256, 32); |
| 114 | // RAM-based background layer (overlays most sprites) |
| 115 | m_bg_tilemap = &machine().tilemap().create( |
| 116 | m_gfxdecode, |
| 117 | tilemap_get_info_delegate(FUNC(prehisle_state::get_bg_tile_info), this), |
| 118 | TILEMAP_SCAN_COLS, // scan order |
| 119 | 16, 16, // tile size |
| 120 | 256, 32); // tilemap size |
| 121 | m_bg_tilemap->set_transparent_pen(15); |
| 96 | 122 | |
| 97 | | m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(prehisle_state::get_fg_tile_info),this), TILEMAP_SCAN_ROWS, |
| 98 | | 8, 8, 32, 32); |
| 99 | | |
| 100 | | m_bg_tilemap->set_transparent_pen(15); |
| 123 | // text layer |
| 124 | m_fg_tilemap = &machine().tilemap().create( |
| 125 | m_gfxdecode, |
| 126 | tilemap_get_info_delegate(FUNC(prehisle_state::get_fg_tile_info), this), |
| 127 | TILEMAP_SCAN_ROWS, // scan order |
| 128 | 8, 8, // tile size |
| 129 | 32, 32); // tilemap size |
| 101 | 130 | m_fg_tilemap->set_transparent_pen(15); |
| 102 | 131 | |
| 103 | 132 | /* register for saving */ |
| r241918 | r241919 | |
| 105 | 134 | } |
| 106 | 135 | |
| 107 | 136 | /* sprite layout |
| 108 | | o fedcba9876543210 |
| 109 | 137 | |
| 110 | | 0 .......xxxxxxxxx y, other bits unused? |
| 111 | | 1 .......xxxxxxxxx x, other bits unused? |
| 112 | | |
| 113 | | 2 ...xxxxxxxxxxxxx code |
| 114 | | 2 ..x............. ? |
| 115 | | 2 .x.............. flipx |
| 116 | | 2 x............... flipy |
| 117 | | |
| 118 | | 3 xxxx............ color+priority, other bits unknown |
| 138 | 0 .......x xxxxxxxx y, other bits unused? |
| 139 | 1 .......x xxxxxxxx x, other bits unused? |
| 140 | 2 x....... ........ flip y |
| 141 | 2 .x...... ........ flip x |
| 142 | 2 ..x..... ........ ? |
| 143 | 2 ...xxxxx xxxxxxxx gfx code |
| 144 | 3 xxxx.... ........ color+priority, other bits unknown |
| 119 | 145 | */ |
| 120 | | void prehisle_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int foreground ) |
| 146 | void prehisle_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 121 | 147 | { |
| 122 | | UINT16 *spriteram16 = m_spriteram; |
| 123 | | int offs; |
| 148 | UINT16 const *const spriteram16 = m_spriteram; |
| 124 | 149 | |
| 125 | | for (offs = 0; offs < 1024; offs += 4) |
| 150 | for (int offs = 0; offs < 1024; offs += 4) |
| 126 | 151 | { |
| 127 | | int attr = spriteram16[offs + 2]; |
| 128 | | int code = attr & 0x1fff; |
| 129 | | int color = spriteram16[offs + 3] >> 12; |
| 130 | | int priority = (color < 0x4); // correct? |
| 131 | | int flipx = attr & 0x4000; |
| 132 | | int flipy = attr & 0x8000; |
| 133 | | int sx = spriteram16[offs + 1]&0x1ff; |
| 134 | | int sy = spriteram16[offs]&0x1ff; |
| 152 | int const attr = spriteram16[offs + 2]; |
| 153 | int const code = attr & 0x1fff; |
| 154 | int const color = spriteram16[offs + 3] >> 12; |
| 155 | int const priority = (color < 0x4) ? 0x04 : 0x06; |
| 156 | bool flipx = attr & 0x4000; |
| 157 | bool flipy = attr & 0x8000; |
| 158 | int sx = spriteram16[offs + 1] & 0x1ff; |
| 159 | int sy = spriteram16[offs] & 0x1ff; |
| 135 | 160 | |
| 136 | 161 | // coordinates are 9-bit signed |
| 137 | | if (sx&0x100) sx=-0x100+(sx&0xff); |
| 138 | | if (sy&0x100) sy=-0x100+(sy&0xff); |
| 162 | if (sx & 0x100) sx = -0x100 + (sx & 0xff); |
| 163 | if (sy & 0x100) sy = -0x100 + (sy & 0xff); |
| 139 | 164 | |
| 140 | 165 | if (flip_screen()) |
| 141 | 166 | { |
| r241918 | r241919 | |
| 145 | 170 | flipy = !flipy; |
| 146 | 171 | } |
| 147 | 172 | |
| 148 | | if ((foreground && priority) || (!foreground && !priority)) |
| 149 | | { |
| 150 | | m_gfxdecode->gfx(3)->transpen(bitmap,cliprect, code, color, flipx, flipy, sx, sy, 15); |
| 151 | | } |
| 173 | m_gfxdecode->gfx(3)->prio_transpen( |
| 174 | bitmap, cliprect, |
| 175 | code, color, |
| 176 | flipx, flipy, |
| 177 | sx, sy, |
| 178 | screen.priority(), priority, |
| 179 | 15); // transparent pen |
| 152 | 180 | } |
| 153 | 181 | } |
| 154 | 182 | |
| 155 | 183 | UINT32 prehisle_state::screen_update_prehisle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 156 | 184 | { |
| 185 | screen.priority().fill(0, cliprect); |
| 186 | |
| 157 | 187 | m_bg2_tilemap->draw(screen, bitmap, cliprect, 0, 0); |
| 158 | | draw_sprites(bitmap, cliprect, 0); |
| 159 | | m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); |
| 160 | | draw_sprites(bitmap, cliprect, 1); |
| 161 | | m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); |
| 188 | m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 1); |
| 189 | m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 2); |
| 190 | draw_sprites(screen, bitmap, cliprect); |
| 191 | |
| 162 | 192 | return 0; |
| 163 | 193 | } |