static void primo_draw_scanline(mame_bitmap *bitmap, int primo_scanline) { int x, i; UINT8 data; /* set up scanline */ UINT16 *scanline = (UINT16*) bitmap->line[primo_scanline]; /* address of current line in Primo video memory */ const UINT8* primo_video_ram_line = memory_get_read_ptr(0, ADDRESS_SPACE_PROGRAM, primo_video_memory_base + 32*primo_scanline); for (x=0; x<256; x+=8) { data = primo_video_ram_line[x/8]; for (i=0; i<8; i++) scanline[x+i]=Machine->pens[(data & (0x80>>i)) ? 1 : 0]; } }
/* The manual is not conclusive as to which bit of the DMVP register (offset 0x3D) determines which page for source or destination is used */ void gamecom_dma_init(void) { if ( gamecom_dma.decrement_x || gamecom_dma.decrement_y ) { logerror( "TODO: Decrement-x and decrement-y are not supported yet\n" ); } gamecom_dma.width_x = internal_registers[SM8521_DMDX]; gamecom_dma.width_x_count = 0; gamecom_dma.width_y = internal_registers[SM8521_DMDY]; gamecom_dma.width_y_count = 0; gamecom_dma.source_x = internal_registers[SM8521_DMX1]; gamecom_dma.source_x_current = gamecom_dma.source_x; gamecom_dma.source_y = internal_registers[SM8521_DMY1]; gamecom_dma.source_width = ( internal_registers[SM8521_LCH] & 0x20 ) ? 50 : 40; gamecom_dma.dest_x = internal_registers[SM8521_DMX2]; gamecom_dma.dest_x_current = gamecom_dma.dest_x; gamecom_dma.dest_y = internal_registers[SM8521_DMY2]; gamecom_dma.dest_width = ( internal_registers[SM8521_LCH] & 0x20 ) ? 50 : 40; gamecom_dma.palette[0] = ( internal_registers[SM8521_DMPL] & 0x03 ); gamecom_dma.palette[1] = ( internal_registers[SM8521_DMPL] & 0x0C ) >> 2; gamecom_dma.palette[2] = ( internal_registers[SM8521_DMPL] & 0x30 ) >> 4; gamecom_dma.palette[3] = ( internal_registers[SM8521_DMPL] & 0xC0 ) >> 6; gamecom_dma.source_mask = 0x1FFF; gamecom_dma.dest_mask = 0x1FFF; logerror("DMA: width %Xx%X, source (%X,%X), dest (%X,%X), transfer_mode %X, banks %X \n", gamecom_dma.width_x, gamecom_dma.width_y, gamecom_dma.source_x, gamecom_dma.source_y, gamecom_dma.dest_x, gamecom_dma.dest_y, gamecom_dma.transfer_mode, internal_registers[SM8521_DMVP] ); logerror( " Palette: %d, %d, %d, %d\n", gamecom_dma.palette[0], gamecom_dma.palette[1], gamecom_dma.palette[2], gamecom_dma.palette[3] ); switch( gamecom_dma.transfer_mode ) { case 0x00: /* VRAM->VRAM */ gamecom_dma.source_bank = &gamecom_vram[(internal_registers[SM8521_DMVP] & 0x01) ? 0x2000 : 0x0000]; gamecom_dma.dest_bank = &gamecom_vram[(internal_registers[SM8521_DMVP] & 0x02) ? 0x2000 : 0x0000]; break; case 0x02: /* ROM->VRAM */ logerror( "DMA DMBR = %X\n", internal_registers[SM8521_DMBR] ); gamecom_dma.source_width = 64; if ( internal_registers[SM8521_DMBR] < 16 ) { gamecom_dma.source_bank = memory_region(REGION_USER1) + (internal_registers[SM8521_DMBR] << 14); gamecom_dma.source_mask = 0x3FFF; } else { logerror( "TODO: Reading from external ROMs not supported yet\n" ); gamecom_dma.source_bank = memory_region(REGION_USER1); } gamecom_dma.dest_bank = &gamecom_vram[(internal_registers[SM8521_DMVP] & 0x02) ? 0x2000 : 0x0000]; break; case 0x04: /* Extend RAM->VRAM */ gamecom_dma.source_width = 64; gamecom_dma.source_bank = memory_get_read_ptr(0, ADDRESS_SPACE_PROGRAM, 0xE000 ); gamecom_dma.dest_bank = &gamecom_vram[(internal_registers[SM8521_DMVP] & 0x02) ? 0x2000 : 0x0000]; break; case 0x06: /* VRAM->Extend RAM */ gamecom_dma.source_bank = &gamecom_vram[(internal_registers[SM8521_DMVP] & 0x01) ? 0x2000 : 0x0000]; gamecom_dma.dest_width = 64; gamecom_dma.dest_bank = memory_get_read_ptr(0, ADDRESS_SPACE_PROGRAM, 0xE000 ); break; } gamecom_dma.source_current = gamecom_dma.source_width * gamecom_dma.source_y; gamecom_dma.source_current += gamecom_dma.source_x >> 2; gamecom_dma.dest_current = gamecom_dma.dest_width * gamecom_dma.dest_y; gamecom_dma.dest_current += gamecom_dma.dest_x >> 2; gamecom_dma.source_line = gamecom_dma.source_current; gamecom_dma.dest_line = gamecom_dma.dest_current; gamecom_dma.state_count = 0; }
/* update video hardware state depending on the new attribute */ static void oric_vh_update_attribute(int c) { /* attribute */ int attribute = c & 0x03f; switch ((attribute>>3) & 0x03) { case 0: { /* set foreground colour */ vh_state.foreground_colour = attribute & 0x07; oric_vh_update_flash(); } break; case 1: { vh_state.text_attributes = attribute & 0x07; oric_refresh_charset(); /* text attributes */ oric_vh_update_flash(); } break; case 2: { /* set background colour */ vh_state.background_colour = attribute & 0x07; oric_vh_update_flash(); } break; case 3: { /* set video mode */ vh_state.mode = attribute & 0x07; /* a different charset base is used depending on the video mode */ /* hires takes all the data from 0x0a000 through to about 0x0bf68, so the charset is moved to 0x09800 */ /* text mode starts at 0x0bb80 and so the charset is in a different location */ if (vh_state.mode & (1<<2)) { /* set screen memory base and standard charset location for this mode */ vh_state.read_addr = 0x0a000; if (oric_ram) vh_state.char_base = oric_ram + (unsigned long)0x09800; else vh_state.char_base = memory_get_read_ptr(0, ADDRESS_SPACE_PROGRAM, 0x09800); /* changing the mode also changes the position of the standard charset and alternative charset */ oric_refresh_charset(); } else { /* set screen memory base and standard charset location for this mode */ vh_state.read_addr = 0x0bb80; if (oric_ram) vh_state.char_base = oric_ram + (unsigned long)0x0b400; else vh_state.char_base = memory_get_read_ptr(0, ADDRESS_SPACE_PROGRAM, 0x0b400); /* changing the mode also changes the position of the standard charset and alternative charset */ oric_refresh_charset(); } } break; default: break; } }