[Decompilation] [th01] EGC-accelerated VRAM page 1➜0 row blitting

Well well, the choice between sorting this function mechanically (and
putting it next to the EGC functions) or contextually (and putting it
next to the GDC SCROLL function)… Any choice would eventually turned
out suboptimal, I'm sure. 😅

Part of P0121, funded by Yanga.
This commit is contained in:
nmlgc 2020-09-27 00:35:13 +02:00
parent 1801e29cb3
commit 92725007a8
4 changed files with 31 additions and 69 deletions

View File

@ -16,3 +16,8 @@
void DEFCONV egc_copy_rect_1_to_0_16(
screen_x_t x, vram_y_t y, pixel_t w, pixel_t h
);
// Blits [h] rows starting at [top] from VRAM page 1 to the same position on
// VRAM page 0. Mainly used after a previous GDC scroll of [h] rows, to
// smoothly scroll between two full background images.
void egc_copy_rows_1_to_0(vram_y_t top, pixel_t h);

18
th01/hardware/egcrows.cpp Normal file
View File

@ -0,0 +1,18 @@
void egc_copy_rows_1_to_0(vram_y_t top, pixel_t h)
{
vram_offset_t vram_offset = vram_offset_muldiv(0, top);
egc_on();
egc_setup_copy();
for(pixel_t y = 0; y < h; y++) {
vram_word_amount_t x = 0;
while(x < (ROW_SIZE / 2)) {
dots16_t page1;
graph_accesspage_func(1); egc_snap(page1, vram_offset, 16);
graph_accesspage_func(0); egc_put(vram_offset, page1, 16);
x++;
vram_offset += static_cast<vram_offset_t>(sizeof(page1));
}
}
egc_off();
}

View File

@ -6,9 +6,13 @@
extern "C" {
#include <dos.h>
#include "libs/master.lib/master.h"
#include "platform.h"
#include "pc98.h"
#include "planar.h"
#include "th01/hardware/egc.h"
#include "th01/hardware/graph.h"
#include "th01/hardware/scrollup.cpp"
#include "th01/hardware/egcrows.cpp"
}

View File

@ -4558,68 +4558,7 @@ main_13__TEXT segment byte public 'CODE' use16
assume es:nothing, ss:nothing, ds:_DATA, fs:nothing, gs:nothing
extern _z_vsync_wait_and_scrollup:proc
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_11816 proc far
var_4 = word ptr -4
var_2 = word ptr -2
arg_0 = word ptr 6
arg_2 = word ptr 8
enter 4, 0
push si
push di
mov ax, [bp+arg_0]
imul ax, 50h
mov si, ax
call egc_on
EGC_SETUP_COPY
xor di, di
jmp short loc_11894
; ---------------------------------------------------------------------------
loc_11857:
mov [bp+var_2], 0
jmp short loc_1188D
; ---------------------------------------------------------------------------
loc_1185E:
push 1
call _graph_accesspage_func
les bx, _VRAM_PLANE_B
assume es:nothing
add bx, si
mov ax, es:[bx]
mov [bp+var_4], ax
push 0
call _graph_accesspage_func
add sp, 4
les bx, _VRAM_PLANE_B
add bx, si
mov ax, [bp+var_4]
mov es:[bx], ax
inc [bp+var_2]
add si, 2
loc_1188D:
cmp [bp+var_2], 28h ; '('
jl short loc_1185E
inc di
loc_11894:
cmp di, [bp+arg_2]
jl short loc_11857
call egc_off
pop di
pop si
leave
retf
sub_11816 endp
extern _egc_copy_rows_1_to_0:proc
; =============== S U B R O U T I N E =======================================
@ -35010,9 +34949,7 @@ sub_2869E proc far
loc_28703:
call _z_vsync_wait_and_scrollup stdcall, si
push 1
push si
call sub_11816
call _egc_copy_rows_1_to_0 stdcall, si, 1
push 1
call _frame_delay
add sp, 8
@ -42571,9 +42508,7 @@ loc_2D120:
loc_2D12A:
call _z_vsync_wait_and_scrollup stdcall, di
push 20h ; ' '
push di
call sub_11816
call _egc_copy_rows_1_to_0 stdcall, di, 32
push 1
call _frame_delay
add sp, 8