src/mame/video/gaelco3d.c
| r1185 | r1186 | |
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | 10 | #include "gaelco3d.h" |
| 11 | | #include "video/poly.h" |
| 11 | #include "video/polynew.h" |
| 12 | 12 | |
| 13 | 13 | UINT8 *gaelco3d_texture; |
| 14 | 14 | UINT8 *gaelco3d_texmask; |
| r1185 | r1186 | |
| 32 | 32 | static mame_bitmap *zbuffer; |
| 33 | 33 | static UINT16 *palette; |
| 34 | 34 | static UINT32 *polydata_buffer; |
| 35 | | static UINT32 polydata_start; |
| 36 | 35 | static UINT32 polydata_count; |
| 37 | 36 | |
| 38 | 37 | static int polygons; |
| 39 | 38 | static int lastscan; |
| 40 | 39 | static int video_changed; |
| 41 | 40 | |
| 42 | | static osd_work_queue *work_queue; |
| 41 | static poly_manager *poly; |
| 43 | 42 | |
| 44 | | static int this_skip; |
| 45 | 43 | |
| 44 | typedef struct _poly_extra_data poly_extra_data; |
| 45 | struct _poly_extra_data |
| 46 | { |
| 47 | UINT32 tex, color; |
| 48 | float ooz_dx, ooz_dy, ooz_base; |
| 49 | float uoz_dx, uoz_dy, uoz_base; |
| 50 | float voz_dx, voz_dy, voz_base; |
| 51 | float z0; |
| 52 | }; |
| 46 | 53 | |
| 47 | 54 | |
| 55 | static void render_noz_noperspective(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid); |
| 56 | static void render_normal(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid); |
| 57 | static void render_alphablend(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid); |
| 58 | |
| 59 | |
| 60 | |
| 48 | 61 | /************************************* |
| 49 | 62 | * |
| 50 | 63 | * Video init |
| r1185 | r1186 | |
| 53 | 66 | |
| 54 | 67 | static void gaelco3d_exit(running_machine *machine) |
| 55 | 68 | { |
| 56 | | osd_work_queue_free(work_queue); |
| 69 | poly_free(poly); |
| 57 | 70 | } |
| 58 | 71 | |
| 59 | 72 | |
| 60 | 73 | VIDEO_START( gaelco3d ) |
| 61 | 74 | { |
| 75 | poly = poly_alloc(2000, sizeof(poly_extra_data), 0); |
| 76 | add_exit_callback(machine, gaelco3d_exit); |
| 77 | |
| 62 | 78 | screenbits = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format); |
| 63 | 79 | |
| 64 | 80 | zbuffer = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, BITMAP_FORMAT_INDEXED16); |
| r1185 | r1186 | |
| 66 | 82 | palette = auto_malloc(32768 * sizeof(palette[0])); |
| 67 | 83 | polydata_buffer = auto_malloc(MAX_POLYDATA * sizeof(polydata_buffer[0])); |
| 68 | 84 | |
| 69 | | work_queue = osd_work_queue_alloc(0); |
| 70 | | add_exit_callback(machine, gaelco3d_exit); |
| 71 | | |
| 72 | 85 | /* save states */ |
| 73 | 86 | |
| 74 | 87 | state_save_register_global_pointer(palette, 32768); |
| 75 | 88 | state_save_register_global_pointer(polydata_buffer, MAX_POLYDATA); |
| 76 | | state_save_register_global(polydata_start); |
| 77 | 89 | state_save_register_global(polydata_count); |
| 78 | 90 | |
| 79 | 91 | state_save_register_global(polygons); |
| r1185 | r1186 | |
| 128 | 140 | * |
| 129 | 141 | *************************************/ |
| 130 | 142 | |
| 131 | | static void *render_poly(void *param) |
| 132 | | { |
| 133 | | UINT32 *polydata = param; |
| 143 | /* |
| 144 | Polygon data stream format: |
| 134 | 145 | |
| 135 | | /* these three parameters combine via A * x + B * y + C to produce a 1/z value */ |
| 136 | | float ooz_dx = dsp_to_float(polydata[4]) * GAELCO3D_RESOLUTION_DIVIDE; |
| 137 | | float ooz_dy = dsp_to_float(polydata[3]) * GAELCO3D_RESOLUTION_DIVIDE; |
| 138 | | float ooz_base = dsp_to_float(polydata[8]); |
| 146 | data[0] (float) = scale factor to map Z to fixed Z buffer value |
| 147 | data[1] (float) = dvoz/dy (change in v/z per Y) |
| 148 | data[2] (float) = dvoz/dx (change in v/z per X) |
| 149 | data[3] (float) = dooz/dy (change in 1/z per Y) |
| 150 | data[4] (float) = dooz/dx (change in 1/z per X) |
| 151 | data[5] (float) = duoz/dy (change in u/z per Y) |
| 152 | data[6] (float) = duoz/dx (change in u/z per X) |
| 153 | data[7] (float) = voz origin (value of v/z at coordinate (0,0)) |
| 154 | data[8] (float) = ooz origin (value of 1/z at coordinate (0,0)) |
| 155 | data[9] (float) = uoz origin (value of u/z at coordinate (0,0)) |
| 156 | data[10] (int) = palette base (bits 14-8) |
| 157 | data[11] (int) = texture address |
| 158 | data[12] (int) = start point (bits 15-8 = X coordinate, bits 12-0 = Y coordinate) |
| 159 | data[13] (int) = next point (bits 15-8 = X coordinate, bits 12-0 = Y coordinate) |
| 160 | data[14] (int) = 16.16 dx/dy from previous point to this point |
| 161 | (repeat these two for each additional point in the fan) |
| 162 | */ |
| 139 | 163 | |
| 140 | | /* these three parameters combine via A * x + B * y + C to produce a u/z value */ |
| 141 | | float uoz_dx = dsp_to_float(polydata[6]) * GAELCO3D_RESOLUTION_DIVIDE; |
| 142 | | float uoz_dy = dsp_to_float(polydata[5]) * GAELCO3D_RESOLUTION_DIVIDE; |
| 143 | | float uoz_base = dsp_to_float(polydata[9]); |
| 144 | | |
| 145 | | /* these three parameters combine via A * x + B * y + C to produce a v/z value */ |
| 146 | | float voz_dx = dsp_to_float(polydata[2]) * GAELCO3D_RESOLUTION_DIVIDE; |
| 147 | | float voz_dy = dsp_to_float(polydata[1]) * GAELCO3D_RESOLUTION_DIVIDE; |
| 148 | | float voz_base = dsp_to_float(polydata[7]); |
| 149 | | |
| 150 | | /* this parameter is used to scale 1/z to a formal Z buffer value */ |
| 164 | static void render_poly(UINT32 *polydata) |
| 165 | { |
| 166 | float midx = Machine->screen[0].width / 2; |
| 167 | float midy = Machine->screen[0].height / 2; |
| 151 | 168 | float z0 = dsp_to_float(polydata[0]); |
| 152 | | |
| 153 | | /* these two parameters are the X,Y origin of the texture data */ |
| 154 | | int xorigin = (INT32)polydata[12] >> 16; |
| 155 | | int yorigin = (INT32)(polydata[12] << 18) >> 18; |
| 156 | | |
| 169 | float voz_dy = dsp_to_float(polydata[1]); |
| 170 | float voz_dx = dsp_to_float(polydata[2]); |
| 171 | float ooz_dy = dsp_to_float(polydata[3]); |
| 172 | float ooz_dx = dsp_to_float(polydata[4]); |
| 173 | float uoz_dy = dsp_to_float(polydata[5]); |
| 174 | float uoz_dx = dsp_to_float(polydata[6]); |
| 175 | float voz_base = dsp_to_float(polydata[7]) - midx * voz_dx - midy * voz_dy; |
| 176 | float ooz_base = dsp_to_float(polydata[8]) - midx * ooz_dx - midy * ooz_dy; |
| 177 | float uoz_base = dsp_to_float(polydata[9]) - midx * uoz_dx - midy * uoz_dy; |
| 157 | 178 | int color = (polydata[10] & 0x7f) << 8; |
| 158 | | int midx = Machine->screen[0].width/2; |
| 159 | | int midy = Machine->screen[0].height/2; |
| 160 | | struct poly_vertex vert[3]; |
| 161 | | rectangle clip; |
| 179 | poly_vertex vert[3]; |
| 162 | 180 | int i; |
| 163 | 181 | |
| 164 | | // shut up the compiler |
| 165 | | (void)xorigin; |
| 166 | | (void)yorigin; |
| 167 | | |
| 168 | | if (LOG_POLYGONS && input_code_pressed(KEYCODE_LSHIFT)) |
| 182 | if (LOG_POLYGONS) |
| 169 | 183 | { |
| 170 | 184 | int t; |
| 171 | | mame_printf_debug("poly: %12.2f %12.2f %12.2f %12.2f %12.2f %12.2f %12.2f %12.2f %12.2f %12.2f %08X %08X (%4d,%4d) %08X", |
| 185 | logerror("poly: %12.2f %12.2f %12.2f %12.2f %12.2f %12.2f %12.2f %12.2f %12.2f %12.2f %08X %08X (%4d,%4d) %08X", |
| 172 | 186 | (double)dsp_to_float(polydata[0]), |
| 173 | 187 | (double)dsp_to_float(polydata[1]), |
| 174 | 188 | (double)dsp_to_float(polydata[2]), |
| r1185 | r1186 | |
| 183 | 197 | polydata[11], |
| 184 | 198 | (INT16)(polydata[12] >> 16), (INT16)(polydata[12] << 2) >> 2, polydata[12]); |
| 185 | 199 | |
| 186 | | mame_printf_debug(" (%4d,%4d) %08X %08X", (INT16)(polydata[13] >> 16), (INT16)(polydata[13] << 2) >> 2, polydata[13], polydata[14]); |
| 200 | logerror(" (%4d,%4d) %08X %08X", (INT16)(polydata[13] >> 16), (INT16)(polydata[13] << 2) >> 2, polydata[13], polydata[14]); |
| 187 | 201 | for (t = 15; !IS_POLYEND(polydata[t - 2]); t += 2) |
| 188 | | mame_printf_debug(" (%4d,%4d) %08X %08X", (INT16)(polydata[t] >> 16), (INT16)(polydata[t] << 2) >> 2, polydata[t], polydata[t+1]); |
| 189 | | mame_printf_debug("\n"); |
| 202 | logerror(" (%4d,%4d) %08X %08X", (INT16)(polydata[t] >> 16), (INT16)(polydata[t] << 2) >> 2, polydata[t], polydata[t+1]); |
| 203 | logerror("\n"); |
| 190 | 204 | } |
| 191 | 205 | |
| 192 | | /* compute the adjusted clip */ |
| 193 | | clip.min_x = Machine->screen[0].visarea.min_x - midx; |
| 194 | | clip.min_y = midy - Machine->screen[0].visarea.max_y; |
| 195 | | clip.max_x = Machine->screen[0].visarea.max_x - midx; |
| 196 | | clip.max_y = midy - Machine->screen[0].visarea.min_y; |
| 197 | | |
| 198 | 206 | /* extract the first two vertices */ |
| 199 | | vert[0].x = (((INT32)polydata[13] >> 16) + (GAELCO3D_RESOLUTION_DIVIDE/2)) / GAELCO3D_RESOLUTION_DIVIDE; |
| 200 | | vert[0].y = (((INT32)(polydata[13] << 18) >> 18) + (GAELCO3D_RESOLUTION_DIVIDE/2)) / GAELCO3D_RESOLUTION_DIVIDE; |
| 201 | | vert[1].x = (((INT32)polydata[15] >> 16) + (GAELCO3D_RESOLUTION_DIVIDE/2)) / GAELCO3D_RESOLUTION_DIVIDE; |
| 202 | | vert[1].y = (((INT32)(polydata[15] << 18) >> 18) + (GAELCO3D_RESOLUTION_DIVIDE/2)) / GAELCO3D_RESOLUTION_DIVIDE; |
| 207 | vert[0].x = midx + (float)((INT32)polydata[13] >> 16) + 0.5f; |
| 208 | vert[0].y = midy + ((float)((INT32)(polydata[13] << 18) >> 18) + 0.5f); |
| 209 | vert[1].x = midx + (float)((INT32)polydata[15] >> 16) + 0.5f; |
| 210 | vert[1].y = midy + ((float)((INT32)(polydata[15] << 18) >> 18) + 0.5f); |
| 203 | 211 | |
| 204 | 212 | /* loop over the remaining verticies */ |
| 205 | 213 | for (i = 17; !IS_POLYEND(polydata[i - 2]) && i < 1000; i += 2) |
| 206 | 214 | { |
| 207 | | offs_t endmask = gaelco3d_texture_size - 1; |
| 208 | | const struct poly_scanline_data *scans; |
| 209 | | UINT32 tex = polydata[11]; |
| 210 | | int x, y; |
| 215 | poly_extra_data *extra = poly_get_extra_data(poly); |
| 211 | 216 | |
| 217 | /* fill in core extra data */ |
| 218 | extra->tex = polydata[11]; |
| 219 | extra->color = color; |
| 220 | extra->ooz_dx = ooz_dx; |
| 221 | extra->ooz_dy = ooz_dy; |
| 222 | extra->ooz_base = ooz_base; |
| 223 | extra->uoz_dx = uoz_dx; |
| 224 | extra->uoz_dy = uoz_dy; |
| 225 | extra->uoz_base = uoz_base; |
| 226 | extra->voz_dx = voz_dx; |
| 227 | extra->voz_dy = voz_dy; |
| 228 | extra->voz_base = voz_base; |
| 229 | extra->z0 = z0; |
| 230 | |
| 212 | 231 | /* extract vertex 2 */ |
| 213 | | vert[2].x = (((INT32)polydata[i] >> 16) + (GAELCO3D_RESOLUTION_DIVIDE/2)) / GAELCO3D_RESOLUTION_DIVIDE; |
| 214 | | vert[2].y = (((INT32)(polydata[i] << 18) >> 18) + (GAELCO3D_RESOLUTION_DIVIDE/2)) / GAELCO3D_RESOLUTION_DIVIDE; |
| 232 | vert[2].x = midx + (float)((INT32)polydata[i] >> 16) + 0.5f; |
| 233 | vert[2].y = midy + (float)((INT32)(polydata[i] << 18) >> 18) + 0.5f; |
| 215 | 234 | |
| 216 | | /* compute the scanning parameters */ |
| 217 | | scans = setup_triangle_0(&vert[0], &vert[1], &vert[2], &clip); |
| 218 | | if (scans) |
| 235 | /* special case: no Z buffering and no perspective correction */ |
| 236 | if (color != 0x7f00 && z0 < 0 && ooz_dx == 0 && ooz_dy == 0) |
| 237 | poly_render_triangle(poly, screenbits, &Machine->screen[0].visarea, render_noz_noperspective, 0, &vert[0], &vert[1], &vert[2]); |
| 238 | |
| 239 | /* general case: non-alpha blended */ |
| 240 | else if (color != 0x7f00) |
| 241 | poly_render_triangle(poly, screenbits, &Machine->screen[0].visarea, render_normal, 0, &vert[0], &vert[1], &vert[2]); |
| 242 | |
| 243 | /* color 0x7f seems to be hard-coded as a 50% alpha blend */ |
| 244 | else |
| 245 | poly_render_triangle(poly, screenbits, &Machine->screen[0].visarea, render_alphablend, 0, &vert[0], &vert[1], &vert[2]); |
| 246 | |
| 247 | /* copy vertex 2 to vertex 1 -- this hardware draws in fans */ |
| 248 | vert[1] = vert[2]; |
| 249 | polygons++; |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | |
| 254 | |
| 255 | static void render_noz_noperspective(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid) |
| 256 | { |
| 257 | poly_extra_data *extra = poly->extra; |
| 258 | mame_bitmap *bitmap = destbase; |
| 259 | UINT16 *dest = BITMAP_ADDR16(bitmap, scanline, 0); |
| 260 | UINT16 *zbuf = BITMAP_ADDR16(zbuffer, scanline, 0); |
| 261 | float zbase = 1.0f / extra->ooz_base; |
| 262 | float uoz = (extra->uoz_base + scanline * extra->uoz_dy + startx * extra->uoz_dx) * zbase; |
| 263 | float voz = (extra->voz_base + scanline * extra->voz_dy + startx * extra->voz_dx) * zbase; |
| 264 | float uoz_step = extra->uoz_dx * zbase; |
| 265 | float voz_step = extra->voz_dx * zbase; |
| 266 | int zbufval = (int)(-extra->z0 * zbase); |
| 267 | offs_t endmask = gaelco3d_texture_size - 1; |
| 268 | UINT16 color = extra->color; |
| 269 | UINT32 tex = extra->tex; |
| 270 | int x; |
| 271 | |
| 272 | for (x = startx; x < stopx; x++) |
| 273 | { |
| 274 | int pixeloffs, u, v; |
| 275 | |
| 276 | if (!BILINEAR_FILTER) |
| 219 | 277 | { |
| 220 | | int pixeloffs, zbufval, u, v; |
| 221 | | #if (BILINEAR_FILTER) |
| 222 | | int paldata, r, g, b, f, tf; |
| 223 | | #endif |
| 224 | | /* special case: no Z buffering and no perspective correction */ |
| 225 | | if (color != 0x7f00 && z0 < 0 && ooz_dx == 0 && ooz_dy == 0) |
| 278 | u = (int)(uoz + 0.5f); v = (int)(voz + 0.5f); |
| 279 | pixeloffs = (tex + v * 4096 + u) & endmask; |
| 280 | if (pixeloffs >= gaelco3d_texmask_size || !gaelco3d_texmask[pixeloffs]) |
| 226 | 281 | { |
| 227 | | float zbase = 1.0f / ooz_base; |
| 228 | | float uoz_step = uoz_dx * zbase; |
| 229 | | float voz_step = voz_dx * zbase; |
| 230 | | zbufval = (int)(-z0 * zbase); |
| 282 | dest[x] = palette[color | gaelco3d_texture[pixeloffs]]; |
| 283 | zbuf[x] = zbufval; |
| 284 | } |
| 285 | } |
| 286 | else |
| 287 | { |
| 288 | u = (int)(uoz * 256.0f); v = (int)(voz * 256.0f); |
| 289 | pixeloffs = (tex + (v >> 8) * 4096 + (u >> 8)) & endmask; |
| 290 | if (pixeloffs >= gaelco3d_texmask_size || !gaelco3d_texmask[pixeloffs]) |
| 291 | { |
| 292 | int paldata, r, g, b, f, tf; |
| 231 | 293 | |
| 232 | | /* loop over scanlines */ |
| 233 | | for (y = scans->sy; y <= scans->ey; y++) |
| 234 | | { |
| 235 | | const struct poly_scanline *scan = &scans->scanline[y - scans->sy]; |
| 236 | | UINT16 *dest = BITMAP_ADDR16(screenbits, midy - y, midx); |
| 237 | | UINT16 *zbuf = BITMAP_ADDR16(zbuffer, midy - y, midx); |
| 238 | | float uoz = (uoz_dy * y + scan->sx * uoz_dx + uoz_base) * zbase; |
| 239 | | float voz = (voz_dy * y + scan->sx * voz_dx + voz_base) * zbase; |
| 294 | paldata = palette[color | gaelco3d_texture[pixeloffs]]; |
| 295 | tf = f = (~u & 0xff) * (~v & 0xff); |
| 296 | r = (paldata & 0x7c00) * f; g = (paldata & 0x03e0) * f; b = (paldata & 0x001f) * f; |
| 240 | 297 | |
| 241 | | for (x = scan->sx; x <= scan->ex; x++) |
| 242 | | { |
| 243 | | #if (!BILINEAR_FILTER) |
| 244 | | u = (int)(uoz + 0.5); v = (int)(voz + 0.5); |
| 245 | | pixeloffs = (tex + v * 4096 + u) & endmask; |
| 246 | | if (pixeloffs >= gaelco3d_texmask_size || !gaelco3d_texmask[pixeloffs]) |
| 247 | | { |
| 248 | | dest[x] = palette[color | gaelco3d_texture[pixeloffs]]; |
| 249 | | zbuf[x] = zbufval; |
| 250 | | } |
| 251 | | #else |
| 252 | | u = (int)(uoz * 256.0); v = (int)(voz * 256.0); |
| 253 | | pixeloffs = (tex + (v >> 8) * 4096 + (u >> 8)) & endmask; |
| 254 | | if (pixeloffs >= gaelco3d_texmask_size || !gaelco3d_texmask[pixeloffs]) |
| 255 | | { |
| 256 | | paldata = palette[color | gaelco3d_texture[pixeloffs]]; |
| 257 | | tf = f = (~u & 0xff) * (~v & 0xff); |
| 258 | | r = (paldata & 0x7c00) * f; g = (paldata & 0x03e0) * f; b = (paldata & 0x001f) * f; |
| 298 | paldata = palette[color | gaelco3d_texture[(pixeloffs + 1) & endmask]]; |
| 299 | tf += f = (u & 0xff) * (~v & 0xff); |
| 300 | r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f; |
| 259 | 301 | |
| 260 | | paldata = palette[color | gaelco3d_texture[(pixeloffs + 1) & endmask]]; |
| 261 | | tf += f = (u & 0xff) * (~v & 0xff); |
| 262 | | r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f; |
| 302 | paldata = palette[color | gaelco3d_texture[(pixeloffs + 4096) & endmask]]; |
| 303 | tf += f = (~u & 0xff) * (v & 0xff); |
| 304 | r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f; |
| 263 | 305 | |
| 264 | | paldata = palette[color | gaelco3d_texture[(pixeloffs + 4096) & endmask]]; |
| 265 | | tf += f = (~u & 0xff) * (v & 0xff); |
| 266 | | r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f; |
| 306 | paldata = palette[color | gaelco3d_texture[(pixeloffs + 4097) & endmask]]; |
| 307 | f = 0x10000 - tf; |
| 308 | r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f; |
| 267 | 309 | |
| 268 | | paldata = palette[color | gaelco3d_texture[(pixeloffs + 4097) & endmask]]; |
| 269 | | f = 0x10000 - tf; |
| 270 | | r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f; |
| 271 | | |
| 272 | | dest[x] = ((r >> 16) & 0x7c00) | ((g >> 16) & 0x03e0) | (b >> 16); |
| 273 | | zbuf[x] = zbufval; |
| 274 | | } |
| 275 | | #endif |
| 276 | | /* advance texture params to the next pixel */ |
| 277 | | uoz += uoz_step; |
| 278 | | voz += voz_step; |
| 279 | | } |
| 280 | | } |
| 310 | dest[x] = ((r >> 16) & 0x7c00) | ((g >> 16) & 0x03e0) | (b >> 16); |
| 311 | zbuf[x] = zbufval; |
| 281 | 312 | } |
| 313 | } |
| 282 | 314 | |
| 283 | | /* general case: non-alpha blended */ |
| 284 | | else if (color != 0x7f00) |
| 315 | /* advance texture params to the next pixel */ |
| 316 | uoz += uoz_step; |
| 317 | voz += voz_step; |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | |
| 322 | static void render_normal(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid) |
| 323 | { |
| 324 | poly_extra_data *extra = poly->extra; |
| 325 | mame_bitmap *bitmap = destbase; |
| 326 | UINT16 *dest = BITMAP_ADDR16(bitmap, scanline, 0); |
| 327 | UINT16 *zbuf = BITMAP_ADDR16(zbuffer, scanline, 0); |
| 328 | float ooz_dx = extra->ooz_dx; |
| 329 | float uoz_dx = extra->uoz_dx; |
| 330 | float voz_dx = extra->voz_dx; |
| 331 | float ooz = extra->ooz_base + scanline * extra->ooz_dy + startx * ooz_dx; |
| 332 | float uoz = extra->uoz_base + scanline * extra->uoz_dy + startx * uoz_dx; |
| 333 | float voz = extra->voz_base + scanline * extra->voz_dy + startx * voz_dx; |
| 334 | offs_t endmask = gaelco3d_texture_size - 1; |
| 335 | UINT16 color = extra->color; |
| 336 | UINT32 tex = extra->tex; |
| 337 | float z0 = extra->z0; |
| 338 | int x; |
| 339 | |
| 340 | for (x = startx; x < stopx; x++) |
| 341 | { |
| 342 | if (ooz > 0) |
| 343 | { |
| 344 | /* compute Z and check the Z buffer value first */ |
| 345 | float z = 1.0f / ooz; |
| 346 | int zbufval = (int)(z0 * z); |
| 347 | if (zbufval < zbuf[x] || zbufval < 0) |
| 285 | 348 | { |
| 286 | | /* loop over scanlines */ |
| 287 | | for (y = scans->sy; y <= scans->ey; y++) |
| 349 | int pixeloffs, u, v; |
| 350 | |
| 351 | if (!BILINEAR_FILTER) |
| 288 | 352 | { |
| 289 | | const struct poly_scanline *scan = &scans->scanline[y - scans->sy]; |
| 290 | | UINT16 *dest = BITMAP_ADDR16(screenbits, midy - y, midx); |
| 291 | | UINT16 *zbuf = BITMAP_ADDR16(zbuffer, midy - y, midx); |
| 292 | | float ooz = ooz_dy * y + scan->sx * ooz_dx + ooz_base; |
| 293 | | float uoz = uoz_dy * y + scan->sx * uoz_dx + uoz_base; |
| 294 | | float voz = voz_dy * y + scan->sx * voz_dx + voz_base; |
| 295 | | |
| 296 | | for (x = scan->sx; x <= scan->ex; x++) |
| 353 | u = (int)(uoz * z + 0.5f); v = (int)(voz * z + 0.5f); |
| 354 | pixeloffs = (tex + v * 4096 + u) & endmask; |
| 355 | if (pixeloffs >= gaelco3d_texmask_size || !gaelco3d_texmask[pixeloffs]) |
| 297 | 356 | { |
| 298 | | if (ooz > 0) |
| 299 | | { |
| 300 | | /* compute Z and check the Z buffer value first */ |
| 301 | | float z = 1.0f / ooz; |
| 302 | | zbufval = (int)(z0 * z); |
| 303 | | if (zbufval < zbuf[x] || zbufval < 0) |
| 304 | | { |
| 305 | | #if (!BILINEAR_FILTER) |
| 306 | | u = (int)(uoz * z + 0.5); v = (int)(voz * z + 0.5); |
| 307 | | pixeloffs = (tex + v * 4096 + u) & endmask; |
| 308 | | if (pixeloffs >= gaelco3d_texmask_size || !gaelco3d_texmask[pixeloffs]) |
| 309 | | { |
| 310 | | dest[x] = palette[color | gaelco3d_texture[pixeloffs]]; |
| 311 | | zbuf[x] = (zbufval < 0) ? -zbufval : zbufval; |
| 312 | | } |
| 313 | | #else |
| 314 | | u = (int)(uoz * z * 256.0); v = (int)(voz * z * 256.0); |
| 315 | | pixeloffs = (tex + (v >> 8) * 4096 + (u >> 8)) & endmask; |
| 316 | | if (pixeloffs >= gaelco3d_texmask_size || !gaelco3d_texmask[pixeloffs]) |
| 317 | | { |
| 318 | | paldata = palette[color | gaelco3d_texture[pixeloffs]]; |
| 319 | | tf = f = (~u & 0xff) * (~v & 0xff); |
| 320 | | r = (paldata & 0x7c00) * f; g = (paldata & 0x03e0) * f; b = (paldata & 0x001f) * f; |
| 357 | dest[x] = palette[color | gaelco3d_texture[pixeloffs]]; |
| 358 | zbuf[x] = (zbufval < 0) ? -zbufval : zbufval; |
| 359 | } |
| 360 | } |
| 361 | else |
| 362 | { |
| 363 | u = (int)(uoz * z * 256.0f); v = (int)(voz * z * 256.0f); |
| 364 | pixeloffs = (tex + (v >> 8) * 4096 + (u >> 8)) & endmask; |
| 365 | if (pixeloffs >= gaelco3d_texmask_size || !gaelco3d_texmask[pixeloffs]) |
| 366 | { |
| 367 | int paldata, r, g, b, f, tf; |
| 321 | 368 | |
| 322 | | paldata = palette[color | gaelco3d_texture[(pixeloffs + 1) & endmask]]; |
| 323 | | tf += f = (u & 0xff) * (~v & 0xff); |
| 324 | | r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f; |
| 369 | paldata = palette[color | gaelco3d_texture[pixeloffs]]; |
| 370 | tf = f = (~u & 0xff) * (~v & 0xff); |
| 371 | r = (paldata & 0x7c00) * f; g = (paldata & 0x03e0) * f; b = (paldata & 0x001f) * f; |
| 325 | 372 | |
| 326 | | paldata = palette[color | gaelco3d_texture[(pixeloffs + 4096) & endmask]]; |
| 327 | | tf += f = (~u & 0xff) * (v & 0xff); |
| 328 | | r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f; |
| 373 | paldata = palette[color | gaelco3d_texture[(pixeloffs + 1) & endmask]]; |
| 374 | tf += f = (u & 0xff) * (~v & 0xff); |
| 375 | r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f; |
| 329 | 376 | |
| 330 | | paldata = palette[color | gaelco3d_texture[(pixeloffs + 4097) & endmask]]; |
| 331 | | f = 0x10000 - tf; |
| 332 | | r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f; |
| 377 | paldata = palette[color | gaelco3d_texture[(pixeloffs + 4096) & endmask]]; |
| 378 | tf += f = (~u & 0xff) * (v & 0xff); |
| 379 | r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f; |
| 333 | 380 | |
| 334 | | dest[x] = ((r >> 16) & 0x7c00) | ((g >> 16) & 0x03e0) | (b >> 16); |
| 335 | | zbuf[x] = (zbufval < 0) ? -zbufval : zbufval; |
| 336 | | } |
| 337 | | #endif |
| 338 | | } |
| 339 | | } |
| 381 | paldata = palette[color | gaelco3d_texture[(pixeloffs + 4097) & endmask]]; |
| 382 | f = 0x10000 - tf; |
| 383 | r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f; |
| 340 | 384 | |
| 341 | | /* advance texture params to the next pixel */ |
| 342 | | ooz += ooz_dx; |
| 343 | | uoz += uoz_dx; |
| 344 | | voz += voz_dx; |
| 385 | dest[x] = ((r >> 16) & 0x7c00) | ((g >> 16) & 0x03e0) | (b >> 16); |
| 386 | zbuf[x] = (zbufval < 0) ? -zbufval : zbufval; |
| 345 | 387 | } |
| 346 | 388 | } |
| 347 | 389 | } |
| 390 | } |
| 348 | 391 | |
| 349 | | /* color 0x7f seems to be hard-coded as a 50% alpha blend */ |
| 350 | | else |
| 392 | /* advance texture params to the next pixel */ |
| 393 | ooz += ooz_dx; |
| 394 | uoz += uoz_dx; |
| 395 | voz += voz_dx; |
| 396 | } |
| 397 | } |
| 398 | |
| 399 | |
| 400 | static void render_alphablend(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid) |
| 401 | { |
| 402 | poly_extra_data *extra = poly->extra; |
| 403 | mame_bitmap *bitmap = destbase; |
| 404 | UINT16 *dest = BITMAP_ADDR16(bitmap, scanline, 0); |
| 405 | UINT16 *zbuf = BITMAP_ADDR16(zbuffer, scanline, 0); |
| 406 | float ooz_dx = extra->ooz_dx; |
| 407 | float uoz_dx = extra->uoz_dx; |
| 408 | float voz_dx = extra->voz_dx; |
| 409 | float ooz = extra->ooz_base + extra->ooz_dy * scanline + startx * ooz_dx; |
| 410 | float uoz = extra->uoz_base + extra->uoz_dy * scanline + startx * uoz_dx; |
| 411 | float voz = extra->voz_base + extra->voz_dy * scanline + startx * voz_dx; |
| 412 | offs_t endmask = gaelco3d_texture_size - 1; |
| 413 | UINT16 color = extra->color; |
| 414 | UINT32 tex = extra->tex; |
| 415 | float z0 = extra->z0; |
| 416 | int x; |
| 417 | |
| 418 | for (x = startx; x < stopx; x++) |
| 419 | { |
| 420 | if (ooz > 0) |
| 421 | { |
| 422 | /* compute Z and check the Z buffer value first */ |
| 423 | float z = 1.0f / ooz; |
| 424 | int zbufval = (int)(z0 * z); |
| 425 | if (zbufval < zbuf[x] || zbufval < 0) |
| 351 | 426 | { |
| 352 | | /* loop over scanlines */ |
| 353 | | for (y = scans->sy; y <= scans->ey; y++) |
| 427 | int pixeloffs, u, v; |
| 428 | |
| 429 | if (!BILINEAR_FILTER) |
| 354 | 430 | { |
| 355 | | const struct poly_scanline *scan = &scans->scanline[y - scans->sy]; |
| 356 | | UINT16 *dest = BITMAP_ADDR16(screenbits, midy - y, midx); |
| 357 | | UINT16 *zbuf = BITMAP_ADDR16(zbuffer, midy - y, midx); |
| 358 | | float ooz = ooz_dy * y + scan->sx * ooz_dx + ooz_base; |
| 359 | | float uoz = uoz_dy * y + scan->sx * uoz_dx + uoz_base; |
| 360 | | float voz = voz_dy * y + scan->sx * voz_dx + voz_base; |
| 361 | | |
| 362 | | for (x = scan->sx; x <= scan->ex; x++) |
| 431 | u = (int)(uoz * z + 0.5f); v = (int)(voz * z + 0.5f); |
| 432 | pixeloffs = (tex + v * 4096 + u) & endmask; |
| 433 | if (pixeloffs >= gaelco3d_texmask_size || !gaelco3d_texmask[pixeloffs]) |
| 363 | 434 | { |
| 364 | | if (ooz > 0) |
| 365 | | { |
| 366 | | /* compute Z and check the Z buffer value first */ |
| 367 | | float z = 1.0f / ooz; |
| 368 | | zbufval = (int)(z0 * z); |
| 369 | | if (zbufval < zbuf[x] || zbufval < 0) |
| 370 | | { |
| 371 | | #if (!BILINEAR_FILTER) |
| 372 | | u = (int)(uoz * z + 0.5); v = (int)(voz * z + 0.5); |
| 373 | | pixeloffs = (tex + v * 4096 + u) & endmask; |
| 374 | | if (pixeloffs >= gaelco3d_texmask_size || !gaelco3d_texmask[pixeloffs]) |
| 375 | | { |
| 376 | | dest[x] = ((dest[x] >> 1) & 0x3def) + ((palette[color | gaelco3d_texture[pixeloffs]] >> 1) & 0x3def); |
| 377 | | zbuf[x] = (zbufval < 0) ? -zbufval : zbufval; |
| 378 | | } |
| 379 | | #else |
| 380 | | u = (int)(uoz * z * 256.0); v = (int)(voz * z * 256.0); |
| 381 | | pixeloffs = (tex + (v >> 8) * 4096 + (u >> 8)) & endmask; |
| 382 | | if (pixeloffs >= gaelco3d_texmask_size || !gaelco3d_texmask[pixeloffs]) |
| 383 | | { |
| 384 | | paldata = palette[color | gaelco3d_texture[pixeloffs]]; |
| 385 | | tf = f = (~u & 0xff) * (~v & 0xff); |
| 386 | | r = (paldata & 0x7c00) * f; g = (paldata & 0x03e0) * f; b = (paldata & 0x001f) * f; |
| 435 | dest[x] = ((dest[x] >> 1) & 0x3def) + ((palette[color | gaelco3d_texture[pixeloffs]] >> 1) & 0x3def); |
| 436 | zbuf[x] = (zbufval < 0) ? -zbufval : zbufval; |
| 437 | } |
| 438 | } |
| 439 | else |
| 440 | { |
| 441 | u = (int)(uoz * z * 256.0f); v = (int)(voz * z * 256.0f); |
| 442 | pixeloffs = (tex + (v >> 8) * 4096 + (u >> 8)) & endmask; |
| 443 | if (pixeloffs >= gaelco3d_texmask_size || !gaelco3d_texmask[pixeloffs]) |
| 444 | { |
| 445 | int paldata, r, g, b, f, tf; |
| 387 | 446 | |
| 388 | | paldata = palette[color | gaelco3d_texture[(pixeloffs + 1) & endmask]]; |
| 389 | | tf += f = (u & 0xff) * (~v & 0xff); |
| 390 | | r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f; |
| 447 | paldata = palette[color | gaelco3d_texture[pixeloffs]]; |
| 448 | tf = f = (~u & 0xff) * (~v & 0xff); |
| 449 | r = (paldata & 0x7c00) * f; g = (paldata & 0x03e0) * f; b = (paldata & 0x001f) * f; |
| 391 | 450 | |
| 392 | | paldata = palette[color | gaelco3d_texture[(pixeloffs + 4096) & endmask]]; |
| 393 | | tf += f = (~u & 0xff) * (v & 0xff); |
| 394 | | r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f; |
| 451 | paldata = palette[color | gaelco3d_texture[(pixeloffs + 1) & endmask]]; |
| 452 | tf += f = (u & 0xff) * (~v & 0xff); |
| 453 | r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f; |
| 395 | 454 | |
| 396 | | paldata = palette[color | gaelco3d_texture[(pixeloffs + 4097) & endmask]]; |
| 397 | | f = 0x10000 - tf; |
| 398 | | r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f; |
| 455 | paldata = palette[color | gaelco3d_texture[(pixeloffs + 4096) & endmask]]; |
| 456 | tf += f = (~u & 0xff) * (v & 0xff); |
| 457 | r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f; |
| 399 | 458 | |
| 400 | | paldata = ((r >> 17) & 0x7c00) | ((g >> 17) & 0x03e0) | (b >> 17); |
| 401 | | dest[x] = ((dest[x] >> 1) & 0x3def) + (paldata & 0x3def); |
| 402 | | zbuf[x] = (zbufval < 0) ? -zbufval : zbufval; |
| 403 | | } |
| 404 | | #endif |
| 405 | | } |
| 406 | | } |
| 459 | paldata = palette[color | gaelco3d_texture[(pixeloffs + 4097) & endmask]]; |
| 460 | f = 0x10000 - tf; |
| 461 | r += (paldata & 0x7c00) * f; g += (paldata & 0x03e0) * f; b += (paldata & 0x001f) * f; |
| 407 | 462 | |
| 408 | | /* advance texture params to the next pixel */ |
| 409 | | ooz += ooz_dx; |
| 410 | | uoz += uoz_dx; |
| 411 | | voz += voz_dx; |
| 463 | paldata = ((r >> 17) & 0x7c00) | ((g >> 17) & 0x03e0) | (b >> 17); |
| 464 | dest[x] = ((dest[x] >> 1) & 0x3def) + (paldata & 0x3def); |
| 465 | zbuf[x] = (zbufval < 0) ? -zbufval : zbufval; |
| 412 | 466 | } |
| 413 | 467 | } |
| 414 | 468 | } |
| 415 | 469 | } |
| 416 | 470 | |
| 417 | | /* copy vertex 2 to vertex 1 -- this hardware draws in fans */ |
| 418 | | vert[1] = vert[2]; |
| 471 | /* advance texture params to the next pixel */ |
| 472 | ooz += ooz_dx; |
| 473 | uoz += uoz_dx; |
| 474 | voz += voz_dx; |
| 419 | 475 | } |
| 420 | | |
| 421 | | polygons++; |
| 422 | | return NULL; |
| 423 | 476 | } |
| 424 | 477 | |
| 425 | 478 | |
| 426 | | |
| 427 | 479 | /************************************* |
| 428 | 480 | * |
| 429 | 481 | * Scene rendering |
| r1185 | r1186 | |
| 433 | 485 | void gaelco3d_render(void) |
| 434 | 486 | { |
| 435 | 487 | /* wait for any queued stuff to complete */ |
| 436 | | osd_work_queue_wait(work_queue, 100 * osd_ticks_per_second()); |
| 488 | poly_wait(poly, "Time to render"); |
| 437 | 489 | |
| 438 | | /* Every 2nd frame video data is written. Only skip if two frames are skipped */ |
| 439 | | this_skip = video_skip_this_frame(); |
| 440 | | |
| 441 | 490 | #if DISPLAY_STATS |
| 442 | 491 | { |
| 443 | 492 | int scan = video_screen_get_vpos(0); |
| r1185 | r1186 | |
| 445 | 494 | } |
| 446 | 495 | #endif |
| 447 | 496 | |
| 448 | | polydata_start = polydata_count = 0; |
| 497 | polydata_count = 0; |
| 449 | 498 | polygons = 0; |
| 450 | 499 | lastscan = -1; |
| 451 | 500 | } |
| r1185 | r1186 | |
| 466 | 515 | fatalerror("Out of polygon buffer space!"); |
| 467 | 516 | |
| 468 | 517 | /* if we've accumulated a completed poly set of data, queue it */ |
| 469 | | if (!this_skip) |
| 518 | if (!video_skip_this_frame()) |
| 470 | 519 | { |
| 471 | | int index = polydata_count - 1 - polydata_start; |
| 472 | | if (index >= 17 && (index % 2) == 1 && IS_POLYEND(data)) |
| 520 | if (polydata_count >= 18 && (polydata_count % 2) == 1 && IS_POLYEND(polydata_buffer[polydata_count - 2])) |
| 473 | 521 | { |
| 474 | | osd_work_item_queue(work_queue, render_poly, &polydata_buffer[polydata_start], WORK_ITEM_FLAG_AUTO_RELEASE); |
| 475 | | polydata_start += index + 2; |
| 522 | render_poly(&polydata_buffer[0]); |
| 523 | polydata_count = 0; |
| 476 | 524 | } |
| 477 | 525 | video_changed = TRUE; |
| 478 | 526 | } |
| r1185 | r1186 | |
| 490 | 538 | * |
| 491 | 539 | *************************************/ |
| 492 | 540 | |
| 493 | | INLINE void update_palette_entry(offs_t offset, UINT16 data) |
| 494 | | { |
| 495 | | int r = (data >> 10) & 0x1f; |
| 496 | | int g = (data >> 5) & 0x1f; |
| 497 | | int b = (data >> 0) & 0x1f; |
| 498 | | r = (r << 3) | (r >> 2); |
| 499 | | g = (g << 3) | (g >> 2); |
| 500 | | b = (b << 3) | (b >> 2); |
| 501 | | palette[offset] = data; |
| 502 | | } |
| 503 | | |
| 504 | | |
| 505 | 541 | WRITE16_HANDLER( gaelco3d_paletteram_w ) |
| 506 | 542 | { |
| 543 | poly_wait(poly, "Palette change"); |
| 507 | 544 | COMBINE_DATA(&paletteram16[offset]); |
| 508 | | update_palette_entry(offset, paletteram16[offset]); |
| 545 | palette[offset] = paletteram16[offset]; |
| 509 | 546 | } |
| 510 | 547 | |
| 511 | 548 | |
| 512 | 549 | WRITE32_HANDLER( gaelco3d_paletteram_020_w ) |
| 513 | 550 | { |
| 551 | poly_wait(poly, "Palette change"); |
| 514 | 552 | COMBINE_DATA(&paletteram32[offset]); |
| 515 | | update_palette_entry(offset*2+0, paletteram32[offset] >> 16); |
| 516 | | update_palette_entry(offset*2+1, paletteram32[offset]); |
| 553 | palette[offset*2+0] = paletteram32[offset] >> 16; |
| 554 | palette[offset*2+1] = paletteram32[offset]; |
| 517 | 555 | } |
| 518 | 556 | |
| 519 | 557 | |
| r1185 | r1186 | |
| 567 | 605 | else |
| 568 | 606 | { |
| 569 | 607 | if (video_changed) |
| 570 | | copybitmap(bitmap, screenbits, 0,0, 0,0, cliprect, TRANSPARENCY_NONE, 0); |
| 608 | copybitmap(bitmap, screenbits, 0,1, 0,0, cliprect, TRANSPARENCY_NONE, 0); |
| 571 | 609 | ret = video_changed; |
| 572 | 610 | video_changed = FALSE; |
| 573 | 611 | } |
src/mame/video/namcos22.c
| r1185 | r1186 | |
| 35 | 35 | |
| 36 | 36 | #include "driver.h" |
| 37 | 37 | #include "namcos22.h" |
| 38 | #include "video/polynew.h" |
| 38 | 39 | #include <math.h> |
| 39 | 40 | |
| 40 | 41 | static int mbSuperSystem22; /* used to conditionally support Super System22-specific features */ |
| 41 | 42 | static int mbSpotlightEnable; |
| 42 | 43 | static UINT16 *namcos22_czram[4]; |
| 43 | 44 | |
| 45 | static poly_manager *poly; |
| 46 | |
| 44 | 47 | static UINT8 |
| 45 | 48 | nthbyte( const UINT32 *pSource, int offs ) |
| 46 | 49 | { |
| r1185 | r1186 | |
| 80 | 83 | static void |
| 81 | 84 | UpdateVideoMixer( void ) |
| 82 | 85 | { |
| 86 | poly_wait(poly, "UpdateVideoMixer"); |
| 83 | 87 | memset( &mixer, 0, sizeof(mixer) ); |
| 84 | 88 | if( mbSuperSystem22 ) |
| 85 | 89 | { |
| r1185 | r1186 | |
| 150 | 154 | } |
| 151 | 155 | } |
| 152 | 156 | |
| 153 | | static UINT8 |
| 157 | INLINE UINT8 |
| 154 | 158 | Clamp256( int v ) |
| 155 | 159 | { |
| 156 | 160 | if( v<0 ) |
| r1185 | r1186 | |
| 237 | 241 | return mpTextureTileData[(tile<<8)|mXYAttrToPixel[mpTextureTileMapAttr[offs]][x&0xf][y&0xf]]; |
| 238 | 242 | } /* texel */ |
| 239 | 243 | |
| 240 | | static void renderscanline_uvi_full(running_machine *machine, mame_bitmap *bitmap, const rectangle *clip, const edge *e1, const edge *e2, int sy, int color, int bn, UINT16 flags, int cmode ) |
| 244 | typedef struct _poly_extra_data poly_extra_data; |
| 245 | struct _poly_extra_data |
| 241 | 246 | { |
| 247 | int color; |
| 248 | int bn; |
| 249 | UINT16 flags; |
| 250 | int cmode; |
| 251 | const UINT8 *source; /* sprites */ |
| 252 | int z; |
| 253 | int alpha; |
| 254 | int prioverchar; |
| 255 | int line_modulo; |
| 256 | }; |
| 257 | |
| 258 | static void renderscanline_uvi_full(void *dest, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid) |
| 259 | { |
| 260 | mame_bitmap *bitmap = dest; |
| 261 | poly_extra_data *extra = poly->extra; |
| 262 | UINT16 flags = extra->flags; |
| 263 | int cmode = extra->cmode; |
| 264 | int bn = extra->bn; |
| 242 | 265 | int fadeEnable = (mixer.target&1) && mixer.fadeFactor; |
| 243 | | int fogDisable = color&0x80; |
| 244 | | const pen_t *pens = &machine->pens[(color&0x7f)<<8]; |
| 245 | | int fogDensity = 0; |
| 266 | int fogDisable = extra->color&0x80; |
| 267 | const pen_t *pens = &Machine->pens[(extra->color&0x7f)<<8]; |
| 268 | int fogDensity = 0; |
| 246 | 269 | int prioverchar = (cmode&7)==1; |
| 247 | 270 | |
| 248 | | if( e1->x > e2->x ) |
| 249 | | { |
| 250 | | SWAP(e1,e2); |
| 251 | | } |
| 271 | const UINT8 *pCharPri = BITMAP_ADDR8(priority_bitmap, scanline, 0); |
| 272 | UINT32 *pDest = BITMAP_ADDR32(bitmap, scanline, 0); |
| 273 | float u = poly_param_value(startx, scanline, 0, poly); /* u/z */ |
| 274 | float v = poly_param_value(startx, scanline, 1, poly); /* v/z */ |
| 275 | float i = poly_param_value(startx, scanline, 2, poly); /* i/z */ |
| 276 | float z = poly_param_value(startx, scanline, 3, poly); /* 1/z */ |
| 277 | float du = poly->param[0].dpdx; |
| 278 | float dv = poly->param[1].dpdx; |
| 279 | float di = poly->param[2].dpdx; |
| 280 | float dz = poly->param[3].dpdx; |
| 281 | int x; |
| 282 | bn *= 0x1000; |
| 252 | 283 | |
| 284 | if( mbSuperSystem22 ) |
| 253 | 285 | { |
| 254 | | const UINT8 *pCharPri = BITMAP_ADDR8(priority_bitmap, sy, 0); |
| 255 | | UINT32 *pDest = BITMAP_ADDR32(bitmap, sy, 0); |
| 256 | | int x0 = (int)e1->x; |
| 257 | | int x1 = (int)e2->x; |
| 258 | | int w = x1-x0; |
| 259 | | if( w ) |
| 286 | if( !fogDisable ) |
| 260 | 287 | { |
| 261 | | float u = e1->u; /* u/z */ |
| 262 | | float v = e1->v; /* v/z */ |
| 263 | | float i = e1->i; /* i/z */ |
| 264 | | float z = e1->z; /* 1/z */ |
| 265 | | float oow = 1.0f / w; |
| 266 | | float du = (e2->u - e1->u)*oow; |
| 267 | | float dv = (e2->v - e1->v)*oow; |
| 268 | | float dz = (e2->z - e1->z)*oow; |
| 269 | | float di = (e2->i - e1->i)*oow; |
| 270 | | int x, crop; |
| 271 | | crop = clip->min_x - x0; |
| 272 | | if( crop>0 ) |
| 288 | int cz = flags>>8; |
| 289 | static const int cztype_remap[4] = { 3,1,2,0 }; |
| 290 | int cztype = flags&3; |
| 291 | if( nthword(namcos22_czattr,4)&(0x4000>>(cztype*4)) ) |
| 273 | 292 | { |
| 274 | | u += crop*du; |
| 275 | | v += crop*dv; |
| 276 | | i += crop*di; |
| 277 | | z += crop*dz; |
| 278 | | x0 = clip->min_x; |
| 279 | | } |
| 280 | | if( x1>clip->max_x ) |
| 281 | | { |
| 282 | | x1 = clip->max_x; |
| 283 | | } |
| 284 | | bn *= 0x1000; |
| 285 | | |
| 286 | | if( mbSuperSystem22 ) |
| 287 | | { |
| 288 | | if( !fogDisable ) |
| 293 | int fogDelta = (INT16)nthword(namcos22_czattr, cztype); |
| 294 | // if( fogDelta == 0x8000 ) fogDelta = -0x7fff; |
| 295 | //cz = Clamp256(cz+fogDelta); |
| 296 | fogDensity = fogDelta + namcos22_czram[cztype_remap[cztype]][cz]; |
| 297 | if( fogDensity<0x0000 ) |
| 289 | 298 | { |
| 290 | | int cz = flags>>8; |
| 291 | | static const int cztype_remap[4] = { 3,1,2,0 }; |
| 292 | | int cztype = flags&3; |
| 293 | | if( nthword(namcos22_czattr,4)&(0x4000>>(cztype*4)) ) |
| 294 | | { |
| 295 | | int fogDelta = (INT16)nthword(namcos22_czattr, cztype); |
| 296 | | // if( fogDelta == 0x8000 ) fogDelta = -0x7fff; |
| 297 | | //cz = Clamp256(cz+fogDelta); |
| 298 | | fogDensity = fogDelta + namcos22_czram[cztype_remap[cztype]][cz]; |
| 299 | | if( fogDensity<0x0000 ) |
| 300 | | { |
| 301 | | fogDensity = 0x0000; |
| 302 | | } |
| 303 | | else if( fogDensity>0x1fff ) |
| 304 | | { |
| 305 | | fogDensity = 0x1fff; |
| 306 | | } |
| 307 | | } |
| 299 | fogDensity = 0x0000; |
| 308 | 300 | } |
| 309 | | } |
| 310 | | else |
| 311 | | { |
| 312 | | fogDisable = 1; |
| 313 | | } |
| 314 | | |
| 315 | | for( x=x0; x<x1; x++ ) |
| 316 | | { |
| 317 | | if( pCharPri[x]==0 || prioverchar ) |
| 301 | else if( fogDensity>0x1fff ) |
| 318 | 302 | { |
| 319 | | float ooz = 1.0f/z; |
| 320 | | int pen = texel((int)(u * ooz),bn+(int)(v*ooz)); |
| 321 | | switch( cmode ) |
| 322 | | { |
| 323 | | case 0x2: |
| 324 | | pen = 0xe0|(pen>>4); |
| 325 | | break; |
| 326 | | case 0x3: |
| 327 | | pen = 0xe0|(pen&0xf); |
| 328 | | break; |
| 329 | | case 0x4: |
| 330 | | pen = 0xec|(pen>>6); |
| 331 | | break; |
| 332 | | case 0x5: |
| 333 | | pen = 0xec|((pen>>4)&3); |
| 334 | | break; |
| 335 | | case 0x6: |
| 336 | | pen = 0xec|((pen>>2)&3); |
| 337 | | break; |
| 338 | | case 0x7: |
| 339 | | pen = 0xec|(pen&3); |
| 340 | | break; |
| 341 | | case 0xa: |
| 342 | | pen = 0xf0|(pen>>4); |
| 343 | | break; |
| 344 | | case 0xb: |
| 345 | | pen = 0xf0|(pen&0xf); |
| 346 | | break; |
| 347 | | case 0xc: |
| 348 | | pen = 0xfc|(pen>>6); |
| 349 | | break; |
| 350 | | case 0xd: |
| 351 | | pen = 0xfc|((pen>>4)&3); |
| 352 | | break; |
| 353 | | case 0xe: |
| 354 | | pen = 0xfc|((pen>>2)&3); |
| 355 | | break; |
| 356 | | case 0xf: |
| 357 | | pen = 0xfc|(pen&3); |
| 358 | | break; |
| 359 | | default: |
| 360 | | break; |
| 361 | | } |
| 362 | | |
| 363 | | { |
| 364 | | UINT32 rgb = pens[pen]; |
| 365 | | int shade = i*ooz; |
| 366 | | int r = rgb>>16; |
| 367 | | int g = (rgb>>8)&0xff; |
| 368 | | int b = rgb&0xff; |
| 369 | | r = r*shade/0x40; |
| 370 | | if( r>0xff ) r = 0xff; |
| 371 | | g = g*shade/0x40; |
| 372 | | if( g>0xff ) g = 0xff; |
| 373 | | b = b*shade/0x40; |
| 374 | | if( b>0xff ) b = 0xff; |
| 375 | | if( !fogDisable ) |
| 376 | | { |
| 377 | | int fogDensity2 = 0x2000 - fogDensity; |
| 378 | | r = (r*fogDensity2 + fogDensity*mixer.rFogColor)>>13; |
| 379 | | g = (g*fogDensity2 + fogDensity*mixer.gFogColor)>>13; |
| 380 | | b = (b*fogDensity2 + fogDensity*mixer.bFogColor)>>13; |
| 381 | | } |
| 382 | | if( fadeEnable ) |
| 383 | | { |
| 384 | | int fade2 = 0x100-mixer.fadeFactor; |
| 385 | | r = (r*fade2+mixer.fadeFactor*mixer.rFadeColor)>>8; |
| 386 | | g = (g*fade2+mixer.fadeFactor*mixer.gFadeColor)>>8; |
| 387 | | b = (b*fade2+mixer.fadeFactor*mixer.bFadeColor)>>8; |
| 388 | | } |
| 389 | | if( prioverchar ) |
| 390 | | { |
| 391 | | UINT32 color = pDest[x]; |
| 392 | | int tr = color>>16; |
| 393 | | int tg = (color>>8)&0xff; |
| 394 | | int tb = color&0xff; |
| 395 | | int trans1 = 0x100 - mixer.poly_translucency; |
| 396 | | r = (tr*mixer.poly_translucency + r*trans1)>>8; |
| 397 | | g = (tg*mixer.poly_translucency + g*trans1)>>8; |
| 398 | | b = (tb*mixer.poly_translucency + b*trans1)>>8; |
| 399 | | } |
| 400 | | rgb = (r<<16)|(g<<8)|b; |
| 401 | | pDest[x] = rgb; |
| 402 | | } |
| 303 | fogDensity = 0x1fff; |
| 403 | 304 | } |
| 404 | | |
| 405 | | u += du; |
| 406 | | v += dv; |
| 407 | | i += di; |
| 408 | | z += dz; |
| 409 | 305 | } |
| 410 | 306 | } |
| 411 | 307 | } |
| 412 | | } /* renderscanline_uvi_full */ |
| 413 | | |
| 414 | | static void rendertri(running_machine *machine, |
| 415 | | mame_bitmap *bitmap, |
| 416 | | const rectangle *clip, |
| 417 | | int color, |
| 418 | | int bn, |
| 419 | | const vertex *v0, |
| 420 | | const vertex *v1, |
| 421 | | const vertex *v2, |
| 422 | | UINT16 flags, |
| 423 | | int cmode ) |
| 424 | | { |
| 425 | | int dy,ystart,yend,crop; |
| 426 | | |
| 427 | | /* first, sort so that v0->y <= v1->y <= v2->y */ |
| 428 | | for(;;) |
| 308 | else |
| 429 | 309 | { |
| 430 | | if( v0->y > v1->y ) |
| 431 | | { |
| 432 | | SWAP(v0,v1); |
| 433 | | } |
| 434 | | else if( v1->y > v2->y ) |
| 435 | | { |
| 436 | | SWAP(v1,v2); |
| 437 | | } |
| 438 | | else |
| 439 | | { |
| 440 | | break; |
| 441 | | } |
| 310 | fogDisable = 1; |
| 442 | 311 | } |
| 443 | 312 | |
| 444 | | ystart = v0->y; |
| 445 | | yend = v2->y; |
| 446 | | dy = yend-ystart; |
| 447 | | if( dy ) |
| 313 | for( x=startx; x<stopx; x++ ) |
| 448 | 314 | { |
| 449 | | int y; |
| 450 | | edge e1; /* short edge (top and bottom) */ |
| 451 | | edge e2; /* long (common) edge */ |
| 452 | | |
| 453 | | float oody = 1.0f / (float)dy; |
| 454 | | |
| 455 | | float dx2dy = (v2->x - v0->x)*oody; |
| 456 | | float du2dy = (v2->u - v0->u)*oody; |
| 457 | | float dv2dy = (v2->v - v0->v)*oody; |
| 458 | | float di2dy = (v2->i - v0->i)*oody; |
| 459 | | float dz2dy = (v2->z - v0->z)*oody; |
| 460 | | |
| 461 | | float dx1dy; |
| 462 | | float du1dy; |
| 463 | | float dv1dy; |
| 464 | | float di1dy; |
| 465 | | float dz1dy; |
| 466 | | |
| 467 | | e2.x = v0->x; |
| 468 | | e2.u = v0->u; |
| 469 | | e2.v = v0->v; |
| 470 | | e2.i = v0->i; |
| 471 | | e2.z = v0->z; |
| 472 | | crop = clip->min_y - ystart; |
| 473 | | if( crop>0 ) |
| 315 | if( pCharPri[x]==0 || prioverchar ) |
| 474 | 316 | { |
| 475 | | e2.x += dx2dy*crop; |
| 476 | | e2.u += du2dy*crop; |
| 477 | | e2.v += dv2dy*crop; |
| 478 | | e2.i += di2dy*crop; |
| 479 | | e2.z += dz2dy*crop; |
| 480 | | } |
| 481 | | |
| 482 | | ystart = v0->y; |
| 483 | | yend = v1->y; |
| 484 | | dy = yend-ystart; |
| 485 | | |
| 486 | | if( dy ) |
| 487 | | { |
| 488 | | e1.x = v0->x; |
| 489 | | e1.u = v0->u; |
| 490 | | e1.v = v0->v; |
| 491 | | e1.i = v0->i; |
| 492 | | e1.z = v0->z; |
| 493 | | |
| 494 | | oody = 1.0f / (float)dy; |
| 495 | | dx1dy = (v1->x - v0->x)*oody; |
| 496 | | du1dy = (v1->u - v0->u)*oody; |
| 497 | | dv1dy = (v1->v - v0->v)*oody; |
| 498 | | di1dy = (v1->i - v0->i)*oody; |
| 499 | | dz1dy = (v1->z - v0->z)*oody; |
| 500 | | |
| 501 | | crop = clip->min_y - ystart; |
| 502 | | if( crop>0 ) |
| 317 | float ooz = 1.0f/z; |
| 318 | int pen = texel((int)(u * ooz),bn+(int)(v*ooz)); |
| 319 | switch( cmode ) |
| 503 | 320 | { |
| 504 | | e1.x += dx1dy*crop; |
| 505 | | e1.u += du1dy*crop; |
| 506 | | e1.v += dv1dy*crop; |
| 507 | | e1.i += di1dy*crop; |
| 508 | | e1.z += dz1dy*crop; |
| 509 | | ystart = clip->min_y; |
| 321 | case 0x2: |
| 322 | pen = 0xe0|(pen>>4); |
| 323 | break; |
| 324 | case 0x3: |
| 325 | pen = 0xe0|(pen&0xf); |
| 326 | break; |
| 327 | case 0x4: |
| 328 | pen = 0xec|(pen>>6); |
| 329 | break; |
| 330 | case 0x5: |
| 331 | pen = 0xec|((pen>>4)&3); |
| 332 | break; |
| 333 | case 0x6: |
| 334 | pen = 0xec|((pen>>2)&3); |
| 335 | break; |
| 336 | case 0x7: |
| 337 | pen = 0xec|(pen&3); |
| 338 | break; |
| 339 | case 0xa: |
| 340 | pen = 0xf0|(pen>>4); |
| 341 | break; |
| 342 | case 0xb: |
| 343 | pen = 0xf0|(pen&0xf); |
| 344 | break; |
| 345 | case 0xc: |
| 346 | pen = 0xfc|(pen>>6); |
| 347 | break; |
| 348 | case 0xd: |
| 349 | pen = 0xfc|((pen>>4)&3); |
| 350 | break; |
| 351 | case 0xe: |
| 352 | pen = 0xfc|((pen>>2)&3); |
| 353 | break; |
| 354 | case 0xf: |
| 355 | pen = 0xfc|(pen&3); |
| 356 | break; |
| 357 | default: |
| 358 | break; |
| 510 | 359 | } |
| 511 | | if( yend>clip->max_y ) yend = clip->max_y; |
| 512 | 360 | |
| 513 | | for( y=ystart; y<yend; y++ ) |
| 514 | 361 | { |
| 515 | | renderscanline_uvi_full(machine, bitmap, clip, &e1, &e2, y, color, bn, flags, cmode ); |
| 516 | | |
| 517 | | e2.x += dx2dy; |
| 518 | | e2.u += du2dy; |
| 519 | | e2.v += dv2dy; |
| 520 | | e2.i += di2dy; |
| 521 | | e2.z += dz2dy; |
| 522 | | |
| 523 | | e1.x += dx1dy; |
| 524 | | e1.u += du1dy; |
| 525 | | e1.v += dv1dy; |
| 526 | | e1.i += di1dy; |
| 527 | | e1.z += dz1dy; |
| 362 | UINT32 rgb = pens[pen]; |
| 363 | int shade = i*ooz; |
| 364 | int r = rgb>>16; |
| 365 | int g = (rgb>>8)&0xff; |
| 366 | int b = rgb&0xff; |
| 367 | r = r*shade/0x40; |
| 368 | if( r>0xff ) r = 0xff; |
| 369 | g = g*shade/0x40; |
| 370 | if( g>0xff ) g = 0xff; |
| 371 | b = b*shade/0x40; |
| 372 | if( b>0xff ) b = 0xff; |
| 373 | if( !fogDisable ) |
| 374 | { |
| 375 | int fogDensity2 = 0x2000 - fogDensity; |
| 376 | r = (r*fogDensity2 + fogDensity*mixer.rFogColor)>>13; |
| 377 | g = (g*fogDensity2 + fogDensity*mixer.gFogColor)>>13; |
| 378 | b = (b*fogDensity2 + fogDensity*mixer.bFogColor)>>13; |
| 379 | } |
| 380 | if( fadeEnable ) |
| 381 | { |
| 382 | int fade2 = 0x100-mixer.fadeFactor; |
| 383 | r = (r*fade2+mixer.fadeFactor*mixer.rFadeColor)>>8; |
| 384 | g = (g*fade2+mixer.fadeFactor*mixer.gFadeColor)>>8; |
| 385 | b = (b*fade2+mixer.fadeFactor*mixer.bFadeColor)>>8; |
| 386 | } |
| 387 | if( prioverchar ) |
| 388 | { |
| 389 | UINT32 color = pDest[x]; |
| 390 | int tr = color>>16; |
| 391 | int tg = (color>>8)&0xff; |
| 392 | int tb = color&0xff; |
| 393 | int trans1 = 0x100 - mixer.poly_translucency; |
| 394 | r = (tr*mixer.poly_translucency + r*trans1)>>8; |
| 395 | g = (tg*mixer.poly_translucency + g*trans1)>>8; |
| 396 | b = (tb*mixer.poly_translucency + b*trans1)>>8; |
| 397 | } |
| 398 | rgb = (r<<16)|(g<<8)|b; |
| 399 | pDest[x] = rgb; |
| 528 | 400 | } |
| 529 | 401 | } |
| 530 | 402 | |
| 531 | | ystart = v1->y; |
| 532 | | yend = v2->y; |
| 533 | | dy = yend-ystart; |
| 534 | | if( dy ) |
| 535 | | { |
| 536 | | e1.x = v1->x; |
| 537 | | e1.u = v1->u; |
| 538 | | e1.v = v1->v; |
| 539 | | e1.i = v1->i; |
| 540 | | e1.z = v1->z; |
| 403 | u += du; |
| 404 | v += dv; |
| 405 | i += di; |
| 406 | z += dz; |
| 407 | } |
| 408 | } /* renderscanline_uvi_full */ |
| 541 | 409 | |
| 542 | | oody = 1.0f / (float)dy; |
| 543 | | dx1dy = (v2->x - v1->x)*oody; |
| 544 | | du1dy = (v2->u - v1->u)*oody; |
| 545 | | dv1dy = (v2->v - v1->v)*oody; |
| 546 | | di1dy = (v2->i - v1->i)*oody; |
| 547 | | dz1dy = (v2->z - v1->z)*oody; |
| 410 | static void rendertri(running_machine *machine, |
| 411 | mame_bitmap *bitmap, |
| 412 | const rectangle *clip, |
| 413 | int color, |
| 414 | int bn, |
| 415 | const vertex *v0, |
| 416 | const vertex *v1, |
| 417 | const vertex *v2, |
| 418 | UINT16 flags, |
| 419 | int cmode ) |
| 420 | { |
| 421 | poly_extra_data *extra = poly_get_extra_data(poly); |
| 422 | poly_vertex vert[3]; |
| 548 | 423 | |
| 549 | | crop = clip->min_y - ystart; |
| 550 | | if( crop>0 ) |
| 551 | | { |
| 552 | | e1.x += dx1dy*crop; |
| 553 | | e1.u += du1dy*crop; |
| 554 | | e1.v += dv1dy*crop; |
| 555 | | e1.i += di1dy*crop; |
| 556 | | e1.z += dz1dy*crop; |
| 557 | | ystart = clip->min_y; |
| 558 | | } |
| 559 | | if( yend>clip->max_y ) yend = clip->max_y; |
| 424 | vert[0].x = v0->x; |
| 425 | vert[0].y = v0->y; |
| 426 | vert[0].p[0] = v0->u; |
| 427 | vert[0].p[1] = v0->v; |
| 428 | vert[0].p[2] = v0->i; |
| 429 | vert[0].p[3] = v0->z; |
| 430 | vert[1].x = v1->x; |
| 431 | vert[1].y = v1->y; |
| 432 | vert[1].p[0] = v1->u; |
| 433 | vert[1].p[1] = v1->v; |
| 434 | vert[1].p[2] = v1->i; |
| 435 | vert[1].p[3] = v1->z; |
| 436 | vert[2].x = v2->x; |
| 437 | vert[2].y = v2->y; |
| 438 | vert[2].p[0] = v2->u; |
| 439 | vert[2].p[1] = v2->v; |
| 440 | vert[2].p[2] = v2->i; |
| 441 | vert[2].p[3] = v2->z; |
| 560 | 442 | |
| 561 | | for( y=ystart; y<yend; y++ ) |
| 562 | | { |
| 563 | | renderscanline_uvi_full(machine, bitmap, clip, &e1,&e2,y, color, bn, flags, cmode ); |
| 443 | extra->color = color; |
| 444 | extra->bn = bn; |
| 445 | extra->flags = flags; |
| 446 | extra->cmode = cmode; |
| 564 | 447 | |
| 565 | | e2.x += dx2dy; |
| 566 | | e2.u += du2dy; |
| 567 | | e2.v += dv2dy; |
| 568 | | e2.i += di2dy; |
| 569 | | e2.z += dz2dy; |
| 448 | poly_render_triangle(poly, bitmap, clip, renderscanline_uvi_full, 4, &vert[0], &vert[1], &vert[2]); |
| 570 | 449 | |
| 571 | | e1.x += dx1dy; |
| 572 | | e1.u += du1dy; |
| 573 | | e1.v += dv1dy; |
| 574 | | e1.i += di1dy; |
| 575 | | e1.z += dz1dy; |
| 576 | | } |
| 577 | | } |
| 578 | | } |
| 579 | 450 | } /* rendertri */ |
| 580 | 451 | |
| 581 | 452 | static void |
| r1185 | r1186 | |
| 748 | 619 | BlitTri(machine, bitmap, pv, color, textureBank, flags, direct, cmode ); |
| 749 | 620 | } |
| 750 | 621 | |
| 751 | | static void |
| 752 | | mydrawgfxzoom( |
| 753 | | mame_bitmap *dest_bmp,const gfx_element *gfx, |
| 754 | | UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy, |
| 755 | | const rectangle *clip,int transparency,int transparent_color, |
| 756 | | int scalex, int scaley, int z, int prioverchar ) |
| 622 | static void renderscanline_sprite(void *destptr, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid) |
| 757 | 623 | { |
| 758 | | rectangle myclip; |
| 759 | | if (!scalex || !scaley) return; |
| 760 | | if(clip) |
| 761 | | { |
| 762 | | myclip.min_x = clip->min_x; |
| 763 | | myclip.max_x = clip->max_x; |
| 764 | | myclip.min_y = clip->min_y; |
| 765 | | myclip.max_y = clip->max_y; |
| 624 | poly_extra_data *extra = poly->extra; |
| 625 | int x_index = poly_param_value(startx, scanline, 0, poly) * 65536.0f; |
| 626 | int y_index = poly_param_value(startx, scanline, 1, poly) * 65536.0f; |
| 627 | int dx = poly->param[0].dpdx * 65536.0f; |
| 628 | mame_bitmap *destmap = destptr; |
| 629 | UINT8 *source = (UINT8 *)extra->source + (y_index>>16) * extra->line_modulo; |
| 630 | UINT32 *dest = BITMAP_ADDR32(destmap, scanline, 0); |
| 631 | const UINT8 *pCharPri = BITMAP_ADDR8(priority_bitmap, scanline, 0); |
| 632 | const pen_t *pal = &Machine->remapped_colortable[extra->color]; |
| 633 | int prioverchar = extra->prioverchar; |
| 634 | int z = extra->z; |
| 635 | int alpha = extra->alpha; |
| 636 | int x; |
| 766 | 637 | |
| 767 | | if (myclip.min_x < 0) myclip.min_x = 0; |
| 768 | | if (myclip.max_x >= dest_bmp->width) myclip.max_x = dest_bmp->width-1; |
| 769 | | if (myclip.min_y < 0) myclip.min_y = 0; |
| 770 | | if (myclip.max_y >= dest_bmp->height) myclip.max_y = dest_bmp->height-1; |
| 638 | int bFogEnable = 0; |
| 639 | INT16 fogDelta = 0; |
| 640 | int fadeEnable = (mixer.target&2) && mixer.fadeFactor; |
| 771 | 641 | |
| 772 | | clip=&myclip; |
| 642 | if( mbSuperSystem22 ) |
| 643 | { |
| 644 | fogDelta = nthword(namcos22_czattr, 0 ); |
| 645 | bFogEnable = nthword(namcos22_czattr,4)&0x4000; /* ? */ |
| 773 | 646 | } |
| 774 | | if( gfx ) |
| 647 | else |
| 775 | 648 | { |
| 776 | | const pen_t *pal = &Machine->remapped_colortable[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; |
| 777 | | UINT8 *source_base = gfx->gfxdata + (code % gfx->total_elements) * gfx->char_modulo; |
| 778 | | int sprite_screen_height = (scaley*gfx->height+0x8000)>>16; |
| 779 | | int sprite_screen_width = (scalex*gfx->width+0x8000)>>16; |
| 780 | | if (sprite_screen_width && sprite_screen_height) |
| 781 | | { |
| 782 | | int dx = (gfx->width<<16)/sprite_screen_width; |
| 783 | | int dy = (gfx->height<<16)/sprite_screen_height; |
| 784 | | int ex = sx+sprite_screen_width; |
| 785 | | int ey = sy+sprite_screen_height; |
| 786 | | int x_index_base; |
| 787 | | int y_index; |
| 649 | bFogEnable = 0; |
| 650 | } |
| 788 | 651 | |
| 789 | | int bFogEnable = 0; |
| 790 | | INT16 fogDelta = 0; |
| 791 | | int fadeEnable = (mixer.target&2) && mixer.fadeFactor; |
| 792 | | |
| 793 | | if( mbSuperSystem22 ) |
| 794 | | { |
| 795 | | fogDelta = nthword(namcos22_czattr, 0 ); |
| 796 | | bFogEnable = nthword(namcos22_czattr,4)&0x4000; /* ? */ |
| 797 | | } |
| 798 | | else |
| 652 | for( x=startx; x<stopx; x++ ) |
| 653 | { |
| 654 | int pen = source[x_index>>16]; |
| 655 | if( pen != 0xff ) |
| 656 | { |
| 657 | if( pCharPri[x]==0 || prioverchar ) |
| 799 | 658 | { |
| 800 | | bFogEnable = 0; |
| 801 | | } |
| 802 | | |
| 803 | | if( flipx ) |
| 804 | | { |
| 805 | | x_index_base = (sprite_screen_width-1)*dx; |
| 806 | | dx = -dx; |
| 807 | | } |
| 808 | | else |
| 809 | | { |
| 810 | | x_index_base = 0; |
| 811 | | } |
| 812 | | if( flipy ) |
| 813 | | { |
| 814 | | y_index = (sprite_screen_height-1)*dy; |
| 815 | | dy = -dy; |
| 816 | | } |
| 817 | | else |
| 818 | | { |
| 819 | | y_index = 0; |
| 820 | | } |
| 821 | | if( clip ) |
| 822 | | { |
| 823 | | if( sx < clip->min_x) |
| 824 | | { /* clip left */ |
| 825 | | int pixels = clip->min_x-sx; |
| 826 | | sx += pixels; |
| 827 | | x_index_base += pixels*dx; |
| 828 | | } |
| 829 | | if( sy < clip->min_y ) |
| 830 | | { /* clip top */ |
| 831 | | int pixels = clip->min_y-sy; |
| 832 | | sy += pixels; |
| 833 | | y_index += pixels*dy; |
| 834 | | } |
| 835 | | if( ex > clip->max_x+1 ) |
| 836 | | { /* clip right */ |
| 837 | | int pixels = ex-clip->max_x-1; |
| 838 | | ex -= pixels; |
| 839 | | } |
| 840 | | if( ey > clip->max_y+1 ) |
| 841 | | { /* clip bottom */ |
| 842 | | int pixels = ey-clip->max_y-1; |
| 843 | | ey -= pixels; |
| 844 | | } |
| 845 | | } |
| 846 | | if( ex>sx ) |
| 847 | | { /* skip if inner loop doesn't draw anything */ |
| 848 | | int y; |
| 849 | | for( y=sy; y<ey; y++ ) |
| 659 | UINT32 color = pal[pen]; |
| 660 | int r = color>>16; |
| 661 | int g = (color>>8)&0xff; |
| 662 | int b = color&0xff; |
| 663 | if( bFogEnable && z!=0xffff ) |
| 850 | 664 | { |
| 851 | | UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo; |
| 852 | | UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); |
| 853 | | const UINT8 *pCharPri = BITMAP_ADDR8(priority_bitmap, y, 0); |
| 854 | | int x, x_index = x_index_base; |
| 855 | | for( x=sx; x<ex; x++ ) |
| 665 | int zc = Clamp256(fogDelta + z); |
| 666 | UINT16 fogDensity = namcos22_czram[3][zc]; |
| 667 | if( fogDensity>0 ) |
| 856 | 668 | { |
| 857 | | int pen = source[x_index>>16]; |
| 858 | | if( pen != transparent_color ) |
| 859 | | { |
| 860 | | if( pCharPri[x]==0 || prioverchar ) |
| 861 | | { |
| 862 | | UINT32 color = pal[pen]; |
| 863 | | int r = color>>16; |
| 864 | | int g = (color>>8)&0xff; |
| 865 | | int b = color&0xff; |
| 866 | | if( bFogEnable && z!=0xffff ) |
| 867 | | { |
| 868 | | int zc = Clamp256(fogDelta + z); |
| 869 | | UINT16 fogDensity = namcos22_czram[3][zc]; |
| 870 | | if( fogDensity>0 ) |
| 871 | | { |
| 872 | | int fogDensity2 = 0x2000 - fogDensity; |
| 873 | | r = (r*fogDensity2 + fogDensity*mixer.rFogColor)>>13; |
| 874 | | g = (g*fogDensity2 + fogDensity*mixer.gFogColor)>>13; |
| 875 | | b = (b*fogDensity2 + fogDensity*mixer.bFogColor)>>13; |
| 876 | | } |
| 877 | | } |
| 878 | | if( fadeEnable ) |
| 879 | | { |
| 880 | | int fade2 = 0x100-mixer.fadeFactor; |
| 881 | | r = (r*fade2+mixer.fadeFactor*mixer.rFadeColor)>>8; |
| 882 | | g = (g*fade2+mixer.fadeFactor*mixer.gFadeColor)>>8; |
| 883 | | b = (b*fade2+mixer.fadeFactor*mixer.bFadeColor)>>8; |
| 884 | | } |
| 885 | | color = (r<<16)|(g<<8)|b; |
| 886 | | color = alpha_blend32(dest[x], color); |
| 887 | | color&=0xffffff; |
| 888 | | dest[x] = color; |
| 889 | | } |
| 890 | | } |
| 891 | | x_index += dx; |
| 669 | int fogDensity2 = 0x2000 - fogDensity; |
| 670 | r = (r*fogDensity2 + fogDensity*mixer.rFogColor)>>13; |
| 671 | g = (g*fogDensity2 + fogDensity*mixer.gFogColor)>>13; |
| 672 | b = (b*fogDensity2 + fogDensity*mixer.bFogColor)>>13; |
| 892 | 673 | } |
| 893 | | y_index += dy; |
| 894 | 674 | } |
| 675 | if( fadeEnable ) |
| 676 | { |
| 677 | int fade2 = 0x100-mixer.fadeFactor; |
| 678 | r = (r*fade2+mixer.fadeFactor*mixer.rFadeColor)>>8; |
| 679 | g = (g*fade2+mixer.fadeFactor*mixer.gFadeColor)>>8; |
| 680 | b = (b*fade2+mixer.fadeFactor*mixer.bFadeColor)>>8; |
| 681 | } |
| 682 | color = (r<<16)|(g<<8)|b; |
| 683 | color = alpha_blend_r32(dest[x], color, alpha); |
| 684 | color&=0xffffff; |
| 685 | dest[x] = color; |
| 895 | 686 | } |
| 896 | 687 | } |
| 688 | x_index += dx; |
| 897 | 689 | } |
| 690 | } |
| 691 | |
| 692 | |
| 693 | static void |
| 694 | mydrawgfxzoom( |
| 695 | mame_bitmap *dest_bmp,const gfx_element *gfx, |
| 696 | UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy, |
| 697 | const rectangle *clip,int transparency,int transparent_color, |
| 698 | int scalex, int scaley, int z, int prioverchar, int alpha ) |
| 699 | { |
| 700 | int sprite_screen_height = (scaley*gfx->height+0x8000)>>16; |
| 701 | int sprite_screen_width = (scalex*gfx->width+0x8000)>>16; |
| 702 | if (sprite_screen_width && sprite_screen_height && gfx) |
| 703 | { |
| 704 | float fsx = sx; |
| 705 | float fsy = sy; |
| 706 | float fwidth = gfx->width; |
| 707 | float fheight = gfx->height; |
| 708 | float fsw = sprite_screen_width; |
| 709 | float fsh = sprite_screen_height; |
| 710 | poly_extra_data *extra; |
| 711 | poly_vertex vert[4]; |
| 712 | |
| 713 | vert[0].x = fsx; |
| 714 | vert[0].y = fsy; |
| 715 | vert[0].p[0] = flipx ? fwidth : 0; |
| 716 | vert[0].p[1] = flipy ? fheight : 0; |
| 717 | vert[1].x = fsx + fsw; |
| 718 | vert[1].y = fsy; |
| 719 | vert[1].p[0] = flipx ? 0 : fwidth; |
| 720 | vert[1].p[1] = flipy ? fheight : 0; |
| 721 | vert[2].x = fsx + fsw; |
| 722 | vert[2].y = fsy + fsh; |
| 723 | vert[2].p[0] = flipx ? 0 : fwidth; |
| 724 | vert[2].p[1] = flipy ? 0 : fheight; |
| 725 | vert[3].x = fsx; |
| 726 | vert[3].y = fsy + fsh; |
| 727 | vert[3].p[0] = flipx ? fwidth : 0; |
| 728 | vert[3].p[1] = flipy ? 0 : fheight; |
| 729 | |
| 730 | extra = poly_get_extra_data(poly); |
| 731 | extra->z = z; |
| 732 | extra->alpha = alpha; |
| 733 | extra->prioverchar = prioverchar; |
| 734 | extra->line_modulo = gfx->line_modulo; |
| 735 | extra->color = gfx->color_base + gfx->color_granularity * (color % gfx->total_colors); |
| 736 | extra->source = gfx->gfxdata + (code % gfx->total_elements) * gfx->char_modulo; |
| 737 | poly_render_triangle(poly, dest_bmp, clip, renderscanline_sprite, 2, &vert[0], &vert[1], &vert[2]); |
| 738 | |
| 739 | extra = poly_get_extra_data(poly); |
| 740 | extra->z = z; |
| 741 | extra->alpha = alpha; |
| 742 | extra->prioverchar = prioverchar; |
| 743 | extra->line_modulo = gfx->line_modulo; |
| 744 | extra->color = gfx->color_base + gfx->color_granularity * (color % gfx->total_colors); |
| 745 | extra->source = gfx->gfxdata + (code % gfx->total_elements) * gfx->char_modulo; |
| 746 | poly_render_triangle(poly, dest_bmp, clip, renderscanline_sprite, 2, &vert[0], &vert[2], &vert[3]); |
| 747 | } |
| 898 | 748 | } /* mydrawgfxzoom */ |
| 899 | 749 | |
| 900 | 750 | static void |
| r1185 | r1186 | |
| 954 | 804 | clip.min_y = 0; |
| 955 | 805 | clip.max_x = 640-1; |
| 956 | 806 | clip.max_y = 480-1; |
| 957 | | alpha_set_level( 0xff - translucency ); |
| 958 | 807 | mydrawgfxzoom( |
| 959 | 808 | bitmap, |
| 960 | 809 | gfx, |
| r1185 | r1186 | |
| 966 | 815 | TRANSPARENCY_ALPHA, 0xff, |
| 967 | 816 | (width<<16)/32, |
| 968 | 817 | (height<<16)/32, |
| 969 | | zc, pri ); |
| 818 | zc, pri, 0xff - translucency ); |
| 970 | 819 | } |
| 971 | 820 | |
| 972 | 821 | #define DSP_FIXED_TO_FLOAT( X ) (((INT16)(X))/(float)0x7fff) |
| r1185 | r1186 | |
| 1290 | 1139 | node->data.nonleaf.next[i] = NULL; |
| 1291 | 1140 | } |
| 1292 | 1141 | poly3d_NoClip(); |
| 1142 | poly_wait(poly, "DrawPolygons"); |
| 1293 | 1143 | } /* RenderScene */ |
| 1294 | 1144 | |
| 1295 | 1145 | static float |
| r1185 | r1186 | |
| 2489 | 2339 | if( mbDSPisActive ) |
| 2490 | 2340 | { |
| 2491 | 2341 | SimulateSlaveDSP( bitmap ); |
| 2342 | poly_wait(poly, "DrawPolygons"); |
| 2492 | 2343 | } |
| 2493 | 2344 | } /* DrawPolygons */ |
| 2494 | 2345 | |
| r1185 | r1186 | |
| 2533 | 2384 | dirtypal[offset&(0x7fff/4)] = 1; |
| 2534 | 2385 | } |
| 2535 | 2386 | |
| 2387 | static void namcos22_exit(running_machine *machine) |
| 2388 | { |
| 2389 | poly_free(poly); |
| 2390 | } |
| 2391 | |
| 2536 | 2392 | static void video_start_common(running_machine *machine) |
| 2537 | 2393 | { |
| 2538 | 2394 | bgtilemap = tilemap_create( TextTilemapGetInfo,tilemap_scan_rows,TILEMAP_TYPE_PEN,16,16,64,64 ); |
| r1185 | r1186 | |
| 2548 | 2404 | mpPolyL = memory_region(REGION_POINTROM); |
| 2549 | 2405 | mpPolyM = mpPolyL + mPtRomSize; |
| 2550 | 2406 | mpPolyH = mpPolyM + mPtRomSize; |
| 2407 | |
| 2408 | poly = poly_alloc(1000, sizeof(poly_extra_data), 0); |
| 2409 | add_exit_callback(machine, namcos22_exit); |
| 2551 | 2410 | } |
| 2552 | 2411 | |
| 2553 | 2412 | VIDEO_START( namcos22 ) |
src/mame/video/midvunit.c
| r1185 | r1186 | |
| 8 | 8 | #include "cpu/tms34010/tms34010.h" |
| 9 | 9 | #include "cpu/adsp2100/adsp2100.h" |
| 10 | 10 | #include "audio/williams.h" |
| 11 | | #include "video/poly.h" |
| 11 | #include "video/polynew.h" |
| 12 | 12 | #include "midvunit.h" |
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | #define WATCH_RENDER (0) |
| 16 | | #define KEEP_STATISTICS (0) |
| 17 | 16 | #define LOG_DMA (0) |
| 18 | 17 | |
| 19 | 18 | |
| 20 | 19 | #define DMA_CLOCK 40000000 |
| 21 | 20 | |
| 22 | 21 | |
| 23 | | #if KEEP_STATISTICS |
| 24 | | #define ADD_TO_PIXEL_COUNT(a) do { if ((a) > 0) pixelcount += (a); } while (0) |
| 25 | | #else |
| 26 | | #define ADD_TO_PIXEL_COUNT(a) |
| 27 | | #endif |
| 28 | | |
| 29 | | |
| 30 | 22 | /* for when we implement DMA timing */ |
| 31 | 23 | #define DMA_QUEUE_SIZE 273 |
| 32 | 24 | #define TIME_PER_PIXEL 41e-9 |
| r1185 | r1186 | |
| 43 | 35 | static UINT8 video_changed; |
| 44 | 36 | |
| 45 | 37 | static mame_timer *scanline_timer; |
| 38 | static poly_manager *poly; |
| 46 | 39 | |
| 47 | | static struct poly_vertex vert[4]; |
| 48 | | static UINT8 topleft, topright, botleft, botright; |
| 40 | typedef struct _poly_extra_data poly_extra_data; |
| 41 | struct _poly_extra_data |
| 42 | { |
| 43 | UINT8 * texbase; |
| 44 | UINT16 pixdata; |
| 45 | UINT8 dither; |
| 46 | }; |
| 49 | 47 | |
| 50 | | #if KEEP_STATISTICS |
| 51 | | static int polycount, pixelcount, lastfps, framecount, totalframes; |
| 52 | | #endif |
| 53 | 48 | |
| 54 | 49 | |
| 55 | 50 | /************************************* |
| r1185 | r1186 | |
| 67 | 62 | } |
| 68 | 63 | |
| 69 | 64 | |
| 70 | | VIDEO_START( midvunit ) |
| 65 | static void midvunit_exit(running_machine *machine) |
| 71 | 66 | { |
| 72 | | scanline_timer = mame_timer_alloc(scanline_timer_cb); |
| 67 | poly_free(poly); |
| 73 | 68 | } |
| 74 | 69 | |
| 75 | 70 | |
| 76 | | |
| 77 | | /************************************* |
| 78 | | * |
| 79 | | * Returns true if the quad is |
| 80 | | * straight-on |
| 81 | | * |
| 82 | | *************************************/ |
| 83 | | |
| 84 | | INLINE int quad_is_straight(void) |
| 71 | VIDEO_START( midvunit ) |
| 85 | 72 | { |
| 86 | | INT32 x1, x2, y1, y2, t; |
| 87 | | |
| 88 | | x1 = vert[0].x; |
| 89 | | t = vert[1].x; |
| 90 | | |
| 91 | | /* case 1: the first two verts are the two extremes */ |
| 92 | | if (t != x1) |
| 93 | | { |
| 94 | | x2 = t; |
| 95 | | t = vert[2].x; |
| 96 | | if (t != x1) |
| 97 | | { |
| 98 | | if (t != x2 || vert[3].x != x1) |
| 99 | | return 0; |
| 100 | | } |
| 101 | | else |
| 102 | | { |
| 103 | | if (vert[3].x != x2) |
| 104 | | return 0; |
| 105 | | } |
| 106 | | } |
| 107 | | |
| 108 | | /* case 2: the first two verts are the same */ |
| 109 | | else |
| 110 | | { |
| 111 | | x2 = vert[2].x; |
| 112 | | if (vert[3].x != x2) |
| 113 | | return 0; |
| 114 | | } |
| 115 | | |
| 116 | | y1 = vert[0].y; |
| 117 | | t = vert[1].y; |
| 118 | | |
| 119 | | /* case 1: the first two verts are the two extremes */ |
| 120 | | if (t != y1) |
| 121 | | { |
| 122 | | y2 = t; |
| 123 | | t = vert[2].y; |
| 124 | | if (t != y1) |
| 125 | | { |
| 126 | | if (t != y2 || vert[3].y != y1) |
| 127 | | return 0; |
| 128 | | } |
| 129 | | else |
| 130 | | { |
| 131 | | if (vert[3].y != y2) |
| 132 | | return 0; |
| 133 | | } |
| 134 | | } |
| 135 | | |
| 136 | | /* case 2: the first two verts are the same */ |
| 137 | | else |
| 138 | | { |
| 139 | | y2 = vert[2].y; |
| 140 | | if (vert[3].y != y2) |
| 141 | | return 0; |
| 142 | | } |
| 143 | | |
| 144 | | /* sort into min/max */ |
| 145 | | if (x1 > x2) { t = x1; x1 = x2; x2 = t; } |
| 146 | | if (y1 > y2) { t = y1; y1 = y2; y2 = t; } |
| 147 | | |
| 148 | | /* determine the corners */ |
| 149 | | for (t = 0; t < 4; t++) |
| 150 | | { |
| 151 | | if (vert[t].x == x1) |
| 152 | | { |
| 153 | | if (vert[t].y == y1) |
| 154 | | topleft = t; |
| 155 | | else |
| 156 | | botleft = t; |
| 157 | | } |
| 158 | | else |
| 159 | | { |
| 160 | | if (vert[t].y == y1) |
| 161 | | topright = t; |
| 162 | | else |
| 163 | | botright = t; |
| 164 | | } |
| 165 | | } |
| 166 | | |
| 167 | | return 1; |
| 73 | scanline_timer = mame_timer_alloc(scanline_timer_cb); |
| 74 | poly = poly_alloc(4000, sizeof(poly_extra_data), 0); |
| 75 | add_exit_callback(machine, midvunit_exit); |
| 168 | 76 | } |
| 169 | 77 | |
| 170 | 78 | |
| 171 | 79 | |
| 172 | 80 | /************************************* |
| 173 | 81 | * |
| 174 | | * Straight, flat quad renderers |
| 82 | * Generic flat quad renderer |
| 175 | 83 | * |
| 176 | 84 | *************************************/ |
| 177 | 85 | |
| 178 | | static void render_straight_flat_quad(running_machine *machine) |
| 86 | static void render_flat(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid) |
| 179 | 87 | { |
| 180 | | UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000]; |
| 181 | | UINT16 pixdata = dma_data[1] | (dma_data[0] & 0x00ff); |
| 182 | | INT32 sx, sy, ex, ey, x, y; |
| 88 | poly_extra_data *extra = poly->extra; |
| 89 | UINT16 *dest = (UINT16 *)destbase + scanline * 512; |
| 90 | UINT16 pixdata = extra->pixdata; |
| 91 | int xstep = extra->dither + 1; |
| 92 | int x; |
| 183 | 93 | |
| 184 | | /* compute parameters */ |
| 185 | | sx = vert[topleft].x; |
| 186 | | ex = vert[topright].x; |
| 187 | | sy = vert[topleft].y; |
| 188 | | ey = vert[botleft].y; |
| 94 | /* if dithering, ensure that we start on an appropriate pixel */ |
| 95 | startx += (scanline ^ startx) & extra->dither; |
| 189 | 96 | |
| 190 | | /* clip */ |
| 191 | | if (sx < machine->screen[0].visarea.min_x) |
| 192 | | sx = machine->screen[0].visarea.min_x; |
| 193 | | if (ex > machine->screen[0].visarea.max_x) |
| 194 | | ex = machine->screen[0].visarea.max_x; |
| 195 | | if (sy < machine->screen[0].visarea.min_y) |
| 196 | | sy = machine->screen[0].visarea.min_y; |
| 197 | | if (ey > machine->screen[0].visarea.max_y) |
| 198 | | ey = machine->screen[0].visarea.max_y; |
| 97 | /* non-dithered 0 pixels can use a memset */ |
| 98 | if (pixdata == 0 && xstep == 1) |
| 99 | memset(&dest[startx], 0, 2 * (stopx - startx + 1)); |
| 199 | 100 | |
| 200 | | ADD_TO_PIXEL_COUNT((ey - sy + 1) * (ex - sx + 1)); |
| 201 | | |
| 202 | | /* loop over rows */ |
| 203 | | for (y = sy; y <= ey; y++) |
| 101 | /* otherwise, we fill manually */ |
| 102 | else |
| 204 | 103 | { |
| 205 | | UINT16 *d = dest + y * 512 + sx; |
| 206 | | if (pixdata) |
| 207 | | for (x = sx; x <= ex; x++) |
| 208 | | *d++ = pixdata; |
| 209 | | else |
| 210 | | memset(d, 0, 2 * (ex - sx + 1)); |
| 104 | for (x = startx; x < stopx; x += xstep) |
| 105 | dest[x] = pixdata; |
| 211 | 106 | } |
| 212 | 107 | } |
| 213 | 108 | |
| 214 | 109 | |
| 215 | | static void render_straight_flat_dither_quad(running_machine *machine) |
| 216 | | { |
| 217 | | UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000]; |
| 218 | | UINT16 pixdata = dma_data[1] | (dma_data[0] & 0x00ff); |
| 219 | | INT32 sx, sy, ex, ey, x, y; |
| 220 | 110 | |
| 221 | | /* compute parameters */ |
| 222 | | sx = vert[topleft].x; |
| 223 | | ex = vert[topright].x; |
| 224 | | sy = vert[topleft].y; |
| 225 | | ey = vert[botleft].y; |
| 226 | | |
| 227 | | /* clip */ |
| 228 | | if (sx < machine->screen[0].visarea.min_x) |
| 229 | | sx = machine->screen[0].visarea.min_x; |
| 230 | | if (ex > machine->screen[0].visarea.max_x) |
| 231 | | ex = machine->screen[0].visarea.max_x; |
| 232 | | if (sy < machine->screen[0].visarea.min_y) |
| 233 | | sy = machine->screen[0].visarea.min_y; |
| 234 | | if (ey > machine->screen[0].visarea.max_y) |
| 235 | | ey = machine->screen[0].visarea.max_y; |
| 236 | | |
| 237 | | ADD_TO_PIXEL_COUNT((ey - sy + 1) * (ex - sx + 1)); |
| 238 | | |
| 239 | | /* loop over rows */ |
| 240 | | for (y = sy; y <= ey; y++) |
| 241 | | { |
| 242 | | UINT16 *d = dest + y * 512; |
| 243 | | int tsx = sx + ((sx ^ y) & 1); |
| 244 | | for (x = tsx; x <= ex; x += 2) |
| 245 | | d[x] = pixdata; |
| 246 | | } |
| 247 | | } |
| 248 | | |
| 249 | | |
| 250 | | |
| 251 | 111 | /************************************* |
| 252 | 112 | * |
| 253 | | * Straight, textured quad renderers |
| 113 | * Generic textured quad renderers |
| 254 | 114 | * |
| 255 | 115 | *************************************/ |
| 256 | 116 | |
| 257 | | static void render_straight_tex_quad(running_machine *machine) |
| 117 | static void render_tex(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid) |
| 258 | 118 | { |
| 259 | | UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000]; |
| 260 | | UINT8 *texbase = (UINT8 *)midvunit_textureram + (dma_data[14] * 256); |
| 261 | | UINT16 pixdata = dma_data[1]; |
| 262 | | INT32 sx, sy, ex, ey, su, sv, dudx, dvdx, dudy, dvdy, x, y, u, v; |
| 119 | poly_extra_data *extra = poly->extra; |
| 120 | UINT16 *dest = (UINT16 *)destbase + scanline * 512; |
| 121 | UINT16 pixdata = extra->pixdata & 0xff00; |
| 122 | const UINT8 *texbase = extra->texbase; |
| 123 | INT32 u = poly_param_value(startx, scanline, 0, poly) * 65536.0f; |
| 124 | INT32 v = poly_param_value(startx, scanline, 1, poly) * 65536.0f; |
| 125 | INT32 dudx = poly->param[0].dpdx * 65536.0f; |
| 126 | INT32 dvdx = poly->param[1].dpdx * 65536.0f; |
| 127 | int xstep = extra->dither + 1; |
| 128 | int x; |
| 263 | 129 | |
| 264 | | /* compute parameters */ |
| 265 | | sx = vert[topleft].x; |
| 266 | | ex = vert[topright].x; |
| 267 | | sy = vert[topleft].y; |
| 268 | | ey = vert[botleft].y; |
| 269 | | su = (dma_data[10 + topleft] & 0x00ff) << 16; |
| 270 | | sv = (dma_data[10 + topleft] & 0xff00) << 8; |
| 271 | | |
| 272 | | /* compute texture deltas */ |
| 273 | | if (ex != sx) |
| 130 | /* if dithering, we advance by 2x; also ensure that we start on an appropriate pixel */ |
| 131 | if (xstep == 2) |
| 274 | 132 | { |
| 275 | | dudx = (((dma_data[10 + topright] & 0x00ff) << 16) - su) / (ex - sx); |
| 276 | | dvdx = (((dma_data[10 + topright] & 0xff00) << 8 ) - sv) / (ex - sx); |
| 277 | | } |
| 278 | | else |
| 279 | | dudx = dvdx = 1; |
| 280 | | if (ey != sy) |
| 281 | | { |
| 282 | | dudy = (((dma_data[10 + botleft] & 0x00ff) << 16) - su) / (ey - sy); |
| 283 | | dvdy = (((dma_data[10 + botleft] & 0xff00) << 8 ) - sv) / (ey - sy); |
| 284 | | } |
| 285 | | else |
| 286 | | dudy = dvdy = 1; |
| 287 | | |
| 288 | | /* clip */ |
| 289 | | if (sx < machine->screen[0].visarea.min_x) |
| 290 | | { |
| 291 | | su += (machine->screen[0].visarea.min_x - sx) * dudx; |
| 292 | | sv += (machine->screen[0].visarea.min_x - sx) * dvdx; |
| 293 | | sx = machine->screen[0].visarea.min_x; |
| 294 | | } |
| 295 | | if (ex > machine->screen[0].visarea.max_x) |
| 296 | | ex = machine->screen[0].visarea.max_x; |
| 297 | | if (sy < machine->screen[0].visarea.min_y) |
| 298 | | { |
| 299 | | su += (machine->screen[0].visarea.min_y - sy) * dudy; |
| 300 | | sv += (machine->screen[0].visarea.min_y - sy) * dvdy; |
| 301 | | sy = machine->screen[0].visarea.min_y; |
| 302 | | } |
| 303 | | if (ey > machine->screen[0].visarea.max_y) |
| 304 | | ey = machine->screen[0].visarea.max_y; |
| 305 | | |
| 306 | | ADD_TO_PIXEL_COUNT((ey - sy + 1) * (ex - sx + 1)); |
| 307 | | |
| 308 | | /* loop over rows */ |
| 309 | | for (y = sy; y <= ey; y++) |
| 310 | | { |
| 311 | | UINT16 *d = dest + y * 512; |
| 312 | | |
| 313 | | u = su; |
| 314 | | v = sv; |
| 315 | | su += dudy; |
| 316 | | sv += dvdy; |
| 317 | | |
| 318 | | for (x = sx; x <= ex; x++) |
| 133 | if ((scanline ^ startx) & 1) |
| 319 | 134 | { |
| 320 | | d[x] = pixdata | texbase[((v >> 8) & 0xff00) + (u >> 16)]; |
| 135 | startx++; |
| 321 | 136 | u += dudx; |
| 322 | 137 | v += dvdx; |
| 323 | 138 | } |
| 139 | dudx *= 2; |
| 140 | dvdx *= 2; |
| 324 | 141 | } |
| 325 | | } |
| 326 | 142 | |
| 327 | | |
| 328 | | static void render_straight_textrans_quad(running_machine *machine) |
| 329 | | { |
| 330 | | UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000]; |
| 331 | | UINT8 *texbase = (UINT8 *)midvunit_textureram + (dma_data[14] * 256); |
| 332 | | UINT16 pixdata = dma_data[1]; |
| 333 | | INT32 sx, sy, ex, ey, su, sv, dudx, dvdx, dudy, dvdy, x, y, u, v; |
| 334 | | |
| 335 | | /* compute parameters */ |
| 336 | | sx = vert[topleft].x; |
| 337 | | ex = vert[topright].x; |
| 338 | | sy = vert[topleft].y; |
| 339 | | ey = vert[botleft].y; |
| 340 | | su = (dma_data[10 + topleft] & 0x00ff) << 16; |
| 341 | | sv = (dma_data[10 + topleft] & 0xff00) << 8; |
| 342 | | |
| 343 | | /* compute texture deltas */ |
| 344 | | if (ex != sx) |
| 143 | /* general case; render every pixel */ |
| 144 | for (x = startx; x < stopx; x += xstep) |
| 345 | 145 | { |
| 346 | | dudx = (((dma_data[10 + topright] & 0x00ff) << 16) - su) / (ex - sx); |
| 347 | | dvdx = (((dma_data[10 + topright] & 0xff00) << 8 ) - sv) / (ex - sx); |
| 146 | dest[x] = pixdata | texbase[((v >> 8) & 0xff00) + (u >> 16)]; |
| 147 | u += dudx; |
| 148 | v += dvdx; |
| 348 | 149 | } |
| 349 | | else |
| 350 | | dudx = dvdx = 1; |
| 351 | | if (ey != sy) |
| 352 | | { |
| 353 | | dudy = (((dma_data[10 + botleft] & 0x00ff) << 16) - su) / (ey - sy); |
| 354 | | dvdy = (((dma_data[10 + botleft] & 0xff00) << 8 ) - sv) / (ey - sy); |
| 355 | | } |
| 356 | | else |
| 357 | | dudy = dvdy = 1; |
| 358 | | |
| 359 | | /* clip */ |
| 360 | | if (sx < machine->screen[0].visarea.min_x) |
| 361 | | { |
| 362 | | su += (machine->screen[0].visarea.min_x - sx) * dudx; |
| 363 | | sv += (machine->screen[0].visarea.min_x - sx) * dvdx; |
| 364 | | sx = machine->screen[0].visarea.min_x; |
| 365 | | } |
| 366 | | if (ex > machine->screen[0].visarea.max_x) |
| 367 | | ex = machine->screen[0].visarea.max_x; |
| 368 | | if (sy < machine->screen[0].visarea.min_y) |
| 369 | | { |
| 370 | | su += (machine->screen[0].visarea.min_y - sy) * dudy; |
| 371 | | sv += (machine->screen[0].visarea.min_y - sy) * dvdy; |
| 372 | | sy = machine->screen[0].visarea.min_y; |
| 373 | | } |
| 374 | | if (ey > machine->screen[0].visarea.max_y) |
| 375 | | ey = machine->screen[0].visarea.max_y; |
| 376 | | |
| 377 | | ADD_TO_PIXEL_COUNT((ey - sy + 1) * (ex - sx + 1)); |
| 378 | | |
| 379 | | /* loop over rows */ |
| 380 | | for (y = sy; y <= ey; y++) |
| 381 | | { |
| 382 | | UINT16 *d = dest + y * 512; |
| 383 | | |
| 384 | | u = su; |
| 385 | | v = sv; |
| 386 | | su += dudy; |
| 387 | | sv += dvdy; |
| 388 | | |
| 389 | | for (x = sx; x <= ex; x++) |
| 390 | | { |
| 391 | | int pix = texbase[((v >> 8) & 0xff00) + (u >> 16)]; |
| 392 | | if (pix) d[x] = pixdata | pix; |
| 393 | | u += dudx; |
| 394 | | v += dvdx; |
| 395 | | } |
| 396 | | } |
| 397 | 150 | } |
| 398 | 151 | |
| 399 | 152 | |
| 400 | | static void render_straight_textransmask_quad(running_machine *machine) |
| 153 | static void render_textrans(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid) |
| 401 | 154 | { |
| 402 | | UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000]; |
| 403 | | UINT8 *texbase = (UINT8 *)midvunit_textureram + (dma_data[14] * 256); |
| 404 | | UINT16 pixdata = dma_data[1] | (dma_data[0] & 0x00ff); |
| 405 | | INT32 sx, sy, ex, ey, su, sv, dudx, dvdx, dudy, dvdy, x, y, u, v; |
| 155 | poly_extra_data *extra = poly->extra; |
| 156 | UINT16 *dest = (UINT16 *)destbase + scanline * 512; |
| 157 | UINT16 pixdata = extra->pixdata & 0xff00; |
| 158 | const UINT8 *texbase = extra->texbase; |
| 159 | INT32 u = poly_param_value(startx, scanline, 0, poly) * 65536.0f; |
| 160 | INT32 v = poly_param_value(startx, scanline, 1, poly) * 65536.0f; |
| 161 | INT32 dudx = poly->param[0].dpdx * 65536.0f; |
| 162 | INT32 dvdx = poly->param[1].dpdx * 65536.0f; |
| 163 | int xstep = extra->dither + 1; |
| 164 | int x; |
| 406 | 165 | |
| 407 | | /* compute parameters */ |
| 408 | | sx = vert[topleft].x; |
| 409 | | ex = vert[topright].x; |
| 410 | | sy = vert[topleft].y; |
| 411 | | ey = vert[botleft].y; |
| 412 | | su = (dma_data[10 + topleft] & 0x00ff) << 16; |
| 413 | | sv = (dma_data[10 + topleft] & 0xff00) << 8; |
| 414 | | |
| 415 | | /* compute texture deltas */ |
| 416 | | if (ex != sx) |
| 166 | /* if dithering, we advance by 2x; also ensure that we start on an appropriate pixel */ |
| 167 | if (xstep == 2) |
| 417 | 168 | { |
| 418 | | dudx = (((dma_data[10 + topright] & 0x00ff) << 16) - su) / (ex - sx); |
| 419 | | dvdx = (((dma_data[10 + topright] & 0xff00) << 8 ) - sv) / (ex - sx); |
| 420 | | } |
| 421 | | else |
| 422 | | dudx = dvdx = 1; |
| 423 | | if (ey != sy) |
| 424 | | { |
| 425 | | dudy = (((dma_data[10 + botleft] & 0x00ff) << 16) - su) / (ey - sy); |
| 426 | | dvdy = (((dma_data[10 + botleft] & 0xff00) << 8 ) - sv) / (ey - sy); |
| 427 | | } |
| 428 | | else |
| 429 | | dudy = dvdy = 1; |
| 430 | | |
| 431 | | /* clip */ |
| 432 | | if (sx < machine->screen[0].visarea.min_x) |
| 433 | | { |
| 434 | | su += (machine->screen[0].visarea.min_x - sx) * dudx; |
| 435 | | sv += (machine->screen[0].visarea.min_x - sx) * dvdx; |
| 436 | | sx = machine->screen[0].visarea.min_x; |
| 437 | | } |
| 438 | | if (ex > machine->screen[0].visarea.max_x) |
| 439 | | ex = machine->screen[0].visarea.max_x; |
| 440 | | if (sy < machine->screen[0].visarea.min_y) |
| 441 | | { |
| 442 | | su += (machine->screen[0].visarea.min_y - sy) * dudy; |
| 443 | | sv += (machine->screen[0].visarea.min_y - sy) * dvdy; |
| 444 | | sy = machine->screen[0].visarea.min_y; |
| 445 | | } |
| 446 | | if (ey > machine->screen[0].visarea.max_y) |
| 447 | | ey = machine->screen[0].visarea.max_y; |
| 448 | | |
| 449 | | ADD_TO_PIXEL_COUNT((ey - sy + 1) * (ex - sx + 1)); |
| 450 | | |
| 451 | | /* loop over rows */ |
| 452 | | for (y = sy; y <= ey; y++) |
| 453 | | { |
| 454 | | UINT16 *d = dest + y * 512; |
| 455 | | |
| 456 | | u = su; |
| 457 | | v = sv; |
| 458 | | su += dudy; |
| 459 | | sv += dvdy; |
| 460 | | |
| 461 | | for (x = sx; x <= ex; x++) |
| 169 | if ((scanline ^ startx) & 1) |
| 462 | 170 | { |
| 463 | | int pix = texbase[((v >> 8) & 0xff00) + (u >> 16)]; |
| 464 | | if (pix) d[x] = pixdata; |
| 171 | startx++; |
| 465 | 172 | u += dudx; |
| 466 | 173 | v += dvdx; |
| 467 | 174 | } |
| 175 | dudx *= 2; |
| 176 | dvdx *= 2; |
| 468 | 177 | } |
| 469 | | } |
| 470 | 178 | |
| 471 | | |
| 472 | | |
| 473 | | /************************************* |
| 474 | | * |
| 475 | | * Generic flat quad renderer |
| 476 | | * |
| 477 | | *************************************/ |
| 478 | | |
| 479 | | static void render_flat_quad(running_machine *machine) |
| 480 | | { |
| 481 | | UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000]; |
| 482 | | UINT16 pixdata = dma_data[1] | (dma_data[0] & 0x00ff); |
| 483 | | const struct poly_scanline_data *scans; |
| 484 | | const struct poly_scanline *curscan; |
| 485 | | int x, y, i; |
| 486 | | |
| 487 | | /* loop over two tris */ |
| 488 | | for (i = 0; i < 2; i++) |
| 179 | /* general case; render every non-zero texel */ |
| 180 | for (x = startx; x < stopx; x += xstep) |
| 489 | 181 | { |
| 490 | | /* first tri is 0,1,2; second is 0,3,2 */ |
| 491 | | if (i == 0) |
| 492 | | scans = setup_triangle_0(&vert[0], &vert[1], &vert[2], &machine->screen[0].visarea); |
| 493 | | else |
| 494 | | scans = setup_triangle_0(&vert[0], &vert[3], &vert[2], &machine->screen[0].visarea); |
| 495 | | |
| 496 | | /* skip if we're clipped out */ |
| 497 | | if (!scans) |
| 498 | | continue; |
| 499 | | |
| 500 | | /* loop over scanlines */ |
| 501 | | curscan = scans->scanline; |
| 502 | | for (y = scans->sy; y <= scans->ey; y++, curscan++) |
| 503 | | { |
| 504 | | UINT16 *d = dest + y * 512 + curscan->sx; |
| 505 | | int width = curscan->ex - curscan->sx + 1; |
| 506 | | ADD_TO_PIXEL_COUNT(curscan->ex - curscan->sx + 1); |
| 507 | | for (x = 0; x < width; x++) |
| 508 | | d[x] = pixdata; |
| 509 | | } |
| 182 | UINT8 pix = texbase[((v >> 8) & 0xff00) + (u >> 16)]; |
| 183 | if (pix != 0) |
| 184 | dest[x] = pixdata | pix; |
| 185 | u += dudx; |
| 186 | v += dvdx; |
| 510 | 187 | } |
| 511 | 188 | } |
| 512 | 189 | |
| 513 | 190 | |
| 514 | | static void render_flat_dither_quad(running_machine *machine) |
| 191 | static void render_textransmask(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid) |
| 515 | 192 | { |
| 516 | | UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000]; |
| 517 | | UINT16 pixdata = dma_data[1] | (dma_data[0] & 0x00ff); |
| 518 | | const struct poly_scanline_data *scans; |
| 519 | | const struct poly_scanline *curscan; |
| 520 | | int x, y, i; |
| 193 | poly_extra_data *extra = poly->extra; |
| 194 | UINT16 *dest = (UINT16 *)destbase + scanline * 512; |
| 195 | UINT16 pixdata = extra->pixdata; |
| 196 | const UINT8 *texbase = extra->texbase; |
| 197 | INT32 u = poly_param_value(startx, scanline, 0, poly) * 65536.0f; |
| 198 | INT32 v = poly_param_value(startx, scanline, 1, poly) * 65536.0f; |
| 199 | INT32 dudx = poly->param[0].dpdx * 65536.0f; |
| 200 | INT32 dvdx = poly->param[1].dpdx * 65536.0f; |
| 201 | int xstep = extra->dither + 1; |
| 202 | int x; |
| 521 | 203 | |
| 522 | | /* loop over two tris */ |
| 523 | | for (i = 0; i < 2; i++) |
| 204 | /* if dithering, we advance by 2x; also ensure that we start on an appropriate pixel */ |
| 205 | if (xstep == 2) |
| 524 | 206 | { |
| 525 | | /* first tri is 0,1,2; second is 0,3,2 */ |
| 526 | | if (i == 0) |
| 527 | | scans = setup_triangle_0(&vert[0], &vert[1], &vert[2], &machine->screen[0].visarea); |
| 528 | | else |
| 529 | | scans = setup_triangle_0(&vert[0], &vert[3], &vert[2], &machine->screen[0].visarea); |
| 530 | | |
| 531 | | /* skip if we're clipped out */ |
| 532 | | if (!scans) |
| 533 | | continue; |
| 534 | | |
| 535 | | /* loop over scanlines */ |
| 536 | | curscan = scans->scanline; |
| 537 | | for (y = scans->sy; y <= scans->ey; y++, curscan++) |
| 207 | if ((scanline ^ startx) & 1) |
| 538 | 208 | { |
| 539 | | int tsx = curscan->sx + ((curscan->sx ^ y) & 1); |
| 540 | | UINT16 *d = dest + y * 512; |
| 541 | | ADD_TO_PIXEL_COUNT(curscan->ex - curscan->sx + 1); |
| 542 | | for (x = tsx; x <= curscan->ex; x += 2) |
| 543 | | d[x] = pixdata; |
| 209 | startx++; |
| 210 | u += dudx; |
| 211 | v += dvdx; |
| 544 | 212 | } |
| 213 | dudx *= 2; |
| 214 | dvdx *= 2; |
| 545 | 215 | } |
| 546 | | } |
| 547 | 216 | |
| 548 | | |
| 549 | | |
| 550 | | /************************************* |
| 551 | | * |
| 552 | | * Generic textured quad renderers |
| 553 | | * |
| 554 | | *************************************/ |
| 555 | | |
| 556 | | static void render_tex_quad(running_machine *machine) |
| 557 | | { |
| 558 | | UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000]; |
| 559 | | UINT8 *texbase = (UINT8 *)midvunit_textureram + (dma_data[14] * 256); |
| 560 | | UINT16 pixdata = dma_data[1]; |
| 561 | | const struct poly_scanline_data *scans; |
| 562 | | const struct poly_scanline *curscan; |
| 563 | | int x, y, i; |
| 564 | | |
| 565 | | /* fill in the vertex data */ |
| 566 | | vert[0].p[0] = dma_data[10] & 0xff; |
| 567 | | vert[0].p[1] = dma_data[10] >> 8; |
| 568 | | vert[1].p[0] = dma_data[11] & 0xff; |
| 569 | | vert[1].p[1] = dma_data[11] >> 8; |
| 570 | | vert[2].p[0] = dma_data[12] & 0xff; |
| 571 | | vert[2].p[1] = dma_data[12] >> 8; |
| 572 | | vert[3].p[0] = dma_data[13] & 0xff; |
| 573 | | vert[3].p[1] = dma_data[13] >> 8; |
| 574 | | |
| 575 | | /* loop over two tris */ |
| 576 | | for (i = 0; i < 2; i++) |
| 217 | /* general case; every non-zero texel renders pixdata */ |
| 218 | for (x = startx; x < stopx; x += xstep) |
| 577 | 219 | { |
| 578 | | /* first tri is 0,1,2; second is 0,3,2 */ |
| 579 | | if (i == 0) |
| 580 | | scans = setup_triangle_2(&vert[0], &vert[1], &vert[2], &machine->screen[0].visarea); |
| 581 | | else |
| 582 | | scans = setup_triangle_2(&vert[0], &vert[3], &vert[2], &machine->screen[0].visarea); |
| 583 | | |
| 584 | | /* skip if we're clipped out */ |
| 585 | | if (!scans) |
| 586 | | continue; |
| 587 | | |
| 588 | | /* loop over scanlines */ |
| 589 | | curscan = scans->scanline; |
| 590 | | for (y = scans->sy; y <= scans->ey; y++, curscan++) |
| 591 | | { |
| 592 | | UINT16 *d = dest + y * 512 + curscan->sx; |
| 593 | | int width = curscan->ex - curscan->sx + 1; |
| 594 | | int u = curscan->p[0], dudx = scans->dp[0]; |
| 595 | | int v = curscan->p[1], dvdx = scans->dp[1]; |
| 596 | | ADD_TO_PIXEL_COUNT(curscan->ex - curscan->sx + 1); |
| 597 | | for (x = 0; x < width; x++) |
| 598 | | { |
| 599 | | d[x] = pixdata | texbase[((v >> 8) & 0xff00) + (u >> 16)]; |
| 600 | | u += dudx; |
| 601 | | v += dvdx; |
| 602 | | } |
| 603 | | } |
| 220 | UINT8 pix = texbase[((v >> 8) & 0xff00) + (u >> 16)]; |
| 221 | if (pix != 0) |
| 222 | dest[x] = pixdata; |
| 223 | u += dudx; |
| 224 | v += dvdx; |
| 604 | 225 | } |
| 605 | 226 | } |
| 606 | 227 | |
| 607 | 228 | |
| 608 | | static void render_textrans_quad(running_machine *machine) |
| 609 | | { |
| 610 | | UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000]; |
| 611 | | UINT8 *texbase = (UINT8 *)midvunit_textureram + (dma_data[14] * 256); |
| 612 | | UINT16 pixdata = dma_data[1]; |
| 613 | | const struct poly_scanline_data *scans; |
| 614 | | const struct poly_scanline *curscan; |
| 615 | | int x, y, i; |
| 616 | 229 | |
| 617 | | /* fill in the vertex data */ |
| 618 | | vert[0].p[0] = dma_data[10] & 0xff; |
| 619 | | vert[0].p[1] = dma_data[10] >> 8; |
| 620 | | vert[1].p[0] = dma_data[11] & 0xff; |
| 621 | | vert[1].p[1] = dma_data[11] >> 8; |
| 622 | | vert[2].p[0] = dma_data[12] & 0xff; |
| 623 | | vert[2].p[1] = dma_data[12] >> 8; |
| 624 | | vert[3].p[0] = dma_data[13] & 0xff; |
| 625 | | vert[3].p[1] = dma_data[13] >> 8; |
| 626 | | |
| 627 | | /* loop over two tris */ |
| 628 | | for (i = 0; i < 2; i++) |
| 629 | | { |
| 630 | | /* first tri is 0,1,2; second is 0,3,2 */ |
| 631 | | if (i == 0) |
| 632 | | scans = setup_triangle_2(&vert[0], &vert[1], &vert[2], &machine->screen[0].visarea); |
| 633 | | else |
| 634 | | scans = setup_triangle_2(&vert[0], &vert[3], &vert[2], &machine->screen[0].visarea); |
| 635 | | |
| 636 | | /* skip if we're clipped out */ |
| 637 | | if (!scans) |
| 638 | | continue; |
| 639 | | |
| 640 | | /* loop over scanlines */ |
| 641 | | curscan = scans->scanline; |
| 642 | | for (y = scans->sy; y <= scans->ey; y++, curscan++) |
| 643 | | { |
| 644 | | UINT16 *d = dest + y * 512 + curscan->sx; |
| 645 | | int width = curscan->ex - curscan->sx + 1; |
| 646 | | int u = curscan->p[0], dudx = scans->dp[0]; |
| 647 | | int v = curscan->p[1], dvdx = scans->dp[1]; |
| 648 | | ADD_TO_PIXEL_COUNT(curscan->ex - curscan->sx + 1); |
| 649 | | for (x = 0; x < width; x++) |
| 650 | | { |
| 651 | | int pix = texbase[((v >> 8) & 0xff00) + (u >> 16)]; |
| 652 | | if (pix) d[x] = pixdata | pix; |
| 653 | | u += dudx; |
| 654 | | v += dvdx; |
| 655 | | } |
| 656 | | } |
| 657 | | } |
| 658 | | } |
| 659 | | |
| 660 | | |
| 661 | | static void render_textransmask_quad(running_machine *machine) |
| 662 | | { |
| 663 | | UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000]; |
| 664 | | UINT8 *texbase = (UINT8 *)midvunit_textureram + (dma_data[14] * 256); |
| 665 | | UINT16 pixdata = dma_data[1] | (dma_data[0] & 0x00ff); |
| 666 | | const struct poly_scanline_data *scans; |
| 667 | | const struct poly_scanline *curscan; |
| 668 | | int x, y, i; |
| 669 | | |
| 670 | | /* fill in the vertex data */ |
| 671 | | vert[0].p[0] = dma_data[10] & 0xff; |
| 672 | | vert[0].p[1] = dma_data[10] >> 8; |
| 673 | | vert[1].p[0] = dma_data[11] & 0xff; |
| 674 | | vert[1].p[1] = dma_data[11] >> 8; |
| 675 | | vert[2].p[0] = dma_data[12] & 0xff; |
| 676 | | vert[2].p[1] = dma_data[12] >> 8; |
| 677 | | vert[3].p[0] = dma_data[13] & 0xff; |
| 678 | | vert[3].p[1] = dma_data[13] >> 8; |
| 679 | | |
| 680 | | /* loop over two tris */ |
| 681 | | for (i = 0; i < 2; i++) |
| 682 | | { |
| 683 | | /* first tri is 0,1,2; second is 0,3,2 */ |
| 684 | | if (i == 0) |
| 685 | | scans = setup_triangle_2(&vert[0], &vert[1], &vert[2], &machine->screen[0].visarea); |
| 686 | | else |
| 687 | | scans = setup_triangle_2(&vert[0], &vert[3], &vert[2], &machine->screen[0].visarea); |
| 688 | | |
| 689 | | /* skip if we're clipped out */ |
| 690 | | if (!scans) |
| 691 | | continue; |
| 692 | | |
| 693 | | /* loop over scanlines */ |
| 694 | | curscan = scans->scanline; |
| 695 | | for (y = scans->sy; y <= scans->ey; y++, curscan++) |
| 696 | | { |
| 697 | | UINT16 *d = dest + y * 512 + curscan->sx; |
| 698 | | int width = curscan->ex - curscan->sx + 1; |
| 699 | | int u = curscan->p[0], dudx = scans->dp[0]; |
| 700 | | int v = curscan->p[1], dvdx = scans->dp[1]; |
| 701 | | ADD_TO_PIXEL_COUNT(curscan->ex - curscan->sx + 1); |
| 702 | | for (x = 0; x < width; x++) |
| 703 | | { |
| 704 | | int pix = texbase[((v >> 8) & 0xff00) + (u >> 16)]; |
| 705 | | if (pix) d[x] = pixdata; |
| 706 | | u += dudx; |
| 707 | | v += dvdx; |
| 708 | | } |
| 709 | | } |
| 710 | | } |
| 711 | | } |
| 712 | | |
| 713 | | |
| 714 | | |
| 715 | 230 | /************************************* |
| 716 | 231 | * |
| 717 | | * Generic dithered textured quad renderers |
| 718 | | * |
| 719 | | *************************************/ |
| 720 | | |
| 721 | | static void render_tex_dither_quad(running_machine *machine) |
| 722 | | { |
| 723 | | UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000]; |
| 724 | | UINT8 *texbase = (UINT8 *)midvunit_textureram + (dma_data[14] * 256); |
| 725 | | UINT16 pixdata = dma_data[1]; |
| 726 | | const struct poly_scanline_data *scans; |
| 727 | | const struct poly_scanline *curscan; |
| 728 | | int x, y, i; |
| 729 | | |
| 730 | | /* fill in the vertex data */ |
| 731 | | vert[0].p[0] = dma_data[10] & 0xff; |
| 732 | | vert[0].p[1] = dma_data[10] >> 8; |
| 733 | | vert[1].p[0] = dma_data[11] & 0xff; |
| 734 | | vert[1].p[1] = dma_data[11] >> 8; |
| 735 | | vert[2].p[0] = dma_data[12] & 0xff; |
| 736 | | vert[2].p[1] = dma_data[12] >> 8; |
| 737 | | vert[3].p[0] = dma_data[13] & 0xff; |
| 738 | | vert[3].p[1] = dma_data[13] >> 8; |
| 739 | | |
| 740 | | /* loop over two tris */ |
| 741 | | for (i = 0; i < 2; i++) |
| 742 | | { |
| 743 | | /* first tri is 0,1,2; second is 0,3,2 */ |
| 744 | | if (i == 0) |
| 745 | | scans = setup_triangle_2(&vert[0], &vert[1], &vert[2], &machine->screen[0].visarea); |
| 746 | | else |
| 747 | | scans = setup_triangle_2(&vert[0], &vert[3], &vert[2], &machine->screen[0].visarea); |
| 748 | | |
| 749 | | /* skip if we're clipped out */ |
| 750 | | if (!scans) |
| 751 | | continue; |
| 752 | | |
| 753 | | /* loop over scanlines */ |
| 754 | | curscan = scans->scanline; |
| 755 | | for (y = scans->sy; y <= scans->ey; y++, curscan++) |
| 756 | | { |
| 757 | | int u = curscan->p[0], dudx = scans->dp[0]; |
| 758 | | int v = curscan->p[1], dvdx = scans->dp[1]; |
| 759 | | UINT16 *d = dest + y * 512; |
| 760 | | int tsx = curscan->sx; |
| 761 | | |
| 762 | | ADD_TO_PIXEL_COUNT(curscan->ex - curscan->sx + 1); |
| 763 | | if ((tsx ^ y) & 1) |
| 764 | | { |
| 765 | | tsx++; |
| 766 | | u += dudx; |
| 767 | | v += dvdx; |
| 768 | | } |
| 769 | | |
| 770 | | dudx *= 2; |
| 771 | | dvdx *= 2; |
| 772 | | |
| 773 | | for (x = tsx; x <= curscan->ex; x += 2) |
| 774 | | { |
| 775 | | d[x] = pixdata | texbase[((v >> 8) & 0xff00) + (u >> 16)]; |
| 776 | | u += dudx; |
| 777 | | v += dvdx; |
| 778 | | } |
| 779 | | } |
| 780 | | } |
| 781 | | } |
| 782 | | |
| 783 | | |
| 784 | | static void render_textrans_dither_quad(running_machine *machine) |
| 785 | | { |
| 786 | | UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000]; |
| 787 | | UINT8 *texbase = (UINT8 *)midvunit_textureram + (dma_data[14] * 256); |
| 788 | | UINT16 pixdata = dma_data[1]; |
| 789 | | const struct poly_scanline_data *scans; |
| 790 | | const struct poly_scanline *curscan; |
| 791 | | int x, y, i; |
| 792 | | |
| 793 | | /* fill in the vertex data */ |
| 794 | | vert[0].p[0] = dma_data[10] & 0xff; |
| 795 | | vert[0].p[1] = dma_data[10] >> 8; |
| 796 | | vert[1].p[0] = dma_data[11] & 0xff; |
| 797 | | vert[1].p[1] = dma_data[11] >> 8; |
| 798 | | vert[2].p[0] = dma_data[12] & 0xff; |
| 799 | | vert[2].p[1] = dma_data[12] >> 8; |
| 800 | | vert[3].p[0] = dma_data[13] & 0xff; |
| 801 | | vert[3].p[1] = dma_data[13] >> 8; |
| 802 | | |
| 803 | | /* loop over two tris */ |
| 804 | | for (i = 0; i < 2; i++) |
| 805 | | { |
| 806 | | /* first tri is 0,1,2; second is 0,3,2 */ |
| 807 | | if (i == 0) |
| 808 | | scans = setup_triangle_2(&vert[0], &vert[1], &vert[2], &machine->screen[0].visarea); |
| 809 | | else |
| 810 | | scans = setup_triangle_2(&vert[0], &vert[3], &vert[2], &machine->screen[0].visarea); |
| 811 | | |
| 812 | | /* skip if we're clipped out */ |
| 813 | | if (!scans) |
| 814 | | continue; |
| 815 | | |
| 816 | | /* loop over scanlines */ |
| 817 | | curscan = scans->scanline; |
| 818 | | for (y = scans->sy; y <= scans->ey; y++, curscan++) |
| 819 | | { |
| 820 | | int u = curscan->p[0], dudx = scans->dp[0]; |
| 821 | | int v = curscan->p[1], dvdx = scans->dp[1]; |
| 822 | | UINT16 *d = dest + y * 512; |
| 823 | | int tsx = curscan->sx; |
| 824 | | |
| 825 | | ADD_TO_PIXEL_COUNT(curscan->ex - curscan->sx + 1); |
| 826 | | if ((tsx ^ y) & 1) |
| 827 | | { |
| 828 | | tsx++; |
| 829 | | u += dudx; |
| 830 | | v += dvdx; |
| 831 | | } |
| 832 | | |
| 833 | | dudx *= 2; |
| 834 | | dvdx *= 2; |
| 835 | | |
| 836 | | for (x = tsx; x <= curscan->ex; x += 2) |
| 837 | | { |
| 838 | | int pix = texbase[((v >> 8) & 0xff00) + (u >> 16)]; |
| 839 | | if (pix) d[x] = pixdata | pix; |
| 840 | | u += dudx; |
| 841 | | v += dvdx; |
| 842 | | } |
| 843 | | } |
| 844 | | } |
| 845 | | } |
| 846 | | |
| 847 | | |
| 848 | | static void render_textransmask_dither_quad(running_machine *machine) |
| 849 | | { |
| 850 | | UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000]; |
| 851 | | UINT8 *texbase = (UINT8 *)midvunit_textureram + (dma_data[14] * 256); |
| 852 | | UINT16 pixdata = dma_data[1] | (dma_data[0] & 0x00ff); |
| 853 | | const struct poly_scanline_data *scans; |
| 854 | | const struct poly_scanline *curscan; |
| 855 | | int x, y, i; |
| 856 | | |
| 857 | | /* fill in the vertex data */ |
| 858 | | vert[0].p[0] = dma_data[10] & 0xff; |
| 859 | | vert[0].p[1] = dma_data[10] >> 8; |
| 860 | | vert[1].p[0] = dma_data[11] & 0xff; |
| 861 | | vert[1].p[1] = dma_data[11] >> 8; |
| 862 | | vert[2].p[0] = dma_data[12] & 0xff; |
| 863 | | vert[2].p[1] = dma_data[12] >> 8; |
| 864 | | vert[3].p[0] = dma_data[13] & 0xff; |
| 865 | | vert[3].p[1] = dma_data[13] >> 8; |
| 866 | | |
| 867 | | /* loop over two tris */ |
| 868 | | for (i = 0; i < 2; i++) |
| 869 | | { |
| 870 | | /* first tri is 0,1,2; second is 0,3,2 */ |
| 871 | | if (i == 0) |
| 872 | | scans = setup_triangle_2(&vert[0], &vert[1], &vert[2], &machine->screen[0].visarea); |
| 873 | | else |
| 874 | | scans = setup_triangle_2(&vert[0], &vert[3], &vert[2], &machine->screen[0].visarea); |
| 875 | | |
| 876 | | /* skip if we're clipped out */ |
| 877 | | if (!scans) |
| 878 | | continue; |
| 879 | | |
| 880 | | /* loop over scanlines */ |
| 881 | | curscan = scans->scanline; |
| 882 | | for (y = scans->sy; y <= scans->ey; y++, curscan++) |
| 883 | | { |
| 884 | | int u = curscan->p[0], dudx = scans->dp[0]; |
| 885 | | int v = curscan->p[1], dvdx = scans->dp[1]; |
| 886 | | UINT16 *d = dest + y * 512; |
| 887 | | int tsx = curscan->sx; |
| 888 | | |
| 889 | | ADD_TO_PIXEL_COUNT(curscan->ex - curscan->sx + 1); |
| 890 | | if ((tsx ^ y) & 1) |
| 891 | | { |
| 892 | | tsx++; |
| 893 | | u += dudx; |
| 894 | | v += dvdx; |
| 895 | | } |
| 896 | | |
| 897 | | dudx *= 2; |
| 898 | | dvdx *= 2; |
| 899 | | |
| 900 | | for (x = tsx; x <= curscan->ex; x += 2) |
| 901 | | { |
| 902 | | int pix = texbase[((v >> 8) & 0xff00) + (u >> 16)]; |
| 903 | | if (pix) d[x] = pixdata; |
| 904 | | u += dudx; |
| 905 | | v += dvdx; |
| 906 | | } |
| 907 | | } |
| 908 | | } |
| 909 | | } |
| 910 | | |
| 911 | | |
| 912 | | |
| 913 | | /************************************* |
| 914 | | * |
| 915 | 232 | * DMA queue processor |
| 916 | 233 | * |
| 917 | 234 | *************************************/ |
| r1185 | r1186 | |
| 919 | 236 | static void process_dma_queue(running_machine *machine) |
| 920 | 237 | { |
| 921 | 238 | int textured = ((dma_data[0] & 0x300) == 0x100); |
| 922 | | int dithered = dma_data[0] & 0x2000; |
| 923 | | int straight; |
| 239 | poly_draw_scanline callback; |
| 240 | poly_vertex vert[4]; |
| 241 | int i; |
| 924 | 242 | |
| 925 | | #if KEEP_STATISTICS |
| 926 | | polycount++; |
| 927 | | #endif |
| 928 | | |
| 929 | 243 | /* if we're rendering to the same page we're viewing, it has changed */ |
| 930 | 244 | if ((((page_control >> 2) ^ page_control) & 1) == 0) |
| 931 | 245 | video_changed = TRUE; |
| 932 | 246 | |
| 933 | 247 | /* fill in the vertex data */ |
| 934 | | vert[0].x = (INT16)dma_data[2]; |
| 935 | | vert[0].y = (INT16)dma_data[3]; |
| 936 | | vert[1].x = (INT16)dma_data[4]; |
| 937 | | vert[1].y = (INT16)dma_data[5]; |
| 938 | | vert[2].x = (INT16)dma_data[6]; |
| 939 | | vert[2].y = (INT16)dma_data[7]; |
| 940 | | vert[3].x = (INT16)dma_data[8]; |
| 941 | | vert[3].y = (INT16)dma_data[9]; |
| 248 | vert[0].x = (float)(INT16)dma_data[2]; |
| 249 | vert[0].y = (float)(INT16)dma_data[3]; |
| 250 | vert[1].x = (float)(INT16)dma_data[4]; |
| 251 | vert[1].y = (float)(INT16)dma_data[5]; |
| 252 | vert[2].x = (float)(INT16)dma_data[6]; |
| 253 | vert[2].y = (float)(INT16)dma_data[7]; |
| 254 | vert[3].x = (float)(INT16)dma_data[8]; |
| 255 | vert[3].y = (float)(INT16)dma_data[9]; |
| 942 | 256 | |
| 943 | | /* determine if it's straight-on or arbitrary */ |
| 944 | | straight = quad_is_straight(); |
| 945 | | |
| 946 | 257 | /* handle flat-shaded quads here */ |
| 947 | 258 | if (!textured) |
| 948 | | { |
| 949 | | /* two cases: straight on and arbitrary */ |
| 950 | | if (straight) |
| 951 | | { |
| 952 | | if (!dithered) |
| 953 | | render_straight_flat_quad(machine); |
| 954 | | else |
| 955 | | render_straight_flat_dither_quad(machine); |
| 956 | | } |
| 957 | | else |
| 958 | | { |
| 959 | | if (!dithered) |
| 960 | | render_flat_quad(machine); |
| 961 | | else |
| 962 | | render_flat_dither_quad(machine); |
| 963 | | } |
| 964 | | } |
| 259 | callback = render_flat; |
| 965 | 260 | |
| 966 | 261 | /* handle textured quads here */ |
| 967 | 262 | else |
| 968 | 263 | { |
| 969 | | /* three cases: straight on, non-dithered arbitrary, and dithered arbitrary */ |
| 970 | | if (straight && !dithered) |
| 971 | | { |
| 972 | | /* handle non-masked, non-transparent quads */ |
| 973 | | if ((dma_data[0] & 0xc00) == 0x000) |
| 974 | | render_straight_tex_quad(machine); |
| 264 | /* if textured, add the texture info */ |
| 265 | vert[0].p[0] = (float)(dma_data[10] & 0xff); |
| 266 | vert[0].p[1] = (float)(dma_data[10] >> 8); |
| 267 | vert[1].p[0] = (float)(dma_data[11] & 0xff); |
| 268 | vert[1].p[1] = (float)(dma_data[11] >> 8); |
| 269 | vert[2].p[0] = (float)(dma_data[12] & 0xff); |
| 270 | vert[2].p[1] = (float)(dma_data[12] >> 8); |
| 271 | vert[3].p[0] = (float)(dma_data[13] & 0xff); |
| 272 | vert[3].p[1] = (float)(dma_data[13] >> 8); |
| 975 | 273 | |
| 976 | | /* handle non-masked, transparent quads */ |
| 977 | | else if ((dma_data[0] & 0xc00) == 0x800) |
| 978 | | render_straight_textrans_quad(machine); |
| 274 | /* handle non-masked, non-transparent quads */ |
| 275 | if ((dma_data[0] & 0xc00) == 0x000) |
| 276 | callback = render_tex; |
| 979 | 277 | |
| 980 | | /* handle masked, transparent quads */ |
| 981 | | else if ((dma_data[0] & 0xc00) == 0xc00) |
| 982 | | render_straight_textransmask_quad(machine); |
| 278 | /* handle non-masked, transparent quads */ |
| 279 | else if ((dma_data[0] & 0xc00) == 0x800) |
| 280 | callback = render_textrans; |
| 983 | 281 | |
| 984 | | /* handle masked, non-transparent quads */ |
| 985 | | else |
| 986 | | render_straight_flat_quad(machine); |
| 987 | | } |
| 988 | | else if (!dithered) |
| 989 | | { |
| 990 | | /* handle non-masked, non-transparent quads */ |
| 991 | | if ((dma_data[0] & 0xc00) == 0x000) |
| 992 | | render_tex_quad(machine); |
| 282 | /* handle masked, transparent quads */ |
| 283 | else if ((dma_data[0] & 0xc00) == 0xc00) |
| 284 | callback = render_textransmask; |
| 993 | 285 | |
| 994 | | /* handle non-masked, transparent quads */ |
| 995 | | else if ((dma_data[0] & 0xc00) == 0x800) |
| 996 | | render_textrans_quad(machine); |
| 997 | | |
| 998 | | /* handle masked, transparent quads */ |
| 999 | | else if ((dma_data[0] & 0xc00) == 0xc00) |
| 1000 | | render_textransmask_quad(machine); |
| 1001 | | |
| 1002 | | /* handle masked, non-transparent quads */ |
| 1003 | | else |
| 1004 | | render_flat_quad(machine); |
| 1005 | | } |
| 286 | /* handle masked, non-transparent quads */ |
| 1006 | 287 | else |
| 1007 | | { |
| 1008 | | /* handle non-masked, non-transparent quads */ |
| 1009 | | if ((dma_data[0] & 0xc00) == 0x000) |
| 1010 | | render_tex_dither_quad(machine); |
| 288 | callback = render_flat; |
| 289 | } |
| 1011 | 290 | |
| 1012 | | /* handle non-masked, transparent quads */ |
| 1013 | | else if ((dma_data[0] & 0xc00) == 0x800) |
| 1014 | | render_textrans_dither_quad(machine); |
| 291 | /* loop over two tris */ |
| 292 | for (i = 0; i < 2; i++) |
| 293 | { |
| 294 | poly_extra_data *extra = poly_get_extra_data(poly); |
| 295 | UINT16 *dest = &midvunit_videoram[(page_control & 4) ? 0x40000 : 0x00000]; |
| 1015 | 296 | |
| 1016 | | /* handle masked, transparent quads */ |
| 1017 | | else if ((dma_data[0] & 0xc00) == 0xc00) |
| 1018 | | render_textransmask_dither_quad(machine); |
| 297 | /* set up the extra data for this triangle */ |
| 298 | extra->texbase = (UINT8 *)midvunit_textureram + (dma_data[14] * 256); |
| 299 | extra->pixdata = dma_data[1] | (dma_data[0] & 0x00ff); |
| 300 | extra->dither = ((dma_data[0] & 0x2000) != 0); |
| 1019 | 301 | |
| 1020 | | /* handle masked, non-transparent quads */ |
| 1021 | | else |
| 1022 | | render_flat_dither_quad(machine); |
| 1023 | | } |
| 302 | /* first tri is 0,1,2; second is 0,3,2 */ |
| 303 | if (i == 0) |
| 304 | poly_render_triangle(poly, dest, &machine->screen[0].visarea, callback, textured ? 2 : 0, &vert[0], &vert[1], &vert[2]); |
| 305 | else |
| 306 | poly_render_triangle(poly, dest, &machine->screen[0].visarea, callback, textured ? 2 : 0, &vert[0], &vert[3], &vert[2]); |
| 1024 | 307 | } |
| 1025 | 308 | } |
| 1026 | 309 | |
| r1185 | r1186 | |
| 1076 | 359 | video_changed = TRUE; |
| 1077 | 360 | if (LOG_DMA && input_code_pressed(KEYCODE_L)) |
| 1078 | 361 | logerror("##########################################################\n"); |
| 1079 | | #if KEEP_STATISTICS |
| 1080 | | popmessage("Polys:%d Render:%d%% FPS:%d", |
| 1081 | | polycount, pixelcount / (512*4), lastfps); |
| 1082 | | polycount = pixelcount = 0; |
| 1083 | | framecount++; |
| 1084 | | #endif |
| 1085 | 362 | video_screen_update_partial(0, video_screen_get_vpos(0) - 1); |
| 1086 | 363 | } |
| 1087 | 364 | page_control = data; |
| r1185 | r1186 | |
| 1142 | 419 | |
| 1143 | 420 | WRITE32_HANDLER( midvunit_videoram_w ) |
| 1144 | 421 | { |
| 422 | poly_wait(poly, "Video RAM write"); |
| 1145 | 423 | if (!video_changed) |
| 1146 | 424 | { |
| 1147 | 425 | int visbase = (page_control & 1) ? 0x40000 : 0x00000; |
| r1185 | r1186 | |
| 1154 | 432 | |
| 1155 | 433 | READ32_HANDLER( midvunit_videoram_r ) |
| 1156 | 434 | { |
| 435 | poly_wait(poly, "Video RAM read"); |
| 1157 | 436 | return midvunit_videoram[offset]; |
| 1158 | 437 | } |
| 1159 | 438 | |
| r1185 | r1186 | |
| 1185 | 464 | WRITE32_HANDLER( midvunit_textureram_w ) |
| 1186 | 465 | { |
| 1187 | 466 | UINT8 *base = (UINT8 *)midvunit_textureram; |
| 467 | poly_wait(poly, "Texture RAM write"); |
| 1188 | 468 | base[offset * 2] = data; |
| 1189 | 469 | base[offset * 2 + 1] = data >> 8; |
| 1190 | 470 | } |
| r1185 | r1186 | |
| 1210 | 490 | int x, y, width, xoffs; |
| 1211 | 491 | UINT32 offset; |
| 1212 | 492 | |
| 493 | poly_wait(poly, "Refresh Time"); |
| 494 | |
| 1213 | 495 | /* if the video didn't change, indicate as much */ |
| 1214 | 496 | if (!video_changed) |
| 1215 | 497 | return UPDATE_HAS_NOT_CHANGED; |
| 1216 | 498 | video_changed = FALSE; |
| 1217 | 499 | |
| 1218 | | #if KEEP_STATISTICS |
| 1219 | | totalframes++; |
| 1220 | | if (totalframes == 57) |
| 1221 | | { |
| 1222 | | lastfps = framecount; |
| 1223 | | framecount = totalframes = 0; |
| 1224 | | } |
| 1225 | | #endif |
| 1226 | | |
| 1227 | 500 | /* determine the base of the videoram */ |
| 1228 | 501 | #if WATCH_RENDER |
| 1229 | 502 | offset = (page_control & 4) ? 0x40000 : 0x00000; |
src/mame/drivers/hornet.c
| r1185 | r1186 | |
| 681 | 681 | AM_RANGE(0x7d04a000, 0x7d04a003) AM_MIRROR(0x80000000) AM_WRITE(comm_rombank_w) |
| 682 | 682 | AM_RANGE(0x7d050000, 0x7d05ffff) AM_MIRROR(0x80000000) AM_ROMBANK(1) /* COMM BOARD 1 */ |
| 683 | 683 | AM_RANGE(0x7e000000, 0x7e7fffff) AM_MIRROR(0x80000000) AM_ROM AM_REGION(REGION_USER2, 0) /* Data ROM */ |
| 684 | | AM_RANGE(0x7f000000, 0x7f1fffff) AM_MIRROR(0x80000000) AM_ROM AM_SHARE(2) |
| 685 | | AM_RANGE(0x7fe00000, 0x7fffffff) AM_MIRROR(0x80000000) AM_ROM AM_REGION(REGION_USER1, 0) AM_SHARE(2) /* Program ROM */ |
| 684 | AM_RANGE(0x7f000000, 0x7f3fffff) AM_MIRROR(0x80000000) AM_ROM AM_SHARE(2) |
| 685 | AM_RANGE(0x7fc00000, 0x7fffffff) AM_MIRROR(0x80000000) AM_ROM AM_REGION(REGION_USER1, 0) AM_SHARE(2) /* Program ROM */ |
| 686 | 686 | ADDRESS_MAP_END |
| 687 | 687 | |
| 688 | 688 | /*****************************************************************************/ |
| r1185 | r1186 | |
| 1248 | 1248 | init_hornet(machine); |
| 1249 | 1249 | } |
| 1250 | 1250 | |
| 1251 | static DRIVER_INIT(terabrst) |
| 1252 | { |
| 1253 | int i; |
| 1254 | UINT16 checksum; |
| 1255 | |
| 1256 | /* RTC data */ |
| 1257 | backup_ram[0x00] = 0x47; // 'G' |
| 1258 | backup_ram[0x01] = 0x4e; // 'N' |
| 1259 | backup_ram[0x02] = 0x37; // '7' |
| 1260 | backup_ram[0x03] = 0x31; // '1' |
| 1261 | backup_ram[0x04] = 0x35; // '5' |
| 1262 | backup_ram[0x05] = 0x00; // |
| 1263 | backup_ram[0x06] = 0x00; // |
| 1264 | backup_ram[0x07] = 0x00; // |
| 1265 | backup_ram[0x08] = 0x19; // |
| 1266 | backup_ram[0x09] = 0x98; // 1998 |
| 1267 | backup_ram[0x0a] = 0x41; // 'J' |
| 1268 | backup_ram[0x0b] = 0x41; // 'A' |
| 1269 | backup_ram[0x0c] = 0x45; // 'E' |
| 1270 | backup_ram[0x0d] = 0x00; // |
| 1271 | |
| 1272 | checksum = 0; |
| 1273 | for (i=0; i < 14; i+=2) |
| 1274 | { |
| 1275 | checksum += (backup_ram[i] << 8) | (backup_ram[i+1]); |
| 1276 | } |
| 1277 | checksum = ~checksum - 0; |
| 1278 | backup_ram[0x0e] = (checksum >> 8) & 0xff; // checksum |
| 1279 | backup_ram[0x0f] = (checksum >> 0) & 0xff; // checksum |
| 1280 | |
| 1281 | voodoo_version = 0; |
| 1282 | init_hornet_2board(machine); |
| 1283 | } |
| 1284 | |
| 1251 | 1285 | static DRIVER_INIT(sscope) |
| 1252 | 1286 | { |
| 1253 | 1287 | int i; |
| r1185 | r1186 | |
| 1347 | 1381 | /*****************************************************************************/ |
| 1348 | 1382 | |
| 1349 | 1383 | ROM_START(sscope) |
| 1350 | | ROM_REGION32_BE(0x200000, REGION_USER1, 0) /* PowerPC program */ |
| 1351 | | ROM_LOAD16_WORD_SWAP("ss1-1.27p", 0x000000, 0x200000, CRC(3b6bb075) SHA1(babc134c3a20c7cdcaa735d5f1fd5cab38667a14)) |
| 1384 | ROM_REGION32_BE(0x400000, REGION_USER1, 0) /* PowerPC program */ |
| 1385 | ROM_LOAD16_WORD_SWAP("ss1-1.27p", 0x200000, 0x200000, CRC(3b6bb075) SHA1(babc134c3a20c7cdcaa735d5f1fd5cab38667a14)) |
| 1352 | 1386 | |
| 1353 | 1387 | ROM_REGION32_BE(0x800000, REGION_USER2, ROMREGION_ERASE00) /* Data roms */ |
| 1354 | 1388 | |
| r1185 | r1186 | |
| 1365 | 1399 | ROM_END |
| 1366 | 1400 | |
| 1367 | 1401 | ROM_START(sscopea) |
| 1368 | | ROM_REGION32_BE(0x200000, REGION_USER1, 0) /* PowerPC program */ |
| 1369 | | ROM_LOAD16_WORD_SWAP("830_a01.bin", 0x000000, 0x200000, CRC(39e353f1) SHA1(569b06969ae7a690f6d6e63cc3b5336061663a37)) |
| 1402 | ROM_REGION32_BE(0x400000, REGION_USER1, 0) /* PowerPC program */ |
| 1403 | ROM_LOAD16_WORD_SWAP("830_a01.bin", 0x200000, 0x200000, CRC(39e353f1) SHA1(569b06969ae7a690f6d6e63cc3b5336061663a37)) |
| 1370 | 1404 | |
| 1371 | 1405 | ROM_REGION32_BE(0x800000, REGION_USER2, ROMREGION_ERASE00) /* Data roms */ |
| 1372 | 1406 | |
| r1185 | r1186 | |
| 1383 | 1417 | ROM_END |
| 1384 | 1418 | |
| 1385 | 1419 | ROM_START(sscope2) |
| 1386 | | ROM_REGION32_BE(0x200000, REGION_USER1, 0) /* PowerPC program */ |
| 1387 | | ROM_LOAD16_WORD_SWAP("931d01.bin", 0x000000, 0x200000, CRC(4065fde6) SHA1(84f2dedc3e8f61651b22c0a21433a64993e1b9e2)) |
| 1420 | ROM_REGION32_BE(0x400000, REGION_USER1, 0) /* PowerPC program */ |
| 1421 | ROM_LOAD16_WORD_SWAP("931d01.bin", 0x200000, 0x200000, CRC(4065fde6) SHA1(84f2dedc3e8f61651b22c0a21433a64993e1b9e2)) |
| 1388 | 1422 | |
| 1389 | 1423 | ROM_REGION32_BE(0x800000, REGION_USER2, 0) /* Data roms */ |
| 1390 | 1424 | ROM_LOAD32_WORD_SWAP("931a04.bin", 0x000000, 0x200000, CRC(4f5917e6) SHA1(a63a107f1d6d9756e4ab0965d72ea446f0692814)) |
| r1185 | r1186 | |
| 1405 | 1439 | ROM_END |
| 1406 | 1440 | |
| 1407 | 1441 | ROM_START(gradius4) |
| 1408 | | ROM_REGION32_BE(0x200000, REGION_USER1, 0) /* PowerPC program */ |
| 1409 | | ROM_LOAD16_WORD_SWAP( "837c01.27p", 0x000000, 0x200000, CRC(ce003123) SHA1(15e33997be2c1b3f71998627c540db378680a7a1) ) |
| 1442 | ROM_REGION32_BE(0x400000, REGION_USER1, 0) /* PowerPC program */ |
| 1443 | ROM_LOAD16_WORD_SWAP( "837c01.27p", 0x200000, 0x200000, CRC(ce003123) SHA1(15e33997be2c1b3f71998627c540db378680a7a1) ) |
| 1410 | 1444 | |
| 1411 | 1445 | ROM_REGION32_BE(0x800000, REGION_USER2, 0) /* Data roms */ |
| 1412 | 1446 | ROM_LOAD32_WORD_SWAP( "837a04.16t", 0x000000, 0x200000, CRC(18453b59) SHA1(3c75a54d8c09c0796223b42d30fb3867a911a074) ) |
| r1185 | r1186 | |
| 1427 | 1461 | ROM_END |
| 1428 | 1462 | |
| 1429 | 1463 | ROM_START(nbapbp) |
| 1430 | | ROM_REGION32_BE(0x200000, REGION_USER1, 0) /* PowerPC program */ |
| 1431 | | ROM_LOAD16_WORD_SWAP( "778a01.27p", 0x000000, 0x200000, CRC(e70019ce) SHA1(8b187b6e670fdc88771da08a56685cd621b139dc) ) |
| 1464 | ROM_REGION32_BE(0x400000, REGION_USER1, 0) /* PowerPC program */ |
| 1465 | ROM_LOAD16_WORD_SWAP( "778a01.27p", 0x200000, 0x200000, CRC(e70019ce) SHA1(8b187b6e670fdc88771da08a56685cd621b139dc) ) |
| 1432 | 1466 | |
| 1433 | 1467 | ROM_REGION32_BE(0x800000, REGION_USER2, 0) /* Data roms */ |
| 1434 | 1468 | ROM_LOAD32_WORD_SWAP( "778a04.16t", 0x000000, 0x400000, CRC(62c70132) SHA1(405aed149fc51e0adfa3ace3c644e47d53cf1ee3) ) |
| r1185 | r1186 | |
| 1450 | 1484 | ROM_LOAD( "778a12.9p", 0xc00000, 0x400000, CRC(27d0c724) SHA1(48e48cbaea6db0de8c3471a2eda6faaa16eed46e) ) |
| 1451 | 1485 | ROM_END |
| 1452 | 1486 | |
| 1487 | ROM_START(terabrst) |
| 1488 | ROM_REGION32_BE(0x400000, REGION_USER1, 0) /* PowerPC program */ |
| 1489 | ROM_LOAD32_WORD_SWAP( "715a02.25p", 0x000000, 0x200000, CRC(070c48b3) SHA1(066cefbd34d8f6476083417471114f782bef97fb) ) |
| 1490 | ROM_LOAD32_WORD_SWAP( "715a03.22p", 0x000002, 0x200000, CRC(f77d242f) SHA1(7680e4abcccd549b3f6d1d245f64631fab57e80d) ) |
| 1491 | |
| 1492 | ROM_REGION32_BE(0x800000, REGION_USER2, 0) /* Data roms */ |
| 1493 | ROM_LOAD32_WORD_SWAP( "715a04.16t", 0x000000, 0x200000, CRC(00d9567e) SHA1(fe372399ad0ae89d557c93c3145b38e3ed0f714d) ) |
| 1494 | ROM_LOAD32_WORD_SWAP( "715a05.14t", 0x000002, 0x200000, CRC(462d53bf) SHA1(0216a84358571de6791365c69a1fa8fe2784148d) ) |
| 1495 | |
| 1496 | ROM_REGION32_BE(0x1000000, REGION_USER5, 0) /* CG Board texture roms */ |
| 1497 | ROM_LOAD32_WORD_SWAP( "715a14.32u", 0x000002, 0x400000, CRC(bbb36be3) SHA1(c828d0af0546db02e87afe68423b9447db7c7e51) ) |
| 1498 | ROM_LOAD32_WORD_SWAP( "715a13.24u", 0x000000, 0x400000, CRC(dbff58a1) SHA1(f0c60bb2cbf268cfcbdd65606ebb18f1b4839c0e) ) |
| 1499 | |
| 1500 | ROM_REGION(0x80000, REGION_CPU2, 0) /* 68K Program */ |
| 1501 | ROM_LOAD16_WORD_SWAP( "715a08.7s", 0x000000, 0x080000, CRC(3aa2f4a5) SHA1(bb43e5f5ef4ac51f228d4d825be66d3c720d51ea) ) |
| 1502 | |
| 1503 | ROM_REGION(0x1000000, REGION_SOUND1, 0) /* PCM sample roms */ |
| 1504 | ROM_LOAD( "715a09.16p", 0x000000, 0x400000, CRC(65845866) SHA1(d2a63d0deef1901e6fa21b55c5f96e1f781dceda) ) |
| 1505 | ROM_LOAD( "715a10.14p", 0x400000, 0x400000, CRC(294fe71b) SHA1(ac5fff5627df1cee4f1e1867377f208b34334899) ) |
| 1506 | |
| 1507 | ROM_REGION(0x20000, REGION_CPU3, 0) /* 68K Program */ |
| 1508 | ROM_LOAD16_WORD_SWAP( "715a17.20k", 0x000000, 0x020000, CRC(f0b7ba0c) SHA1(863b260824b0ae2f890ba84d1c9a8f436891b1ff) ) |
| 1509 | ROM_END |
| 1510 | |
| 1453 | 1511 | /*************************************************************************/ |
| 1454 | 1512 | |
| 1455 | 1513 | GAME( 1998, gradius4, 0, hornet, hornet, gradius4, ROT0, "Konami", "Gradius 4: Fukkatsu", GAME_IMPERFECT_SOUND ) |
| 1456 | 1514 | GAME( 1998, nbapbp, 0, hornet, hornet, nbapbp, ROT0, "Konami", "NBA Play By Play", GAME_IMPERFECT_SOUND ) |
| 1515 | GAMEL( 1998, terabrst, 0, hornet_2board, hornet, terabrst, ROT0, "Konami", "Teraburst", GAME_IMPERFECT_SOUND, layout_dualhsxs ) |
| 1457 | 1516 | GAMEL( 2000, sscope, 0, hornet_2board, sscope, sscope, ROT0, "Konami", "Silent Scope (ver UAB)", GAME_IMPERFECT_SOUND|GAME_NOT_WORKING, layout_dualhsxs ) |
| 1458 | 1517 | GAMEL( 2000, sscopea, sscope, hornet_2board, sscope, sscope, ROT0, "Konami", "Silent Scope (ver UAA)", GAME_IMPERFECT_SOUND|GAME_NOT_WORKING, layout_dualhsxs ) |
| 1459 | 1518 | GAMEL( 2000, sscope2, 0, hornet_2board, sscope, sscope2, ROT0, "Konami", "Silent Scope 2", GAME_IMPERFECT_SOUND|GAME_NOT_WORKING, layout_dualhsxs ) |
src/mame/drivers/midzeus.c
| r1185 | r1186 | |
| 110 | 110 | 01C03E:graphics_w(0CE) = 00007620 |
| 111 | 111 | 01C03E:graphics_w(0CD) = 00000000 |
| 112 | 112 | 01C03E:graphics_w(0CC) = 00000000 |
| 113 | | 01C03E:graphics_w(0CB) = 00000116 |
| 114 | | 01C03E:graphics_w(0CA) = 00000107 |
| 115 | | 01C03E:graphics_w(0C9) = 00000103 |
| 116 | | 01C03E:graphics_w(0C8) = 000000FF |
| 113 | 01C03E:graphics_w(0CB) = 00000116 = VTOTAL(?) |
| 114 | 01C03E:graphics_w(0CA) = 00000107 = VSYNC END |
| 115 | 01C03E:graphics_w(0C9) = 00000103 = VSYNC START |
| 116 | 01C03E:graphics_w(0C8) = 000000FF = VBSTART |
| 117 | 117 | 01C03E:graphics_w(0C7) = 00000211 |
| 118 | 118 | 01C03E:graphics_w(0C6) = 0000007F |
| 119 | 119 | 01C03E:graphics_w(0C5) = 0000000C |
| r1185 | r1186 | |
| 829 | 829 | } |
| 830 | 830 | |
| 831 | 831 | |
| 832 | static READ32_HANDLER( graphics2_r ) |
| 833 | { |
| 834 | return graphics_r(offset * 2, 0); |
| 835 | } |
| 832 | 836 | |
| 837 | |
| 838 | static WRITE32_HANDLER( graphics2_w ) |
| 839 | { |
| 840 | graphics_w(offset * 2, data, mem_mask); |
| 841 | } |
| 842 | |
| 843 | |
| 844 | |
| 833 | 845 | /************************************* |
| 834 | 846 | * |
| 835 | 847 | * Machine init |
| r1185 | r1186 | |
| 838 | 850 | |
| 839 | 851 | static MACHINE_RESET( midzeus ) |
| 840 | 852 | { |
| 841 | | memcpy(ram_base, memory_region(REGION_USER1), 0x20000*4); |
| 853 | memcpy(ram_base, memory_region(REGION_USER1), 0x40000*4); |
| 842 | 854 | |
| 843 | 855 | *(UINT32 *)ram_base *= 2; |
| 844 | 856 | |
| r1185 | r1186 | |
| 942 | 954 | } |
| 943 | 955 | |
| 944 | 956 | |
| 945 | | static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 957 | static ADDRESS_MAP_START( zeus_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 946 | 958 | ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) ) |
| 947 | 959 | AM_RANGE(0x000000, 0x03ffff) AM_RAM AM_BASE(&ram_base) |
| 948 | 960 | AM_RANGE(0x400000, 0x41ffff) AM_RAM |
| r1185 | r1186 | |
| 959 | 971 | ADDRESS_MAP_END |
| 960 | 972 | |
| 961 | 973 | |
| 974 | static ADDRESS_MAP_START( zeus2_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 975 | ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) ) |
| 976 | AM_RANGE(0x000000, 0x03ffff) AM_RAM AM_BASE(&ram_base) |
| 977 | AM_RANGE(0x400000, 0x43ffff) AM_RAM |
| 978 | AM_RANGE(0x808000, 0x80807f) AM_READWRITE(tms32031_control_r, tms32031_control_w) AM_BASE(&tms32031_control) |
| 979 | AM_RANGE(0x87fe00, 0x87ffff) AM_RAM |
| 980 | AM_RANGE(0x880000, 0x8801ff) AM_READWRITE(graphics2_r, graphics2_w) AM_BASE(&graphics_ram) |
| 981 | AM_RANGE(0x8d0000, 0x8d0003) AM_READWRITE(unknown_8d0000_r, unknown_8d0000_w) AM_BASE(&unknown_8d0000) |
| 982 | AM_RANGE(0x990000, 0x99000f) AM_READWRITE(midway_ioasic_r, midway_ioasic_w) |
| 983 | //9d0000 -- page select? |
| 984 | AM_RANGE(0x9e0000, 0x9e0000) AM_WRITENOP // watchdog? |
| 985 | AM_RANGE(0x9f0000, 0x9f7fff) AM_READWRITE(cmos_r, cmos_w) AM_BASE(&generic_nvram32) AM_SIZE(&generic_nvram_size) |
| 986 | AM_RANGE(0x9f8000, 0x9f8000) AM_WRITE(cmos_protect_w) |
| 987 | AM_RANGE(0xa00000, 0xffffff) AM_ROM AM_REGION(REGION_USER1, 0) |
| 988 | ADDRESS_MAP_END |
| 962 | 989 | |
| 990 | |
| 991 | |
| 963 | 992 | /************************************* |
| 964 | 993 | * |
| 965 | 994 | * Input ports |
| r1185 | r1186 | |
| 1402 | 1431 | |
| 1403 | 1432 | /* basic machine hardware */ |
| 1404 | 1433 | MDRV_CPU_ADD_TAG("main", TMS32031, 50000000) // actually, TMS32032 |
| 1405 | | MDRV_CPU_PROGRAM_MAP(main_map,0) |
| 1434 | MDRV_CPU_PROGRAM_MAP(zeus_map,0) |
| 1406 | 1435 | MDRV_CPU_VBLANK_INT(irq0_line_assert,1) |
| 1407 | 1436 | |
| 1408 | 1437 | MDRV_SCREEN_REFRESH_RATE(57) |
| r1185 | r1186 | |
| 1426 | 1455 | MACHINE_DRIVER_END |
| 1427 | 1456 | |
| 1428 | 1457 | |
| 1458 | MACHINE_DRIVER_START( midzeus2 ) |
| 1459 | MDRV_IMPORT_FROM(midzeus) |
| 1429 | 1460 | |
| 1461 | /* basic machine hardware */ |
| 1462 | MDRV_CPU_MODIFY("main") |
| 1463 | MDRV_CPU_PROGRAM_MAP(zeus2_map,0) |
| 1464 | MACHINE_DRIVER_END |
| 1465 | |
| 1466 | |
| 1467 | |
| 1430 | 1468 | /************************************* |
| 1431 | 1469 | * |
| 1432 | 1470 | * ROM definitions |
| r1185 | r1186 | |
| 1435 | 1473 | |
| 1436 | 1474 | ROM_START( mk4 ) |
| 1437 | 1475 | ROM_REGION16_LE( 0x1000000, REGION_SOUND1, ROMREGION_ERASEFF ) /* sound data */ |
| 1476 | ROM_LOAD16_BYTE( "mk4_l2.u2", 0x000000, 0x200000, CRC(4c01b493) SHA1(dcd6da9ee30d0f6645bfdb1762d926be0a26090a) ) |
| 1477 | ROM_LOAD16_BYTE( "mk4_l2.u3", 0x400000, 0x200000, CRC(8fbcf0ac) SHA1(c53704e72cfcba800c7af3a03267041f1e29a784) ) |
| 1478 | ROM_LOAD16_BYTE( "mk4_l2.u4", 0x800000, 0x200000, CRC(dee91696) SHA1(00a182a36a414744cd014fcfc53c2e1a66ab5189) ) |
| 1479 | ROM_LOAD16_BYTE( "mk4_l2.u5", 0xc00000, 0x200000, CRC(44d072be) SHA1(8a636c2801d799dfb84e69607ade76d2b49cf09f) ) |
| 1480 | |
| 1481 | ROM_REGION32_LE( 0x1800000, REGION_USER1, 0 ) |
| 1482 | ROM_LOAD32_WORD( "mk4_l3.u10", 0x0000000, 0x200000, CRC(84efe5a9) SHA1(e2a9bf6fab971691017371a87ab87b1bf66f96d0) ) |
| 1483 | ROM_LOAD32_WORD( "mk4_l3.u11", 0x0000002, 0x200000, CRC(0c026ccb) SHA1(7531fe81ff8d8dd9ec3cd915acaf14cbe6bdc90a) ) |
| 1484 | ROM_LOAD32_WORD( "mk4_l3.u12", 0x0400000, 0x200000, CRC(7816c07f) SHA1(da94b4391e671f915c61b5eb9bece4acb3382e31) ) |
| 1485 | ROM_LOAD32_WORD( "mk4_l3.u13", 0x0400002, 0x200000, CRC(b3c237cd) SHA1(9e71e60cc92c17524f85f36543c174ca138104cd) ) |
| 1486 | ROM_LOAD32_WORD( "mk4_l3.u14", 0x0800000, 0x200000, CRC(fd33eb1a) SHA1(59d9d2e5251679d19cab031f51731c85f429ba18) ) |
| 1487 | ROM_LOAD32_WORD( "mk4_l3.u15", 0x0800002, 0x200000, CRC(b907518f) SHA1(cfb56538746895bdca779957fec6a872019b23c3) ) |
| 1488 | ROM_LOAD32_WORD( "mk4_l3.u16", 0x0c00000, 0x200000, CRC(24371d57) SHA1(c90134b17c23a182d391d1679bf457d251e641f7) ) |
| 1489 | ROM_LOAD32_WORD( "mk4_l3.u17", 0x0c00002, 0x200000, CRC(3a1a082c) SHA1(5f8e8ce760d8ebadd1240ef08f1382a37cf11d0b) ) |
| 1490 | ROM_END |
| 1491 | |
| 1492 | ROM_START( mk4a ) |
| 1493 | ROM_REGION16_LE( 0x1000000, REGION_SOUND1, ROMREGION_ERASEFF ) /* sound data */ |
| 1438 | 1494 | ROM_LOAD16_BYTE( "mk4_l2.2", 0x000000, 0x200000, CRC(4c01b493) SHA1(dcd6da9ee30d0f6645bfdb1762d926be0a26090a) ) |
| 1439 | 1495 | ROM_LOAD16_BYTE( "mk4_l2.3", 0x400000, 0x200000, CRC(8fbcf0ac) SHA1(c53704e72cfcba800c7af3a03267041f1e29a784) ) |
| 1440 | 1496 | ROM_LOAD16_BYTE( "mk4_l2.4", 0x800000, 0x200000, CRC(dee91696) SHA1(00a182a36a414744cd014fcfc53c2e1a66ab5189) ) |
| 1441 | 1497 | ROM_LOAD16_BYTE( "mk4_l2.5", 0xc00000, 0x200000, CRC(44d072be) SHA1(8a636c2801d799dfb84e69607ade76d2b49cf09f) ) |
| 1442 | 1498 | |
| 1443 | 1499 | ROM_REGION32_LE( 0x1800000, REGION_USER1, 0 ) |
| 1444 | | ROM_LOAD32_WORD( "mk4_l3.10", 0x0000000, 0x200000, CRC(84efe5a9) SHA1(e2a9bf6fab971691017371a87ab87b1bf66f96d0) ) |
| 1445 | | ROM_LOAD32_WORD( "mk4_l3.11", 0x0000002, 0x200000, CRC(0c026ccb) SHA1(7531fe81ff8d8dd9ec3cd915acaf14cbe6bdc90a) ) |
| 1500 | ROM_LOAD32_WORD( "mk4_l2.1.u10", 0x000000, 0x200000, CRC(42d0f1c9) SHA1(5ac0ded8bf6e756319be2691e3b555eac079ebdc) ) |
| 1501 | ROM_LOAD32_WORD( "mk4_l2.1.u11", 0x000002, 0x200000, CRC(6e21b243) SHA1(6d4768a5972db05c1409e0d16e79df9eff8918a0) ) |
| 1446 | 1502 | ROM_LOAD32_WORD( "mk4_l3.12", 0x0400000, 0x200000, CRC(7816c07f) SHA1(da94b4391e671f915c61b5eb9bece4acb3382e31) ) |
| 1447 | 1503 | ROM_LOAD32_WORD( "mk4_l3.13", 0x0400002, 0x200000, CRC(b3c237cd) SHA1(9e71e60cc92c17524f85f36543c174ca138104cd) ) |
| 1448 | 1504 | ROM_LOAD32_WORD( "mk4_l3.14", 0x0800000, 0x200000, CRC(fd33eb1a) SHA1(59d9d2e5251679d19cab031f51731c85f429ba18) ) |
| r1185 | r1186 | |
| 1454 | 1510 | |
| 1455 | 1511 | ROM_START( invasn ) |
| 1456 | 1512 | ROM_REGION16_LE( 0x1000000, REGION_SOUND1, ROMREGION_ERASEFF ) /* sound data */ |
| 1457 | | ROM_LOAD16_BYTE( "invau2", 0x000000, 0x200000, CRC(59d2e1d6) SHA1(994a4311ac4841d4341449c0c7480952b6f3855d) ) |
| 1458 | | ROM_LOAD16_BYTE( "invau3", 0x400000, 0x200000, CRC(86b956ae) SHA1(f7fd4601a2ce3e7e9b67e7d77908bfa206ee7e62) ) |
| 1459 | | ROM_LOAD16_BYTE( "invau4", 0x800000, 0x200000, CRC(5ef1fab5) SHA1(987afa0672fa89b18cf20d28644848a9e5ee9b17) ) |
| 1460 | | ROM_LOAD16_BYTE( "invau5", 0xc00000, 0x200000, CRC(e42805c9) SHA1(e5b71eb1852809a649ac43a82168b3bdaf4b1526) ) |
| 1513 | ROM_LOAD16_BYTE( "invasion.u2", 0x000000, 0x200000, CRC(59d2e1d6) SHA1(994a4311ac4841d4341449c0c7480952b6f3855d) ) |
| 1514 | ROM_LOAD16_BYTE( "invasion.u3", 0x400000, 0x200000, CRC(86b956ae) SHA1(f7fd4601a2ce3e7e9b67e7d77908bfa206ee7e62) ) |
| 1515 | ROM_LOAD16_BYTE( "invasion.u4", 0x800000, 0x200000, CRC(5ef1fab5) SHA1(987afa0672fa89b18cf20d28644848a9e5ee9b17) ) |
| 1516 | ROM_LOAD16_BYTE( "invasion.u5", 0xc00000, 0x200000, CRC(e42805c9) SHA1(e5b71eb1852809a649ac43a82168b3bdaf4b1526) ) |
| 1461 | 1517 | |
| 1462 | 1518 | ROM_REGION32_LE( 0x1800000, REGION_USER1, 0 ) |
| 1463 | | ROM_LOAD32_WORD( "invau10", 0x0000000, 0x200000, CRC(b3ce958b) SHA1(ed51c167d85bc5f6155b8046ec056a4f4ad5cf9d) ) |
| 1464 | | ROM_LOAD32_WORD( "invau11", 0x0000002, 0x200000, CRC(0bd09359) SHA1(f40886bd2e5f5fbf506580e5baa2f733be200852) ) |
| 1465 | | ROM_LOAD32_WORD( "invau12", 0x0400000, 0x200000, CRC(ce1eb06a) SHA1(ff17690a0cbca6dcccccde70e2c5812ae03db5bb) ) |
| 1466 | | ROM_LOAD32_WORD( "invau13", 0x0400002, 0x200000, CRC(33fc6707) SHA1(11a39ad980ec320547319eca6ffa5aef3ab8b010) ) |
| 1467 | | ROM_LOAD32_WORD( "invau14", 0x0800000, 0x200000, CRC(760682a1) SHA1(ff91210225d4aa750115c6219d4c35c9521a3f0b) ) |
| 1468 | | ROM_LOAD32_WORD( "invau15", 0x0800002, 0x200000, CRC(90467d7a) SHA1(a143a3d3605e5626852e75937160ba6bcd891608) ) |
| 1469 | | ROM_LOAD32_WORD( "invau16", 0x0c00000, 0x200000, CRC(3ef1b28d) SHA1(6f9a071b8830194fea84daa62aadabae86977c5f) ) |
| 1470 | | ROM_LOAD32_WORD( "invau17", 0x0c00002, 0x200000, CRC(97aa677a) SHA1(4d21cc59e0ffd4985f89c97c71d605c3b404a8a3) ) |
| 1471 | | ROM_LOAD32_WORD( "invau18", 0x1000000, 0x200000, CRC(6930c656) SHA1(28054ff9a6c6f5764a371f8defe4c1f5730618f3) ) |
| 1472 | | ROM_LOAD32_WORD( "invau19", 0x1000002, 0x200000, CRC(89fa6ee5) SHA1(572565e1308142b0b062aa72315c68e928f2419c) ) |
| 1519 | ROM_LOAD32_WORD( "invasion.u10", 0x0000000, 0x200000, CRC(b3ce958b) SHA1(ed51c167d85bc5f6155b8046ec056a4f4ad5cf9d) ) |
| 1520 | ROM_LOAD32_WORD( "invasion.u11", 0x0000002, 0x200000, CRC(0bd09359) SHA1(f40886bd2e5f5fbf506580e5baa2f733be200852) ) |
| 1521 | ROM_LOAD32_WORD( "invasion.u12", 0x0400000, 0x200000, CRC(ce1eb06a) SHA1(ff17690a0cbca6dcccccde70e2c5812ae03db5bb) ) |
| 1522 | ROM_LOAD32_WORD( "invasion.u13", 0x0400002, 0x200000, CRC(33fc6707) SHA1(11a39ad980ec320547319eca6ffa5aef3ab8b010) ) |
| 1523 | ROM_LOAD32_WORD( "invasion.u14", 0x0800000, 0x200000, CRC(760682a1) SHA1(ff91210225d4aa750115c6219d4c35c9521a3f0b) ) |
| 1524 | ROM_LOAD32_WORD( "invasion.u15", 0x0800002, 0x200000, CRC(90467d7a) SHA1(a143a3d3605e5626852e75937160ba6bcd891608) ) |
| 1525 | ROM_LOAD32_WORD( "invasion.u16", 0x0c00000, 0x200000, CRC(3ef1b28d) SHA1(6f9a071b8830194fea84daa62aadabae86977c5f) ) |
| 1526 | ROM_LOAD32_WORD( "invasion.u17", 0x0c00002, 0x200000, CRC(97aa677a) SHA1(4d21cc59e0ffd4985f89c97c71d605c3b404a8a3) ) |
| 1527 | ROM_LOAD32_WORD( "invasion.u18", 0x1000000, 0x200000, CRC(6930c656) SHA1(28054ff9a6c6f5764a371f8defe4c1f5730618f3) ) |
| 1528 | ROM_LOAD32_WORD( "invasion.u19", 0x1000002, 0x200000, CRC(89fa6ee5) SHA1(572565e1308142b0b062aa72315c68e928f2419c) ) |
| 1473 | 1529 | ROM_END |
| 1474 | 1530 | |
| 1475 | 1531 | |
| r1185 | r1186 | |
| 1507 | 1563 | ROM_LOAD( "the_grid.u4", 0x800000, 0x400000, CRC(7a15c203) SHA1(a0a49dd08bba92402640ed2d1fb4fee112c4ab5f) ) |
| 1508 | 1564 | |
| 1509 | 1565 | ROM_REGION32_LE( 0x3000000, REGION_USER1, 0 ) |
| 1510 | | ROM_LOAD32_WORD( "the_grid.u10", 0x0000000, 0x100000, BAD_DUMP CRC(3219c028) SHA1(956cb358c4c52d4fa7e870796e92880fb2b94147) ) |
| 1511 | | ROM_LOAD32_WORD( "the_grid.u11", 0x0000002, 0x100000, BAD_DUMP CRC(540dd6f9) SHA1(02af52bdbe266cdf51294b31e1db71c1ee723d0d) ) |
| 1512 | | ROM_LOAD32_WORD( "the_grid.u12", 0x0200000, 0x100000, BAD_DUMP CRC(4e9f7031) SHA1(4df99e0edc5510067521c554227921d2185070c4) ) |
| 1513 | | ROM_LOAD32_WORD( "the_grid.u13", 0x0200002, 0x100000, BAD_DUMP CRC(268252ca) SHA1(80080e0244bb8ba2ff7dd513ea263b5f5dc54bb6) ) |
| 1514 | | ROM_LOAD32_WORD( "the_grid.u18", 0x0400000, 0x400000, CRC(3a3460be) SHA1(e719dae8a2e54584cb6a074ed42e35e3debef2f6) ) |
| 1515 | | ROM_LOAD32_WORD( "the_grid.u19", 0x0400002, 0x400000, CRC(af262d5b) SHA1(3eb3980fa81a360a70aa74e793b2bc3028f68cf2) ) |
| 1516 | | ROM_LOAD32_WORD( "the_grid.u20", 0x0c00002, 0x400000, CRC(e6ad1917) SHA1(acab25e1251fd07b374badebe79f6ec1772b3589) ) |
| 1517 | | ROM_LOAD32_WORD( "the_grid.u21", 0x0c00002, 0x400000, CRC(48c03f8e) SHA1(50790bdae9f2234ffb4914c2c5c16374e3508b47) ) |
| 1518 | | ROM_LOAD32_WORD( "the_grid.u22", 0x1400002, 0x400000, CRC(84c3a8b6) SHA1(de0dcf9daf7ada7a6952b9e29a29571b2aa9d0b2) ) |
| 1519 | | ROM_LOAD32_WORD( "the_grid.u23", 0x1400002, 0x400000, CRC(f48ef409) SHA1(79d74b4fe38b06a02ae0351d13d7f0a7ed0f0c87) ) |
| 1566 | ROM_LOAD32_WORD( "thegrid-11.u10", 0x0000000, 0x100000, CRC(87ea0e9e) SHA1(618de2ca87b7a3e0225d1f7e65f8fc1356de1421) ) |
| 1567 | ROM_LOAD32_WORD( "thegrid-11.u11", 0x0000002, 0x100000, CRC(73d84b1a) SHA1(8dcfcab5ff64f46f8486e6439a10d91ad26fd48a) ) |
| 1568 | ROM_LOAD32_WORD( "thegrid-11.u12", 0x0200000, 0x100000, CRC(78d16ca1) SHA1(7b893ec8af2f44d8bc293861fd8622d68d41ccbe) ) |
| 1569 | ROM_LOAD32_WORD( "thegrid-11.u13", 0x0200002, 0x100000, CRC(8e00b400) SHA1(96581c5da62afc19e6d69b2352b3166665cb9918) ) |
| 1570 | ROM_LOAD32_WORD( "the_grid.u18", 0x0400000, 0x400000, CRC(3a3460be) SHA1(e719dae8a2e54584cb6a074ed42e35e3debef2f6) ) |
| 1571 | ROM_LOAD32_WORD( "the_grid.u19", 0x0400002, 0x400000, CRC(af262d5b) SHA1(3eb3980fa81a360a70aa74e793b2bc3028f68cf2) ) |
| 1572 | ROM_LOAD32_WORD( "the_grid.u20", 0x0c00002, 0x400000, CRC(e6ad1917) SHA1(acab25e1251fd07b374badebe79f6ec1772b3589) ) |
| 1573 | ROM_LOAD32_WORD( "the_grid.u21", 0x0c00002, 0x400000, CRC(48c03f8e) SHA1(50790bdae9f2234ffb4914c2c5c16374e3508b47) ) |
| 1574 | ROM_LOAD32_WORD( "the_grid.u22", 0x1400002, 0x400000, CRC(84c3a8b6) SHA1(de0dcf9daf7ada7a6952b9e29a29571b2aa9d0b2) ) |
| 1575 | ROM_LOAD32_WORD( "the_grid.u23", 0x1400002, 0x400000, CRC(f48ef409) SHA1(79d74b4fe38b06a02ae0351d13d7f0a7ed0f0c87) ) |
| 1520 | 1576 | ROM_END |
| 1521 | 1577 | |
| 1522 | 1578 | |
| r1185 | r1186 | |
| 1569 | 1625 | * |
| 1570 | 1626 | *************************************/ |
| 1571 | 1627 | |
| 1572 | | GAME( 1997, mk4, 0, midzeus, mk4, mk4, ROT0, "Midway", "Mortal Kombat 4 (rev L3)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 1573 | | GAME( 1999, invasn, 0, midzeus, invasn, invasn, ROT0, "Midway", "Invasion (Midway)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 1574 | | GAME( 1999, crusnexo, 0, midzeus, crusnexo, crusnexo, ROT0, "Midway", "Cruis'n Exotica", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 1575 | | GAME( 2001, thegrid, 0, midzeus, thegrid, thegrid, ROT0, "Midway", "The Grid", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 1628 | GAME( 1997, mk4, 0, midzeus, mk4, mk4, ROT0, "Midway", "Mortal Kombat 4 (rev L3)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 1629 | GAME( 1997, mk4a, mk4, midzeus, mk4, mk4, ROT0, "Midway", "Mortal Kombat 4 (? rev)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 1630 | GAME( 1999, invasn, 0, midzeus, invasn, invasn, ROT0, "Midway", "Invasion (Midway)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 1631 | GAME( 1999, crusnexo, 0, midzeus2, crusnexo, crusnexo, ROT0, "Midway", "Cruis'n Exotica", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 1632 | GAME( 2001, thegrid, 0, midzeus2, thegrid, thegrid, ROT0, "Midway", "The Grid (version 1.1)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
src/mame/drivers/goodejan.c
| r0 | r1186 | |
| 1 | /****************************************************************************************** |
| 2 | |
| 3 | Seibu Mahjong games (distributed by Tecmo) |
| 4 | |
| 5 | CPU: V30 D70116C-10 |
| 6 | Sound: Z80 YM3812 M6295 |
| 7 | OSC: 12.000MHz 16.000MHz 7.15909MHz |
| 8 | |
| 9 | |
| 10 | ToDo: |
| 11 | BG Banking is wrong. |
| 12 | Inputs are imperfect (missing dips) |
| 13 | Sprite glitches in intro |
| 14 | |
| 15 | |
| 16 | PCB Layout |
| 17 | |
| 18 | |---------------------------------------------------------------| |
| 19 | |LA4460 YM3812 M6295 E-JAN.U0911 6116 Z80A 7.15909MHz | |
| 20 | | | |
| 21 | | 5.U1016 | |
| 22 | | SEI0100 PAL | |
| 23 | | | |
| 24 | | E-JAN.U064 4.U061 | |
| 25 | | SEI0160 | |
| 26 | | SEI0181 3.U063 | |
| 27 | | | |
| 28 | | | |
| 29 | | PAL SEI0200 6264 PAL | |
| 30 | | TC110G21AF | |
| 31 | | 82S135.U083 PAL 6264 | |
| 32 | | | |
| 33 | | DSW DSW | |
| 34 | | 62256 62256 | |
| 35 | | E-JAN.U078 PAL | |
| 36 | | | |
| 37 | | PAL PAL 1.U022 2.U023 | |
| 38 | | SEI0210 | |
| 39 | | PAL PAL | |
| 40 | | | |
| 41 | | 12MHz 16MHz V30 | |
| 42 | |---------------------------------------------------------------| |
| 43 | Notes: |
| 44 | V30 clock - 8.000MHz [16/2] |
| 45 | Z80 clock - 3.579545MHz [7.15909/2] |
| 46 | YM3812 clock - 3.579545MHz [7.15909/2] |
| 47 | M6295 clock - 1.000MHz [16/16], Pin 7 HIGH |
| 48 | VSync - 60Hz |
| 49 | HSync - 15.38kHz |
| 50 | |
| 51 | |
| 52 | *******************************************************************************************/ |
| 53 | |
| 54 | #include "driver.h" |
| 55 | #include "audio/seibu.h" |
| 56 | #include "sound/3812intf.h" |
| 57 | |
| 58 | #define GOODEJAN_MHZ1 7159090 |
| 59 | #define GOODEJAN_MHZ2 16000000 |
| 60 | #define GOODEJAN_MHZ3 12000000 |
| 61 | |
| 62 | extern UINT16 *goodejan_bgvram, *goodejan_txvram; |
| 63 | static UINT16 goodejan_mux_data; |
| 64 | |
| 65 | WRITE16_HANDLER( goodejan_bgvram_w ); |
| 66 | WRITE16_HANDLER( goodejan_txvram_w ); |
| 67 | WRITE16_HANDLER( goodejan_bg_scrollx_w ); |
| 68 | WRITE16_HANDLER( goodejan_bg_scrolly_w ); |
| 69 | |
| 70 | VIDEO_START( goodejan ); |
| 71 | VIDEO_UPDATE( goodejan ); |
| 72 | |
| 73 | /* Multiplexer device for the mahjong panel */ |
| 74 | static READ16_HANDLER( mahjong_panel_r ) |
| 75 | { |
| 76 | UINT16 ret; |
| 77 | ret = 0xffff; |
| 78 | |
| 79 | switch(goodejan_mux_data) |
| 80 | { |
| 81 | case 1: ret = readinputport(1); break; |
| 82 | case 2: ret = readinputport(2); break; |
| 83 | case 4: ret = readinputport(3); break; |
| 84 | case 8: ret = readinputport(4); break; |
| 85 | case 0x10: ret = readinputport(5); break; |
| 86 | } |
| 87 | |
| 88 | return ret; |
| 89 | } |
| 90 | |
| 91 | static WRITE16_HANDLER( mahjong_panel_w ) |
| 92 | { |
| 93 | goodejan_mux_data = data; |
| 94 | } |
| 95 | |
| 96 | static READ16_HANDLER( goodejan_read_ff ) |
| 97 | { |
| 98 | return 0xff; |
| 99 | } |
| 100 | |
| 101 | static ADDRESS_MAP_START( goodejan_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 102 | AM_RANGE(0x00000, 0x0afff) AM_RAM |
| 103 | AM_RANGE(0x0c000, 0x0c7ff) AM_RAM AM_WRITE(goodejan_bgvram_w) AM_BASE(&goodejan_bgvram) |
| 104 | AM_RANGE(0x0d000, 0x0dfff) AM_RAM AM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE(&paletteram16) |
| 105 | AM_RANGE(0x0c800, 0x0cfff) AM_RAM AM_WRITE(goodejan_txvram_w) AM_BASE(&goodejan_txvram) |
| 106 | AM_RANGE(0x0f800, 0x0ffff) AM_RAM AM_BASE(&spriteram16) |
| 107 | AM_RANGE(0xc0000, 0xfffff) AM_ROM |
| 108 | ADDRESS_MAP_END |
| 109 | |
| 110 | |
| 111 | static ADDRESS_MAP_START( goodejan_io_map, ADDRESS_SPACE_IO, 16 ) |
| 112 | |
| 113 | AM_RANGE(0x8060, 0x8061) AM_WRITE(goodejan_bg_scrollx_w ) |
| 114 | AM_RANGE(0x8062, 0x8063) AM_WRITE(goodejan_bg_scrolly_w ) |
| 115 | |
| 116 | AM_RANGE(0xb004, 0xb005) AM_WRITE(mahjong_panel_w) |
| 117 | |
| 118 | AM_RANGE(0xc000, 0xc001) AM_READ(goodejan_read_ff) |
| 119 | AM_RANGE(0xc002, 0xc003) AM_READ(mahjong_panel_r) |
| 120 | // AM_RANGE(0xc004, 0xc005) AM_READ(random_reading) |
| 121 | |
| 122 | AM_RANGE(0xd000, 0xd00f) AM_READWRITE(seibu_main_word_r, seibu_main_word_w) |
| 123 | ADDRESS_MAP_END |
| 124 | |
| 125 | INPUT_PORTS_START( goodejan ) |
| 126 | /* Must be port 0: coin inputs read through sound cpu */ |
| 127 | SEIBU_COIN_INPUTS |
| 128 | |
| 129 | PORT_START |
| 130 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A ) |
| 131 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E ) |
| 132 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I ) |
| 133 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M ) |
| 134 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) |
| 135 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) |
| 136 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 137 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 138 | |
| 139 | PORT_START |
| 140 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B ) |
| 141 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F ) |
| 142 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J ) |
| 143 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N ) |
| 144 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) |
| 145 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET ) |
| 146 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 147 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 148 | |
| 149 | PORT_START |
| 150 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C ) |
| 151 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G ) |
| 152 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K ) |
| 153 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) |
| 154 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) |
| 155 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 156 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 157 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 158 | |
| 159 | PORT_START |
| 160 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D ) |
| 161 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H ) |
| 162 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L ) |
| 163 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) |
| 164 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 165 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 166 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 167 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 168 | |
| 169 | PORT_START |
| 170 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE ) |
| 171 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE ) |
| 172 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP ) |
| 173 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP ) |
| 174 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG ) |
| 175 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL ) |
| 176 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 177 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 178 | |
| 179 | PORT_DIPNAME( 0x0001, 0x0001, "4" ) |
| 180 | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) |
| 181 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 182 | PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) |
| 183 | PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) |
| 184 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 185 | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) |
| 186 | PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) |
| 187 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 188 | PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) |
| 189 | PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) |
| 190 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 191 | PORT_DIPNAME( 0x0010, 0x0000, DEF_STR( Unknown ) ) // Freezes if off? |
| 192 | PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) |
| 193 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 194 | PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) |
| 195 | PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) |
| 196 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 197 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) |
| 198 | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) |
| 199 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 200 | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) |
| 201 | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) |
| 202 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 203 | PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) ) |
| 204 | PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) |
| 205 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 206 | PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) |
| 207 | PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) |
| 208 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 209 | PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) ) |
| 210 | PORT_DIPSETTING( 0x0400, DEF_STR( Off ) ) |
| 211 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 212 | PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) ) |
| 213 | PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) |
| 214 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 215 | PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) |
| 216 | PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) |
| 217 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 218 | PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) |
| 219 | PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) |
| 220 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 221 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) |
| 222 | PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) |
| 223 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 224 | PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) |
| 225 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) |
| 226 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 227 | INPUT_PORTS_END |
| 228 | |
| 229 | |
| 230 | static const gfx_layout tilelayout = |
| 231 | { |
| 232 | 16,16, /* 16*16 sprites */ |
| 233 | RGN_FRAC(1,1), |
| 234 | 4, /* 4 bits per pixel */ |
| 235 | { 12, 8, 4, 0 }, |
| 236 | { |
| 237 | 0, 1, 2, 3, |
| 238 | 16, 17, 18, 19, |
| 239 | 512,513,514,515, |
| 240 | 528,529,530,531 |
| 241 | }, |
| 242 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, 8*32, 9*32, 10*32, 11*32, 12*32, 13*32, 14*32, 15*32 }, |
| 243 | 32*32, |
| 244 | }; |
| 245 | |
| 246 | static const gfx_layout charlayout = |
| 247 | { |
| 248 | 8,8, |
| 249 | RGN_FRAC(1,1), |
| 250 | 4, /* 4 bits per pixel */ |
| 251 | { 12, 8, 4, 0 }, |
| 252 | { |
| 253 | 0, 1, 2, 3, |
| 254 | 16, 17, 18, 19 |
| 255 | }, |
| 256 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, |
| 257 | 8*32 |
| 258 | }; |
| 259 | |
| 260 | static GFXDECODE_START( goodejan ) |
| 261 | GFXDECODE_ENTRY( REGION_GFX3, 0, tilelayout, 0x200, 0x40 ) /* Sprites */ |
| 262 | GFXDECODE_ENTRY( REGION_GFX2, 0, tilelayout, 0x000, 0x30 ) /* Tiles */ |
| 263 | GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0x100, 0x10 ) /* Text */ |
| 264 | GFXDECODE_END |
| 265 | |
| 266 | SEIBU_SOUND_SYSTEM_YM3812_HARDWARE |
| 267 | |
| 268 | static INTERRUPT_GEN( goodejan_interrupt ) |
| 269 | { |
| 270 | if (cpu_getiloops()) |
| 271 | cpunum_set_input_line_and_vector(0,0,HOLD_LINE,0x208/4); |
| 272 | else |
| 273 | cpunum_set_input_line_and_vector(0,0,HOLD_LINE,0x00c/4); |
| 274 | } |
| 275 | |
| 276 | static MACHINE_DRIVER_START( goodejan ) |
| 277 | |
| 278 | /* basic machine hardware */ |
| 279 | MDRV_CPU_ADD(V30, GOODEJAN_MHZ2/2) |
| 280 | MDRV_CPU_PROGRAM_MAP(goodejan_map,0) |
| 281 | MDRV_CPU_IO_MAP(goodejan_io_map,0) |
| 282 | MDRV_CPU_VBLANK_INT(goodejan_interrupt,2) |
| 283 | |
| 284 | SEIBU_SOUND_SYSTEM_CPU(GOODEJAN_MHZ1/2) |
| 285 | |
| 286 | MDRV_SCREEN_REFRESH_RATE(60) |
| 287 | MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION) |
| 288 | |
| 289 | MDRV_MACHINE_RESET(seibu_sound_1) |
| 290 | |
| 291 | /* video hardware */ |
| 292 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| 293 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 294 | MDRV_SCREEN_SIZE(32*8, 32*8) |
| 295 | MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 296 | MDRV_GFXDECODE(goodejan) |
| 297 | MDRV_PALETTE_LENGTH(0x1000) |
| 298 | |
| 299 | MDRV_VIDEO_START(goodejan) |
| 300 | MDRV_VIDEO_UPDATE(goodejan) |
| 301 | |
| 302 | /* sound hardware */ |
| 303 | SEIBU_SOUND_SYSTEM_YM3812_INTERFACE(GOODEJAN_MHZ1/2,GOODEJAN_MHZ2/16,1) |
| 304 | MACHINE_DRIVER_END |
| 305 | |
| 306 | ROM_START( totmejan ) |
| 307 | ROM_REGION( 0x100000, REGION_CPU1, 0 ) /* V30 code */ |
| 308 | ROM_LOAD16_BYTE( "1.022", 0xc0000, 0x20000, CRC(63c3c54f) SHA1(3116b73b848a1f7391a47b994951ba1af92ba298) ) |
| 309 | ROM_LOAD16_BYTE( "2.023", 0xc0001, 0x20000, CRC(c0b9892f) SHA1(127f439a9e625d5a0f5e88102fed6500433cd9cc) ) |
| 310 | |
| 311 | ROM_REGION( 0x20000, REGION_CPU2, 0 ) /* 64k code for sound Z80 */ |
| 312 | ROM_LOAD( "5.1016", 0x000000, 0x08000, CRC(8bfdb304) SHA1(454fd84eb7d9338f0b5f8de0ffae541d17b958d5) ) |
| 313 | ROM_CONTINUE( 0x010000, 0x08000 ) |
| 314 | ROM_COPY( REGION_CPU2, 0, 0x018000, 0x08000 ) |
| 315 | |
| 316 | ROM_REGION( 0x20000, REGION_GFX1, ROMREGION_ERASEFF | ROMREGION_DISPOSE ) |
| 317 | ROM_LOAD16_BYTE( "3.063", 0x00000, 0x10000, CRC(61b5ae88) SHA1(16105a4e97765454079deda8eaa456d60d44e906) ) |
| 318 | ROM_LOAD16_BYTE( "4.061", 0x00001, 0x10000, CRC(29fb6ad2) SHA1(8a9c4625472daefca7fb73a9ef3717e86c3d632f) ) |
| 319 | |
| 320 | ROM_REGION( 0x100000, REGION_GFX2, ROMREGION_DISPOSE ) |
| 321 | ROM_LOAD( "e-jan.064", 0x080000, 0x080000, CRC(5f6185ee) SHA1(599e4a574672cd1571032e879b3032d06b70e4e2) ) |
| 322 | ROM_CONTINUE(0x00000,0x80000) |
| 323 | |
| 324 | ROM_REGION( 0x080000, REGION_GFX3, ROMREGION_DISPOSE ) |
| 325 | ROM_LOAD( "e-jan.078", 0x000000, 0x080000, CRC(ff9ee9d8) SHA1(5e49e9a666630ca9867ee96b9d2b8d6f503b25df) ) |
| 326 | |
| 327 | ROM_REGION( 0x80000, REGION_SOUND1, 0 ) /* ADPCM samples */ |
| 328 | ROM_LOAD( "e-jan.0911", 0x00000, 0x80000, CRC(a7fb93c2) SHA1(c2e1300f142032c087c96e1a785af28a6d678947) ) |
| 329 | |
| 330 | ROM_REGION( 0x200, REGION_USER1, ROMREGION_DISPOSE ) /* not used */ |
| 331 | ROM_LOAD( "fmj08.083", 0x000, 0x100, CRC(9657b7ad) SHA1(e9b469c2b3534593f7fe0ea19cbbf93b55957e42) ) |
| 332 | ROM_END |
| 333 | |
| 334 | ROM_START( goodejan ) |
| 335 | ROM_REGION( 0x100000, REGION_CPU1, 0 ) /* V30 code */ |
| 336 | ROM_LOAD16_BYTE( "1.022", 0xc0000, 0x20000, CRC(8555122f) SHA1(92e1ec02fb81ae972eb7492b5d226b40ca65c70d) ) |
| 337 | ROM_LOAD16_BYTE( "2.023", 0xc0001, 0x20000, CRC(32704d74) SHA1(9722b7f1e506a17e0fa5234e05f79333cd99a364) ) |
| 338 | |
| 339 | ROM_REGION( 0x20000, REGION_CPU2, 0 ) /* 64k code for sound Z80 */ |
| 340 | ROM_LOAD( "5.1016", 0x000000, 0x08000, CRC(732e9eae) SHA1(d306610f08630708bbbb97d71e9ed4d7e027579a) ) |
| 341 | ROM_CONTINUE( 0x010000, 0x08000 ) |
| 342 | ROM_COPY( REGION_CPU2, 0, 0x018000, 0x08000 ) |
| 343 | |
| 344 | ROM_REGION( 0x20000, REGION_GFX1, ROMREGION_ERASEFF | ROMREGION_DISPOSE ) |
| 345 | ROM_LOAD16_BYTE( "3.063", 0x00000, 0x10000, CRC(f355564a) SHA1(35140cc86504d6fdaba00b520d226724bac9f546) ) |
| 346 | ROM_LOAD16_BYTE( "4.061", 0x00001, 0x10000, CRC(5bdf7225) SHA1(a8eded9dc5be1db20cddbed1ae8c22de1674de2a) ) |
| 347 | |
| 348 | ROM_REGION( 0x100000, REGION_GFX2, ROMREGION_DISPOSE ) |
| 349 | ROM_LOAD( "e_jan2scr.064", 0x000000, 0x100000, CRC(71654822) SHA1(fe2a128413999085e321e455aeebda0360d38cb8) ) |
| 350 | |
| 351 | ROM_REGION( 0x080000, REGION_GFX3, ROMREGION_DISPOSE ) |
| 352 | ROM_LOAD( "e_jan2obj.078", 0x000000, 0x080000, CRC(0f892ef2) SHA1(188ae43db1c48fb6870aa45c64718e901831499b) ) |
| 353 | |
| 354 | ROM_REGION( 0x80000, REGION_SOUND1, 0 ) /* ADPCM samples */ |
| 355 | ROM_LOAD( "e-jan.911", 0x00000, 0x80000, CRC(6d2cbc35) SHA1(61f47e2a94b8877906224f46d8301a26a0b9e55f) ) |
| 356 | |
| 357 | ROM_REGION( 0x200, REGION_USER1, ROMREGION_DISPOSE ) /* not used */ |
| 358 | ROM_LOAD( "fmj08.083", 0x000, 0x100, CRC(9657b7ad) SHA1(e9b469c2b3534593f7fe0ea19cbbf93b55957e42) ) |
| 359 | ROM_END |
| 360 | |
| 361 | ROM_START( goodejaa ) |
| 362 | ROM_REGION( 0x100000, REGION_CPU1, 0 ) /* V30 code */ |
| 363 | ROM_LOAD16_BYTE( "1.u022", 0xc0000, 0x20000, CRC(d496cdd1) SHA1(144a9d8850b3b62520b71efd2ed1459bd673ac92) ) |
| 364 | ROM_LOAD16_BYTE( "2.u023", 0xc0001, 0x20000, CRC(5eda77bb) SHA1(ac54125988f9c929207becf0dcbab72eff4f054a) ) |
| 365 | |
| 366 | ROM_REGION( 0x20000, REGION_CPU2, 0 ) /* 64k code for sound Z80 */ |
| 367 | ROM_LOAD( "5.1016", 0x000000, 0x08000, CRC(732e9eae) SHA1(d306610f08630708bbbb97d71e9ed4d7e027579a) ) |
| 368 | ROM_CONTINUE( 0x010000, 0x08000 ) |
| 369 | ROM_COPY( REGION_CPU2, 0, 0x018000, 0x08000 ) |
| 370 | |
| 371 | ROM_REGION( 0x20000, REGION_GFX1, ROMREGION_ERASEFF | ROMREGION_DISPOSE ) |
| 372 | ROM_LOAD16_BYTE( "3.063", 0x00000, 0x10000, CRC(f355564a) SHA1(35140cc86504d6fdaba00b520d226724bac9f546) ) |
| 373 | ROM_LOAD16_BYTE( "4.061", 0x00001, 0x10000, CRC(5bdf7225) SHA1(a8eded9dc5be1db20cddbed1ae8c22de1674de2a) ) |
| 374 | |
| 375 | ROM_REGION( 0x100000, REGION_GFX2, ROMREGION_DISPOSE ) |
| 376 | ROM_LOAD( "e_jan2scr.064", 0x000000, 0x100000, CRC(71654822) SHA1(fe2a128413999085e321e455aeebda0360d38cb8) ) |
| 377 | |
| 378 | ROM_REGION( 0x080000, REGION_GFX3, ROMREGION_DISPOSE ) |
| 379 | ROM_LOAD( "e_jan2obj.078", 0x000000, 0x080000, CRC(0f892ef2) SHA1(188ae43db1c48fb6870aa45c64718e901831499b) ) |
| 380 | |
| 381 | ROM_REGION( 0x80000, REGION_SOUND1, 0 ) /* ADPCM samples */ |
| 382 | ROM_LOAD( "e-jan.911", 0x00000, 0x80000, CRC(6d2cbc35) SHA1(61f47e2a94b8877906224f46d8301a26a0b9e55f) ) |
| 383 | |
| 384 | ROM_REGION( 0x200, REGION_USER1, ROMREGION_DISPOSE ) /* not used */ |
| 385 | ROM_LOAD( "fmj08.083", 0x000, 0x100, CRC(9657b7ad) SHA1(e9b469c2b3534593f7fe0ea19cbbf93b55957e42) ) |
| 386 | ROM_END |
| 387 | |
| 388 | GAME( 1991, totmejan, 0, goodejan, goodejan, 0, ROT0, "Seibu (distributed by Tecmo)", "Tottemo E Jong", GAME_IMPERFECT_GRAPHICS ) |
| 389 | GAME( 1991, goodejan, 0, goodejan, goodejan, 0, ROT0, "Seibu (distributed by Tecmo)", "Good E Jong -Kachinuki Mahjong Syoukin Oh!!- (set 1)", GAME_IMPERFECT_GRAPHICS ) |
| 390 | GAME( 1991, goodejaa, goodejan, goodejan, goodejan, 0, ROT0, "Seibu (distributed by Tecmo)", "Good E Jong -Kachinuki Mahjong Syoukin Oh!!- (set 2)", GAME_IMPERFECT_GRAPHICS ) |
src/mame/drivers/cclimber.c
| r1185 | r1186 | |
| 458 | 458 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL |
| 459 | 459 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_4WAY PORT_COCKTAIL |
| 460 | 460 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_COCKTAIL |
| 461 | | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL |
| 462 | | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL |
| 461 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL |
| 462 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL |
| 463 | 463 | |
| 464 | 464 | PORT_START_TAG("DSW") |
| 465 | | PORT_DIPNAME( 0x01, 0x00, "Unknown 1" ) |
| 466 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 467 | | PORT_DIPSETTING( 0x01, DEF_STR( On ) ) |
| 468 | | PORT_DIPNAME( 0x02, 0x00, "Player title" ) |
| 469 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 470 | | PORT_DIPSETTING( 0x02, DEF_STR( On ) ) |
| 465 | PORT_DIPNAME( 0x03, 0x03, "Display" ) |
| 466 | PORT_DIPSETTING( 0x03, "Scores and Progession Bars" ) |
| 467 | PORT_DIPSETTING( 0x01, "Scores only" ) |
| 468 | PORT_DIPSETTING( 0x02, "Progession Bars only" ) |
| 469 | PORT_DIPSETTING( 0x00, DEF_STR( None ) ) |
| 471 | 470 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Cabinet ) ) |
| 472 | 471 | PORT_DIPSETTING( 0x04, DEF_STR( Upright ) ) |
| 473 | 472 | PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) |
| r1185 | r1186 | |
| 476 | 475 | PORT_DIPSETTING( 0x08, "4" ) |
| 477 | 476 | PORT_DIPSETTING( 0x10, "5" ) |
| 478 | 477 | PORT_DIPSETTING( 0x18, "6" ) |
| 479 | | PORT_DIPNAME( 0x20, 0x00, "Unknown 2" ) |
| 480 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 481 | | PORT_DIPSETTING( 0x20, DEF_STR( On ) ) |
| 482 | | PORT_DIPNAME( 0x40, 0x00, "Unknown 3" ) |
| 483 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 484 | | PORT_DIPSETTING( 0x40, DEF_STR( On ) ) |
| 485 | | PORT_DIPNAME( 0x80, 0x00, "Unknown 4" ) |
| 486 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 487 | | PORT_DIPSETTING( 0x80, DEF_STR( On ) ) |
| 478 | PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW ) |
| 479 | PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW ) |
| 480 | PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW ) |
| 488 | 481 | |
| 489 | | CKONGIN2 |
| 482 | PORT_START_TAG("IN2") |
| 483 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 484 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 485 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME( "Start" ) |
| 486 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 ) PORT_NAME( "Select" ) |
| 487 | PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 490 | 488 | INPUT_PORTS_END |
| 491 | 489 | |
| 492 | 490 | INPUT_PORTS_START( ckong ) |
| r1185 | r1186 | |
| 1286 | 1284 | ROM_LOAD( "ck12.bin", 0x1000, 0x1000, CRC(2eb23b60) SHA1(c9e7dc584562aceb374193655fbacb7df6c9c731) ) |
| 1287 | 1285 | ROM_END |
| 1288 | 1286 | |
| 1287 | ROM_START( ckongb ) |
| 1288 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) |
| 1289 | ROM_LOAD( "d05-7.rom", 0x0000, 0x1000, CRC(5d96ee9a) SHA1(f531d251fd3469edd3b5b5e7c26ff9cef7006ce8) ) |
| 1290 | ROM_LOAD( "f05-8.rom", 0x1000, 0x1000, CRC(74a8435b) SHA1(465ad96009d3ba939eee13ba0d5fd6d9dec118bc) ) |
| 1291 | ROM_LOAD( "h05-9.rom", 0x2000, 0x1000, CRC(e06ca575) SHA1(cd5a32fac614902e136e522ac188616c72d65571) ) |
| 1292 | ROM_LOAD( "k05-10.rom", 0x3000, 0x1000, CRC(46d83a11) SHA1(de840994104bfc633a3640610966f087fbc3d749) ) |
| 1293 | ROM_LOAD( "l05-11.rom", 0x4000, 0x1000, CRC(07c30f3d) SHA1(9b72f8a76c64ab22f8b8c1bd8e457c10b86d95a1) ) |
| 1294 | ROM_LOAD( "n05-12.rom", 0x5000, 0x1000, CRC(151de90a) SHA1(5d063c4fe6767727d051815120d692818a30ee81) ) |
| 1295 | |
| 1296 | ROM_REGION( 0x4000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 1297 | ROM_LOAD( "n11-6.bin", 0x0000, 0x1000, CRC(2dcedd12) SHA1(dfdcfc21bcba7c8e148ee54daae511ca78c58e70) ) |
| 1298 | ROM_LOAD( "k11-4.bin", 0x1000, 0x1000, CRC(3375b3bd) SHA1(a00b3c31cff123aab6ac0833aabfdd663302971a) ) |
| 1299 | ROM_LOAD( "l11-5.bin", 0x2000, 0x1000, CRC(fa7cbd91) SHA1(0208d2ebc59f3600005476b6987472685bc99d67) ) |
| 1300 | ROM_LOAD( "h11-3.bin", 0x3000, 0x1000, CRC(5655cc11) SHA1(5195e9b2a60c54280b48b32ee8248090904dbc51) ) |
| 1301 | |
| 1302 | ROM_REGION( 0x1000, REGION_GFX2, ROMREGION_DISPOSE ) |
| 1303 | ROM_LOAD( "c11-2.bin", 0x0000, 0x0800, CRC(d1352c31) SHA1(da726a63a8be830d695afeddc1717749af8c9d47) ) |
| 1304 | ROM_LOAD( "a11-1.bin", 0x0800, 0x0800, CRC(a7a2fdbd) SHA1(529865f8bbfbdbbf34ac39c70ef17e6d5bd0f845) ) |
| 1305 | |
| 1306 | ROM_REGION( 0x0060, REGION_PROMS, 0 ) |
| 1307 | ROM_LOAD( "prom.v6", 0x0000, 0x0020, CRC(b3fc1505) SHA1(5b94adde0428a26b815c7eb9b3f3716470d349c7) ) |
| 1308 | ROM_LOAD( "prom.u6", 0x0020, 0x0020, CRC(26aada9e) SHA1(f59645e606ea4f0dd0fc4ea47dd03f526c534941) ) |
| 1309 | ROM_LOAD( "prom.t6", 0x0040, 0x0020, CRC(676b3166) SHA1(29b9434cd34d43ea5664e436e2a24b54f8d88aac) ) |
| 1310 | |
| 1311 | ROM_REGION( 0x2000, REGION_SOUND1, 0 ) /* samples */ |
| 1312 | ROM_LOAD( "s05-14.bin", 0x0000, 0x1000, CRC(5f0bcdfb) SHA1(7f79bf6de117348f606696ed7ea1937bbf926612) ) |
| 1313 | ROM_LOAD( "r05-13.bin", 0x1000, 0x1000, CRC(9003ffbd) SHA1(fd016056aabc23957643f37230f03842294f795e) ) |
| 1314 | ROM_END |
| 1315 | |
| 1289 | 1316 | ROM_START( rpatrolb ) |
| 1290 | 1317 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) |
| 1291 | 1318 | ROM_LOAD( "rp1.4l", 0x0000, 0x1000, CRC(bfd7ae7a) SHA1(a06d1cc2674ed40d0bfa67dd6d724964c1e40600) ) |
| r1185 | r1186 | |
| 1462 | 1489 | ROM_LOAD( "cb5.bin", 0x1000, 0x1000, CRC(9003ffbd) SHA1(fd016056aabc23957643f37230f03842294f795e) ) |
| 1463 | 1490 | ROM_END |
| 1464 | 1491 | |
| 1465 | | ROM_START( ckongb ) |
| 1466 | | ROM_REGION( 0x10000, REGION_CPU1, 0 ) |
| 1467 | | ROM_LOAD( "d05-7.rom", 0x0000, 0x1000, CRC(5d96ee9a) SHA1(f531d251fd3469edd3b5b5e7c26ff9cef7006ce8) ) |
| 1468 | | ROM_LOAD( "f05-8.rom", 0x1000, 0x1000, CRC(74a8435b) SHA1(465ad96009d3ba939eee13ba0d5fd6d9dec118bc) ) |
| 1469 | | ROM_LOAD( "h05-9.rom", 0x2000, 0x1000, CRC(e06ca575) SHA1(cd5a32fac614902e136e522ac188616c72d65571) ) |
| 1470 | | ROM_LOAD( "k05-10.rom", 0x3000, 0x1000, CRC(46d83a11) SHA1(de840994104bfc633a3640610966f087fbc3d749) ) |
| 1471 | | ROM_LOAD( "l05-11.rom", 0x4000, 0x1000, CRC(07c30f3d) SHA1(9b72f8a76c64ab22f8b8c1bd8e457c10b86d95a1) ) |
| 1472 | | ROM_LOAD( "n05-12.rom", 0x5000, 0x1000, CRC(151de90a) SHA1(5d063c4fe6767727d051815120d692818a30ee81) ) |
| 1473 | | |
| 1474 | | ROM_REGION( 0x4000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 1475 | | ROM_LOAD( "n11-6.bin", 0x0000, 0x1000, CRC(2dcedd12) SHA1(dfdcfc21bcba7c8e148ee54daae511ca78c58e70) ) |
| 1476 | | ROM_LOAD( "k11-4.bin", 0x1000, 0x1000, CRC(3375b3bd) SHA1(a00b3c31cff123aab6ac0833aabfdd663302971a) ) |
| 1477 | | ROM_LOAD( "l11-5.bin", 0x2000, 0x1000, CRC(fa7cbd91) SHA1(0208d2ebc59f3600005476b6987472685bc99d67) ) |
| 1478 | | ROM_LOAD( "h11-3.bin", 0x3000, 0x1000, CRC(5655cc11) SHA1(5195e9b2a60c54280b48b32ee8248090904dbc51) ) |
| 1479 | | |
| 1480 | | ROM_REGION( 0x1000, REGION_GFX2, ROMREGION_DISPOSE ) |
| 1481 | | ROM_LOAD( "c11-2.bin", 0x0000, 0x0800, CRC(d1352c31) SHA1(da726a63a8be830d695afeddc1717749af8c9d47) ) |
| 1482 | | ROM_LOAD( "a11-1.bin", 0x0800, 0x0800, CRC(a7a2fdbd) SHA1(529865f8bbfbdbbf34ac39c70ef17e6d5bd0f845) ) |
| 1483 | | |
| 1484 | | ROM_REGION( 0x0060, REGION_PROMS, 0 ) |
| 1485 | | ROM_LOAD( "prom.v6", 0x0000, 0x0020, CRC(b3fc1505) SHA1(5b94adde0428a26b815c7eb9b3f3716470d349c7) ) |
| 1486 | | ROM_LOAD( "prom.u6", 0x0020, 0x0020, CRC(26aada9e) SHA1(f59645e606ea4f0dd0fc4ea47dd03f526c534941) ) |
| 1487 | | ROM_LOAD( "prom.t6", 0x0040, 0x0020, CRC(676b3166) SHA1(29b9434cd34d43ea5664e436e2a24b54f8d88aac) ) |
| 1488 | | |
| 1489 | | ROM_REGION( 0x2000, REGION_SOUND1, 0 ) /* samples */ |
| 1490 | | ROM_LOAD( "s05-14.bin", 0x0000, 0x1000, CRC(5f0bcdfb) SHA1(7f79bf6de117348f606696ed7ea1937bbf926612) ) |
| 1491 | | ROM_LOAD( "r05-13.bin", 0x1000, 0x1000, CRC(9003ffbd) SHA1(fd016056aabc23957643f37230f03842294f795e) ) |
| 1492 | | ROM_END |
| 1493 | | |
| 1494 | 1492 | ROM_START( swimmer ) |
| 1495 | 1493 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) |
| 1496 | 1494 | ROM_LOAD( "sw1", 0x0000, 0x1000, CRC(f12481e7) SHA1(4e8ee509043fd57ec1579594f0b2c543f270bead) ) |
| r1185 | r1186 | |
| 1630 | 1628 | GAME( 1981, ckongalc, ckong, cclimber, ckong, 0, ROT270, "bootleg", "Crazy Kong (Alca bootleg)", 0 ) |
| 1631 | 1629 | GAME( 198?, bigkong, ckong, cclimber, ckong, 0, ROT270, "bootleg", "Big Kong", 0 ) |
| 1632 | 1630 | GAME( 1981, monkeyd, ckong, cclimber, ckong, 0, ROT270, "bootleg", "Monkey Donkey", 0 ) |
| 1631 | GAME( 198?, ckongb, ckong, cclimber, ckongb, ckongb, ROT270, "bootleg", "Crazy Kong (Alternative levels)", 0 ) |
| 1633 | 1632 | |
| 1634 | 1633 | GAME( 1981, rpatrolb, 0, cclimber, rpatrolb, 0, ROT0, "bootleg", "River Patrol (bootleg)", 0 ) |
| 1635 | 1634 | GAME( 1981, rpatrolo, rpatrolb, cclimber, rpatrolb, 0, ROT0, "Orca", "River Patrol (Orca)", 0 ) |
| 1636 | 1635 | GAME( 1981, silvland, rpatrolb, cclimber, rpatrolb, 0, ROT0, "Falcon", "Silver Land", 0 ) |
| 1637 | 1636 | |
| 1638 | | GAME( 1985, cannonb, 0, cannonb, cannonb, cannonb, ROT90, "Soft", "Cannon Ball (Crazy Climber hardware)" , GAME_IMPERFECT_GRAPHICS ) |
| 1639 | | GAME( 1985, cannonb2, cannonb, cannonb, cannonb, 0, ROT90, "TV Game Gruenberg", "Cannon Ball (set 2)", 0 ) |
| 1640 | | GAME( 198?, ckongb, ckong, cclimber, ckongb, ckongb, ROT270, "bootleg", "Crazy Kong (Alternative levels)", 0 ) |
| 1637 | GAME( 1985, cannonb, cannonbp, cannonb, cannonb, cannonb, ROT90, "Soft", "Cannon Ball (bootleg on Crazy Climber hardware, set 1)" , GAME_IMPERFECT_GRAPHICS ) |
| 1638 | GAME( 1985, cannonb2, cannonbp, cannonb, cannonb, cannonb2, ROT90, "TV Game Gruenberg", "Cannon Ball (bootleg on Crazy Climber hardware, set 2)", 0 ) |
| 1641 | 1639 | |
| 1642 | 1640 | GAME( 1982, swimmer, 0, swimmer, swimmer, 0, ROT0, "Tehkan", "Swimmer (set 1)", 0 ) |
| 1643 | 1641 | GAME( 1982, swimmera, swimmer, swimmer, swimmer, 0, ROT0, "Tehkan", "Swimmer (set 2)", 0 ) |
src/mame/drivers/stv.c
| r1185 | r1186 | |
| 3694 | 3694 | //GBX YEAR, NAME, PARENT, BIOS, MACH,INP, INIT, MONITOR |
| 3695 | 3695 | /* Playable */ |
| 3696 | 3696 | GAMEB( 1998, astrass, stvbios, stvbios, stv, stv, astrass, ROT0, "Sunsoft", "Astra SuperStars (J 980514 V1.002)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 3697 | | GAMEB( 1996, bakubaku, stvbios, stvbios, stv, stv, bakubaku, ROT0, "Sega", "Baku Baku Animal (J 950407 V1.000)", GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3697 | GAMEB( 1995, bakubaku, stvbios, stvbios, stv, stv, bakubaku, ROT0, "Sega", "Baku Baku Animal (J 950407 V1.000)", GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3698 | 3698 | GAMEB( 1996, batmanfr, stvbios, stvbios, stv, stv, batmanfr, ROT0, "Acclaim", "Batman Forever (JUE 960507 V1.000)", GAME_NO_SOUND ) |
| 3699 | 3699 | GAMEB( 1996, colmns97, stvbios, stvbios, stv, stv, colmns97, ROT0, "Sega", "Columns '97 (JET 961209 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3700 | 3700 | GAMEB( 1997, cotton2, stvbios, stvbios, stv, stv, cotton2, ROT0, "Success", "Cotton 2 (JUET 970902 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| r1185 | r1186 | |
| 3707 | 3707 | GAMEB( 1995, fhboxers, stvbios, stvbios, stv, stv, fhboxers, ROT0, "Sega", "Funky Head Boxers (JUETBKAL 951218 V1.000)", GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3708 | 3708 | GAMEB( 1994, gaxeduel, stvbios, stvbios, stv, stv, gaxeduel, ROT0, "Sega", "Golden Axe - The Duel (JUETL 950117 V1.000)", GAME_IMPERFECT_SOUND ) |
| 3709 | 3709 | GAMEB( 1998, grdforce, stvbios, stvbios, stv, stv, grdforce, ROT0, "Success", "Guardian Force (JUET 980318 V0.105)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3710 | | GAMEB( 1996, groovef, stvbios, stvbios, stv, stv, groovef, ROT0, "Atlus", "Power Instinct 3 - Groove On Fight (J 970416 V1.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3711 | | GAMEB( 1998, hanagumi, stvbios, stvbios, stv, stv, hanagumi, ROT0, "Sega", "Hanagumi Taisen Columns - Sakura Wars (J 971007 V1.010)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 3710 | GAMEB( 1998, groovef, stvbios, stvbios, stv, stv, groovef, ROT0, "Atlus", "Power Instinct 3 - Groove On Fight (J 970416 V1.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3711 | GAMEB( 1997, hanagumi, stvbios, stvbios, stv, stv, hanagumi, ROT0, "Sega", "Hanagumi Taisen Columns - Sakura Wars (J 971007 V1.010)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 3712 | 3712 | GAMEB( 1996, introdon, stvbios, stvbios, stv, stv, ic13, ROT0, "Sunsoft / Success", "Karaoke Quiz Intro Don Don! (J 960213 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3713 | 3713 | GAMEB( 1995, kiwames, stvbios, stvbios, stv, stvmp,ic13, ROT0, "Athena", "Pro Mahjong Kiwame S (J 951020 V1.208)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3714 | 3714 | GAMEB( 1997, maruchan, stvbios, stvbios, stv, stv, maruchan, ROT0, "Sega / Toyosuisan", "Maru-Chan de Goo! (J 971216 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3715 | | GAMEB( 1995, mausuke, stvbios, stvbios, stv, stv, mausuke, ROT0, "Data East", "Mausuke no Ojama the World (J 960314 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3715 | GAMEB( 1996, mausuke, stvbios, stvbios, stv, stv, mausuke, ROT0, "Data East", "Mausuke no Ojama the World (J 960314 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3716 | 3716 | GAMEB( 1998, othellos, stvbios, stvbios, stv, stv, othellos, ROT0, "Success", "Othello Shiyouyo (J 980423 V1.002)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3717 | 3717 | GAMEB( 1995, pblbeach, stvbios, stvbios, stv, stv, pblbeach, ROT0, "T&E Soft", "Pebble Beach - The Great Shot (JUE 950913 V0.990)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3718 | 3718 | GAMEB( 1996, prikura, stvbios, stvbios, stv, stv, prikura, ROT0, "Atlus", "Princess Clara Daisakusen (J 960910 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3719 | 3719 | GAMEB( 1996, puyosun, stvbios, stvbios, stv, stv, puyosun, ROT0, "Compile", "Puyo Puyo Sun (J 961115 V0.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3720 | 3720 | GAMEB( 1998, rsgun, stvbios, stvbios, stv, stv, rsgun, ROT0, "Treasure", "Radiant Silvergun (JUET 980523 V1.000)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 3721 | | GAMEB( 1996, sasissu, stvbios, stvbios, stv, stv, sasissu, ROT0, "Sega", "Taisen Tanto-R Sashissu!! (J 980216 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3722 | | GAMEB( 1998, seabass, stvbios, stvbios, stv, stv, seabass, ROT0, "A wave inc. (Able license)","Sea Bass Fishing (JUET 971110 V0.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3721 | GAMEB( 1998, sasissu, stvbios, stvbios, stv, stv, sasissu, ROT0, "Sega", "Taisen Tanto-R Sashissu!! (J 980216 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3722 | GAMEB( 1997, seabass, stvbios, stvbios, stv, stv, seabass, ROT0, "A wave inc. (Able license)","Sea Bass Fishing (JUET 971110 V0.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3723 | 3723 | GAMEB( 1995, shanhigw, stvbios, stvbios, stv, stv, shanhigw, ROT0, "Sunsoft / Activision", "Shanghai - The Great Wall / Shanghai Triple Threat (JUE 950623 V1.005)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3724 | 3724 | GAMEB( 1997, shienryu, stvbios, stvbios, stv, stv, shienryu, ROT270, "Warashi", "Shienryu (JUET 961226 V1.000)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 3725 | 3725 | GAMEB( 1995, smleague, stvbios, stvbios, stv, stv, smleague, ROT0, "Sega", "Super Major League (U 960108 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3726 | 3726 | GAMEB( 1995, finlarch, smleague,stvbios, stv, stv, finlarch, ROT0, "Sega", "Final Arch (J 950714 V1.001)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3727 | 3727 | GAMEB( 1998, sss, stvbios, stvbios, stv, stv, sss, ROT0, "Capcom / Cave / Victor", "Steep Slope Sliders (JUET 981110 V1.000)", GAME_IMPERFECT_SOUND ) |
| 3728 | | GAMEB( 1995, sandor, stvbios, stvbios, stv, stv, sandor, ROT0, "Sega", "Sando-R (J 951114 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3728 | GAMEB( 1995, sandor, stvbios, stvbios, stv, stv, sandor, ROT0, "Sega", "Puzzle & Action: Sando-R (J 951114 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3729 | 3729 | GAMEB( 1996, sokyugrt, stvbios, stvbios, stv, stv, sokyugrt, ROT0, "Raizing / 8ing", "Soukyugurentai / Terra Diver (JUET 960821 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3730 | 3730 | GAMEB( 1995, suikoenb, stvbios, stvbios, stv, stv, suikoenb, ROT0, "Data East", "Suikoenbu / Outlaws of the Lost Dynasty (JUETL 950314 V2.001)", GAME_IMPERFECT_SOUND ) |
| 3731 | | GAMEB( 1995, thunt, sandor, stvbios, stv, stv, thunt, ROT0, "Sega (Deniam license?)", "Treasure Hunt (JUET 970901 V2.00E)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3731 | GAMEB( 1997, thunt, sandor, stvbios, stv, stv, thunt, ROT0, "Sega", "Puzzle & Action: Treasure Hunt (JUET 970901 V2.00E)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3732 | 3732 | GAMEB( 1996, vfkids, stvbios, stvbios, stv, stv, ic13, ROT0, "Sega", "Virtua Fighter Kids (JUET 960319 V0.000)", GAME_IMPERFECT_SOUND ) |
| 3733 | 3733 | GAMEB( 1997, winterht, stvbios, stvbios, stv, stv, winterht, ROT0, "Sega", "Winter Heat (JUET 971012 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| 3734 | 3734 | GAMEB( 1997, znpwfv, stvbios, stvbios, stv, stv, znpwfv, ROT0, "Sega", "Zen Nippon Pro-Wrestling Featuring Virtua (J 971123 V1.000)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS ) |
| r1185 | r1186 | |
| 3741 | 3741 | /* Doing Something.. but not enough yet */ |
| 3742 | 3742 | GAMEB( 1998, elandore, stvbios, stvbios, stv, stv, elandore, ROT0, "Sai-Mate", "Elan Doree - Legend of Dragon (JUET 980922 V1.006)", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING )//japanese name? |
| 3743 | 3743 | GAMEB( 1995, vfremix, stvbios, stvbios, stv, stv, vfremix, ROT0, "Sega", "Virtua Fighter Remix (JUETBKAL 950428 V1.000)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
| 3744 | | GAMEB( 1996, findlove, stvbios, stvbios, stv, stv, ic13, ROT0, "Daiki / FCF", "Find Love (J 971212 V1.000)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
| 3745 | | GAMEB( 1995, decathlt, stvbios, stvbios, stv, stv, decathlt, ROT0, "Sega", "Decathlete (JUET 960424 V1.000)", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION ) |
| 3744 | GAMEB( 1997, findlove, stvbios, stvbios, stv, stv, ic13, ROT0, "Daiki / FCF", "Find Love (J 971212 V1.000)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) |
| 3745 | GAMEB( 1996, decathlt, stvbios, stvbios, stv, stv, decathlt, ROT0, "Sega", "Decathlete (JUET 960424 V1.000)", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION ) |
| 3746 | 3746 | |
| 3747 | 3747 | /* not working,black screen */ |
| 3748 | 3748 | GAMEB( 1999, ffreveng, stvbios, stvbios, stv, stv, ffreveng, ROT0, "Capcom", "Final Fight Revenge (JUET 990714 V1.000)", GAME_UNEMULATED_PROTECTION | GAME_NO_SOUND | GAME_NOT_WORKING ) |
src/mame/drivers/psikyo4.c
| r1185 | r1186 | |
| 10 | 10 | Taisen Hot Gimmick (c)1997 |
| 11 | 11 | Taisen Hot Gimmick Kairakuten (c)1998 |
| 12 | 12 | Taisen Hot Gimmick 3 Digital Surfing (c)1999 |
| 13 | Taisen Hot Gimmick 4 Ever (c)2000 |
| 14 | Taisen Hot Gimmick Integral (c)2001 |
| 15 | |
| 13 | 16 | Lode Runner - The Dig Fight (c)2000 |
| 14 | 17 | Quiz de Idol! Hot Debut (c)2000 |
| 15 | 18 | |
| 16 | | Incomplete Dumps |
| 17 | | Taisen Hot Gimmick 4 Ever (c)2000 (confirmed by Japump) |
| 18 | | Taisen Hot Gimmick Integral (c)2001 (confirmed by Yahoo! Japan auction) |
| 19 | | |
| 20 | | |
| 21 | 19 | The PS4 board appears to be a cheaper board than PS3/5/5v2, with only simple sprites, no bgs, |
| 22 | 20 | smaller palette etc, only 8bpp sprites too. |
| 23 | 21 | Supports dual-screen though. |
| r1185 | r1186 | |
| 42 | 40 | |
| 43 | 41 | Hold Button during booting to test roms (Checksum 16-bit) for: |
| 44 | 42 | |
| 45 | | Lode Runner - The Dig Fight: PL1 Start (passes gfx, sample result:05A5, expects:0BB0 [both sets]) |
| 43 | Lode Runner - The Dig Fight: PL1 Start (passes gfx, sample result:05A5, expects:0BB0 [both sets]) (banking?) |
| 46 | 44 | Quiz de Idol! Hot Debut: PL1 Start (passes) |
| 47 | 45 | |
| 48 | 46 | --- Lode Runner: The Dig Fight --- |
| r1185 | r1186 | |
| 56 | 54 | NOTE: The version number (A/B) on Lode Runner: The Dig Fight is ONLY displayed when the game is set |
| 57 | 55 | to Japanese. The same is true for Space Bomber in psikyosh.c |
| 58 | 56 | |
| 57 | |
| 58 | Psikyo PS4V3 Hardware Overview |
| 59 | Psikyo, 1997-2001 |
| 60 | |
| 61 | PCB Layout |
| 62 | ---------- |
| 63 | |
| 64 | PS4V3 MADE IN JAPAN |
| 65 | |--------------------------------------------------------------------| |
| 66 | | SND0.U10 SND1.U19 HA13118 HA13118 | |
| 67 | | JRC4741 | |
| 68 | | 8L.U112 8H.U113 YAC516 VOL VOL |-| |
| 69 | | 74ACT153 74ACT153 | |
| 70 | | |-| |
| 71 | | 7L.U9 7H.U18 74HCT273 74HCT273 74ACT138 74HCT273 | |
| 72 | | 74HC244 74HC244 M| |
| 73 | | 74ACT244 CN8 A| |
| 74 | | 6L.U8 6H.U17 74ACT138 93LC56 H| |
| 75 | | JP4 74ACT244 J| |
| 76 | | |---------| O| |
| 77 | | 5L.U7 5H.U16 | | 74ACT244 CN7 N| |
| 78 | | | PSIKYO | 74HC14 G| |
| 79 | | | PS6807 | 74ACT244 TD62064 | |
| 80 | | 4L.U6 4H.U15 | | |-| |
| 81 | | |---------| 74ACT244 | |
| 82 | | TD62003 |-| |
| 83 | | 3L.U5 3H.U14 57.2727MHz 74ACT244 | |
| 84 | | 74ACT138 TD62003 | |
| 85 | | 3771 J| |
| 86 | | 2L.U4 2H.U13 814260 74AC08 74ACT04 74HC245 74HC244 A| |
| 87 | | M| |
| 88 | | 814260 |--------| M| |
| 89 | | 1L.U3 1H.U12 | | A| |
| 90 | | | SH-2 | | |
| 91 | | | | 74HC244 |-| |
| 92 | | 0L.U2 0H.U11 1.U23 |--------| | |
| 93 | | 74HC244 |-| |
| 94 | | PROG.U1 2.U22 74ACT139 | |
| 95 | |--------------------------------------------------------------------| |
| 96 | (All IC's listed) |
| 97 | Notes: |
| 98 | SH-2 - Hitachi HD6417604F28 SH-2 CPU, clock input 28.63635 [57.2727/2] (QFP144) |
| 99 | YMF278 - Yamaha YMF278B OPL4 sound chip, clock input 28.63635MHz [57.2727/2] (QFP80) |
| 100 | YAC516 - Yamaha YAC516 Delta Sigma Modulation D/A Converter with 8 Times Over-sampling |
| 101 | Filter. Clock input 14.318175MHz [57.2727/4] |
| 102 | 814260 - Fujitsu 814260-70 256k x16 (4MBit) DRAM (SOJ40) |
| 103 | 3771 - Fujitsu MB3771 Watchdog Reset IC (SOIC8) |
| 104 | 93LC56 - 256x8(2k) Serial CMOS EEPROM (SOIC8) |
| 105 | JRC4741 - Japan Radio Co. JRC4741 Quad OP AMP (SOIC14) |
| 106 | HA13118 - 18W Bridge Tied Load (BTL) Mono Audio Amplifier Module (in 15-pin SP-15TA package) |
| 107 | JP4 - Hardwired jumper bank (x4) for region selection. |
| 108 | All jumpers shorted = Japan region (default) |
| 109 | CN7/CN8 - Extra connector for 2nd screen output and additional player inputs. JAMMA/MAHJONG |
| 110 | connectors not used together. Either one or the other is used depending on the game. |
| 111 | Game will operate fine with 1 screen output. CN7/CN8 connection is optional. |
| 112 | TD62064 - Toshiba TD62064 4 Channel High-Current Darlington Sink Driver (SOP18) |
| 113 | TD62003 - Toshiba TD62003 7 Channel High-Current Darlington Sink Driver (SOP16) |
| 114 | VSync - 60Hz |
| 115 | HSync - 15.68kHz |
| 116 | |
| 117 | ROMs - |
| 118 | 1.U23 - Main Program, ST 27C4002 EPROM (DIP40) |
| 119 | 2.U22 / |
| 120 | |
| 121 | The remaining ROMs are surface mounted TSOP48 Type II MASKROMs, |
| 122 | either OKI MSM27C3252 (32MBit) or OKI MSM27C1652 (16MBit). |
| 123 | These MASKROMs are non-standard are require a custom adapter |
| 124 | to read them. Not all positions are populated for each game. See |
| 125 | the source below for specifics. |
| 126 | |
| 59 | 127 | ----------------------------------------------------------------*/ |
| 60 | 128 | |
| 61 | 129 | #include "driver.h" |
| r1185 | r1186 | |
| 851 | 919 | ROM_END |
| 852 | 920 | |
| 853 | 921 | ROM_START( hotgmcki ) |
| 854 | | /* main program */ |
| 855 | | ROM_REGION( 0x300000, REGION_CPU1, 0) |
| 922 | ROM_REGION( 0x500000, REGION_CPU1, 0) |
| 856 | 923 | ROM_LOAD32_WORD_SWAP( "2.u22", 0x000000, 0x080000, CRC(abc192dd) SHA1(674c2b8814319605c1b6221bbe18588a98dda093) ) |
| 857 | 924 | ROM_LOAD32_WORD_SWAP( "1.u23", 0x000002, 0x080000, CRC(8be896d0) SHA1(5d677dede4ec18cbfc54acae95fe0f10bfc4d566) ) |
| 858 | | /* not dumped yet */ |
| 859 | | ROM_LOAD16_WORD_SWAP( "prog.u1", 0x100000, 0x100000, NO_DUMP ) |
| 925 | ROM_LOAD16_WORD_SWAP( "prog.u1", 0x100000, 0x200000, CRC(9017ae8e) SHA1(0879198606095a2d209df059538ce1c73460b30e) ) // no test |
| 926 | ROM_RELOAD(0x300000,0x200000) |
| 860 | 927 | |
| 861 | | /* exact number & size of gfx / sound roms may be incorrect */ |
| 862 | | ROM_REGION( 0x4000000, REGION_GFX1, ROMTEST_GFX ) /* Sprites */ |
| 863 | | /* not dumped yet */ |
| 864 | | ROM_LOAD32_WORD( "0l.u2", 0x0000000, 0x400000, NO_DUMP ) |
| 865 | | ROM_LOAD32_WORD( "0h.u11", 0x0000002, 0x400000, NO_DUMP ) |
| 866 | | ROM_LOAD32_WORD( "1l.u3", 0x0800000, 0x400000, NO_DUMP ) |
| 867 | | ROM_LOAD32_WORD( "1h.u12", 0x0800002, 0x400000, NO_DUMP ) |
| 868 | | ROM_LOAD32_WORD( "2l.u4", 0x1000000, 0x400000, NO_DUMP ) |
| 869 | | ROM_LOAD32_WORD( "2h.u13", 0x1000002, 0x400000, NO_DUMP ) |
| 870 | | ROM_LOAD32_WORD( "3l.u5", 0x1800000, 0x400000, NO_DUMP ) |
| 871 | | ROM_LOAD32_WORD( "3h.u14", 0x1800002, 0x400000, NO_DUMP ) |
| 872 | | ROM_LOAD32_WORD( "4l.u6", 0x2000000, 0x400000, NO_DUMP ) |
| 873 | | ROM_LOAD32_WORD( "4h.u15", 0x2000002, 0x400000, NO_DUMP ) |
| 874 | | ROM_LOAD32_WORD( "5l.u7", 0x2800000, 0x400000, NO_DUMP ) |
| 875 | | ROM_LOAD32_WORD( "5h.u16", 0x2800002, 0x400000, NO_DUMP ) |
| 876 | | ROM_LOAD32_WORD( "6l.u8", 0x3000000, 0x400000, NO_DUMP ) |
| 877 | | ROM_LOAD32_WORD( "6h.u17", 0x3000002, 0x400000, NO_DUMP ) |
| 878 | | ROM_LOAD32_WORD( "7l.u9", 0x3800000, 0x400000, NO_DUMP ) |
| 879 | | ROM_LOAD32_WORD( "7h.u18", 0x3800002, 0x400000, NO_DUMP ) |
| 928 | /* Roms have to be mirrored with ROM_RELOAD for rom tests to pass */ |
| 929 | ROM_REGION( 0x4000000, REGION_GFX1, ROMREGION_ERASEFF | ROMTEST_GFX ) /* Sprites */ |
| 930 | ROM_LOAD32_WORD( "0l.u2", 0x0000000, 0x200000, CRC(58ae45eb) SHA1(76a23e79f2c772c5e85b8c15cf79f56b6f71fbc6) ) // ok |
| 931 | ROM_RELOAD( 0x0400000, 0x200000 ) |
| 932 | ROM_LOAD32_WORD( "0h.u11", 0x0000002, 0x200000, CRC(d7bbb929) SHA1(c505ad04cdafb84800099bbbb67c5f6b52212124) ) // ok |
| 933 | ROM_RELOAD( 0x0400002, 0x200000 ) |
| 934 | ROM_LOAD32_WORD( "1l.u3", 0x0800000, 0x200000, CRC(27576360) SHA1(ed9d6f5b9934e8ddae3f3ca146e99f42dbd495de) ) // ok |
| 935 | ROM_RELOAD( 0x0c00000, 0x200000 ) |
| 936 | ROM_LOAD32_WORD( "1h.u12", 0x0800002, 0x200000, CRC(7439a63f) SHA1(c9a74e5e81a2c94ce7a9b3b487f54ac5b3635744) ) // ok |
| 937 | ROM_RELOAD( 0x0c00002, 0x200000 ) |
| 938 | ROM_LOAD32_WORD( "2l.u4", 0x1000000, 0x200000, CRC(fda64e24) SHA1(e8788b5f0e8b0f90c9942f9f4cbcee02be8afd09) ) // ok |
| 939 | ROM_RELOAD( 0x1400000, 0x200000 ) |
| 940 | ROM_LOAD32_WORD( "2h.u13", 0x1000002, 0x200000, CRC(8be54ea6) SHA1(311812e9d7815e80db05d9a94c277b2b37e7a589) ) // ok |
| 941 | ROM_RELOAD( 0x1400002, 0x200000 ) |
| 942 | ROM_LOAD32_WORD( "3l.u5", 0x1800000, 0x200000, CRC(92507b3f) SHA1(15f0432a8061e886be6171ee90581ad8fe3d44ba) ) // ok |
| 943 | ROM_RELOAD( 0x1c00000, 0x200000 ) |
| 944 | ROM_LOAD32_WORD( "3h.u14", 0x1800002, 0x200000, CRC(042bef5e) SHA1(b57ffa744a17be21681db3d5246025ea27067ae7) ) // ok |
| 945 | ROM_RELOAD( 0x1c00002, 0x200000 ) |
| 946 | ROM_LOAD32_WORD( "4l.u6", 0x2000000, 0x200000, CRC(023b6d70) SHA1(7932d8648d1c2e90539955a6474d9755f02b4350) ) // ok |
| 947 | ROM_RELOAD( 0x2400000, 0x200000 ) |
| 948 | ROM_LOAD32_WORD( "4h.u15", 0x2000002, 0x200000, CRC(9be7e8b1) SHA1(2200bb86b0a7b05a9387da14d8bdc571d0570d11) ) // ok |
| 949 | ROM_RELOAD( 0x2400002, 0x200000 ) |
| 950 | ROM_LOAD32_WORD( "5l.u7", 0x2800000, 0x200000, CRC(7aa54306) SHA1(ec9ecc8dbe81679e0e7544cf5f331ca3eeee700a) ) // ok |
| 951 | ROM_RELOAD( 0x2c00000, 0x200000 ) |
| 952 | ROM_LOAD32_WORD( "5h.u16", 0x2800002, 0x200000, CRC(e6b48e52) SHA1(1deb84fe96fe31ba33ddf833967ef332570b8fe5) ) // ok |
| 953 | ROM_RELOAD( 0x2c00002, 0x200000 ) |
| 954 | ROM_LOAD32_WORD( "6l.u8", 0x3000000, 0x200000, CRC(dfe675e9) SHA1(a4ff934c4b0501be490a2ba3a0ef1d46bc1d68e7) ) // ok |
| 955 | ROM_RELOAD( 0x3400000, 0x200000 ) |
| 956 | ROM_LOAD32_WORD( "6h.u17", 0x3000002, 0x200000, CRC(45919576) SHA1(63c509f8786ebd43ec24664bb2b829f4bf8acf5d) ) // ok |
| 957 | ROM_RELOAD( 0x3400002, 0x200000 ) |
| 958 | ROM_LOAD32_WORD( "7l.u9", 0x3800000, 0x200000, CRC(cd3af598) SHA1(57c8048802264a4699e0e95b8deb25689afff237) ) // ok |
| 959 | ROM_RELOAD( 0x3c00000, 0x200000 ) |
| 960 | ROM_LOAD32_WORD( "7h.u18", 0x3800002, 0x200000, CRC(a3fd4ae5) SHA1(31056e5f645984b85e9bc3767016a856ac0175f9) ) // ok |
| 961 | ROM_RELOAD( 0x3c00002, 0x200000 ) |
| 880 | 962 | |
| 881 | 963 | ROM_REGION( 0x400000, REGION_SOUND1, ROMREGION_ERASE00 ) |
| 882 | 964 | |
| 883 | 965 | ROM_REGION( 0x800000, REGION_SOUND2, 0 ) |
| 884 | | /* not dumped yet */ |
| 885 | | ROM_LOAD( "snd0.u10", 0x000000, 0x400000, NO_DUMP ) |
| 886 | | ROM_LOAD( "snd1.u19", 0x400000, 0x400000, NO_DUMP ) |
| 966 | ROM_LOAD( "snd0.u10", 0x000000, 0x400000, CRC(5f275f35) SHA1(c5952a16e9f0cee6fc990c234ccaa7ca577741bd) ) // ok |
| 967 | ROM_LOAD( "snd1.u19", 0x400000, 0x400000, CRC(98608779) SHA1(a73c21f0f66c2af903e44a0a6a9f821b00615e7b) ) // ok (but fails rom test due to bad banking in service mode) |
| 887 | 968 | ROM_END |
| 888 | 969 | |
| 889 | 970 | |
| r1185 | r1186 | |
| 1033 | 1114 | GAME( 1998, hgkairak, 0, ps4big, hotgmck, hotgmck, ROT0, "Psikyo", "Taisen Hot Gimmick Kairakuten (Japan)", 0 ) |
| 1034 | 1115 | GAME( 1999, hotgmck3, 0, ps4big, hotgmck, hotgmck, ROT0, "Psikyo", "Taisen Hot Gimmick 3 Digital Surfing (Japan)", 0 ) |
| 1035 | 1116 | GAME( 2000, hotgm4ev, 0, ps4big, hotgmck, hotgmck, ROT0, "Psikyo", "Taisen Hot Gimmick 4 Ever (Japan)", 0 ) |
| 1036 | | GAME( 2001, hotgmcki, 0, ps4big, hotgmck, hotgmck, ROT0, "Psikyo", "Taisen Hot Gimmick Integral (Japan)", GAME_NOT_WORKING ) |
| 1117 | GAME( 2001, hotgmcki, 0, ps4big, hotgmck, hotgmck, ROT0, "Psikyo", "Mahjong Hot Gimmick Integral (Japan)", 0 ) |
| 1037 | 1118 | GAME( 2000, loderndf, 0, ps4small, loderndf, loderndf, ROT0, "Psikyo", "Lode Runner - The Dig Fight (ver. B)", 0 ) |
| 1038 | 1119 | GAME( 2000, loderdfa, loderndf, ps4small, loderndf, loderdfa, ROT0, "Psikyo", "Lode Runner - The Dig Fight (ver. A)", 0 ) |
| 1039 | 1120 | GAME( 2000, hotdebut, 0, ps4small, hotdebut, hotdebut, ROT0, "Psikyo / Moss", "Quiz de Idol! Hot Debut (Japan)", 0 ) |
src/mame/drivers/f1gp.c
| r1185 | r1186 | |
| 209 | 209 | AM_RANGE(0x1b, 0x1b) AM_WRITE(YM2610_data_port_0_B_w) |
| 210 | 210 | ADDRESS_MAP_END |
| 211 | 211 | |
| 212 | static WRITE16_HANDLER( f1gpb_misc_w ) |
| 213 | { |
| 214 | /* |
| 215 | static int old=-1; |
| 216 | static int old_bank = -1; |
| 217 | int new_bank = (data & 0xf0) >> 4; //wrong! |
| 212 | 218 | |
| 219 | if(old_bank != new_bank && new_bank < 5) |
| 220 | { |
| 221 | // oki banking |
| 222 | UINT8 *src = memory_region(REGION_SOUND1) + 0x40000 + 0x10000 * new_bank; |
| 223 | UINT8 *dst = memory_region(REGION_SOUND1) + 0x30000; |
| 224 | memcpy(dst, src, 0x10000); |
| 213 | 225 | |
| 226 | old_bank = new_bank; |
| 227 | } |
| 228 | |
| 229 | //data & 0x80 toggles |
| 230 | |
| 231 | if((data & 0x7f) != old) |
| 232 | printf("misc = %X\n",old=data & 0x7f); |
| 233 | |
| 234 | */ |
| 235 | } |
| 236 | |
| 237 | static ADDRESS_MAP_START( f1gpb_cpu1_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 238 | AM_RANGE(0x000000, 0x03ffff) AM_ROM |
| 239 | AM_RANGE(0x100000, 0x2fffff) AM_READ(extrarom_r) |
| 240 | AM_RANGE(0xa00000, 0xbfffff) AM_READ(extrarom2_r) |
| 241 | AM_RANGE(0x800000, 0x801fff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) |
| 242 | AM_RANGE(0xc00000, 0xc3ffff) AM_READWRITE(f1gp_zoomdata_r, f1gp_zoomdata_w) |
| 243 | AM_RANGE(0xd00000, 0xd01fff) AM_READWRITE(f1gp_rozvideoram_r, f1gp_rozvideoram_w) AM_BASE(&f1gp_rozvideoram) |
| 244 | AM_RANGE(0xd02000, 0xd03fff) AM_READWRITE(f1gp_rozvideoram_r, f1gp_rozvideoram_w) /* mirror */ |
| 245 | AM_RANGE(0xd04000, 0xd05fff) AM_READWRITE(f1gp_rozvideoram_r, f1gp_rozvideoram_w) /* mirror */ |
| 246 | AM_RANGE(0xd06000, 0xd07fff) AM_READWRITE(f1gp_rozvideoram_r, f1gp_rozvideoram_w) /* mirror */ |
| 247 | AM_RANGE(0xe00000, 0xe03fff) AM_RAM //unused |
| 248 | AM_RANGE(0xe04000, 0xe07fff) AM_RAM //unused |
| 249 | AM_RANGE(0xf00000, 0xf003ff) AM_RAM //unused |
| 250 | AM_RANGE(0xf10000, 0xf103ff) AM_RAM //unused |
| 251 | AM_RANGE(0xff8000, 0xffbfff) AM_RAM |
| 252 | AM_RANGE(0xffc000, 0xffcfff) AM_READWRITE(sharedram_r, sharedram_w) AM_BASE(&sharedram) |
| 253 | AM_RANGE(0xffd000, 0xffdfff) AM_RAM AM_WRITE(f1gp_fgvideoram_w) AM_BASE(&f1gp_fgvideoram) |
| 254 | AM_RANGE(0xffe000, 0xffefff) AM_RAM AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16) |
| 255 | AM_RANGE(0xfff000, 0xfff001) AM_READ(input_port_0_word_r) |
| 256 | AM_RANGE(0xfff004, 0xfff005) AM_READ(input_port_1_word_r) |
| 257 | AM_RANGE(0xfff006, 0xfff007) AM_READ(input_port_2_word_r) |
| 258 | AM_RANGE(0xfff008, 0xfff009) AM_READNOP //? |
| 259 | AM_RANGE(0xfff006, 0xfff007) AM_WRITENOP |
| 260 | AM_RANGE(0xfff00a, 0xfff00b) AM_RAM AM_BASE(&f1gpb_fgregs) |
| 261 | AM_RANGE(0xfff00e, 0xfff00f) AM_READWRITE(OKIM6295_status_0_lsb_r, OKIM6295_data_0_lsb_w) |
| 262 | AM_RANGE(0xfff00c, 0xfff00d) AM_WRITE(f1gpb_misc_w) |
| 263 | AM_RANGE(0xfff010, 0xfff011) AM_WRITENOP |
| 264 | AM_RANGE(0xfff020, 0xfff023) AM_RAM //? |
| 265 | AM_RANGE(0xfff050, 0xfff051) AM_READ(input_port_3_word_r) |
| 266 | AM_RANGE(0xfff800, 0xfff809) AM_RAM AM_BASE(&f1gpb_rozregs) |
| 267 | ADDRESS_MAP_END |
| 268 | |
| 269 | static ADDRESS_MAP_START( f1gpb_cpu2_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 270 | AM_RANGE(0x000000, 0x01ffff) AM_ROM |
| 271 | AM_RANGE(0xff8000, 0xffbfff) AM_RAM |
| 272 | AM_RANGE(0xffc000, 0xffcfff) AM_READWRITE(sharedram_r, sharedram_w) |
| 273 | AM_RANGE(0xfff030, 0xfff031) AM_NOP //? |
| 274 | ADDRESS_MAP_END |
| 275 | |
| 214 | 276 | INPUT_PORTS_START( f1gp ) |
| 215 | 277 | PORT_START |
| 216 | 278 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r1185 | r1186 | |
| 524 | 586 | MACHINE_DRIVER_END |
| 525 | 587 | |
| 526 | 588 | |
| 527 | | static MACHINE_DRIVER_START( sf1gp ) |
| 589 | static MACHINE_DRIVER_START( f1gpb ) |
| 528 | 590 | |
| 529 | 591 | /* basic machine hardware */ |
| 530 | 592 | MDRV_CPU_ADD_TAG("main",M68000,10000000) /* 10 MHz ??? */ |
| 531 | | MDRV_CPU_PROGRAM_MAP(f1gp_readmem1,f1gp_writemem1) |
| 593 | MDRV_CPU_PROGRAM_MAP(f1gpb_cpu1_map,0) |
| 532 | 594 | MDRV_CPU_VBLANK_INT(irq1_line_hold,1) |
| 533 | 595 | |
| 534 | 596 | MDRV_CPU_ADD(M68000,10000000) /* 10 MHz ??? */ |
| 535 | | MDRV_CPU_PROGRAM_MAP(readmem2,writemem2) |
| 597 | MDRV_CPU_PROGRAM_MAP(f1gpb_cpu2_map,0) |
| 536 | 598 | MDRV_CPU_VBLANK_INT(irq1_line_hold,1) |
| 537 | 599 | |
| 538 | 600 | /* NO sound CPU */ |
| r1185 | r1186 | |
| 548 | 610 | MDRV_GFXDECODE(f1gp) |
| 549 | 611 | MDRV_PALETTE_LENGTH(2048) |
| 550 | 612 | |
| 551 | | MDRV_VIDEO_START(f1gp) |
| 552 | | MDRV_VIDEO_UPDATE(f1gp) |
| 613 | MDRV_VIDEO_START(f1gpb) |
| 614 | MDRV_VIDEO_UPDATE(f1gpb) |
| 553 | 615 | |
| 554 | 616 | /* sound hardware */ |
| 555 | 617 | MDRV_SPEAKER_STANDARD_STEREO("left", "right") |
| r1185 | r1186 | |
| 630 | 692 | the video hardware is different, it lacks the sound z80, and has less samples |
| 631 | 693 | */ |
| 632 | 694 | |
| 633 | | ROM_START( sf1gp ) |
| 695 | ROM_START( f1gpb ) |
| 634 | 696 | ROM_REGION( 0x40000, REGION_CPU1, 0 ) /* 68000 code */ |
| 635 | 697 | /* these have extra data at 0x30000 which isn't preset in the f1gp set, is it related to the changed sound hardware? */ |
| 636 | 698 | ROM_LOAD16_BYTE( "1.ic38", 0x000001, 0x20000, CRC(046dd83a) SHA1(ea65fa88f9d9a79664de666e63594a7a7de86650) ) |
| r1185 | r1186 | |
| 681 | 743 | ROM_REGION( 0x40000, REGION_GFX4, ROMREGION_ERASE00 ) /* gfx data for the 053936 */ |
| 682 | 744 | /* RAM, not ROM - handled at run time */ |
| 683 | 745 | |
| 684 | | ROM_REGION( 0x100000, REGION_SOUND1, 0 ) /* sound samples */ |
| 685 | | ROM_LOAD( "6.ic13", 0x000000, 0x080000, CRC(6e83ffd8) SHA1(618fd6cd6c0844a4be96f77ff22cd41364718d16) ) |
| 746 | ROM_REGION( 0x90000, REGION_SOUND1, 0 ) /* sound samples */ |
| 747 | ROM_LOAD( "6.ic13", 0x000000, 0x030000, CRC(6e83ffd8) SHA1(618fd6cd6c0844a4be96f77ff22cd41364718d16) ) |
| 748 | ROM_CONTINUE( 0x040000, 0x050000 ) |
| 686 | 749 | ROM_END |
| 687 | 750 | |
| 688 | 751 | |
| r1185 | r1186 | |
| 721 | 784 | ROM_LOAD( "rom3", 0x000000, 0x100000, CRC(7f8f066f) SHA1(5e051d5feb327ac818e9c7f7ac721dada3a102b6) ) |
| 722 | 785 | ROM_END |
| 723 | 786 | |
| 724 | | DRIVER_INIT( sf1gp ) |
| 725 | | { |
| 726 | | // no sound z80 to send sound commands to. |
| 727 | | memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0xfff008, 0xfff009, 0, 0, MWA16_NOP); |
| 728 | | } |
| 729 | 787 | |
| 730 | | |
| 731 | 788 | GAME( 1991, f1gp, 0, f1gp, f1gp, 0, ROT90, "Video System Co.", "F-1 Grand Prix", GAME_NO_COCKTAIL ) |
| 732 | | GAME( 1991, sf1gp, f1gp, sf1gp, f1gp, sf1gp, ROT90, "[Video System Co.] (Playmark bootleg)", "Super Formula II (bootleg of F-1 Grand Prix)", GAME_NOT_WORKING ) // PCB marked 'Super Formula II', manufactured by Playmark. |
| 789 | GAME( 1991, f1gpb, f1gp, f1gpb, f1gp, 0, ROT90, "[Video System Co.] (Playmark bootleg)", "F-1 Grand Prix (Playmark bootleg)", GAME_NOT_WORKING ) // PCB marked 'Super Formula II', manufactured by Playmark. |
| 733 | 790 | |
| 734 | 791 | GAME( 1992, f1gp2, 0, f1gp2, f1gp2, 0, ROT90, "Video System Co.", "F-1 Grand Prix Part II", GAME_NO_COCKTAIL ) |
src/mame/drivers/dominob.c
| r1185 | r1186 | |
| 3 | 3 | |
| 4 | 4 | Driver by Tomasz Slanina |
| 5 | 5 | some bits by David Haywood |
| 6 | Fixed Dip Switches and additional infos by Stephh |
| 6 | 7 | |
| 7 | | based on the Arkanoid driver |
| 8 | Based on the Arkanoid driver |
| 8 | 9 | |
| 9 | 10 | This is a hacked up version of Arkanoid with high colour backgrounds |
| 10 | 11 | and gameplay modifications. It runs on custom Korean hardware. |
| 11 | 12 | |
| 12 | 13 | Button 1 = 'use Domino' - The ball will bounce along the bricks in a |
| 13 | | horizontal line, without coming down |
| 14 | horizontal line without coming down |
| 15 | until a "hole" or a grey or gold brick |
| 14 | 16 | |
| 15 | | Button 2 = 'use Rocked' - Your paddle will jump to the top of the screen |
| 16 | | then back down, destroying everything in its |
| 17 | | path |
| 17 | Button 2 = 'use Rocket' - Your paddle will jump to the top of the screen |
| 18 | then back down, destroying everything in its path |
| 18 | 19 | |
| 20 | Bonus Lives always at 200000, 500000, then every 300000 (no Dip Switch) |
| 21 | |
| 22 | There are 6 stages of 5 rounds. When these 30 levels are completed, |
| 23 | you'll have to complete round 1 of each stage with a smaller bat. |
| 24 | When this stage 7 is completed, the game ends but you can't enter |
| 25 | your initials if you have achieved a high score ! |
| 26 | |
| 27 | It's funny to see that this game, as 'arkanoid', does NOT allow you |
| 28 | to enter "SEX" as initials (which will be replaced by "H !") ;) |
| 29 | |
| 19 | 30 | ***************************************************************************/ |
| 20 | 31 | |
| 21 | 32 | #include "driver.h" |
| r1185 | r1186 | |
| 81 | 92 | } |
| 82 | 93 | } |
| 83 | 94 | |
| 84 | | |
| 85 | | |
| 86 | 95 | { |
| 87 | 96 | int x,y; |
| 88 | 97 | for(y=0;y<32;y++) |
| r1185 | r1186 | |
| 98 | 107 | TRANSPARENCY_PEN,0); |
| 99 | 108 | } |
| 100 | 109 | } |
| 110 | |
| 101 | 111 | draw_sprites(machine, bitmap, cliprect); |
| 102 | 112 | |
| 103 | 113 | return 0; |
| 104 | 114 | } |
| 105 | 115 | |
| 106 | 116 | |
| 107 | | /* Input Ports */ |
| 108 | | INPUT_PORTS_START( dominob ) |
| 109 | | PORT_START_TAG("IN0") |
| 110 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) |
| 111 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) // works, but still gives 1 player game |
| 112 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 ) // only service coin (from arkanoid) works, is it coin1 on this? |
| 113 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_TILT ) |
| 114 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN ) |
| 115 | | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) |
| 116 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) |
| 117 | | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) |
| 118 | | |
| 119 | | PORT_START_TAG("IN1") |
| 120 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 121 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) |
| 122 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL |
| 123 | | PORT_BIT( 0xf8, IP_ACTIVE_HIGH, IPT_UNKNOWN ) |
| 124 | | |
| 125 | | PORT_START_TAG("IN2") /* Spinner Player 1 */ |
| 126 | | PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(30) PORT_KEYDELTA(15) |
| 127 | | |
| 128 | | PORT_START_TAG("IN3") /* Spinner Player 2 */ /* no player 2? */ |
| 129 | | //PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(30) PORT_KEYDELTA(15) PORT_COCKTAIL |
| 130 | | |
| 131 | | PORT_START_TAG("DSW") |
| 132 | | PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) ) |
| 133 | | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) |
| 134 | | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 135 | | PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) |
| 136 | | PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) |
| 137 | | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 138 | | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) |
| 139 | | PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) |
| 140 | | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 141 | | PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) |
| 142 | | PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) |
| 143 | | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 144 | | PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) |
| 145 | | PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) |
| 146 | | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 147 | | PORT_DIPNAME( 0x0060, 0x0040, DEF_STR( Lives ) ) |
| 148 | | PORT_DIPSETTING( 0x0060, "1" ) |
| 149 | | PORT_DIPSETTING( 0x0040, "3" ) |
| 150 | | PORT_DIPSETTING( 0x0020, "5" ) |
| 151 | | PORT_DIPSETTING( 0x0000, "7" ) |
| 152 | | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) |
| 153 | | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) |
| 154 | | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 155 | | INPUT_PORTS_END |
| 156 | | |
| 157 | | |
| 158 | 117 | //UINT8 dominob_paddle_select; |
| 159 | | //UINT8 arkanoid_paddle_value; |
| 118 | //UINT8 dominob_paddle_value; |
| 160 | 119 | |
| 161 | 120 | WRITE8_HANDLER( dominob_d008_w ) |
| 162 | 121 | { |
| 163 | | /* is there a purpose on this? */ |
| 122 | /* is there a purpose on this ? always set to 0x00 (read from 0xc47b in RAM) */ |
| 164 | 123 | } |
| 165 | 124 | |
| 166 | 125 | READ8_HANDLER( dominob_input_2_r ) |
| r1185 | r1186 | |
| 189 | 148 | AM_RANGE(0xfc00, 0xffff) AM_RAM |
| 190 | 149 | ADDRESS_MAP_END |
| 191 | 150 | |
| 192 | | /* I don't know if this has a purpose */ |
| 151 | /* I don't know if this has a purpose - also read in 'arkatayt' but not handled */ |
| 193 | 152 | READ8_HANDLER( dominob_unk_port02_r ) |
| 194 | 153 | { |
| 195 | 154 | return 0xff;//mame_rand(Machine); |
| r1185 | r1186 | |
| 201 | 160 | ADDRESS_MAP_END |
| 202 | 161 | |
| 203 | 162 | |
| 163 | INPUT_PORTS_START( dominob ) |
| 164 | PORT_START_TAG("IN0") |
| 165 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) |
| 166 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) /* works (subs 2 credits), but starts a 1 player game as START1 */ |
| 167 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 ) /* SERVICE1 in 'arkanoid' */ |
| 168 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* TILT in 'arkanoid' */ |
| 169 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* COIN1 in 'arkanoid' */ |
| 170 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* COIN2 in 'arkanoid' */ |
| 171 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL ) |
| 172 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) |
| 204 | 173 | |
| 174 | PORT_START_TAG("IN1") |
| 175 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) /* also works in "demo mode" ! */ |
| 176 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) /* also works in "demo mode" ! */ |
| 177 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* player 2 BUTTON1 in 'arkanoid' - only read to select the girl */ |
| 178 | PORT_BIT( 0xf8, IP_ACTIVE_HIGH, IPT_UNKNOWN ) |
| 179 | |
| 180 | PORT_START_TAG("IN2") /* Spinner Player 1 */ |
| 181 | PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(30) PORT_KEYDELTA(15) |
| 182 | |
| 183 | PORT_START_TAG("IN3") /* Spinner Player 2 */ /* No Player 2 */ |
| 184 | // PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(30) PORT_KEYDELTA(15) PORT_COCKTAIL |
| 185 | |
| 186 | PORT_START_TAG("DSW") |
| 187 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Coinage ) ) |
| 188 | PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) ) |
| 189 | PORT_DIPSETTING( 0x01, DEF_STR( 1C_1C ) ) |
| 190 | PORT_DIPNAME( 0x06, 0x06, "Difficulty 1" ) /* code at 0x1a82 - table at 0x1aa4 (4 * 8 bytes) */ |
| 191 | PORT_DIPSETTING( 0x06, DEF_STR( Easy ) ) /* starting speed = 0x02/0x03/0x03/0x03/0x03 - max speed = 0x09 */ |
| 192 | PORT_DIPSETTING( 0x04, DEF_STR( Medium ) ) /* starting speed = 0x03/0x04/0x04/0x04/0x04 - max speed = 0x09 */ |
| 193 | PORT_DIPSETTING( 0x02, DEF_STR( Hard ) ) /* starting speed = 0x03/0x04/0x05/0x05/0x05 - max speed = 0x0b */ |
| 194 | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) /* starting speed = 0x04/0x05/0x06/0x06/0x06 - max speed = 0x0b */ |
| 195 | PORT_DIPNAME( 0x18, 0x18, "Difficulty 2" ) /* code at 0x03b5 - table at 0x040c (4 * 16 bytes) */ |
| 196 | PORT_DIPSETTING( 0x18, DEF_STR( Easy ) ) /* increase speed when 0x30/0x30/0x30/0x40/0x40/0x50/0x50/0x50/0x50/0x80 - when max speed, speed = 0x06 */ |
| 197 | PORT_DIPSETTING( 0x10, DEF_STR( Medium ) ) /* increase speed when 0x30/0x30/0x30/0x30/0x40/0x40/0x40/0x40/0x40/0x90 - when max speed, speed = 0x07 */ |
| 198 | PORT_DIPSETTING( 0x08, DEF_STR( Hard ) ) /* increase speed when 0x30/0x30/0x20/0x20/0x30/0x30/0x30/0x40/0x40/0xa0 - when max speed, speed = 0x08 */ |
| 199 | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) /* increase speed when 0x20/0x20/0x20/0x20/0x20/0x30/0x30/0x30/0x40/0xc0 - when max speed, speed = 0x09 */ |
| 200 | PORT_DIPNAME( 0x60, 0x40, DEF_STR( Lives ) ) |
| 201 | PORT_DIPSETTING( 0x60, "1" ) |
| 202 | PORT_DIPSETTING( 0x40, "3" ) |
| 203 | PORT_DIPSETTING( 0x20, "5" ) |
| 204 | PORT_DIPSETTING( 0x00, "7" ) |
| 205 | PORT_DIPNAME( 0x80, 0x80, "Striptease" ) |
| 206 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 207 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 208 | INPUT_PORTS_END |
| 209 | |
| 210 | |
| 205 | 211 | static const gfx_layout charlayout = |
| 206 | 212 | { |
| 207 | 213 | 8,8, |
src/mame/drivers/peplus.c
| r1185 | r1186 | |
| 13 | 13 | |
| 14 | 14 | Hardware: |
| 15 | 15 | |
| 16 | | CPU = 83c02 ; I8052 compatible |
| 17 | | VIDEO = SY6545 ; CRTC6845 compatible |
| 16 | CPU = INTEL 83c02 ; I8052 compatible |
| 17 | VIDEO = ROCKWELL 6545 ; CRTC6845 compatible |
| 18 | 18 | SND = AY-3-8912 ; AY8910 compatible |
| 19 | 19 | |
| 20 | 20 | History: |
| r1185 | r1186 | |
| 41 | 41 | #include "sound/ay8910.h" |
| 42 | 42 | #include "cpu/i8051/i8051.h" |
| 43 | 43 | |
| 44 | #include "peplus.lh" |
| 45 | #include "pepp0188.lh" |
| 46 | #include "peset038.lh" |
| 47 | |
| 44 | 48 | static tilemap *bg_tilemap; |
| 45 | 49 | |
| 46 | 50 | /* Pointers to External RAM */ |
| 47 | 51 | UINT8 *program_ram; |
| 48 | | UINT8 *settings_ram; |
| 49 | | UINT8 *set038_ram; |
| 52 | UINT8 *cmos_ram; |
| 50 | 53 | |
| 51 | 54 | /* Variables used instead of CRTC6845 system */ |
| 52 | 55 | UINT8 vid_register = 0; |
| r1185 | r1186 | |
| 56 | 59 | /* Holds upper video address and palette number */ |
| 57 | 60 | UINT8 *palette_ram; |
| 58 | 61 | |
| 59 | | UINT8 ramcheck; |
| 62 | /* IO Ports */ |
| 63 | UINT8 *io_port; |
| 64 | |
| 65 | |
| 60 | 66 | /***************** |
| 61 | 67 | * Write Handlers * |
| 62 | 68 | ******************/ |
| r1185 | r1186 | |
| 92 | 98 | } |
| 93 | 99 | |
| 94 | 100 | /* |
| 95 | | SY6545 - Transparent Memory Addressing |
| 101 | ROCKWELL 6545 - Transparent Memory Addressing |
| 96 | 102 | The current CRTC6845 driver does not support these |
| 97 | 103 | additional registers (R18, R19, R31) |
| 98 | 104 | */ |
| 105 | WRITE8_HANDLER( peplus_crtc_mode_w ) |
| 106 | { |
| 107 | /* Mode Control - Register 8 */ |
| 108 | /* Sets CRT to Transparent Memory Addressing Mode */ |
| 109 | } |
| 110 | |
| 99 | 111 | WRITE8_HANDLER( peplus_crtc_register_w ) |
| 100 | 112 | { |
| 101 | 113 | switch(data) { |
| r1185 | r1186 | |
| 123 | 135 | { |
| 124 | 136 | UINT16 vid_address = (vid_high<<8) | vid_low; |
| 125 | 137 | |
| 126 | | /* P1 holds the following: */ |
| 127 | | /* high nibble = palette, low nibble = high address */ |
| 128 | | UINT8 p1 = i8051_get_intram(P1); |
| 129 | | |
| 130 | 138 | videoram[vid_address] = data; |
| 131 | | palette_ram[vid_address] = p1; |
| 139 | palette_ram[vid_address] = io_port[1]; |
| 132 | 140 | |
| 133 | 141 | tilemap_mark_tile_dirty(bg_tilemap, vid_address); |
| 134 | 142 | |
| r1185 | r1186 | |
| 144 | 152 | // EEPROM is a X2404P 4K-bit Serial I2C Bus |
| 145 | 153 | } |
| 146 | 154 | |
| 147 | | WRITE8_HANDLER( peplus_ramcheck_w ) |
| 155 | WRITE8_HANDLER( peplus_io_w ) |
| 148 | 156 | { |
| 149 | | ramcheck = data; |
| 157 | io_port[offset] = data; |
| 150 | 158 | } |
| 151 | 159 | |
| 160 | WRITE8_HANDLER( peplus_duart_w ) |
| 161 | { |
| 162 | // Used for Progressive Jackpot Communication |
| 163 | } |
| 152 | 164 | |
| 165 | WRITE8_HANDLER( peplus_cmos_w ) |
| 166 | { |
| 167 | cmos_ram[offset] = data; |
| 168 | } |
| 169 | |
| 170 | WRITE8_HANDLER( peplus_output_bank_a_w ) |
| 171 | { |
| 172 | output_set_value("coinlockout",(data >> 0) & 1); /* Coin Lockout */ |
| 173 | output_set_value("diverter",(data >> 1) & 1); /* Diverter */ |
| 174 | output_set_value("bell",(data >> 2) & 1); /* Bell */ |
| 175 | output_set_value("na1",(data >> 3) & 1); /* N/A */ |
| 176 | output_set_value("hopper1",(data >> 4) & 1); /* Hopper 1 */ |
| 177 | output_set_value("hopper2",(data >> 5) & 1); /* Hopper 2 */ |
| 178 | output_set_value("na2",(data >> 6) & 1); /* N/A */ |
| 179 | output_set_value("na3",(data >> 7) & 1); /* N/A */ |
| 180 | } |
| 181 | |
| 182 | WRITE8_HANDLER( peplus_output_bank_b_w ) |
| 183 | { |
| 184 | output_set_lamp_value(0,(data >> 0) & 1); /* Hold 2 3 4 Lt */ |
| 185 | output_set_lamp_value(1,(data >> 1) & 1); /* Deal Draw Lt */ |
| 186 | output_set_lamp_value(2,(data >> 2) & 1); /* Cash Out Lt */ |
| 187 | output_set_lamp_value(3,(data >> 3) & 1); /* Hold 1 Lt */ |
| 188 | output_set_lamp_value(4,(data >> 4) & 1); /* Bet Credits Lt */ |
| 189 | output_set_lamp_value(5,(data >> 5) & 1); /* Change Request Lt */ |
| 190 | output_set_lamp_value(6,(data >> 6) & 1); /* Door Open Lt */ |
| 191 | output_set_lamp_value(7,(data >> 7) & 1); /* Hold 5 Lt */ |
| 192 | } |
| 193 | |
| 194 | WRITE8_HANDLER( peplus_output_bank_c_w ) |
| 195 | { |
| 196 | output_set_value("coininmeter",(data >> 0) & 1); /* Coin In Meter */ |
| 197 | output_set_value("coinoutmeter",(data >> 1) & 1); /* Coin Out Meter */ |
| 198 | output_set_value("coindropmeter",(data >> 2) & 1); /* Coin Drop Meter */ |
| 199 | output_set_value("jackpotmeter",(data >> 3) & 1); /* Jackpot Meter */ |
| 200 | output_set_value("billacceptor",(data >> 4) & 1); /* Bill Acceptor Enabled */ |
| 201 | output_set_value("sdsout",(data >> 5) & 1); /* SDS Out */ |
| 202 | output_set_value("na4",(data >> 6) & 1); /* N/A */ |
| 203 | output_set_value("gamemeter",(data >> 7) & 1); /* Game Meter */ |
| 204 | } |
| 205 | |
| 206 | |
| 153 | 207 | /**************** |
| 154 | 208 | * Read Handlers * |
| 155 | 209 | ****************/ |
| 156 | 210 | |
| 211 | READ8_HANDLER( peplus_duart_r ) |
| 212 | { |
| 213 | // Used for Progressive Jackpot Communication |
| 214 | return 0x00; |
| 215 | } |
| 216 | |
| 217 | READ8_HANDLER( peplus_cmos_r ) |
| 218 | { |
| 219 | switch (offset) |
| 220 | { |
| 221 | case 0x0db: |
| 222 | if ((readinputportbytag("DOOR") & 0x01) == 1) { |
| 223 | cmos_ram[offset] = 0x01; |
| 224 | } |
| 225 | case 0xb8d: |
| 226 | if ((readinputportbytag("DOOR") & 0x02) == 1) |
| 227 | cmos_ram[offset] = 0x01; |
| 228 | } |
| 229 | |
| 230 | // Fake A Bunch of Coins In Hack |
| 231 | if ((readinputportbytag("SENSOR") & 0x01) == 1) { |
| 232 | cmos_ram[0x01E] = 0x01; |
| 233 | } |
| 234 | |
| 235 | return cmos_ram[offset]; |
| 236 | } |
| 237 | |
| 157 | 238 | /* External RAM Callback for I8052 */ |
| 158 | 239 | READ32_HANDLER( peplus_external_ram_iaddr ) |
| 159 | 240 | { |
| 160 | | UINT8 p2 = i8051_get_intram(P2); |
| 161 | | |
| 162 | | if (offset < 0x1000) { |
| 163 | | return (p2 << 8) | offset; |
| 241 | if (mem_mask == 0xff) { |
| 242 | return (io_port[2] << 8) | offset; |
| 164 | 243 | } else { |
| 165 | 244 | return offset; |
| 166 | 245 | } |
| r1185 | r1186 | |
| 172 | 251 | return palette_get_color(Machine, 15); /* Return bgcolor from First Palette */ |
| 173 | 252 | } |
| 174 | 253 | |
| 254 | READ8_HANDLER( peplus_dropdoor_r ) |
| 255 | { |
| 256 | return 0x00; /* Drop Door 0x00=Closed 0x02=Open */ |
| 257 | } |
| 175 | 258 | |
| 259 | READ8_HANDLER( peplus_c000_r ) |
| 260 | { |
| 261 | return 0xff; /* Unknown */ |
| 262 | } |
| 263 | |
| 176 | 264 | /* Insufficient Code, will need more to handle cmos and coin pulses */ |
| 177 | 265 | READ8_HANDLER( peplus_input_bank_a_r ) |
| 178 | 266 | { |
| r1185 | r1186 | |
| 186 | 274 | Bit 6 = LOW BATTERY |
| 187 | 275 | Bit 7 = CMOS ACK (0=ACK) |
| 188 | 276 | */ |
| 189 | | return 0x77; |
| 190 | | } |
| 277 | UINT8 tempbank = 0x00; |
| 278 | UINT8 coindetect = 0x00; |
| 279 | if ((readinputportbytag("SENSOR") & 0x01) == 0x01) { |
| 280 | coindetect = 0x07; |
| 281 | } |
| 191 | 282 | |
| 192 | | READ8_HANDLER( peplus_ramcheck_r ) |
| 193 | | { |
| 194 | | if (ramcheck == 0x3e) |
| 195 | | return 0xff; |
| 196 | | else |
| 197 | | return ramcheck; |
| 283 | tempbank = (0x57 | (!(readinputportbytag("DOOR") & 0x01)<<5)) ^ (coindetect); |
| 284 | return tempbank; |
| 198 | 285 | } |
| 199 | 286 | |
| 200 | 287 | |
| 201 | | /************************* |
| 202 | | * Temporary Memory Hacks * |
| 203 | | *************************/ |
| 204 | | |
| 205 | | /* Hack to test coins in */ |
| 206 | | READ8_HANDLER( peplus_coinsin_r ) |
| 207 | | { |
| 208 | | return 0x05; |
| 209 | | } |
| 210 | | |
| 211 | | /* Hack to test credits */ |
| 212 | | READ8_HANDLER( peplus_credits_r ) |
| 213 | | { |
| 214 | | return 0x20; |
| 215 | | } |
| 216 | | |
| 217 | 288 | /**************************** |
| 218 | 289 | * Video/Character functions * |
| 219 | 290 | ****************************/ |
| r1185 | r1186 | |
| 258 | 329 | int bit0, bit1, bit2, r, g, b; |
| 259 | 330 | |
| 260 | 331 | /* red component */ |
| 261 | | bit0 = (color_prom[i] >> 0) & 0x01; |
| 262 | | bit1 = (color_prom[i] >> 1) & 0x01; |
| 263 | | bit2 = (color_prom[i] >> 2) & 0x01; |
| 332 | bit0 = (~color_prom[i] >> 0) & 0x01; |
| 333 | bit1 = (~color_prom[i] >> 1) & 0x01; |
| 334 | bit2 = (~color_prom[i] >> 2) & 0x01; |
| 264 | 335 | r = 0x21 * bit2 + 0x47 * bit1 + 0x97 * bit0; |
| 265 | 336 | |
| 266 | 337 | /* green component */ |
| 267 | | bit0 = (color_prom[i] >> 3) & 0x01; |
| 268 | | bit1 = (color_prom[i] >> 4) & 0x01; |
| 269 | | bit2 = (color_prom[i] >> 5) & 0x01; |
| 338 | bit0 = (~color_prom[i] >> 3) & 0x01; |
| 339 | bit1 = (~color_prom[i] >> 4) & 0x01; |
| 340 | bit2 = (~color_prom[i] >> 5) & 0x01; |
| 270 | 341 | g = 0x21 * bit2 + 0x47 * bit1 + 0x97 * bit0; |
| 271 | 342 | |
| 272 | 343 | /* blue component */ |
| 273 | | bit0 = (color_prom[i] >> 6) & 0x01; |
| 274 | | bit1 = (color_prom[i] >> 7) & 0x01; |
| 344 | bit0 = (~color_prom[i] >> 6) & 0x01; |
| 345 | bit1 = (~color_prom[i] >> 7) & 0x01; |
| 275 | 346 | bit2 = 0; |
| 276 | 347 | b = 0x21 * bit2 + 0x47 * bit1 + 0x97 * bit0; |
| 277 | 348 | |
| 278 | | /* TODO */ |
| 279 | | /* Add code to load last color in each palette with bgcolor */ |
| 280 | | /* Using default in color prom instead for now */ |
| 281 | | |
| 282 | 349 | palette_set_color(machine, i, MAKE_RGB(r, g, b)); |
| 283 | 350 | } |
| 284 | 351 | } |
| r1185 | r1186 | |
| 309 | 376 | GFXDECODE_END |
| 310 | 377 | |
| 311 | 378 | |
| 312 | | /*********************** |
| 313 | | * Sound Interface * |
| 314 | | ***********************/ |
| 315 | | |
| 316 | | static struct AY8910interface ay8910_interface = |
| 317 | | { |
| 318 | | input_port_3_r /* SW1 is accessed via sound portA */ |
| 319 | | }; |
| 320 | | |
| 321 | | |
| 322 | 379 | /************** |
| 323 | 380 | * Driver Init * |
| 324 | 381 | ***************/ |
| r1185 | r1186 | |
| 328 | 385 | /* External RAM callback */ |
| 329 | 386 | i8051_set_eram_iaddr_callback(peplus_external_ram_iaddr); |
| 330 | 387 | |
| 331 | | // Set038 Chip - For testing only, cannot stay in final driver |
| 332 | | //program_ram[0x302] = 0x22; /* disable memory test */ |
| 333 | | //program_ram[0x289f] = 0x22; /* disable program checksum */ |
| 334 | | //set038_ram[0x00] = 0xfe; |
| 388 | // For testing only, cannot stay in final driver |
| 389 | program_ram[0x990e] = 0xd3; /* SETB C - disable game test */ |
| 390 | program_ram[0x990f] = 0x22; /* RET - disable game test */ |
| 335 | 391 | |
| 336 | | // PP0516 - For testing only, cannot stay in final driver |
| 337 | | program_ram[0x9a24] = 0x22; /* disable memory test */ |
| 338 | | program_ram[0xd61d] = 0x22; /* disable program checksum */ |
| 392 | program_ram[0xaf91] = 0x79; /* MOV R1, - disable I2C random read */ |
| 393 | program_ram[0xaf92] = 0x00; /* #000H - disable I2C random read */ |
| 394 | program_ram[0xaf93] = 0x22; /* RET - disable I2C random read */ |
| 339 | 395 | |
| 340 | | /* TODO: Machine settings and coin counts need to be loaded using save state system */ |
| 396 | program_ram[0xd61d] = 0x22; /* RET - disable program checksum */ |
| 397 | |
| 398 | program_ram[0x5e7e] = 0x01; /* Allow Autohold Feature */ |
| 399 | |
| 400 | /* TODO: Machine settings and coin counts need to be loaded using eeprom data */ |
| 341 | 401 | /* below are some hardcoded examples of memory to patch */ |
| 342 | 402 | |
| 343 | | settings_ram[0x030] = 0x05; /* Maximum Coins - 5 */ |
| 344 | | settings_ram[0x06b] = 0x03; /* Current Denomination - 25c */ |
| 345 | | set038_ram[0x2a] = settings_ram[0x06b]; |
| 346 | | settings_ram[0x197] = 0x00; /* Bill Acceptor - Disabled */ |
| 347 | | set038_ram[0x2b] = settings_ram[0x197]; |
| 403 | cmos_ram[0x129] = 0x08; /* Additional Operator Screens Enabled */ |
| 404 | cmos_ram[0x130] = 0x05; /* Maximum Coins In */ |
| 405 | cmos_ram[0x148] = 0xff; /* Maximum Payout Low Byte */ |
| 406 | cmos_ram[0x149] = 0xff; /* Maximum Payout High Byte */ |
| 407 | cmos_ram[0x14a] = 0xff; /* Maximum Cashout Low Byte */ |
| 408 | cmos_ram[0x14b] = 0xff; /* Maximum Cashout High Byte */ |
| 409 | cmos_ram[0x16b] = 0x03; /* Current Denomination = 25c */ |
| 410 | cmos_ram[0x16e] = 0x40; /* Background Color */ |
| 411 | cmos_ram[0x183] = 0x01; /* 0=Tones, 1=Music */ |
| 412 | cmos_ram[0x188] = 0x7d; /* Game Type */ |
| 413 | cmos_ram[0x248] = 0x01; /* SAS Mini System Address */ |
| 414 | cmos_ram[0x284] = 0x55; /* 0=Disabled, 0x55=Drop Door */ |
| 415 | cmos_ram[0x297] = 0x00; /* 0=Disabled, 0xa5=Bill Acceptor */ |
| 416 | cmos_ram[0xb8f] = 0x01; /* 0=No Double Up, 1=Double Up */ |
| 417 | cmos_ram[0xb90] = 0x01; /* 0=No Animation, 1=Animation */ |
| 418 | cmos_ram[0xb91] = 0x00; /* 0=No Paytable, 1=Paytable */ |
| 419 | cmos_ram[0xb93] = 0x01; /* 0=Disabled, 1=Autohold */ |
| 420 | cmos_ram[0xb94] = 0x04; /* 0-9=Deal Speed */ |
| 421 | cmos_ram[0xbd8] = 0xaa; /* Communication Type 0xaa=None, 0x5a=sas, 0xa5=miser */ |
| 422 | |
| 423 | /* Mirrored in cmos scratch area to eeprom */ |
| 424 | cmos_ram[0xe01] = cmos_ram[0x188]; /* Game Type */ |
| 425 | cmos_ram[0xe2a] = cmos_ram[0x16b]; /* Current Denomination */ |
| 426 | cmos_ram[0xe2b] = cmos_ram[0x297]; /* Bill Acceptor */ |
| 427 | cmos_ram[0xe60] = cmos_ram[0x130]; /* Maximum Coins In */ |
| 428 | cmos_ram[0xe64] = cmos_ram[0x16e]; /* Background Color */ |
| 348 | 429 | } |
| 349 | 430 | |
| 431 | static DRIVER_INIT( pepp0188 ) |
| 432 | { |
| 433 | /* External RAM callback */ |
| 434 | i8051_set_eram_iaddr_callback(peplus_external_ram_iaddr); |
| 435 | |
| 436 | // For testing only, cannot stay in final driver |
| 437 | program_ram[0x994b] = 0xd3; /* SETB C - disable game test */ |
| 438 | program_ram[0x994c] = 0x22; /* RET - disable game test */ |
| 439 | |
| 440 | program_ram[0x9b3e] = 0x79; /* MOV R1, - disable I2C random read */ |
| 441 | program_ram[0x9b3f] = 0x00; /* #000H - disable I2C random read */ |
| 442 | program_ram[0x9b40] = 0x22; /* RET - disable I2C random read */ |
| 443 | |
| 444 | program_ram[0xf429] = 0x22; /* RET - disable program checksum */ |
| 445 | |
| 446 | program_ram[0x742f] = 0x01; /* Allow Autohold Feature */ |
| 447 | |
| 448 | /* TODO: Machine settings and coin counts need to be loaded using eeprom data */ |
| 449 | /* below are some hardcoded examples of memory to patch */ |
| 450 | |
| 451 | cmos_ram[0x12d] = 0x08; /* Additional Operator Screens Enabled */ |
| 452 | cmos_ram[0x134] = 0x05; /* Maximum Coins In */ |
| 453 | cmos_ram[0x14c] = 0xff; /* Maximum Payout Low Byte */ |
| 454 | cmos_ram[0x14d] = 0xff; /* Maximum Payout High Byte */ |
| 455 | cmos_ram[0x14e] = 0xff; /* Maximum Cashout Low Byte */ |
| 456 | cmos_ram[0x14f] = 0xff; /* Maximum Cashout High Byte */ |
| 457 | cmos_ram[0x16f] = 0x03; /* Current Denomination = 25c */ |
| 458 | cmos_ram[0x172] = 0x40; /* Background Color */ |
| 459 | cmos_ram[0x187] = 0x01; /* 0=Tones, 1=Music */ |
| 460 | cmos_ram[0x18c] = 0x85; /* Game Type */ |
| 461 | cmos_ram[0x22e] = 0x01; /* SAS Mini System Address */ |
| 462 | cmos_ram[0xb3a] = 0x55; /* 0=Disabled, 0x55=Drop Door */ |
| 463 | cmos_ram[0x289] = 0x00; /* 0=Disabled, 0xa5=Bill Acceptor */ |
| 464 | cmos_ram[0xaf6] = 0x01; /* 0=No Double Up, 1=Double Up */ |
| 465 | cmos_ram[0xaf7] = 0x01; /* 0=No Animation, 1=Animation */ |
| 466 | cmos_ram[0xaf8] = 0x00; /* 0=No Paytable, 1=Paytable */ |
| 467 | cmos_ram[0xafa] = 0x01; /* 0=Disabled, 1=Autohold */ |
| 468 | cmos_ram[0xafb] = 0x04; /* 0-9=Deal Speed */ |
| 469 | cmos_ram[0xb51] = 0xaa; /* Communication Type 0xaa=None, 0x5a=sas, 0xa5=miser */ |
| 470 | cmos_ram[0xbf5] = cmos_ram[0x134]; /* Maximum Coins In */ |
| 471 | |
| 472 | /* Mirrored in cmos scratch area to eeprom */ |
| 473 | cmos_ram[0xe01] = cmos_ram[0x18c]; /* Game Type */ |
| 474 | cmos_ram[0xe2a] = cmos_ram[0x16f]; /* Current Denomination */ |
| 475 | cmos_ram[0xe2b] = cmos_ram[0x289]; /* Bill Acceptor */ |
| 476 | cmos_ram[0xe60] = cmos_ram[0x134]; /* Maximum Coins In */ |
| 477 | cmos_ram[0xe64] = cmos_ram[0x172]; /* Background Color */ |
| 478 | } |
| 479 | |
| 480 | static DRIVER_INIT( peset038 ) |
| 481 | { |
| 482 | /* External RAM callback */ |
| 483 | i8051_set_eram_iaddr_callback(peplus_external_ram_iaddr); |
| 484 | |
| 485 | // For testing only, cannot stay in final driver |
| 486 | program_ram[0x302] = 0x22; /* RET - disable memory test */ |
| 487 | program_ram[0x3b5] = 0x22; /* RET - disable I2C random read */ |
| 488 | program_ram[0x289f] = 0x22; /* RET - disable program checksum */ |
| 489 | |
| 490 | cmos_ram[0xe01] = 0x7d; /* Game Type */ |
| 491 | } |
| 492 | |
| 350 | 493 | /************************* |
| 351 | 494 | * Memory map information * |
| 352 | 495 | *************************/ |
| r1185 | r1186 | |
| 356 | 499 | ADDRESS_MAP_END |
| 357 | 500 | |
| 358 | 501 | static ADDRESS_MAP_START( peplus_datamap, ADDRESS_SPACE_DATA, 8 ) |
| 502 | // Battery-backed RAM |
| 503 | AM_RANGE(0x0000, 0x0fff) AM_RAM AM_READWRITE(peplus_cmos_r, peplus_cmos_w) AM_BASE(&cmos_ram) |
| 504 | |
| 505 | // CRT Controller |
| 506 | AM_RANGE(0x2008, 0x2008) AM_WRITE(peplus_crtc_mode_w) |
| 359 | 507 | AM_RANGE(0x2080, 0x2080) AM_WRITE(peplus_crtc_register_w) |
| 360 | 508 | AM_RANGE(0x2081, 0x2081) AM_WRITE(peplus_crtc_address_w) |
| 361 | 509 | AM_RANGE(0x2083, 0x2083) AM_WRITE(peplus_crtc_display_w) |
| 362 | | AM_RANGE(0x20db, 0x20db) AM_READ(input_port_1_r) /* upper door */ |
| 363 | | AM_RANGE(0x2100, 0x21ff) AM_RAM AM_BASE(&settings_ram) |
| 364 | | AM_RANGE(0x2b8d, 0x2b8d) AM_READ(input_port_2_r) /* lower door */ |
| 365 | | //AM_RANGE(0x2b9b, 0x2b9b) AM_READ(peplus_coinsin_r) /* hack to test coins in */ |
| 366 | | //AM_RANGE(0x2b9d, 0x2b9d) AM_READ(peplus_credits_r) /* hack to test credits */ |
| 367 | | AM_RANGE(0x2e01, 0x2eff) AM_RAM AM_BASE(&set038_ram) |
| 510 | |
| 511 | // Sound and Dipswitches |
| 368 | 512 | AM_RANGE(0x4000, 0x4000) AM_WRITE(AY8910_control_port_0_w) |
| 369 | | AM_RANGE(0x4004, 0x4004) AM_WRITE(AY8910_write_port_0_w) |
| 370 | | //AM_RANGE(0x4175, 0x4175) AM_READ(peplus_ramcheck_r) AM_WRITE(peplus_ramcheck_w) |
| 513 | AM_RANGE(0x4004, 0x4004) AM_READ(input_port_3_r) AM_WRITE(AY8910_write_port_0_w) |
| 371 | 514 | |
| 515 | // Background Color Latch |
| 372 | 516 | AM_RANGE(0x6000, 0x6000) AM_READ(peplus_bgcolor_r) AM_WRITE(peplus_bgcolor_w) |
| 517 | |
| 518 | // Video RAM |
| 373 | 519 | AM_RANGE(0x7000, 0x73ff) AM_RAM AM_BASE(&videoram) |
| 374 | | AM_RANGE(0x8000, 0x8000) AM_READ(peplus_input_bank_a_r) |
| 375 | | AM_RANGE(0x9000, 0x9000) AM_WRITE(peplus_eeprom_w) |
| 376 | | AM_RANGE(0xa000, 0xa000) AM_READ(input_port_0_r) |
| 377 | | AM_RANGE(0x0000, 0xffff) AM_RAM |
| 520 | |
| 521 | // Input Bank A, Output Bank C |
| 522 | AM_RANGE(0x8000, 0x8000) AM_READ(peplus_input_bank_a_r) AM_WRITE(peplus_output_bank_c_w) |
| 523 | |
| 524 | // Drop Door, I2C EEPROM Writes |
| 525 | AM_RANGE(0x9000, 0x9000) AM_READ(peplus_dropdoor_r) AM_WRITE(peplus_eeprom_w) |
| 526 | |
| 527 | // Input Banks B & C, Output Bank B |
| 528 | AM_RANGE(0xa000, 0xa000) AM_READ(input_port_0_r) AM_WRITE(peplus_output_bank_b_w) |
| 529 | |
| 530 | // Output Bank A |
| 531 | AM_RANGE(0xc000, 0xc000) AM_READ(peplus_c000_r) AM_WRITE(peplus_output_bank_a_w) |
| 532 | |
| 533 | // DUART |
| 534 | AM_RANGE(0xe000, 0xe005) AM_READWRITE(peplus_duart_r, peplus_duart_w) |
| 378 | 535 | ADDRESS_MAP_END |
| 379 | 536 | |
| 537 | static ADDRESS_MAP_START( peplus_iomap, ADDRESS_SPACE_IO, 8 ) |
| 538 | ADDRESS_MAP_FLAGS(AMEF_ABITS(8)) |
| 539 | |
| 540 | // I/O Ports |
| 541 | AM_RANGE(0x00, 0x03) AM_WRITE(peplus_io_w) AM_BASE(&io_port) |
| 542 | ADDRESS_MAP_END |
| 543 | |
| 380 | 544 | /************************* |
| 381 | 545 | * Input ports * |
| 382 | 546 | *************************/ |
| r1185 | r1186 | |
| 400 | 564 | PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_BUTTON15 ) PORT_NAME("Bill Acceptor") PORT_CODE(KEYCODE_U) |
| 401 | 565 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 402 | 566 | |
| 403 | | PORT_START_TAG("IN1") |
| 567 | PORT_START_TAG("DOOR") |
| 404 | 568 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Upper Door") PORT_CODE(KEYCODE_O) |
| 569 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Lower Door") PORT_CODE(KEYCODE_I) |
| 405 | 570 | |
| 406 | | PORT_START_TAG("IN2") |
| 407 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Lower Door") PORT_CODE(KEYCODE_I) |
| 571 | PORT_START_TAG("SENSOR") |
| 572 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Coin In") PORT_CODE(KEYCODE_M) |
| 408 | 573 | |
| 409 | 574 | PORT_START_TAG("SW1") |
| 410 | | PORT_DIPNAME( 0x01, 0x01, "0-60HZ, 1-50HZ" ) |
| 411 | | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 575 | PORT_DIPNAME( 0x01, 0x01, "Line Frequency" ) |
| 576 | PORT_DIPSETTING( 0x01, "60HZ" ) |
| 577 | PORT_DIPSETTING( 0x00, "50HZ" ) |
| 578 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) |
| 579 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 412 | 580 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 581 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) |
| 582 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 583 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 584 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) |
| 585 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 586 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 587 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) |
| 588 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 589 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 590 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) |
| 591 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 592 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 593 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) |
| 594 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 595 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 596 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) |
| 597 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 598 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 599 | INPUT_PORTS_END |
| 600 | |
| 601 | INPUT_PORTS_START( pepp0188 ) |
| 602 | PORT_START_TAG("IN0") |
| 603 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Jackpot Reset") PORT_CODE(KEYCODE_L) |
| 604 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Self Test") PORT_CODE(KEYCODE_K) |
| 605 | PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Hold 1") PORT_CODE(KEYCODE_Z) |
| 606 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Hold 2") PORT_CODE(KEYCODE_X) |
| 607 | PORT_BIT( 0x05, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Hold 3") PORT_CODE(KEYCODE_C) |
| 608 | PORT_BIT( 0x06, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Hold 4") PORT_CODE(KEYCODE_V) |
| 609 | PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Hold 5") PORT_CODE(KEYCODE_B) |
| 610 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 611 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Deal-Spin-Start") PORT_CODE(KEYCODE_Q) |
| 612 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_NAME("Max Bet") PORT_CODE(KEYCODE_W) |
| 613 | PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_UNKNOWN ) |
| 614 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON12 ) PORT_NAME("Play Credit") PORT_CODE(KEYCODE_R) |
| 615 | PORT_BIT( 0x50, IP_ACTIVE_HIGH, IPT_BUTTON13 ) PORT_NAME("Cashout") PORT_CODE(KEYCODE_T) |
| 616 | PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_BUTTON14 ) PORT_NAME("Change Request") PORT_CODE(KEYCODE_Y) |
| 617 | PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_BUTTON15 ) PORT_NAME("Bill Acceptor") PORT_CODE(KEYCODE_U) |
| 618 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 619 | |
| 620 | PORT_START_TAG("DOOR") |
| 621 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Upper Door") PORT_CODE(KEYCODE_O) |
| 622 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Lower Door") PORT_CODE(KEYCODE_I) |
| 623 | |
| 624 | PORT_START_TAG("SENSOR") |
| 625 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Coin In") PORT_CODE(KEYCODE_M) |
| 626 | |
| 627 | PORT_START_TAG("SW1") |
| 628 | PORT_DIPNAME( 0x01, 0x01, "Line Frequency" ) |
| 629 | PORT_DIPSETTING( 0x01, "60HZ" ) |
| 630 | PORT_DIPSETTING( 0x00, "50HZ" ) |
| 413 | 631 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) |
| 414 | 632 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 415 | 633 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| r1185 | r1186 | |
| 433 | 651 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 434 | 652 | INPUT_PORTS_END |
| 435 | 653 | |
| 654 | INPUT_PORTS_START( peset038 ) |
| 655 | PORT_START_TAG("IN0") |
| 656 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Jackpot Reset") PORT_CODE(KEYCODE_L) |
| 657 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Self Test") PORT_CODE(KEYCODE_K) |
| 658 | PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Hold 1") PORT_CODE(KEYCODE_Z) |
| 659 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Hold 2") PORT_CODE(KEYCODE_X) |
| 660 | PORT_BIT( 0x05, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Hold 3") PORT_CODE(KEYCODE_C) |
| 661 | PORT_BIT( 0x06, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Hold 4") PORT_CODE(KEYCODE_V) |
| 662 | PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Hold 5") PORT_CODE(KEYCODE_B) |
| 663 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 664 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON9 ) PORT_NAME("Deal-Spin-Start") PORT_CODE(KEYCODE_Q) |
| 665 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON10 ) PORT_NAME("Max Bet") PORT_CODE(KEYCODE_W) |
| 666 | PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_UNKNOWN ) |
| 667 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON12 ) PORT_NAME("Play Credit") PORT_CODE(KEYCODE_R) |
| 668 | PORT_BIT( 0x50, IP_ACTIVE_HIGH, IPT_BUTTON13 ) PORT_NAME("Cashout") PORT_CODE(KEYCODE_T) |
| 669 | PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_BUTTON14 ) PORT_NAME("Change Request") PORT_CODE(KEYCODE_Y) |
| 670 | PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_BUTTON15 ) PORT_NAME("Bill Acceptor") PORT_CODE(KEYCODE_U) |
| 671 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 436 | 672 | |
| 673 | PORT_START_TAG("DOOR") |
| 674 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Upper Door") PORT_CODE(KEYCODE_O) |
| 675 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Lower Door") PORT_CODE(KEYCODE_I) |
| 676 | |
| 677 | PORT_START_TAG("SENSOR") |
| 678 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Coin In") PORT_CODE(KEYCODE_M) |
| 679 | |
| 680 | PORT_START_TAG("SW1") |
| 681 | PORT_DIPNAME( 0x01, 0x01, "Line Frequency" ) |
| 682 | PORT_DIPSETTING( 0x01, "60HZ" ) |
| 683 | PORT_DIPSETTING( 0x00, "50HZ" ) |
| 684 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) |
| 685 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 686 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 687 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) |
| 688 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 689 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 690 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) |
| 691 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 692 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 693 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) |
| 694 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 695 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 696 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) |
| 697 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 698 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 699 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) |
| 700 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 701 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 702 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) |
| 703 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 704 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 705 | INPUT_PORTS_END |
| 706 | |
| 707 | |
| 437 | 708 | /************************* |
| 438 | 709 | * Machine Driver * |
| 439 | 710 | *************************/ |
| 440 | 711 | |
| 441 | 712 | static MACHINE_DRIVER_START( peplus ) |
| 442 | 713 | // basic machine hardware |
| 443 | | MDRV_CPU_ADD(I8052, 3686400*2) |
| 714 | MDRV_CPU_ADD_TAG("main", I8052, 3686400*2) |
| 444 | 715 | MDRV_CPU_PROGRAM_MAP(peplus_map, 0) |
| 445 | 716 | MDRV_CPU_DATA_MAP(peplus_datamap, 0) |
| 717 | MDRV_CPU_IO_MAP(peplus_iomap, 0) |
| 446 | 718 | MDRV_CPU_VBLANK_INT(irq0_line_hold, 1) |
| 447 | 719 | |
| 448 | 720 | MDRV_SCREEN_REFRESH_RATE(60) |
| r1185 | r1186 | |
| 464 | 736 | // sound hardware |
| 465 | 737 | MDRV_SOUND_ADD(AY8912, 20000000/12) |
| 466 | 738 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 467 | | MDRV_SOUND_CONFIG(ay8910_interface) |
| 468 | 739 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) |
| 469 | 740 | MACHINE_DRIVER_END |
| 470 | 741 | |
| 742 | static MACHINE_DRIVER_START( pepp0188 ) |
| 743 | MDRV_IMPORT_FROM(peplus) |
| 744 | MACHINE_DRIVER_END |
| 471 | 745 | |
| 746 | static MACHINE_DRIVER_START( peset038 ) |
| 747 | MDRV_IMPORT_FROM(peplus) |
| 748 | MACHINE_DRIVER_END |
| 749 | |
| 750 | |
| 472 | 751 | /************************* |
| 473 | 752 | * Rom Load * |
| 474 | 753 | *************************/ |
| r1185 | r1186 | |
| 484 | 763 | ROM_LOAD( "mxo-cg740.u75", 0x18000, 0x8000, CRC(ce4cbe0b) SHA1(4bafcd68be94a5deaae9661584fa0fc940b834bb) ) |
| 485 | 764 | |
| 486 | 765 | ROM_REGION( 0x100, REGION_PROMS, 0 ) |
| 487 | | ROM_LOAD( "cap740.u50", 0x0000, 0x0100, CRC(9cd834bd) SHA1(ad66099d8ed8f784fb20b97df7c9dda51b19ff3f) ) |
| 766 | ROM_LOAD( "cap740.u50", 0x0000, 0x0100, CRC(6fe619c4) SHA1(49e43dafd010ce0fe9b2a63b96a4ddedcb933c6d) ) |
| 488 | 767 | ROM_END |
| 489 | 768 | |
| 769 | ROM_START( pepp0188 ) |
| 770 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) |
| 771 | ROM_LOAD( "pp0188.u68", 0x00000, 0x10000, CRC(cf36a53c) SHA1(99b578538ab24d9ff91971b1f77599272d1dbfc6) ) |
| 490 | 772 | |
| 773 | ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 774 | ROM_LOAD( "mro-cg740.u72", 0x00000, 0x8000, CRC(72667f6c) SHA1(89843f472cc0329317cfc643c63bdfd11234b194) ) |
| 775 | ROM_LOAD( "mgo-cg740.u73", 0x08000, 0x8000, CRC(7437254a) SHA1(bba166dece8af58da217796f81117d0b05752b87) ) |
| 776 | ROM_LOAD( "mbo-cg740.u74", 0x10000, 0x8000, CRC(92e8c33e) SHA1(05344664d6fdd3f4205c50fa4ca76fc46c18cf8f) ) |
| 777 | ROM_LOAD( "mxo-cg740.u75", 0x18000, 0x8000, CRC(ce4cbe0b) SHA1(4bafcd68be94a5deaae9661584fa0fc940b834bb) ) |
| 778 | |
| 779 | ROM_REGION( 0x100, REGION_PROMS, 0 ) |
| 780 | ROM_LOAD( "cap740.u50", 0x0000, 0x0100, CRC(6fe619c4) SHA1(49e43dafd010ce0fe9b2a63b96a4ddedcb933c6d) ) |
| 781 | ROM_END |
| 782 | |
| 783 | ROM_START( peset038 ) |
| 784 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) |
| 785 | ROM_LOAD( "set038.u68", 0x00000, 0x10000, CRC(9c4b1d1a) SHA1(8a65cd1d8e2d74c7b66f4dfc73e7afca8458e979) ) |
| 786 | |
| 787 | ROM_REGION( 0x100000, REGION_GFX1, ROMREGION_DISPOSE ) |
| 788 | ROM_LOAD( "mro-cg740.u72", 0x00000, 0x8000, CRC(72667f6c) SHA1(89843f472cc0329317cfc643c63bdfd11234b194) ) |
| 789 | ROM_LOAD( "mgo-cg740.u73", 0x08000, 0x8000, CRC(7437254a) SHA1(bba166dece8af58da217796f81117d0b05752b87) ) |
| 790 | ROM_LOAD( "mbo-cg740.u74", 0x10000, 0x8000, CRC(92e8c33e) SHA1(05344664d6fdd3f4205c50fa4ca76fc46c18cf8f) ) |
| 791 | ROM_LOAD( "mxo-cg740.u75", 0x18000, 0x8000, CRC(ce4cbe0b) SHA1(4bafcd68be94a5deaae9661584fa0fc940b834bb) ) |
| 792 | |
| 793 | ROM_REGION( 0x100, REGION_PROMS, 0 ) |
| 794 | ROM_LOAD( "cap740.u50", 0x0000, 0x0100, CRC(6fe619c4) SHA1(49e43dafd010ce0fe9b2a63b96a4ddedcb933c6d) ) |
| 795 | ROM_END |
| 796 | |
| 797 | |
| 491 | 798 | /************************* |
| 492 | 799 | * Game Drivers * |
| 493 | 800 | *************************/ |
| 494 | 801 | |
| 495 | 802 | /* YEAR NAME PARENT MACHINE INPUT INIT ROT COMPANY FULLNAME FLAGS */ |
| 496 | 803 | GAME( 1987, peplus, 0, peplus, peplus, peplus, ROT0, "IGT - International Gaming Technology", "Player's Edge Plus (PP0516) Double Bonus Poker", 0 ) |
| 804 | GAME( 1987, pepp0188, 0, pepp0188, pepp0188, pepp0188, ROT0, "IGT - International Gaming Technology", "Player's Edge Plus (PP0188) Standard Draw Poker", 0 ) |
| 805 | GAME( 1987, peset038, 0, peset038, peset038, peset038, ROT0, "IGT - International Gaming Technology", "Player's Edge Plus (Set038) Set Chip", 0 ) |
src/mame/drivers/tubep.c
| r1185 | r1186 | |
| 104 | 104 | |
| 105 | 105 | #include "driver.h" |
| 106 | 106 | #include "cpu/z80/z80.h" |
| 107 | #include "cpu/m6805/m6805.h" |
| 107 | 108 | #include "sound/ay8910.h" |
| 108 | 109 | #include "sound/msm5205.h" |
| 109 | | |
| 110 | 110 | #include "tubep.h" |
| 111 | 111 | |
| 112 | 112 | /* Global variables */ |
| r1185 | r1186 | |
| 116 | 116 | |
| 117 | 117 | static mame_timer *interrupt_timer; |
| 118 | 118 | |
| 119 | | /*************************** Main CPU on main PCB **************************/ |
| 120 | 119 | |
| 120 | /************************************* |
| 121 | * |
| 122 | * Main CPU on main PCB |
| 123 | * |
| 124 | *************************************/ |
| 121 | 125 | |
| 126 | |
| 122 | 127 | static WRITE8_HANDLER( tubep_LS259_w ) |
| 123 | 128 | { |
| 124 | 129 | switch(offset) |
| r1185 | r1186 | |
| 186 | 191 | ADDRESS_MAP_END |
| 187 | 192 | |
| 188 | 193 | |
| 194 | /************************************* |
| 195 | * |
| 196 | * Slave CPU on main PCB |
| 197 | * |
| 198 | *************************************/ |
| 189 | 199 | |
| 190 | 200 | |
| 191 | | /************************** Slave CPU on main PCB ****************************/ |
| 192 | | |
| 193 | 201 | static ADDRESS_MAP_START( tubep_g_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 194 | 202 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 195 | 203 | AM_RANGE(0xa000, 0xa000) AM_WRITE(tubep_background_a000_w) |
| r1185 | r1186 | |
| 243 | 251 | AM_RANGE(0x07, 0x07) AM_WRITE(tubep_sound_unknown) |
| 244 | 252 | ADDRESS_MAP_END |
| 245 | 253 | |
| 254 | |
| 255 | /************************************* |
| 256 | * |
| 257 | * Save state setup |
| 258 | * |
| 259 | *************************************/ |
| 260 | |
| 261 | |
| 246 | 262 | static TIMER_CALLBACK( scanline_callback ) |
| 247 | 263 | { |
| 248 | 264 | int scanline = param; |
| r1185 | r1186 | |
| 281 | 297 | mame_timer_adjust(interrupt_timer, video_screen_get_time_until_pos(0, 64, 0), 64, time_zero); |
| 282 | 298 | } |
| 283 | 299 | |
| 284 | | |
| 285 | 300 | static MACHINE_START( rjammer ) |
| 286 | 301 | { |
| 287 | 302 | tubep_setup_save_state(); |
| 288 | 303 | } |
| 289 | 304 | |
| 290 | | /****************************************************************/ |
| 305 | static MACHINE_RESET( rjammer ) |
| 306 | {} |
| 291 | 307 | |
| 308 | |
| 309 | /************************************* |
| 310 | * |
| 311 | * Roller Jammer memory handlers |
| 312 | * |
| 313 | *************************************/ |
| 314 | |
| 315 | |
| 292 | 316 | static WRITE8_HANDLER( rjammer_LS259_w ) |
| 293 | 317 | { |
| 294 | 318 | switch(offset) |
| r1185 | r1186 | |
| 334 | 358 | ADDRESS_MAP_END |
| 335 | 359 | |
| 336 | 360 | |
| 337 | | |
| 338 | 361 | static ADDRESS_MAP_START( rjammer_slave_portmap, ADDRESS_SPACE_IO, 8 ) |
| 339 | 362 | ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) |
| 340 | 363 | AM_RANGE(0xb0, 0xb0) AM_WRITE(rjammer_background_page_w) |
| 341 | 364 | AM_RANGE(0xd0, 0xd0) AM_WRITE(rjammer_background_LS377_w) |
| 342 | 365 | ADDRESS_MAP_END |
| 343 | 366 | |
| 367 | |
| 344 | 368 | static ADDRESS_MAP_START( rjammer_slave_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 345 | 369 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 346 | 370 | AM_RANGE(0xa000, 0xa7ff) AM_RAM /* M5M5117P @21G */ |
| r1185 | r1186 | |
| 350 | 374 | ADDRESS_MAP_END |
| 351 | 375 | |
| 352 | 376 | |
| 377 | /************************************* |
| 378 | * |
| 379 | * NSC8105 memory handlers |
| 380 | * |
| 381 | *************************************/ |
| 382 | |
| 383 | |
| 353 | 384 | /* MS2010-A CPU (equivalent to NSC8105 with one new opcode: 0xec) on graphics PCB */ |
| 354 | 385 | static ADDRESS_MAP_START( nsc_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 355 | 386 | AM_RANGE(0x0000, 0x03ff) AM_RAM AM_SHARE(3) AM_BASE(&tubep_sprite_colorsharedram) |
| r1185 | r1186 | |
| 360 | 391 | ADDRESS_MAP_END |
| 361 | 392 | |
| 362 | 393 | |
| 394 | /************************************* |
| 395 | * |
| 396 | * Sound CPU |
| 397 | * |
| 398 | *************************************/ |
| 363 | 399 | |
| 364 | 400 | |
| 365 | | |
| 366 | | /****************************** Sound CPU *******************************/ |
| 367 | | |
| 368 | | |
| 369 | | |
| 370 | | |
| 371 | 401 | static READ8_HANDLER( rjammer_soundlatch_r ) |
| 372 | 402 | { |
| 373 | 403 | int res = sound_latch; |
| r1185 | r1186 | |
| 480 | 510 | } |
| 481 | 511 | |
| 482 | 512 | |
| 513 | /************************************* |
| 514 | * |
| 515 | * Game-specific port definitions |
| 516 | * |
| 517 | *************************************/ |
| 483 | 518 | |
| 519 | |
| 484 | 520 | INPUT_PORTS_START( tubep ) |
| 485 | | PORT_START /* Player 1 controls */ |
| 521 | PORT_START_TAG("P1") |
| 486 | 522 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY |
| 487 | 523 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY |
| 488 | 524 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY |
| r1185 | r1186 | |
| 492 | 528 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 493 | 529 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 494 | 530 | |
| 495 | | PORT_START /* Player 2 controls */ |
| 531 | PORT_START_TAG("P2") |
| 496 | 532 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL |
| 497 | 533 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL |
| 498 | 534 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL |
| r1185 | r1186 | |
| 502 | 538 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 503 | 539 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 504 | 540 | |
| 505 | | PORT_START /* Coin, Start */ |
| 541 | PORT_START_TAG("Coin_Start") |
| 506 | 542 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 507 | 543 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 508 | 544 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) |
| r1185 | r1186 | |
| 512 | 548 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 513 | 549 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 514 | 550 | |
| 515 | | PORT_START /* DSW1 */ |
| 516 | | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) |
| 551 | PORT_START_TAG("DSW1") |
| 552 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:6,5,4") |
| 517 | 553 | PORT_DIPSETTING( 0x07, DEF_STR( 1C_1C ) ) |
| 518 | 554 | PORT_DIPSETTING( 0x06, DEF_STR( 1C_2C ) ) |
| 519 | 555 | PORT_DIPSETTING( 0x05, DEF_STR( 1C_3C ) ) |
| r1185 | r1186 | |
| 522 | 558 | PORT_DIPSETTING( 0x02, DEF_STR( 1C_6C ) ) |
| 523 | 559 | PORT_DIPSETTING( 0x01, DEF_STR( 1C_7C ) ) |
| 524 | 560 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_8C ) ) |
| 525 | | PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_B ) ) |
| 561 | PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:3,2,1") |
| 526 | 562 | PORT_DIPSETTING( 0x00, DEF_STR( 8C_1C ) ) |
| 527 | 563 | PORT_DIPSETTING( 0x08, DEF_STR( 7C_1C ) ) |
| 528 | 564 | PORT_DIPSETTING( 0x10, DEF_STR( 6C_1C ) ) |
| r1185 | r1186 | |
| 531 | 567 | PORT_DIPSETTING( 0x28, DEF_STR( 3C_1C ) ) |
| 532 | 568 | PORT_DIPSETTING( 0x30, DEF_STR( 2C_1C ) ) |
| 533 | 569 | PORT_DIPSETTING( 0x38, DEF_STR( 1C_1C ) ) |
| 534 | | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) |
| 535 | | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 536 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 537 | | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) |
| 538 | | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 539 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 570 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 571 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 540 | 572 | |
| 541 | | PORT_START /* DSW2 */ |
| 542 | | PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) ) |
| 573 | PORT_START_TAG("DSW2") |
| 574 | PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:6,5") |
| 543 | 575 | PORT_DIPSETTING( 0x03, "2" ) |
| 544 | 576 | PORT_DIPSETTING( 0x02, "3" ) |
| 545 | 577 | PORT_DIPSETTING( 0x01, "4" ) |
| 546 | 578 | PORT_DIPSETTING( 0x00, "5" ) |
| 547 | | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) |
| 579 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:4,3") |
| 548 | 580 | PORT_DIPSETTING( 0x0c, "40000" ) |
| 549 | 581 | PORT_DIPSETTING( 0x08, "50000" ) |
| 550 | 582 | PORT_DIPSETTING( 0x04, "60000" ) |
| 551 | 583 | PORT_DIPSETTING( 0x00, "80000" ) |
| 552 | | PORT_DIPNAME( 0x10, 0x00, DEF_STR( Cabinet ) ) |
| 584 | PORT_DIPNAME( 0x10, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW2:2") |
| 553 | 585 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 554 | 586 | PORT_DIPSETTING( 0x10, DEF_STR( Cocktail ) ) |
| 555 | | PORT_SERVICE( 0x20, IP_ACTIVE_LOW ) |
| 556 | | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) |
| 557 | | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 587 | PORT_DIPNAME( 0x20, 0x20, "Serivce mode" ) PORT_DIPLOCATION("SW2:1") |
| 588 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 558 | 589 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 559 | | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) |
| 560 | | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 561 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 590 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 591 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 562 | 592 | |
| 563 | | PORT_START /* DSW3 */ |
| 564 | | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) |
| 593 | PORT_START_TAG("DSW3") |
| 594 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW3:6") |
| 565 | 595 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 566 | 596 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 567 | | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) |
| 597 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:5") |
| 568 | 598 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 569 | 599 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 570 | | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) |
| 600 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:4") |
| 571 | 601 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 572 | 602 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 573 | | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) |
| 603 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:3") |
| 574 | 604 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 575 | 605 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 576 | | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) |
| 606 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:2") |
| 577 | 607 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 578 | 608 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 579 | | PORT_DIPNAME( 0x20, 0x20, "In Game Sounds" ) |
| 609 | PORT_DIPNAME( 0x20, 0x20, "In Game Sounds" ) PORT_DIPLOCATION("SW3:1") |
| 580 | 610 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 581 | 611 | PORT_DIPSETTING( 0x20, DEF_STR( On ) ) |
| 582 | | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) |
| 583 | | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 584 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 585 | | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) |
| 586 | | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 587 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 612 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 613 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 588 | 614 | INPUT_PORTS_END |
| 589 | 615 | |
| 590 | 616 | |
| 617 | INPUT_PORTS_START( tubepb ) |
| 618 | PORT_INCLUDE(tubep ) |
| 591 | 619 | |
| 620 | PORT_MODIFY("DSW2") |
| 621 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:4,3") |
| 622 | PORT_DIPSETTING( 0x0c, "10000" ) |
| 623 | PORT_DIPSETTING( 0x08, "20000" ) |
| 624 | PORT_DIPSETTING( 0x04, "30000" ) |
| 625 | PORT_DIPSETTING( 0x00, "40000" ) |
| 626 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:2") |
| 627 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 628 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 629 | INPUT_PORTS_END |
| 592 | 630 | |
| 631 | |
| 593 | 632 | INPUT_PORTS_START( rjammer ) |
| 594 | | PORT_START /* Player 1 controls */ |
| 633 | PORT_START_TAG("P1") |
| 595 | 634 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) |
| 596 | 635 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 597 | 636 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY |
| r1185 | r1186 | |
| 601 | 640 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 ) |
| 602 | 641 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) |
| 603 | 642 | |
| 604 | | PORT_START /* Player 2 controls */ |
| 643 | PORT_START_TAG("P2") |
| 605 | 644 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL |
| 606 | 645 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL |
| 607 | 646 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL |
| r1185 | r1186 | |
| 611 | 650 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 ) |
| 612 | 651 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL |
| 613 | 652 | |
| 614 | | PORT_START /* DSW2 */ |
| 615 | | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) |
| 653 | PORT_START_TAG("DSW2") |
| 654 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:6") |
| 616 | 655 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 617 | 656 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 618 | | PORT_DIPNAME( 0x02, 0x02, "Bonus Time" ) |
| 657 | PORT_DIPNAME( 0x02, 0x02, "Bonus Time" ) PORT_DIPLOCATION("SW2:5") |
| 619 | 658 | PORT_DIPSETTING( 0x02, "100" ) |
| 620 | 659 | PORT_DIPSETTING( 0x00, "200" ) |
| 621 | | PORT_DIPNAME( 0x0c, 0x0c, "Clear Men" ) |
| 660 | PORT_DIPNAME( 0x0c, 0x0c, "Clear Men" ) PORT_DIPLOCATION("SW2:4,3") |
| 622 | 661 | PORT_DIPSETTING( 0x0c, "20" ) |
| 623 | 662 | PORT_DIPSETTING( 0x08, "30" ) |
| 624 | 663 | PORT_DIPSETTING( 0x04, "40" ) |
| 625 | 664 | PORT_DIPSETTING( 0x00, "50" ) |
| 626 | | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Difficulty ) ) |
| 665 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:2") |
| 627 | 666 | PORT_DIPSETTING( 0x10, DEF_STR( Easy ) ) |
| 628 | 667 | PORT_DIPSETTING( 0x00, DEF_STR( Hard ) ) |
| 629 | | PORT_DIPNAME( 0x20, 0x20, "Time" ) |
| 668 | PORT_DIPNAME( 0x20, 0x20, "Time" ) PORT_DIPLOCATION("SW2:1") |
| 630 | 669 | PORT_DIPSETTING( 0x20, "40" ) |
| 631 | 670 | PORT_DIPSETTING( 0x00, "50" ) |
| 632 | | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) |
| 633 | | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 634 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 635 | | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) |
| 636 | | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 637 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 671 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 672 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 638 | 673 | |
| 639 | | PORT_START /* DSW1 */ |
| 640 | | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) |
| 674 | PORT_START_TAG("DSW1") |
| 675 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW1:6") |
| 641 | 676 | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 642 | 677 | PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) |
| 643 | | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) |
| 678 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:5") |
| 644 | 679 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 645 | 680 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 646 | | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) ) |
| 681 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:4,3") |
| 647 | 682 | PORT_DIPSETTING( 0x00, DEF_STR( 3C_1C ) ) |
| 648 | 683 | PORT_DIPSETTING( 0x04, DEF_STR( 2C_3C ) ) |
| 649 | 684 | PORT_DIPSETTING( 0x0c, DEF_STR( 1C_3C ) ) |
| 650 | 685 | PORT_DIPSETTING( 0x08, DEF_STR( 1C_6C ) ) |
| 651 | | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) |
| 686 | PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:2,1") |
| 652 | 687 | PORT_DIPSETTING( 0x10, DEF_STR( 2C_1C ) ) |
| 653 | 688 | PORT_DIPSETTING( 0x30, DEF_STR( 1C_1C ) ) |
| 654 | 689 | PORT_DIPSETTING( 0x20, DEF_STR( 1C_2C ) ) |
| 655 | 690 | PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) ) |
| 656 | | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) |
| 657 | | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 658 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 659 | | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) |
| 660 | | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 661 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 691 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 692 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 662 | 693 | |
| 663 | | PORT_START |
| 694 | PORT_START_TAG("Coins_Service") |
| 664 | 695 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 665 | 696 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 666 | 697 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| r1185 | r1186 | |
| 672 | 703 | INPUT_PORTS_END |
| 673 | 704 | |
| 674 | 705 | |
| 706 | /************************************* |
| 707 | * |
| 708 | * Graphics definitions |
| 709 | * |
| 710 | *************************************/ |
| 711 | |
| 712 | |
| 675 | 713 | static const gfx_layout charlayout = |
| 676 | 714 | { |
| 677 | 715 | 8, 8, /* 8*8 characters */ |
| r1185 | r1186 | |
| 690 | 728 | GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0, 16 ) /* 16 color codes */ |
| 691 | 729 | GFXDECODE_END |
| 692 | 730 | |
| 731 | |
| 732 | /************************************* |
| 733 | * |
| 734 | * Sound definitions |
| 735 | * |
| 736 | *************************************/ |
| 737 | |
| 738 | |
| 693 | 739 | static struct AY8910interface ay8910_interface_1 = |
| 694 | 740 | { |
| 695 | 741 | 0, |
| r1185 | r1186 | |
| 721 | 767 | }; |
| 722 | 768 | |
| 723 | 769 | |
| 770 | /************************************* |
| 771 | * |
| 772 | * Machine driver |
| 773 | * |
| 774 | *************************************/ |
| 724 | 775 | |
| 776 | |
| 725 | 777 | static MACHINE_DRIVER_START( tubep ) |
| 726 | 778 | |
| 727 | 779 | /* basic machine hardware */ |
| 728 | | MDRV_CPU_ADD(Z80,16000000 / 4) /* 4 MHz */ |
| 780 | MDRV_CPU_ADD_TAG("main",Z80,16000000 / 4) /* 4 MHz */ |
| 729 | 781 | MDRV_CPU_PROGRAM_MAP(tubep_map,0) |
| 730 | 782 | MDRV_CPU_IO_MAP(tubep_portmap,0) |
| 731 | 783 | MDRV_CPU_VBLANK_INT(irq0_line_hold,1) |
| 732 | 784 | |
| 733 | | MDRV_CPU_ADD(Z80,16000000 / 4) /* 4 MHz */ |
| 785 | MDRV_CPU_ADD_TAG("slave",Z80,16000000 / 4) /* 4 MHz */ |
| 734 | 786 | MDRV_CPU_PROGRAM_MAP(tubep_g_map,0) |
| 735 | 787 | MDRV_CPU_VBLANK_INT(irq0_line_hold,1) |
| 736 | 788 | |
| 737 | | MDRV_CPU_ADD(Z80,19968000 / 8) /* X2 19968000 Hz divided by LS669 (on Qc output) (signal RH0) */ |
| 789 | MDRV_CPU_ADD_TAG("sound",Z80,19968000 / 8) /* X2 19968000 Hz divided by LS669 (on Qc output) (signal RH0) */ |
| 738 | 790 | /* audio CPU */ |
| 739 | 791 | MDRV_CPU_PROGRAM_MAP(tubep_sound_map,0) |
| 740 | 792 | MDRV_CPU_IO_MAP(tubep_sound_portmap,0) |
| 741 | 793 | |
| 742 | | MDRV_CPU_ADD(NSC8105,6000000/4) /* 6 MHz Xtal - divided internally ??? */ |
| 794 | MDRV_CPU_ADD_TAG("nsc",NSC8105,6000000/4) /* 6 MHz Xtal - divided internally ??? */ |
| 743 | 795 | MDRV_CPU_PROGRAM_MAP(nsc_map,0) |
| 744 | 796 | MDRV_CPU_VBLANK_INT(nmi_line_pulse,1) |
| 745 | 797 | |
| r1185 | r1186 | |
| 780 | 832 | MACHINE_DRIVER_END |
| 781 | 833 | |
| 782 | 834 | |
| 835 | static MACHINE_DRIVER_START( tubepb ) |
| 836 | MDRV_IMPORT_FROM( tubep ) |
| 837 | |
| 838 | MDRV_CPU_REMOVE("nsc") |
| 839 | |
| 840 | MDRV_CPU_ADD(M6802,6000000/4) /* ? MHz Xtal */ |
| 841 | MDRV_CPU_PROGRAM_MAP(nsc_map,0) |
| 842 | MDRV_CPU_VBLANK_INT(nmi_line_pulse,1) |
| 843 | MACHINE_DRIVER_END |
| 844 | |
| 845 | |
| 783 | 846 | static MACHINE_DRIVER_START( rjammer ) |
| 847 | MDRV_IMPORT_FROM( tubep ) |
| 784 | 848 | |
| 785 | 849 | /* basic machine hardware */ |
| 786 | | MDRV_CPU_ADD(Z80,16000000 / 4) /* 4 MHz */ |
| 850 | MDRV_CPU_MODIFY("main") |
| 787 | 851 | MDRV_CPU_PROGRAM_MAP(rjammer_map,0) |
| 788 | 852 | MDRV_CPU_IO_MAP(rjammer_portmap,0) |
| 789 | | MDRV_CPU_VBLANK_INT(irq0_line_hold,1) |
| 790 | 853 | |
| 791 | | MDRV_CPU_ADD(Z80,16000000 / 4) /* 4 MHz */ |
| 854 | MDRV_CPU_MODIFY("slave") |
| 792 | 855 | MDRV_CPU_PROGRAM_MAP(rjammer_slave_map,0) |
| 793 | 856 | MDRV_CPU_IO_MAP(rjammer_slave_portmap,0) |
| 794 | | MDRV_CPU_VBLANK_INT(irq0_line_hold,1) |
| 795 | 857 | |
| 796 | | MDRV_CPU_ADD(Z80,19968000 / 8) /* Xtal3 divided by LS669 (on Qc output) (signal RH0) */ |
| 797 | | /* audio CPU */ |
| 858 | MDRV_CPU_MODIFY("sound") /* Xtal3 divided by LS669 (on Qc output) (signal RH0) */ |
| 798 | 859 | MDRV_CPU_PROGRAM_MAP(rjammer_sound_map,0) |
| 799 | 860 | MDRV_CPU_IO_MAP(rjammer_sound_portmap,0) |
| 800 | 861 | |
| 801 | | MDRV_CPU_ADD(NSC8105,6000000/4) /* 6 MHz Xtal - divided internally ??? */ |
| 802 | | MDRV_CPU_PROGRAM_MAP(nsc_map,0) |
| 803 | | MDRV_CPU_VBLANK_INT(nmi_line_pulse,1) |
| 804 | | |
| 805 | | |
| 806 | | MDRV_SCREEN_REFRESH_RATE(60) |
| 807 | | MDRV_INTERLEAVE(100) |
| 808 | | |
| 809 | 862 | MDRV_MACHINE_START(rjammer) |
| 863 | MDRV_MACHINE_RESET(rjammer) |
| 810 | 864 | |
| 811 | 865 | /* video hardware */ |
| 812 | | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| 813 | | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 814 | | MDRV_SCREEN_SIZE(32*8, 32*8) |
| 815 | | MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 816 | 866 | MDRV_GFXDECODE(rjammer) |
| 817 | 867 | MDRV_PALETTE_LENGTH(64) |
| 818 | 868 | MDRV_COLORTABLE_LENGTH(2*16 + 16*2) |
| 819 | 869 | |
| 820 | 870 | MDRV_PALETTE_INIT(rjammer) |
| 821 | | MDRV_VIDEO_START(tubep) |
| 822 | | MDRV_VIDEO_EOF(tubep) |
| 823 | 871 | MDRV_VIDEO_UPDATE(rjammer) |
| 824 | 872 | |
| 825 | 873 | /* sound hardware */ |
| 826 | | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 827 | | |
| 828 | | MDRV_SOUND_ADD(AY8910, 19968000 / 8 / 2) |
| 829 | | MDRV_SOUND_CONFIG(ay8910_interface_1) |
| 830 | | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10) |
| 831 | | |
| 832 | | MDRV_SOUND_ADD(AY8910, 19968000 / 8 / 2) |
| 833 | | MDRV_SOUND_CONFIG(ay8910_interface_2) |
| 834 | | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10) |
| 835 | | |
| 836 | | MDRV_SOUND_ADD(AY8910, 19968000 / 8 / 2) |
| 837 | | MDRV_SOUND_CONFIG(ay8910_interface_3) |
| 838 | | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10) |
| 839 | | |
| 840 | 874 | MDRV_SOUND_ADD(MSM5205, 384000) |
| 841 | 875 | MDRV_SOUND_CONFIG(msm5205_interface) |
| 842 | 876 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 843 | 877 | MACHINE_DRIVER_END |
| 844 | 878 | |
| 845 | 879 | |
| 880 | /************************************* |
| 881 | * |
| 882 | * ROM definition(s) |
| 883 | * |
| 884 | *************************************/ |
| 846 | 885 | |
| 847 | 886 | |
| 848 | 887 | ROM_START( tubep ) |
| r1185 | r1186 | |
| 900 | 939 | ROM_END |
| 901 | 940 | |
| 902 | 941 | |
| 942 | ROM_START( tubepb ) |
| 943 | ROM_REGION( 0x10000,REGION_CPU1, 0 ) /* Z80 (master) cpu code */ |
| 944 | ROM_LOAD( "a15.bin", 0x0000, 0x1000, CRC(806370a8) SHA1(c1915fae15bd766ffbd3c47d65ade51d36117eb8) ) |
| 945 | ROM_LOAD( "a16.bin", 0x1000, 0x1000, CRC(0917fb76) SHA1(1ce2680700d6ce28dfd202f238f1fc6e9c4a2758) ) |
| 946 | ROM_LOAD( "a13.bin", 0x2000, 0x1000, CRC(6e4bb47e) SHA1(092eba1a90f43eb298ee9e4dc0f13d5411a14b4a) ) |
| 947 | ROM_LOAD( "a14.bin", 0x3000, 0x1000, CRC(3df78441) SHA1(8e078d4f674da12034e3bb82878e781253f227f2) ) |
| 948 | ROM_LOAD( "a11.bin", 0x4000, 0x1000, CRC(2b557e49) SHA1(b7b7fdca23b62ebf320d50548d0a09aa904dfe5d) ) |
| 949 | ROM_LOAD( "a12.bin", 0x5000, 0x1000, CRC(d04a548e) SHA1(bdb4aacb636c9fc9c94af67384b455459c26272e) ) |
| 950 | ROM_LOAD( "a9.bin", 0x6000, 0x1000, CRC(a20de3d1) SHA1(84f2417597dbaecace0ce72a1684345fb212fc3a) ) |
| 951 | ROM_LOAD( "a10.bin", 0x7000, 0x1000, CRC(033ba70c) SHA1(de561c5db7cd493aee05e3513e48d52ed95bd510) ) |
| 952 | |
| 953 | ROM_REGION( 0x10000,REGION_CPU2, 0 ) /* Z80 (slave) cpu code */ |
| 954 | ROM_LOAD( "a1.bin", 0x0000, 0x1000, CRC(8a68523d) SHA1(268c659a2312e4d1a29e2064f55dfa07e57f6bca) ) |
| 955 | ROM_LOAD( "a2.bin", 0x1000, 0x1000, CRC(d15a8645) SHA1(9970377ff49ac525f2ef21c36ded8e7447ed700c) ) |
| 956 | ROM_LOAD( "a3.bin", 0x2000, 0x1000, CRC(7acf777c) SHA1(042b051de8fcc1295aca459f762619771438625e) ) |
| 957 | ROM_LOAD( "a4.bin", 0x3000, 0x1000, CRC(8f2bed23) SHA1(fa682172ed7a7a99161a2eaaf2c2e822bbab3f80) ) |
| 958 | ROM_LOAD( "a5.bin", 0x4000, 0x1000, CRC(8ba045f0) SHA1(91196b96592d98cd49474672ad4cc6b8039a9bcf) ) |
| 959 | ROM_LOAD( "a6.bin", 0x5000, 0x1000, CRC(8672ab0f) SHA1(784d74b71ab9613fb8177b39295bff083933a002) ) |
| 960 | ROM_LOAD( "a7.bin", 0x6000, 0x1000, CRC(417dd321) SHA1(aa0faa19eed1397e46a67e8793c5a27991ea9c1b) ) |
| 961 | ROM_LOAD( "a8.bin", 0x7000, 0x1000, CRC(d26ab4c0) SHA1(8d92386e75114494d65df4cfebdbacd09fddb48e) ) |
| 962 | |
| 963 | ROM_REGION( 0x10000,REGION_CPU3, 0 ) /* Z80 (sound) cpu code */ |
| 964 | ROM_LOAD( "15.bin", 0x0000, 0x2000, CRC(78964fcc) SHA1(a2c6119275d6291d82ac11dcffdaf2e8726e935a) ) |
| 965 | ROM_LOAD( "16.bin", 0x2000, 0x2000, CRC(61232e29) SHA1(a9ef0fefb7250392ef51173b69a69c903ff91ee8) ) |
| 966 | |
| 967 | ROM_REGION( 0x10000,REGION_CPU4, 0 ) /* 64k for the custom CPU */ |
| 968 | ROM_LOAD( "5.bin", 0xc000, 0x2000, CRC(9f375b27) SHA1(9666d1b20169d899176fbdf5954df41df06b4b82) ) |
| 969 | ROM_LOAD( "6.bin", 0xe000, 0x2000, CRC(46a273b5) SHA1(ff862c9337b3eeadee5a3d3f0837931a7a71393e) ) |
| 970 | |
| 971 | ROM_REGION( 0xc000, REGION_USER1, 0 ) /* background data */ |
| 972 | ROM_LOAD( "9.bin", 0x0000, 0x2000, CRC(fda355e0) SHA1(3270c65a4ee5d01388727f38691f7fe38f541031) ) |
| 973 | ROM_LOAD( "10.bin", 0x2000, 0x2000, CRC(0ccb23b0) SHA1(71660a3476ed299684e5662058b8c40153d4a168) ) |
| 974 | ROM_LOAD( "11.bin", 0x4000, 0x2000, CRC(f5d118e7) SHA1(a899bef3accef8995c457e8142a0001eed033fae) ) |
| 975 | ROM_LOAD( "12.bin", 0x6000, 0x2000, CRC(01952144) SHA1(d1074c79b51d3e2c152c9f3df6892027fe3a0e00) ) |
| 976 | ROM_LOAD( "13.bin", 0x8000, 0x2000, CRC(4dabea43) SHA1(72b9df9a3665baf34fb1f7301c5b9dd2619ed206) ) |
| 977 | ROM_LOAD( "14.bin", 0xa000, 0x2000, CRC(01952144) SHA1(d1074c79b51d3e2c152c9f3df6892027fe3a0e00) ) |
| 978 | |
| 979 | ROM_REGION( 0x18000,REGION_USER2, 0 ) |
| 980 | ROM_LOAD( "d1.bin", 0x0000, 0x1000, CRC(702348d7) SHA1(717e48d8c3529acb9a216b4e99df1599fb2e6b3b) ) |
| 981 | ROM_LOAD( "d2.bin", 0x1000, 0x1000, CRC(47601e8b) SHA1(4e56fe72644a000648199e92b306365c100cca30) ) |
| 982 | ROM_LOAD( "d3.bin", 0x2000, 0x1000, CRC(caad3ee2) SHA1(a99b8da36bf26a193d92fa807f168e60ed4bdce5) ) |
| 983 | ROM_LOAD( "d4.bin", 0x3000, 0x1000, CRC(ba5d8666) SHA1(83bf9a4a6c4cabed7312f1c09dcf317a69fdf26a) ) |
| 984 | ROM_LOAD( "d5.bin", 0x4000, 0x1000, CRC(cc709b7f) SHA1(6218c4aaac8a1d025d00923e27e026f54eda8987) ) |
| 985 | ROM_LOAD( "d6.bin", 0x5000, 0x1000, CRC(b9be626a) SHA1(94806056d9f16d455d8993795f220827d5b03183) ) |
| 986 | ROM_LOAD( "d7.bin", 0x6000, 0x1000, CRC(934e09d4) SHA1(395a0ca3bdf76ef8f715bfddc514b583be9ed499) ) |
| 987 | ROM_LOAD( "d8.bin", 0x7000, 0x1000, CRC(7e1970a0) SHA1(9e5fb5aa63149348f3da885844eb08d3471ec409) ) |
| 988 | ROM_LOAD( "d15.bin", 0x8000, 0x1000, CRC(f1f15364) SHA1(e5b783acb3fa3e1b67770db8a8a623ad38dc6a73) ) |
| 989 | ROM_LOAD( "d16.bin", 0x9000, 0x1000, CRC(05c52829) SHA1(21cc9334cf393bcc808e9b0999e84a15b94cedcb) ) |
| 990 | ROM_LOAD( "d13.bin", 0xa000, 0x1000, CRC(7c0b9e16) SHA1(2ec6337d06702a542c0dae9eb963d2b8e1736232) ) |
| 991 | ROM_LOAD( "d14.bin", 0xb000, 0x1000, CRC(81b31170) SHA1(cfaf768dd98116df730fb5ee0468ebc78dc42b2e) ) |
| 992 | ROM_LOAD( "d11.bin", 0xc000, 0x1000, CRC(9e07ef70) SHA1(e814c7ed72d94011718e45fba640f8dafc49aa31) ) |
| 993 | ROM_LOAD( "d12.bin", 0xd000, 0x1000, CRC(77e72279) SHA1(594e8018d64fd9862f54de0152723e610163e1b8) ) |
| 994 | ROM_LOAD( "d9.bin", 0xe000, 0x1000, CRC(7a0edea8) SHA1(ca98c35ef2007363ead3d24a8556e24df031308b) ) |
| 995 | ROM_LOAD( "d10.bin", 0xf000, 0x1000, CRC(0c1c2cb1) SHA1(addc9cea5247b25c114b88e3e9e1804305aa53c8) ) |
| 996 | ROM_LOAD( "4.bin", 0x10000, 0x1000, CRC(40a1fe00) SHA1(2e1e12efe8083bf96233016a7712e6e486d968e4) ) /* 2732 eprom is used, but the PCB is prepared for 2764 eproms */ |
| 997 | ROM_RELOAD( 0x11000, 0x1000 ) |
| 998 | ROM_LOAD( "1.bin", 0x12000, 0x1000, CRC(4a7407a2) SHA1(7ca4e03c637a6f1c338ca438a7ab9e4ba537fee0) ) |
| 999 | ROM_LOAD( "2.bin", 0x13000, 0x1000, CRC(f0b26c2e) SHA1(54057c619675bb384035547becd2019974bf23fa) ) |
| 1000 | |
| 1001 | ROM_LOAD( "7.bin", 0x14000, 0x2000, CRC(105cb9e4) SHA1(b9d8ffe35c1f66aa401e5d8e415bf7c016ff53bb) ) |
| 1002 | ROM_LOAD( "8.bin", 0x16000, 0x2000, CRC(27e5e6c1) SHA1(f3896d0006351d165e36bafa4340175077b3d6ba) ) |
| 1003 | |
| 1004 | ROM_REGION( 0x1000, REGION_GFX1, 0 ) |
| 1005 | ROM_LOAD( "3.bin", 0x0000, 0x1000, CRC(657a465d) SHA1(848217c3b736550586e8e9ba7a6e99e884094066) ) /* text characters */ |
| 1006 | |
| 1007 | ROM_REGION( 0x40, REGION_PROMS, 0 ) /* color proms */ |
| 1008 | ROM_LOAD( "prom6331.b", 0x0000, 0x0020, CRC(ac7e582f) SHA1(9d8f9eda7130b49b91d9c63bafa119b2a91eeda0) ) /* text and sprites palette */ |
| 1009 | ROM_LOAD( "prom6331.a", 0x0020, 0x0020, CRC(cd0910d6) SHA1(1e6dae16115d5a03bbaf76c695327a06eb6da602) ) /* color control prom */ |
| 1010 | ROM_END |
| 1011 | |
| 1012 | |
| 903 | 1013 | ROM_START( rjammer ) |
| 904 | 1014 | ROM_REGION( 0x10000,REGION_CPU1, 0 ) /* Z80 (master) cpu code */ |
| 905 | 1015 | ROM_LOAD( "tp-p.1", 0x0000, 0x2000, CRC(93eeed67) SHA1(9ccfc49f42c6b451ff1c541d6487276f4bf9338e) ) |
| r1185 | r1186 | |
| 954 | 1064 | ROM_LOAD( "16a", 0x0020, 0x0020, CRC(90222a71) SHA1(c3fd49c8075b0af451f6d2a142a4c4a2e397ac08) ) /* background palette */ |
| 955 | 1065 | ROM_END |
| 956 | 1066 | |
| 957 | | /* year rom parent machine inp init */ |
| 1067 | |
| 1068 | /************************************* |
| 1069 | * |
| 1070 | * Game driver(s) |
| 1071 | * |
| 1072 | *************************************/ |
| 1073 | |
| 1074 | |
| 1075 | /* year rom parent machine inp init */ |
| 958 | 1076 | GAME( 1984, tubep, 0, tubep, tubep, 0, ROT0, "Nichibutsu + Fujitek", "Tube Panic", GAME_SUPPORTS_SAVE ) |
| 1077 | GAME( 1984, tubepb, tubep, tubepb, tubepb, 0, ROT0, "bootleg", "Tube Panic (bootleg)", GAME_SUPPORTS_SAVE ) |
| 959 | 1078 | GAME( 1984, rjammer, 0, rjammer, rjammer, 0, ROT0, "Nichibutsu + Alice", "Roller Jammer", GAME_SUPPORTS_SAVE ) |
| 960 | 1079 | |
src/mame/drivers/gamecstl.c
| r0 | r1186 | |
| 1 | /* |
| 2 | Cristaltec "Game Cristal" (MAME bootleg) |
| 3 | |
| 4 | Skeleton driver by R. Belmont, based on taitowlf.c by Ville Linde |
| 5 | |
| 6 | Specs: P3-866, SiS 630 graphics card, SiS 7018 sound, Windows 98, DirectX 8.1. |
| 7 | |
| 8 | Input is via a custom COM1 port JAMMA adaptor. |
| 9 | |
| 10 | The custom emulator is a heavily modified version of MAME32. If you extract the |
| 11 | disk image, it's in C:\GH4\GH4.EXE. It's UPX compressed, so unpack it before doing |
| 12 | any forensics. The emulator does run on Windows as new as XP Pro SP2 but you can't |
| 13 | control it due to the lack of the custom input. |
| 14 | */ |
| 15 | |
| 16 | #include "driver.h" |
| 17 | #include "memconv.h" |
| 18 | #include "machine/8237dma.h" |
| 19 | #include "machine/pic8259.h" |
| 20 | #include "machine/pit8253.h" |
| 21 | #include "machine/mc146818.h" |
| 22 | #include "machine/pcshare.h" |
| 23 | #include "machine/pci.h" |
| 24 | #include "machine/8042kbdc.h" |
| 25 | #include "machine/pckeybrd.h" |
| 26 | #include "machine/idectrl.h" |
| 27 | #include "cpu/i386/i386.h" |
| 28 | |
| 29 | static UINT32 *cga_ram; |
| 30 | static UINT32 *bios_ram; |
| 31 | |
| 32 | static const rgb_t cga_palette[16] = |
| 33 | { |
| 34 | MAKE_RGB( 0x00, 0x00, 0x00 ), MAKE_RGB( 0x00, 0x00, 0xaa ), MAKE_RGB( 0x00, 0xaa, 0x00 ), MAKE_RGB( 0x00, 0xaa, 0xaa ), |
| 35 | MAKE_RGB( 0xaa, 0x00, 0x00 ), MAKE_RGB( 0xaa, 0x00, 0xaa ), MAKE_RGB( 0xaa, 0x55, 0x00 ), MAKE_RGB( 0xaa, 0xaa, 0xaa ), |
| 36 | MAKE_RGB( 0x55, 0x55, 0x55 ), MAKE_RGB( 0x55, 0x55, 0xff ), MAKE_RGB( 0x55, 0xff, 0x55 ), MAKE_RGB( 0x55, 0xff, 0xff ), |
| 37 | MAKE_RGB( 0xff, 0x55, 0x55 ), MAKE_RGB( 0xff, 0x55, 0xff ), MAKE_RGB( 0xff, 0xff, 0x55 ), MAKE_RGB( 0xff, 0xff, 0xff ), |
| 38 | }; |
| 39 | |
| 40 | static VIDEO_START(gamecstl) |
| 41 | { |
| 42 | int i; |
| 43 | for (i=0; i < 16; i++) |
| 44 | { |
| 45 | palette_set_color(machine, i, cga_palette[i]); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | static void draw_char(mame_bitmap *bitmap, const rectangle *cliprect, const gfx_element *gfx, int ch, int att, int x, int y) |
| 50 | { |
| 51 | int i,j; |
| 52 | UINT8 *dp; |
| 53 | int index = 0; |
| 54 | dp = gfx->gfxdata + ch * gfx->char_modulo; |
| 55 | |
| 56 | for (j=y; j < y+8; j++) |
| 57 | { |
| 58 | UINT16 *p = BITMAP_ADDR16(bitmap, j, 0); |
| 59 | for (i=x; i < x+8; i++) |
| 60 | { |
| 61 | UINT8 pen = dp[index++]; |
| 62 | if (pen) |
| 63 | { |
| 64 | p[i] = Machine->remapped_colortable[gfx->color_base + (att & 0xf)]; |
| 65 | } |
| 66 | else |
| 67 | { |
| 68 | p[i] = Machine->remapped_colortable[gfx->color_base + ((att >> 4) & 0x7)]; |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | static VIDEO_UPDATE(gamecstl) |
| 75 | { |
| 76 | int i, j; |
| 77 | const gfx_element *gfx = machine->gfx[0]; |
| 78 | UINT32 *cga = cga_ram; |
| 79 | int index = 0; |
| 80 | |
| 81 | fillbitmap(bitmap, 0, cliprect); |
| 82 | |
| 83 | for (j=0; j < 25; j++) |
| 84 | { |
| 85 | for (i=0; i < 80; i+=2) |
| 86 | { |
| 87 | int att0 = (cga[index] >> 8) & 0xff; |
| 88 | int ch0 = (cga[index] >> 0) & 0xff; |
| 89 | int att1 = (cga[index] >> 24) & 0xff; |
| 90 | int ch1 = (cga[index] >> 16) & 0xff; |
| 91 | |
| 92 | draw_char(bitmap, cliprect, gfx, ch0, att0, i*8, j*8); |
| 93 | draw_char(bitmap, cliprect, gfx, ch1, att1, (i*8)+8, j*8); |
| 94 | index++; |
| 95 | } |
| 96 | } |
| 97 | return 0; |
| 98 | } |
| 99 | |
| 100 | static READ8_HANDLER(at_dma8237_1_r) |
| 101 | { |
| 102 | return dma8237_1_r(offset / 2); |
| 103 | } |
| 104 | |
| 105 | static WRITE8_HANDLER(at_dma8237_1_w) |
| 106 | { |
| 107 | dma8237_1_w(offset / 2, data); |
| 108 | } |
| 109 | |
| 110 | static READ32_HANDLER(at32_dma8237_1_r) |
| 111 | { |
| 112 | return read32le_with_read8_handler(at_dma8237_1_r, offset, mem_mask); |
| 113 | } |
| 114 | |
| 115 | static WRITE32_HANDLER(at32_dma8237_1_w) |
| 116 | { |
| 117 | write32le_with_write8_handler(at_dma8237_1_w, offset, data, mem_mask); |
| 118 | } |
| 119 | |
| 120 | |
| 121 | |
| 122 | // Intel 82439TX System Controller (MXTC) |
| 123 | static UINT8 mxtc_config_reg[256]; |
| 124 | |
| 125 | static UINT8 mxtc_config_r(int function, int reg) |
| 126 | { |
| 127 | // mame_printf_debug("MXTC: read %d, %02X\n", function, reg); |
| 128 | |
| 129 | return mxtc_config_reg[reg]; |
| 130 | } |
| 131 | |
| 132 | static void mxtc_config_w(int function, int reg, UINT8 data) |
| 133 | { |
| 134 | // mame_printf_debug("MXTC: write %d, %02X, %02X at %08X\n", function, reg, data, activecpu_get_pc()); |
| 135 | |
| 136 | switch(reg) |
| 137 | { |
| 138 | case 0x59: // PAM0 |
| 139 | { |
| 140 | if (data & 0x10) // enable RAM access to region 0xf0000 - 0xfffff |
| 141 | { |
| 142 | memory_set_bankptr(1, bios_ram); |
| 143 | } |
| 144 | else // disable RAM access (reads go to BIOS ROM) |
| 145 | { |
| 146 | memory_set_bankptr(1, memory_region(REGION_USER1) + 0x30000); |
| 147 | } |
| 148 | break; |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | mxtc_config_reg[reg] = data; |
| 153 | } |
| 154 | |
| 155 | static void intel82439tx_init(void) |
| 156 | { |
| 157 | mxtc_config_reg[0x60] = 0x02; |
| 158 | mxtc_config_reg[0x61] = 0x02; |
| 159 | mxtc_config_reg[0x62] = 0x02; |
| 160 | mxtc_config_reg[0x63] = 0x02; |
| 161 | mxtc_config_reg[0x64] = 0x02; |
| 162 | mxtc_config_reg[0x65] = 0x02; |
| 163 | } |
| 164 | |
| 165 | static UINT32 intel82439tx_pci_r(int function, int reg, UINT32 mem_mask) |
| 166 | { |
| 167 | UINT32 r = 0; |
| 168 | if (!(mem_mask & 0xff000000)) |
| 169 | { |
| 170 | r |= mxtc_config_r(function, reg + 3) << 24; |
| 171 | } |
| 172 | if (!(mem_mask & 0x00ff0000)) |
| 173 | { |
| 174 | r |= mxtc_config_r(function, reg + 2) << 16; |
| 175 | } |
| 176 | if (!(mem_mask & 0x0000ff00)) |
| 177 | { |
| 178 | r |= mxtc_config_r(function, reg + 1) << 8; |
| 179 | } |
| 180 | if (!(mem_mask & 0x000000ff)) |
| 181 | { |
| 182 | r |= mxtc_config_r(function, reg + 0) << 0; |
| 183 | } |
| 184 | return r; |
| 185 | } |
| 186 | |
| 187 | static void intel82439tx_pci_w(int function, int reg, UINT32 data, UINT32 mem_mask) |
| 188 | { |
| 189 | if (!(mem_mask & 0xff000000)) |
| 190 | { |
| 191 | mxtc_config_w(function, reg + 3, (data >> 24) & 0xff); |
| 192 | } |
| 193 | if (!(mem_mask & 0x00ff0000)) |
| 194 | { |
| 195 | mxtc_config_w(function, reg + 2, (data >> 16) & 0xff); |
| 196 | } |
| 197 | if (!(mem_mask & 0x0000ff00)) |
| 198 | { |
| 199 | mxtc_config_w(function, reg + 1, (data >> 8) & 0xff); |
| 200 | } |
| 201 | if (!(mem_mask & 0x000000ff)) |
| 202 | { |
| 203 | mxtc_config_w(function, reg + 0, (data >> 0) & 0xff); |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | // Intel 82371AB PCI-to-ISA / IDE bridge (PIIX4) |
| 208 | static UINT8 piix4_config_reg[4][256]; |
| 209 | |
| 210 | static UINT8 piix4_config_r(int function, int reg) |
| 211 | { |
| 212 | // mame_printf_debug("PIIX4: read %d, %02X\n", function, reg); |
| 213 | return piix4_config_reg[function][reg]; |
| 214 | } |
| 215 | |
| 216 | static void piix4_config_w(int function, int reg, UINT8 data) |
| 217 | { |
| 218 | // mame_printf_debug("PIIX4: write %d, %02X, %02X at %08X\n", function, reg, data, activecpu_get_pc()); |
| 219 | piix4_config_reg[function][reg] = data; |
| 220 | } |
| 221 | |
| 222 | static UINT32 intel82371ab_pci_r(int function, int reg, UINT32 mem_mask) |
| 223 | { |
| 224 | UINT32 r = 0; |
| 225 | if (!(mem_mask & 0xff000000)) |
| 226 | { |
| 227 | r |= piix4_config_r(function, reg + 3) << 24; |
| 228 | } |
| 229 | if (!(mem_mask & 0x00ff0000)) |
| 230 | { |
| 231 | r |= piix4_config_r(function, reg + 2) << 16; |
| 232 | } |
| 233 | if (!(mem_mask & 0x0000ff00)) |
| 234 | { |
| 235 | r |= piix4_config_r(function, reg + 1) << 8; |
| 236 | } |
| 237 | if (!(mem_mask & 0x000000ff)) |
| 238 | { |
| 239 | r |= piix4_config_r(function, reg + 0) << 0; |
| 240 | } |
| 241 | return r; |
| 242 | } |
| 243 | |
| 244 | static void intel82371ab_pci_w(int function, int reg, UINT32 data, UINT32 mem_mask) |
| 245 | { |
| 246 | if (!(mem_mask & 0xff000000)) |
| 247 | { |
| 248 | piix4_config_w(function, reg + 3, (data >> 24) & 0xff); |
| 249 | } |
| 250 | if (!(mem_mask & 0x00ff0000)) |
| 251 | { |
| 252 | piix4_config_w(function, reg + 2, (data >> 16) & 0xff); |
| 253 | } |
| 254 | if (!(mem_mask & 0x0000ff00)) |
| 255 | { |
| 256 | piix4_config_w(function, reg + 1, (data >> 8) & 0xff); |
| 257 | } |
| 258 | if (!(mem_mask & 0x000000ff)) |
| 259 | { |
| 260 | piix4_config_w(function, reg + 0, (data >> 0) & 0xff); |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | // ISA Plug-n-Play |
| 265 | static WRITE32_HANDLER( pnp_config_w ) |
| 266 | { |
| 267 | if (!(mem_mask & 0x0000ff00)) |
| 268 | { |
| 269 | // mame_printf_debug("PNP Config: %02X\n", (data >> 8) & 0xff); |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | static WRITE32_HANDLER( pnp_data_w ) |
| 274 | { |
| 275 | if (!(mem_mask & 0x0000ff00)) |
| 276 | { |
| 277 | // mame_printf_debug("PNP Data: %02X\n", (data >> 8) & 0xff); |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | |
| 282 | |
| 283 | static READ32_HANDLER( ide0_r ) |
| 284 | { |
| 285 | return ide_controller32_0_r(0x1f0/4 + offset, mem_mask); |
| 286 | } |
| 287 | |
| 288 | static WRITE32_HANDLER( ide0_w ) |
| 289 | { |
| 290 | ide_controller32_0_w(0x1f0/4 + offset, data, mem_mask); |
| 291 | } |
| 292 | |
| 293 | static READ32_HANDLER( fdc_r ) |
| 294 | { |
| 295 | return ide_controller32_0_r(0x3f0/4 + offset, mem_mask); |
| 296 | } |
| 297 | |
| 298 | static WRITE32_HANDLER( fdc_w ) |
| 299 | { |
| 300 | //mame_printf_debug("FDC: write %08X, %08X, %08X\n", data, offset, mem_mask); |
| 301 | ide_controller32_0_w(0x3f0/4 + offset, data, mem_mask); |
| 302 | } |
| 303 | |
| 304 | |
| 305 | |
| 306 | static WRITE32_HANDLER(bios_ram_w) |
| 307 | { |
| 308 | if (mxtc_config_reg[0x59] & 0x20) // write to RAM if this region is write-enabled |
| 309 | { |
| 310 | COMBINE_DATA(bios_ram + offset); |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | /*****************************************************************************/ |
| 315 | |
| 316 | static ADDRESS_MAP_START( gamecstl_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 317 | AM_RANGE(0x00000000, 0x0009ffff) AM_RAM |
| 318 | AM_RANGE(0x000a0000, 0x000affff) AM_RAM |
| 319 | AM_RANGE(0x000b0000, 0x000b7fff) AM_RAM AM_BASE(&cga_ram) |
| 320 | AM_RANGE(0x000e0000, 0x000effff) AM_RAM |
| 321 | AM_RANGE(0x000f0000, 0x000fffff) AM_ROMBANK(1) |
| 322 | AM_RANGE(0x000f0000, 0x000fffff) AM_WRITE(bios_ram_w) |
| 323 | AM_RANGE(0x00100000, 0x01ffffff) AM_RAM |
| 324 | AM_RANGE(0xfffc0000, 0xffffffff) AM_ROM AM_REGION(REGION_USER1, 0) /* System BIOS */ |
| 325 | ADDRESS_MAP_END |
| 326 | |
| 327 | static ADDRESS_MAP_START(gamecstl_io, ADDRESS_SPACE_IO, 32) |
| 328 | AM_RANGE(0x0000, 0x001f) AM_READWRITE(dma8237_32le_0_r, dma8237_32le_0_w) |
| 329 | AM_RANGE(0x0020, 0x003f) AM_READWRITE(pic8259_32le_0_r, pic8259_32le_0_w) |
| 330 | AM_RANGE(0x0040, 0x005f) AM_READWRITE(pit8253_32le_0_r, pit8253_32le_0_w) |
| 331 | AM_RANGE(0x0060, 0x006f) AM_READWRITE(kbdc8042_32le_r, kbdc8042_32le_w) |
| 332 | AM_RANGE(0x0070, 0x007f) AM_READWRITE(mc146818_port32le_r, mc146818_port32le_w) |
| 333 | AM_RANGE(0x0080, 0x009f) AM_READWRITE(at_page32_r, at_page32_w) |
| 334 | AM_RANGE(0x00a0, 0x00bf) AM_READWRITE(pic8259_32le_1_r, pic8259_32le_1_w) |
| 335 | AM_RANGE(0x00c0, 0x00df) AM_READWRITE(at32_dma8237_1_r, at32_dma8237_1_w) |
| 336 | AM_RANGE(0x00e8, 0x00eb) AM_NOP |
| 337 | AM_RANGE(0x01f0, 0x01f7) AM_READWRITE(ide0_r, ide0_w) |
| 338 | AM_RANGE(0x0300, 0x03af) AM_NOP |
| 339 | AM_RANGE(0x03b0, 0x03df) AM_NOP |
| 340 | AM_RANGE(0x0278, 0x027b) AM_WRITE(pnp_config_w) |
| 341 | AM_RANGE(0x03f0, 0x03ff) AM_READWRITE(fdc_r, fdc_w) |
| 342 | AM_RANGE(0x0a78, 0x0a7b) AM_WRITE(pnp_data_w) |
| 343 | AM_RANGE(0x0cf8, 0x0cff) AM_READWRITE(pci_32le_r, pci_32le_w) |
| 344 | ADDRESS_MAP_END |
| 345 | |
| 346 | /*****************************************************************************/ |
| 347 | |
| 348 | static const gfx_layout CGA_charlayout = |
| 349 | { |
| 350 | 8,8, /* 8 x 16 characters */ |
| 351 | 256, /* 256 characters */ |
| 352 | 1, /* 1 bits per pixel */ |
| 353 | { 0 }, /* no bitplanes; 1 bit per pixel */ |
| 354 | /* x offsets */ |
| 355 | { 0,1,2,3,4,5,6,7 }, |
| 356 | /* y offsets */ |
| 357 | { 0*8,1*8,2*8,3*8, |
| 358 | 4*8,5*8,6*8,7*8, |
| 359 | 0*8,1*8,2*8,3*8, |
| 360 | 4*8,5*8,6*8,7*8 }, |
| 361 | 8*8 /* every char takes 8 bytes */ |
| 362 | }; |
| 363 | |
| 364 | static GFXDECODE_START( CGA ) |
| 365 | /* Support up to four CGA fonts */ |
| 366 | GFXDECODE_ENTRY( REGION_GFX1, 0x0000, CGA_charlayout, 0, 256 ) /* Font 0 */ |
| 367 | GFXDECODE_ENTRY( REGION_GFX1, 0x0800, CGA_charlayout, 0, 256 ) /* Font 1 */ |
| 368 | GFXDECODE_ENTRY( REGION_GFX1, 0x1000, CGA_charlayout, 0, 256 ) /* Font 2 */ |
| 369 | GFXDECODE_ENTRY( REGION_GFX1, 0x1800, CGA_charlayout, 0, 256 ) /* Font 3*/ |
| 370 | GFXDECODE_END |
| 371 | |
| 372 | #define AT_KEYB_HELPER(bit, text, key1) \ |
| 373 | PORT_BIT( bit, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(text) PORT_CODE(key1) |
| 374 | |
| 375 | INPUT_PORTS_START(gamecstl) |
| 376 | PORT_START_TAG("pc_keyboard_0") |
| 377 | PORT_BIT ( 0x0001, 0x0000, IPT_UNUSED ) /* unused scancode 0 */ |
| 378 | AT_KEYB_HELPER( 0x0002, "Esc", KEYCODE_Q ) /* Esc 01 81 */ |
| 379 | |
| 380 | PORT_START_TAG("pc_keyboard_1") |
| 381 | AT_KEYB_HELPER( 0x0020, "Y", KEYCODE_Y ) /* Y 15 95 */ |
| 382 | AT_KEYB_HELPER( 0x1000, "Enter", KEYCODE_ENTER ) /* Enter 1C 9C */ |
| 383 | |
| 384 | PORT_START_TAG("pc_keyboard_2") |
| 385 | |
| 386 | PORT_START_TAG("pc_keyboard_3") |
| 387 | AT_KEYB_HELPER( 0x0002, "N", KEYCODE_N ) /* N 31 B1 */ |
| 388 | AT_KEYB_HELPER( 0x0800, "F1", KEYCODE_S ) /* F1 3B BB */ |
| 389 | |
| 390 | PORT_START_TAG("pc_keyboard_4") |
| 391 | |
| 392 | PORT_START_TAG("pc_keyboard_5") |
| 393 | |
| 394 | PORT_START_TAG("pc_keyboard_6") |
| 395 | AT_KEYB_HELPER( 0x0040, "(MF2)Cursor Up", KEYCODE_UP ) /* Up 67 e7 */ |
| 396 | AT_KEYB_HELPER( 0x0080, "(MF2)Page Up", KEYCODE_PGUP ) /* Page Up 68 e8 */ |
| 397 | AT_KEYB_HELPER( 0x0100, "(MF2)Cursor Left", KEYCODE_LEFT ) /* Left 69 e9 */ |
| 398 | AT_KEYB_HELPER( 0x0200, "(MF2)Cursor Right", KEYCODE_RIGHT ) /* Right 6a ea */ |
| 399 | AT_KEYB_HELPER( 0x0800, "(MF2)Cursor Down", KEYCODE_DOWN ) /* Down 6c ec */ |
| 400 | AT_KEYB_HELPER( 0x1000, "(MF2)Page Down", KEYCODE_PGDN ) /* Page Down 6d ed */ |
| 401 | AT_KEYB_HELPER( 0x4000, "Del", KEYCODE_A ) /* Delete 6f ef */ |
| 402 | |
| 403 | PORT_START_TAG("pc_keyboard_7") |
| 404 | INPUT_PORTS_END |
| 405 | |
| 406 | static int irq_callback(int irqline) |
| 407 | { |
| 408 | int r = 0; |
| 409 | r = pic8259_acknowledge(1); |
| 410 | if (r==0) |
| 411 | { |
| 412 | r = pic8259_acknowledge(0); |
| 413 | } |
| 414 | return r; |
| 415 | } |
| 416 | |
| 417 | static MACHINE_RESET(gamecstl) |
| 418 | { |
| 419 | memory_set_bankptr(1, memory_region(REGION_USER1) + 0x30000); |
| 420 | |
| 421 | dma8237_reset(); |
| 422 | cpunum_set_irq_callback(0, irq_callback); |
| 423 | } |
| 424 | |
| 425 | static MACHINE_DRIVER_START(gamecstl) |
| 426 | |
| 427 | /* basic machine hardware */ |
| 428 | MDRV_CPU_ADD(PENTIUM, 200000000) |
| 429 | MDRV_CPU_PROGRAM_MAP(gamecstl_map, 0) |
| 430 | MDRV_CPU_IO_MAP(gamecstl_io, 0) |
| 431 | |
| 432 | MDRV_SCREEN_REFRESH_RATE(60) |
| 433 | MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION) |
| 434 | |
| 435 | MDRV_MACHINE_RESET(gamecstl) |
| 436 | |
| 437 | MDRV_NVRAM_HANDLER( mc146818 ) |
| 438 | |
| 439 | /* video hardware */ |
| 440 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER ) |
| 441 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB15) |
| 442 | MDRV_SCREEN_SIZE(640, 480) |
| 443 | MDRV_SCREEN_VISIBLE_AREA(0, 639, 0, 199) |
| 444 | MDRV_GFXDECODE(CGA) |
| 445 | MDRV_PALETTE_LENGTH(16) |
| 446 | |
| 447 | MDRV_VIDEO_START(gamecstl) |
| 448 | MDRV_VIDEO_UPDATE(gamecstl) |
| 449 | |
| 450 | MACHINE_DRIVER_END |
| 451 | |
| 452 | static struct pci_device_info intel82439tx = |
| 453 | { |
| 454 | intel82439tx_pci_r, |
| 455 | intel82439tx_pci_w |
| 456 | }; |
| 457 | |
| 458 | static struct pci_device_info intel82371ab = |
| 459 | { |
| 460 | intel82371ab_pci_r, |
| 461 | intel82371ab_pci_w |
| 462 | }; |
| 463 | |
| 464 | static void set_gate_a20(int a20) |
| 465 | { |
| 466 | cpunum_set_input_line(0, INPUT_LINE_A20, a20); |
| 467 | } |
| 468 | |
| 469 | static void keyboard_interrupt(int state) |
| 470 | { |
| 471 | pic8259_set_irq_line(0, 1, state); |
| 472 | } |
| 473 | |
| 474 | static void ide_interrupt(int state) |
| 475 | { |
| 476 | pic8259_set_irq_line(1, 6, state); |
| 477 | } |
| 478 | |
| 479 | static struct kbdc8042_interface at8042 = |
| 480 | { |
| 481 | KBDC8042_AT386, set_gate_a20, keyboard_interrupt |
| 482 | }; |
| 483 | |
| 484 | static struct ide_interface ide_intf = |
| 485 | { |
| 486 | ide_interrupt |
| 487 | }; |
| 488 | |
| 489 | static DRIVER_INIT( gamecstl ) |
| 490 | { |
| 491 | bios_ram = auto_malloc(0x10000); |
| 492 | |
| 493 | init_pc_common(PCCOMMON_KEYBOARD_AT | PCCOMMON_DMA8237_AT | PCCOMMON_TIMER_8254); |
| 494 | mc146818_init(MC146818_STANDARD); |
| 495 | |
| 496 | intel82439tx_init(); |
| 497 | |
| 498 | pci_init(); |
| 499 | pci_add_device(0, 0, &intel82439tx); |
| 500 | pci_add_device(0, 7, &intel82371ab); |
| 501 | |
| 502 | kbdc8042_init(&at8042); |
| 503 | |
| 504 | ide_controller_init(0, &ide_intf); |
| 505 | } |
| 506 | |
| 507 | /*****************************************************************************/ |
| 508 | |
| 509 | // not the correct BIOS, f205v owes me a dump of it... |
| 510 | ROM_START(gamecstl) |
| 511 | ROM_REGION32_LE(0x40000, REGION_USER1, 0) |
| 512 | ROM_LOAD("p5tx-la.bin", 0x00000, 0x40000, BAD_DUMP CRC(072e6d51) SHA1(70414349b37e478fc28ecbaba47ad1033ae583b7)) |
| 513 | |
| 514 | ROM_REGION(0x08100, REGION_GFX1, 0) |
| 515 | ROM_LOAD("cga.chr", 0x00000, 0x01000, CRC(42009069) SHA1(ed08559ce2d7f97f68b9f540bddad5b6295294dd)) |
| 516 | |
| 517 | DISK_REGION( REGION_DISKS ) |
| 518 | DISK_IMAGE( "gamecstl", 0, MD5(501ddbebb530b8fd67eb64a4a2de3e35) SHA1(2477468ef1c1d4529057064a319ebfe9fd8facd7) ) |
| 519 | ROM_END |
| 520 | |
| 521 | /*****************************************************************************/ |
| 522 | |
| 523 | GAME(2002, gamecstl, 0, gamecstl, gamecstl, gamecstl, ROT0, "Cristaltec", "GameCristal", GAME_NOT_WORKING | GAME_NO_SOUND); |
| 524 | |
src/mame/drivers/pacman.c
| r1185 | r1186 | |
| 355 | 355 | #define VBSTART (224) /*(224+16)*/ |
| 356 | 356 | |
| 357 | 357 | |
| 358 | UINT8 cannonb_bit_to_read; |
| 358 | 359 | |
| 360 | |
| 359 | 361 | /************************************* |
| 360 | 362 | * |
| 361 | 363 | * Machine init |
| r1185 | r1186 | |
| 2923 | 2925 | |
| 2924 | 2926 | INPUT_PORTS_START( cannonbp ) |
| 2925 | 2927 | PORT_START_TAG("IN0") |
| 2926 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_4WAY |
| 2927 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_4WAY |
| 2928 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_4WAY |
| 2929 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_4WAY |
| 2930 | | PORT_DIPNAME(0x10, 0x10, "Rack Test (Cheat)" ) PORT_CODE(KEYCODE_F1) |
| 2931 | | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 2932 | | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2928 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY |
| 2929 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY |
| 2930 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY |
| 2931 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY |
| 2932 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2933 | 2933 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 2934 | 2934 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 2935 | 2935 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 2936 | 2936 | |
| 2937 | 2937 | PORT_START_TAG("IN1") |
| 2938 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_4WAY PORT_COCKTAIL |
| 2939 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_4WAY PORT_COCKTAIL |
| 2940 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_4WAY PORT_COCKTAIL |
| 2941 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_4WAY PORT_COCKTAIL |
| 2942 | | PORT_SERVICE( 0x10, IP_ACTIVE_LOW ) |
| 2943 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) |
| 2944 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 ) |
| 2945 | | PORT_DIPNAME(0x80, 0x80, DEF_STR( Cabinet ) ) |
| 2946 | | PORT_DIPSETTING( 0x80, DEF_STR( Upright ) ) |
| 2947 | | PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) |
| 2938 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_COCKTAIL |
| 2939 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL |
| 2940 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL |
| 2941 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_COCKTAIL |
| 2942 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL |
| 2943 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME( "Start" ) |
| 2944 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 ) PORT_NAME( "Select" ) |
| 2945 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2948 | 2946 | |
| 2949 | 2947 | PORT_START_TAG("DSW 1") |
| 2950 | | PORT_DIPNAME( 0x0001, 0x0001, "DSW1" ) |
| 2951 | | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) |
| 2952 | | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 2953 | | PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) |
| 2954 | | PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) |
| 2955 | | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 2956 | | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) |
| 2957 | | PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) |
| 2958 | | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 2959 | | PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) |
| 2960 | | PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) |
| 2961 | | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 2962 | | PORT_DIPNAME( 0x0010, 0x0000, DEF_STR( Unknown ) ) |
| 2963 | | PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) |
| 2964 | | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 2965 | | PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) |
| 2966 | | PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) |
| 2967 | | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 2968 | | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) |
| 2969 | | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) |
| 2970 | | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 2971 | | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) |
| 2972 | | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) |
| 2973 | | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 2948 | PORT_DIPNAME( 0x03, 0x03, "Display" ) |
| 2949 | PORT_DIPSETTING( 0x03, "Scores and Progession Bars" ) |
| 2950 | PORT_DIPSETTING( 0x01, "Scores only" ) |
| 2951 | PORT_DIPSETTING( 0x02, "Progession Bars only" ) |
| 2952 | PORT_DIPSETTING( 0x00, DEF_STR( None ) ) |
| 2953 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Cabinet ) ) |
| 2954 | PORT_DIPSETTING( 0x04, DEF_STR( Upright ) ) |
| 2955 | PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) |
| 2956 | PORT_DIPNAME( 0x18, 0x00, DEF_STR( Lives ) ) |
| 2957 | PORT_DIPSETTING( 0x00, "3" ) |
| 2958 | PORT_DIPSETTING( 0x08, "4" ) |
| 2959 | PORT_DIPSETTING( 0x10, "5" ) |
| 2960 | PORT_DIPSETTING( 0x18, "6" ) |
| 2961 | PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW ) |
| 2962 | PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW ) |
| 2963 | PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW ) |
| 2974 | 2964 | |
| 2975 | 2965 | PORT_START_TAG("DSW 2") |
| 2976 | | PORT_DIPNAME( 0x0001, 0x0001, "DSW2" ) |
| 2977 | | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) |
| 2978 | | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 2979 | | PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) |
| 2980 | | PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) |
| 2981 | | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 2982 | | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) |
| 2983 | | PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) |
| 2984 | | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 2985 | | PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) |
| 2986 | | PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) |
| 2987 | | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 2988 | | PORT_DIPNAME( 0x0010, 0x0000, DEF_STR( Unknown ) ) |
| 2989 | | PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) |
| 2990 | | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 2991 | | PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) |
| 2992 | | PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) |
| 2993 | | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 2994 | | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) |
| 2995 | | PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) |
| 2996 | | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 2997 | | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) |
| 2998 | | PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) |
| 2999 | | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 2966 | PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 3000 | 2967 | INPUT_PORTS_END |
| 3001 | 2968 | |
| 3002 | 2969 | /************************************* |
| r1185 | r1186 | |
| 5356 | 5323 | |
| 5357 | 5324 | static READ8_HANDLER( cannonbp_protection_r ) |
| 5358 | 5325 | { |
| 5359 | | /* at 6p where a rom would usually be there is an epoxy resin chip with 'Novomatic Industrie' Cannon Ball tm 1984 label. */ |
| 5326 | |
| 5327 | /* At 6p where a rom would usually be there is an epoxy resin chip with 'Novomatic Industrie' Cannon Ball tm 1984 label. */ |
| 5328 | /* As I have no clue about what shall be in this chip, what follows is only a simulation which is enough to play the game. */ |
| 5360 | 5329 | switch (offset) |
| 5361 | 5330 | { |
| 5362 | 5331 | default: |
| 5363 | 5332 | logerror("CPU0 %04x: Unhandled protection read, offset %04x\n", activecpu_get_pc(), offset); |
| 5364 | 5333 | return 0x00; |
| 5365 | 5334 | |
| 5366 | | case 0x000: // unknown |
| 5367 | | case 0x003: // unknown |
| 5368 | | case 0x012: // unknown |
| 5335 | case 0x0000: // unknown |
| 5336 | case 0x0003: // unknown |
| 5337 | case 0x0012: // unknown |
| 5369 | 5338 | return 0x00; |
| 5370 | 5339 | |
| 5371 | | case 0x001: // affects the ball hitting the blocks |
| 5372 | | return 0xff; |
| 5373 | | |
| 5374 | | case 0x105: // player start x position |
| 5340 | /* code at 0x2b77 : |
| 5341 | - after partial checksum (range 0x0000-0x1e7c), HL = 0x9d39 |
| 5342 | - then L += A and HL += 0x717c to determine jump address after bonus round |
| 5343 | where A is the result of 8 reads from 0x3001 |
| 5344 | - as jump address shall be 0x0efb, A = 0x46 |
| 5345 | - as H after partial checksum is wrong in the bootlegs, |
| 5346 | they will reset or hang after bonus round |
| 5347 | unless you patch ROM at 0x2ba0 with this code : |
| 5348 | 2BA0: 21 FB 0E ld hl,$0EFB |
| 5349 | 2BA3: 00 nop |
| 5350 | */ |
| 5351 | case 0x0004: |
| 5352 | cannonb_bit_to_read = 7; |
| 5375 | 5353 | return 0x00; |
| 5354 | case 0x0001: // affects the ball hitting the blocks as well as jump address after bonus round |
| 5355 | if (activecpu_get_pc() == 0x2b97) |
| 5356 | return (BIT(0x46, cannonb_bit_to_read--) << 7); |
| 5357 | else |
| 5358 | return 0xff; /* value taken from the bootlegs */ |
| 5376 | 5359 | |
| 5377 | | case 0x107: // player start y position |
| 5378 | | return 0x70; |
| 5360 | /* code at 0x2613 : HL += 0xd088 for start position - in the bootlegs, start position = 0x1088 */ |
| 5361 | case 0x0105: // player start x position -> register L |
| 5362 | return 0x00; |
| 5363 | case 0x0107: // player start y position -> register H |
| 5364 | return 0x40; |
| 5379 | 5365 | } |
| 5380 | 5366 | } |
| 5381 | 5367 | |
| r1185 | r1186 | |
| 5471 | 5457 | GAME( 1986, rocktrv2, 0, rocktrv2, rocktrv2, rocktrv2, ROT90, "Triumph Software Inc.", "MTV Rock-N-Roll Trivia (Part 2)", GAME_SUPPORTS_SAVE ) |
| 5472 | 5458 | GAME( 1986, bigbucks, 0, bigbucks, bigbucks, 0, ROT90, "Dynasoft Inc.", "Big Bucks", GAME_SUPPORTS_SAVE ) |
| 5473 | 5459 | GAME( 1995, mschamp, mspacman, mschamp, mschamp, 0, ROT90, "hack", "Ms. Pacman Champion Edition / Super Zola Pac Gal", GAME_SUPPORTS_SAVE ) |
| 5474 | | GAME( 198?, cannonbp, cannonb, pacman, cannonbp, cannonbp, ROT90, "Novomatic", "Cannon Ball (Pacman Hardware)", GAME_WRONG_COLORS|GAME_SUPPORTS_SAVE ) |
| 5460 | GAME( 198?, cannonbp, 0, pacman, cannonbp, cannonbp, ROT90, "Novomatic", "Cannon Ball (Pacman Hardware)", GAME_WRONG_COLORS|GAME_SUPPORTS_SAVE ) |
src/emu/cpu/m6800/m6800.c
| r1185 | r1186 | |
| 112 | 112 | PAIR output_compare; /* output compare */ |
| 113 | 113 | UINT16 input_capture; /* input capture */ |
| 114 | 114 | |
| 115 | | int clock; |
| 116 | | UINT8 trcsr, rmcr, rdr, tdr, rsr, tsr; |
| 117 | | int rxbits, txbits, txstate, trcsr_read, tx; |
| 118 | | |
| 119 | 115 | PAIR timer_over; |
| 120 | 116 | } m6800_Regs; |
| 121 | 117 | |
| 122 | 118 | /* 680x registers */ |
| 123 | 119 | static m6800_Regs m6800; |
| 124 | 120 | |
| 125 | | static mame_timer *m6800_rx_timer; |
| 126 | | static mame_timer *m6800_tx_timer; |
| 127 | | |
| 128 | 121 | #define m6801 m6800 |
| 129 | 122 | #define m6802 m6800 |
| 130 | 123 | #define m6803 m6800 |
| r1185 | r1186 | |
| 204 | 197 | SET_TIMER_EVENT; \ |
| 205 | 198 | } |
| 206 | 199 | |
| 207 | | // serial I/O |
| 208 | | |
| 209 | | #define M6800_RMCR_SS_MASK 0x03 // Speed Select |
| 210 | | #define M6800_RMCR_SS_4096 0x03 // E / 4096 |
| 211 | | #define M6800_RMCR_SS_1024 0x02 // E / 1024 |
| 212 | | #define M6800_RMCR_SS_128 0x01 // E / 128 |
| 213 | | #define M6800_RMCR_SS_16 0x00 // E / 16 |
| 214 | | #define M6800_RMCR_CC_MASK 0x0c // Clock Control/Format Select |
| 215 | | |
| 216 | | #define M6800_TRCSR_RDRF 0x80 // Receive Data Register Full |
| 217 | | #define M6800_TRCSR_ORFE 0x40 // Over Run Framing Error |
| 218 | | #define M6800_TRCSR_TDRE 0x20 // Transmit Data Register Empty |
| 219 | | #define M6800_TRCSR_RIE 0x10 // Receive Interrupt Enable |
| 220 | | #define M6800_TRCSR_RE 0x08 // Receive Enable |
| 221 | | #define M6800_TRCSR_TIE 0x04 // Transmit Interrupt Enable |
| 222 | | #define M6800_TRCSR_TE 0x02 // Transmit Enable |
| 223 | | #define M6800_TRCSR_WU 0x01 // Wake Up |
| 224 | | |
| 225 | | #define M6800_PORT2_IO4 0x10 |
| 226 | | #define M6800_PORT2_IO3 0x08 |
| 227 | | |
| 228 | | static const int M6800_RMCR_SS[] = { 16, 128, 1024, 4096 }; |
| 229 | | |
| 230 | | #define M6800_SERIAL_START 0 |
| 231 | | #define M6800_SERIAL_STOP 9 |
| 232 | | |
| 233 | | enum |
| 234 | | { |
| 235 | | M6800_TX_STATE_INIT = 0, |
| 236 | | M6800_TX_STATE_READY |
| 237 | | }; |
| 238 | | |
| 239 | 200 | /* take interrupt */ |
| 240 | 201 | #define TAKE_ICI ENTER_INTERRUPT("M6800#%d take ICI\n",0xfff6) |
| 241 | 202 | #define TAKE_OCI ENTER_INTERRUPT("M6800#%d take OCI\n",0xfff4) |
| r1185 | r1186 | |
| 243 | 204 | #define TAKE_SCI ENTER_INTERRUPT("M6800#%d take SCI\n",0xfff0) |
| 244 | 205 | #define TAKE_TRAP ENTER_INTERRUPT("M6800#%d take TRAP\n",0xffee) |
| 245 | 206 | |
| 207 | /* check IRQ2 (internal irq) */ |
| 208 | #define CHECK_IRQ2 { \ |
| 209 | if(m6800.irq2&(TCSR_ICF|TCSR_OCF|TCSR_TOF)) \ |
| 210 | { \ |
| 211 | if(m6800.irq2&TCSR_ICF) \ |
| 212 | { \ |
| 213 | TAKE_ICI; \ |
| 214 | if( m6800.irq_callback ) \ |
| 215 | (void)(*m6800.irq_callback)(M6800_TIN_LINE); \ |
| 216 | } \ |
| 217 | else if(m6800.irq2&TCSR_OCF) \ |
| 218 | { \ |
| 219 | TAKE_OCI; \ |
| 220 | } \ |
| 221 | else if(m6800.irq2&TCSR_TOF) \ |
| 222 | { \ |
| 223 | TAKE_TOI; \ |
| 224 | } \ |
| 225 | } \ |
| 226 | } |
| 227 | |
| 246 | 228 | /* operate one instruction for */ |
| 247 | 229 | #define ONE_MORE_INSN() { \ |
| 248 | 230 | UINT8 ireg; \ |
| r1185 | r1186 | |
| 265 | 247 | (void)(*m6800.irq_callback)(M6800_IRQ_LINE); \ |
| 266 | 248 | } \ |
| 267 | 249 | else \ |
| 268 | | m6800_check_irq2(); \ |
| 250 | CHECK_IRQ2; \ |
| 269 | 251 | } \ |
| 270 | 252 | } |
| 271 | 253 | |
| r1185 | r1186 | |
| 529 | 511 | CHANGE_PC(); |
| 530 | 512 | } |
| 531 | 513 | |
| 532 | | void m6800_check_irq2(void) |
| 533 | | { |
| 534 | | if ((m6800.tcsr & (TCSR_EICI|TCSR_ICF)) == (TCSR_EICI|TCSR_ICF)) |
| 535 | | { |
| 536 | | TAKE_ICI; |
| 537 | | if( m6800.irq_callback ) |
| 538 | | (void)(*m6800.irq_callback)(M6800_TIN_LINE); |
| 539 | | } |
| 540 | | else if ((m6800.tcsr & (TCSR_EOCI|TCSR_OCF)) == (TCSR_EOCI|TCSR_OCF)) |
| 541 | | { |
| 542 | | TAKE_OCI; |
| 543 | | } |
| 544 | | else if ((m6800.tcsr & (TCSR_ETOI|TCSR_TOF)) == (TCSR_ETOI|TCSR_TOF)) |
| 545 | | { |
| 546 | | TAKE_TOI; |
| 547 | | } |
| 548 | | else if (((m6800.trcsr & (M6800_TRCSR_RIE|M6800_TRCSR_RDRF)) == (M6800_TRCSR_RIE|M6800_TRCSR_RDRF)) || |
| 549 | | ((m6800.trcsr & (M6800_TRCSR_RIE|M6800_TRCSR_ORFE)) == (M6800_TRCSR_RIE|M6800_TRCSR_ORFE)) || |
| 550 | | ((m6800.trcsr & (M6800_TRCSR_TIE|M6800_TRCSR_TDRE)) == (M6800_TRCSR_TIE|M6800_TRCSR_TDRE))) |
| 551 | | { |
| 552 | | TAKE_SCI; |
| 553 | | } |
| 554 | | } |
| 555 | | |
| 556 | 514 | /* check OCI or TOI */ |
| 557 | 515 | static void check_timer_event(void) |
| 558 | 516 | { |
| r1185 | r1186 | |
| 589 | 547 | /* include the opcode functions */ |
| 590 | 548 | #include "6800ops.c" |
| 591 | 549 | |
| 592 | | static void m6800_tx(int value) |
| 593 | | { |
| 594 | | m6800.port2_data = (m6800.port2_data & 0xef) | (value << 4); |
| 595 | | |
| 596 | | if(m6800.port2_ddr == 0xff) |
| 597 | | io_write_byte_8(M6803_PORT2,m6800.port2_data); |
| 598 | | else |
| 599 | | io_write_byte_8(M6803_PORT2,(m6800.port2_data & m6800.port2_ddr) |
| 600 | | | (io_read_byte_8(M6803_PORT2) & (m6800.port2_ddr ^ 0xff))); |
| 601 | | } |
| 602 | | |
| 603 | | static int m6800_rx(void) |
| 604 | | { |
| 605 | | return (io_read_byte_8(M6803_PORT2) & M6800_PORT2_IO3) >> 3; |
| 606 | | } |
| 607 | | |
| 608 | | static TIMER_CALLBACK(m6800_tx_tick) |
| 609 | | { |
| 610 | | int cpunum = param; |
| 611 | | |
| 612 | | if (m6800.trcsr & M6800_TRCSR_TE) |
| 613 | | { |
| 614 | | // force Port 2 bit 4 as output |
| 615 | | m6800.port2_ddr |= M6800_PORT2_IO4; |
| 616 | | |
| 617 | | switch (m6800.txstate) |
| 618 | | { |
| 619 | | case M6800_TX_STATE_INIT: |
| 620 | | m6800.tx = 1; |
| 621 | | m6800.txbits++; |
| 622 | | |
| 623 | | if (m6800.txbits == 10) |
| 624 | | { |
| 625 | | m6800.txstate = M6800_TX_STATE_READY; |
| 626 | | m6800.txbits = M6800_SERIAL_START; |
| 627 | | } |
| 628 | | break; |
| 629 | | |
| 630 | | case M6800_TX_STATE_READY: |
| 631 | | switch (m6800.txbits) |
| 632 | | { |
| 633 | | case M6800_SERIAL_START: |
| 634 | | if (m6800.trcsr & M6800_TRCSR_TDRE) |
| 635 | | { |
| 636 | | // transmit buffer is empty, send consecutive '1's |
| 637 | | m6800.tx = 1; |
| 638 | | } |
| 639 | | else |
| 640 | | { |
| 641 | | // transmit buffer is full, send data |
| 642 | | |
| 643 | | // load TDR to shift register |
| 644 | | m6800.tsr = m6800.tdr; |
| 645 | | |
| 646 | | // transmit buffer is empty, set TDRE flag |
| 647 | | m6800.trcsr |= M6800_TRCSR_TDRE; |
| 648 | | |
| 649 | | // send start bit '0' |
| 650 | | m6800.tx = 0; |
| 651 | | |
| 652 | | m6800.txbits++; |
| 653 | | } |
| 654 | | break; |
| 655 | | |
| 656 | | case M6800_SERIAL_STOP: |
| 657 | | // send stop bit '1' |
| 658 | | m6800.tx = 1; |
| 659 | | |
| 660 | | cpuintrf_push_context(cpunum); |
| 661 | | CHECK_IRQ_LINES(); |
| 662 | | cpuintrf_pop_context(); |
| 663 | | |
| 664 | | m6800.txbits = M6800_SERIAL_START; |
| 665 | | break; |
| 666 | | |
| 667 | | default: |
| 668 | | // send data bit '0' or '1' |
| 669 | | m6800.tx = m6800.tsr & 0x01; |
| 670 | | |
| 671 | | // shift transmit register |
| 672 | | m6800.tsr >>= 1; |
| 673 | | |
| 674 | | m6800.txbits++; |
| 675 | | break; |
| 676 | | } |
| 677 | | break; |
| 678 | | } |
| 679 | | } |
| 680 | | |
| 681 | | m6800_tx(m6800.tx); |
| 682 | | } |
| 683 | | |
| 684 | | static TIMER_CALLBACK(m6800_rx_tick) |
| 685 | | { |
| 686 | | int cpunum = param; |
| 687 | | |
| 688 | | if (m6800.trcsr & M6800_TRCSR_RE) |
| 689 | | { |
| 690 | | if (m6800.trcsr & M6800_TRCSR_WU) |
| 691 | | { |
| 692 | | // wait for 10 bits of '1' |
| 693 | | |
| 694 | | if (m6800_rx() == 1) |
| 695 | | { |
| 696 | | m6800.rxbits++; |
| 697 | | |
| 698 | | if (m6800.rxbits == 10) |
| 699 | | { |
| 700 | | m6800.trcsr &= ~M6800_TRCSR_WU; |
| 701 | | m6800.rxbits = M6800_SERIAL_START; |
| 702 | | } |
| 703 | | } |
| 704 | | else |
| 705 | | { |
| 706 | | m6800.rxbits = M6800_SERIAL_START; |
| 707 | | } |
| 708 | | } |
| 709 | | else |
| 710 | | { |
| 711 | | // receive data |
| 712 | | |
| 713 | | switch (m6800.rxbits) |
| 714 | | { |
| 715 | | case M6800_SERIAL_START: |
| 716 | | if (m6800_rx() == 0) |
| 717 | | { |
| 718 | | // start bit found |
| 719 | | m6800.rxbits++; |
| 720 | | } |
| 721 | | break; |
| 722 | | |
| 723 | | case M6800_SERIAL_STOP: |
| 724 | | if (m6800_rx() == 1) |
| 725 | | { |
| 726 | | if (m6800.trcsr & M6800_TRCSR_RDRF) |
| 727 | | { |
| 728 | | // overrun error |
| 729 | | |
| 730 | | m6800.trcsr |= M6800_TRCSR_ORFE; |
| 731 | | |
| 732 | | cpuintrf_push_context(cpunum); |
| 733 | | CHECK_IRQ_LINES(); |
| 734 | | cpuintrf_pop_context(); |
| 735 | | } |
| 736 | | else |
| 737 | | { |
| 738 | | if (!(m6800.trcsr & M6800_TRCSR_ORFE)) |
| 739 | | { |
| 740 | | // transfer data into receive register |
| 741 | | m6800.rdr = m6800.rsr; |
| 742 | | |
| 743 | | // set RDRF flag |
| 744 | | m6800.trcsr |= M6800_TRCSR_RDRF; |
| 745 | | |
| 746 | | cpuintrf_push_context(cpunum); |
| 747 | | CHECK_IRQ_LINES(); |
| 748 | | cpuintrf_pop_context(); |
| 749 | | } |
| 750 | | } |
| 751 | | } |
| 752 | | else |
| 753 | | { |
| 754 | | // framing error |
| 755 | | |
| 756 | | if (!(m6800.trcsr & M6800_TRCSR_ORFE)) |
| 757 | | { |
| 758 | | // transfer unframed data into receive register |
| 759 | | m6800.rdr = m6800.rsr; |
| 760 | | } |
| 761 | | |
| 762 | | m6800.trcsr |= M6800_TRCSR_ORFE; |
| 763 | | m6800.trcsr &= ~M6800_TRCSR_RDRF; |
| 764 | | |
| 765 | | cpuintrf_push_context(cpunum); |
| 766 | | CHECK_IRQ_LINES(); |
| 767 | | cpuintrf_pop_context(); |
| 768 | | } |
| 769 | | |
| 770 | | m6800.rxbits = M6800_SERIAL_START; |
| 771 | | break; |
| 772 | | |
| 773 | | default: |
| 774 | | // shift receive register |
| 775 | | m6800.rsr >>= 1; |
| 776 | | |
| 777 | | // receive bit into register |
| 778 | | m6800.rsr |= (m6800_rx() << 7); |
| 779 | | |
| 780 | | m6800.rxbits++; |
| 781 | | break; |
| 782 | | } |
| 783 | | } |
| 784 | | } |
| 785 | | } |
| 786 | | |
| 787 | 550 | /**************************************************************************** |
| 788 | 551 | * Reset registers to their initial values |
| 789 | 552 | ****************************************************************************/ |
| r1185 | r1186 | |
| 846 | 609 | OCD = 0xffff; |
| 847 | 610 | TOD = 0xffff; |
| 848 | 611 | m6800.ram_ctrl |= 0x40; |
| 849 | | |
| 850 | | #if (HAS_HD63701) |
| 851 | | m6800.trcsr = M6800_TRCSR_TDRE; |
| 852 | | m6800.rmcr = 0; |
| 853 | | mame_timer_enable(m6800_rx_timer, 0); |
| 854 | | mame_timer_enable(m6800_tx_timer, 0); |
| 855 | | m6800.txstate = M6800_TX_STATE_INIT; |
| 856 | | m6800.txbits = m6800.rxbits = 0; |
| 857 | | m6800.trcsr_read = 0; |
| 858 | | #endif |
| 859 | 612 | } |
| 860 | 613 | |
| 861 | 614 | /**************************************************************************** |
| r1185 | r1186 | |
| 923 | 676 | m6800.input_capture = CT; |
| 924 | 677 | MODIFIED_tcsr; |
| 925 | 678 | if( !(CC & 0x10) ) |
| 926 | | m6800_check_irq2(); |
| 679 | CHECK_IRQ2 |
| 927 | 680 | break; |
| 928 | 681 | default: |
| 929 | 682 | return; |
| r1185 | r1186 | |
| 1595 | 1348 | * HD63701 similiar to the M6800 |
| 1596 | 1349 | ****************************************************************************/ |
| 1597 | 1350 | #if (HAS_HD63701) |
| 1598 | | |
| 1599 | 1351 | static void hd63701_init(int index, int clock, const void *config, int (*irqcallback)(int)) |
| 1600 | 1352 | { |
| 1601 | 1353 | // m6800.subtype = SUBTYPE_HD63701; |
| 1602 | 1354 | m6800.insn = hd63701_insn; |
| 1603 | 1355 | m6800.cycles = cycles_63701; |
| 1604 | 1356 | m6800.irq_callback = irqcallback; |
| 1605 | | |
| 1606 | | m6800.clock = clock; |
| 1607 | | m6800_rx_timer = mame_timer_alloc(m6800_rx_tick); |
| 1608 | | m6800_tx_timer = mame_timer_alloc(m6800_tx_tick); |
| 1609 | | |
| 1610 | 1357 | state_register("hd63701", index); |
| 1611 | 1358 | } |
| 1612 | 1359 | /**************************************************************************** |
| r1185 | r1186 | |
| 2265 | 2012 | | (m6800.port4_data & m6800.port4_ddr); |
| 2266 | 2013 | case 0x08: |
| 2267 | 2014 | m6800.pending_tcsr = 0; |
| 2015 | //logerror("CPU #%d PC %04x: warning - read TCSR register\n",cpu_getactivecpu(),activecpu_get_pc()); |
| 2268 | 2016 | return m6800.tcsr; |
| 2269 | 2017 | case 0x09: |
| 2270 | 2018 | if(!(m6800.pending_tcsr&TCSR_TOF)) |
| r1185 | r1186 | |
| 2299 | 2047 | case 0x0e: |
| 2300 | 2048 | return (m6800.input_capture >> 8) & 0xff; |
| 2301 | 2049 | case 0x0f: |
| 2302 | | logerror("CPU #%d PC %04x: warning - read from unsupported register %02x\n",cpu_getactivecpu(),activecpu_get_pc(),offset); |
| 2303 | | return 0; |
| 2304 | 2050 | case 0x10: |
| 2305 | | return m6800.rmcr; |
| 2306 | 2051 | case 0x11: |
| 2307 | | m6800.trcsr_read = 1; |
| 2308 | | return m6800.trcsr; |
| 2309 | 2052 | case 0x12: |
| 2310 | | if (m6800.trcsr_read) |
| 2311 | | { |
| 2312 | | m6800.trcsr_read = 0; |
| 2313 | | m6800.trcsr = m6800.trcsr & 0x3f; |
| 2314 | | } |
| 2315 | | return m6800.rdr; |
| 2316 | 2053 | case 0x13: |
| 2317 | | return m6800.tdr; |
| 2054 | logerror("CPU #%d PC %04x: warning - read from unsupported internal register %02x\n",cpu_getactivecpu(),activecpu_get_pc(),offset); |
| 2055 | return 0; |
| 2318 | 2056 | case 0x14: |
| 2319 | 2057 | logerror("CPU #%d PC %04x: read RAM control register\n",cpu_getactivecpu(),activecpu_get_pc()); |
| 2320 | 2058 | return m6800.ram_ctrl; |
| r1185 | r1186 | |
| 2375 | 2113 | | (io_read_byte_8(M6803_PORT1) & (m6800.port1_ddr ^ 0xff))); |
| 2376 | 2114 | break; |
| 2377 | 2115 | case 0x03: |
| 2378 | | m6800.port2_data = (m6800.port2_data & 0xef) | (m6800.tx << 4); |
| 2116 | m6800.port2_data = data; |
| 2117 | m6800.port2_ddr = data; |
| 2379 | 2118 | if(m6800.port2_ddr == 0xff) |
| 2380 | 2119 | io_write_byte_8(M6803_PORT2,m6800.port2_data); |
| 2381 | 2120 | else |
| r1185 | r1186 | |
| 2425 | 2164 | m6800.pending_tcsr &= m6800.tcsr; |
| 2426 | 2165 | MODIFIED_tcsr; |
| 2427 | 2166 | if( !(CC & 0x10) ) |
| 2428 | | m6800_check_irq2(); |
| 2167 | CHECK_IRQ2; |
| 2168 | //logerror("CPU #%d PC %04x: TCSR = %02x\n",cpu_getactivecpu(),activecpu_get_pc(),data); |
| 2429 | 2169 | break; |
| 2430 | 2170 | case 0x09: |
| 2431 | 2171 | latch09 = data & 0xff; /* 6301 only */ |
| r1185 | r1186 | |
| 2454 | 2194 | break; |
| 2455 | 2195 | case 0x0d: |
| 2456 | 2196 | case 0x0e: |
| 2457 | | case 0x12: |
| 2458 | 2197 | logerror("CPU #%d PC %04x: warning - write %02x to read only internal register %02x\n",cpu_getactivecpu(),activecpu_get_pc(),data,offset); |
| 2459 | 2198 | break; |
| 2460 | 2199 | case 0x0f: |
| 2461 | | logerror("CPU #%d PC %04x: warning - write %02x to unsupported internal register %02x\n",cpu_getactivecpu(),activecpu_get_pc(),data,offset); |
| 2462 | | break; |
| 2463 | 2200 | case 0x10: |
| 2464 | | m6800.rmcr = data & 0x0f; |
| 2465 | | |
| 2466 | | switch ((m6800.rmcr & M6800_RMCR_CC_MASK) >> 2) |
| 2467 | | { |
| 2468 | | case 0: |
| 2469 | | case 3: // not implemented |
| 2470 | | mame_timer_enable(m6800_rx_timer, 0); |
| 2471 | | mame_timer_enable(m6800_tx_timer, 0); |
| 2472 | | break; |
| 2473 | | |
| 2474 | | case 1: |
| 2475 | | case 2: |
| 2476 | | { |
| 2477 | | int divisor = M6800_RMCR_SS[m6800.rmcr & M6800_RMCR_SS_MASK]; |
| 2478 | | |
| 2479 | | mame_timer_adjust(m6800_rx_timer, time_zero, cpu_getactivecpu(), MAME_TIME_IN_HZ(m6800.clock / divisor)); |
| 2480 | | mame_timer_adjust(m6800_tx_timer, time_zero, cpu_getactivecpu(), MAME_TIME_IN_HZ(m6800.clock / divisor)); |
| 2481 | | } |
| 2482 | | break; |
| 2483 | | } |
| 2484 | | break; |
| 2485 | 2201 | case 0x11: |
| 2486 | | if ((data & M6800_TRCSR_TE) && !(m6800.trcsr & M6800_TRCSR_TE)) |
| 2487 | | { |
| 2488 | | m6800.txstate = M6800_TX_STATE_INIT; |
| 2489 | | } |
| 2490 | | m6800.trcsr = (m6800.trcsr & 0xe0) | (data & 0x1f); |
| 2491 | | break; |
| 2202 | case 0x12: |
| 2492 | 2203 | case 0x13: |
| 2493 | | if (m6800.trcsr_read) |
| 2494 | | { |
| 2495 | | m6800.trcsr_read = 0; |
| 2496 | | m6800.trcsr &= ~M6800_TRCSR_TDRE; |
| 2497 | | } |
| 2498 | | m6800.tdr = data; |
| 2204 | logerror("CPU #%d PC %04x: warning - write %02x to unsupported internal register %02x\n",cpu_getactivecpu(),activecpu_get_pc(),data,offset); |
| 2499 | 2205 | break; |
| 2500 | 2206 | case 0x14: |
| 2501 | 2207 | logerror("CPU #%d PC %04x: write %02x to RAM control register\n",cpu_getactivecpu(),activecpu_get_pc(),data); |
| r1185 | r1186 | |
| 2571 | 2277 | case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA: info->i = 0; break; |
| 2572 | 2278 | case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA: info->i = 0; break; |
| 2573 | 2279 | case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA: info->i = 0; break; |
| 2574 | | case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO: info->i = 9; break; |
| 2280 | case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO: info->i = 0; break; |
| 2575 | 2281 | case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO: info->i = 0; break; |
| 2576 | 2282 | case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO: info->i = 0; break; |
| 2577 | 2283 | |
src/emu/video/voodoo.c
| r1185 | r1186 | |
| 136 | 136 | |
| 137 | 137 | #include "driver.h" |
| 138 | 138 | #include "profiler.h" |
| 139 | #include "video/polynew.h" |
| 139 | 140 | #include "voodoo.h" |
| 140 | 141 | #include "vooddefs.h" |
| 141 | 142 | #include "ui.h" |
| r1185 | r1186 | |
| 155 | 156 | #define LOG_FIFO (0) |
| 156 | 157 | #define LOG_FIFO_VERBOSE (0) |
| 157 | 158 | #define LOG_REGISTERS (0) |
| 159 | #define LOG_WAITS (0) |
| 158 | 160 | #define LOG_LFB (0) |
| 159 | 161 | #define LOG_TEXTURE_RAM (0) |
| 160 | 162 | #define LOG_RASTERIZERS (0) |
| r1185 | r1186 | |
| 211 | 213 | static UINT32 banshee_io_r(voodoo_state *v, offs_t offset, UINT32 mem_mask); |
| 212 | 214 | static UINT32 banshee_rom_r(voodoo_state *v, offs_t offset, UINT32 mem_mask); |
| 213 | 215 | |
| 214 | | /* work item management */ |
| 215 | | static void work_item_enqueue(voodoo_state *v, work_info *work, int numitems); |
| 216 | | static void work_item_wait(voodoo_state *v); |
| 217 | | static void *work_item_callback(void *param); |
| 218 | | |
| 219 | 216 | /* command handlers */ |
| 220 | 217 | static INT32 fastfill(voodoo_state *v); |
| 221 | 218 | static INT32 swapbuffer(voodoo_state *v, UINT32 data); |
| r1185 | r1186 | |
| 233 | 230 | static void dump_rasterizer_stats(voodoo_state *v); |
| 234 | 231 | |
| 235 | 232 | /* generic rasterizers */ |
| 236 | | static void raster_fastfill(work_info *work, INT32 scanline, INT32 startx, INT32 stopx); |
| 237 | | static void raster_generic_0tmu(work_info *work, INT32 y, INT32 startx, INT32 stopx); |
| 238 | | static void raster_generic_1tmu(work_info *work, INT32 y, INT32 startx, INT32 stopx); |
| 239 | | static void raster_generic_2tmu(work_info *work, INT32 y, INT32 startx, INT32 stopx); |
| 233 | static void raster_fastfill(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid); |
| 234 | static void raster_generic_0tmu(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid); |
| 235 | static void raster_generic_1tmu(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid); |
| 236 | static void raster_generic_2tmu(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid); |
| 240 | 237 | |
| 241 | 238 | |
| 242 | 239 | |
| r1185 | r1186 | |
| 282 | 279 | |
| 283 | 280 | void voodoo_start(int which, int scrnum, int type, int fbmem_in_mb, int tmem0_in_mb, int tmem1_in_mb) |
| 284 | 281 | { |
| 282 | const raster_info *info; |
| 285 | 283 | void *fbmem, *tmumem[2]; |
| 286 | 284 | voodoo_state *v; |
| 287 | 285 | int val; |
| r1185 | r1186 | |
| 292 | 290 | voodoo[which] = v; |
| 293 | 291 | |
| 294 | 292 | /* create a multiprocessor work queue */ |
| 295 | | v->work_queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_MULTI); |
| 293 | v->poly = poly_alloc(64, sizeof(poly_extra_data), 0); |
| 294 | v->thread_stats = auto_malloc(sizeof(v->thread_stats[0]) * WORK_MAX_THREADS); |
| 296 | 295 | |
| 297 | 296 | /* create a table of precomputed 1/n and log2(n) values */ |
| 298 | 297 | /* n ranges from 1.0000 to 2.0000 */ |
| r1185 | r1186 | |
| 371 | 370 | v->trigger = 51324 + which; |
| 372 | 371 | |
| 373 | 372 | /* build the rasterizer table */ |
| 374 | | #ifndef VOODOO_DRC |
| 375 | | { |
| 376 | | const raster_info *info; |
| 377 | 373 | for (info = predef_raster_table; info->callback; info++) |
| 378 | 374 | add_rasterizer(v, info); |
| 379 | | } |
| 380 | | #endif |
| 381 | 375 | |
| 382 | 376 | /* set up the PCI FIFO */ |
| 383 | 377 | v->pci.fifo.base = v->pci.fifo_mem; |
| r1185 | r1186 | |
| 448 | 442 | void voodoo_exit(int which) |
| 449 | 443 | { |
| 450 | 444 | /* release the work queue, ensuring all work is finished */ |
| 451 | | if (voodoo[which] != NULL && voodoo[which]->work_queue != NULL) |
| 452 | | osd_work_queue_free(voodoo[which]->work_queue); |
| 445 | if (voodoo[which] != NULL && voodoo[which]->poly != NULL) |
| 446 | poly_free(voodoo[which]->poly); |
| 453 | 447 | } |
| 454 | 448 | |
| 455 | 449 | |
| r1185 | r1186 | |
| 919 | 913 | |
| 920 | 914 | /************************************* |
| 921 | 915 | * |
| 916 | * Statistics management |
| 917 | * |
| 918 | *************************************/ |
| 919 | |
| 920 | static void accumulate_statistics(voodoo_state *v, const stats_block *stats) |
| 921 | { |
| 922 | /* apply internal voodoo statistics */ |
| 923 | v->reg[fbiPixelsIn].u += stats->pixels_in; |
| 924 | v->reg[fbiPixelsOut].u += stats->pixels_out; |
| 925 | v->reg[fbiChromaFail].u += stats->chroma_fail; |
| 926 | v->reg[fbiZfuncFail].u += stats->zfunc_fail; |
| 927 | v->reg[fbiAfuncFail].u += stats->afunc_fail; |
| 928 | |
| 929 | /* apply emulation statistics */ |
| 930 | v->stats.total_pixels_in += stats->pixels_in; |
| 931 | v->stats.total_pixels_out += stats->pixels_out; |
| 932 | v->stats.total_chroma_fail += stats->chroma_fail; |
| 933 | v->stats.total_zfunc_fail += stats->zfunc_fail; |
| 934 | v->stats.total_afunc_fail += stats->afunc_fail; |
| 935 | v->stats.total_clipped += stats->clip_fail; |
| 936 | v->stats.total_stippled += stats->stipple_count; |
| 937 | } |
| 938 | |
| 939 | |
| 940 | static void update_statistics(voodoo_state *v, int accumulate) |
| 941 | { |
| 942 | int threadnum; |
| 943 | |
| 944 | /* accumulate/reset statistics from all units */ |
| 945 | for (threadnum = 0; threadnum < ARRAY_LENGTH(v->thread_stats); threadnum++) |
| 946 | { |
| 947 | if (accumulate) |
| 948 | accumulate_statistics(v, &v->thread_stats[threadnum]); |
| 949 | memset(&v->thread_stats[threadnum], 0, sizeof(v->thread_stats[threadnum])); |
| 950 | } |
| 951 | |
| 952 | /* accumulate/reset statistics from the LFB */ |
| 953 | if (accumulate) |
| 954 | accumulate_statistics(v, &v->fbi.lfb_stats); |
| 955 | memset(&v->fbi.lfb_stats, 0, sizeof(v->fbi.lfb_stats)); |
| 956 | } |
| 957 | |
| 958 | |
| 959 | |
| 960 | /************************************* |
| 961 | * |
| 922 | 962 | * VBLANK management |
| 923 | 963 | * |
| 924 | 964 | *************************************/ |
| r1185 | r1186 | |
| 988 | 1028 | if (v->stats.display) |
| 989 | 1029 | { |
| 990 | 1030 | int screen_area = (Machine->screen[v->scrnum].visarea.max_x - Machine->screen[v->scrnum].visarea.min_x + 1) * (Machine->screen[v->scrnum].visarea.max_y - Machine->screen[v->scrnum].visarea.min_y + 1); |
| 991 | | int pixelcount = v->stats.total_pixels_out; |
| 992 | 1031 | char *statsptr = v->stats.buffer; |
| 1032 | int pixelcount; |
| 993 | 1033 | int i; |
| 994 | 1034 | |
| 1035 | update_statistics(v, TRUE); |
| 1036 | pixelcount = v->stats.total_pixels_out; |
| 1037 | |
| 995 | 1038 | statsptr += sprintf(statsptr, "Swap:%6d\n", v->stats.swaps); |
| 996 | 1039 | statsptr += sprintf(statsptr, "Hist:%08X\n", v->reg[fbiSwapHistory].u); |
| 997 | 1040 | statsptr += sprintf(statsptr, "Stal:%6d\n", v->stats.stalls); |
| r1185 | r1186 | |
| 1108 | 1151 | |
| 1109 | 1152 | static void reset_counters(voodoo_state *v) |
| 1110 | 1153 | { |
| 1154 | update_statistics(v, FALSE); |
| 1111 | 1155 | v->reg[fbiPixelsIn].u = 0; |
| 1112 | 1156 | v->reg[fbiChromaFail].u = 0; |
| 1113 | 1157 | v->reg[fbiZfuncFail].u = 0; |
| r1185 | r1186 | |
| 1491 | 1535 | } |
| 1492 | 1536 | |
| 1493 | 1537 | |
| 1494 | | INLINE void prepare_tmu(tmu_state *t) |
| 1538 | INLINE INT32 prepare_tmu(tmu_state *t) |
| 1495 | 1539 | { |
| 1496 | 1540 | INT64 texdx, texdy; |
| 1541 | INT32 lodbase; |
| 1497 | 1542 | |
| 1498 | 1543 | /* if the texture parameters are dirty, update them */ |
| 1499 | 1544 | if (t->regdirty) |
| 1545 | { |
| 1500 | 1546 | recompute_texture_params(t); |
| 1501 | 1547 | |
| 1502 | | /* ensure that the NCC tables are up to date */ |
| 1503 | | if ((TEXMODE_FORMAT(t->reg[textureMode].u) & 7) == 1) |
| 1504 | | { |
| 1505 | | ncc_table *n = &t->ncc[TEXMODE_NCC_TABLE_SELECT(t->reg[textureMode].u)]; |
| 1506 | | t->texel[1] = t->texel[9] = n->texel; |
| 1507 | | if (n->dirty) |
| 1508 | | ncc_table_update(n); |
| 1548 | /* ensure that the NCC tables are up to date */ |
| 1549 | if ((TEXMODE_FORMAT(t->reg[textureMode].u) & 7) == 1) |
| 1550 | { |
| 1551 | ncc_table *n = &t->ncc[TEXMODE_NCC_TABLE_SELECT(t->reg[textureMode].u)]; |
| 1552 | t->texel[1] = t->texel[9] = n->texel; |
| 1553 | if (n->dirty) |
| 1554 | ncc_table_update(n); |
| 1555 | } |
| 1509 | 1556 | } |
| 1510 | 1557 | |
| 1511 | 1558 | /* compute (ds^2 + dt^2) in both X and Y as 28.36 numbers */ |
| r1185 | r1186 | |
| 1522 | 1569 | /* adjust the result: negative to get the log of the original value */ |
| 1523 | 1570 | /* plus 12 to account for the extra exponent, and divided by 2 to */ |
| 1524 | 1571 | /* get the log of the square root of texdx */ |
| 1525 | | (void)fast_reciplog(texdx, &t->lodbase); |
| 1526 | | t->lodbase = (-t->lodbase + (12 << 8)) / 2; |
| 1572 | (void)fast_reciplog(texdx, &lodbase); |
| 1573 | return (-lodbase + (12 << 8)) / 2; |
| 1527 | 1574 | } |
| 1528 | 1575 | |
| 1529 | 1576 | |
| r1185 | r1186 | |
| 2207 | 2254 | return 0; |
| 2208 | 2255 | } |
| 2209 | 2256 | |
| 2210 | | /* wait for any outstanding work to finish */ |
| 2211 | | if (regnum < vertexAx || regnum > fdWdY) |
| 2212 | | work_item_wait(v); |
| 2213 | | |
| 2214 | 2257 | /* switch off the register */ |
| 2215 | 2258 | switch (regnum) |
| 2216 | 2259 | { |
| r1185 | r1186 | |
| 2454 | 2497 | |
| 2455 | 2498 | /* mask off invalid bits for different cards */ |
| 2456 | 2499 | case fbzColorPath: |
| 2500 | poly_wait(v->poly, v->regnames[regnum]); |
| 2457 | 2501 | if (v->type < VOODOO_2) |
| 2458 | 2502 | data &= 0x0fffffff; |
| 2459 | 2503 | if (chips & 1) v->reg[fbzColorPath].u = data; |
| 2460 | 2504 | break; |
| 2461 | 2505 | |
| 2462 | 2506 | case fbzMode: |
| 2507 | poly_wait(v->poly, v->regnames[regnum]); |
| 2463 | 2508 | if (v->type < VOODOO_2) |
| 2464 | 2509 | data &= 0x001fffff; |
| 2465 | 2510 | if (chips & 1) v->reg[fbzMode].u = data; |
| 2466 | 2511 | break; |
| 2467 | 2512 | |
| 2468 | 2513 | case fogMode: |
| 2514 | poly_wait(v->poly, v->regnames[regnum]); |
| 2469 | 2515 | if (v->type < VOODOO_2) |
| 2470 | 2516 | data &= 0x0000003f; |
| 2471 | 2517 | if (chips & 1) v->reg[fogMode].u = data; |
| r1185 | r1186 | |
| 2494 | 2540 | |
| 2495 | 2541 | /* other commands */ |
| 2496 | 2542 | case nopCMD: |
| 2543 | poly_wait(v->poly, v->regnames[regnum]); |
| 2497 | 2544 | if (data & 1) |
| 2498 | 2545 | reset_counters(v); |
| 2499 | 2546 | if (data & 2) |
| r1185 | r1186 | |
| 2505 | 2552 | break; |
| 2506 | 2553 | |
| 2507 | 2554 | case swapbufferCMD: |
| 2555 | poly_wait(v->poly, v->regnames[regnum]); |
| 2508 | 2556 | cycles = swapbuffer(v, data); |
| 2509 | 2557 | break; |
| 2510 | 2558 | |
| 2511 | 2559 | case userIntrCMD: |
| 2560 | poly_wait(v->poly, v->regnames[regnum]); |
| 2512 | 2561 | fatalerror("userIntrCMD"); |
| 2513 | 2562 | break; |
| 2514 | 2563 | |
| r1185 | r1186 | |
| 2516 | 2565 | case clutData: |
| 2517 | 2566 | if (v->type <= VOODOO_2 && (chips & 1)) |
| 2518 | 2567 | { |
| 2568 | poly_wait(v->poly, v->regnames[regnum]); |
| 2519 | 2569 | if (!FBIINIT1_VIDEO_TIMING_RESET(v->reg[fbiInit1].u)) |
| 2520 | 2570 | { |
| 2521 | 2571 | int index = data >> 24; |
| r1185 | r1186 | |
| 2534 | 2584 | case dacData: |
| 2535 | 2585 | if (v->type <= VOODOO_2 && (chips & 1)) |
| 2536 | 2586 | { |
| 2587 | poly_wait(v->poly, v->regnames[regnum]); |
| 2537 | 2588 | if (!(data & 0x800)) |
| 2538 | 2589 | dacdata_w(&v->dac, (data >> 8) & 7, data & 0xff); |
| 2539 | 2590 | else |
| r1185 | r1186 | |
| 2548 | 2599 | case videoDimensions: |
| 2549 | 2600 | if (v->type <= VOODOO_2 && (chips & 1)) |
| 2550 | 2601 | { |
| 2602 | poly_wait(v->poly, v->regnames[regnum]); |
| 2551 | 2603 | v->reg[regnum].u = data; |
| 2552 | 2604 | if (v->reg[hSync].u != 0 && v->reg[vSync].u != 0 && v->reg[videoDimensions].u != 0) |
| 2553 | 2605 | { |
| r1185 | r1186 | |
| 2625 | 2677 | |
| 2626 | 2678 | /* fbiInit0 can only be written if initEnable says we can -- Voodoo/Voodoo2 only */ |
| 2627 | 2679 | case fbiInit0: |
| 2680 | poly_wait(v->poly, v->regnames[regnum]); |
| 2628 | 2681 | if (v->type <= VOODOO_2 && (chips & 1) && INITEN_ENABLE_HW_INIT(v->pci.init_enable)) |
| 2629 | 2682 | { |
| 2630 | 2683 | v->reg[fbiInit0].u = data; |
| r1185 | r1186 | |
| 2648 | 2701 | case fbiInit1: |
| 2649 | 2702 | case fbiInit2: |
| 2650 | 2703 | case fbiInit4: |
| 2704 | poly_wait(v->poly, v->regnames[regnum]); |
| 2651 | 2705 | if (v->type <= VOODOO_2 && (chips & 1) && INITEN_ENABLE_HW_INIT(v->pci.init_enable)) |
| 2652 | 2706 | { |
| 2653 | 2707 | v->reg[regnum].u = data; |
| r1185 | r1186 | |
| 2657 | 2711 | break; |
| 2658 | 2712 | |
| 2659 | 2713 | case fbiInit3: |
| 2714 | poly_wait(v->poly, v->regnames[regnum]); |
| 2660 | 2715 | if (v->type <= VOODOO_2 && (chips & 1) && INITEN_ENABLE_HW_INIT(v->pci.init_enable)) |
| 2661 | 2716 | { |
| 2662 | 2717 | v->reg[regnum].u = data; |
| r1185 | r1186 | |
| 2670 | 2725 | /* case swapPending: -- Banshee */ |
| 2671 | 2726 | if (v->type == VOODOO_2 && (chips & 1) && INITEN_ENABLE_HW_INIT(v->pci.init_enable)) |
| 2672 | 2727 | { |
| 2728 | poly_wait(v->poly, v->regnames[regnum]); |
| 2673 | 2729 | v->reg[regnum].u = data; |
| 2674 | 2730 | v->fbi.cmdfifo[0].enable = FBIINIT7_CMDFIFO_ENABLE(data); |
| 2675 | 2731 | v->fbi.cmdfifo[0].count_holes = !FBIINIT7_DISABLE_CMDFIFO_HOLES(data); |
| r1185 | r1186 | |
| 2682 | 2738 | case cmdFifoBaseAddr: |
| 2683 | 2739 | if (v->type == VOODOO_2 && (chips & 1)) |
| 2684 | 2740 | { |
| 2741 | poly_wait(v->poly, v->regnames[regnum]); |
| 2685 | 2742 | v->reg[regnum].u = data; |
| 2686 | 2743 | v->fbi.cmdfifo[0].base = (data & 0x3ff) << 12; |
| 2687 | 2744 | v->fbi.cmdfifo[0].end = (((data >> 16) & 0x3ff) + 1) << 12; |
| r1185 | r1186 | |
| 2763 | 2820 | case nccTable+9: |
| 2764 | 2821 | case nccTable+10: |
| 2765 | 2822 | case nccTable+11: |
| 2823 | poly_wait(v->poly, v->regnames[regnum]); |
| 2766 | 2824 | if (chips & 2) ncc_table_write(&v->tmu[0].ncc[0], regnum - nccTable, data); |
| 2767 | 2825 | if (chips & 4) ncc_table_write(&v->tmu[1].ncc[0], regnum - nccTable, data); |
| 2768 | 2826 | break; |
| r1185 | r1186 | |
| 2779 | 2837 | case nccTable+21: |
| 2780 | 2838 | case nccTable+22: |
| 2781 | 2839 | case nccTable+23: |
| 2840 | poly_wait(v->poly, v->regnames[regnum]); |
| 2782 | 2841 | if (chips & 2) ncc_table_write(&v->tmu[0].ncc[1], regnum - (nccTable+12), data); |
| 2783 | 2842 | if (chips & 4) ncc_table_write(&v->tmu[1].ncc[1], regnum - (nccTable+12), data); |
| 2784 | 2843 | break; |
| r1185 | r1186 | |
| 2816 | 2875 | case fogTable+29: |
| 2817 | 2876 | case fogTable+30: |
| 2818 | 2877 | case fogTable+31: |
| 2878 | poly_wait(v->poly, v->regnames[regnum]); |
| 2819 | 2879 | if (chips & 1) |
| 2820 | 2880 | { |
| 2821 | 2881 | int base = 2 * (regnum - fogTable); |
| r1185 | r1186 | |
| 2834 | 2894 | case texBaseAddr_1: |
| 2835 | 2895 | case texBaseAddr_2: |
| 2836 | 2896 | case texBaseAddr_3_8: |
| 2897 | poly_wait(v->poly, v->regnames[regnum]); |
| 2837 | 2898 | if (chips & 2) |
| 2838 | 2899 | { |
| 2839 | 2900 | v->tmu[0].reg[regnum].u = data; |
| r1185 | r1186 | |
| 2846 | 2907 | } |
| 2847 | 2908 | break; |
| 2848 | 2909 | |
| 2910 | /* these registers are referenced in the renderer; we must wait for pending work before changing */ |
| 2911 | case chromaRange: |
| 2912 | case chromaKey: |
| 2913 | case alphaMode: |
| 2914 | case fogColor: |
| 2915 | case stipple: |
| 2916 | case zaColor: |
| 2917 | case color1: |
| 2918 | case color0: |
| 2919 | case clipLowYHighY: |
| 2920 | case clipLeftRight: |
| 2921 | poly_wait(v->poly, v->regnames[regnum]); |
| 2922 | /* fall through to default implementation */ |
| 2923 | |
| 2849 | 2924 | /* by default, just feed the data to the chips */ |
| 2850 | 2925 | default: |
| 2851 | 2926 | if (chips & 1) v->reg[0x000 + regnum].u = data; |
| r1185 | r1186 | |
| 3106 | 3181 | depthmax = v->fbi.auxmax; |
| 3107 | 3182 | |
| 3108 | 3183 | /* wait for any outstanding work to finish */ |
| 3109 | | work_item_wait(v); |
| 3184 | poly_wait(v->poly, "LFB Write"); |
| 3110 | 3185 | |
| 3111 | 3186 | /* simple case: no pipeline */ |
| 3112 | 3187 | if (!LFBMODE_ENABLE_PIXEL_PIPELINE(v->reg[lfbMode].u)) |
| r1185 | r1186 | |
| 3168 | 3243 | else |
| 3169 | 3244 | { |
| 3170 | 3245 | DECLARE_DITHER_POINTERS; |
| 3171 | | DECLARE_STATISTICS; |
| 3172 | 3246 | |
| 3173 | 3247 | if (LOG_LFB) logerror("VOODOO.%d.LFB:write pipelined mode %X (%d,%d) = %08X & %08X\n", v->index, LFBMODE_WRITE_FORMAT(v->reg[lfbMode].u), x, y, data, mem_mask); |
| 3174 | 3248 | |
| r1185 | r1186 | |
| 3191 | 3265 | /* make sure we care about this pixel */ |
| 3192 | 3266 | if (mask & 0x0f) |
| 3193 | 3267 | { |
| 3268 | stats_block *stats = &v->fbi.lfb_stats; |
| 3194 | 3269 | INT64 iterw = sw[pixel] << (30-16); |
| 3195 | 3270 | INT32 iterz = sw[pixel] << 12; |
| 3196 | 3271 | rgb_union color; |
| r1185 | r1186 | |
| 3203 | 3278 | scry < ((v->reg[clipLowYHighY].u >> 16) & 0x3ff) || |
| 3204 | 3279 | scry >= (v->reg[clipLowYHighY].u & 0x3ff)) |
| 3205 | 3280 | { |
| 3206 | | pixin++; |
| 3207 | | v->stats.total_clipped++; |
| 3281 | stats->pixels_in++; |
| 3282 | stats->clip_fail++; |
| 3208 | 3283 | continue; |
| 3209 | 3284 | } |
| 3210 | 3285 | } |
| 3211 | 3286 | |
| 3212 | 3287 | /* pixel pipeline part 1 handles depth testing and stippling */ |
| 3213 | | PIXEL_PIPELINE_BEGIN(v, x, y, v->reg[fbzColorPath].u, v->reg[fbzMode].u, iterz, iterw); |
| 3288 | PIXEL_PIPELINE_BEGIN(v, stats, x, y, v->reg[fbzColorPath].u, v->reg[fbzMode].u, iterz, iterw); |
| 3214 | 3289 | |
| 3215 | 3290 | /* use the RGBA we stashed above */ |
| 3216 | 3291 | color.rgb.r = r = sr[pixel]; |
| r1185 | r1186 | |
| 3219 | 3294 | color.rgb.a = a = sa[pixel]; |
| 3220 | 3295 | |
| 3221 | 3296 | /* apply chroma key, alpha mask, and alpha testing */ |
| 3222 | | APPLY_CHROMAKEY(v, v->reg[fbzMode].u, color); |
| 3223 | | APPLY_ALPHAMASK(v, v->reg[fbzMode].u, color.rgb.a); |
| 3224 | | APPLY_ALPHATEST(v, v->reg[alphaMode].u, color.rgb.a); |
| 3297 | APPLY_CHROMAKEY(v, stats, v->reg[fbzMode].u, color); |
| 3298 | APPLY_ALPHAMASK(v, stats, v->reg[fbzMode].u, color.rgb.a); |
| 3299 | APPLY_ALPHATEST(v, stats, v->reg[alphaMode].u, color.rgb.a); |
| 3225 | 3300 | |
| 3226 | 3301 | /* pixel pipeline part 2 handles color combine, fog, alpha, and final output */ |
| 3227 | | PIXEL_PIPELINE_END(v, dither, dither4, dither_lookup, x, dest, depth, v->reg[fbzMode].u, v->reg[fbzColorPath].u, v->reg[alphaMode].u, v->reg[fogMode].u, iterz, iterw, v->reg[zaColor]); |
| 3302 | PIXEL_PIPELINE_END(v, stats, dither, dither4, dither_lookup, x, dest, depth, v->reg[fbzMode].u, v->reg[fbzColorPath].u, v->reg[alphaMode].u, v->reg[fogMode].u, iterz, iterw, v->reg[zaColor]); |
| 3228 | 3303 | } |
| 3229 | 3304 | |
| 3230 | 3305 | /* advance our pointers */ |
| 3231 | 3306 | x++; |
| 3232 | 3307 | mask >>= 4; |
| 3233 | 3308 | } |
| 3234 | | |
| 3235 | | UPDATE_STATISTICS(v); |
| 3236 | 3309 | } |
| 3237 | 3310 | |
| 3238 | 3311 | return 0; |
| r1185 | r1186 | |
| 3263 | 3336 | fatalerror("Texture direct write!"); |
| 3264 | 3337 | |
| 3265 | 3338 | /* wait for any outstanding work to finish */ |
| 3266 | | work_item_wait(v); |
| 3339 | poly_wait(v->poly, "Texture write"); |
| 3267 | 3340 | |
| 3268 | 3341 | /* update texture info if dirty */ |
| 3269 | 3342 | if (t->regdirty) |
| r1185 | r1186 | |
| 3811 | 3884 | break; |
| 3812 | 3885 | |
| 3813 | 3886 | /* all counters are 24-bit only */ |
| 3814 | | case fbiTrianglesOut: |
| 3815 | 3887 | case fbiPixelsIn: |
| 3816 | 3888 | case fbiChromaFail: |
| 3817 | 3889 | case fbiZfuncFail: |
| 3818 | 3890 | case fbiAfuncFail: |
| 3819 | 3891 | case fbiPixelsOut: |
| 3820 | | result &= 0xffffff; |
| 3892 | update_statistics(v, TRUE); |
| 3893 | case fbiTrianglesOut: |
| 3894 | result = v->reg[regnum].u & 0xffffff; |
| 3821 | 3895 | break; |
| 3822 | 3896 | } |
| 3823 | 3897 | |
| r1185 | r1186 | |
| 3903 | 3977 | return 0xffffffff; |
| 3904 | 3978 | |
| 3905 | 3979 | /* wait for any outstanding work to finish */ |
| 3906 | | work_item_wait(v); |
| 3980 | poly_wait(v->poly, "LFB read"); |
| 3907 | 3981 | |
| 3908 | 3982 | /* compute the data */ |
| 3909 | 3983 | data = buffer[bufoffs + 0] | (buffer[bufoffs + 1] << 16); |
| r1185 | r1186 | |
| 4500 | 4574 | |
| 4501 | 4575 | |
| 4502 | 4576 | /*************************************************************************** |
| 4503 | | WORK ITEM MANAGEMENT |
| 4504 | | ***************************************************************************/ |
| 4505 | | |
| 4506 | | /*------------------------------------------------- |
| 4507 | | work_item_enqueue - enqueue a new work item, |
| 4508 | | remembering starting statistics |
| 4509 | | -------------------------------------------------*/ |
| 4510 | | |
| 4511 | | static void work_item_enqueue(voodoo_state *v, work_info *work, int numitems) |
| 4512 | | { |
| 4513 | | /* remember the starting statistics values */ |
| 4514 | | work->start_pixels_in = v->reg[fbiPixelsIn].u; |
| 4515 | | work->start_pixels_out = v->reg[fbiPixelsOut].u; |
| 4516 | | work->start_chroma_fail = v->reg[fbiChromaFail].u; |
| 4517 | | work->start_zfunc_fail = v->reg[fbiZfuncFail].u; |
| 4518 | | work->start_afunc_fail = v->reg[fbiAfuncFail].u; |
| 4519 | | |
| 4520 | | /* set the state */ |
| 4521 | | work->state = v; |
| 4522 | | |
| 4523 | | /* enqueue the work item */ |
| 4524 | | osd_work_item_queue_multiple(v->work_queue, work_item_callback, numitems, work->unit, sizeof(*work->unit), WORK_ITEM_FLAG_AUTO_RELEASE); |
| 4525 | | } |
| 4526 | | |
| 4527 | | |
| 4528 | | /*------------------------------------------------- |
| 4529 | | work_item_wait - wait for all pending work |
| 4530 | | items to complete, then update statistics |
| 4531 | | -------------------------------------------------*/ |
| 4532 | | |
| 4533 | | static void work_item_wait(voodoo_state *v) |
| 4534 | | { |
| 4535 | | work_info *work = &v->work; |
| 4536 | | |
| 4537 | | /* wait for the work item to complete */ |
| 4538 | | osd_work_queue_wait(v->work_queue, osd_ticks_per_second()); |
| 4539 | | |
| 4540 | | /* update our global stats based on the results */ |
| 4541 | | v->stats.total_pixels_in += v->reg[fbiPixelsIn].u - work->start_pixels_in; |
| 4542 | | v->stats.total_pixels_out += v->reg[fbiPixelsOut].u - work->start_pixels_out; |
| 4543 | | v->stats.total_chroma_fail += v->reg[fbiChromaFail].u - work->start_chroma_fail; |
| 4544 | | v->stats.total_zfunc_fail += v->reg[fbiZfuncFail].u - work->start_zfunc_fail; |
| 4545 | | v->stats.total_afunc_fail += v->reg[fbiAfuncFail].u - work->start_afunc_fail; |
| 4546 | | if (work->info != NULL) |
| 4547 | | work->info->hits += v->reg[fbiPixelsIn].u - work->start_pixels_in; |
| 4548 | | |
| 4549 | | /* remember the starting statistics values */ |
| 4550 | | work->start_pixels_in = v->reg[fbiPixelsIn].u; |
| 4551 | | work->start_pixels_out = v->reg[fbiPixelsOut].u; |
| 4552 | | work->start_chroma_fail = v->reg[fbiChromaFail].u; |
| 4553 | | work->start_zfunc_fail = v->reg[fbiZfuncFail].u; |
| 4554 | | work->start_afunc_fail = v->reg[fbiAfuncFail].u; |
| 4555 | | } |
| 4556 | | |
| 4557 | | |
| 4558 | | /*------------------------------------------------- |
| 4559 | | work_item_callback - work item callback; |
| 4560 | | loop over scanlines and call the rasterizer |
| 4561 | | for each one |
| 4562 | | -------------------------------------------------*/ |
| 4563 | | |
| 4564 | | static void *work_item_callback(void *param) |
| 4565 | | { |
| 4566 | | work_unit *unit = param; |
| 4567 | | work_info *work = unit->work; |
| 4568 | | int extnum; |
| 4569 | | |
| 4570 | | /* iterate over extents */ |
| 4571 | | for (extnum = 0; extnum < unit->count; extnum++) |
| 4572 | | (*work->callback)(work, unit->scanline + extnum, unit->extent[extnum].startx, unit->extent[extnum].stopx); |
| 4573 | | return NULL; |
| 4574 | | } |
| 4575 | | |
| 4576 | | |
| 4577 | | |
| 4578 | | /*************************************************************************** |
| 4579 | 4577 | COMMAND HANDLERS |
| 4580 | 4578 | ***************************************************************************/ |
| 4581 | 4579 | |
| r1185 | r1186 | |
| 4590 | 4588 | int ex = (v->reg[clipLeftRight].u >> 0) & 0x3ff; |
| 4591 | 4589 | int sy = (v->reg[clipLowYHighY].u >> 16) & 0x3ff; |
| 4592 | 4590 | int ey = (v->reg[clipLowYHighY].u >> 0) & 0x3ff; |
| 4593 | | work_info *work = &v->work; |
| 4594 | | work_unit *unit = work->unit; |
| 4595 | | int x, y; |
| 4591 | scanline_extent extents[256]; |
| 4592 | UINT16 dithermatrix[16]; |
| 4593 | UINT16 *drawbuf = NULL; |
| 4594 | UINT32 pixels = 0; |
| 4595 | int extnum, x, y; |
| 4596 | 4596 | |
| 4597 | 4597 | /* if we're not clearing either, take no time */ |
| 4598 | 4598 | if (!FBZMODE_RGB_BUFFER_MASK(v->reg[fbzMode].u) && !FBZMODE_AUX_BUFFER_MASK(v->reg[fbzMode].u)) |
| r1185 | r1186 | |
| 4606 | 4606 | switch (destbuf) |
| 4607 | 4607 | { |
| 4608 | 4608 | case 0: /* front buffer */ |
| 4609 | | work->drawbuf = v->fbi.rgb[v->fbi.frontbuf]; |
| 4609 | drawbuf = v->fbi.rgb[v->fbi.frontbuf]; |
| 4610 | 4610 | break; |
| 4611 | 4611 | |
| 4612 | 4612 | case 1: /* back buffer */ |
| 4613 | | work->drawbuf = v->fbi.rgb[v->fbi.backbuf]; |
| 4613 | drawbuf = v->fbi.rgb[v->fbi.backbuf]; |
| 4614 | 4614 | break; |
| 4615 | 4615 | |
| 4616 | 4616 | default: /* reserved */ |
| r1185 | r1186 | |
| 4624 | 4624 | COMPUTE_DITHER_POINTERS(v->reg[fbzMode].u, y); |
| 4625 | 4625 | for (x = 0; x < 4; x++) |
| 4626 | 4626 | { |
| 4627 | | int r = RGB_RED(v->reg[color1].u); |
| 4628 | | int g = RGB_GREEN(v->reg[color1].u); |
| 4629 | | int b = RGB_BLUE(v->reg[color1].u); |
| 4627 | int r = v->reg[color1].rgb.r; |
| 4628 | int g = v->reg[color1].rgb.g; |
| 4629 | int b = v->reg[color1].rgb.b; |
| 4630 | 4630 | |
| 4631 | 4631 | APPLY_DITHER(v->reg[fbzMode].u, x, dither_lookup, r, g, b); |
| 4632 | | work->dither[y*4 + x] = (r << 11) | (g << 5) | b; |
| 4632 | dithermatrix[y*4 + x] = (r << 11) | (g << 5) | b; |
| 4633 | 4633 | } |
| 4634 | 4634 | } |
| 4635 | 4635 | } |
| 4636 | 4636 | |
| 4637 | | /* create a shared work item to actually perform the fill */ |
| 4638 | | work->startscanline = sy; |
| 4639 | | work->callback = raster_fastfill; |
| 4640 | | work->info = NULL; |
| 4641 | | for (y = sy; y < ey; y += SCANLINES_PER_WORK) |
| 4637 | /* fill in a block of extents */ |
| 4638 | extents[0].startx = sx; |
| 4639 | extents[0].stopx = ex; |
| 4640 | for (extnum = 1; extnum < ARRAY_LENGTH(extents); extnum++) |
| 4641 | extents[extnum] = extents[0]; |
| 4642 | |
| 4643 | /* iterate over blocks of extents */ |
| 4644 | for (y = sy; y < ey; y += ARRAY_LENGTH(extents)) |
| 4642 | 4645 | { |
| 4643 | | int extnum; |
| 4646 | poly_extra_data *extra = poly_get_extra_data(v->poly); |
| 4647 | int count = MIN(ey - y, ARRAY_LENGTH(extents)); |
| 4644 | 4648 | |
| 4645 | | unit->work = work; |
| 4646 | | unit->scanline = y; |
| 4647 | | unit->count = MIN(ey - y, SCANLINES_PER_WORK); |
| 4648 | | for (extnum = 0; extnum < unit->count; extnum++) |
| 4649 | | { |
| 4650 | | unit->extent[extnum].startx = sx; |
| 4651 | | unit->extent[extnum].stopx = ex; |
| 4652 | | } |
| 4653 | | unit++; |
| 4649 | extra->state = v; |
| 4650 | memcpy(extra->dither, dithermatrix, sizeof(extra->dither)); |
| 4651 | |
| 4652 | pixels += poly_render_custom(v->poly, drawbuf, NULL, raster_fastfill, y, count, extents); |
| 4654 | 4653 | } |
| 4655 | | work_item_enqueue(v, work, unit - work->unit); |
| 4656 | 4654 | |
| 4657 | | /* track pixel writes to the frame buffer regardless of mask */ |
| 4658 | | if (FBZMODE_RGB_BUFFER_MASK(v->reg[fbzMode].u)) |
| 4659 | | v->reg[fbiPixelsOut].u += (ey - sy) * (ex - sx); |
| 4660 | | |
| 4661 | 4655 | /* 2 pixels per clock */ |
| 4662 | | return ((ey - sy) * (ex - sx)) / 2; |
| 4656 | return pixels / 2; |
| 4663 | 4657 | } |
| 4664 | 4658 | |
| 4665 | 4659 | |
| r1185 | r1186 | |
| 4695 | 4689 | |
| 4696 | 4690 | static INT32 triangle(voodoo_state *v) |
| 4697 | 4691 | { |
| 4698 | | int texcount = 0, texnum; |
| 4692 | int texcount = 0; |
| 4699 | 4693 | UINT16 *drawbuf; |
| 4700 | 4694 | int destbuf; |
| 4701 | 4695 | int pixels; |
| r1185 | r1186 | |
| 4743 | 4737 | } |
| 4744 | 4738 | |
| 4745 | 4739 | /* wait for any outstanding work to finish */ |
| 4746 | | work_item_wait(v); |
| 4740 | // poly_wait(v->poly, "triangle"); |
| 4747 | 4741 | |
| 4748 | | /* set up the textures */ |
| 4749 | | for (texnum = 0; texnum < texcount; texnum++) |
| 4750 | | { |
| 4751 | | prepare_tmu(&v->tmu[texnum]); |
| 4752 | | v->stats.texture_mode[TEXMODE_FORMAT(v->tmu[texnum].reg[textureMode].u)]++; |
| 4753 | | } |
| 4754 | | |
| 4755 | 4742 | /* determine the draw buffer */ |
| 4756 | 4743 | destbuf = (v->type >= VOODOO_BANSHEE) ? 1 : FBZMODE_DRAW_BUFFER(v->reg[fbzMode].u); |
| 4757 | 4744 | switch (destbuf) |
| r1185 | r1186 | |
| 4997 | 4984 | |
| 4998 | 4985 | static INT32 triangle_create_work_item(voodoo_state *v, UINT16 *drawbuf, int texcount) |
| 4999 | 4986 | { |
| 4987 | poly_extra_data *extra = poly_get_extra_data(v->poly); |
| 5000 | 4988 | raster_info *info = find_rasterizer(v, texcount); |
| 5001 | | work_info *work = &v->work; |
| 5002 | | work_unit *unit = work->unit; |
| 5003 | | int curscan, pixels = 0; |
| 5004 | | INT32 dxdy_minmid; |
| 5005 | | INT32 dxdy_minmax; |
| 5006 | | INT32 dxdy_midmax; |
| 5007 | | INT32 minx, miny; |
| 5008 | | INT32 midx, midy; |
| 5009 | | INT32 maxx, maxy; |
| 5010 | | INT32 endscanline; |
| 4989 | poly_vertex vert[3]; |
| 5011 | 4990 | |
| 5012 | | /* sort the vertices */ |
| 5013 | | /* note that this is not necessary on the Voodoo 1 as the card assumes the vertices */ |
| 5014 | | /* are presorted such that ay <= by <= cy, but we do it anyway because it is cheap enough */ |
| 5015 | | if (v->fbi.ay <= v->fbi.by) |
| 5016 | | { |
| 5017 | | if (v->fbi.by <= v->fbi.cy) |
| 5018 | | { |
| 5019 | | minx = v->fbi.ax; miny = v->fbi.ay; |
| 5020 | | midx = v->fbi.bx; midy = v->fbi.by; |
| 5021 | | maxx = v->fbi.cx; maxy = v->fbi.cy; |
| 5022 | | } |
| 5023 | | else if (v->fbi.ay <= v->fbi.cy) |
| 5024 | | { |
| 5025 | | minx = v->fbi.ax; miny = v->fbi.ay; |
| 5026 | | midx = v->fbi.cx; midy = v->fbi.cy; |
| 5027 | | maxx = v->fbi.bx; maxy = v->fbi.by; |
| 5028 | | } |
| 5029 | | else |
| 5030 | | { |
| 5031 | | minx = v->fbi.cx; miny = v->fbi.cy; |
| 5032 | | midx = v->fbi.ax; midy = v->fbi.ay; |
| 5033 | | maxx = v->fbi.bx; maxy = v->fbi.by; |
| 5034 | | } |
| 5035 | | } |
| 5036 | | else |
| 5037 | | { |
| 5038 | | if (v->fbi.ay <= v->fbi.cy) |
| 5039 | | { |
| 5040 | | minx = v->fbi.bx; miny = v->fbi.by; |
| 5041 | | midx = v->fbi.ax; midy = v->fbi.ay; |
| 5042 | | maxx = v->fbi.cx; maxy = v->fbi.cy; |
| 5043 | | } |
| 5044 | | else if (v->fbi.by <= v->fbi.cy) |
| 5045 | | { |
| 5046 | | minx = v->fbi.bx; miny = v->fbi.by; |
| 5047 | | midx = v->fbi.cx; midy = v->fbi.cy; |
| 5048 | | maxx = v->fbi.ax; maxy = v->fbi.ay; |
| 5049 | | } |
| 5050 | | else |
| 5051 | | { |
| 5052 | | minx = v->fbi.cx; miny = v->fbi.cy; |
| 5053 | | midx = v->fbi.bx; midy = v->fbi.by; |
| 5054 | | maxx = v->fbi.ax; maxy = v->fbi.ay; |
| 5055 | | } |
| 5056 | | } |
| 4991 | /* fill in the vertex data */ |
| 4992 | vert[0].x = (float)v->fbi.ax * (1.0f / 16.0f); |
| 4993 | vert[0].y = (float)v->fbi.ay * (1.0f / 16.0f); |
| 4994 | vert[1].x = (float)v->fbi.bx * (1.0f / 16.0f); |
| 4995 | vert[1].y = (float)v->fbi.by * (1.0f / 16.0f); |
| 4996 | vert[2].x = (float)v->fbi.cx * (1.0f / 16.0f); |
| 4997 | vert[2].y = (float)v->fbi.cy * (1.0f / 16.0f); |
| 5057 | 4998 | |
| 5058 | | /* clamp to full pixels */ |
| 5059 | | work->startscanline = (miny + 7) >> 4; |
| 5060 | | endscanline = (maxy + 7) >> 4; |
| 5061 | | if (work->startscanline >= endscanline) |
| 5062 | | return 0; |
| 4999 | /* fill in the extra data */ |
| 5000 | extra->state = v; |
| 5001 | extra->info = info; |
| 5063 | 5002 | |
| 5064 | | /* compute the slopes as 16.16 numbers */ |
| 5065 | | dxdy_minmid = (miny == midy) ? 0 : ((midx - minx) << 16) / (midy - miny); |
| 5066 | | dxdy_minmax = (miny == maxy) ? 0 : ((maxx - minx) << 16) / (maxy - miny); |
| 5067 | | dxdy_midmax = (midy == maxy) ? 0 : ((maxx - midx) << 16) / (maxy - midy); |
| 5003 | /* fill in triangle parameters */ |
| 5004 | extra->ax = v->fbi.ax; |
| 5005 | extra->ay = v->fbi.ay; |
| 5006 | extra->startr = v->fbi.startr; |
| 5007 | extra->startg = v->fbi.startg; |
| 5008 | extra->startb = v->fbi.startb; |
| 5009 | extra->starta = v->fbi.starta; |
| 5010 | extra->startz = v->fbi.startz; |
| 5011 | extra->startw = v->fbi.startw; |
| 5012 | extra->drdx = v->fbi.drdx; |
| 5013 | extra->dgdx = v->fbi.dgdx; |
| 5014 | extra->dbdx = v->fbi.dbdx; |
| 5015 | extra->dadx = v->fbi.dadx; |
| 5016 | extra->dzdx = v->fbi.dzdx; |
| 5017 | extra->dwdx = v->fbi.dwdx; |
| 5018 | extra->drdy = v->fbi.drdy; |
| 5019 | extra->dgdy = v->fbi.dgdy; |
| 5020 | extra->dbdy = v->fbi.dbdy; |
| 5021 | extra->dady = v->fbi.dady; |
| 5022 | extra->dzdy = v->fbi.dzdy; |
| 5023 | extra->dwdy = v->fbi.dwdy; |
| 5068 | 5024 | |
| 5069 | | /* compute the X extents for each scanline */ |
| 5070 | | for (curscan = work->startscanline; curscan < endscanline; curscan += SCANLINES_PER_WORK) |
| 5071 | | { |
| 5072 | | int extnum; |
| 5073 | | |
| 5074 | | /* fill in the work unit basics */ |
| 5075 | | unit->work = work; |
| 5076 | | unit->scanline = curscan; |
| 5077 | | unit->count = MIN(endscanline - curscan, SCANLINES_PER_WORK); |
| 5078 | | |
| 5079 | | /* iterate over extents */ |
| 5080 | | for (extnum = 0; extnum < unit->count; extnum++) |
| 5081 | | { |
| 5082 | | INT32 fully = ((curscan + extnum) << 4) + 8; |
| 5083 | | INT32 startx = minx + (((fully - miny) * dxdy_minmax) >> 16); |
| 5084 | | INT32 stopx; |
| 5085 | | |
| 5086 | | /* compute the ending X based on which part of the triangle we're in */ |
| 5087 | | if (fully < midy) |
| 5088 | | stopx = minx + (((fully - miny) * dxdy_minmid) >> 16); |
| 5089 | | else |
| 5090 | | stopx = midx + (((fully - midy) * dxdy_midmax) >> 16); |
| 5091 | | |
| 5092 | | /* clamp to full pixels */ |
| 5093 | | startx = (startx + 7) >> 4; |
| 5094 | | stopx = (stopx + 7) >> 4; |
| 5095 | | |
| 5096 | | /* force start < stop */ |
| 5097 | | if (startx > stopx) |
| 5098 | | { |
| 5099 | | int temp = startx; |
| 5100 | | startx = stopx; |
| 5101 | | stopx = temp; |
| 5102 | | } |
| 5103 | | |
| 5104 | | /* set the extent and update the total pixel count */ |
| 5105 | | unit->extent[extnum].startx = startx; |
| 5106 | | unit->extent[extnum].stopx = stopx; |
| 5107 | | pixels += stopx - startx; |
| 5108 | | } |
| 5109 | | unit++; |
| 5110 | | } |
| 5111 | | |
| 5112 | | /* copy data */ |
| 5113 | | work->ax = v->fbi.ax; |
| 5114 | | work->ay = v->fbi.ay; |
| 5115 | | work->startr = v->fbi.startr; |
| 5116 | | work->startg = v->fbi.startg; |
| 5117 | | work->startb = v->fbi.startb; |
| 5118 | | work->starta = v->fbi.starta; |
| 5119 | | work->startz = v->fbi.startz; |
| 5120 | | work->startw = v->fbi.startw; |
| 5121 | | work->drdx = v->fbi.drdx; |
| 5122 | | work->dgdx = v->fbi.dgdx; |
| 5123 | | work->dbdx = v->fbi.dbdx; |
| 5124 | | work->dadx = v->fbi.dadx; |
| 5125 | | work->dzdx = v->fbi.dzdx; |
| 5126 | | work->dwdx = v->fbi.dwdx; |
| 5127 | | work->drdy = v->fbi.drdy; |
| 5128 | | work->dgdy = v->fbi.dgdy; |
| 5129 | | work->dbdy = v->fbi.dbdy; |
| 5130 | | work->dady = v->fbi.dady; |
| 5131 | | work->dzdy = v->fbi.dzdy; |
| 5132 | | work->dwdy = v->fbi.dwdy; |
| 5025 | /* fill in texture 0 parameters */ |
| 5133 | 5026 | if (texcount > 0) |
| 5134 | 5027 | { |
| 5135 | | work->starts0 = v->tmu[0].starts; |
| 5136 | | work->startt0 = v->tmu[0].startt; |
| 5137 | | work->startw0 = v->tmu[0].startw; |
| 5138 | | work->ds0dx = v->tmu[0].dsdx; |
| 5139 | | work->dt0dx = v->tmu[0].dtdx; |
| 5140 | | work->dw0dx = v->tmu[0].dwdx; |
| 5141 | | work->ds0dy = v->tmu[0].dsdy; |
| 5142 | | work->dt0dy = v->tmu[0].dtdy; |
| 5143 | | work->dw0dy = v->tmu[0].dwdy; |
| 5028 | extra->starts0 = v->tmu[0].starts; |
| 5029 | extra->startt0 = v->tmu[0].startt; |
| 5030 | extra->startw0 = v->tmu[0].startw; |
| 5031 | extra->ds0dx = v->tmu[0].dsdx; |
| 5032 | extra->dt0dx = v->tmu[0].dtdx; |
| 5033 | extra->dw0dx = v->tmu[0].dwdx; |
| 5034 | extra->ds0dy = v->tmu[0].dsdy; |
| 5035 | extra->dt0dy = v->tmu[0].dtdy; |
| 5036 | extra->dw0dy = v->tmu[0].dwdy; |
| 5037 | extra->lodbase0 = prepare_tmu(&v->tmu[0]); |
| 5038 | v->stats.texture_mode[TEXMODE_FORMAT(v->tmu[0].reg[textureMode].u)]++; |
| 5039 | |
| 5040 | /* fill in texture 1 parameters */ |
| 5144 | 5041 | if (texcount > 1) |
| 5145 | 5042 | { |
| 5146 | | work->starts1 = v->tmu[1].starts; |
| 5147 | | work->startt1 = v->tmu[1].startt; |
| 5148 | | work->startw1 = v->tmu[1].startw; |
| 5149 | | work->ds1dx = v->tmu[1].dsdx; |
| 5150 | | work->dt1dx = v->tmu[1].dtdx; |
| 5151 | | work->dw1dx = v->tmu[1].dwdx; |
| 5152 | | work->ds1dy = v->tmu[1].dsdy; |
| 5153 | | work->dt1dy = v->tmu[1].dtdy; |
| 5154 | | work->dw1dy = v->tmu[1].dwdy; |
| 5043 | extra->starts1 = v->tmu[1].starts; |
| 5044 | extra->startt1 = v->tmu[1].startt; |
| 5045 | extra->startw1 = v->tmu[1].startw; |
| 5046 | extra->ds1dx = v->tmu[1].dsdx; |
| 5047 | extra->dt1dx = v->tmu[1].dtdx; |
| 5048 | extra->dw1dx = v->tmu[1].dwdx; |
| 5049 | extra->ds1dy = v->tmu[1].dsdy; |
| 5050 | extra->dt1dy = v->tmu[1].dtdy; |
| 5051 | extra->dw1dy = v->tmu[1].dwdy; |
| 5052 | extra->lodbase1 = prepare_tmu(&v->tmu[1]); |
| 5053 | v->stats.texture_mode[TEXMODE_FORMAT(v->tmu[1].reg[textureMode].u)]++; |
| 5155 | 5054 | } |
| 5156 | 5055 | } |
| 5157 | 5056 | |
| 5158 | 5057 | /* farm the rasterization out to other threads */ |
| 5159 | | work->callback = info->callback; |
| 5160 | | work->drawbuf = drawbuf; |
| 5161 | | work->info = info; |
| 5162 | | work_item_enqueue(v, work, unit - work->unit); |
| 5163 | | |
| 5164 | | /* update statistics */ |
| 5165 | 5058 | info->polys++; |
| 5166 | | return pixels; |
| 5059 | return poly_render_triangle(v->poly, drawbuf, NULL, info->callback, 0, &vert[0], &vert[1], &vert[2]); |
| 5167 | 5060 | } |
| 5168 | 5061 | |
| 5169 | 5062 | |
| r1185 | r1186 | |
| 5318 | 5211 | implementation of the 'fastfill' command |
| 5319 | 5212 | -------------------------------------------------*/ |
| 5320 | 5213 | |
| 5321 | | static void raster_fastfill(work_info *work, INT32 scanline, INT32 startx, INT32 stopx) |
| 5214 | static void raster_fastfill(void *destbase, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid) |
| 5322 | 5215 | { |
| 5323 | | voodoo_state *v = work->state; |
| 5216 | poly_extra_data *extra = poly->extra; |
| 5217 | voodoo_state *v = extra->state; |
| 5218 | stats_block *stats = &v->thread_stats[threadid]; |
| 5324 | 5219 | int scry, x; |
| 5325 | 5220 | |
| 5326 | 5221 | /* determine the screen Y */ |
| r1185 | r1186 | |
| 5331 | 5226 | /* fill this RGB row */ |
| 5332 | 5227 | if (FBZMODE_RGB_BUFFER_MASK(v->reg[fbzMode].u)) |
| 5333 | 5228 | { |
| 5334 | | UINT16 *ditherow = &work->dither[(scanline & 3) * 4]; |
| 5335 | | UINT16 *dest = work->drawbuf + scry * v->fbi.rowpixels; |
| 5229 | UINT16 *ditherow = &extra->dither[(scanline & 3) * 4]; |
| 5230 | UINT64 expanded = *(UINT64 *)ditherow; |
| 5231 | UINT16 *dest = (UINT16 *)destbase + scry * v->fbi.rowpixels; |
| 5336 | 5232 | |
| 5337 | | for (x = startx; x < stopx; x++) |
| 5233 | for (x = startx; x < stopx && (x & 3) != 0; x++) |
| 5338 | 5234 | dest[x] = ditherow[x & 3]; |
| 5235 | for ( ; x < (stopx & ~3); x += 4) |
| 5236 | *(UINT64 *)&dest[x] = expanded; |
| 5237 | for ( ; x < stopx; x++) |
| 5238 | dest[x] = ditherow[x & 3]; |
| 5239 | stats->pixels_out += stopx - startx; |
| 5339 | 5240 | } |
| 5340 | 5241 | |
| 5341 | 5242 | /* fill this dest buffer row */ |
| 5342 | 5243 | if (FBZMODE_AUX_BUFFER_MASK(v->reg[fbzMode].u) && v->fbi.aux) |
| 5343 | 5244 | { |
| 5344 | 5245 | UINT16 color = v->reg[zaColor].u; |
| 5246 | UINT64 expanded = ((UINT64)color << 48) | ((UINT64)color << 32) | (color << 16) | color; |
| 5345 | 5247 | UINT16 *dest = v->fbi.aux + scry * v->fbi.rowpixels; |
| 5346 | 5248 | |
| 5347 | | for (x = startx; x < stopx; x++) |
| 5249 | for (x = startx; x < stopx && (x & 3) != 0; x++) |
| 5348 | 5250 | dest[x] = color; |
| 5251 | for ( ; x < (stopx & ~3); x += 4) |
| 5252 | *(UINT64 *)&dest[x] = expanded; |
| 5253 | for ( ; x < stopx; x++) |
| 5254 | dest[x] = color; |
| 5349 | 5255 | } |
| 5350 | 5256 | } |
| 5351 | 5257 | |
src/emu/video/vooddefs.h
| r1185 | r1186 | |
| 24 | 24 | /* maximum number of TMUs */ |
| 25 | 25 | #define MAX_TMU 2 |
| 26 | 26 | |
| 27 | | /* scanlines per work item */ |
| 28 | | #define SCANLINES_PER_WORK 4 |
| 29 | | |
| 30 | 27 | /* accumulate operations less than this number of clocks */ |
| 31 | 28 | #define ACCUMULATE_THRESHOLD 0 |
| 32 | 29 | |
| r1185 | r1186 | |
| 1336 | 1333 | *************************************/ |
| 1337 | 1334 | |
| 1338 | 1335 | typedef struct _voodoo_state voodoo_state; |
| 1339 | | typedef struct _work_info work_info; |
| 1336 | typedef struct _poly_extra_data poly_extra_data; |
| 1340 | 1337 | |
| 1341 | 1338 | |
| 1342 | 1339 | typedef struct _rgba rgba; |
| r1185 | r1186 | |
| 1363 | 1360 | typedef voodoo_reg rgb_union; |
| 1364 | 1361 | |
| 1365 | 1362 | |
| 1363 | typedef struct _voodoo_stats voodoo_stats; |
| 1364 | struct _voodoo_stats |
| 1365 | { |
| 1366 | UINT8 lastkey; /* last key state */ |
| 1367 | UINT8 display; /* display stats? */ |
| 1368 | INT32 swaps; /* total swaps */ |
| 1369 | INT32 stalls; /* total stalls */ |
| 1370 | INT32 total_triangles; /* total triangles */ |
| 1371 | INT32 total_pixels_in; /* total pixels in */ |
| 1372 | INT32 total_pixels_out; /* total pixels out */ |
| 1373 | INT32 total_chroma_fail; /* total chroma fail */ |
| 1374 | INT32 total_zfunc_fail; /* total z func fail */ |
| 1375 | INT32 total_afunc_fail; /* total a func fail */ |
| 1376 | INT32 total_clipped; /* total clipped */ |
| 1377 | INT32 total_stippled; /* total stippled */ |
| 1378 | INT32 lfb_writes; /* LFB writes */ |
| 1379 | INT32 lfb_reads; /* LFB reads */ |
| 1380 | INT32 reg_writes; /* register writes */ |
| 1381 | INT32 reg_reads; /* register reads */ |
| 1382 | INT32 tex_writes; /* texture writes */ |
| 1383 | INT32 texture_mode[16]; /* 16 different texture modes */ |
| 1384 | UINT8 render_override; /* render override */ |
| 1385 | char buffer[1024]; /* string */ |
| 1386 | }; |
| 1387 | |
| 1388 | |
| 1389 | /* note that this structure is an even 32 bytes long */ |
| 1390 | typedef struct _stats_block stats_block; |
| 1391 | struct _stats_block |
| 1392 | { |
| 1393 | INT32 pixels_in; /* pixels in statistic */ |
| 1394 | INT32 pixels_out; /* pixels out statistic */ |
| 1395 | INT32 chroma_fail; /* chroma test fail statistic */ |
| 1396 | INT32 zfunc_fail; /* z function test fail statistic */ |
| 1397 | INT32 afunc_fail; /* alpha function test fail statistic */ |
| 1398 | INT32 clip_fail; /* clipping fail statistic */ |
| 1399 | INT32 stipple_count; /* stipple statistic */ |
| 1400 | INT32 filler[64/4 - 7]; /* pad this structure to 64 bytes */ |
| 1401 | }; |
| 1402 | |
| 1403 | |
| 1366 | 1404 | typedef struct _fifo_state fifo_state; |
| 1367 | 1405 | struct _fifo_state |
| 1368 | 1406 | { |
| r1185 | r1186 | |
| 1392 | 1430 | struct _pci_state |
| 1393 | 1431 | { |
| 1394 | 1432 | fifo_state fifo; /* PCI FIFO */ |
| 1395 | | UINT32 fifo_mem[64*2]; /* memory backing the PCI FIFO */ |
| 1396 | 1433 | UINT32 init_enable; /* initEnable value */ |
| 1397 | 1434 | UINT8 stall_state; /* state of the system if we're stalled */ |
| 1398 | 1435 | void (*stall_callback)(int); /* callback for stalling/unstalling */ |
| 1399 | 1436 | UINT8 op_pending; /* true if an operation is pending */ |
| 1400 | 1437 | mame_time op_end_time; /* time when the pending operation ends */ |
| 1401 | 1438 | mame_timer *continue_timer; /* timer to use to continue processing */ |
| 1439 | UINT32 fifo_mem[64*2]; /* memory backing the PCI FIFO */ |
| 1402 | 1440 | }; |
| 1403 | 1441 | |
| 1404 | 1442 | |
| r1185 | r1186 | |
| 1410 | 1448 | INT32 ir[4], ig[4], ib[4]; /* I values for R,G,B */ |
| 1411 | 1449 | INT32 qr[4], qg[4], qb[4]; /* Q values for R,G,B */ |
| 1412 | 1450 | INT32 y[16]; /* Y values */ |
| 1413 | | rgb_t texel[256]; /* texel lookup */ |
| 1414 | 1451 | rgb_t * palette; /* pointer to associated RGB palette */ |
| 1415 | 1452 | rgb_t * palettea; /* pointer to associated ARGB palette */ |
| 1453 | rgb_t texel[256]; /* texel lookup */ |
| 1416 | 1454 | }; |
| 1417 | 1455 | |
| 1418 | 1456 | |
| r1185 | r1186 | |
| 1438 | 1476 | INT32 lodbias; /* LOD bias */ |
| 1439 | 1477 | UINT32 lodmask; /* mask of available LODs */ |
| 1440 | 1478 | UINT32 lodoffset[9]; /* offset of texture base for each LOD */ |
| 1441 | | INT32 lodbase; /* used during rasterization */ |
| 1442 | 1479 | INT32 detailmax; /* detail clamp */ |
| 1443 | 1480 | INT32 detailbias; /* detail bias */ |
| 1444 | 1481 | UINT8 detailscale; /* detail scale */ |
| r1185 | r1186 | |
| 1512 | 1549 | UINT32 tile_height; /* height of video tiles */ |
| 1513 | 1550 | UINT32 x_tiles; /* number of tiles in the X direction */ |
| 1514 | 1551 | |
| 1515 | | rgb_t pen[65536]; /* mapping from pixels to pens */ |
| 1516 | | rgb_t clut[512]; /* clut gamma data */ |
| 1517 | | UINT8 clut_dirty; /* do we need to recompute? */ |
| 1518 | | |
| 1519 | 1552 | mame_timer *vblank_timer; /* VBLANK timer */ |
| 1520 | 1553 | UINT8 vblank; /* VBLANK state */ |
| 1521 | 1554 | UINT8 vblank_count; /* number of VBLANKs since last swap */ |
| r1185 | r1186 | |
| 1524 | 1557 | UINT8 vblank_dont_swap; /* don't actually swap when we hit this point */ |
| 1525 | 1558 | void (*vblank_client)(int); /* client callback */ |
| 1526 | 1559 | |
| 1527 | | fifo_state fifo; /* framebuffer memory fifo */ |
| 1528 | | cmdfifo_info cmdfifo[2]; /* command FIFOs */ |
| 1529 | | |
| 1530 | | UINT8 fogblend[64]; /* 64-entry fog table */ |
| 1531 | | UINT8 fogdelta[64]; /* 64-entry fog table */ |
| 1532 | | UINT8 fogdelta_mask; /* mask for for delta (0xff for V1, 0xfc for V2) */ |
| 1533 | | |
| 1534 | 1560 | /* triangle setup info */ |
| 1535 | 1561 | UINT8 cheating_allowed; /* allow cheating? */ |
| 1536 | 1562 | INT32 sign; /* triangle sign */ |
| r1185 | r1186 | |
| 1547 | 1573 | INT32 dzdy; /* delta Z per Y */ |
| 1548 | 1574 | INT64 dwdy; /* delta W per Y */ |
| 1549 | 1575 | |
| 1576 | stats_block lfb_stats; /* LFB-access statistics */ |
| 1577 | |
| 1550 | 1578 | UINT8 sverts; /* number of vertices ready */ |
| 1551 | 1579 | setup_vertex svert[3]; /* 3 setup vertices */ |
| 1580 | |
| 1581 | fifo_state fifo; /* framebuffer memory fifo */ |
| 1582 | cmdfifo_info cmdfifo[2]; /* command FIFOs */ |
| 1583 | |
| 1584 | UINT8 fogblend[64]; /* 64-entry fog table */ |
| 1585 | UINT8 fogdelta[64]; /* 64-entry fog table */ |
| 1586 | UINT8 fogdelta_mask; /* mask for for delta (0xff for V1, 0xfc for V2) */ |
| 1587 | |
| 1588 | rgb_t pen[65536]; /* mapping from pixels to pens */ |
| 1589 | rgb_t clut[512]; /* clut gamma data */ |
| 1590 | UINT8 clut_dirty; /* do we need to recompute? */ |
| 1552 | 1591 | }; |
| 1553 | 1592 | |
| 1554 | 1593 | |
| r1185 | r1186 | |
| 1560 | 1599 | }; |
| 1561 | 1600 | |
| 1562 | 1601 | |
| 1563 | | typedef struct _voodoo_stats voodoo_stats; |
| 1564 | | struct _voodoo_stats |
| 1565 | | { |
| 1566 | | char buffer[1024]; /* string */ |
| 1567 | | UINT8 lastkey; /* last key state */ |
| 1568 | | UINT8 display; /* display stats? */ |
| 1569 | | INT32 swaps; /* total swaps */ |
| 1570 | | INT32 stalls; /* total stalls */ |
| 1571 | | INT32 total_triangles; /* total triangles */ |
| 1572 | | INT32 total_pixels_in; /* total pixels in */ |
| 1573 | | INT32 total_pixels_out; /* total pixels out */ |
| 1574 | | INT32 total_chroma_fail; /* total chroma fail */ |
| 1575 | | INT32 total_zfunc_fail; /* total z func fail */ |
| 1576 | | INT32 total_afunc_fail; /* total a func fail */ |
| 1577 | | INT32 total_clipped; /* total clipped */ |
| 1578 | | INT32 total_stippled; /* total stippled */ |
| 1579 | | INT32 lfb_writes; /* LFB writes */ |
| 1580 | | INT32 lfb_reads; /* LFB reads */ |
| 1581 | | INT32 reg_writes; /* register writes */ |
| 1582 | | INT32 reg_reads; /* register reads */ |
| 1583 | | INT32 tex_writes; /* texture writes */ |
| 1584 | | INT32 texture_mode[16]; /* 16 different texture modes */ |
| 1585 | | UINT8 render_override; /* render override */ |
| 1586 | | }; |
| 1587 | | |
| 1588 | | |
| 1589 | | typedef void (*raster_callback)(work_info *, INT32, INT32, INT32); |
| 1590 | | |
| 1591 | | |
| 1592 | 1602 | typedef struct _raster_info raster_info; |
| 1593 | 1603 | struct _raster_info |
| 1594 | 1604 | { |
| 1595 | 1605 | struct _raster_info *next; /* pointer to next entry with the same hash */ |
| 1596 | | raster_callback callback; /* callback pointer */ |
| 1606 | poly_draw_scanline callback; /* callback pointer */ |
| 1597 | 1607 | UINT8 is_generic; /* TRUE if this is one of the generic rasterizers */ |
| 1598 | 1608 | UINT8 display; /* display index */ |
| 1599 | 1609 | UINT32 hits; /* how many hits (pixels) we've used this for */ |
| r1185 | r1186 | |
| 1607 | 1617 | }; |
| 1608 | 1618 | |
| 1609 | 1619 | |
| 1610 | | typedef struct _work_unit work_unit; |
| 1611 | | struct _work_unit |
| 1620 | struct _poly_extra_data |
| 1612 | 1621 | { |
| 1613 | | work_info *work; /* pointer back to the work info */ |
| 1614 | | INT16 scanline, count; /* starting scanline and count */ |
| 1615 | | struct |
| 1616 | | { |
| 1617 | | INT32 startx, stopx; /* starting/ending X points for each scanline */ |
| 1618 | | } extent[SCANLINES_PER_WORK]; |
| 1619 | | }; |
| 1620 | | |
| 1621 | | |
| 1622 | | struct _work_info |
| 1623 | | { |
| 1624 | 1622 | voodoo_state *state; /* pointer back to the voodoo state */ |
| 1625 | | |
| 1626 | | raster_callback callback; /* callback to handle a scanline's worth of work */ |
| 1627 | | UINT16 * drawbuf; /* pointer to render buffer */ |
| 1628 | | |
| 1629 | | INT32 startscanline; /* starting scanline */ |
| 1630 | | |
| 1631 | | UINT16 dither[16]; /* dither matrix, for fastfill */ |
| 1632 | | |
| 1633 | | INT32 start_pixels_in; /* starting fbiPixelsIn value */ |
| 1634 | | INT32 start_pixels_out; /* starting fbiPixelsOut value */ |
| 1635 | | INT32 start_chroma_fail; /* starting fbiChromaFail value */ |
| 1636 | | INT32 start_zfunc_fail; /* starting fbiZfuncFail value */ |
| 1637 | | INT32 start_afunc_fail; /* starting fbiAfuncFail value */ |
| 1638 | 1623 | raster_info *info; /* pointer to rasterizer information */ |
| 1639 | 1624 | |
| 1640 | 1625 | INT16 ax, ay; /* vertex A x,y (12.4) */ |
| r1185 | r1186 | |
| 1654 | 1639 | INT64 dw0dx; /* delta W per X */ |
| 1655 | 1640 | INT64 ds0dy, dt0dy; /* delta S,T per Y */ |
| 1656 | 1641 | INT64 dw0dy; /* delta W per Y */ |
| 1642 | INT32 lodbase0; /* used during rasterization */ |
| 1657 | 1643 | |
| 1658 | 1644 | INT64 starts1, startt1; /* starting S,T (14.18) */ |
| 1659 | 1645 | INT64 startw1; /* starting W (2.30) */ |
| r1185 | r1186 | |
| 1661 | 1647 | INT64 dw1dx; /* delta W per X */ |
| 1662 | 1648 | INT64 ds1dy, dt1dy; /* delta S,T per Y */ |
| 1663 | 1649 | INT64 dw1dy; /* delta W per Y */ |
| 1650 | INT32 lodbase1; /* used during rasterization */ |
| 1664 | 1651 | |
| 1665 | | work_unit unit[4100/SCANLINES_PER_WORK]; /* individual work units */ |
| 1652 | UINT16 dither[16]; /* dither matrix, for fastfill */ |
| 1666 | 1653 | }; |
| 1667 | 1654 | |
| 1668 | 1655 | |
| r1185 | r1186 | |
| 1705 | 1692 | tmu_shared_state tmushare; /* TMU shared state */ |
| 1706 | 1693 | banshee_info banshee; /* Banshee state */ |
| 1707 | 1694 | |
| 1708 | | work_info work; /* work queue management */ |
| 1709 | | osd_work_queue *work_queue; /* work queue for offloading rasterization */ |
| 1695 | poly_manager *poly; /* polygon manager */ |
| 1696 | stats_block *thread_stats; /* per-thread statistics */ |
| 1710 | 1697 | |
| 1711 | 1698 | voodoo_stats stats; /* internal statistics */ |
| 1712 | 1699 | |
| r1185 | r1186 | |
| 2212 | 2199 | * |
| 2213 | 2200 | *************************************/ |
| 2214 | 2201 | |
| 2215 | | #define APPLY_CHROMAKEY(VV, FBZMODE, COLOR) \ |
| 2202 | #define APPLY_CHROMAKEY(VV, STATS, FBZMODE, COLOR) \ |
| 2216 | 2203 | do \ |
| 2217 | 2204 | { \ |
| 2218 | 2205 | if (FBZMODE_ENABLE_CHROMAKEY(FBZMODE)) \ |
| r1185 | r1186 | |
| 2222 | 2209 | { \ |
| 2223 | 2210 | if (((COLOR.u ^ (VV)->reg[chromaKey].u) & 0xffffff) == 0) \ |
| 2224 | 2211 | { \ |
| 2225 | | chromafail++; \ |
| 2212 | (STATS)->chroma_fail++; \ |
| 2226 | 2213 | goto skipdrawdepth; \ |
| 2227 | 2214 | } \ |
| 2228 | 2215 | } \ |
| r1185 | r1186 | |
| 2261 | 2248 | { \ |
| 2262 | 2249 | if (results != 0) \ |
| 2263 | 2250 | { \ |
| 2264 | | chromafail++; \ |
| 2251 | (STATS)->chroma_fail++; \ |
| 2265 | 2252 | goto skipdrawdepth; \ |
| 2266 | 2253 | } \ |
| 2267 | 2254 | } \ |
| r1185 | r1186 | |
| 2269 | 2256 | { \ |
| 2270 | 2257 | if (results == 7) \ |
| 2271 | 2258 | { \ |
| 2272 | | chromafail++; \ |
| 2259 | (STATS)->chroma_fail++; \ |
| 2273 | 2260 | goto skipdrawdepth; \ |
| 2274 | 2261 | } \ |
| 2275 | 2262 | } \ |
| r1185 | r1186 | |
| 2286 | 2273 | * |
| 2287 | 2274 | *************************************/ |
| 2288 | 2275 | |
| 2289 | | #define APPLY_ALPHAMASK(VV, FBZMODE, AA) \ |
| 2276 | #define APPLY_ALPHAMASK(VV, STATS, FBZMODE, AA) \ |
| 2290 | 2277 | do \ |
| 2291 | 2278 | { \ |
| 2292 | 2279 | if (FBZMODE_ENABLE_ALPHA_MASK(FBZMODE)) \ |
| 2293 | 2280 | { \ |
| 2294 | 2281 | if (((AA) & 1) == 0) \ |
| 2295 | 2282 | { \ |
| 2296 | | afail++; \ |
| 2283 | (STATS)->afunc_fail++; \ |
| 2297 | 2284 | goto skipdrawdepth; \ |
| 2298 | 2285 | } \ |
| 2299 | 2286 | } \ |
| r1185 | r1186 | |
| 2308 | 2295 | * |
| 2309 | 2296 | *************************************/ |
| 2310 | 2297 | |
| 2311 | | #define APPLY_ALPHATEST(VV, ALPHAMODE, AA) \ |
| 2298 | #define APPLY_ALPHATEST(VV, STATS, ALPHAMODE, AA) \ |
| 2312 | 2299 | do \ |
| 2313 | 2300 | { \ |
| 2314 | 2301 | if (ALPHAMODE_ALPHATEST(ALPHAMODE)) \ |
| 2315 | 2302 | { \ |
| 2303 | UINT8 alpharef = (VV)->reg[alphaMode].rgb.a; \ |
| 2316 | 2304 | switch (ALPHAMODE_ALPHAFUNCTION(ALPHAMODE)) \ |
| 2317 | 2305 | { \ |
| 2318 | 2306 | case 0: /* alphaOP = never */ \ |
| 2319 | | afail++; \ |
| 2307 | (STATS)->afunc_fail++; \ |
| 2320 | 2308 | goto skipdrawdepth; \ |
| 2321 | 2309 | \ |
| 2322 | 2310 | case 1: /* alphaOP = less than */ \ |
| 2323 | | if ((AA) >= v->reg[alphaMode].rgb.a) \ |
| 2311 | if ((AA) >= alpharef) \ |
| 2324 | 2312 | { \ |
| 2325 | | afail++; \ |
| 2313 | (STATS)->afunc_fail++; \ |
| 2326 | 2314 | goto skipdrawdepth; \ |
| 2327 | 2315 | } \ |
| 2328 | 2316 | break; \ |
| 2329 | 2317 | \ |
| 2330 | 2318 | case 2: /* alphaOP = equal */ \ |
| 2331 | | if ((AA) != v->reg[alphaMode].rgb.a) \ |
| 2319 | if ((AA) != alpharef) \ |
| 2332 | 2320 | { \ |
| 2333 | | afail++; \ |
| 2321 | (STATS)->afunc_fail++; \ |
| 2334 | 2322 | goto skipdrawdepth; \ |
| 2335 | 2323 | } \ |
| 2336 | 2324 | break; \ |
| 2337 | 2325 | \ |
| 2338 | 2326 | case 3: /* alphaOP = less than or equal */ \ |
| 2339 | | if ((AA) > v->reg[alphaMode].rgb.a) \ |
| 2327 | if ((AA) > alpharef) \ |
| 2340 | 2328 | { \ |
| 2341 | | afail++; \ |
| 2329 | (STATS)->afunc_fail++; \ |
| 2342 | 2330 | goto skipdrawdepth; \ |
| 2343 | 2331 | } \ |
| 2344 | 2332 | break; \ |
| 2345 | 2333 | \ |
| 2346 | 2334 | case 4: /* alphaOP = greater than */ \ |
| 2347 | | if ((AA) <= v->reg[alphaMode].rgb.a) \ |
| 2335 | if ((AA) <= alpharef) \ |
| 2348 | 2336 | { \ |
| 2349 | | afail++; \ |
| 2337 | (STATS)->afunc_fail++; \ |
| 2350 | 2338 | goto skipdrawdepth; \ |
| 2351 | 2339 | } \ |
| 2352 | 2340 | break; \ |
| 2353 | 2341 | \ |
| 2354 | 2342 | case 5: /* alphaOP = not equal */ \ |
| 2355 | | if ((AA) == v->reg[alphaMode].rgb.a) \ |
| 2343 | if ((AA) == alpharef) \ |
| 2356 | 2344 | { \ |
| 2357 | | afail++; \ |
| 2345 | (STATS)->afunc_fail++; \ |
| 2358 | 2346 | goto skipdrawdepth; \ |
| 2359 | 2347 | } \ |
| 2360 | 2348 | break; \ |
| 2361 | 2349 | \ |
| 2362 | 2350 | case 6: /* alphaOP = greater than or equal */ \ |
| 2363 | | if ((AA) < v->reg[alphaMode].rgb.a) \ |
| 2351 | if ((AA) < alpharef) \ |
| 2364 | 2352 | { \ |
| 2365 | | afail++; \ |
| 2353 | (STATS)->afunc_fail++; \ |
| 2366 | 2354 | goto skipdrawdepth; \ |
| 2367 | 2355 | } \ |
| 2368 | 2356 | break; \ |
| r1185 | r1186 | |
| 2552 | 2540 | { \ |
| 2553 | 2541 | if (FOGMODE_ENABLE_FOG(FOGMODE)) \ |
| 2554 | 2542 | { \ |
| 2543 | rgb_union fogcolor = (VV)->reg[fogColor]; \ |
| 2555 | 2544 | INT32 fr, fg, fb; \ |
| 2556 | 2545 | \ |
| 2557 | 2546 | /* constant fog bypasses everything else */ \ |
| 2558 | 2547 | if (FOGMODE_FOG_CONSTANT(FOGMODE)) \ |
| 2559 | 2548 | { \ |
| 2560 | | fr = (VV)->reg[fogColor].rgb.r; \ |
| 2561 | | fg = (VV)->reg[fogColor].rgb.g; \ |
| 2562 | | fb = (VV)->reg[fogColor].rgb.b; \ |
| 2549 | fr = fogcolor.rgb.r; \ |
| 2550 | fg = fogcolor.rgb.g; \ |
| 2551 | fb = fogcolor.rgb.b; \ |
| 2563 | 2552 | } \ |
| 2564 | 2553 | \ |
| 2565 | 2554 | /* non-constant fog comes from several sources */ \ |
| r1185 | r1186 | |
| 2570 | 2559 | /* if fog_add is zero, we start with the fog color */ \ |
| 2571 | 2560 | if (FOGMODE_FOG_ADD(FOGMODE) == 0) \ |
| 2572 | 2561 | { \ |
| 2573 | | fr = (VV)->reg[fogColor].rgb.r; \ |
| 2574 | | fg = (VV)->reg[fogColor].rgb.g; \ |
| 2575 | | fb = (VV)->reg[fogColor].rgb.b; \ |
| 2562 | fr = fogcolor.rgb.r; \ |
| 2563 | fg = fogcolor.rgb.g; \ |
| 2564 | fb = fogcolor.rgb.b; \ |
| 2576 | 2565 | } \ |
| 2577 | 2566 | else \ |
| 2578 | 2567 | fr = fg = fb = 0; \ |
| r1185 | r1186 | |
| 3022 | 3011 | * |
| 3023 | 3012 | *************************************/ |
| 3024 | 3013 | |
| 3025 | | #define PIXEL_PIPELINE_BEGIN(VV, XX, YY, FBZCOLORPATH, FBZMODE, ITERZ, ITERW) \ |
| 3014 | #define PIXEL_PIPELINE_BEGIN(VV, STATS, XX, YY, FBZCOLORPATH, FBZMODE, ITERZ, ITERW) \ |
| 3026 | 3015 | do \ |
| 3027 | 3016 | { \ |
| 3028 | 3017 | INT32 depthval, wfloat; \ |
| 3029 | 3018 | INT32 prefogr, prefogg, prefogb; \ |
| 3030 | 3019 | INT32 r, g, b, a; \ |
| 3031 | 3020 | \ |
| 3032 | | pixin++; \ |
| 3021 | (STATS)->pixels_in++; \ |
| 3033 | 3022 | \ |
| 3034 | 3023 | /* apply clipping */ \ |
| 3035 | 3024 | /* note that for perf reasons, we assume the caller has done clipping */ \ |
| 3036 | 3025 | \ |
| 3037 | | /* rotate stipple pattern */ \ |
| 3038 | | if (FBZMODE_STIPPLE_PATTERN(FBZMODE) == 0) \ |
| 3039 | | (VV)->reg[stipple].u = ((VV)->reg[stipple].u << 1) | ((VV)->reg[stipple].u >> 31);\ |
| 3040 | | \ |
| 3041 | 3026 | /* handle stippling */ \ |
| 3042 | 3027 | if (FBZMODE_ENABLE_STIPPLE(FBZMODE)) \ |
| 3043 | 3028 | { \ |
| 3044 | 3029 | /* rotate mode */ \ |
| 3045 | 3030 | if (FBZMODE_STIPPLE_PATTERN(FBZMODE) == 0) \ |
| 3046 | 3031 | { \ |
| 3032 | (VV)->reg[stipple].u = ((VV)->reg[stipple].u << 1) | ((VV)->reg[stipple].u >> 31);\ |
| 3047 | 3033 | if (((VV)->reg[stipple].u & 0x80000000) == 0) \ |
| 3048 | 3034 | { \ |
| 3049 | | v->stats.total_stippled++; \ |
| 3035 | (VV)->stats.total_stippled++; \ |
| 3050 | 3036 | goto skipdrawdepth; \ |
| 3051 | 3037 | } \ |
| 3052 | 3038 | } \ |
| r1185 | r1186 | |
| 3057 | 3043 | int stipple_index = (((YY) & 3) << 3) | (~(XX) & 7); \ |
| 3058 | 3044 | if ((((VV)->reg[stipple].u >> stipple_index) & 1) == 0) \ |
| 3059 | 3045 | { \ |
| 3060 | | v->stats.total_stippled++; \ |
| 3046 | (VV)->stats.total_stippled++; \ |
| 3061 | 3047 | goto skipdrawdepth; \ |
| 3062 | 3048 | } \ |
| 3063 | 3049 | } \ |
| r1185 | r1186 | |
| 3103 | 3089 | /* add the bias */ \ |
| 3104 | 3090 | if (FBZMODE_ENABLE_DEPTH_BIAS(FBZMODE)) \ |
| 3105 | 3091 | { \ |
| 3106 | | depthval += (INT16)v->reg[zaColor].u; \ |
| 3092 | depthval += (INT16)(VV)->reg[zaColor].u; \ |
| 3107 | 3093 | CLAMP(depthval, 0, 0xffff); \ |
| 3108 | 3094 | } \ |
| 3109 | 3095 | \ |
| r1185 | r1186 | |
| 3117 | 3103 | if (FBZMODE_DEPTH_SOURCE_COMPARE(FBZMODE) == 0) \ |
| 3118 | 3104 | depthsource = depthval; \ |
| 3119 | 3105 | else \ |
| 3120 | | depthsource = v->reg[zaColor].u & 0xffff; \ |
| 3106 | depthsource = (UINT16)(VV)->reg[zaColor].u; \ |
| 3121 | 3107 | \ |
| 3122 | 3108 | /* test against the depth buffer */ \ |
| 3123 | 3109 | switch (FBZMODE_DEPTH_FUNCTION(FBZMODE)) \ |
| 3124 | 3110 | { \ |
| 3125 | 3111 | case 0: /* depthOP = never */ \ |
| 3126 | | zfail++; \ |
| 3112 | (STATS)->zfunc_fail++; \ |
| 3127 | 3113 | goto skipdrawdepth; \ |
| 3128 | 3114 | \ |
| 3129 | 3115 | case 1: /* depthOP = less than */ \ |
| 3130 | 3116 | if (depthsource >= depth[XX]) \ |
| 3131 | 3117 | { \ |
| 3132 | | zfail++; \ |
| 3118 | (STATS)->zfunc_fail++; \ |
| 3133 | 3119 | goto skipdrawdepth; \ |
| 3134 | 3120 | } \ |
| 3135 | 3121 | break; \ |
| r1185 | r1186 | |
| 3137 | 3123 | case 2: /* depthOP = equal */ \ |
| 3138 | 3124 | if (depthsource != depth[XX]) \ |
| 3139 | 3125 | { \ |
| 3140 | | zfail++; \ |
| 3126 | (STATS)->zfunc_fail++; \ |
| 3141 | 3127 | goto skipdrawdepth; \ |
| 3142 | 3128 | } \ |
| 3143 | 3129 | break; \ |
| r1185 | r1186 | |
| 3145 | 3131 | case 3: /* depthOP = less than or equal */ \ |
| 3146 | 3132 | if (depthsource > depth[XX]) \ |
| 3147 | 3133 | { \ |
| 3148 | | zfail++; \ |
| 3134 | (STATS)->zfunc_fail++; \ |
| 3149 | 3135 | goto skipdrawdepth; \ |
| 3150 | 3136 | } \ |
| 3151 | 3137 | break; \ |
| r1185 | r1186 | |
| 3153 | 3139 | case 4: /* depthOP = greater than */ \ |
| 3154 | 3140 | if (depthsource <= depth[XX]) \ |
| 3155 | 3141 | { \ |
| 3156 | | zfail++; \ |
| 3142 | (STATS)->zfunc_fail++; \ |
| 3157 | 3143 | goto skipdrawdepth; \ |
| 3158 | 3144 | } \ |
| 3159 | 3145 | break; \ |
| r1185 | r1186 | |
| 3161 | 3147 | case 5: /* depthOP = not equal */ \ |
| 3162 | 3148 | if (depthsource == depth[XX]) \ |
| 3163 | 3149 | { \ |
| 3164 | | zfail++; \ |
| 3150 | (STATS)->zfunc_fail++; \ |
| 3165 | 3151 | goto skipdrawdepth; \ |
| 3166 | 3152 | } \ |
| 3167 | 3153 | break; \ |
| r1185 | r1186 | |
| 3169 | 3155 | case 6: /* depthOP = greater than or equal */ \ |
| 3170 | 3156 | if (depthsource < depth[XX]) \ |
| 3171 | 3157 | { \ |
| 3172 | | zfail++; \ |
| 3158 | (STATS)->zfunc_fail++; \ |
| 3173 | 3159 | goto skipdrawdepth; \ |
| 3174 | 3160 | } \ |
| 3175 | 3161 | break; \ |
| r1185 | r1186 | |
| 3180 | 3166 | } |
| 3181 | 3167 | |
| 3182 | 3168 | |
| 3183 | | #define PIXEL_PIPELINE_END(VV, DITHER, DITHER4, DITHER_LOOKUP, XX, dest, depth, FBZMODE, FBZCOLORPATH, ALPHAMODE, FOGMODE, ITERZ, ITERW, ITERAXXX) \ |
| 3169 | #define PIXEL_PIPELINE_END(VV, STATS, DITHER, DITHER4, DITHER_LOOKUP, XX, dest, depth, FBZMODE, FBZCOLORPATH, ALPHAMODE, FOGMODE, ITERZ, ITERW, ITERAXXX) \ |
| 3184 | 3170 | \ |
| 3185 | 3171 | /* perform fogging */ \ |
| 3186 | 3172 | prefogr = r; \ |
| r1185 | r1186 | |
| 3213 | 3199 | } \ |
| 3214 | 3200 | \ |
| 3215 | 3201 | /* track pixel writes to the frame buffer regardless of mask */ \ |
| 3216 | | pixout++; \ |
| 3202 | (STATS)->pixels_out++; \ |
| 3217 | 3203 | \ |
| 3218 | 3204 | skipdrawdepth: \ |
| 3219 | 3205 | ; \ |
| r1185 | r1186 | |
| 3265 | 3251 | |
| 3266 | 3252 | INT32 r, g, b, a; |
| 3267 | 3253 | */ |
| 3268 | | #define COLORPATH_PIPELINE(VV, FBZCOLORPATH, FBZMODE, ALPHAMODE, TEXELARGB, ITERZ, ITERW, ITERARGB) \ |
| 3254 | #define COLORPATH_PIPELINE(VV, STATS, FBZCOLORPATH, FBZMODE, ALPHAMODE, TEXELARGB, ITERZ, ITERW, ITERARGB) \ |
| 3269 | 3255 | do \ |
| 3270 | 3256 | { \ |
| 3271 | 3257 | INT32 blendr, blendg, blendb, blenda; \ |
| r1185 | r1186 | |
| 3293 | 3279 | } \ |
| 3294 | 3280 | \ |
| 3295 | 3281 | /* handle chroma key */ \ |
| 3296 | | APPLY_CHROMAKEY(VV, FBZMODE, c_other); \ |
| 3282 | APPLY_CHROMAKEY(VV, STATS, FBZMODE, c_other); \ |
| 3297 | 3283 | \ |
| 3298 | 3284 | /* compute a_other */ \ |
| 3299 | 3285 | switch (FBZCP_CC_ASELECT(FBZCOLORPATH)) \ |
| r1185 | r1186 | |
| 3316 | 3302 | } \ |
| 3317 | 3303 | \ |
| 3318 | 3304 | /* handle alpha mask */ \ |
| 3319 | | APPLY_ALPHAMASK(VV, FBZMODE, c_other.rgb.a); \ |
| 3305 | APPLY_ALPHAMASK(VV, STATS, FBZMODE, c_other.rgb.a); \ |
| 3320 | 3306 | \ |
| 3321 | 3307 | /* handle alpha test */ \ |
| 3322 | | APPLY_ALPHATEST(VV, ALPHAMODE, c_other.rgb.a); \ |
| 3308 | APPLY_ALPHATEST(VV, STATS, ALPHAMODE, c_other.rgb.a); \ |
| 3323 | 3309 | \ |
| 3324 | 3310 | /* compute c_local */ \ |
| 3325 | 3311 | if (FBZCP_CC_LOCALSELECT_OVERRIDE(FBZCOLORPATH) == 0) \ |
| r1185 | r1186 | |
| 3516 | 3502 | |
| 3517 | 3503 | /************************************* |
| 3518 | 3504 | * |
| 3519 | | * Statistics manipulation |
| 3520 | | * |
| 3521 | | *************************************/ |
| 3522 | | |
| 3523 | | #define DECLARE_STATISTICS \ |
| 3524 | | INT32 pixin = 0, pixout = 0, afail = 0, zfail = 0, chromafail = 0 \ |
| 3525 | | |
| 3526 | | #define UPDATE_STATISTICS(VV) \ |
| 3527 | | do \ |
| 3528 | | { \ |
| 3529 | | /* update statistics atomically */ \ |
| 3530 | | if (pixin != 0) \ |
| 3531 | | osd_sync_add((INT32 volatile *)&(VV)->reg[fbiPixelsIn].u, pixin); \ |
| 3532 | | if (pixout != 0) \ |
| 3533 | | osd_sync_add((INT32 volatile *)&(VV)->reg[fbiPixelsOut].u, pixout); \ |
| 3534 | | if (afail != 0) \ |
| 3535 | | osd_sync_add((INT32 volatile *)&(VV)->reg[fbiAfuncFail].u, afail); \ |
| 3536 | | if (zfail != 0) \ |
| 3537 | | osd_sync_add((INT32 volatile *)&(VV)->reg[fbiZfuncFail].u, zfail); \ |
| 3538 | | if (chromafail != 0) \ |
| 3539 | | osd_sync_add((INT32 volatile *)&(VV)->reg[fbiChromaFail].u, chromafail);\ |
| 3540 | | } \ |
| 3541 | | while (0) |
| 3542 | | |
| 3543 | | |
| 3544 | | |
| 3545 | | /************************************* |
| 3546 | | * |
| 3547 | 3505 | * Rasterizer generator macro |
| 3548 | 3506 | * |
| 3549 | 3507 | *************************************/ |
| 3550 | 3508 | |
| 3551 | 3509 | #define RASTERIZER(name, TMUS, FBZCOLORPATH, FBZMODE, ALPHAMODE, FOGMODE, TEXMODE0, TEXMODE1) \ |
| 3552 | 3510 | \ |
| 3553 | | static void raster_##name(work_info *work, INT32 y, INT32 startx, INT32 stopx) \ |
| 3511 | static void raster_##name(void *destbase, INT32 y, INT32 startx, INT32 stopx, const poly_params *poly, int threadid) \ |
| 3554 | 3512 | { \ |
| 3555 | | voodoo_state *v = work->state; \ |
| 3513 | poly_extra_data *extra = poly->extra; \ |
| 3514 | voodoo_state *v = extra->state; \ |
| 3515 | stats_block *stats = &v->thread_stats[threadid]; \ |
| 3556 | 3516 | DECLARE_DITHER_POINTERS; \ |
| 3557 | | DECLARE_STATISTICS; \ |
| 3558 | 3517 | INT32 iterr, iterg, iterb, itera; \ |
| 3559 | 3518 | INT32 iterz; \ |
| 3560 | 3519 | INT64 iterw, iterw0 = 0, iterw1 = 0; \ |
| r1185 | r1186 | |
| 3583 | 3542 | if (scry < ((v->reg[clipLowYHighY].u >> 16) & 0x3ff) || \ |
| 3584 | 3543 | scry >= (v->reg[clipLowYHighY].u & 0x3ff)) \ |
| 3585 | 3544 | { \ |
| 3586 | | pixin += stopx - startx; \ |
| 3587 | | v->stats.total_clipped += stopx - startx; \ |
| 3545 | stats->pixels_in += stopx - startx; \ |
| 3546 | stats->clip_fail += stopx - startx; \ |
| 3588 | 3547 | return; \ |
| 3589 | 3548 | } \ |
| 3590 | 3549 | \ |
| r1185 | r1186 | |
| 3592 | 3551 | tempclip = (v->reg[clipLeftRight].u >> 16) & 0x3ff; \ |
| 3593 | 3552 | if (startx < tempclip) \ |
| 3594 | 3553 | { \ |
| 3595 | | pixin += tempclip - startx; \ |
| 3554 | stats->pixels_in += tempclip - startx; \ |
| 3596 | 3555 | v->stats.total_clipped += tempclip - startx; \ |
| 3597 | 3556 | startx = tempclip; \ |
| 3598 | 3557 | } \ |
| 3599 | 3558 | tempclip = v->reg[clipLeftRight].u & 0x3ff; \ |
| 3600 | 3559 | if (stopx >= tempclip) \ |
| 3601 | 3560 | { \ |
| 3602 | | pixin += stopx - tempclip; \ |
| 3561 | stats->pixels_in += stopx - tempclip; \ |
| 3603 | 3562 | v->stats.total_clipped += stopx - tempclip; \ |
| 3604 | 3563 | stopx = tempclip - 1; \ |
| 3605 | 3564 | } \ |
| 3606 | 3565 | } \ |
| 3607 | 3566 | \ |
| 3608 | 3567 | /* get pointers to the target buffer and depth buffer */ \ |
| 3609 | | dest = work->drawbuf + scry * v->fbi.rowpixels; \ |
| 3568 | dest = (UINT16 *)destbase + scry * v->fbi.rowpixels; \ |
| 3610 | 3569 | depth = v->fbi.aux ? (v->fbi.aux + scry * v->fbi.rowpixels) : NULL; \ |
| 3611 | 3570 | \ |
| 3612 | 3571 | /* compute the starting parameters */ \ |
| 3613 | | dx = startx - (work->ax >> 4); \ |
| 3614 | | dy = y - (work->ay >> 4); \ |
| 3615 | | iterr = work->startr + dy * work->drdy + dx * work->drdx; \ |
| 3616 | | iterg = work->startg + dy * work->dgdy + dx * work->dgdx; \ |
| 3617 | | iterb = work->startb + dy * work->dbdy + dx * work->dbdx; \ |
| 3618 | | itera = work->starta + dy * work->dady + dx * work->dadx; \ |
| 3619 | | iterz = work->startz + dy * work->dzdy + dx * work->dzdx; \ |
| 3620 | | iterw = work->startw + dy * work->dwdy + dx * work->dwdx; \ |
| 3572 | dx = startx - (extra->ax >> 4); \ |
| 3573 | dy = y - (extra->ay >> 4); \ |
| 3574 | iterr = extra->startr + dy * extra->drdy + dx * extra->drdx; \ |
| 3575 | iterg = extra->startg + dy * extra->dgdy + dx * extra->dgdx; \ |
| 3576 | iterb = extra->startb + dy * extra->dbdy + dx * extra->dbdx; \ |
| 3577 | itera = extra->starta + dy * extra->dady + dx * extra->dadx; \ |
| 3578 | iterz = extra->startz + dy * extra->dzdy + dx * extra->dzdx; \ |
| 3579 | iterw = extra->startw + dy * extra->dwdy + dx * extra->dwdx; \ |
| 3621 | 3580 | if (TMUS >= 1) \ |
| 3622 | 3581 | { \ |
| 3623 | | iterw0 = work->startw0 + dy * work->dw0dy + dx * work->dw0dx; \ |
| 3624 | | iters0 = work->starts0 + dy * work->ds0dy + dx * work->ds0dx; \ |
| 3625 | | itert0 = work->startt0 + dy * work->dt0dy + dx * work->dt0dx; \ |
| 3582 | iterw0 = extra->startw0 + dy * extra->dw0dy + dx * extra->dw0dx; \ |
| 3583 | iters0 = extra->starts0 + dy * extra->ds0dy + dx * extra->ds0dx; \ |
| 3584 | itert0 = extra->startt0 + dy * extra->dt0dy + dx * extra->dt0dx; \ |
| 3626 | 3585 | } \ |
| 3627 | 3586 | if (TMUS >= 2) \ |
| 3628 | 3587 | { \ |
| 3629 | | iterw1 = work->startw1 + dy * work->dw1dy + dx * work->dw1dx; \ |
| 3630 | | iters1 = work->starts1 + dy * work->ds1dy + dx * work->ds1dx; \ |
| 3631 | | itert1 = work->startt1 + dy * work->dt1dy + dx * work->dt1dx; \ |
| 3588 | iterw1 = extra->startw1 + dy * extra->dw1dy + dx * extra->dw1dx; \ |
| 3589 | iters1 = extra->starts1 + dy * extra->ds1dy + dx * extra->ds1dx; \ |
| 3590 | itert1 = extra->startt1 + dy * extra->dt1dy + dx * extra->dt1dx; \ |
| 3632 | 3591 | } \ |
| 3633 | 3592 | \ |
| 3634 | 3593 | /* loop in X */ \ |
| r1185 | r1186 | |
| 3638 | 3597 | rgb_union texel = { 0 }; \ |
| 3639 | 3598 | \ |
| 3640 | 3599 | /* pixel pipeline part 1 handles depth testing and stippling */ \ |
| 3641 | | PIXEL_PIPELINE_BEGIN(v, x, y, FBZCOLORPATH, FBZMODE, \ |
| 3600 | PIXEL_PIPELINE_BEGIN(v, stats, x, y, FBZCOLORPATH, FBZMODE, \ |
| 3642 | 3601 | iterz, iterw); \ |
| 3643 | 3602 | \ |
| 3644 | 3603 | /* run the texture pipeline on TMU1 to produce a value in texel */ \ |
| 3645 | 3604 | /* note that they set LOD min to 8 to "disable" a TMU */ \ |
| 3646 | 3605 | if (TMUS >= 2 && v->tmu[1].lodmin < (8 << 8)) \ |
| 3647 | 3606 | TEXTURE_PIPELINE(&v->tmu[1], x, dither4, TEXMODE1, texel, \ |
| 3648 | | v->tmu[1].lookup, v->tmu[1].lodbase, \ |
| 3607 | v->tmu[1].lookup, extra->lodbase1, \ |
| 3649 | 3608 | iters1, itert1, iterw1, texel); \ |
| 3650 | 3609 | \ |
| 3651 | 3610 | /* run the texture pipeline on TMU0 to produce a final */ \ |
| r1185 | r1186 | |
| 3653 | 3612 | /* note that they set LOD min to 8 to "disable" a TMU */ \ |
| 3654 | 3613 | if (TMUS >= 1 && v->tmu[0].lodmin < (8 << 8)) \ |
| 3655 | 3614 | TEXTURE_PIPELINE(&v->tmu[0], x, dither4, TEXMODE0, texel, \ |
| 3656 | | v->tmu[0].lookup, v->tmu[0].lodbase, \ |
| 3615 | v->tmu[0].lookup, extra->lodbase0, \ |
| 3657 | 3616 | iters0, itert0, iterw0, texel); \ |
| 3658 | 3617 | \ |
| 3659 | 3618 | /* colorpath pipeline selects source colors and does blending */ \ |
| 3660 | 3619 | CLAMPED_ARGB(iterr, iterg, iterb, itera, FBZCOLORPATH, iterargb); \ |
| 3661 | | COLORPATH_PIPELINE(v, FBZCOLORPATH, FBZMODE, ALPHAMODE, texel, \ |
| 3620 | COLORPATH_PIPELINE(v, stats, FBZCOLORPATH, FBZMODE, ALPHAMODE, texel, \ |
| 3662 | 3621 | iterz, iterw, iterargb); \ |
| 3663 | 3622 | \ |
| 3664 | 3623 | /* pixel pipeline part 2 handles fog, alpha, and final output */ \ |
| 3665 | | PIXEL_PIPELINE_END(v, dither, dither4, dither_lookup, x, dest, depth, \ |
| 3624 | PIXEL_PIPELINE_END(v, stats, dither, dither4, dither_lookup, x, dest, depth, \ |
| 3666 | 3625 | FBZMODE, FBZCOLORPATH, ALPHAMODE, FOGMODE, \ |
| 3667 | 3626 | iterz, iterw, iterargb); \ |
| 3668 | 3627 | \ |
| 3669 | 3628 | /* update the iterated parameters */ \ |
| 3670 | | iterr += work->drdx; \ |
| 3671 | | iterg += work->dgdx; \ |
| 3672 | | iterb += work->dbdx; \ |
| 3673 | | itera += work->dadx; \ |
| 3674 | | iterz += work->dzdx; \ |
| 3675 | | iterw += work->dwdx; \ |
| 3629 | iterr += extra->drdx; \ |
| 3630 | iterg += extra->dgdx; \ |
| 3631 | iterb += extra->dbdx; \ |
| 3632 | itera += extra->dadx; \ |
| 3633 | iterz += extra->dzdx; \ |
| 3634 | iterw += extra->dwdx; \ |
| 3676 | 3635 | if (TMUS >= 1) \ |
| 3677 | 3636 | { \ |
| 3678 | | iterw0 += work->dw0dx; \ |
| 3679 | | iters0 += work->ds0dx; \ |
| 3680 | | itert0 += work->dt0dx; \ |
| 3637 | iterw0 += extra->dw0dx; \ |
| 3638 | iters0 += extra->ds0dx; \ |
| 3639 | itert0 += extra->dt0dx; \ |
| 3681 | 3640 | } \ |
| 3682 | 3641 | if (TMUS >= 2) \ |
| 3683 | 3642 | { \ |
| 3684 | | iterw1 += work->dw1dx; \ |
| 3685 | | iters1 += work->ds1dx; \ |
| 3686 | | itert1 += work->dt1dx; \ |
| 3643 | iterw1 += extra->dw1dx; \ |
| 3644 | iters1 += extra->ds1dx; \ |
| 3645 | itert1 += extra->dt1dx; \ |
| 3687 | 3646 | } \ |
| 3688 | 3647 | } \ |
| 3689 | | UPDATE_STATISTICS(v); \ |
| 3690 | 3648 | } |
src/emu/video/polynew.c
| r0 | r1186 | |
| 1 | /*************************************************************************** |
| 2 | |
| 3 | polynew.c |
| 4 | |
| 5 | Helper routines for polygon rendering. |
| 6 | |
| 7 | ***************************************************************************/ |
| 8 | |
| 9 | #include "polynew.h" |
| 10 | #include "mame.h" |
| 11 | #include <math.h> |
| 12 | |
| 13 | |
| 14 | /*************************************************************************** |
| 15 | DEBUGGING |
| 16 | ***************************************************************************/ |
| 17 | |
| 18 | /* keep statistics */ |
| 19 | #define KEEP_STATISTICS 0 |
| 20 | |
| 21 | /* turn this on to log the reasons for any long waits */ |
| 22 | #define LOG_WAITS 0 |
| 23 | |
| 24 | /* number of profiling ticks before we consider a wait "long" */ |
| 25 | #define LOG_WAIT_THRESHOLD 1000 |
| 26 | |
| 27 | |
| 28 | |
| 29 | /*************************************************************************** |
| 30 | CONSTANTS |
| 31 | ***************************************************************************/ |
| 32 | |
| 33 | #define SCANLINES_PER_BUCKET 8 |
| 34 | #define CACHE_LINE_SIZE 64 /* this is a general guess */ |
| 35 | #define TOTAL_BUCKETS (512 / SCANLINES_PER_BUCKET) |
| 36 | #define UNITS_PER_POLY (100 / SCANLINES_PER_BUCKET) |
| 37 | |
| 38 | |
| 39 | |
| 40 | /*************************************************************************** |
| 41 | TYPE DEFINITIONS |
| 42 | ***************************************************************************/ |
| 43 | |
| 44 | /* forward definitions */ |
| 45 | typedef struct _polygon_info polygon_info; |
| 46 | |
| 47 | |
| 48 | /* work_unit describes a single "unit" of work, which is a small number of scanlines */ |
| 49 | typedef struct _work_unit work_unit; |
| 50 | struct _work_unit |
| 51 | { |
| 52 | polygon_info * polygon; /* pointer to polygon */ |
| 53 | volatile UINT32 count_next; /* number of scanlines and index of next item to process */ |
| 54 | INT16 scanline; /* starting scanline and count */ |
| 55 | UINT16 previtem; /* index of previous item in the same bucket */ |
| 56 | scanline_extent extent[SCANLINES_PER_BUCKET]; /* array of scanline extents */ |
| 57 | }; |
| 58 | |
| 59 | |
| 60 | /* polygon_info describes a single polygon, which includes the poly_params */ |
| 61 | struct _polygon_info |
| 62 | { |
| 63 | poly_manager * poly; /* pointer back to the poly manager */ |
| 64 | void * dest; /* pointer to the destination we are rendering to */ |
| 65 | poly_draw_scanline callback; /* callback to handle a scanline's worth of work */ |
| 66 | poly_params params; /* poly_params structure */ |
| 67 | }; |
| 68 | |
| 69 | |
| 70 | /* full poly manager description */ |
| 71 | struct _poly_manager |
| 72 | { |
| 73 | /* queue management */ |
| 74 | osd_work_queue * queue; /* work queue */ |
| 75 | |
| 76 | /* work units */ |
| 77 | work_unit ** unit; /* array of work unit pointers */ |
| 78 | UINT32 unit_next; /* index of next unit to allocate */ |
| 79 | UINT32 unit_count; /* number of work units available */ |
| 80 | size_t unit_size; /* size of each work unit, in bytes */ |
| 81 | |
| 82 | /* poly data */ |
| 83 | polygon_info ** polygon; /* array of polygon pointers */ |
| 84 | UINT32 polygon_next; /* index of next polygon to allocate */ |
| 85 | UINT32 polygon_count; /* number of polygon items available */ |
| 86 | size_t polygon_size; /* size of each polygon, in bytes */ |
| 87 | |
| 88 | /* misc data */ |
| 89 | UINT8 flags; /* flags */ |
| 90 | |
| 91 | /* buckets */ |
| 92 | UINT16 unit_bucket[TOTAL_BUCKETS]; /* buckets for tracking unit usage */ |
| 93 | |
| 94 | /* statistics */ |
| 95 | UINT32 polygons; /* number of polygons queued */ |
| 96 | UINT64 pixels; /* number of pixels rendered */ |
| 97 | #if KEEP_STATISTICS |
| 98 | UINT32 conflicts[WORK_MAX_THREADS]; /* number of conflicts found, per thread */ |
| 99 | UINT32 resolved[WORK_MAX_THREADS]; /* number of conflicts resolved, per thread */ |
| 100 | #endif |
| 101 | }; |
| 102 | |
| 103 | |
| 104 | |
| 105 | /*************************************************************************** |
| 106 | FUNCTION PROTOTYPES |
| 107 | ***************************************************************************/ |
| 108 | |
| 109 | static void *poly_item_callback(void *param, int threadid); |
| 110 | |
| 111 | |
| 112 | |
| 113 | /*************************************************************************** |
| 114 | INLINE FUNCTIONS |
| 115 | ***************************************************************************/ |
| 116 | |
| 117 | /*------------------------------------------------- |
| 118 | round_coordinate - round a coordinate to |
| 119 | an integer, following rules that 0.5 rounds |
| 120 | down |
| 121 | -------------------------------------------------*/ |
| 122 | |
| 123 | INLINE INT32 round_coordinate(float value) |
| 124 | { |
| 125 | INT32 result = floor(value); |
| 126 | return result + (value - (float)result > 0.5f); |
| 127 | } |
| 128 | |
| 129 | |
| 130 | |
| 131 | /*************************************************************************** |
| 132 | INITIALIZATION/TEARDOWN |
| 133 | ***************************************************************************/ |
| 134 | |
| 135 | /*------------------------------------------------- |
| 136 | poly_alloc - initialize a new polygon |
| 137 | manager |
| 138 | -------------------------------------------------*/ |
| 139 | |
| 140 | poly_manager *poly_alloc(int max_queued_polygons, size_t extra_data_size, UINT8 flags) |
| 141 | { |
| 142 | int polynum, unitnum; |
| 143 | poly_manager *poly; |
| 144 | |
| 145 | /* allocate the manager itself */ |
| 146 | poly = malloc_or_die(sizeof(*poly)); |
| 147 | memset(poly, 0, sizeof(*poly)); |
| 148 | poly->flags = flags; |
| 149 | |
| 150 | /* allocate polygons */ |
| 151 | poly->polygon_size = sizeof(polygon_info) + extra_data_size; |
| 152 | poly->polygon_count = MAX(max_queued_polygons, 1); |
| 153 | poly->polygon = malloc_or_die(sizeof(*poly->polygon) * poly->polygon_count); |
| 154 | memset(poly->polygon, 0, sizeof(*poly->polygon) * poly->polygon_count); |
| 155 | poly->polygon[0] = malloc_or_die(sizeof(*poly->polygon[0]) * poly->polygon_count * poly->polygon_size); |
| 156 | memset(poly->polygon[0], 0, sizeof(*poly->polygon[0]) * poly->polygon_count * poly->polygon_size); |
| 157 | |
| 158 | /* initialize the pointers */ |
| 159 | for (polynum = 0; polynum < poly->polygon_count; polynum++) |
| 160 | { |
| 161 | poly->polygon[polynum] = (void *)((UINT8 *)poly->polygon[0] + polynum * poly->polygon_size); |
| 162 | poly->polygon[polynum]->params.extra = (void *)((UINT8 *)poly->polygon[polynum] + sizeof(polygon_info)); |
| 163 | } |
| 164 | |
| 165 | /* allocate work units */ |
| 166 | poly->unit_size = ((sizeof(work_unit) + CACHE_LINE_SIZE - 1) / CACHE_LINE_SIZE) * CACHE_LINE_SIZE; |
| 167 | poly->unit_count = MIN(poly->polygon_count * UNITS_PER_POLY, 65535); |
| 168 | poly->unit = malloc_or_die(sizeof(*poly->unit) * poly->unit_count); |
| 169 | memset(poly->unit, 0, sizeof(*poly->unit) * poly->unit_count); |
| 170 | poly->unit[0] = malloc_or_die(sizeof(*poly->unit[0]) * poly->unit_count * poly->unit_size); |
| 171 | memset(poly->unit[0], 0, sizeof(*poly->unit[0]) * poly->unit_count * poly->unit_size); |
| 172 | |
| 173 | /* initialize the work units */ |
| 174 | for (unitnum = 0; unitnum < poly->unit_count; unitnum++) |
| 175 | poly->unit[unitnum] = (void *)((UINT8 *)poly->unit[0] + unitnum * poly->unit_size); |
| 176 | |
| 177 | /* create the work queue */ |
| 178 | if (!(flags & POLYFLAG_NO_WORK_QUEUE)) |
| 179 | poly->queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_MULTI | WORK_QUEUE_FLAG_HIGH_FREQ); |
| 180 | return poly; |
| 181 | } |
| 182 | |
| 183 | |
| 184 | /*------------------------------------------------- |
| 185 | poly_free - free a polygon manager |
| 186 | -------------------------------------------------*/ |
| 187 | |
| 188 | void poly_free(poly_manager *poly) |
| 189 | { |
| 190 | #if KEEP_STATISTICS |
| 191 | { |
| 192 | int i, conflicts = 0, resolved = 0; |
| 193 | for (i = 0; i < ARRAY_LENGTH(poly->conflicts); i++) |
| 194 | { |
| 195 | conflicts += poly->conflicts[i]; |
| 196 | resolved += poly->resolved[i]; |
| 197 | } |
| 198 | printf("Total polygons = %d\n", poly->polygons); |
| 199 | if (poly->pixels > 1000000000) |
| 200 | printf("Total pixels = %d%09d\n", (UINT32)(poly->pixels / 1000000000), (UINT32)(poly->pixels % 1000000000)); |
| 201 | else |
| 202 | printf("Total pixels = %d\n", (UINT32)poly->pixels); |
| 203 | printf("Resolved conflicts = %d/%d\n", resolved, conflicts); |
| 204 | } |
| 205 | #endif |
| 206 | |
| 207 | /* free the work queue */ |
| 208 | if (poly->queue != NULL) |
| 209 | osd_work_queue_free(poly->queue); |
| 210 | |
| 211 | /* free the work units */ |
| 212 | if (poly->unit != NULL) |
| 213 | { |
| 214 | if (poly->unit[0] != NULL) |
| 215 | free(poly->unit[0]); |
| 216 | free(poly->unit); |
| 217 | } |
| 218 | |
| 219 | /* free the polygon */ |
| 220 | if (poly->polygon != NULL) |
| 221 | { |
| 222 | if (poly->polygon[0] != NULL) |
| 223 | free(poly->polygon[0]); |
| 224 | free(poly->polygon); |
| 225 | } |
| 226 | |
| 227 | /* free the manager itself */ |
| 228 | free(poly); |
| 229 | } |
| 230 | |
| 231 | |
| 232 | |
| 233 | /*************************************************************************** |
| 234 | SYNCHRONIZATION |
| 235 | ***************************************************************************/ |
| 236 | |
| 237 | /*------------------------------------------------- |
| 238 | poly_wait - wait for all pending rendering |
| 239 | to complete |
| 240 | -------------------------------------------------*/ |
| 241 | |
| 242 | void poly_wait(poly_manager *poly, const char *debug_reason) |
| 243 | { |
| 244 | osd_ticks_t time; |
| 245 | |
| 246 | /* remember the start time if we're logging */ |
| 247 | if (LOG_WAITS) |
| 248 | time = osd_profiling_ticks(); |
| 249 | |
| 250 | /* wait for all pending work items to complete */ |
| 251 | if (poly->queue != NULL) |
| 252 | osd_work_queue_wait(poly->queue, osd_ticks_per_second() * 100); |
| 253 | |
| 254 | /* if we don't have a queue, just run the whole list now */ |
| 255 | else |
| 256 | { |
| 257 | int unitnum; |
| 258 | for (unitnum = 0; unitnum < poly->unit_next; unitnum++) |
| 259 | poly_item_callback(poly->unit[unitnum], 0); |
| 260 | } |
| 261 | |
| 262 | /* log any long waits */ |
| 263 | if (LOG_WAITS) |
| 264 | { |
| 265 | time = osd_profiling_ticks() - time; |
| 266 | if (time > LOG_WAIT_THRESHOLD) |
| 267 | logerror("Poly:Waited %d cycles for %s\n", (int)time, debug_reason); |
| 268 | } |
| 269 | |
| 270 | /* reset the state */ |
| 271 | poly->polygon_next = poly->unit_next = 0; |
| 272 | memset(poly->unit_bucket, 0xff, sizeof(poly->unit_bucket)); |
| 273 | } |
| 274 | |
| 275 | |
| 276 | |
| 277 | /*************************************************************************** |
| 278 | CORE RENDERING |
| 279 | ***************************************************************************/ |
| 280 | |
| 281 | /*------------------------------------------------- |
| 282 | poly_get_extra_data - get a pointer to the |
| 283 | extra data for the next polygon |
| 284 | -------------------------------------------------*/ |
| 285 | |
| 286 | void *poly_get_extra_data(poly_manager *poly) |
| 287 | { |
| 288 | /* wait for a work item if we have to */ |
| 289 | if (poly->polygon_next + 1 > poly->polygon_count) |
| 290 | poly_wait(poly, "Out of polygons"); |
| 291 | |
| 292 | /* return a pointer to the extra data for the next item */ |
| 293 | return poly->polygon[poly->polygon_next]->params.extra; |
| 294 | } |
| 295 | |
| 296 | |
| 297 | |
| 298 | /*************************************************************************** |
| 299 | CORE RENDERING |
| 300 | ***************************************************************************/ |
| 301 | |
| 302 | /*------------------------------------------------- |
| 303 | poly_render_triangle - render a single |
| 304 | triangle given 3 vertexes |
| 305 | -------------------------------------------------*/ |
| 306 | |
| 307 | UINT32 poly_render_triangle(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int paramcount, const poly_vertex *v1, const poly_vertex *v2, const poly_vertex *v3) |
| 308 | { |
| 309 | float dxdy_minmid, dxdy_minmax, dxdy_midmax; |
| 310 | const poly_vertex *tv; |
| 311 | INT32 curscan, scaninc; |
| 312 | polygon_info *polygon; |
| 313 | INT32 v1yclip, v3yclip; |
| 314 | INT32 v1y, v3y, v1x; |
| 315 | INT32 pixels = 0; |
| 316 | UINT32 startunit; |
| 317 | |
| 318 | /* first sort by Y */ |
| 319 | if (v2->y < v1->y) |
| 320 | { |
| 321 | tv = v1; |
| 322 | v1 = v2; |
| 323 | v2 = tv; |
| 324 | } |
| 325 | if (v3->y < v2->y) |
| 326 | { |
| 327 | tv = v2; |
| 328 | v2 = v3; |
| 329 | v3 = tv; |
| 330 | if (v2->y < v1->y) |
| 331 | { |
| 332 | tv = v1; |
| 333 | v1 = v2; |
| 334 | v2 = tv; |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | /* compute some integral X/Y vertex values */ |
| 339 | v1x = round_coordinate(v1->x); |
| 340 | v1y = round_coordinate(v1->y); |
| 341 | v3y = round_coordinate(v3->y); |
| 342 | |
| 343 | /* clip coordinates */ |
| 344 | v1yclip = v1y; |
| 345 | v3yclip = v3y + ((poly->flags & POLYFLAG_INCLUDE_BOTTOM_EDGE) ? 1 : 0); |
| 346 | if (cliprect != NULL) |
| 347 | { |
| 348 | v1yclip = MAX(v1yclip, cliprect->min_y); |
| 349 | v3yclip = MIN(v3yclip, cliprect->max_y + 1); |
| 350 | } |
| 351 | if (v3yclip - v1yclip <= 0) |
| 352 | return 0; |
| 353 | |
| 354 | /* wait for a work item if we have to */ |
| 355 | if (poly->polygon_next + 1 > poly->polygon_count) |
| 356 | poly_wait(poly, "Out of polygons"); |
| 357 | else if (poly->unit_next + (v3yclip - v1yclip) / SCANLINES_PER_BUCKET + 2 > poly->unit_count) |
| 358 | poly_wait(poly, "Out of work units"); |
| 359 | polygon = poly->polygon[poly->polygon_next++]; |
| 360 | |
| 361 | /* fill in the polygon information */ |
| 362 | polygon->poly = poly; |
| 363 | polygon->dest = dest; |
| 364 | polygon->callback = callback; |
| 365 | |
| 366 | /* set the start X/Y coordinates */ |
| 367 | polygon->params.xorigin = v1x; |
| 368 | polygon->params.yorigin = v1y; |
| 369 | |
| 370 | /* compute the slopes for each portion of the triangle */ |
| 371 | dxdy_minmid = (v2->y == v1->y) ? 0.0f : (v2->x - v1->x) / (v2->y - v1->y); |
| 372 | dxdy_minmax = (v3->y == v1->y) ? 0.0f : (v3->x - v1->x) / (v3->y - v1->y); |
| 373 | dxdy_midmax = (v3->y == v2->y) ? 0.0f : (v3->x - v2->x) / (v3->y - v2->y); |
| 374 | |
| 375 | /* compute the X extents for each scanline */ |
| 376 | startunit = poly->unit_next; |
| 377 | for (curscan = v1yclip; curscan < v3yclip; curscan += scaninc) |
| 378 | { |
| 379 | UINT32 bucketnum = ((UINT32)curscan / SCANLINES_PER_BUCKET) % TOTAL_BUCKETS; |
| 380 | UINT32 unit_index = poly->unit_next++; |
| 381 | work_unit *unit = poly->unit[unit_index]; |
| 382 | int extnum; |
| 383 | |
| 384 | /* determine how much to advance to hit the next bucket */ |
| 385 | scaninc = SCANLINES_PER_BUCKET - (UINT32)curscan % SCANLINES_PER_BUCKET; |
| 386 | |
| 387 | /* fill in the work unit basics */ |
| 388 | unit->polygon = polygon; |
| 389 | unit->count_next = MIN(v3yclip - curscan, scaninc); |
| 390 | unit->scanline = curscan; |
| 391 | unit->previtem = poly->unit_bucket[bucketnum]; |
| 392 | poly->unit_bucket[bucketnum] = unit_index; |
| 393 | |
| 394 | /* iterate over extents */ |
| 395 | for (extnum = 0; extnum < unit->count_next; extnum++) |
| 396 | { |
| 397 | float fully = (float)(curscan + extnum) + 0.5f; |
| 398 | float startx = v1->x + (fully - v1->y) * dxdy_minmax; |
| 399 | float stopx; |
| 400 | INT32 istartx, istopx; |
| 401 | |
| 402 | /* compute the ending X based on which part of the triangle we're in */ |
| 403 | if (fully < v2->y) |
| 404 | stopx = v1->x + (fully - v1->y) * dxdy_minmid; |
| 405 | else |
| 406 | stopx = v2->x + (fully - v2->y) * dxdy_midmax; |
| 407 | |
| 408 | /* clamp to full pixels */ |
| 409 | istartx = round_coordinate(startx); |
| 410 | istopx = round_coordinate(stopx); |
| 411 | |
| 412 | /* force start < stop */ |
| 413 | if (istartx > istopx) |
| 414 | { |
| 415 | INT32 temp = istartx; |
| 416 | istartx = istopx; |
| 417 | istopx = temp; |
| 418 | } |
| 419 | |
| 420 | /* include the right edge if requested */ |
| 421 | if (poly->flags & POLYFLAG_INCLUDE_RIGHT_EDGE) |
| 422 | istopx++; |
| 423 | |
| 424 | /* apply left/right clipping */ |
| 425 | if (cliprect != NULL) |
| 426 | { |
| 427 | if (istartx < cliprect->min_x) |
| 428 | istartx = cliprect->min_x; |
| 429 | if (istopx > cliprect->max_x) |
| 430 | istopx = cliprect->max_x + 1; |
| 431 | } |
| 432 | |
| 433 | /* set the extent and update the total pixel count */ |
| 434 | if (istartx >= istopx) |
| 435 | istartx = istopx = 0; |
| 436 | unit->extent[extnum].startx = istartx; |
| 437 | unit->extent[extnum].stopx = istopx; |
| 438 | pixels += istopx - istartx; |
| 439 | } |
| 440 | } |
| 441 | |
| 442 | /* compute parameter starting points and deltas */ |
| 443 | if (paramcount > 0) |
| 444 | { |
| 445 | float divisor, dx1, dx2, dy1, dy2, xoffset, yoffset; |
| 446 | int paramnum; |
| 447 | |
| 448 | /* compute the divisor */ |
| 449 | divisor = 1.0f / ((v1->x - v2->x) * (v1->y - v3->y) - (v1->x - v3->x) * (v1->y - v2->y)); |
| 450 | |
| 451 | /* compute the dx/dy values */ |
| 452 | dx1 = v1->y - v3->y; |
| 453 | dx2 = v1->y - v2->y; |
| 454 | dy1 = v1->x - v2->x; |
| 455 | dy2 = v1->x - v3->x; |
| 456 | |
| 457 | /* determine x/y offset for subpixel correction so that the starting values are |
| 458 | relative to the integer coordinates */ |
| 459 | xoffset = v1->x - ((float)polygon->params.xorigin + 0.5f); |
| 460 | yoffset = v1->y - ((float)polygon->params.yorigin + 0.5f); |
| 461 | |
| 462 | /* iterate over parameters */ |
| 463 | for (paramnum = 0; paramnum < paramcount; paramnum++) |
| 464 | { |
| 465 | poly_param *params = &polygon->params.param[paramnum]; |
| 466 | params->dpdx = ((v1->p[paramnum] - v2->p[paramnum]) * dx1 - (v1->p[paramnum] - v3->p[paramnum]) * dx2) * divisor; |
| 467 | params->dpdy = ((v1->p[paramnum] - v3->p[paramnum]) * dy1 - (v1->p[paramnum] - v2->p[paramnum]) * dy2) * divisor; |
| 468 | params->start = v1->p[paramnum] - xoffset * params->dpdx - yoffset * params->dpdy; |
| 469 | } |
| 470 | } |
| 471 | |
| 472 | /* enqueue the work items */ |
| 473 | if (poly->queue != NULL) |
| 474 | osd_work_item_queue_multiple(poly->queue, poly_item_callback, poly->unit_next - startunit, poly->unit[startunit], poly->unit_size, WORK_ITEM_FLAG_AUTO_RELEASE); |
| 475 | |
| 476 | /* return the total number of pixels in the triangle */ |
| 477 | poly->polygons++; |
| 478 | poly->pixels += pixels; |
| 479 | return pixels; |
| 480 | } |
| 481 | |
| 482 | |
| 483 | /*------------------------------------------------- |
| 484 | poly_render_custom - perform a custom render |
| 485 | of an object, given specific extents |
| 486 | -------------------------------------------------*/ |
| 487 | |
| 488 | UINT32 poly_render_custom(poly_manager *poly, void *dest, const rectangle *cliprect, poly_draw_scanline callback, int startscanline, int numscanlines, const scanline_extent *extents) |
| 489 | { |
| 490 | INT32 curscan, scaninc; |
| 491 | polygon_info *polygon; |
| 492 | INT32 v1yclip, v3yclip; |
| 493 | INT32 pixels = 0; |
| 494 | UINT32 startunit; |
| 495 | |
| 496 | /* clip coordinates */ |
| 497 | if (cliprect != NULL) |
| 498 | { |
| 499 | v1yclip = MAX(startscanline, cliprect->min_y); |
| 500 | v3yclip = MIN(startscanline + numscanlines, cliprect->max_y + 1); |
| 501 | } |
| 502 | else |
| 503 | { |
| 504 | v1yclip = startscanline; |
| 505 | v3yclip = startscanline + numscanlines; |
| 506 | } |
| 507 | if (v3yclip - v1yclip <= 0) |
| 508 | return 0; |
| 509 | |
| 510 | /* wait for a work item if we have to */ |
| 511 | if (poly->polygon_next + 1 > poly->polygon_count) |
| 512 | poly_wait(poly, "Out of polygons"); |
| 513 | else if (poly->unit_next + (v3yclip - v1yclip) / SCANLINES_PER_BUCKET + 2 > poly->unit_count) |
| 514 | poly_wait(poly, "Out of work units"); |
| 515 | polygon = poly->polygon[poly->polygon_next++]; |
| 516 | |
| 517 | /* fill in the polygon information */ |
| 518 | polygon->poly = poly; |
| 519 | polygon->dest = dest; |
| 520 | polygon->callback = callback; |
| 521 | |
| 522 | /* compute the X extents for each scanline */ |
| 523 | startunit = poly->unit_next; |
| 524 | for (curscan = v1yclip; curscan < v3yclip; curscan += scaninc) |
| 525 | { |
| 526 | UINT32 bucketnum = ((UINT32)curscan / SCANLINES_PER_BUCKET) % TOTAL_BUCKETS; |
| 527 | UINT32 unit_index = poly->unit_next++; |
| 528 | work_unit *unit = poly->unit[unit_index]; |
| 529 | int extnum; |
| 530 | |
| 531 | /* determine how much to advance to hit the next bucket */ |
| 532 | scaninc = SCANLINES_PER_BUCKET - (UINT32)curscan % SCANLINES_PER_BUCKET; |
| 533 | |
| 534 | /* fill in the work unit basics */ |
| 535 | unit->polygon = polygon; |
| 536 | unit->count_next = MIN(v3yclip - curscan, scaninc); |
| 537 | unit->scanline = curscan; |
| 538 | unit->previtem = poly->unit_bucket[bucketnum]; |
| 539 | poly->unit_bucket[bucketnum] = unit_index; |
| 540 | |
| 541 | /* iterate over extents */ |
| 542 | for (extnum = 0; extnum < unit->count_next; extnum++) |
| 543 | { |
| 544 | const scanline_extent *extent = &extents[(curscan + extnum) - startscanline]; |
| 545 | INT32 istartx = extent->startx, istopx = extent->stopx; |
| 546 | |
| 547 | /* force start < stop */ |
| 548 | if (istartx > istopx) |
| 549 | { |
| 550 | INT32 temp = istartx; |
| 551 | istartx = istopx; |
| 552 | istopx = temp; |
| 553 | } |
| 554 | |
| 555 | /* apply left/right clipping */ |
| 556 | if (cliprect != NULL) |
| 557 | { |
| 558 | if (istartx < cliprect->min_x) |
| 559 | istartx = cliprect->min_x; |
| 560 | if (istopx > cliprect->max_x) |
| 561 | istopx = cliprect->max_x + 1; |
| 562 | } |
| 563 | |
| 564 | /* set the extent and update the total pixel count */ |
| 565 | unit->extent[extnum].startx = istartx; |
| 566 | unit->extent[extnum].stopx = istopx; |
| 567 | if (istartx < istopx) |
| 568 | pixels += istopx - istartx; |
| 569 | } |
| 570 | } |
| 571 | |
| 572 | /* enqueue the work items */ |
| 573 | if (poly->queue != NULL) |
| 574 | osd_work_item_queue_multiple(poly->queue, poly_item_callback, poly->unit_next - startunit, poly->unit[startunit], poly->unit_size, WORK_ITEM_FLAG_AUTO_RELEASE); |
| 575 | |
| 576 | /* return the total number of pixels in the object */ |
| 577 | poly->polygons++; |
| 578 | poly->pixels += pixels; |
| 579 | return pixels; |
| 580 | } |
| 581 | |
| 582 | |
| 583 | |
| 584 | /*************************************************************************** |
| 585 | WORK ITEM CALLBACK |
| 586 | ***************************************************************************/ |
| 587 | |
| 588 | /*------------------------------------------------- |
| 589 | poly_item_callback - callback for each poly |
| 590 | item |
| 591 | -------------------------------------------------*/ |
| 592 | |
| 593 | static void *poly_item_callback(void *param, int threadid) |
| 594 | { |
| 595 | while (1) |
| 596 | { |
| 597 | work_unit *unit = param; |
| 598 | polygon_info *polygon = unit->polygon; |
| 599 | int count = unit->count_next & 0xffff; |
| 600 | UINT32 orig_count_next; |
| 601 | int extnum; |
| 602 | |
| 603 | /* if our previous item isn't done yet, enqueue this item to the end and proceed */ |
| 604 | if (unit->previtem != 0xffff) |
| 605 | { |
| 606 | work_unit *prevunit = polygon->poly->unit[unit->previtem]; |
| 607 | if (prevunit->count_next != 0) |
| 608 | { |
| 609 | UINT32 unitnum = ((UINT8 *)unit - (UINT8 *)polygon->poly->unit[0]) / polygon->poly->unit_size; |
| 610 | UINT32 new_count_next; |
| 611 | |
| 612 | /* attempt to atomically swap in this new value */ |
| 613 | do |
| 614 | { |
| 615 | orig_count_next = prevunit->count_next; |
| 616 | new_count_next = orig_count_next | (unitnum << 16); |
| 617 | } while (osd_compare_exchange32((volatile INT32 *)&prevunit->count_next, orig_count_next, new_count_next) != orig_count_next); |
| 618 | |
| 619 | #if KEEP_STATISTICS |
| 620 | /* track resolved conflicts */ |
| 621 | polygon->poly->conflicts[threadid]++; |
| 622 | if (orig_count_next != 0) |
| 623 | polygon->poly->resolved[threadid]++; |
| 624 | #endif |
| 625 | /* if we succeeded, skip out early so we can do other work */ |
| 626 | if (orig_count_next != 0) |
| 627 | break; |
| 628 | } |
| 629 | } |
| 630 | |
| 631 | /* iterate over extents */ |
| 632 | for (extnum = 0; extnum < count; extnum++) |
| 633 | (*polygon->callback)(polygon->dest, unit->scanline + extnum, unit->extent[extnum].startx, unit->extent[extnum].stopx, &polygon->params, threadid); |
| 634 | |
| 635 | /* set our count to 0 and re-fetch the original count value */ |
| 636 | do |
| 637 | { |
| 638 | orig_count_next = unit->count_next; |
| 639 | } while (osd_compare_exchange32((volatile INT32 *)&unit->count_next, orig_count_next, 0) != orig_count_next); |
| 640 | |
| 641 | /* if we have no more work to do, do nothing */ |
| 642 | orig_count_next >>= 16; |
| 643 | if (orig_count_next == 0) |
| 644 | break; |
| 645 | param = polygon->poly->unit[orig_count_next]; |
| 646 | } |
| 647 | return NULL; |
| 648 | } |
src/emu/sound/2610intf.c
| r1185 | r1186 | |
| 19 | 19 | |
| 20 | 20 | #if (BUILD_YM2610||BUILD_YM2610B) |
| 21 | 21 | |
| 22 | | static int sound_type = SOUND_YM2610; |
| 22 | static sound_type chip_type = SOUND_YM2610; |
| 23 | 23 | struct ym2610_info |
| 24 | 24 | { |
| 25 | 25 | sound_stream * stream; |
| r1185 | r1186 | |
| 130 | 130 | int pcmsizea,pcmsizeb; |
| 131 | 131 | struct ym2610_info *info; |
| 132 | 132 | |
| 133 | | sound_type = SOUND_YM2610; |
| 133 | chip_type = SOUND_YM2610; |
| 134 | 134 | |
| 135 | 135 | info = auto_malloc(sizeof(*info)); |
| 136 | 136 | memset(info, 0, sizeof(*info)); |
| r1185 | r1186 | |
| 182 | 182 | int pcmsizea,pcmsizeb; |
| 183 | 183 | struct ym2610_info *info; |
| 184 | 184 | |
| 185 | | sound_type = SOUND_YM2610B; |
| 185 | chip_type = SOUND_YM2610B; |
| 186 | 186 | |
| 187 | 187 | info = auto_malloc(sizeof(*info)); |
| 188 | 188 | memset(info, 0, sizeof(*info)); |
| r1185 | r1186 | |
| 233 | 233 | /************************************************/ |
| 234 | 234 | READ8_HANDLER( YM2610_status_port_0_A_r ) |
| 235 | 235 | { |
| 236 | | //logerror("PC %04x: 2610 S0A=%02X\n",activecpu_get_pc(),YM2610Read(sndti_token(sound_type,0,0)); |
| 237 | | struct ym2610_info *info = sndti_token(sound_type,0); |
| 236 | //logerror("PC %04x: 2610 S0A=%02X\n",activecpu_get_pc(),YM2610Read(sndti_token(chip_type,0,0)); |
| 237 | struct ym2610_info *info = sndti_token(chip_type,0); |
| 238 | 238 | return YM2610Read(info->chip,0); |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | READ16_HANDLER( YM2610_status_port_0_A_lsb_r ) |
| 242 | 242 | { |
| 243 | | //logerror("PC %04x: 2610 S0A=%02X\n",activecpu_get_pc(),YM2610Read(sndti_token(sound_type,0,0)); |
| 244 | | struct ym2610_info *info = sndti_token(sound_type,0); |
| 243 | //logerror("PC %04x: 2610 S0A=%02X\n",activecpu_get_pc(),YM2610Read(sndti_token(chip_type,0,0)); |
| 244 | struct ym2610_info *info = sndti_token(chip_type,0); |
| 245 | 245 | return YM2610Read(info->chip,0); |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | READ8_HANDLER( YM2610_status_port_0_B_r ) |
| 249 | 249 | { |
| 250 | | //logerror("PC %04x: 2610 S0B=%02X\n",activecpu_get_pc(),YM2610Read(sndti_token(sound_type,0,2)); |
| 251 | | struct ym2610_info *info = sndti_token(sound_type,0); |
| 250 | //logerror("PC %04x: 2610 S0B=%02X\n",activecpu_get_pc(),YM2610Read(sndti_token(chip_type,0,2)); |
| 251 | struct ym2610_info *info = sndti_token(chip_type,0); |
| 252 | 252 | return YM2610Read(info->chip,2); |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | READ16_HANDLER( YM2610_status_port_0_B_lsb_r ) |
| 256 | 256 | { |
| 257 | | //logerror("PC %04x: 2610 S0B=%02X\n",activecpu_get_pc(),YM2610Read(sndti_token(sound_type,0,2)); |
| 258 | | struct ym2610_info *info = sndti_token(sound_type,0); |
| 257 | //logerror("PC %04x: 2610 S0B=%02X\n",activecpu_get_pc(),YM2610Read(sndti_token(chip_type,0,2)); |
| 258 | struct ym2610_info *info = sndti_token(chip_type,0); |
| 259 | 259 | return YM2610Read(info->chip,2); |
| 260 | 260 | } |
| 261 | 261 | |
| r1185 | r1186 | |
| 263 | 263 | /* Status Read for YM2610 - Chip 1 */ |
| 264 | 264 | /************************************************/ |
| 265 | 265 | READ8_HANDLER( YM2610_status_port_1_A_r ) { |
| 266 | | struct ym2610_info *info = sndti_token(sound_type,1); |
| 266 | struct ym2610_info *info = sndti_token(chip_type,1); |
| 267 | 267 | return YM2610Read(info->chip,0); |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | READ16_HANDLER( YM2610_status_port_1_A_lsb_r ) { |
| 271 | | struct ym2610_info *info = sndti_token(sound_type,1); |
| 271 | struct ym2610_info *info = sndti_token(chip_type,1); |
| 272 | 272 | return YM2610Read(info->chip,0); |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | READ8_HANDLER( YM2610_status_port_1_B_r ) { |
| 276 | | struct ym2610_info *info = sndti_token(sound_type,1); |
| 276 | struct ym2610_info *info = sndti_token(chip_type,1); |
| 277 | 277 | return YM2610Read(info->chip,2); |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | READ16_HANDLER( YM2610_status_port_1_B_lsb_r ) { |
| 281 | | struct ym2610_info *info = sndti_token(sound_type,1); |
| 281 | struct ym2610_info *info = sndti_token(chip_type,1); |
| 282 | 282 | return YM2610Read(info->chip,2); |
| 283 | 283 | } |
| 284 | 284 | |
| r1185 | r1186 | |
| 286 | 286 | /* Port Read for YM2610 - Chip 0 */ |
| 287 | 287 | /************************************************/ |
| 288 | 288 | READ8_HANDLER( YM2610_read_port_0_r ){ |
| 289 | | struct ym2610_info *info = sndti_token(sound_type,0); |
| 289 | struct ym2610_info *info = sndti_token(chip_type,0); |
| 290 | 290 | return YM2610Read(info->chip,1); |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | READ16_HANDLER( YM2610_read_port_0_lsb_r ){ |
| 294 | | struct ym2610_info *info = sndti_token(sound_type,0); |
| 294 | struct ym2610_info *info = sndti_token(chip_type,0); |
| 295 | 295 | return YM2610Read(info->chip,1); |
| 296 | 296 | } |
| 297 | 297 | |
| r1185 | r1186 | |
| 299 | 299 | /* Port Read for YM2610 - Chip 1 */ |
| 300 | 300 | /************************************************/ |
| 301 | 301 | READ8_HANDLER( YM2610_read_port_1_r ){ |
| 302 | | struct ym2610_info *info = sndti_token(sound_type,1); |
| 302 | struct ym2610_info *info = sndti_token(chip_type,1); |
| 303 | 303 | return YM2610Read(info->chip,1); |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | READ16_HANDLER( YM2610_read_port_1_lsb_r ){ |
| 307 | | struct ym2610_info *info = sndti_token(sound_type,1); |
| 307 | struct ym2610_info *info = sndti_token(chip_type,1); |
| 308 | 308 | return YM2610Read(info->chip,1); |
| 309 | 309 | } |
| 310 | 310 | |
| r1185 | r1186 | |
| 315 | 315 | WRITE8_HANDLER( YM2610_control_port_0_A_w ) |
| 316 | 316 | { |
| 317 | 317 | //logerror("PC %04x: 2610 Reg A %02X",activecpu_get_pc(),data); |
| 318 | | struct ym2610_info *info = sndti_token(sound_type,0); |
| 318 | struct ym2610_info *info = sndti_token(chip_type,0); |
| 319 | 319 | YM2610Write(info->chip,0,data); |
| 320 | 320 | } |
| 321 | 321 | |
| r1185 | r1186 | |
| 324 | 324 | //logerror("PC %04x: 2610 Reg A %02X",activecpu_get_pc(),data); |
| 325 | 325 | if (ACCESSING_LSB) |
| 326 | 326 | { |
| 327 | | struct ym2610_info *info = sndti_token(sound_type,0); |
| 327 | struct ym2610_info *info = sndti_token(chip_type,0); |
| 328 | 328 | YM2610Write(info->chip,0,data); |
| 329 | 329 | } |
| 330 | 330 | } |
| r1185 | r1186 | |
| 332 | 332 | WRITE8_HANDLER( YM2610_control_port_0_B_w ) |
| 333 | 333 | { |
| 334 | 334 | //logerror("PC %04x: 2610 Reg B %02X",activecpu_get_pc(),data); |
| 335 | | struct ym2610_info *info = sndti_token(sound_type,0); |
| 335 | struct ym2610_info *info = sndti_token(chip_type,0); |
| 336 | 336 | YM2610Write(info->chip,2,data); |
| 337 | 337 | } |
| 338 | 338 | |
| r1185 | r1186 | |
| 341 | 341 | //logerror("PC %04x: 2610 Reg B %02X",activecpu_get_pc(),data); |
| 342 | 342 | if (ACCESSING_LSB) |
| 343 | 343 | { |
| 344 | | struct ym2610_info *info = sndti_token(sound_type,0); |
| 344 | struct ym2610_info *info = sndti_token(chip_type,0); |
| 345 | 345 | YM2610Write(info->chip,2,data); |
| 346 | 346 | } |
| 347 | 347 | } |
| r1185 | r1186 | |
| 351 | 351 | /* Consists of 2 addresses */ |
| 352 | 352 | /************************************************/ |
| 353 | 353 | WRITE8_HANDLER( YM2610_control_port_1_A_w ){ |
| 354 | | struct ym2610_info *info = sndti_token(sound_type,1); |
| 354 | struct ym2610_info *info = sndti_token(chip_type,1); |
| 355 | 355 | YM2610Write(info->chip,0,data); |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | WRITE16_HANDLER( YM2610_control_port_1_A_lsb_w ){ |
| 359 | 359 | if (ACCESSING_LSB) |
| 360 | 360 | { |
| 361 | | struct ym2610_info *info = sndti_token(sound_type,1); |
| 361 | struct ym2610_info *info = sndti_token(chip_type,1); |
| 362 | 362 | YM2610Write(info->chip,0,data); |
| 363 | 363 | } |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | WRITE8_HANDLER( YM2610_control_port_1_B_w ){ |
| 367 | | struct ym2610_info *info = sndti_token(sound_type,1); |
| 367 | struct ym2610_info *info = sndti_token(chip_type,1); |
| 368 | 368 | YM2610Write(info->chip,2,data); |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | WRITE16_HANDLER( YM2610_control_port_1_B_lsb_w ){ |
| 372 | 372 | if (ACCESSING_LSB) |
| 373 | 373 | { |
| 374 | | struct ym2610_info *info = sndti_token(sound_type,1); |
| 374 | struct ym2610_info *info = sndti_token(chip_type,1); |
| 375 | 375 | YM2610Write(info->chip,2,data); |
| 376 | 376 | } |
| 377 | 377 | } |
| r1185 | r1186 | |
| 383 | 383 | WRITE8_HANDLER( YM2610_data_port_0_A_w ) |
| 384 | 384 | { |
| 385 | 385 | //logerror(" =%02X\n",data); |
| 386 | | struct ym2610_info *info = sndti_token(sound_type,0); |
| 386 | struct ym2610_info *info = sndti_token(chip_type,0); |
| 387 | 387 | YM2610Write(info->chip,1,data); |
| 388 | 388 | } |
| 389 | 389 | |
| r1185 | r1186 | |
| 392 | 392 | //logerror(" =%02X\n",data); |
| 393 | 393 | if (ACCESSING_LSB) |
| 394 | 394 | { |
| 395 | | struct ym2610_info *info = sndti_token(sound_type,0); |
| 395 | struct ym2610_info *info = sndti_token(chip_type,0); |
| 396 | 396 | YM2610Write(info->chip,1,data); |
| 397 | 397 | } |
| 398 | 398 | } |
| r1185 | r1186 | |
| 400 | 400 | WRITE8_HANDLER( YM2610_data_port_0_B_w ) |
| 401 | 401 | { |
| 402 | 402 | //logerror(" =%02X\n",data); |
| 403 | | struct ym2610_info *info = sndti_token(sound_type,0); |
| 403 | struct ym2610_info *info = sndti_token(chip_type,0); |
| 404 | 404 | YM2610Write(info->chip,3,data); |
| 405 | 405 | } |
| 406 | 406 | |
| r1185 | r1186 | |
| 409 | 409 | //logerror(" =%02X\n",data); |
| 410 | 410 | if (ACCESSING_LSB) |
| 411 | 411 | { |
| 412 | | struct ym2610_info *info = sndti_token(sound_type,0); |
| 412 | struct ym2610_info *info = sndti_token(chip_type,0); |
| 413 | 413 | YM2610Write(info->chip,3,data); |
| 414 | 414 | } |
| 415 | 415 | } |
| r1185 | r1186 | |
| 419 | 419 | /* Consists of 2 addresses */ |
| 420 | 420 | /************************************************/ |
| 421 | 421 | WRITE8_HANDLER( YM2610_data_port_1_A_w ){ |
| 422 | | struct ym2610_info *info = sndti_token(sound_type,1); |
| 422 | struct ym2610_info *info = sndti_token(chip_type,1); |
| 423 | 423 | YM2610Write(info->chip,1,data); |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | WRITE16_HANDLER( YM2610_data_port_1_A_lsb_w ){ |
| 427 | 427 | if (ACCESSING_LSB) |
| 428 | 428 | { |
| 429 | | struct ym2610_info *info = sndti_token(sound_type,1); |
| 429 | struct ym2610_info *info = sndti_token(chip_type,1); |
| 430 | 430 | YM2610Write(info->chip,1,data); |
| 431 | 431 | } |
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | WRITE8_HANDLER( YM2610_data_port_1_B_w ){ |
| 435 | | struct ym2610_info *info = sndti_token(sound_type,1); |
| 435 | struct ym2610_info *info = sndti_token(chip_type,1); |
| 436 | 436 | YM2610Write(info->chip,3,data); |
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | WRITE16_HANDLER( YM2610_data_port_1_B_lsb_w ){ |
| 440 | 440 | if (ACCESSING_LSB) |
| 441 | 441 | { |
| 442 | | struct ym2610_info *info = sndti_token(sound_type,1); |
| 442 | struct ym2610_info *info = sndti_token(chip_type,1); |
| 443 | 443 | YM2610Write(info->chip,3,data); |
| 444 | 444 | } |
| 445 | 445 | } |