From a07e5fad42a60a045919e24a8afe14f3dda1f872 Mon Sep 17 00:00:00 2001 From: nmlgc Date: Thu, 18 Dec 2014 14:36:43 +0100 Subject: [PATCH] [Reverse-engineering] Slot-based PI display Also covering the two variations for blitting only every second row or blitting only a 320x200 quarter, as seen in the endings. So yeah, there's indeed nothing wrong with piread.cpp. TH03 just uses that separate function that only blits every second row of an image, and indeed always loads the entire image as it would appear in a PNG conversion. Here's what happens if you display these images using the non-interlacing function: https://www.dropbox.com/s/885krj09d9l0890/th03%20PI%20no%20interlace.png --- th02/formats/pi_slot_put.asm | 65 ++++++ th02_main.asm | 92 +------- th02_maine.asm | 151 ++----------- th02_op.asm | 121 ++--------- th03/formats/pi_slot_put_interlace.asm | 59 +++++ th03/formats/pi_slot_put_quarter.asm | 74 +++++++ th03_mainl.asm | 289 ++----------------------- th03_op.asm | 99 +-------- th04_maine.asm | 194 +---------------- th04_op.asm | 119 ++-------- th05/formats/pi_slot_put.asm | 106 +++++++++ th05_maine.asm | 160 +------------- th05_op.asm | 158 ++------------ 13 files changed, 413 insertions(+), 1274 deletions(-) create mode 100644 th02/formats/pi_slot_put.asm create mode 100644 th03/formats/pi_slot_put_interlace.asm create mode 100644 th03/formats/pi_slot_put_quarter.asm create mode 100644 th05/formats/pi_slot_put.asm diff --git a/th02/formats/pi_slot_put.asm b/th02/formats/pi_slot_put.asm new file mode 100644 index 00000000..735b09ea --- /dev/null +++ b/th02/formats/pi_slot_put.asm @@ -0,0 +1,65 @@ +; Displays the PI image in slot #[slot] at [x],[y]. If the image exceeds the +; screen resolution, it is wrapped vertically and cut off horizontally. + +; int DEFCONV pi_slot_put(int x, int y, int slot) +proc_defconv pi_slot_put + arg @@x:word, @@y:word, @@slot:word +if GAME ge 3 + local @@row_num:word, @@row_buf:dword +else + local @@row_buf:dword, @@row_num:word +endif + + push si + push di + mov si, @@y + mov di, @@slot + mov bx, di + shl bx, 2 + mov ax, word ptr (pi_slot_buffers+2)[bx] + mov dx, word ptr pi_slot_buffers[bx] + mov word ptr @@row_buf+2, ax + mov word ptr @@row_buf, dx + mov @@row_num, 0 + jmp short @@check + +@@put: + push @@x + push si + pushd @@row_buf + mov bx, di + imul bx, size PiHeader + push pi_slot_headers.PiHeader._xsize[bx] + call graph_pack_put_8 + inc si + cmp si, 400 + jl short @@next_row + sub si, 400 + +@@next_row: + mov bx, di + imul bx, size PiHeader + mov ax, pi_slot_headers.PiHeader._xsize[bx] + shr ax, 1 + add word ptr @@row_buf, ax + mov eax, @@row_buf + shr eax, 10h + mov dx, word ptr @@row_buf + shr dx, 4 + add ax, dx + mov dx, word ptr @@row_buf + and dx, 0Fh + mov word ptr @@row_buf+2, ax + mov word ptr @@row_buf, dx + inc @@row_num + +@@check: + mov bx, di + imul bx, size PiHeader + mov ax, pi_slot_headers.PiHeader._ysize[bx] + cmp ax, @@row_num + ja short @@put + pop di + pop si + ret +pi_slot_put endp diff --git a/th02_main.asm b/th02_main.asm index e8150271..a527fdf5 100644 --- a/th02_main.asm +++ b/th02_main.asm @@ -2320,9 +2320,7 @@ var_C = byte ptr -0Ch call sub_FBE9 call pi_slot_palette_apply stdcall, 0 call pi_slot_palette_apply stdcall, 0 - pushd 90h - push 60h - call sub_F970 + call pi_slot_put stdcall, 96, large 144 add sp, 0Ah call sub_102D6 call sub_16A6B @@ -8495,11 +8493,7 @@ loc_E782: sub si, 190h loc_E793: - push 1 - push si - push 70h ; 'p' - call sub_F970 - add sp, 6 + call pi_slot_put c, 112, si, 1 loc_E7A0: cmp word_218B6, 56h ; 'V' @@ -8729,10 +8723,7 @@ loc_E9A6: sub [bp+var_2], 190h loc_E9DB: - push 1 - push [bp+var_2] - push 20h ; ' ' - call sub_F970 + call pi_slot_put stdcall, 32, [bp+var_2], 1 push 10h call sub_FA52 add sp, 8 @@ -8959,11 +8950,7 @@ loc_EBCC: sub si, 190h loc_EBE2: - push 1 - push si - push 20h ; ' ' - call sub_F970 - add sp, 6 + call pi_slot_put c, 32, si, 1 loc_EBEF: test byte ptr word_218B6, 3 @@ -10588,76 +10575,7 @@ loc_F927: sub_F913 endp include th02/formats/pi_slot_palette_apply.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_F970 proc far - -var_6 = word ptr -6 -var_4 = dword ptr -4 -arg_0 = word ptr 6 -arg_2 = word ptr 8 -arg_4 = word ptr 0Ah - - enter 6, 0 - push si - push di - mov si, [bp+arg_2] - mov di, [bp+arg_4] - mov bx, di - shl bx, 2 - mov ax, [bx+22EEh] - mov dx, [bx+22ECh] - mov word ptr [bp+var_4+2], ax - mov word ptr [bp+var_4], dx - mov [bp+var_6], 0 - jmp short loc_F9E4 -; --------------------------------------------------------------------------- - -loc_F996: - push [bp+arg_0] - push si - pushd [bp+var_4] - mov bx, di - imul bx, 48h - push word ptr [bx+2318h] - call graph_pack_put_8 - inc si - cmp si, 190h - jl short loc_F9B7 - sub si, 190h - -loc_F9B7: - mov bx, di - imul bx, 48h - mov ax, [bx+2318h] - shr ax, 1 - add word ptr [bp+var_4], ax - mov eax, [bp+var_4] - shr eax, 10h - mov dx, word ptr [bp+var_4] - shr dx, 4 - add ax, dx - mov dx, word ptr [bp+var_4] - and dx, 0Fh - mov word ptr [bp+var_4+2], ax - mov word ptr [bp+var_4], dx - inc [bp+var_6] - -loc_F9E4: - mov bx, di - imul bx, 48h - mov ax, [bx+231Ah] - cmp ax, [bp+var_6] - ja short loc_F996 - pop di - pop si - leave - retf -sub_F970 endp - +include th02/formats/pi_slot_put.asm include th02/hardware/snd_kaja_func.asm ; --------------------------------------------------------------------------- diff --git a/th02_maine.asm b/th02_maine.asm index 4bc2f23c..21d0eb71 100644 --- a/th02_maine.asm +++ b/th02_maine.asm @@ -1058,10 +1058,7 @@ sub_9B64 proc near call pi_slot_load c, 0, offset aEd01_pi, ds call pi_slot_palette_apply stdcall, 0 pop cx - pushd 0 - push 0 - call sub_B7B3 - add sp, 6 + call pi_slot_put c, 0, large 0 freePISlotLarge 0 push 2 call palette_black_in @@ -1294,10 +1291,7 @@ loc_9D96: call pi_slot_load c, 0, offset aEd02_pi, ds call pi_slot_palette_apply stdcall, 0 pop cx - pushd 0 - push 0 - call sub_B7B3 - add sp, 6 + call pi_slot_put c, 0, large 0 freePISlotLarge 0 push 2 call palette_black_out @@ -1594,10 +1588,7 @@ sub_A09D proc near call pi_slot_load c, 0, offset aEd01_pi, ds call pi_slot_palette_apply stdcall, 0 pop cx - pushd 0 - push 0 - call sub_B7B3 - add sp, 6 + call pi_slot_put c, 0, large 0 freePISlotLarge 0 push 2 call palette_black_in @@ -1623,10 +1614,7 @@ sub_A09D proc near call pi_slot_load c, 0, offset aEd03_pi, ds call pi_slot_palette_apply stdcall, 0 pop cx - pushd 0 - push 0 - call sub_B7B3 - add sp, 6 + call pi_slot_put c, 0, large 0 freePISlotLarge 0 push 0 call sub_98B5 @@ -1746,10 +1734,7 @@ loc_A247: call pi_slot_load c, 0, offset aEd04_pi, ds call pi_slot_palette_apply stdcall, 0 pop cx - pushd 0 - push 0 - call sub_B7B3 - add sp, 6 + call pi_slot_put c, 0, large 0 freePISlotLarge 0 mov dx, 0A6h ; '¦' mov al, 0 @@ -1960,10 +1945,7 @@ loc_A451: call pi_slot_load c, 0, offset aEd05_pi, ds call pi_slot_palette_apply stdcall, 0 pop cx - pushd 0 - push 0 - call sub_B7B3 - add sp, 6 + call pi_slot_put c, 0, large 0 freePISlotLarge 0 push 0 call sub_98B5 @@ -2121,10 +2103,7 @@ loc_A620: call pi_slot_load c, 0, offset aEd05_pi, ds call pi_slot_palette_apply stdcall, 0 pop cx - pushd 0 - push 0 - call sub_B7B3 - add sp, 6 + call pi_slot_put c, 0, large 0 freePISlotLarge 0 push 1 call sub_98B5 @@ -2267,10 +2246,7 @@ loc_A6B6: call pi_slot_load c, 0, offset aEd05_pi, ds call pi_slot_palette_apply stdcall, 0 pop cx - pushd 0 - push 0 - call sub_B7B3 - add sp, 6 + call pi_slot_put c, 0, large 0 freePISlotLarge 0 push 2 call sub_98B5 @@ -2492,10 +2468,7 @@ loc_A992: call pi_slot_load c, 0, offset aEd06_pi, ds call pi_slot_palette_apply stdcall, 0 pop cx - pushd 0 - push 0 - call sub_B7B3 - add sp, 6 + call pi_slot_put c, 0, large 0 freePISlotLarge 0 mov dx, 0A6h ; '¦' mov al, 0 @@ -2540,10 +2513,7 @@ loc_A992: mov al, 1 out dx, al call pi_slot_load c, 0, offset aEd07_pi, ds - pushd 0 - push 0 - call sub_B7B3 - add sp, 6 + call pi_slot_put c, 0, large 0 freePISlotLarge 0 mov dx, 0A6h ; '¦' mov al, 0 @@ -2621,10 +2591,7 @@ loc_A992: mov al, 1 out dx, al call pi_slot_load c, 0, offset aEd08_pi, ds - pushd 0 - push 0 - call sub_B7B3 - add sp, 6 + call pi_slot_put c, 0, large 0 mov dx, 0A6h ; '¦' mov al, 0 out dx, al @@ -2713,10 +2680,7 @@ loc_A992: call pi_slot_load c, 0, offset aEd09_pi, ds call pi_slot_palette_apply stdcall, 0 pop cx - pushd 0 - push 0 - call sub_B7B3 - add sp, 6 + call pi_slot_put c, 0, large 0 freePISlotLarge 0 push 0 call graph_copy_page @@ -3045,10 +3009,7 @@ sub_AFE7 proc far call pi_slot_load c, 0, offset aAll_pi, ds call pi_slot_palette_apply stdcall, 0 pop cx - pushd 0 - push 0 - call sub_B7B3 - add sp, 6 + call pi_slot_put c, 0, large 0 freePISlotLarge 0 push 2 call palette_black_in @@ -3057,10 +3018,7 @@ sub_AFE7 proc far call pi_slot_load c, 0, offset aBut_pi, ds call pi_slot_palette_apply stdcall, 0 pop cx - pushd 0 - push 0 - call sub_B7B3 - add sp, 6 + call pi_slot_put c, 0, large 0 freePISlotLarge 0 call sub_B4B7 push 5 @@ -3087,10 +3045,7 @@ sub_B07F proc far call pi_slot_load c, 0, offset aAll_pi, ds call pi_slot_palette_apply stdcall, 0 pop cx - pushd 0 - push 0 - call sub_B7B3 - add sp, 6 + call pi_slot_put c, 0, large 0 freePISlotLarge 0 push 2 call palette_black_in @@ -3099,10 +3054,7 @@ sub_B07F proc far call pi_slot_load c, 0, offset aExtra_pi, ds call pi_slot_palette_apply stdcall, 0 pop cx - pushd 0 - push 0 - call sub_B7B3 - add sp, 6 + call pi_slot_put c, 0, large 0 freePISlotLarge 0 call sub_B4B7 push 5 @@ -3823,76 +3775,7 @@ loc_B76A: sub_B756 endp include th02/formats/pi_slot_palette_apply.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_B7B3 proc far - -var_6 = word ptr -6 -var_4 = dword ptr -4 -arg_0 = word ptr 6 -arg_2 = word ptr 8 -arg_4 = word ptr 0Ah - - enter 6, 0 - push si - push di - mov si, [bp+arg_2] - mov di, [bp+arg_4] - mov bx, di - shl bx, 2 - mov ax, [bx+2924h] - mov dx, [bx+2922h] - mov word ptr [bp+var_4+2], ax - mov word ptr [bp+var_4], dx - mov [bp+var_6], 0 - jmp short loc_B827 -; --------------------------------------------------------------------------- - -loc_B7D9: - push [bp+arg_0] - push si - pushd [bp+var_4] - mov bx, di - imul bx, 48h - push word ptr [bx+294Eh] - call graph_pack_put_8 - inc si - cmp si, 190h - jl short loc_B7FA - sub si, 190h - -loc_B7FA: - mov bx, di - imul bx, 48h - mov ax, [bx+294Eh] - shr ax, 1 - add word ptr [bp+var_4], ax - mov eax, [bp+var_4] - shr eax, 10h - mov dx, word ptr [bp+var_4] - shr dx, 4 - add ax, dx - mov dx, word ptr [bp+var_4] - and dx, 0Fh - mov word ptr [bp+var_4+2], ax - mov word ptr [bp+var_4], dx - inc [bp+var_6] - -loc_B827: - mov bx, di - imul bx, 48h - mov ax, [bx+2950h] - cmp ax, [bp+var_6] - ja short loc_B7D9 - pop di - pop si - leave - retf -sub_B7B3 endp - +include th02/formats/pi_slot_put.asm include th02/hardware/snd_kaja_func.asm ; =============== S U B R O U T I N E ======================================= diff --git a/th02_op.asm b/th02_op.asm index c22c9296..9b6f7286 100644 --- a/th02_op.asm +++ b/th02_op.asm @@ -383,10 +383,7 @@ arg_2 = word ptr 6 mov al, [bp+arg_0] out dx, al call pi_slot_palette_apply stdcall, 0 - push 0 - push 0 - push 0 - call sub_B17D + call pi_slot_put stdcall, 0, 0, 0 add sp, 0Eh freePISlot 0 pop bp @@ -1095,10 +1092,7 @@ loc_A3BC: out dx, al call pi_slot_load stdcall, 0, offset aOp2_pi, ds call pi_slot_palette_apply stdcall, 0 - push 0 - push 0 - push 0 - call sub_B17D + call pi_slot_put stdcall, 0, 0, 0 add sp, 0Eh freePISlot 0 push ds @@ -2619,76 +2613,7 @@ include th02/hardware/snd_determine_mode.asm include th02/hardware/snd_pmd_resident.asm include th02/hardware/snd_load.asm include th02/formats/pi_slot_palette_apply.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_B17D proc far - -var_6 = word ptr -6 -var_4 = dword ptr -4 -arg_0 = word ptr 6 -arg_2 = word ptr 8 -arg_4 = word ptr 0Ah - - enter 6, 0 - push si - push di - mov si, [bp+arg_2] - mov di, [bp+arg_4] - mov bx, di - shl bx, 2 - mov ax, [bx+1B4Eh] - mov dx, [bx+1B4Ch] - mov word ptr [bp+var_4+2], ax - mov word ptr [bp+var_4], dx - mov [bp+var_6], 0 - jmp short loc_B1F1 -; --------------------------------------------------------------------------- - -loc_B1A3: - push [bp+arg_0] - push si - pushd [bp+var_4] - mov bx, di - imul bx, 48h - push word ptr [bx+1B78h] - call graph_pack_put_8 - inc si - cmp si, 190h - jl short loc_B1C4 - sub si, 190h - -loc_B1C4: - mov bx, di - imul bx, 48h - mov ax, [bx+1B78h] - shr ax, 1 - add word ptr [bp+var_4], ax - mov eax, [bp+var_4] - shr eax, 10h - mov dx, word ptr [bp+var_4] - shr dx, 4 - add ax, dx - mov dx, word ptr [bp+var_4] - and dx, 0Fh - mov word ptr [bp+var_4+2], ax - mov word ptr [bp+var_4], dx - inc [bp+var_6] - -loc_B1F1: - mov bx, di - imul bx, 48h - mov ax, [bx+1B7Ah] - cmp ax, [bp+var_6] - ja short loc_B1A3 - pop di - pop si - leave - retf -sub_B17D endp - +include th02/formats/pi_slot_put.asm include th02/hardware/snd_kaja_func.asm ; --------------------------------------------------------------------------- @@ -2866,7 +2791,7 @@ loc_B329: loc_B330: push 0 push 0 - call sub_B17D + call pi_slot_put add sp, 6 loc_B33C: @@ -4096,10 +4021,7 @@ sub_BBC0 proc far out dx, al call pi_slot_load stdcall, 3, offset aTselect_pi, ds call pi_slot_palette_apply stdcall, 3 - push 3 - push 0 - push 0 - call sub_B17D + call pi_slot_put stdcall, 0, 0, 3 add sp, 0Eh freePISlot 3 push 1 @@ -4173,18 +4095,9 @@ loc_BCA3: add sp, 0Ah loc_BCBA: - push 0 - push 88h - push 18h - call sub_B17D - push 1 - push 0E0h - push 0E0h - call sub_B17D - push 2 - push 88h - push 1B8h - call sub_B17D + call pi_slot_put stdcall, 24, 136, 0 + call pi_slot_put stdcall, 224, 224, 1 + call pi_slot_put stdcall, 440, 136, 2 les bx, dword_F3DC mov byte ptr es:[bx+26h], 1 push 88h @@ -4292,7 +4205,7 @@ loc_BD6A: mov ax, ss:[bx] add ax, 8 push ax - call sub_B17D + call pi_slot_put add sp, 6 push 1 call frame_delay @@ -4357,7 +4270,7 @@ loc_BE0F: add ax, dx mov bx, ax push word ptr ss:[bx] - call sub_B17D + call pi_slot_put add sp, 6 loc_BE6D: @@ -4396,7 +4309,7 @@ loc_BE77: mov ax, ss:[bx] add ax, 8 push ax - call sub_B17D + call pi_slot_put add sp, 6 push 1 call frame_delay @@ -4469,7 +4382,7 @@ loc_BF1C: add ax, dx mov bx, ax push word ptr ss:[bx] - call sub_B17D + call pi_slot_put add sp, 6 loc_BF7A: @@ -5527,10 +5440,7 @@ var_1 = byte ptr -1 out dx, al call pi_slot_load stdcall, 0, offset aOp3_pi, ds call pi_slot_palette_apply stdcall, 0 - push 0 - push 0 - push 0 - call sub_B17D + call pi_slot_put stdcall, 0, 0, 0 add sp, 0Eh freePISlot 0 mov al, byte_DF97 @@ -5707,10 +5617,7 @@ loc_C978: out dx, al call pi_slot_load stdcall, 0, offset aOp2_pi_0, ds call pi_slot_palette_apply stdcall, 0 - push 0 - push 0 - push 0 - call sub_B17D + call pi_slot_put stdcall, 0, 0, 0 add sp, 0Eh freePISlot 0 push ds diff --git a/th03/formats/pi_slot_put_interlace.asm b/th03/formats/pi_slot_put_interlace.asm new file mode 100644 index 00000000..24b549ef --- /dev/null +++ b/th03/formats/pi_slot_put_interlace.asm @@ -0,0 +1,59 @@ +; Copy of pi_slot_put() that only displays every second row in the given PI. + +; int DEFCONV pi_slot_put_interlace(int x, int y, int slot) +proc_defconv pi_slot_put_interlace + arg @@x:word, @@y:word, @@slot:word + local @@row_num:word, @@row_buf:dword + + push si + push di + mov si, @@y + mov di, @@slot + mov bx, di + shl bx, 2 + mov ax, word ptr (pi_slot_buffers+2)[bx] + mov dx, word ptr pi_slot_buffers[bx] + mov word ptr @@row_buf+2, ax + mov word ptr @@row_buf, dx + mov @@row_num, 0 + jmp short @@check + +@@put: + push @@x + push si + pushd @@row_buf + mov bx, di + imul bx, size PiHeader + push pi_slot_headers.PiHeader._xsize[bx] + call graph_pack_put_8 + inc si + cmp si, 400 + jl short @@next_row + sub si, 400 + +@@next_row: + mov bx, di + imul bx, size PiHeader + mov ax, pi_slot_headers.PiHeader._xsize[bx] + add word ptr @@row_buf, ax + mov eax, @@row_buf + shr eax, 10h + mov dx, word ptr @@row_buf + shr dx, 4 + add ax, dx + mov dx, word ptr @@row_buf + and dx, 0Fh + mov word ptr @@row_buf+2, ax + mov word ptr @@row_buf, dx + add @@row_num, 2 + +@@check: + mov bx, di + imul bx, size PiHeader + mov ax, pi_slot_headers.PiHeader._ysize[bx] + cmp ax, @@row_num + ja short @@put + pop di + pop si + ret +pi_slot_put_interlace endp diff --git a/th03/formats/pi_slot_put_quarter.asm b/th03/formats/pi_slot_put_quarter.asm new file mode 100644 index 00000000..8e5921da --- /dev/null +++ b/th03/formats/pi_slot_put_quarter.asm @@ -0,0 +1,74 @@ +; Displays the n-th 320x200 [quarter], counted from the top left, of the PI +; image in slot #[slot] at [x],[y]. + +; int DEFCONV pi_slot_put_quarter(int x, int y, int slot, int quarter) +proc_defconv pi_slot_put_quarter + arg @@x:word, @@y:word, @@slot:word, @@quarter:word + local @@row_num:word, @@row_buf:dword + + push si + push di + mov si, @@y + mov di, @@quarter + mov bx, @@slot + shl bx, 2 + mov ax, word ptr (pi_slot_buffers+2)[bx] + mov dx, word ptr pi_slot_buffers[bx] + mov word ptr @@row_buf+2, ax + mov word ptr @@row_buf, dx + cmp di, 1 + jnz short @@bottom_left? + add word ptr @@row_buf, (320 / 2) + jmp short @@first + +@@bottom_left?: + cmp di, 2 + jnz short @@bottom_right? + add word ptr @@row_buf, (640 * 200) / 2 + jmp short @@first + +@@bottom_right?: + cmp di, 3 + jnz short @@first + add word ptr @@row_buf, ((640 * 200) + 320) / 2 + +@@first: + mov eax, @@row_buf + shr eax, 10h + mov dx, word ptr @@row_buf + shr dx, 4 + add ax, dx + mov dx, word ptr @@row_buf + and dx, 0Fh + mov word ptr @@row_buf+2, ax + mov word ptr @@row_buf, dx + mov @@row_num, 0 + jmp short @@check + +@@put: + call graph_pack_put_8 pascal, @@x, si, @@row_buf, 320 + inc si + cmp si, 400 + jl short @@next_row + sub si, 400 + +@@next_row: + add word ptr @@row_buf, 320 + mov eax, @@row_buf + shr eax, 10h + mov dx, word ptr @@row_buf + shr dx, 4 + add ax, dx + mov dx, word ptr @@row_buf + and dx, 0Fh + mov word ptr @@row_buf+2, ax + mov word ptr @@row_buf, dx + inc @@row_num + +@@check: + cmp @@row_num, 200 + jl short @@put + pop di + pop si + ret +pi_slot_put_quarter endp diff --git a/th03_mainl.asm b/th03_mainl.asm index 64015fff..58c19db6 100644 --- a/th03_mainl.asm +++ b/th03_mainl.asm @@ -783,14 +783,10 @@ loc_99D4: loc_99F1: call pi_slot_load pascal, 0, ds, offset aStnx0_pi - pushd 0 - push 0 - call sub_CD2F + call pi_slot_put pascal, large 0, 0 freePISlotLarge 0 call pi_slot_load pascal, 0, ds, word_E504 - pushd 0 - push 0 - call sub_CD2F + call pi_slot_put pascal, large 0, 0 leave retn sub_990C endp @@ -888,9 +884,7 @@ loc_9A8E: push 1 call sub_9D20 call pi_slot_load pascal, 0, ds, offset aEn2_pi - pushd 118h - push 0 - call sub_CDB7 + call pi_slot_put_interlace pascal, large 280, 0 freePISlotLarge 0 les bx, dword_105DA mov al, es:[bx+0Dh] @@ -943,9 +937,7 @@ loc_9BBD: call pi_slot_load loc_9BC2: - pushd 130h - push 0 - call sub_CDB7 + call pi_slot_put_interlace pascal, large 304, 0 les bx, dword_105DA mov al, es:[bx+0Dh] mov ah, 0 @@ -1051,20 +1043,16 @@ arg_4 = word ptr 8 mov si, [bp+arg_4] call pi_slot_load pascal, 0, large [bp+arg_0] mov ax, si - imul ax, 140h - push ax - push 0C80000h - call sub_CDB7 + imul ax, 320 + call pi_slot_put_interlace pascal, ax, (200 shl 16) freePISlotLarge 0 les bx, [bp+arg_0] - mov byte ptr es:[bx+2], 65h ; 'e' - mov byte ptr es:[bx+3], 78h ; 'x' + mov byte ptr es:[bx+2], 'e' + mov byte ptr es:[bx+3], 'x' call pi_slot_load pascal, 0, word ptr [bp+arg_0+2], bx mov ax, si - imul ax, 140h - push ax - push 0D00000h - call sub_CDB7 + imul ax, 320 + call pi_slot_put_interlace pascal, ax, (208 shl 16) freePISlotLarge 0 pop si pop bp @@ -1476,9 +1464,7 @@ loc_A0C5: call far ptr palette_show call pi_slot_load pascal, 0, ds, offset aOver_pi call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_CD2F + call pi_slot_put pascal, large 0, 0 freePISlotLarge 0 kajacall KAJA_SONG_STOP les bx, dword_105DA @@ -2583,9 +2569,7 @@ loc_A9EB: call pi_slot_palette_apply pascal, 0 loc_A9FE: - pushd 0 - push 0 - call sub_CD2F + call pi_slot_put pascal, large 0, 0 push 0 call graph_copy_page mov dx, 0A6h ; '¦' @@ -2725,10 +2709,7 @@ loc_AB33: out dx, al loc_AB44: - push 0A00040h - push 0 - push [bp+var_2] - call sub_D4F1 + call pi_slot_put_quarter pascal, (160 shl 16) + 64, 0, [bp+var_2] loc_AB54: mov dx, 0A4h @@ -3324,9 +3305,7 @@ sub_AFAC proc near out dx, al call pi_slot_load pascal, 0, ds, offset aRegib_pi call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_CD2F + call pi_slot_put pascal, large 0, 0 freePISlotLarge 0 les bx, dword_105DA mov al, es:[bx+0Bh] @@ -4531,9 +4510,7 @@ loc_B879: jz short loc_B8F1 call pi_slot_load pascal, 0, ds, offset aConti_pi call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_CD2F + call pi_slot_put pascal, large 0, 0 freePISlotLarge 0 push 0 push ds @@ -4546,9 +4523,7 @@ loc_B879: loc_B8F1: call pi_slot_load pascal, 0, ds, offset aOver_pi_0 call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_CD2F + call pi_slot_put pascal, large 0, 0 freePISlotLarge 0 call snd_delay_until_volume stdcall, 255 pop cx @@ -6776,145 +6751,8 @@ locret_CD08: sub_CB68 endp include th02/formats/pi_slot_palette_apply.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_CD2F proc far - -var_6 = word ptr -6 -var_4 = dword ptr -4 -arg_0 = word ptr 6 -arg_2 = word ptr 8 -arg_4 = word ptr 0Ah - - enter 6, 0 - push si - push di - mov si, [bp+arg_2] - mov di, [bp+arg_0] - mov bx, di - shl bx, 2 - mov ax, [bx+1F10h] - mov dx, [bx+1F0Eh] - mov word ptr [bp+var_4+2], ax - mov word ptr [bp+var_4], dx - mov [bp+var_6], 0 - jmp short loc_CDA3 -; --------------------------------------------------------------------------- - -loc_CD55: - push [bp+arg_4] - push si - pushd [bp+var_4] - mov bx, di - imul bx, 48h - push word ptr [bx+1F3Ah] - call graph_pack_put_8 - inc si - cmp si, 190h - jl short loc_CD76 - sub si, 190h - -loc_CD76: - mov bx, di - imul bx, 48h - mov ax, [bx+1F3Ah] - shr ax, 1 - add word ptr [bp+var_4], ax - mov eax, [bp+var_4] - shr eax, 10h - mov dx, word ptr [bp+var_4] - shr dx, 4 - add ax, dx - mov dx, word ptr [bp+var_4] - and dx, 0Fh - mov word ptr [bp+var_4+2], ax - mov word ptr [bp+var_4], dx - inc [bp+var_6] - -loc_CDA3: - mov bx, di - imul bx, 48h - mov ax, [bx+1F3Ch] - cmp ax, [bp+var_6] - ja short loc_CD55 - pop di - pop si - leave - retf 6 -sub_CD2F endp - - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_CDB7 proc far - -var_6 = word ptr -6 -var_4 = dword ptr -4 -arg_0 = word ptr 6 -arg_2 = word ptr 8 -arg_4 = word ptr 0Ah - - enter 6, 0 - push si - push di - mov si, [bp+arg_2] - mov di, [bp+arg_0] - mov bx, di - shl bx, 2 - mov ax, [bx+1F10h] - mov dx, [bx+1F0Eh] - mov word ptr [bp+var_4+2], ax - mov word ptr [bp+var_4], dx - mov [bp+var_6], 0 - jmp short loc_CE2A -; --------------------------------------------------------------------------- - -loc_CDDD: - push [bp+arg_4] - push si - pushd [bp+var_4] - mov bx, di - imul bx, 48h - push word ptr [bx+1F3Ah] - call graph_pack_put_8 - inc si - cmp si, 190h - jl short loc_CDFE - sub si, 190h - -loc_CDFE: - mov bx, di - imul bx, 48h - mov ax, [bx+1F3Ah] - add word ptr [bp+var_4], ax - mov eax, [bp+var_4] - shr eax, 10h - mov dx, word ptr [bp+var_4] - shr dx, 4 - add ax, dx - mov dx, word ptr [bp+var_4] - and dx, 0Fh - mov word ptr [bp+var_4+2], ax - mov word ptr [bp+var_4], dx - add [bp+var_6], 2 - -loc_CE2A: - mov bx, di - imul bx, 48h - mov ax, [bx+1F3Ch] - cmp ax, [bp+var_6] - ja short loc_CDDD - pop di - pop si - leave - retf 6 -sub_CDB7 endp - +include th02/formats/pi_slot_put.asm +include th03/formats/pi_slot_put_interlace.asm ; =============== S U B R O U T I N E ======================================= @@ -7791,96 +7629,7 @@ loc_D49D: sub_D47A endp include th02/formats/pi_slot_load.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_D4F1 proc far - -var_6 = word ptr -6 -var_4 = dword ptr -4 -arg_0 = word ptr 6 -arg_2 = word ptr 8 -arg_4 = word ptr 0Ah -arg_6 = word ptr 0Ch - - enter 6, 0 - push si - push di - mov si, [bp+arg_4] - mov di, [bp+arg_0] - mov bx, [bp+arg_2] - shl bx, 2 - mov ax, [bx+1F10h] - mov dx, [bx+1F0Eh] - mov word ptr [bp+var_4+2], ax - mov word ptr [bp+var_4], dx - cmp di, 1 - jnz short loc_D51D - add word ptr [bp+var_4], 0A0h - jmp short loc_D533 -; --------------------------------------------------------------------------- - -loc_D51D: - cmp di, 2 - jnz short loc_D529 - add word ptr [bp+var_4], 0FA00h - jmp short loc_D533 -; --------------------------------------------------------------------------- - -loc_D529: - cmp di, 3 - jnz short loc_D533 - add word ptr [bp+var_4], 0FAA0h - -loc_D533: - mov eax, [bp+var_4] - shr eax, 10h - mov dx, word ptr [bp+var_4] - shr dx, 4 - add ax, dx - mov dx, word ptr [bp+var_4] - and dx, 0Fh - mov word ptr [bp+var_4+2], ax - mov word ptr [bp+var_4], dx - mov [bp+var_6], 0 - jmp short loc_D595 -; --------------------------------------------------------------------------- - -loc_D556: - push [bp+arg_6] - push si - pushd [bp+var_4] - push 140h - call graph_pack_put_8 - inc si - cmp si, 190h - jl short loc_D571 - sub si, 190h - -loc_D571: - add word ptr [bp+var_4], 140h - mov eax, [bp+var_4] - shr eax, 10h - mov dx, word ptr [bp+var_4] - shr dx, 4 - add ax, dx - mov dx, word ptr [bp+var_4] - and dx, 0Fh - mov word ptr [bp+var_4+2], ax - mov word ptr [bp+var_4], dx - inc [bp+var_6] - -loc_D595: - cmp [bp+var_6], 0C8h - jl short loc_D556 - pop di - pop si - leave - retf 8 -sub_D4F1 endp - +include th03/formats/pi_slot_put_quarter.asm ; =============== S U B R O U T I N E ======================================= diff --git a/th03_op.asm b/th03_op.asm index d95d774f..612b2a0e 100644 --- a/th03_op.asm +++ b/th03_op.asm @@ -2685,9 +2685,7 @@ loc_AC15: out dx, al call pi_slot_load pascal, 0, ds, offset aOp3_pi call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_C37B + call pi_slot_put pascal, large 0, 0 freePISlotLarge 0 mov al, byte_DE83 mov byte ptr word_F828, al @@ -2870,16 +2868,12 @@ var_2 = word ptr -2 mov dx, 0A6h ; '¦' mov al, 1 out dx, al - pushd 0 - push 0 - call sub_C37B + call pi_slot_put pascal, large 0, 0 mov dx, 0A6h ; '¦' mov al, 0 out dx, al call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_C37B + call pi_slot_put pascal, large 0, 0 push 2 call egc_shift_left_all mov Palettes+45, 0 @@ -2988,9 +2982,7 @@ loc_AF65: mov dx, 0A6h ; '¦' out dx, al call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_C37B + call pi_slot_put pascal, large 0, 0 push 1 call frame_delay mov PaletteTone, 64h ; 'd' @@ -3018,9 +3010,7 @@ loc_AFD9: mov dx, 0A6h ; '¦' mov al, 1 out dx, al - pushd 0 - push 0 - call sub_C37B + call pi_slot_put pascal, large 0, 0 mov dx, 0A6h ; '¦' mov al, 0 out dx, al @@ -3055,16 +3045,12 @@ sub_B008 proc near mov dx, 0A6h ; '¦' mov al, 1 out dx, al - pushd 0 - push 0 - call sub_C37B + call pi_slot_put pascal, large 0, 0 mov dx, 0A6h ; '¦' mov al, 0 out dx, al call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_C37B + call pi_slot_put pascal, large 0, 0 mov dx, 0A6h ; '¦' mov al, 0 out dx, al @@ -5427,76 +5413,7 @@ locret_C354: sub_C1B4 endp include th02/formats/pi_slot_palette_apply.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_C37B proc far - -var_6 = word ptr -6 -var_4 = dword ptr -4 -arg_0 = word ptr 6 -arg_2 = word ptr 8 -arg_4 = word ptr 0Ah - - enter 6, 0 - push si - push di - mov si, [bp+arg_2] - mov di, [bp+arg_0] - mov bx, di - shl bx, 2 - mov ax, [bx+1CAAh] - mov dx, [bx+1CA8h] - mov word ptr [bp+var_4+2], ax - mov word ptr [bp+var_4], dx - mov [bp+var_6], 0 - jmp short loc_C3EF -; --------------------------------------------------------------------------- - -loc_C3A1: - push [bp+arg_4] - push si - pushd [bp+var_4] - mov bx, di - imul bx, 48h - push word ptr [bx+1CD4h] - call graph_pack_put_8 - inc si - cmp si, 190h - jl short loc_C3C2 - sub si, 190h - -loc_C3C2: - mov bx, di - imul bx, 48h - mov ax, [bx+1CD4h] - shr ax, 1 - add word ptr [bp+var_4], ax - mov eax, [bp+var_4] - shr eax, 10h - mov dx, word ptr [bp+var_4] - shr dx, 4 - add ax, dx - mov dx, word ptr [bp+var_4] - and dx, 0Fh - mov word ptr [bp+var_4+2], ax - mov word ptr [bp+var_4], dx - inc [bp+var_6] - -loc_C3EF: - mov bx, di - imul bx, 48h - mov ax, [bx+1CD6h] - cmp ax, [bp+var_6] - ja short loc_C3A1 - pop di - pop si - leave - retf 6 -sub_C37B endp - +include th02/formats/pi_slot_put.asm include th02/hardware/snd_kaja_func.asm ; =============== S U B R O U T I N E ======================================= diff --git a/th04_maine.asm b/th04_maine.asm index a6bf3516..7640680f 100644 --- a/th04_maine.asm +++ b/th04_maine.asm @@ -442,9 +442,7 @@ loc_A187: out dx, al call pi_slot_load pascal, 0, word ptr [bp+var_4+2], bx call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_CCDD + call pi_slot_put pascal, large 0, 0 freePISlotLarge 0 push 0 call graph_copy_page @@ -479,9 +477,7 @@ loc_A1FE: out dx, al call pi_slot_load pascal, 0, large [bp+var_4] call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_CCDD + call pi_slot_put pascal, large 0, 0 freePISlotLarge 0 push 0 call graph_copy_page @@ -1657,9 +1653,7 @@ loc_AB7A: call pi_slot_palette_apply pascal, 0 loc_AB8D: - pushd 0 - push 0 - call sub_CCDD + call pi_slot_put pascal, large 0, 0 push 0 call graph_copy_page mov dx, 0A6h ; '¦' @@ -1802,10 +1796,7 @@ loc_ACCF: out dx, al loc_ACE0: - push 0A00040h - push 0 - push [bp+var_2] - call sub_CDAB + call pi_slot_put_quarter pascal, (160 shl 16) + 64, 0, [bp+var_2] loc_ACF0: mov dx, 0A4h @@ -2746,9 +2737,7 @@ sub_B44D proc near out dx, al call pi_slot_load pascal, 0, ds, offset aSff1_pi call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_CCDD + call pi_slot_put pascal, large 0, 0 freePISlotLarge 0 push 0 call graph_copy_page @@ -2825,9 +2814,7 @@ sub_B44D proc near out dx, al call pi_slot_load pascal, 0, ds, offset aSff2_pi call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_CCDD + call pi_slot_put pascal, large 0, 0 freePISlotLarge 0 push 0 call graph_copy_page @@ -3925,9 +3912,7 @@ sub_C0F8 proc near out dx, al call pi_slot_load pascal, 0, ds, offset aUde_pi call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_CCDD + call pi_slot_put pascal, large 0, 0 freePISlotLarge 0 push 0 call graph_copy_page @@ -4963,9 +4948,7 @@ var_2 = word ptr -2 out dx, al call pi_slot_load pascal, 0, ds, offset aHi01_pi call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_CCDD + call pi_slot_put pascal, large 0, 0 freePISlotLarge 0 push 0 call graph_copy_page @@ -5519,166 +5502,9 @@ sub_CC7A endp include th02/frame_delay.asm include th02/formats/pi_slot_palette_apply.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_CCDD proc far - -var_6 = word ptr -6 -var_4 = dword ptr -4 -arg_0 = word ptr 6 -arg_2 = word ptr 8 -arg_4 = word ptr 0Ah - - enter 6, 0 - push si - push di - mov si, [bp+arg_2] - mov di, [bp+arg_0] - mov bx, di - shl bx, 2 - mov ax, [bx+17A4h] - mov dx, [bx+17A2h] - mov word ptr [bp+var_4+2], ax - mov word ptr [bp+var_4], dx - mov [bp+var_6], 0 - jmp short loc_CD51 -; --------------------------------------------------------------------------- - -loc_CD03: - push [bp+arg_4] - push si - pushd [bp+var_4] - mov bx, di - imul bx, 48h - push word ptr [bx+17CEh] - call graph_pack_put_8 - inc si - cmp si, 190h - jl short loc_CD24 - sub si, 190h - -loc_CD24: - mov bx, di - imul bx, 48h - mov ax, [bx+17CEh] - shr ax, 1 - add word ptr [bp+var_4], ax - mov eax, [bp+var_4] - shr eax, 10h - mov dx, word ptr [bp+var_4] - shr dx, 4 - add ax, dx - mov dx, word ptr [bp+var_4] - and dx, 0Fh - mov word ptr [bp+var_4+2], ax - mov word ptr [bp+var_4], dx - inc [bp+var_6] - -loc_CD51: - mov bx, di - imul bx, 48h - mov ax, [bx+17D0h] - cmp ax, [bp+var_6] - ja short loc_CD03 - pop di - pop si - leave - retf 6 -sub_CCDD endp - +include th02/formats/pi_slot_put.asm include th02/formats/pi_slot_load.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_CDAB proc far - -var_6 = word ptr -6 -var_4 = dword ptr -4 -arg_0 = word ptr 6 -arg_2 = word ptr 8 -arg_4 = word ptr 0Ah -arg_6 = word ptr 0Ch - - enter 6, 0 - push si - push di - mov si, [bp+arg_4] - mov di, [bp+arg_0] - mov bx, [bp+arg_2] - shl bx, 2 - mov ax, [bx+17A4h] - mov dx, [bx+17A2h] - mov word ptr [bp+var_4+2], ax - mov word ptr [bp+var_4], dx - cmp di, 1 - jnz short loc_CDD7 - add word ptr [bp+var_4], 0A0h - jmp short loc_CDED -; --------------------------------------------------------------------------- - -loc_CDD7: - cmp di, 2 - jnz short loc_CDE3 - add word ptr [bp+var_4], 0FA00h - jmp short loc_CDED -; --------------------------------------------------------------------------- - -loc_CDE3: - cmp di, 3 - jnz short loc_CDED - add word ptr [bp+var_4], 0FAA0h - -loc_CDED: - mov eax, [bp+var_4] - shr eax, 10h - mov dx, word ptr [bp+var_4] - shr dx, 4 - add ax, dx - mov dx, word ptr [bp+var_4] - and dx, 0Fh - mov word ptr [bp+var_4+2], ax - mov word ptr [bp+var_4], dx - mov [bp+var_6], 0 - jmp short loc_CE4F -; --------------------------------------------------------------------------- - -loc_CE10: - push [bp+arg_6] - push si - pushd [bp+var_4] - push 140h - call graph_pack_put_8 - inc si - cmp si, 190h - jl short loc_CE2B - sub si, 190h - -loc_CE2B: - add word ptr [bp+var_4], 140h - mov eax, [bp+var_4] - shr eax, 10h - mov dx, word ptr [bp+var_4] - shr dx, 4 - add ax, dx - mov dx, word ptr [bp+var_4] - and dx, 0Fh - mov word ptr [bp+var_4+2], ax - mov word ptr [bp+var_4], dx - inc [bp+var_6] - -loc_CE4F: - cmp [bp+var_6], 0C8h - jl short loc_CE10 - pop di - pop si - leave - retf 8 -sub_CDAB endp +include th03/formats/pi_slot_put_quarter.asm ; --------------------------------------------------------------------------- push di diff --git a/th04_op.asm b/th04_op.asm index a6569cf3..76a3c312 100644 --- a/th04_op.asm +++ b/th04_op.asm @@ -1201,9 +1201,7 @@ loc_AF56: out dx, al call pi_slot_load pascal, 0, ds, offset aOp1_pi call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_DA75 + call pi_slot_put pascal, large 0, 0 freePISlotLarge 0 push 0 call graph_copy_page @@ -1231,9 +1229,7 @@ loc_AFBD: out dx, al call pi_slot_load pascal, 0, ds, offset aOp1_pi call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_DA75 + call pi_slot_put pascal, large 0, 0 freePISlotLarge 0 push 0 call graph_copy_page @@ -2472,9 +2468,7 @@ sub_B9CE proc near out dx, al call pi_slot_load pascal, 0, ds, offset aMs_pi call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_DA75 + call pi_slot_put pascal, large 0, 0 freePISlotLarge 0 push 0 call graph_copy_page @@ -2787,9 +2781,7 @@ var_1 = byte ptr -1 out dx, al call pi_slot_load pascal, 0, ds, offset aZun00_pi call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_DA75 + call pi_slot_put pascal, large 0, 0 freePISlotLarge 0 push 0 call graph_copy_page @@ -3736,9 +3728,7 @@ sub_C3B7 proc near out dx, al call pi_slot_load pascal, 0, ds, offset aMusic_pi call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_DA75 + call pi_slot_put pascal, large 0, 0 freePISlotLarge 0 mov al, byte_102AF mov byte ptr word_12DBC, al @@ -4509,16 +4499,12 @@ sub_CA1A proc near mov al, 1 out dx, al call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_DA75 + call pi_slot_put pascal, large 0, 0 mov dx, 0A6h ; '¦' mov al, 0 out dx, al call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_DA75 + call pi_slot_put pascal, large 0, 0 push 0 call sub_C8F5 mov si, 1 @@ -4626,9 +4612,7 @@ loc_CB58: out dx, al call pi_slot_load pascal, 0, ds, offset aOp1_pi_0 call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_DA75 + call pi_slot_put pascal, large 0, 0 freePISlotLarge 0 push 0 call graph_copy_page @@ -4830,11 +4814,11 @@ loc_CD7A: jnz short loc_CDB0 cmp [bp+var_3], 6 jnb short loc_CDB0 - pushd 26h ; '&' + pushd 38 mov al, [bp+var_3] mov ah, 0 push ax - call sub_DA75 + call pi_slot_put inc [bp+var_3] mov dx, 0A6h ; '¦' mov al, [bp+var_4] @@ -4881,9 +4865,7 @@ loc_CE50: out dx, al call pi_slot_load pascal, 0, ds, offset aOp1_pi_1 call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_DA75 + call pi_slot_put pascal, large 0, 0 freePISlotLarge 0 push 0 call graph_copy_page @@ -5886,9 +5868,7 @@ sub_D6B2 proc near mov al, 0 out dx, al call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_DA75 + call pi_slot_put pascal, large 0, 0 call sub_CF5E push 0 call sub_D338 @@ -6103,9 +6083,7 @@ loc_D881: out dx, al mov PaletteTone, 0C8h ; 'È' call far ptr palette_show - pushd 0 - push 0 - call sub_DA75 + call pi_slot_put pascal, large 0, 0 call sub_D650 push 0 call graph_copy_page @@ -6282,76 +6260,7 @@ sub_DA12 endp include th02/frame_delay.asm include th02/formats/pi_slot_palette_apply.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_DA75 proc far - -var_6 = word ptr -6 -var_4 = dword ptr -4 -arg_0 = word ptr 6 -arg_2 = word ptr 8 -arg_4 = word ptr 0Ah - - enter 6, 0 - push si - push di - mov si, [bp+arg_2] - mov di, [bp+arg_0] - mov bx, di - shl bx, 2 - mov ax, [bx+2372h] - mov dx, [bx+2370h] - mov word ptr [bp+var_4+2], ax - mov word ptr [bp+var_4], dx - mov [bp+var_6], 0 - jmp short loc_DAE9 -; --------------------------------------------------------------------------- - -loc_DA9B: - push [bp+arg_4] - push si - pushd [bp+var_4] - mov bx, di - imul bx, 48h - push word ptr [bx+239Ch] - call graph_pack_put_8 - inc si - cmp si, 190h - jl short loc_DABC - sub si, 190h - -loc_DABC: - mov bx, di - imul bx, 48h - mov ax, [bx+239Ch] - shr ax, 1 - add word ptr [bp+var_4], ax - mov eax, [bp+var_4] - shr eax, 10h - mov dx, word ptr [bp+var_4] - shr dx, 4 - add ax, dx - mov dx, word ptr [bp+var_4] - and dx, 0Fh - mov word ptr [bp+var_4+2], ax - mov word ptr [bp+var_4], dx - inc [bp+var_6] - -loc_DAE9: - mov bx, di - imul bx, 48h - mov ax, [bx+239Eh] - cmp ax, [bp+var_6] - ja short loc_DA9B - pop di - pop si - leave - retf 6 -sub_DA75 endp - +include th02/formats/pi_slot_put.asm include th02/formats/pi_slot_load.asm ; --------------------------------------------------------------------------- diff --git a/th05/formats/pi_slot_put.asm b/th05/formats/pi_slot_put.asm new file mode 100644 index 00000000..e1fff9dc --- /dev/null +++ b/th05/formats/pi_slot_put.asm @@ -0,0 +1,106 @@ +; int DEFCONV pi_slot_put(int x, int y, int slot) +proc_defconv pi_slot_put +@@slot = word ptr [bp + (cPtrSize + 2)] +@@y = word ptr [bp + (cPtrSize + 4)] +@@x = word ptr [bp + (cPtrSize + 6)] + + push bp + mov bp, sp + push si + push di + mov si, @@slot + mov di, si + shl si, 2 + les si, pi_slot_buffers[si] + imul di, size PiHeader + push @@x + push @@y + mov ax, pi_slot_headers.PiHeader._xsize[di] + push ax + shr ax, 1 + push ax + mov di, pi_slot_headers.PiHeader._ysize[di] + call pi_slot_put_rowloop + pop di + pop si + pop bp + ret 6 +pi_slot_put endp + align 2 + +; --------------------------------------------------------------------------- + +; int DEFCONV pi_slot_put_quarter(int x, int y, int slot, int quarter) +proc_defconv pi_slot_put_quarter +@@quarter = byte ptr [bp + (cPtrSize + 2)] +@@slot = word ptr [bp + (cPtrSize + 4)] +@@y = word ptr [bp + (cPtrSize + 6)] +@@x = word ptr [bp + (cPtrSize + 8)] + + push bp + mov bp, sp + push si + push di + xor ax, ax + xor dx, dx + mov si, @@slot + mov cl, @@quarter + test cl, 1 + jz short @@bottom_quarter? + mov ax, 160 + +@@bottom_quarter?: + test cl, 2 + jz short @@put + mov dx, ((640 * 200) / 2) / 16 + +@@put: + shl si, 2 + les si, pi_slot_buffers[si] + add si, ax + mov ax, es + add ax, dx + mov es, ax + push @@x + push @@y + push 320 + push 320 + mov di, 200 + call pi_slot_put_rowloop + pop di + pop si + pop bp + ret 8 +pi_slot_put_quarter endp + +; --------------------------------------------------------------------------- + +pi_slot_put_rowloop proc near +@@stride = word ptr [bp+2] +@@len = word ptr [bp+4] +@@y = word ptr [bp+6] +@@x = word ptr [bp+8] + + mov bp, sp + +@@put: + push es + call graph_pack_put_8_noclip pascal, @@x, @@y, es, si, @@len + pop es + inc @@y + cmp @@y, 400 + jb short @@next_row + sub @@y, 400 + +@@next_row: + add si, @@stride + mov ax, si + shr ax, 4 + mov dx, es + add dx, ax + mov es, dx + and si, 0Fh + dec di + jnz short @@put + retn 8 +pi_slot_put_rowloop endp diff --git a/th05_maine.asm b/th05_maine.asm index 6c5edc0f..bdeb2631 100644 --- a/th05_maine.asm +++ b/th05_maine.asm @@ -1379,9 +1379,7 @@ loc_ACE1: call pi_slot_palette_apply pascal, 0 loc_ACF4: - pushd 0 - push 0 - call sub_EFAC + call pi_slot_put pascal, large 0, 0 push 0 call graph_copy_page mov dx, 0A6h ; '¦' @@ -1474,10 +1472,7 @@ loc_AD9A: out dx, al cmp [bp+var_2], 4 jge short loc_ADE3 - push 0A00040h - push 0 - push [bp+var_2] - call sub_EFDC + call pi_slot_put_quarter pascal, (160 shl 16) + 64, 0, [bp+var_2] jmp loc_AE64 ; --------------------------------------------------------------------------- @@ -1529,10 +1524,7 @@ loc_AE42: mov dx, 0A6h ; '¦' mov al, 1 out dx, al - push 0A00040h - push 0 - push [bp+var_2] - call sub_EFDC + call pi_slot_put_quarter pascal, (160 shl 16) + 64, 0, [bp+var_2] push 1 call frame_delay @@ -2074,17 +2066,9 @@ loc_B2EE: loc_B309: cmp si, 8 jl short loc_B2EE - push di - push [bp+arg_0] - push 0 - push [bp+var_2] - call sub_EFDC + call pi_slot_put_quarter pascal, di, [bp+arg_0], 0, [bp+var_2] call sub_B37C - push di - push [bp+arg_0] - push 0 - push [bp+var_2] - call sub_EFDC + call pi_slot_put_quarter pascal, di, [bp+arg_0], 0, [bp+var_2] inc allcast_screen_plus_one cmp allcast_screen_plus_one, 8 jge short loc_B357 @@ -4112,9 +4096,7 @@ var_2 = word ptr -2 out dx, al call pi_slot_load pascal, 0, ds, offset aHi01_pi call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_EFAC + call pi_slot_put pascal, large 0, 0 call pi_slot_free pascal, 0 push 0 call graph_copy_page @@ -5811,9 +5793,7 @@ sub_D1B1 proc near out dx, al call pi_slot_load pascal, 0, ds, offset aUde_pi call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_EFAC + call pi_slot_put pascal, large 0, 0 call pi_slot_free pascal, 0 push 0 call graph_copy_page @@ -9349,131 +9329,7 @@ sub_EF39 proc near sub_EF39 endp include th05/formats/pi_slot_load.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_EFAC proc far - -arg_0 = word ptr 6 -arg_2 = word ptr 8 -arg_4 = word ptr 0Ah - - push bp - mov bp, sp - push si - push di - mov si, [bp+arg_0] - mov di, si - shl si, 2 - les si, [si+6FEh] - imul di, 48h - push [bp+arg_4] - push [bp+arg_2] - mov ax, [di+27CEh] - push ax - shr ax, 1 - push ax - mov di, [di+27D0h] - call sub_F022 - pop di - pop si - pop bp - retf 6 -sub_EFAC endp - -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_EFDC proc far - -arg_0 = byte ptr 6 -arg_2 = word ptr 8 -arg_4 = word ptr 0Ah -arg_6 = word ptr 0Ch - - push bp - mov bp, sp - push si - push di - xor ax, ax - xor dx, dx - mov si, [bp+arg_2] - mov cl, [bp+arg_0] - test cl, 1 - jz short loc_EFF3 - mov ax, 0A0h - -loc_EFF3: - test cl, 2 - jz short loc_EFFB - mov dx, 0FA0h - -loc_EFFB: - shl si, 2 - les si, [si+6FEh] - add si, ax - mov ax, es - add ax, dx - mov es, ax - assume es:nothing - push [bp+arg_6] - push [bp+arg_4] - -loc_F010: - push 140h - push 140h - mov di, 0C8h - call sub_F022 - pop di - pop si - pop bp - retf 8 -sub_EFDC endp - - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_F022 proc near - -arg_0 = word ptr 2 -arg_2 = word ptr 4 -arg_4 = word ptr 6 -arg_6 = word ptr 8 - - mov bp, sp - -loc_F024: - push es - call graph_pack_put_8_noclip pascal, \ - [bp+arg_6], [bp+arg_4], es, si, [bp+arg_2] - pop es - assume es:nothing - inc [bp+arg_4] - cmp [bp+arg_4], 190h - jb short loc_F045 - sub [bp+arg_4], 190h - -loc_F045: - add si, [bp+arg_0] - mov ax, si - shr ax, 4 - mov dx, es - add dx, ax - mov es, dx - and si, 0Fh - dec di - jnz short loc_F024 - retn 8 -sub_F022 endp - +include th05/formats/pi_slot_put.asm include th05/formats/pi_slot_palette_apply.asm include th05/formats/pi_slot_free.asm diff --git a/th05_op.asm b/th05_op.asm index 39e82cb7..c019619e 100644 --- a/th05_op.asm +++ b/th05_op.asm @@ -1100,9 +1100,7 @@ loc_AA91: out dx, al call pi_slot_load pascal, 0, ds, offset aOp1_pi call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_DE0A + call pi_slot_put pascal, large 0, 0 call pi_slot_free pascal, 0 push 0 call graph_copy_page @@ -1121,9 +1119,7 @@ loc_AAE1: out dx, al call pi_slot_load pascal, 0, ds, offset aOp1_pi call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_DE0A + call pi_slot_put pascal, large 0, 0 call pi_slot_free pascal, 0 push 0 call graph_copy_page @@ -1149,9 +1145,7 @@ loc_AB3B: out dx, al call pi_slot_load pascal, 0, ds, offset aOp1_pi call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_DE0A + call pi_slot_put pascal, large 0, 0 call pi_slot_free pascal, 0 push 0 call graph_copy_page @@ -2418,9 +2412,7 @@ sub_B5A6 proc near out dx, al call pi_slot_load pascal, 0, ds, offset aMs_pi call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_DE0A + call pi_slot_put pascal, large 0, 0 call pi_slot_free pascal, 0 push 0 call graph_copy_page @@ -2733,9 +2725,7 @@ var_1 = byte ptr -1 out dx, al call pi_slot_load pascal, 0, ds, offset aZun00_pi call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_DE0A + call pi_slot_put pascal, large 0, 0 call pi_slot_free pascal, 0 push 0 call graph_copy_page @@ -3313,13 +3303,13 @@ loc_BD55: cwd idiv bx call pi_slot_palette_apply pascal, ax - pushd 116h + pushd 278 mov ax, si mov bx, 8 cwd idiv bx push ax - call sub_DE0A + call pi_slot_put loc_BD81: push 1 @@ -3414,9 +3404,7 @@ loc_BE46: mov al, 0 out dx, al call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_DE0A + call pi_slot_put pascal, large 0, 0 call pi_slot_free pascal, 0 push 0 call graph_copy_page @@ -4222,9 +4210,7 @@ var_1 = byte ptr -1 out dx, al call pi_slot_load pascal, 0, ds, offset aMusic_pi call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_DE0A + call pi_slot_put pascal, large 0, 0 call pi_slot_free pascal, 0 call sub_D894 call sub_BFB7 @@ -5106,16 +5092,12 @@ sub_CBDC proc near mov al, 1 out dx, al call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_DE0A + call pi_slot_put pascal, large 0, 0 mov dx, 0A6h ; '¦' mov al, 0 out dx, al call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_DE0A + call pi_slot_put pascal, large 0, 0 xor si, si jmp short loc_CC27 ; --------------------------------------------------------------------------- @@ -5229,9 +5211,7 @@ loc_CD17: out dx, al call pi_slot_load pascal, 0, ds, offset aOp1_pi_1 call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_DE0A + call pi_slot_put pascal, large 0, 0 call pi_slot_free pascal, 0 push 0 call graph_copy_page @@ -5670,9 +5650,7 @@ var_2 = word ptr -2 out dx, al call pi_slot_load pascal, 0, ds, offset aSlb1_pi call pi_slot_palette_apply pascal, 0 - pushd 0 - push 0 - call sub_DE0A + call pi_slot_put pascal, large 0, 0 call pi_slot_free pascal, 0 push 0 call graph_copy_page @@ -7284,115 +7262,7 @@ sub_DD97 proc near sub_DD97 endp include th05/formats/pi_slot_load.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_DE0A proc far - -arg_0 = word ptr 6 -arg_2 = word ptr 8 -arg_4 = word ptr 0Ah - - push bp - mov bp, sp - push si - push di - mov si, [bp+arg_0] - mov di, si - shl si, 2 - les si, [si+0A84h] - imul di, 48h - push [bp+arg_4] - push [bp+arg_2] - mov ax, [di+3866h] - push ax - shr ax, 1 - push ax - mov di, [di+3868h] - call sub_DE80 - pop di - pop si - pop bp - retf 6 -sub_DE0A endp - -; --------------------------------------------------------------------------- - nop - push bp - mov bp, sp - push si - push di - xor ax, ax - xor dx, dx - mov si, [bp+8] - mov cl, [bp+6] - test cl, 1 - jz short loc_DE51 - mov ax, 0A0h - -loc_DE51: - test cl, 2 - jz short loc_DE59 - mov dx, 0FA0h - -loc_DE59: - shl si, 2 - les si, [si+0A84h] - add si, ax - mov ax, es - add ax, dx - mov es, ax - assume es:nothing - push word ptr [bp+0Ch] - push word ptr [bp+0Ah] - push 140h - push 140h - mov di, 0C8h ; 'È' - call sub_DE80 - pop di - pop si - pop bp - retf 8 - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_DE80 proc near - -arg_0 = word ptr 2 -arg_2 = word ptr 4 -arg_4 = word ptr 6 -arg_6 = word ptr 8 - - mov bp, sp - -loc_DE82: - push es - call graph_pack_put_8_noclip pascal, \ - [bp+arg_6], [bp+arg_4], es, si, [bp+arg_2] - pop es - assume es:nothing - inc [bp+arg_4] - cmp [bp+arg_4], 190h - jb short loc_DEA3 - sub [bp+arg_4], 190h - -loc_DEA3: - add si, [bp+arg_0] - mov ax, si - shr ax, 4 - mov dx, es - add dx, ax - mov es, dx - and si, 0Fh - dec di - jnz short loc_DE82 - retn 8 -sub_DE80 endp - +include th05/formats/pi_slot_put.asm include th05/formats/pi_slot_palette_apply.asm include th05/formats/pi_slot_free.asm