void i8275x_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { //int y = m_screen->vpos(); //int x = m_screen->hpos(); int rc = m_scanline / SCANLINES_PER_ROW; int lc = m_scanline % SCANLINES_PER_ROW; switch (id) { case TIMER_HRTC_ON: //logerror("I8275 '%s' y %u x %u HRTC 1\n", tag(), y, x); m_write_hrtc(1); break; case TIMER_DRQ_ON: //logerror("I8275 '%s' y %u x %u DRQ 1\n", tag(), y, x); m_write_drq(1); m_drq_off_timer->adjust(clocks_to_attotime(DMA_BURST_COUNT)); break; case TIMER_DRQ_OFF: if (m_buffer_idx == 0) { m_status |= ST_DU; m_du = true; //logerror("I8275 '%s' y %u x %u DRQ 0\n", tag(), y, x); m_write_drq(0); } else if (m_buffer_idx == CHARACTERS_PER_ROW) { //logerror("I8275 '%s' y %u x %u DRQ 0\n", tag(), y, x); m_write_drq(0); } else if (DMA_BURST_SPACE > 0) { //logerror("I8275 '%s' y %u x %u DRQ 0\n", tag(), y, x); m_write_drq(0); m_drq_on_timer->adjust(clocks_to_attotime(DMA_BURST_SPACE)); } break; case TIMER_SCANLINE: if (!(m_status & ST_VE)) break; //logerror("I8275 '%s' y %u x %u HRTC 0\n", tag(), y, x); m_write_hrtc(0); if (m_scanline == 0) { //logerror("I8275 '%s' y %u x %u VRTC 0\n", tag(), y, x); m_write_vrtc(0); } else if (m_scanline == m_irq_scanline) { if (m_status & ST_IE) { //logerror("I8275 '%s' y %u x %u IRQ 1\n", tag(), y, x); m_status |= ST_IR; m_write_irq(ASSERT_LINE); } } else if (m_scanline == m_vrtc_scanline) { //logerror("I8275 '%s' y %u x %u VRTC 1\n", tag(), y, x); m_write_vrtc(1); // reset field attributes m_hlgt = 0; m_vsp = 0; m_gpa = 0; m_rvv = 0, m_lten = 0; m_du = false; m_cursor_blink++; m_cursor_blink &= 0x1f; m_char_blink++; m_char_blink &= 0x3f; } if (lc == 0) { // swap line buffers m_buffer_dma = !m_buffer_dma; m_buffer_idx = 0; m_fifo_idx = 0; if (!m_du && ((m_scanline < m_vrtc_scanline - SCANLINES_PER_ROW) || (m_scanline == m_vrtc_drq_scanline))) { // start DMA burst m_drq_on_timer->adjust(clocks_to_attotime(DMA_BURST_SPACE)); } } if (m_scanline < m_vrtc_scanline) { for (int sx = 0; sx < CHARACTERS_PER_ROW; sx++) { int m_lineattr = 0; int lten = 0; int vsp = 0; UINT8 data = m_buffer[!m_buffer_dma][sx]; if (data & 0x80) { if ((data & 0xc0) == 0x80) { // field attribute code m_hlgt = (data & FAC_H) ? 1 : 0; m_vsp = (data & FAC_B) ? 1 : 0; m_gpa = (data & FAC_GG) >> 2; m_rvv = (data & FAC_R) ? 1 : 0; m_lten = (data & FAC_U) ? 1 : 0; if (!VISIBLE_FIELD_ATTRIBUTE) { int fifo_idx = 0; data = m_fifo[!m_buffer_dma][fifo_idx]; fifo_idx++; fifo_idx &= 0xf; } else { vsp = 1; } } else { // character attribute code } } if (!vsp && m_vsp) { vsp = (m_char_blink < 32) ? 1 : 0; } if ((rc == m_param[REG_CUR_ROW]) && (sx == m_param[REG_CUR_COL])) { int vis = 1; if (!(CURSOR_FORMAT & 0x02)) { vis = (m_cursor_blink < 16) ? 1 : 0; } if (CURSOR_FORMAT & 0x01) { lten = (lc == UNDERLINE) ? vis : 0; } else { lten = vis; } } if (OFFSET_LINE_COUNTER) { lc = (lc - 1) & 0x0f; } if (m_display_pixels) m_display_pixels(this, m_bitmap, sx * m_hpixels_per_column, // x position on screen of starting point m_scanline, // y position on screen lc, // current line of char (data & 0x7f), // char code to be displayed m_lineattr, // line attribute code lten | m_lten, // light enable signal m_rvv, // reverse video signal vsp, // video suppression m_gpa, // general purpose attribute code m_hlgt // highlight ); } }
void i8275_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { //int y = m_screen->vpos(); //int x = m_screen->hpos(); int rc = m_scanline / SCANLINES_PER_ROW; int lc = m_scanline % SCANLINES_PER_ROW; switch (id) { case TIMER_HRTC_ON: //LOG("I8275 y %u x %u HRTC 1\n", y, x); m_write_hrtc(1); break; case TIMER_DRQ_ON: //LOG("I8275 y %u x %u DRQ 1\n", y, x); m_write_drq(1); break; case TIMER_SCANLINE: if (!(m_status & ST_VE)) break; //LOG("I8275 y %u x %u HRTC 0\n", y, x); m_write_hrtc(0); if (m_scanline == 0) { //LOG("I8275 y %u x %u VRTC 0\n", y, x); m_write_vrtc(0); } if (m_scanline <= (m_vrtc_scanline - SCANLINES_PER_ROW)) { if (lc == 0) { if (m_buffer_idx < CHARACTERS_PER_ROW) { m_status |= ST_DU; m_du = true; //LOG("I8275 y %u x %u DMA Underrun\n", y, x); m_write_drq(0); } if (!m_du && !m_dma_stop) { // swap line buffers m_buffer_dma = !m_buffer_dma; m_buffer_idx = 0; m_fifo_idx = 0; if ((m_scanline < (m_vrtc_scanline - SCANLINES_PER_ROW))) { // start DMA burst m_drq_on_timer->adjust(clocks_to_attotime(DMA_BURST_SPACE)); } } } } if (m_scanline == m_irq_scanline) { if (m_status & ST_IE) { //LOG("I8275 y %u x %u IRQ 1\n", y, x); m_status |= ST_IR; m_write_irq(ASSERT_LINE); } } if (m_scanline == m_vrtc_scanline) { //LOG("I8275 y %u x %u VRTC 1\n", y, x); m_write_vrtc(1); // reset field attributes m_hlgt = 0; m_vsp = 0; m_gpa = 0; m_rvv = 0, m_lten = 0; m_du = false; m_dma_stop = false; m_end_of_screen = false; m_cursor_blink++; m_cursor_blink &= 0x1f; m_char_blink++; m_char_blink &= 0x3f; m_stored_attr = 0; } if (m_scanline == m_vrtc_drq_scanline) { // swap line buffers m_buffer_dma = !m_buffer_dma; m_buffer_idx = 0; m_fifo_idx = 0; // start DMA burst m_drq_on_timer->adjust(clocks_to_attotime(DMA_BURST_SPACE)); } if (m_scanline < m_vrtc_scanline) { int line_counter = OFFSET_LINE_COUNTER ? ((lc - 1) % SCANLINES_PER_ROW) : lc; bool end_of_row = false; int fifo_idx = 0; m_hlgt = (m_stored_attr & FAC_H) ? 1 : 0; m_vsp = (m_stored_attr & FAC_B) ? 1 : 0; m_gpa = (m_stored_attr & FAC_GG) >> 2; m_rvv = (m_stored_attr & FAC_R) ? 1 : 0; m_lten = ((m_stored_attr & FAC_U) != 0) && (lc == UNDERLINE) ? 1 : 0; for (int sx = 0; sx < CHARACTERS_PER_ROW; sx++) { int m_lineattr = 0; int lten = 0; int vsp = 0; int rvv = 0; uint8_t data = (end_of_row || m_end_of_screen) ? 0 : m_buffer[!m_buffer_dma][sx]; if (data & 0x80) { if ((data & 0xc0) == 0x80) { // field attribute code m_hlgt = (data & FAC_H) ? 1 : 0; m_vsp = (data & FAC_B) ? 1 : 0; m_gpa = (data & FAC_GG) >> 2; m_rvv = (data & FAC_R) ? 1 : 0; m_lten = ((data & FAC_U) != 0) && (lc == UNDERLINE) ? 1 : 0; if ((SCANLINES_PER_ROW - lc)==1) m_stored_attr = data; if (!VISIBLE_FIELD_ATTRIBUTE) { data = m_fifo[!m_buffer_dma][fifo_idx]; fifo_idx++; fifo_idx &= 0xf; } else { vsp = 1; } } else { if ((data & 0xf0) == 0xf0) { // special control character switch (data) { case SCC_END_OF_ROW: case SCC_END_OF_ROW_DMA: end_of_row = true; break; case SCC_END_OF_SCREEN: case SCC_END_OF_SCREEN_DMA: m_end_of_screen = true; break; } //vsp = 1; } else { // character attribute code m_hlgt = (data & CA_H) ? 1 : 0; m_vsp = (data & CA_B) ? 1 : 0; uint8_t ca; int cccc = (data >> 2) & 0x0f; if (line_counter < UNDERLINE) { ca = character_attribute[0][cccc]; } else if (line_counter == UNDERLINE) { ca = character_attribute[1][cccc]; } else { ca = character_attribute[2][cccc]; } m_lten = (ca & CA_LTEN) ? 1 : 0; m_vsp = (ca & CA_VSP) ? 1 : 0; m_lineattr = ca >> 2; } } } if (!vsp && m_vsp) { vsp = (m_char_blink < 32) ? 1 : 0; } if ((rc == m_param[REG_CUR_ROW]) && (sx == m_param[REG_CUR_COL])) { int vis = 1; if (!(CURSOR_FORMAT & 0x02)) { vis = (m_cursor_blink < 16) ? 1 : 0; } if (CURSOR_FORMAT & 0x01) { lten = (lc == UNDERLINE) ? vis : 0; } else { rvv = vis; } } if (end_of_row || m_end_of_screen) { vsp = 1; } if (!m_display_cb.isnull()) m_display_cb(m_bitmap, sx * m_hpixels_per_column, // x position on screen of starting point m_scanline, // y position on screen line_counter, // current line of char (data & 0x7f), // char code to be displayed m_lineattr, // line attribute code lten | m_lten, // light enable signal rvv ^ m_rvv, // reverse video signal vsp, // video suppression m_gpa, // general purpose attribute code m_hlgt // highlight ); }