From 92725007a84df0a01baef10f4deac29fe5231ba7 Mon Sep 17 00:00:00 2001 From: nmlgc Date: Sun, 27 Sep 2020 00:35:13 +0200 Subject: [PATCH] =?UTF-8?q?[Decompilation]=20[th01]=20EGC-accelerated=20VR?= =?UTF-8?q?AM=20page=201=E2=9E=9C0=20row=20blitting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- th01/hardware/egc.h | 5 +++ th01/hardware/egcrows.cpp | 18 ++++++++++ th01/main_13.cpp | 6 +++- th01_reiiden.asm | 71 ++------------------------------------- 4 files changed, 31 insertions(+), 69 deletions(-) create mode 100644 th01/hardware/egcrows.cpp diff --git a/th01/hardware/egc.h b/th01/hardware/egc.h index 46cdb8ef..e459bfc9 100644 --- a/th01/hardware/egc.h +++ b/th01/hardware/egc.h @@ -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); diff --git a/th01/hardware/egcrows.cpp b/th01/hardware/egcrows.cpp new file mode 100644 index 00000000..60b9b1b0 --- /dev/null +++ b/th01/hardware/egcrows.cpp @@ -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(sizeof(page1)); + } + } + egc_off(); +} diff --git a/th01/main_13.cpp b/th01/main_13.cpp index 48ccee82..f6e18233 100644 --- a/th01/main_13.cpp +++ b/th01/main_13.cpp @@ -6,9 +6,13 @@ extern "C" { #include +#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" } diff --git a/th01_reiiden.asm b/th01_reiiden.asm index cc3e5867..e4e0c721 100644 --- a/th01_reiiden.asm +++ b/th01_reiiden.asm @@ -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