From 9f7dde8953ac2e3e0f18a5d9512359ca193cdf9e Mon Sep 17 00:00:00 2001 From: nmlgc Date: Fri, 10 Jan 2020 21:25:29 +0100 Subject: [PATCH] [Decompilation] [th01] Inter-page rectangle moves MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Semi-unused, that is, the one use of this function doesn't actually move the rectangle to a different position. Ironically, the non-moving back-to-front function immediately above *is* unused… Also, too bad that stack order is the only reason we can't use structs to combine all plane variables into a single object. Part of P0067, funded by Splashman. --- Research/Borland C++ decompilation.md | 11 + pc98.h | 8 + th01/hardware/graph.cpp | 81 ++++++ th01/hardware/graph.h | 39 +++ th01/hardware/pages.h | 3 - th01/th01.h | 8 +- th01_fuuin.asm | 341 +------------------------- th01_op.asm | 275 --------------------- th01_reiiden.asm | 337 +------------------------ 9 files changed, 144 insertions(+), 959 deletions(-) create mode 100644 th01/hardware/graph.h delete mode 100644 th01/hardware/pages.h diff --git a/Research/Borland C++ decompilation.md b/Research/Borland C++ decompilation.md index 14430f19..96f5f26a 100644 --- a/Research/Borland C++ decompilation.md +++ b/Research/Borland C++ decompilation.md @@ -15,6 +15,17 @@ Example: | `[bp-1]` | `char var_2;` | | `[bp-2]` | `char var_3;` | +### Grouping + +Any structures or classes that contain more than a single scalar-type member +are grouped according to their declaration order, and placed *after* (that is, +further away from BP) than all scalar-type variables. This means that it's not +possible to bundle a set of variables with the same meaning into a structure +(e.g. pointers to all 4 VRAM planes) if a scalar-type variable is placed +inbetween two of these structure instances on the stack: Those structure +instances would be grouped and always placed next to each other, no matter +where the scalar-type variable is declared in relation to them. + ## Signedness | | | diff --git a/pc98.h b/pc98.h index 09f06dcc..d9c792e4 100644 --- a/pc98.h +++ b/pc98.h @@ -45,6 +45,14 @@ typedef bool page_t; #pragma option -a. /// -------- +/// Memory segments +/// --------------- +#define SEG_PLANE_B 0xA800 +#define SEG_PLANE_R 0xB000 +#define SEG_PLANE_G 0xB800 +#define SEG_PLANE_E 0xE000 +/// --------------- + /// Keyboard /// -------- typedef enum { diff --git a/th01/hardware/graph.cpp b/th01/hardware/graph.cpp index 427bf670..2f15b73d 100644 --- a/th01/hardware/graph.cpp +++ b/th01/hardware/graph.cpp @@ -4,13 +4,94 @@ extern "C" { #include #include "ReC98.h" #include "th01/hardware/vsync.h" +#include "th01/hardware/graph.h" #include "th01/hardware/palette.hpp" +/// VRAM plane "structures" +/// ----------------------- +#define Planes_declare(var) \ + planar8_t *var##_B = reinterpret_cast(MK_FP(SEG_PLANE_B, 0)); \ + planar8_t *var##_R = reinterpret_cast(MK_FP(SEG_PLANE_R, 0)); \ + planar8_t *var##_G = reinterpret_cast(MK_FP(SEG_PLANE_G, 0)); \ + planar8_t *var##_E = reinterpret_cast(MK_FP(SEG_PLANE_E, 0)); + +#define Planes_next_row(var) \ + var##_B += ROW_SIZE; \ + var##_R += ROW_SIZE; \ + var##_G += ROW_SIZE; \ + var##_E += ROW_SIZE; + +#define Planes_offset(var, x, y) \ + var##_B += (x / 8) + (y * ROW_SIZE); \ + var##_R += (x / 8) + (y * ROW_SIZE); \ + var##_G += (x / 8) + (y * ROW_SIZE); \ + var##_E += (x / 8) + (y * ROW_SIZE); + +#define PlanarRow_declare(var) \ + planar8_t var##_B[ROW_SIZE]; \ + planar8_t var##_R[ROW_SIZE]; \ + planar8_t var##_G[ROW_SIZE]; \ + planar8_t var##_E[ROW_SIZE]; \ + +#define PlanarRow_blit(dst, src, bytes) \ + memcpy(dst##_B, src##_B, bytes); \ + memcpy(dst##_R, src##_R, bytes); \ + memcpy(dst##_G, src##_G, bytes); \ + memcpy(dst##_E, src##_E, bytes); +/// ----------------------- + /// Pages /// ----- extern page_t page_back; /// ----- +void graph_copy_byterect_back_to_front( + int left, int top, int right, int bottom +) +{ + int w = (right - left) / 8; + int h = (bottom - top); + Planes_declare(p); + page_t page_front = page_back ^ 1; + int row; + PlanarRow_declare(tmp); + + Planes_offset(p, left, top); + for(row = 0; row < h; row++) { + PlanarRow_blit(tmp, p, w); + graph_accesspage(page_front); + PlanarRow_blit(p, tmp, w); + graph_accesspage(page_back); + Planes_next_row(p); + } +} + +void graph_move_byterect_interpage( + int src_left, int src_top, int src_right, int src_bottom, + int dst_left, int dst_top, + page_t src, page_t dst +) +{ + int w = (src_right - src_left) / 8; + int h = (src_bottom - src_top); + Planes_declare(src); + Planes_declare(dst); + int row; + PlanarRow_declare(tmp); + + Planes_offset(src, src_left, src_top); + Planes_offset(dst, dst_left, dst_top); + for(row = 0; row < h; row++) { + PlanarRow_blit(tmp, src, w); + graph_accesspage(dst); + PlanarRow_blit(dst, tmp, w); + graph_accesspage(src); + Planes_next_row(src); + Planes_next_row(dst); + } + graph_accesspage(page_back); +} + void z_palette_fade_from( uint4_t from_r, uint4_t from_g, uint4_t from_b, int keep[COLOR_COUNT], diff --git a/th01/hardware/graph.h b/th01/hardware/graph.h new file mode 100644 index 00000000..90ba26b5 --- /dev/null +++ b/th01/hardware/graph.h @@ -0,0 +1,39 @@ +/// Pages +/// ----- +// Also updates [page_back]. +void graph_showpage_func(page_t page); +void graph_accesspage_func(int page); +/// ----- + +/// GRCG +/// ---- +void grcg_setcolor_rmw(int col); +void grcg_setcolor_tdw(int col); +void grcg_off_func(void); +#undef grcg_off +#define grcg_off grcg_off_func +/// ---- + +/// Blitting +/// -------- +// Copies the given rectangle from +// (⌊left/8⌋*8, top) +// to +// (⌊left/8⌋*8 + ⌊(right-left)/8⌋*8, bottom) +// on the current back page to the same position on the current front page. +void graph_copy_byterect_back_to_front( + int left, int top, int right, int bottom +); + +// Moves the given source rectangle from +// (⌊left/8⌋*8, top) +// to +// (⌊left/8⌋*8 + ⌊(right-left)/8⌋*8, bottom) +// on the [src] page to the given position +// in the [dst] page. Already assumes [src] to be the currently accessed page. +void graph_move_byterect_interpage( + int src_left, int src_top, int src_right, int src_bottom, + int dst_left, int dst_top, + page_t src, page_t dst +); +/// -------- diff --git a/th01/hardware/pages.h b/th01/hardware/pages.h deleted file mode 100644 index 2a555536..00000000 --- a/th01/hardware/pages.h +++ /dev/null @@ -1,3 +0,0 @@ -// Also updates [page_back]. -void graph_showpage_func(page_t page); -void graph_accesspage_func(int page); diff --git a/th01/th01.h b/th01/th01.h index 239dcc36..d8566296 100644 --- a/th01/th01.h +++ b/th01/th01.h @@ -9,13 +9,7 @@ // -------- void egc_copy_rect_1_to_0(int x, int y, int w, int h); -#include "th01/hardware/pages.h" - -void grcg_setcolor_rmw(int color); -void grcg_setcolor_tdw(int color); -void grcg_off_func(void); -#undef grcg_off -#define grcg_off grcg_off_func +#include "th01/hardware/graph.h" // -------- // master.lib text function reimplementations diff --git a/th01_fuuin.asm b/th01_fuuin.asm index e1094c30..ed4621d2 100644 --- a/th01_fuuin.asm +++ b/th01_fuuin.asm @@ -3141,16 +3141,7 @@ arg_6 = dword ptr 0Ch push 30h ; '0' call _graph_slow_2xscale_rect_1_to_0 add sp, 0Ch - push 1 - push 0 - push 180h - push 0 - push 190h - push 120h - push 180h - push 0 - call sub_E56D - add sp, 10h + call _graph_move_byterect_interpage c, 0, 384, 288, RES_Y, 0, 384, 0, 1 jmp short loc_B67B ; --------------------------------------------------------------------------- @@ -8361,335 +8352,7 @@ loc_E41D: retf graph_putsa_fx endp - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_E42B proc far - -var_156 = byte ptr -156h -var_106 = byte ptr -106h -var_B6 = byte ptr -0B6h -dest = byte ptr -66h -var_16 = word ptr -16h -@@page_other = byte ptr -13h -var_12 = dword ptr -12h -var_E = dword ptr -0Eh -var_A = dword ptr -0Ah -_src = dword ptr -6 -var_2 = word ptr -2 -arg_0 = word ptr 6 -arg_2 = word ptr 8 -arg_4 = word ptr 0Ah -arg_6 = word ptr 0Ch - - enter 156h, 0 - push si - push di - mov di, [bp+arg_0] - mov ax, [bp+arg_4] - sub ax, di - mov bx, 8 - cwd - idiv bx - mov si, ax - mov ax, [bp+arg_6] - sub ax, [bp+arg_2] - mov [bp+var_2], ax - mov [bp+_src], 0A8000000h - mov [bp+var_A], 0B0000000h - mov [bp+var_E], 0B8000000h - mov [bp+var_12], 0E0000000h - mov al, _page_back - xor al, 1 - mov [bp+@@page_other], al - mov ax, di - cwd - idiv bx - mov dx, [bp+arg_2] - imul dx, 50h - add ax, dx - add word ptr [bp+_src], ax - mov ax, di - cwd - idiv bx - mov dx, [bp+arg_2] - imul dx, 50h - add ax, dx - add word ptr [bp+var_A], ax - mov ax, di - cwd - idiv bx - mov dx, [bp+arg_2] - imul dx, 50h - add ax, dx - add word ptr [bp+var_E], ax - mov ax, di - cwd - idiv bx - mov dx, [bp+arg_2] - imul dx, 50h - add ax, dx - add word ptr [bp+var_12], ax - mov [bp+var_16], 0 - jmp loc_E55F -; --------------------------------------------------------------------------- - -loc_E4BA: - push si ; n - pushd [bp+_src] ; src - push ss - lea ax, [bp+dest] - push ax ; dest - call _memcpy - push si ; n - pushd [bp+var_A] ; src - push ss - lea ax, [bp+var_B6] - push ax ; dest - call _memcpy - push si ; n - pushd [bp+var_E] ; src - push ss - lea ax, [bp+var_106] - push ax ; dest - call _memcpy - push si ; n - pushd [bp+var_12] ; src - push ss - lea ax, [bp+var_156] - push ax ; dest - call _memcpy - graph_accesspage [bp+@@page_other] - push si ; n - push ss - lea ax, [bp+dest] - push ax ; src - pushd [bp+_src] ; dest - call _memcpy - add sp, 32h - push si ; n - push ss - lea ax, [bp+var_B6] - push ax ; src - pushd [bp+var_A] ; dest - call _memcpy - push si ; n - push ss - lea ax, [bp+var_106] - push ax ; src - pushd [bp+var_E] ; dest - call _memcpy - push si ; n - push ss - lea ax, [bp+var_156] - push ax ; src - pushd [bp+var_12] ; dest - call _memcpy - add sp, 1Eh - graph_accesspage _page_back - add word ptr [bp+_src], 50h ; 'P' - add word ptr [bp+var_A], 50h ; 'P' - add word ptr [bp+var_E], 50h ; 'P' - add word ptr [bp+var_12], 50h ; 'P' - inc [bp+var_16] - -loc_E55F: - mov ax, [bp+var_16] - cmp ax, [bp+var_2] - jl loc_E4BA - pop di - pop si - leave - retf -sub_E42B endp - - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_E56D proc far - -var_164 = byte ptr -164h -var_114 = byte ptr -114h -var_C4 = byte ptr -0C4h -dest = byte ptr -74h -var_24 = word ptr -24h -var_22 = dword ptr -22h -var_1E = dword ptr -1Eh -var_1A = dword ptr -1Ah -var_16 = dword ptr -16h -var_12 = dword ptr -12h -var_E = dword ptr -0Eh -var_A = dword ptr -0Ah -_src = dword ptr -6 -var_2 = word ptr -2 -arg_0 = word ptr 6 -arg_2 = word ptr 8 -arg_4 = word ptr 0Ah -arg_6 = word ptr 0Ch -arg_8 = word ptr 0Eh -arg_A = word ptr 10h -@@page = byte ptr 12h -@@page_other = byte ptr 14h - - enter 164h, 0 - push si - push di - mov di, [bp+arg_0] - mov ax, [bp+arg_4] - sub ax, di - mov bx, 8 - cwd - idiv bx - mov si, ax - mov ax, [bp+arg_6] - sub ax, [bp+arg_2] - mov [bp+var_2], ax - mov [bp+_src], 0A8000000h - mov [bp+var_A], 0B0000000h - mov [bp+var_E], 0B8000000h - mov [bp+var_12], 0E0000000h - mov [bp+var_16], 0A8000000h - mov [bp+var_1A], 0B0000000h - mov [bp+var_1E], 0B8000000h - mov [bp+var_22], 0E0000000h - mov ax, di - cwd - idiv bx - mov dx, [bp+arg_2] - imul dx, 50h - add ax, dx - add word ptr [bp+_src], ax - mov ax, di - cwd - idiv bx - mov dx, [bp+arg_2] - imul dx, 50h - add ax, dx - add word ptr [bp+var_A], ax - mov ax, di - cwd - idiv bx - mov dx, [bp+arg_2] - imul dx, 50h - add ax, dx - add word ptr [bp+var_E], ax - mov ax, di - cwd - idiv bx - mov dx, [bp+arg_2] - imul dx, 50h - add ax, dx - add word ptr [bp+var_12], ax - mov ax, [bp+arg_8] - cwd - idiv bx - mov dx, [bp+arg_A] - imul dx, 50h - add ax, dx - add word ptr [bp+var_16], ax - mov ax, [bp+arg_8] - cwd - idiv bx - mov dx, [bp+arg_A] - imul dx, 50h - add ax, dx - add word ptr [bp+var_1A], ax - mov ax, [bp+arg_8] - cwd - idiv bx - mov dx, [bp+arg_A] - imul dx, 50h - add ax, dx - add word ptr [bp+var_1E], ax - mov ax, [bp+arg_8] - cwd - idiv bx - mov dx, [bp+arg_A] - imul dx, 50h - add ax, dx - add word ptr [bp+var_22], ax - mov [bp+var_24], 0 - jmp loc_E70D -; --------------------------------------------------------------------------- - -loc_E658: - push si ; n - pushd [bp+_src] ; src - push ss - lea ax, [bp+dest] - push ax ; dest - call _memcpy - push si ; n - pushd [bp+var_A] ; src - push ss - lea ax, [bp+var_C4] - push ax ; dest - call _memcpy - push si ; n - pushd [bp+var_E] ; src - push ss - lea ax, [bp+var_114] - push ax ; dest - call _memcpy - push si ; n - pushd [bp+var_12] ; src - push ss - lea ax, [bp+var_164] - push ax ; dest - call _memcpy - graph_accesspage [bp+@@page_other] - push si ; n - push ss - lea ax, [bp+dest] - push ax ; src - pushd [bp+var_16] ; dest - call _memcpy - add sp, 32h - push si ; n - push ss - lea ax, [bp+var_C4] - push ax ; src - pushd [bp+var_1A] ; dest - call _memcpy - push si ; n - push ss - lea ax, [bp+var_114] - push ax ; src - pushd [bp+var_1E] ; dest - call _memcpy - push si ; n - push ss - lea ax, [bp+var_164] - push ax ; src - pushd [bp+var_22] ; dest - call _memcpy - add sp, 1Eh - graph_accesspage [bp+@@page] - add word ptr [bp+_src], 50h ; 'P' - add word ptr [bp+var_A], 50h ; 'P' - add word ptr [bp+var_E], 50h ; 'P' - add word ptr [bp+var_12], 50h ; 'P' - add word ptr [bp+var_16], 50h ; 'P' - add word ptr [bp+var_1A], 50h ; 'P' - add word ptr [bp+var_1E], 50h ; 'P' - add word ptr [bp+var_22], 50h ; 'P' - inc [bp+var_24] - -loc_E70D: - mov ax, [bp+var_24] - cmp ax, [bp+var_2] - jl loc_E658 - graph_accesspage _page_back - pop di - pop si - leave - retf -sub_E56D endp - + extern _graph_move_byterect_interpage:proc extern _z_respal_set:proc fuuin_08_TEXT ends diff --git a/th01_op.asm b/th01_op.asm index 26ba258b..6f13150d 100644 --- a/th01_op.asm +++ b/th01_op.asm @@ -4654,281 +4654,6 @@ loc_CC59: retf graph_putsa_fx endp -; --------------------------------------------------------------------------- - enter 156h, 0 - push si - push di - mov di, [bp+6] - mov ax, [bp+0Ah] - sub ax, di - mov bx, 8 - cwd - idiv bx - mov si, ax - mov ax, [bp+0Ch] - sub ax, [bp+8] - mov [bp-2], ax - mov dword ptr [bp-6], 0A8000000h - mov dword ptr [bp-0Ah], 0B0000000h - mov dword ptr [bp-0Eh], 0B8000000h - mov dword ptr [bp-12h], 0E0000000h - mov al, _page_back - xor al, 1 - mov [bp-13h], al - mov ax, di - cwd - idiv bx - mov dx, [bp+8] - imul dx, 50h - add ax, dx - add [bp-6], ax - mov ax, di - cwd - idiv bx - mov dx, [bp+8] - imul dx, 50h - add ax, dx - add [bp-0Ah], ax - mov ax, di - cwd - idiv bx - mov dx, [bp+8] - imul dx, 50h - add ax, dx - add [bp-0Eh], ax - mov ax, di - cwd - idiv bx - mov dx, [bp+8] - imul dx, 50h - add ax, dx - add [bp-12h], ax - mov word ptr [bp-16h], 0 - jmp loc_CD9B -; --------------------------------------------------------------------------- - -loc_CCF6: - push si - pushd dword ptr [bp-6] - push ss - lea ax, [bp-66h] - push ax - call _memcpy - push si - pushd dword ptr [bp-0Ah] - push ss - lea ax, [bp-0B6h] - push ax - call _memcpy - push si - pushd dword ptr [bp-0Eh] - push ss - lea ax, [bp-106h] - push ax - call _memcpy - push si - pushd dword ptr [bp-12h] - push ss - lea ax, [bp-156h] - push ax - call _memcpy - graph_accesspage [bp-13h] - push si - push ss - lea ax, [bp-66h] - push ax - pushd dword ptr [bp-6] - call _memcpy - add sp, 32h - push si - push ss - lea ax, [bp-0B6h] - push ax - pushd dword ptr [bp-0Ah] - call _memcpy - push si - push ss - lea ax, [bp-106h] - push ax - pushd dword ptr [bp-0Eh] - call _memcpy - push si - push ss - lea ax, [bp-156h] - push ax - pushd dword ptr [bp-12h] - call _memcpy - add sp, 1Eh - graph_accesspage _page_back - add word ptr [bp-6], 50h ; 'P' - add word ptr [bp-0Ah], 50h ; 'P' - add word ptr [bp-0Eh], 50h ; 'P' - add word ptr [bp-12h], 50h ; 'P' - inc word ptr [bp-16h] - -loc_CD9B: - mov ax, [bp-16h] - cmp ax, [bp-2] - jl loc_CCF6 - pop di - pop si - leave - retf -; --------------------------------------------------------------------------- - enter 164h, 0 - push si - push di - mov di, [bp+6] - mov ax, [bp+0Ah] - sub ax, di - mov bx, 8 - cwd - idiv bx - mov si, ax - mov ax, [bp+0Ch] - sub ax, [bp+8] - mov [bp-2], ax - mov dword ptr [bp-6], 0A8000000h - mov dword ptr [bp-0Ah], 0B0000000h - mov dword ptr [bp-0Eh], 0B8000000h - mov dword ptr [bp-12h], 0E0000000h - mov dword ptr [bp-16h], 0A8000000h - mov dword ptr [bp-1Ah], 0B0000000h - mov dword ptr [bp-1Eh], 0B8000000h - mov dword ptr [bp-22h], 0E0000000h - mov ax, di - cwd - idiv bx - mov dx, [bp+8] - imul dx, 50h - add ax, dx - add [bp-6], ax - mov ax, di - cwd - idiv bx - mov dx, [bp+8] - imul dx, 50h - add ax, dx - add [bp-0Ah], ax - mov ax, di - cwd - idiv bx - mov dx, [bp+8] - imul dx, 50h - add ax, dx - add [bp-0Eh], ax - mov ax, di - cwd - idiv bx - mov dx, [bp+8] - imul dx, 50h - add ax, dx - add [bp-12h], ax - mov ax, [bp+0Eh] - cwd - idiv bx - mov dx, [bp+10h] - imul dx, 50h - add ax, dx - add [bp-16h], ax - mov ax, [bp+0Eh] - cwd - idiv bx - mov dx, [bp+10h] - imul dx, 50h - add ax, dx - add [bp-1Ah], ax - mov ax, [bp+0Eh] - cwd - idiv bx - mov dx, [bp+10h] - imul dx, 50h - add ax, dx - add [bp-1Eh], ax - mov ax, [bp+0Eh] - cwd - idiv bx - mov dx, [bp+10h] - imul dx, 50h - add ax, dx - add [bp-22h], ax - mov word ptr [bp-24h], 0 - jmp loc_CF49 -; --------------------------------------------------------------------------- - -loc_CE94: - push si - pushd dword ptr [bp-6] - push ss - lea ax, [bp-74h] - push ax - call _memcpy - push si - pushd dword ptr [bp-0Ah] - push ss - lea ax, [bp-0C4h] - push ax - call _memcpy - push si - pushd dword ptr [bp-0Eh] - push ss - lea ax, [bp-114h] - push ax - call _memcpy - push si - pushd dword ptr [bp-12h] - push ss - lea ax, [bp-164h] - push ax - call _memcpy - graph_accesspage [bp+14h] - push si - push ss - lea ax, [bp-74h] - push ax - pushd dword ptr [bp-16h] - call _memcpy - add sp, 32h - push si - push ss - lea ax, [bp-0C4h] - push ax - pushd dword ptr [bp-1Ah] - call _memcpy - push si - push ss - lea ax, [bp-114h] - push ax - pushd dword ptr [bp-1Eh] - call _memcpy - push si - push ss - lea ax, [bp-164h] - push ax - pushd dword ptr [bp-22h] - call _memcpy - add sp, 1Eh - graph_accesspage [bp+12h] - add word ptr [bp-6], 50h ; 'P' - add word ptr [bp-0Ah], 50h ; 'P' - add word ptr [bp-0Eh], 50h ; 'P' - add word ptr [bp-12h], 50h ; 'P' - add word ptr [bp-16h], 50h ; 'P' - add word ptr [bp-1Ah], 50h ; 'P' - add word ptr [bp-1Eh], 50h ; 'P' - add word ptr [bp-22h], 50h ; 'P' - inc word ptr [bp-24h] - -loc_CF49: - mov ax, [bp-24h] - cmp ax, [bp-2] - jl loc_CE94 - graph_accesspage _page_back - pop di - pop si - leave - retf - extern _z_respal_set:proc op_06_TEXT ends diff --git a/th01_reiiden.asm b/th01_reiiden.asm index 62274611..04766d40 100644 --- a/th01_reiiden.asm +++ b/th01_reiiden.asm @@ -7955,335 +7955,7 @@ loc_FD54: retf graph_putsa_fx endp - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_FD62 proc far - -var_156 = byte ptr -156h -var_106 = byte ptr -106h -var_B6 = byte ptr -0B6h -dest = byte ptr -66h -var_16 = word ptr -16h -@@page_other = byte ptr -13h -var_12 = dword ptr -12h -var_E = dword ptr -0Eh -var_A = dword ptr -0Ah -_src = dword ptr -6 -var_2 = word ptr -2 -arg_0 = word ptr 6 -arg_2 = word ptr 8 -arg_4 = word ptr 0Ah -arg_6 = word ptr 0Ch - - enter 156h, 0 - push si - push di - mov di, [bp+arg_0] - mov ax, [bp+arg_4] - sub ax, di - mov bx, 8 - cwd - idiv bx - mov si, ax - mov ax, [bp+arg_6] - sub ax, [bp+arg_2] - mov [bp+var_2], ax - mov [bp+_src], 0A8000000h - mov [bp+var_A], 0B0000000h - mov [bp+var_E], 0B8000000h - mov [bp+var_12], 0E0000000h - mov al, _page_back - xor al, 1 - mov [bp+@@page_other], al - mov ax, di - cwd - idiv bx - mov dx, [bp+arg_2] - imul dx, 50h - add ax, dx - add word ptr [bp+_src], ax - mov ax, di - cwd - idiv bx - mov dx, [bp+arg_2] - imul dx, 50h - add ax, dx - add word ptr [bp+var_A], ax - mov ax, di - cwd - idiv bx - mov dx, [bp+arg_2] - imul dx, 50h - add ax, dx - add word ptr [bp+var_E], ax - mov ax, di - cwd - idiv bx - mov dx, [bp+arg_2] - imul dx, 50h - add ax, dx - add word ptr [bp+var_12], ax - mov [bp+var_16], 0 - jmp loc_FE96 -; --------------------------------------------------------------------------- - -loc_FDF1: - push si ; n - pushd [bp+_src] ; src - push ss - lea ax, [bp+dest] - push ax ; dest - call _memcpy - push si ; n - pushd [bp+var_A] ; src - push ss - lea ax, [bp+var_B6] - push ax ; dest - call _memcpy - push si ; n - pushd [bp+var_E] ; src - push ss - lea ax, [bp+var_106] - push ax ; dest - call _memcpy - push si ; n - pushd [bp+var_12] ; src - push ss - lea ax, [bp+var_156] - push ax ; dest - call _memcpy - graph_accesspage [bp+@@page_other] - push si ; n - push ss - lea ax, [bp+dest] - push ax ; src - pushd [bp+_src] ; dest - call _memcpy - add sp, 32h - push si ; n - push ss - lea ax, [bp+var_B6] - push ax ; src - pushd [bp+var_A] ; dest - call _memcpy - push si ; n - push ss - lea ax, [bp+var_106] - push ax ; src - pushd [bp+var_E] ; dest - call _memcpy - push si ; n - push ss - lea ax, [bp+var_156] - push ax ; src - pushd [bp+var_12] ; dest - call _memcpy - add sp, 1Eh - graph_accesspage _page_back - add word ptr [bp+_src], 50h ; 'P' - add word ptr [bp+var_A], 50h ; 'P' - add word ptr [bp+var_E], 50h ; 'P' - add word ptr [bp+var_12], 50h ; 'P' - inc [bp+var_16] - -loc_FE96: - mov ax, [bp+var_16] - cmp ax, [bp+var_2] - jl loc_FDF1 - pop di - pop si - leave - retf -sub_FD62 endp - - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_FEA4 proc far - -var_164 = byte ptr -164h -var_114 = byte ptr -114h -var_C4 = byte ptr -0C4h -dest = byte ptr -74h -var_24 = word ptr -24h -var_22 = dword ptr -22h -var_1E = dword ptr -1Eh -var_1A = dword ptr -1Ah -var_16 = dword ptr -16h -var_12 = dword ptr -12h -var_E = dword ptr -0Eh -var_A = dword ptr -0Ah -_src = dword ptr -6 -var_2 = word ptr -2 -arg_0 = word ptr 6 -arg_2 = word ptr 8 -arg_4 = word ptr 0Ah -arg_6 = word ptr 0Ch -arg_8 = word ptr 0Eh -arg_A = word ptr 10h -@@page = byte ptr 12h -@@page_other = byte ptr 14h - - enter 164h, 0 - push si - push di - mov di, [bp+arg_0] - mov ax, [bp+arg_4] - sub ax, di - mov bx, 8 - cwd - idiv bx - mov si, ax - mov ax, [bp+arg_6] - sub ax, [bp+arg_2] - mov [bp+var_2], ax - mov [bp+_src], 0A8000000h - mov [bp+var_A], 0B0000000h - mov [bp+var_E], 0B8000000h - mov [bp+var_12], 0E0000000h - mov [bp+var_16], 0A8000000h - mov [bp+var_1A], 0B0000000h - mov [bp+var_1E], 0B8000000h - mov [bp+var_22], 0E0000000h - mov ax, di - cwd - idiv bx - mov dx, [bp+arg_2] - imul dx, 50h - add ax, dx - add word ptr [bp+_src], ax - mov ax, di - cwd - idiv bx - mov dx, [bp+arg_2] - imul dx, 50h - add ax, dx - add word ptr [bp+var_A], ax - mov ax, di - cwd - idiv bx - mov dx, [bp+arg_2] - imul dx, 50h - add ax, dx - add word ptr [bp+var_E], ax - mov ax, di - cwd - idiv bx - mov dx, [bp+arg_2] - imul dx, 50h - add ax, dx - add word ptr [bp+var_12], ax - mov ax, [bp+arg_8] - cwd - idiv bx - mov dx, [bp+arg_A] - imul dx, 50h - add ax, dx - add word ptr [bp+var_16], ax - mov ax, [bp+arg_8] - cwd - idiv bx - mov dx, [bp+arg_A] - imul dx, 50h - add ax, dx - add word ptr [bp+var_1A], ax - mov ax, [bp+arg_8] - cwd - idiv bx - mov dx, [bp+arg_A] - imul dx, 50h - add ax, dx - add word ptr [bp+var_1E], ax - mov ax, [bp+arg_8] - cwd - idiv bx - mov dx, [bp+arg_A] - imul dx, 50h - add ax, dx - add word ptr [bp+var_22], ax - mov [bp+var_24], 0 - jmp loc_10044 -; --------------------------------------------------------------------------- - -loc_FF8F: - push si ; n - pushd [bp+_src] ; src - push ss - lea ax, [bp+dest] - push ax ; dest - call _memcpy - push si ; n - pushd [bp+var_A] ; src - push ss - lea ax, [bp+var_C4] - push ax ; dest - call _memcpy - push si ; n - pushd [bp+var_E] ; src - push ss - lea ax, [bp+var_114] - push ax ; dest - call _memcpy - push si ; n - pushd [bp+var_12] ; src - push ss - lea ax, [bp+var_164] - push ax ; dest - call _memcpy - graph_accesspage [bp+@@page_other] - push si ; n - push ss - lea ax, [bp+dest] - push ax ; src - pushd [bp+var_16] ; dest - call _memcpy - add sp, 32h - push si ; n - push ss - lea ax, [bp+var_C4] - push ax ; src - pushd [bp+var_1A] ; dest - call _memcpy - push si ; n - push ss - lea ax, [bp+var_114] - push ax ; src - pushd [bp+var_1E] ; dest - call _memcpy - push si ; n - push ss - lea ax, [bp+var_164] - push ax ; src - pushd [bp+var_22] ; dest - call _memcpy - add sp, 1Eh - graph_accesspage [bp+@@page] - add word ptr [bp+_src], 50h ; 'P' - add word ptr [bp+var_A], 50h ; 'P' - add word ptr [bp+var_E], 50h ; 'P' - add word ptr [bp+var_12], 50h ; 'P' - add word ptr [bp+var_16], 50h ; 'P' - add word ptr [bp+var_1A], 50h ; 'P' - add word ptr [bp+var_1E], 50h ; 'P' - add word ptr [bp+var_22], 50h ; 'P' - inc [bp+var_24] - -loc_10044: - mov ax, [bp+var_24] - cmp ax, [bp+var_2] - jl loc_FF8F - graph_accesspage _page_back - pop di - pop si - leave - retf -sub_FEA4 endp - + extern _graph_move_byterect_interpage:proc extern _z_respal_set:proc main_06_TEXT ends @@ -16046,12 +15718,7 @@ loc_1496F: pushd 30h ; '0' call _graph_slow_2xscale_rect_1_to_0 add sp, 0Ch - push 10000h - push 1800000h - push 1900120h - push 1800000h - call sub_FEA4 - add sp, 10h + call _graph_move_byterect_interpage c, large (384 shl 16) or 0, large (RES_Y shl 16) or 288, large (384 shl 16) or 0, large (1 shl 16) or 0 jmp short loc_149D4 ; ---------------------------------------------------------------------------