inline static void handle_fetch_matrix(long offset, CLOCK sub, CLOCK *write_offset) { raster_t *raster; *write_offset = 0; raster = &ted.raster; do_matrix_fetch(sub); if ((ted.ted_raster_counter >= ted.first_dma_line) && (ted.ted_raster_counter < ted.last_dma_line)) { ted.fetch_clk += ted.cycles_per_line; } else { ted.fetch_clk += (ted.screen_height - ted.ted_raster_counter) * ted.cycles_per_line; } alarm_set(ted.raster_fetch_alarm, ted.fetch_clk); return; }
inline static int handle_fetch_matrix(long offset, CLOCK sub, CLOCK *write_offset) { raster_t *raster; raster_sprite_status_t *sprite_status; *write_offset = 0; raster = &vicii.raster; sprite_status = raster->sprite_status; if (sprite_status->visible_msk == 0 && sprite_status->dma_msk == 0) { do_matrix_fetch(sub); /* As sprites are all turned off, there is no need for a sprite DMA check; next time we will VICII_FETCH_MATRIX again. This works because a VICII_CHECK_SPRITE_DMA is forced in `vic_store()' whenever the mask becomes nonzero. */ /* This makes sure we only create VICII_FETCH_MATRIX events in the bad line range. These checks are (a little) redundant for safety. */ if (raster->current_line < vicii.first_dma_line) { vicii.fetch_clk += ((vicii.first_dma_line - raster->current_line) * vicii.cycles_per_line); } else { if (raster->current_line >= vicii.last_dma_line) vicii.fetch_clk += ((vicii.screen_height - raster->current_line + vicii.first_dma_line) * vicii.cycles_per_line); else vicii.fetch_clk += vicii.cycles_per_line; } alarm_set(vicii.raster_fetch_alarm, vicii.fetch_clk); return 1; } else { int fetch_done; fetch_done = do_matrix_fetch(sub); /* Sprites might be turned on, check for sprite DMA next time. */ vicii.fetch_idx = VICII_CHECK_SPRITE_DMA; /* Calculate time for next event. */ vicii.fetch_clk = VICII_LINE_START_CLK(maincpu_clk) + vicii.sprite_fetch_cycle; if (vicii.fetch_clk > maincpu_clk || offset == 0) { /* Prepare the next fetch event. */ alarm_set(vicii.raster_fetch_alarm, vicii.fetch_clk); return 1; } if (fetch_done && sub == 0) *write_offset = VICII_SCREEN_TEXTCOLS + 3; } return 0; }