void darkedge_fd1149_vblank(void) { program_write_word(0x20f072, 0); program_write_word(0x20f082, 0); if( program_read_byte(0x20a12c) != 0 ) { program_write_byte(0x20a12c, program_read_byte(0x20a12c)-1 ); if( program_read_byte(0x20a12c) == 0 ) program_write_byte(0x20a12e, 1); } }
static READ8_HANDLER(main_obj_r) { UINT8 result; cpuintrf_push_context(2); result = program_read_byte(offset | (v30_obj_addr << 16)); cpuintrf_pop_context(); return result; }
INLINE int READ_NIBBLE(SaturnAdr adr) { int data; saturn_ICount-=3; data = program_read_byte(adr); if (saturn.config&&saturn.config->crc) saturn.config->crc(adr, data); return data; }
UINT8 cpunum_read_byte(int cpunum, offs_t address) { int result; VERIFY_CPUNUM(cpunum_read_byte); cpuintrf_push_context(cpunum); result = program_read_byte(address); cpuintrf_pop_context(); return result; }
static Z80DMA_READ(mario_dma_read_byte) { UINT8 result; cpuintrf_push_context(0); result = program_read_byte(offset); cpuintrf_pop_context(); return result; }
static READ8_HANDLER( apple3_indexed_read ) { UINT8 result; UINT8 *addr; addr = apple3_get_indexed_addr(offset); if (!addr) result = program_read_byte(offset); else if (addr != (UINT8 *) ~0) result = *addr; else result = memory_region(REGION_CPU1)[offset % memory_region_length(REGION_CPU1)]; return result; }
static WRITE8_HANDLER( i8257_LMSR_w ) { if(!data) { INT32 src=e00x_d[0][1]*256+e00x_d[0][0]; INT32 dst=e00x_d[2][1]*256+e00x_d[2][0]; INT32 size=(e00x_d[1][1]*256+e00x_d[1][0])&0x3ff; INT32 i; size++; /*?? */ for(i=0;i<size;i++) { program_write_byte(dst++, program_read_byte(src++)); } e00x_l[0]=0; e00x_l[1]=0; e00x_l[2]=0; e00x_l[3]=0; } }
static READ8_HANDLER( ram_mirror_r ) { return program_read_byte(0x1000+offset); }
static READ8_HANDLER( spunchout_prot_r ) { switch ( offset ) { case 0x00: if ( prot_mode_sel == 0x0a ) return program_read_byte(0xd012); if ( prot_mode_sel == 0x0b || prot_mode_sel == 0x23 ) return program_read_byte(0xd7c1); return prot_mem[offset]; break; case 0x01: if ( prot_mode_sel == 0x08 ) /* PC = 0x0b6a */ return 0x00; /* under 6 */ break; case 0x02: if ( prot_mode_sel == 0x0b ) /* PC = 0x0613 */ return 0x09; /* write "JMP (HL)"code to 0d79fh */ if ( prot_mode_sel == 0x09 ) /* PC = 0x20f9, 0x22d9 */ return prot_mem[offset]; /* act as registers */ break; case 0x03: if ( prot_mode_sel == 0x09 ) /* PC = 0x1e4c */ return prot_mem[offset] & 0x07; /* act as registers with mask */ break; case 0x05: if ( prot_mode_sel == 0x09 ) /* PC = 0x29D1 */ return prot_mem[offset] & 0x03; /* AND 0FH -> AND 06H */ break; case 0x06: if ( prot_mode_sel == 0x0b ) /* PC = 0x2dd8 */ return 0x0a; /* E=00, HL=23E6, D = (ret and 0x0f), HL+DE = 2de6 */ if ( prot_mode_sel == 0x09 ) /* PC = 0x2289 */ return prot_mem[offset] & 0x07; /* act as registers with mask */ break; case 0x09: if ( prot_mode_sel == 0x09 ) /* PC = 0x0313 */ return ( prot_mem[15] << 4 ); /* pipe through register 0xf7 << 4 */ /* (ret or 0x10) -> (D7DF),(D7A0) - (D7DF),(D7A0) = 0d0h(ret nc) */ break; case 0x0a: if ( prot_mode_sel == 0x0b ) /* PC = 0x060a */ return 0x05; /* write "JMP (IX)"code to 0d79eh */ if ( prot_mode_sel == 0x09 ) /* PC = 0x1bd7 */ return prot_mem[offset] & 0x01; /* AND 0FH -> AND 01H */ break; case 0x0b: if ( prot_mode_sel == 0x09 ) /* PC = 0x2AA3 */ return prot_mem[11] & 0x03; /* AND 0FH -> AND 03H */ break; case 0x0c: /* PC = 0x2162 */ /* B = 0(return value) */ return 0x00; case 0x0d: return prot_mode_sel; break; } logerror("Read from unknown protection? port %02x ( selector = %02x )\n", offset, prot_mode_sel ); return prot_mem[offset]; }
INLINE UINT8 READ_BYTE(UINT16 adr) { return program_read_byte(adr); }
int vic6560_dma_read (int offset) { /* should read real system bus between 0x9000 and 0xa000 */ return program_read_byte(VIC6560ADDR2VC20ADDR (offset)); }
static void svision_update (void *param,stream_sample_t **inputs, stream_sample_t **_buffer,int length) { stream_sample_t *left=_buffer[0], *right=_buffer[1]; int i, j; SVISION_CHANNEL *channel; for (i = 0; i < length; i++, left++, right++) { *left = 0; *right = 0; for (channel=svision_channel, j=0; j<ARRAY_LENGTH(svision_channel); j++, channel++) { if (channel->size != 0) { if (channel->on||channel->count) { bool on = FALSE; switch (channel->waveform) { case 0: on = channel->pos <= (28 * channel->size) >> 5; break; case 1: on = channel->pos <= (24 * channel->size) >> 5; break; default: case 2: on = channel->pos <= channel->size / 2; break; case 3: on = channel->pos <= (9 * channel->size) >> 5; break; } { INT16 s = on ? channel->volume << 8 : 0; if (j == 0) *right += s; else *left += s; } } channel->pos++; if (channel->pos >= channel->size) channel->pos = 0; } } if (svision_noise.on && (svision_noise.play || svision_noise.count)) { INT16 s = (svision_noise.value ? 1 << 8: 0) * svision_noise.volume; bool b1, b2; if (svision_noise.left) *left += s; if (svision_noise.right) *right += s; svision_noise.pos += svision_noise.step; if (svision_noise.pos >= 1.0) { switch (svision_noise.type) { case SVISION_NOISE_Type7Bit: svision_noise.value = svision_noise.state & 0x40 ? 1 : 0; b1 = (svision_noise.state & 0x40) != 0; b2 = (svision_noise.state & 0x20) != 0; svision_noise.state=(svision_noise.state<<1)+(b1!=b2?1:0); break; case SVISION_NOISE_Type14Bit: default: svision_noise.value = svision_noise.state & 0x2000 ? 1 : 0; b1 = (svision_noise.state & 0x2000) != 0; b2 = (svision_noise.state & 0x1000) != 0; svision_noise.state = (svision_noise.state << 1) + (b1 != b2 ? 1 : 0); } svision_noise.pos -= 1; } } if (svision_dma.on) { UINT8 sample; INT16 s; UINT16 addr = svision_dma.start + (unsigned) svision_dma.pos / 2; if (addr >= 0x8000 && addr < 0xc000) { sample = memory_region(REGION_USER1)[(addr & 0x3fff) | svision_dma.ca14to16]; } else { sample = program_read_byte(addr); } if (((unsigned)svision_dma.pos) & 1) s = (sample & 0xf); else s = (sample & 0xf0) >> 4; s <<= 8; if (svision_dma.left) *left += s; if (svision_dma.right) *right += s; svision_dma.pos += svision_dma.step; if (svision_dma.pos >= svision_dma.size) { svision_dma.finished = TRUE; svision_dma.on = FALSE; svision_irq(); } }