void namcos2_68k_video_palette_w( int offset, int data ) { int oldword = READ_WORD(&namcos2_68k_palette_ram[offset&0xffff]); int newword = COMBINE_WORD(oldword, data); int pen,red,green,blue; if(oldword != newword) { WRITE_WORD(&namcos2_68k_palette_ram[offset&0xffff],newword); /* 0x3000 offset is control registers */ if((offset&0x3000)!=0x3000) { pen=(((offset&0xc000)>>2) | (offset&0x0fff))>>1; red =(READ_WORD(&namcos2_68k_palette_ram[offset&0xcfff]))&0x00ff; green=(READ_WORD(&namcos2_68k_palette_ram[(offset&0xcfff)+0x1000]))&0x00ff; blue =(READ_WORD(&namcos2_68k_palette_ram[(offset&0xcfff)+0x2000]))&0x00ff; /* Int color, uchar r/g/b */ palette_change_color(pen,red,green,blue); // if (errorlog) fprintf(errorlog,"CPU#%d PC=$%06x Video Palette write Addr=%08x, Data=%04x\n",cpu_getactivecpu(),cpu_get_pc(),offset,data); if (errorlog) fprintf(errorlog,"CPU#%d PC=$%06x Video Palette PEN=%04x, R=%02x, G=%02x B=%02x\n",cpu_getactivecpu(),cpu_get_pc(),pen,red,green,blue); }
void atarisys2_paletteram_w (int offset, int data) { static const int intensity_table[16] = { #define ZB 115 #define Z3 78 #define Z2 37 #define Z1 17 #define Z0 9 0, ZB+Z0, ZB+Z1, ZB+Z1+Z0, ZB+Z2, ZB+Z2+Z0, ZB+Z2+Z1, ZB+Z2+Z1+Z0, ZB+Z3, ZB+Z3+Z0, ZB+Z3+Z1, ZB+Z3+Z1+Z0,ZB+ Z3+Z2, ZB+Z3+Z2+Z0, ZB+Z3+Z2+Z1, ZB+Z3+Z2+Z1+Z0 }; static const int color_table[16] = { 0x0, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xe, 0xf, 0xf }; int inten, red, green, blue; int oldword = READ_WORD (&paletteram[offset]); int newword = COMBINE_WORD (oldword, data); int indx = offset / 2; WRITE_WORD (&paletteram[offset], newword); inten = intensity_table[newword & 15]; red = (color_table[(newword >> 12) & 15] * inten) >> 4; green = (color_table[(newword >> 8) & 15] * inten) >> 4; blue = (color_table[(newword >> 4) & 15] * inten) >> 4; palette_change_color (indx, red, green, blue); }
static WRITE_HANDLER( ddragon3_io_w ){ reg[offset/2] = COMBINE_WORD(reg[offset],data); switch (offset) { case 0x0: ddragon3_vreg = reg[0]; break; case 0x2: /* soundlatch_w */ soundlatch_w(1,reg[1]&0xff); cpu_cause_interrupt( 1, Z80_NMI_INT ); break; case 0x4: /* this gets written to on startup and at the end of IRQ6 ** possibly trigger IRQ on sound CPU */ break; case 0x6: /* this gets written to on startup, ** and at the end of IRQ5 (input port read) */ break; case 0x8: /* this gets written to at the end of IRQ6 only */ break; default: //logerror("OUTPUT 1400[%02x] %08x, pc=%06x \n", offset,(unsigned)data, cpu_get_pc() ); break; } }
static void sync_w(int offset, int data) { int oldword = READ_WORD(&sync_data[offset]); int newword = COMBINE_WORD(oldword, data); WRITE_WORD(&sync_data[offset], newword); if ((oldword & 0xff00) != (newword & 0xff00)) cpu_yield(); }
static WRITE_HANDLER( sync_w ) { int oldword = READ_WORD(&sync_data[offset]); int newword = COMBINE_WORD(oldword, data); WRITE_WORD(&sync_data[offset], newword); if ((oldword & 0xff00) != (newword & 0xff00)) cpu_yield(); }
static void cabal_background_w( int offset, int data ){ int oldword = READ_WORD(&videoram[offset]); int newword = COMBINE_WORD(oldword,data); if( oldword != newword ){ WRITE_WORD(&videoram[offset],newword); dirtybuffer[offset/2] = 1; } }
void atarisys2_hscroll_w (int offset, int data) { int oldword = READ_WORD (&atarigen_hscroll[offset]); int newword = COMBINE_WORD (oldword, data); WRITE_WORD (&atarigen_hscroll[offset], newword); /* if we changed the bank, we need to rerender the playfield */ if (offset == 0 && (oldword & 15) != (newword & 15)) fast_memset (playfielddirty, 1, playfieldram_size / 2); }
void klax_playfieldram_w (int offset, int data) { int oldword = READ_WORD (&atarigen_playfieldram[offset]); int newword = COMBINE_WORD (oldword, data); if (oldword != newword) { WRITE_WORD (&atarigen_playfieldram[offset], newword); playfielddirty[(offset & 0xfff) / 2] = 1; } }
void eprom_playfieldpalram_w(int offset, int data) { int oldword = READ_WORD(&eprom_playfieldpalram[offset]); int newword = COMBINE_WORD(oldword, data); if (oldword != newword) { WRITE_WORD(&eprom_playfieldpalram[offset], newword); atarigen_pf_dirty[offset / 2] = 1; } }
void badlands_playfieldram_w(int offset, int data) { int oldword = READ_WORD(&atarigen_playfieldram[offset]); int newword = COMBINE_WORD(oldword, data); if (oldword != newword) { WRITE_WORD(&atarigen_playfieldram[offset], newword); atarigen_pf_dirty[offset / 2] = 0xff; } }
void toobin_playfieldram_w (int offset, int data) { int oldword = READ_WORD (&atarigen_playfieldram[offset]); int newword = COMBINE_WORD (oldword, data); if (oldword != newword) { WRITE_WORD (&atarigen_playfieldram[offset], newword); playfielddirty[offset / 4] = 1; } }
void badlands_pf_bank_w(int offset, int data) { int oldword = READ_WORD(&atarigen_playfieldram[offset]); int newword = COMBINE_WORD(oldword, data); if (oldword != newword) { pf_state.param[0] = data & 1; atarigen_pf_update(&pf_state, cpu_getscanline()); } }
static WRITE_HANDLER( interrupt_scan_w ) { int oldword = READ_WORD(&interrupt_scan[offset]); int newword = COMBINE_WORD(oldword, data); /* if something changed, update the word in memory */ if (oldword != newword) { WRITE_WORD(&interrupt_scan[offset], newword); atarigen_scanline_int_set(newword & 0x1ff); } }
void bionicc_fgvideoram_w(int offset,int data) { int oldword = READ_WORD(&bionicc_fgvideoram[offset]); int newword = COMBINE_WORD(oldword,data); if (oldword != newword) { int tile_index = offset/4; WRITE_WORD(&bionicc_fgvideoram[offset],newword); tilemap_mark_tile_dirty(fg_tilemap,tile_index%64,tile_index/64); } }
void bionicc_txvideoram_w(int offset,int data) { int oldword = READ_WORD(&bionicc_txvideoram[offset]); int newword = COMBINE_WORD(oldword,data); if (oldword != newword) { int tile_index = (offset&0x7ff)/2; WRITE_WORD(&bionicc_txvideoram[offset],newword); tilemap_mark_tile_dirty(tx_tilemap,tile_index%32,tile_index/32); } }
void zerowing_videoram3_w(int offset, int data) { int oldword = READ_WORD (&zerowing_videoram3[(video_ofs3 & (VIDEORAM3_SIZE-1))*4 + offset]); int newword = COMBINE_WORD (oldword, data); #ifdef DEBUG if ((video_ofs3 & (VIDEORAM3_SIZE-1))*4 + offset >= VIDEORAM3_SIZE*4) { return; } #endif WRITE_WORD (&zerowing_videoram3[(video_ofs3 & (VIDEORAM3_SIZE-1))*4 + offset],newword); if ( offset == 2 ) video_ofs3++; }
void zerowing_videoram2_w(int offset, int data) { int oldword = READ_WORD (&zerowing_videoram2[2*video_ofs & (VIDEORAM2_SIZE-1)]); int newword = COMBINE_WORD (oldword, data); #ifdef DEBUG if (2*video_ofs >= VIDEORAM2_SIZE) { return; } #endif WRITE_WORD (&zerowing_videoram2[2*video_ofs & (VIDEORAM2_SIZE-1)],newword); video_ofs++; }
void relief_playfield2ram_w(int offset, int data) { int oldword = READ_WORD(&atarigen_playfield2ram[offset]); int newword = COMBINE_WORD(oldword, data); /* only update if changed */ if (oldword != newword) { WRITE_WORD(&atarigen_playfield2ram[offset], newword); atarigen_pf2_dirty[(offset / 2) & 0xfff] = 1; } /* handle the latch, but only write the upper byte */ if (atarigen_video_control_state.latch1 != -1) relief_colorram_w(offset, atarigen_video_control_state.latch1 | 0x00ff0000); }
void relief_colorram_w(int offset, int data) { int oldword = READ_WORD(&atarigen_playfieldram_color[offset]); int newword = COMBINE_WORD(oldword, data); /* only update if changed */ if (oldword != newword) { WRITE_WORD(&atarigen_playfieldram_color[offset], newword); oldword ^= newword; /* low byte affects pf1 */ if (oldword & 0x00ff) atarigen_pf_dirty[(offset / 2) & 0xfff] = 1; /* upper byte affects pf2 */ if (oldword & 0xff00) atarigen_pf2_dirty[(offset / 2) & 0xfff] = 1; } }
void atarisys2_bankselect_w (int offset, int data) { static int bankoffset[64] = { 0x28000, 0x20000, 0x18000, 0x10000, 0x2a000, 0x22000, 0x1a000, 0x12000, 0x2c000, 0x24000, 0x1c000, 0x14000, 0x2e000, 0x26000, 0x1e000, 0x16000, 0x48000, 0x40000, 0x38000, 0x30000, 0x4a000, 0x42000, 0x3a000, 0x32000, 0x4c000, 0x44000, 0x3c000, 0x34000, 0x4e000, 0x46000, 0x3e000, 0x36000, 0x68000, 0x60000, 0x58000, 0x50000, 0x6a000, 0x62000, 0x5a000, 0x52000, 0x6c000, 0x64000, 0x5c000, 0x54000, 0x6e000, 0x66000, 0x5e000, 0x56000, 0x88000, 0x80000, 0x78000, 0x70000, 0x8a000, 0x82000, 0x7a000, 0x72000, 0x8c000, 0x84000, 0x7c000, 0x74000, 0x8e000, 0x86000, 0x7e000, 0x76000 }; int oldword = READ_WORD (&atarisys2_bankselect[offset]); int newword = COMBINE_WORD (oldword, data); unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region]; unsigned char *base = &RAM[bankoffset[(newword >> 10) & 0x3f]]; WRITE_WORD (&atarisys2_bankselect[offset], newword); if (offset == 0) { cpu_setbank (1, base); t11_SetBank (0x4000, base); } else if (offset == 2) { cpu_setbank (2, base); t11_SetBank (0x6000, base); } }
void blstroid_playfieldram_w (int offset, int data) { int oldword = READ_WORD (&atarigen_playfieldram[offset]); int newword = COMBINE_WORD (oldword, data); if (oldword != newword) { WRITE_WORD (&atarigen_playfieldram[offset], newword); playfielddirty[offset / 2] = 1; /* modifying an interrupt state? */ if ((offset & 0x7f) == 0x50) { int row = (offset >> 7) & 0x1f; if ((newword & 0x8000) && !int1_timer[row]) int1_timer[row] = timer_set (cpu_getscanlinetime (8 * row), row, blstroid_int1_callback); else if (!(newword & 0x8000) && int1_timer[row]) { timer_remove (int1_timer[row]); int1_timer[row] = 0; } }
void toobin_paletteram_w (int offset, int data) { int oldword = READ_WORD (&paletteram[offset]); int newword = COMBINE_WORD (oldword, data); WRITE_WORD (&paletteram[offset], newword); { int red = (((newword >> 10) & 31) * 224) >> 5; int green = (((newword >> 5) & 31) * 224) >> 5; int blue = (((newword ) & 31) * 224) >> 5; if (red) red += 38; if (green) green += 38; if (blue) blue += 38; if (!(newword & 0x8000)) { red = (red * last_intensity) >> 5; green = (green * last_intensity) >> 5; blue = (blue * last_intensity) >> 5; } palette_change_color ((offset / 2) & 0x3ff, red, green, blue); }
void namcos2_68k_eeprom_w(int offset, int data) { int oldword = READ_WORD (&namcos2_eeprom[offset]); int newword = COMBINE_WORD (oldword, data); WRITE_WORD (&namcos2_eeprom[offset], newword); }