[Separate translation units] [th04] cdg_put_nocolors_8() (undecompilable)

Reason: Self-modifying. -.-

Part of P0139, funded by [Anonymous].
This commit is contained in:
nmlgc 2021-04-29 13:54:13 +02:00
parent 7761f4e804
commit d8ece227fd
7 changed files with 65 additions and 46 deletions

View File

@ -133,7 +133,7 @@ bin\th04\res_huma.com: th04\res_huma.cpp
$**
| masters.lib
bin\th04\op.exe: bin\th04\op.obj th04\m_char.cpp bin\th01\vplanset.obj bin\frmdely1.obj bin\th03\pi_put.obj bin\th03\pi_load.obj bin\hfliplut.obj bin\th04\input_w.obj bin\th04\vector.obj bin\th04\snd_pmdr.obj bin\th04\snd_mmdr.obj bin\th04\snd_kaja.obj bin\th04\cdg_put.obj bin\th04\exit.obj bin\th04\initop.obj bin\th04\cdg_p_na.obj bin\th04\input_s.obj bin\th04\snd_se_r.obj bin\th04\snd_se.obj bin\th04\egcrect.obj bin\th04\bgimage.obj bin\th04\bgimager.obj bin\th04\cdg_load.obj th04\frmdely2.c
bin\th04\op.exe: bin\th04\op.obj th04\m_char.cpp bin\th01\vplanset.obj bin\frmdely1.obj bin\th03\pi_put.obj bin\th03\pi_load.obj bin\hfliplut.obj bin\th04\input_w.obj bin\th04\vector.obj bin\th04\snd_pmdr.obj bin\th04\snd_mmdr.obj bin\th04\snd_kaja.obj bin\th04\cdg_p_nc.obj bin\th04\cdg_put.obj bin\th04\exit.obj bin\th04\initop.obj bin\th04\cdg_p_na.obj bin\th04\input_s.obj bin\th04\snd_se_r.obj bin\th04\snd_se.obj bin\th04\egcrect.obj bin\th04\bgimage.obj bin\th04\bgimager.obj bin\th04\cdg_load.obj th04\frmdely2.c
$(CC) $(CFLAGS) $(LARGE_LFLAGS) -DGAME=4 -DBINARY='O' -3 -Z -d -nbin\th04\ -eOP.EXE @&&|
$**
|

View File

@ -89,6 +89,7 @@ BMP2ARR = bin\\Pipeline\\bmp2arr.exe
: th04_memchk.asm |> !as |> bin\\th04\\memchk.obj
: th04\\scoreupd.asm |> !as4 |>
: th04\\cdg_put.asm |> !as4 |>
: th04\\cdg_p_nc.asm |> !as4 |>
: th04\\cdg_p_pr.asm |> !as4 |>
: th04\\input_s.asm |> !as4 |>
: th04\\cdg_load.asm |> !as4 |>

View File

@ -38,6 +38,7 @@ tasm32 /m /mx /kh32768 /t th04_zuninit.asm bin\th04\zuninit.obj
tasm32 /m /mx /kh32768 /t th04_memchk.asm bin\th04\memchk.obj
tasm32 /m /mx /kh32768 /t /dGAME=4 th04\scoreupd.asm bin\th04\scoreupd.obj
tasm32 /m /mx /kh32768 /t /dGAME=4 th04\cdg_put.asm bin\th04\cdg_put.obj
tasm32 /m /mx /kh32768 /t /dGAME=4 th04\cdg_p_nc.asm bin\th04\cdg_p_nc.obj
tasm32 /m /mx /kh32768 /t /dGAME=4 th04\cdg_p_pr.asm bin\th04\cdg_p_pr.obj
tasm32 /m /mx /kh32768 /t /dGAME=4 th04\input_s.asm bin\th04\input_s.obj
tasm32 /m /mx /kh32768 /t /dGAME=4 th04\cdg_load.asm bin\th04\cdg_load.obj

1
th04/cdg_p_nc.asm Normal file
View File

@ -0,0 +1 @@
include th04/formats/cdg_p_nc.asm

60
th04/formats/cdg_p_nc.asm Normal file
View File

@ -0,0 +1,60 @@
.386
locals
include pc98.inc
include th03/formats/cdg.inc
extrn _cdg_slots:cdg_t:CDG_SLOT_COUNT
SHARED segment word public 'CODE' use16
assume cs:SHARED
; Identical to the barely decompilable TH05 version, which doesn't rely on
; self-modifying code for the width.
public CDG_PUT_NOCOLORS_8
cdg_put_nocolors_8 proc far
; (PASCAL calling convention, parameter list needs to be reversed here)
arg @@slot:word, @@top:word, @@left:word
@@stride_backwards equ <dx>
push bp
mov bp, sp
push si
push di
cdg_slot_offset si, @@slot
cdg_dst_offset di, si, @@left
mov ax, [si+cdg_t.vram_dword_w]
mov @@width, ax
jmp short $+2
shl ax, 2
add ax, ROW_SIZE
mov @@stride_backwards, ax
cdg_dst_segment es, @@top, bx
push ds
mov ds, [si+cdg_t.seg_alpha]
xor si, si
cld
even
@@next_row:
@@width = word ptr $+1
mov cx, 1234h
rep movsd
sub di, @@stride_backwards
jns short @@next_row
pop ds
pop di
pop si
pop bp
retf 6
cdg_put_nocolors_8 endp
even
SHARED ends
end

View File

@ -1,44 +0,0 @@
; Identical to the barely decompilable TH05 version, which doesn't rely on
; self-modifying code for the width.
public CDG_PUT_NOCOLORS_8
cdg_put_nocolors_8 proc far
@@slot = word ptr 6
@@top = word ptr 8
@@left = word ptr 10
push bp
mov bp, sp
push si
push di
cdg_slot_offset si, [bp+@@slot]
cdg_dst_offset di, si, [bp+@@left]
mov ax, [si+cdg_t.vram_dword_w]
mov word ptr cs:@@width+1, ax
jmp short $+2
shl ax, 2
add ax, (640 / 8)
mov dx, ax
cdg_dst_segment es, [bp+@@top], bx
push ds
mov ds, [si+cdg_t.seg_alpha]
xor si, si
cld
align 2
@@width:
mov cx, 1234h
rep movsd
sub di, dx
jns short @@width
pop ds
pop di
pop si
pop bp
retf 6
cdg_put_nocolors_8 endp
align 2

View File

@ -2642,13 +2642,13 @@ SHARED segment word public 'CODE' use16
extern _snd_pmd_resident:proc
extern _snd_mmd_resident:proc
extern SND_KAJA_INTERRUPT:proc
extern CDG_PUT_NOCOLORS_8:proc
SHARED ends
SHARED_ segment word public 'CODE' use16
assume cs:g_SHARED
assume es:nothing, ss:nothing, ds:_DATA, fs:nothing, gs:nothing
include th04/formats/cdg_put_nocolors.asm
include th04/snd/detmodes.asm
include th03/snd/delaymea.asm
include th02/exit_dos.asm