static READ8_HANDLER(data_408_r) { /* Hot Smash select_408=1 && bit 7==1 -> protection related ? Setting this bit to high cause win/lose/game over etc (see below) */ switch(select_408) { case 0: return 0; //pb? case 1: return is_pbillian?input_port_3_r(0):((spriteram[0x20]&1)?0x8c:input_port_3_r(0)); /* written by mcu ? (bit 7=1) (should be sequence of writes , 0x88+0x8c for example) 0x82 = no ball 0x83 = time over 0x84 = P1 score++ 0x86 = 0-1 0x87 = 1-0 0x88 = P1 WIN 0x89 = Game Over 0x8a = restart P1 side 0x8b = restart P2 side 0x8c = next level + restart */ case 2: return input_port_4_r(0); case 4: return input_port_0_r(0); case 8: return input_port_1_r(0); case 0x20: return 0; //pb ? case 0x80: return 0; //pb? case 0xf0: return 0; //hs? } logerror("408[%x] r at %x\n",select_408,activecpu_get_previouspc()); return 0; }
static READ8_HANDLER( track_1_r ) { return (input_port_1_r(offset) & 0xf0) | ((input_port_3_r(offset) - last_trackball_val[1]) & 0x0f); }
static READ8_HANDLER( control2_r ) { return 0x02 | EEPROM_read_bit() | (input_port_1_r(0) & 0xf0); }
static READ16_HANDLER( joystick_r ) { return (((input_port_0_r (offset) - 0xf) << 8) | ((input_port_1_r (offset) - 0xf) & 0xff)); }
int sprint2_read_ports(int offset) { int gear; gear=input_port_1_r(0); if (gear & 0x01) sprint2_gear1=1; else if (gear & 0x02) sprint2_gear1=2; else if (gear & 0x04) sprint2_gear1=3; else if (gear & 0x08) sprint2_gear1=4; if (gear & 0x10) sprint2_gear2=1; else if (gear & 0x20) sprint2_gear2=2; else if (gear & 0x40) sprint2_gear2=3; else if (gear & 0x80) sprint2_gear2=4; switch (offset) { /* IN0 */ case 0x28: return ((input_port_2_r(0) & 0x01) << 7); case 0x29: return ((input_port_2_r(0) & 0x02) << 6); case 0x2A: return ((input_port_2_r(0) & 0x04) << 5); case 0x2C: return ((input_port_2_r(0) & 0x08) << 4); case 0x2D: return ((input_port_2_r(0) & 0x10) << 3); case 0x2E: return ((input_port_2_r(0) & 0x20) << 2); /* IN1 */ case 0x18: if (sprint2_gear1==1) return 0x00; else return 0x80; case 0x19: if (sprint2_gear2==1) return 0x00; else return 0x80; case 0x1A: if (sprint2_gear1==2) return 0x00; else return 0x80; case 0x1B: if (sprint2_gear2==2) return 0x00; else return 0x80; case 0x1C: if (sprint2_gear1==3) return 0x00; else return 0x80; case 0x1D: if (sprint2_gear2==3) return 0x00; else return 0x80; /* DSW */ case 0x10: case 0x14: case 0x30: case 0x34: return ((input_port_0_r(0) & 0x03) << 6); case 0x11: case 0x15: case 0x31: case 0x35: return ((input_port_0_r(0) & 0x0C) << 4); case 0x12: case 0x16: case 0x32: case 0x36: return ((input_port_0_r(0) & 0x30) << 2); case 0x13: case 0x17: case 0x33: case 0x37: return ((input_port_0_r(0) & 0xC0) << 0); /* Just in case */ default: return 0xFF; } }
static READ8_HANDLER(prot_r) { return (input_port_1_r(0)&0x1f)|protData[protAdr]; }
int seawolf2_controller2_r(int offset) { return (input_port_1_r(0) & 0x80) + ControllerTable[Controller2]; }
INLINE int m6530_r(int chip, int offset) { int data = 0xff; switch (offset) { case 0x00: case 0x08: /* Data register A */ if (chip == 1) { int which = ((m6530[1].drob & m6530[1].ddrb) >> 1) & 0x0f; switch (which) { case 0: /* key row 1 */ m6530[1].dria = input_port_0_r(0); logerror("read keybd(%d): %c%c%c%c%c%c%c\n", which, (m6530[1].dria & 0x40) ? '.' : '0', (m6530[1].dria & 0x20) ? '.' : '1', (m6530[1].dria & 0x10) ? '.' : '2', (m6530[1].dria & 0x08) ? '.' : '3', (m6530[1].dria & 0x04) ? '.' : '4', (m6530[1].dria & 0x02) ? '.' : '5', (m6530[1].dria & 0x01) ? '.' : '6'); break; case 1: /* key row 2 */ m6530[1].dria = input_port_1_r(0); logerror("read keybd(%d): %c%c%c%c%c%c%c\n", which, (m6530[1].dria & 0x40) ? '.' : '7', (m6530[1].dria & 0x20) ? '.' : '8', (m6530[1].dria & 0x10) ? '.' : '9', (m6530[1].dria & 0x08) ? '.' : 'A', (m6530[1].dria & 0x04) ? '.' : 'B', (m6530[1].dria & 0x02) ? '.' : 'C', (m6530[1].dria & 0x01) ? '.' : 'D'); break; case 2: /* key row 3 */ m6530[1].dria = input_port_2_r(0); logerror("read keybd(%d): %c%c%c%c%c%c%c\n", which, (m6530[1].dria & 0x40) ? '.' : 'E', (m6530[1].dria & 0x20) ? '.' : 'F', (m6530[1].dria & 0x10) ? '.' : 'a', (m6530[1].dria & 0x08) ? '.' : 'd', (m6530[1].dria & 0x04) ? '.' : '+', (m6530[1].dria & 0x02) ? '.' : 'g', (m6530[1].dria & 0x01) ? '.' : 'p'); break; case 3: /* WR4?? */ m6530[1].dria = 0xff; break; default: m6530[1].dria = 0xff; logerror("read DRA(%d) $ff\n", which); } } data = (m6530[chip].dria & ~m6530[chip].ddra) | (m6530[chip].droa & m6530[chip].ddra); logerror("m6530(%d) DRA read : $%02x\n", chip, data); break; case 0x01: case 0x09: /* Data direction register A */ data = m6530[chip].ddra; logerror("m6530(%d) DDRA read : $%02x\n", chip, data); break; case 0x02: case 0x0a: /* Data register B */ data = (m6530[chip].drib & ~m6530[chip].ddrb) | (m6530[chip].drob & m6530[chip].ddrb); logerror("m6530(%d) DRB read : $%02x\n", chip, data); break; case 0x03: case 0x0b: /* Data direction register B */ data = m6530[chip].ddrb; logerror("m6530(%d) DDRB read : $%02x\n", chip, data); break; case 0x04: case 0x0c: /* Timer count read (not supported?) */ data = (int) (256 * timer_timeleft(m6530[chip].timer) / TIME_IN_HZ(m6530[chip].clock)); m6530[chip].irqen = (offset & 8) ? 1 : 0; logerror("m6530(%d) TIMR read : $%02x%s\n", chip, data, (offset & 8) ? " (IRQ)" : ""); break; case 0x05: case 0x0d: /* Timer count read (not supported?) */ data = (int) (256 * timer_timeleft(m6530[chip].timer) / TIME_IN_HZ(m6530[chip].clock)); m6530[chip].irqen = (offset & 8) ? 1 : 0; logerror("m6530(%d) TIMR read : $%02x%s\n", chip, data, (offset & 8) ? " (IRQ)" : ""); break; case 0x06: case 0x0e: /* Timer count read */ data = (int) (256 * timer_timeleft(m6530[chip].timer) / TIME_IN_HZ(m6530[chip].clock)); m6530[chip].irqen = (offset & 8) ? 1 : 0; logerror("m6530(%d) TIMR read : $%02x%s\n", chip, data, (offset & 8) ? " (IRQ)" : ""); break; case 0x07: case 0x0f: /* Timer status read */ data = m6530[chip].state; m6530[chip].state &= ~0x80; m6530[chip].irqen = (offset & 8) ? 1 : 0; logerror("m6530(%d) STAT read : $%02x%s\n", chip, data, (offset & 8) ? " (IRQ)" : ""); break; }
void spacewar_vh_screenrefresh (struct osd_bitmap *bitmap, int full_refresh) { int tk[] = {3, 8, 4, 9, 1, 6, 2, 7, 5, 0}; int i, pwidth, pheight, key, row, col, sw_option; float scale; struct osd_bitmap vector_bitmap; struct rectangle rect; static int sw_option_change; if (spacewar_panel == NULL) { vector_vh_update(bitmap, full_refresh); vector_clear_list (); return; } pwidth = spacewar_panel->artwork->width; pheight = spacewar_panel->artwork->height; vector_bitmap.width = bitmap->width; vector_bitmap.height = bitmap->height - pheight; vector_bitmap._private = bitmap->_private; vector_bitmap.line = bitmap->line; vector_vh_update(&vector_bitmap,full_refresh); vector_clear_list (); if (full_refresh) copybitmap(bitmap,spacewar_panel->artwork,0,0, 0,bitmap->height - pheight, 0,TRANSPARENCY_NONE,0); scale = pwidth/1024.0; sw_option = input_port_2_r(0) | ((input_port_1_r(0) << 6) & 0x300); sw_option_change ^= sw_option; for (i = 0; i < 10; i++) { if (sw_option_change & (1 << i) || full_refresh) { key = tk[i]; col = key % 5; row = key / 5; rect.min_x = scale * (465 + 20 * col); rect.max_x = scale * (465 + 20 * col + 18); rect.min_y = scale * (39 + 20 * row) + vector_bitmap.height; rect.max_y = scale * (39 + 20 * row + 18) + vector_bitmap.height; if (sw_option & (1 << i)) { copybitmap(bitmap,spacewar_panel->artwork,0,0, 0, vector_bitmap.height, &rect,TRANSPARENCY_NONE,0); } else { copybitmap(bitmap,spacewar_pressed_panel->artwork,0,0, 0, vector_bitmap.height, &rect,TRANSPARENCY_NONE,0); } osd_mark_dirty (rect.min_x, rect.min_y, rect.max_x, rect.max_y, 0); } } sw_option_change = sw_option; }