2020-05-24 17:04:55 +00:00
|
|
|
|
#pragma option -O-
|
|
|
|
|
|
2020-10-01 14:34:46 +00:00
|
|
|
|
#include "th01/end/pic.hpp"
|
|
|
|
|
|
2020-05-24 17:04:55 +00:00
|
|
|
|
void pascal end_pics_load_palette_show(const char *fn)
|
|
|
|
|
{
|
|
|
|
|
graph_accesspage_func(1);
|
|
|
|
|
grp_put_palette_show(fn);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Avoid symbol duplication...
|
|
|
|
|
#define egc_start_copy egc_start_copy_1
|
2021-03-07 12:07:29 +00:00
|
|
|
|
#include "th01/hardware/egcstart.cpp"
|
2020-05-24 17:04:55 +00:00
|
|
|
|
|
|
|
|
|
void end_pic_show(int quarter)
|
|
|
|
|
{
|
|
|
|
|
egc_start_copy();
|
|
|
|
|
|
2020-08-21 18:13:08 +00:00
|
|
|
|
pixel_t src_left = ((quarter % 2) * PIC_W);
|
|
|
|
|
pixel_t src_top = ((quarter / 2) * PIC_H);
|
2020-08-21 17:18:28 +00:00
|
|
|
|
uvram_offset_t vram_offset_src = vram_offset_shift(src_left, src_top);
|
|
|
|
|
uvram_offset_t vram_offset_dst = vram_offset_shift(PIC_LEFT, PIC_TOP);
|
2020-08-21 18:13:08 +00:00
|
|
|
|
vram_word_amount_t vram_x;
|
|
|
|
|
pixel_t y;
|
2020-05-24 17:04:55 +00:00
|
|
|
|
|
2022-06-15 20:05:09 +00:00
|
|
|
|
// This EGC-"accelerated" copy operation ends up performing a total of
|
|
|
|
|
// ((320 / 16) × 200 × 2) = 8000 VRAM page switches, which are everything
|
|
|
|
|
// but instant. Even the optimal assembly instructions for a *single* page
|
|
|
|
|
// switch, `MOV AL, (0|1)` followed by `OUT 0xA6, AL`, take 12 cycles on a
|
|
|
|
|
// 386 and 17 cycles on a 486, and ZUN adds the bloat of a standard
|
|
|
|
|
// function call on top of even that.
|
|
|
|
|
// Optimizations aside, using the EGC can't give you a better algorithm,
|
2022-08-09 17:43:22 +00:00
|
|
|
|
// as its tile registers are limited to 16 dots. Expanding to at least 32
|
2022-06-15 20:05:09 +00:00
|
|
|
|
// dots would have really been nice for ≥386 CPUs...
|
2020-05-24 17:04:55 +00:00
|
|
|
|
for(y = 0; y < PIC_H; y++) {
|
2022-08-09 17:43:22 +00:00
|
|
|
|
for(vram_x = 0; vram_x < (PIC_VRAM_W / EGC_REGISTER_SIZE); vram_x++) {
|
|
|
|
|
egc_temp_t d;
|
2020-05-24 17:04:55 +00:00
|
|
|
|
|
2022-08-09 17:43:22 +00:00
|
|
|
|
graph_accesspage_func(1); d = egc_chunk(vram_offset_src);
|
|
|
|
|
graph_accesspage_func(0); egc_chunk(vram_offset_dst) = d;
|
2020-05-24 17:04:55 +00:00
|
|
|
|
|
2022-08-09 17:43:22 +00:00
|
|
|
|
vram_offset_src += EGC_REGISTER_SIZE;
|
|
|
|
|
vram_offset_dst += EGC_REGISTER_SIZE;
|
2020-05-24 17:04:55 +00:00
|
|
|
|
}
|
|
|
|
|
vram_offset_src += (ROW_SIZE - PIC_VRAM_W);
|
|
|
|
|
vram_offset_dst += (ROW_SIZE - PIC_VRAM_W);
|
|
|
|
|
}
|
|
|
|
|
egc_off();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pragma option -O.
|