[Reverse-engineering] [th04/th05] GENSOU.SCR decoding, encoding, and defaults

WTF. Fine, let's have separate, micro-optimized ASM implementations for
decoding and encoding inr MAIN.EXE, but still, all those minute
difference between OP.EXE and MAINE.EXE…
This is as far as anyone should reasonably go before decompilation;
things will get really ugly with the loading functions once the file
name is involved as well…

Completes P0063, funded by -Tom-.
This commit is contained in:
nmlgc 2019-12-27 22:28:54 +01:00
parent f46fc914c1
commit 8dbb45050f
15 changed files with 680 additions and 1214 deletions

View File

@ -35,3 +35,39 @@ extern scoredat_section_t hi;
// Used to simultaneously store scores for Marisa in TH04's OP.EXE. Still
// present in TH05, but unused.
extern scoredat_section_t hi2;
/// Functions
/// ---------
// All of those write to and read from [hi], except where mentioned otherwise.
// Decoding and encoding
#if (BINARY == 'O')
// scoredat_decode() variant that decodes both [hi] and [hi2] -
// even in TH05 where [hi2] is not referenced anywhere else.
void pascal near scoredat_decode_both(void);
void pascal near scoredat_encode(void);
# define scoredat_decode_func scoredat_decode_both
#elif (BINARY == 'M') && (GAME == 4)
void pascal near scoredat_decode(scoredat_section_t near *hi);
void pascal near scoredat_encode(scoredat_section_t near *hi);
# define scoredat_decode_func() scoredat_decode(&hi)
# define scoredat_encode_func() scoredat_encode(&hi)
#else
void pascal near scoredat_decode(void);
void pascal near scoredat_encode(void);
# define scoredat_decode_func scoredat_decode
# define scoredat_encode_func scoredat_encode
#endif
// Recreation
#if (GAME == 4)
void pascal near scoredat_recreate(void);
#elif (GAME == 5) && (BINARY == 'O')
void pascal near scoredat_recreate_op(void);
#elif (GAME == 5) && (BINARY == 'E')
void pascal near scoredat_recreate_maine(void);
#endif
/// ---------

View File

@ -31,3 +31,14 @@ scoredat_section_t struc
sum dw ?
score scoredat_t <?>
scoredat_section_t ends
ifdef BINARY
scoredat_decode_func equ <scoredat_decode>
scoredat_encode_func equ <scoredat_encode>
if BINARY eq 'O'
scoredat_decode_func equ <scoredat_decode_both>
elseif (BINARY eq 'M') and (GAME eq 4)
scoredat_decode_func equ <scoredat_decode pascal, offset _hi>
scoredat_encode_func equ <scoredat_encode pascal, offset _hi>
endif
endif

View File

@ -0,0 +1,106 @@
scoredat_func macro nam:req
public nam
nam proc near
if GAME eq 5
push si
mov bx, offset _hi
else
mov bx, sp
push si
mov bx, ss:[bx+2]
endif
mov si, bx
endfunc macro
pop si
if GAME eq 5
retn
nam endp
else
retn 2
nam endp
; TODO: Turn into unconditional EVEN once this is a separate
; translation unit
even
endif
endm
endm
scoredat_func SCOREDAT_DECODE
mov cx, size scoredat_t - 1
if GAME eq 5
mov dx, word ptr [bx+scoredat_section_t.key1]
add bx, scoredat_section_t.score
@@decode:
mov al, [bx+1]
ror al, 3
xor al, dh
add al, dl
add [bx], al
inc bx
loop @@decode
add [bx], dl
mov cx, size scoredat_t
xor bx, bx
else
mov ah, [bx+scoredat_section_t.key2]
add bx, scoredat_section_t.score
@@decode:
mov al, [bx+1]
ror al, 3
xor al, ah
add al, [si+scoredat_section_t.key1]
add [bx], al
inc bx
loop @@decode
mov al, [si+scoredat_section_t.key1]
add [bx], al
xor bx, bx
mov cx, size scoredat_t
endif
xor dx, dx
mov ax, [si+scoredat_section_t.sum]
add si, scoredat_section_t.score
@@sum:
mov bl, [si]
add dx, bx
inc si
loop @@sum
sub ax, dx
endfunc
scoredat_func SCOREDAT_ENCODE
xor dx, dx
xor ax, ax
add bx, scoredat_section_t.score
mov cx, size scoredat_t
@@sum:
mov dl, [bx]
add ax, dx
inc bx
loop @@sum
mov [si+scoredat_section_t.sum], ax
call IRand
mov word ptr [si+scoredat_section_t.key1], ax
xor dx, dx
add si, size scoredat_section_t - 1
mov cx, size scoredat_t
@@encode:
add dl, al
sub [si], dl
mov dl, [si]
ror dl, 3
xor dl, ah
dec si
loop @@encode
endfunc
purge scoredat_func

View File

@ -0,0 +1,51 @@
public SCOREDAT_DECODE
scoredat_decode proc near
@@byte = byte ptr -1
enter 2, 0
push si
mov si, scoredat_section_t.score
jmp short @@1_decode_more?
; ---------------------------------------------------------------------------
@@1_decode_loop:
mov al, byte ptr _hi+1[si]
mov [bp+@@byte], al
mov al, _hi.key2
ror [bp+@@byte], 3
xor [bp+@@byte], al
mov al, byte ptr _hi+0[si]
mov dl, _hi.key1
add dl, [bp+@@byte]
add al, dl
mov byte ptr _hi+0[si], al
inc si
@@1_decode_more?:
cmp si, size scoredat_section_t - 1
jl short @@1_decode_loop
mov al, _hi.key1
add byte ptr _hi+0[si], al
xor cx, cx
mov si, scoredat_section_t.score
jmp short @@1_sum_more?
; ---------------------------------------------------------------------------
@@1_sum_loop?:
mov al, byte ptr _hi+0[si]
mov ah, 0
add cx, ax
inc si
@@1_sum_more?:
cmp si, size scoredat_section_t
jl short @@1_sum_loop?
mov al, byte ptr _hi.sum
sub al, cl
@@ret:
pop si
leave
retn
scoredat_decode endp

View File

@ -0,0 +1,94 @@
public SCOREDAT_DECODE_BOTH
scoredat_decode_both proc near
@@byte = byte ptr -1
enter 2, 0
push si
mov si, scoredat_section_t.score
jmp short @@1_decode_more?
; ---------------------------------------------------------------------------
@@1_decode_loop:
mov al, byte ptr _hi+1[si]
mov [bp+@@byte], al
mov al, _hi.key2
ror [bp+@@byte], 3
xor [bp+@@byte], al
mov al, byte ptr _hi+0[si]
mov dl, _hi.key1
add dl, [bp+@@byte]
add al, dl
mov byte ptr _hi+0[si], al
inc si
@@1_decode_more?:
cmp si, size scoredat_section_t - 1
jl short @@1_decode_loop
mov al, _hi.key1
add byte ptr _hi+0[si], al
xor cx, cx
mov si, scoredat_section_t.score
jmp short @@1_sum_more?
; ---------------------------------------------------------------------------
@@1_sum_loop?:
mov al, byte ptr _hi+0[si]
mov ah, 0
add cx, ax
inc si
@@1_sum_more?:
cmp si, size scoredat_section_t
jl short @@1_sum_loop?
cmp _hi.sum, cx
jz short @@1_sum_matches
mov al, 1
jmp short @@ret
; ---------------------------------------------------------------------------
@@1_sum_matches:
mov si, scoredat_section_t.score
jmp short @@2_decode_more?
; ---------------------------------------------------------------------------
@@2_decode_loop:
mov al, byte ptr _hi2+1[si]
mov [bp+@@byte], al
mov al, _hi2.key2
ror [bp+@@byte], 3
xor [bp+@@byte], al
mov al, byte ptr _hi2+0[si]
mov dl, _hi2.key1
add dl, [bp+@@byte]
add al, dl
mov byte ptr _hi2+0[si], al
inc si
@@2_decode_more?:
cmp si, size scoredat_section_t - 1
jl short @@2_decode_loop
mov al, _hi2.key1
add byte ptr _hi2+0[si], al
xor cx, cx
mov si, scoredat_section_t.score
jmp short @@2_sum_more?
; ---------------------------------------------------------------------------
@@2_sum_loop:
mov al, byte ptr _hi2+0[si]
mov ah, 0
add cx, ax
inc si
@@2_sum_more?:
cmp si, size scoredat_section_t
jl short @@2_sum_loop
mov al, byte ptr _hi2.sum
sub al, cl
@@ret:
pop si
leave
retn
scoredat_decode_both endp

View File

@ -0,0 +1,50 @@
public SCOREDAT_ENCODE
scoredat_encode proc near
@@byte = byte ptr -1
enter 2, 0
push si
mov _hi.sum, 0
mov si, scoredat_section_t.score
jmp short @@sum_more?
; ---------------------------------------------------------------------------
@@sum_loop:
mov al, byte ptr _hi[si]
mov ah, 0
add _hi.sum, ax
inc si
@@sum_more?:
cmp si, size scoredat_section_t
jl short @@sum_loop
call IRand
mov _hi.key1, al
call IRand
mov _hi.key2, al
mov [bp+@@byte], 0
mov si, size scoredat_section_t - 1
jmp short @@encode_more?
; ---------------------------------------------------------------------------
@@encode_loop:
mov al, byte ptr _hi[si]
mov dl, _hi.key1
add dl, [bp+@@byte]
sub al, dl
mov byte ptr _hi[si], al
mov al, byte ptr _hi[si]
mov [bp+@@byte], al
mov al, _hi.key2
ror [bp+@@byte], 3
xor [bp+@@byte], al
dec si
@@encode_more?:
cmp si, scoredat_section_t.score
jge short @@encode_loop
pop si
leave
retn
scoredat_encode endp

View File

@ -0,0 +1,92 @@
public SCOREDAT_RECREATE
scoredat_recreate proc near
@@digit = byte ptr -1
enter 2, 0
push si
push di
mov [bp+@@digit], gb_9_
xor si, si
jmp short @@places_more?
; ---------------------------------------------------------------------------
@@place_loop:
mov _hi.score.cleared, SCOREDAT_NOT_CLEARED
xor di, di
jmp short @@digit_zero_more?
; ---------------------------------------------------------------------------
@@digit_zero_loop:
mov bx, si
shl bx, 3
mov _hi.score.g_points[bx+di], gb_0_
inc di
@@digit_zero_more?:
cmp di, SCORE_DIGITS
jl short @@digit_zero_loop
or si, si
jnz short @@not_first_place
mov bx, si
shl bx, 3
mov _hi.score.g_points[bx][5], gb_1_
jmp short @@set_stage
; ---------------------------------------------------------------------------
@@not_first_place:
mov bx, si
shl bx, 3
mov al, [bp+@@digit]
mov _hi.score.g_points[bx][4], al
dec [bp+@@digit]
@@set_stage:
mov ax, si
cwd
sub ax, dx
sar ax, 1
mov dl, gb_5_
sub dl, al
mov _hi.score.g_stage[si], dl
xor di, di
jmp short @@name_more?
; ---------------------------------------------------------------------------
@@name_loop:
mov bx, si
imul bx, (SCOREDAT_NAME_LEN + 1)
mov _hi.score.g_name[bx+di], gs_DOT
inc di
@@name_more?:
cmp di, SCOREDAT_NAME_LEN
jl short @@name_loop
mov bx, si
imul bx, (SCOREDAT_NAME_LEN + 1)
mov _hi.score.g_name[bx] + SCOREDAT_NAME_LEN, 0
inc si
@@places_more?:
cmp si, SCOREDAT_PLACES
jl short @@place_loop
call file_create pascal, ds, offset aGensou_scr ; "GENSOU.SCR"
xor si, si
jmp short @@sections_more?
; ---------------------------------------------------------------------------
@@section_loop:
call scoredat_encode_func
call file_write pascal, ds, offset _hi, size scoredat_section_t
call scoredat_decode_func
inc si
@@sections_more?:
cmp si, RANK_COUNT * PLAYCHAR_COUNT
jl short @@section_loop
call file_close
pop di
pop si
leave
retn
scoredat_recreate endp

View File

@ -2424,84 +2424,7 @@ sub_C34E endp
include th04/playperf.asm
include th04/select_for_rank.asm
; =============== S U B R O U T I N E =======================================
sub_C3AA proc near
mov bx, sp
push si
mov bx, ss:[bx+2]
mov si, bx
mov cx, size scoredat_t - 1
mov ah, [bx+scoredat_section_t.key2]
add bx, scoredat_section_t.score
loc_C3BC:
mov al, [bx+1]
ror al, 3
xor al, ah
add al, [si+scoredat_section_t.key1]
add [bx], al
inc bx
loop loc_C3BC
mov al, [si+scoredat_section_t.key1]
add [bx], al
xor bx, bx
mov cx, size scoredat_t
xor dx, dx
mov ax, [si+scoredat_section_t.sum]
add si, scoredat_section_t.score
loc_C3DC:
mov bl, [si]
add dx, bx
inc si
loop loc_C3DC
sub ax, dx
pop si
retn 2
sub_C3AA endp
even
; =============== S U B R O U T I N E =======================================
sub_C3EA proc near
mov bx, sp
push si
mov bx, ss:[bx+2]
mov si, bx
xor dx, dx
xor ax, ax
add bx, scoredat_section_t.score
mov cx, size scoredat_t
loc_C3FD:
mov dl, [bx]
add ax, dx
inc bx
loop loc_C3FD
mov [si+scoredat_section_t.sum], ax
call IRand
mov word ptr [si+scoredat_section_t.key1], ax
xor dx, dx
add si, size scoredat_section_t - 1
mov cx, size scoredat_t
loc_C417:
add dl, al
sub [si], dl
mov dl, [si]
ror dl, 3
xor dl, ah
dec si
loop loc_C417
pop si
retn 2
sub_C3EA endp
even
include th04/formats/scoredat_code_asm.asm
; ---------------------------------------------------------------------------
word_C42A dw 0
@ -14008,105 +13931,7 @@ loc_12A05:
retn
mugetsu_gengetsu_bg_render endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_12A0A proc near
@@digit = byte ptr -1
enter 2, 0
push si
push di
mov [bp+@@digit], gb_9_
xor si, si
jmp short loc_12A7E
; ---------------------------------------------------------------------------
loc_12A18:
mov _hi.score.cleared, SCOREDAT_NOT_CLEARED
xor di, di
jmp short loc_12A2C
; ---------------------------------------------------------------------------
loc_12A21:
mov bx, si
shl bx, 3
mov _hi.score.g_points[bx+di], gb_0_
inc di
loc_12A2C:
cmp di, SCORE_DIGITS
jl short loc_12A21
or si, si
jnz short loc_12A41
mov bx, si
shl bx, 3
mov _hi.score.g_points[bx][5], gb_1_
jmp short loc_12A50
; ---------------------------------------------------------------------------
loc_12A41:
mov bx, si
shl bx, 3
mov al, [bp+@@digit]
mov _hi.score.g_points[bx][4], al
dec [bp+@@digit]
loc_12A50:
mov ax, si
cwd
sub ax, dx
sar ax, 1
mov dl, gb_5_
sub dl, al
mov _hi.score.g_stage[si], dl
xor di, di
jmp short loc_12A6E
; ---------------------------------------------------------------------------
loc_12A63:
mov bx, si
imul bx, (SCOREDAT_NAME_LEN + 1)
mov _hi.score.g_name[bx+di], gs_DOT
inc di
loc_12A6E:
cmp di, SCOREDAT_NAME_LEN
jl short loc_12A63
mov bx, si
imul bx, (SCOREDAT_NAME_LEN + 1)
mov _hi.score.g_name[bx][SCOREDAT_NAME_LEN], 0
inc si
loc_12A7E:
cmp si, 0Ah
jl short loc_12A18
push ds
push offset aGensou_scr ; "GENSOU.SCR"
call file_create
xor si, si
jmp short loc_12AA9
; ---------------------------------------------------------------------------
loc_12A90:
call main_01:sub_C3EA pascal, offset _hi
call file_write pascal, ds, offset _hi, size scoredat_section_t
call main_01:sub_C3AA pascal, offset _hi
inc si
loc_12AA9:
cmp si, 0Ah
jl short loc_12A90
call file_close
pop di
pop si
leave
retn
sub_12A0A endp
include th04/formats/scoredat_recreate.asm
; =============== S U B R O U T I N E =======================================
@ -14137,12 +13962,12 @@ sub_12AB7 proc near
loc_12AFE:
call file_read pascal, ds, offset _hi, size scoredat_section_t
call file_close
call main_01:sub_C3AA pascal, offset _hi
call main_01:scoredat_decode pascal, offset _hi
or al, al
jz short loc_12B1C
loc_12B19:
call main_01:sub_12A0A
call main_01:scoredat_recreate
loc_12B1C:
pop bp
@ -14157,7 +13982,7 @@ sub_12AB7 endp
sub_12B1E proc near
push bp
mov bp, sp
call main_01:sub_C3EA pascal, offset _hi
call main_01:scoredat_encode pascal, offset _hi
push ds
push offset aGensou_scr_2 ; "GENSOU.SCR"
call file_append

View File

@ -3478,214 +3478,9 @@ sub_C0F8 proc near
retn
sub_C0F8 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_C149 proc near
@@byte = byte ptr -1
enter 2, 0
push si
mov si, scoredat_section_t.score
jmp short loc_C176
; ---------------------------------------------------------------------------
loc_C153:
mov al, byte ptr _hi+1[si]
mov [bp+@@byte], al
mov al, _hi.key2
ror [bp+@@byte], 3
xor [bp+@@byte], al
mov al, byte ptr _hi+0[si]
mov dl, _hi.key1
add dl, [bp+@@byte]
add al, dl
mov byte ptr _hi+0[si], al
inc si
loc_C176:
cmp si, size scoredat_section_t - 1
jl short loc_C153
mov al, _hi.key1
add byte ptr _hi+0[si], al
xor cx, cx
mov si, scoredat_section_t.score
jmp short loc_C193
; ---------------------------------------------------------------------------
loc_C18A:
mov al, byte ptr _hi+0[si]
mov ah, 0
add cx, ax
inc si
loc_C193:
cmp si, size scoredat_section_t
jl short loc_C18A
mov al, byte ptr _hi.sum
sub al, cl
pop si
leave
retn
sub_C149 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_C1A1 proc near
@@byte = byte ptr -1
enter 2, 0
push si
mov _hi.sum, 0
mov si, scoredat_section_t.score
jmp short loc_C1BC
; ---------------------------------------------------------------------------
loc_C1B1:
mov al, byte ptr _hi[si]
mov ah, 0
add _hi.sum, ax
inc si
loc_C1BC:
cmp si, size scoredat_section_t
jl short loc_C1B1
call IRand
mov _hi.key1, al
call IRand
mov _hi.key2, al
mov [bp+@@byte], 0
mov si, size scoredat_section_t - 1
jmp short loc_C1FE
; ---------------------------------------------------------------------------
loc_C1DB:
mov al, byte ptr _hi[si]
mov dl, _hi.key1
add dl, [bp+@@byte]
sub al, dl
mov byte ptr _hi[si], al
mov al, byte ptr _hi[si]
mov [bp+@@byte], al
mov al, _hi.key2
ror [bp+@@byte], 3
xor [bp+@@byte], al
dec si
loc_C1FE:
cmp si, scoredat_section_t.score
jge short loc_C1DB
pop si
leave
retn
sub_C1A1 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_C206 proc near
var_1 = byte ptr -1
enter 2, 0
push si
push di
mov [bp+var_1], gb_9_
xor si, si
jmp short loc_C27A
; ---------------------------------------------------------------------------
loc_C214:
mov _hi.score.cleared, SCOREDAT_NOT_CLEARED
xor di, di
jmp short loc_C228
; ---------------------------------------------------------------------------
loc_C21D:
mov bx, si
shl bx, 3
mov _hi.score.g_points[bx+di], gb_0_
inc di
loc_C228:
cmp di, SCORE_DIGITS
jl short loc_C21D
or si, si
jnz short loc_C23D
mov bx, si
shl bx, 3
mov _hi.score.g_points[bx][5], gb_1_
jmp short loc_C24C
; ---------------------------------------------------------------------------
loc_C23D:
mov bx, si
shl bx, 3
mov al, [bp+var_1]
mov _hi.score.g_points[bx][4], al
dec [bp+var_1]
loc_C24C:
mov ax, si
cwd
sub ax, dx
sar ax, 1
mov dl, gb_5_
sub dl, al
mov _hi.score.g_stage[si], dl
xor di, di
jmp short loc_C26A
; ---------------------------------------------------------------------------
loc_C25F:
mov bx, si
imul bx, (SCOREDAT_NAME_LEN + 1)
mov _hi.score.g_name[bx+di], gs_DOT
inc di
loc_C26A:
cmp di, SCOREDAT_NAME_LEN
jl short loc_C25F
mov bx, si
imul bx, (SCOREDAT_NAME_LEN + 1)
mov _hi.score.g_name[bx][SCOREDAT_NAME_LEN], 0
inc si
loc_C27A:
cmp si, 0Ah
jl short loc_C214
push ds
push offset aGensou_scr ; "GENSOU.SCR"
call file_create
xor si, si
jmp short loc_C29F
; ---------------------------------------------------------------------------
loc_C28C:
call sub_C1A1
call file_write pascal, ds, offset _hi, size scoredat_section_t
call sub_C149
inc si
loc_C29F:
cmp si, 0Ah
jl short loc_C28C
call file_close
pop di
pop si
leave
retn
sub_C206 endp
include th04/formats/scoredat_decode.asm
include th04/formats/scoredat_encode.asm
include th04/formats/scoredat_recreate.asm
; =============== S U B R O U T I N E =======================================
@ -3719,12 +3514,12 @@ arg_0 = byte ptr 4
loc_C2EF:
call file_read pascal, ds, offset _hi, size scoredat_section_t
call file_close
call sub_C149
call scoredat_decode
or al, al
jz short loc_C310
loc_C307:
call sub_C206
call scoredat_recreate
mov al, 1
pop bp
retn 2
@ -3745,7 +3540,7 @@ sub_C316 proc near
push bp
mov bp, sp
push si
call sub_C1A1
call scoredat_encode
push ds
push offset aGensou_scr_2 ; "GENSOU.SCR"
call file_append
@ -3770,8 +3565,8 @@ loc_C360:
movzx eax, ax
call file_seek pascal, large eax, 0
call file_read pascal, ds, offset _hi, size scoredat_section_t
call sub_C149
call sub_C1A1
call scoredat_decode
call scoredat_encode
mov ax, si
imul ax, size scoredat_section_t
movzx eax, ax

View File

@ -2442,259 +2442,9 @@ loc_C544:
retn
musicroom endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_C57A proc near
@@byte = byte ptr -1
enter 2, 0
push si
mov si, scoredat_section_t.score
jmp short loc_C5A7
; ---------------------------------------------------------------------------
loc_C584:
mov al, byte ptr _hi+1[si]
mov [bp+@@byte], al
mov al, _hi.key2
ror [bp+@@byte], 3
xor [bp+@@byte], al
mov al, byte ptr _hi+0[si]
mov dl, _hi.key1
add dl, [bp+@@byte]
add al, dl
mov byte ptr _hi+0[si], al
inc si
loc_C5A7:
cmp si, size scoredat_section_t - 1
jl short loc_C584
mov al, _hi.key1
add byte ptr _hi+0[si], al
xor cx, cx
mov si, scoredat_section_t.score
jmp short loc_C5C4
; ---------------------------------------------------------------------------
loc_C5BB:
mov al, byte ptr _hi+0[si]
mov ah, 0
add cx, ax
inc si
loc_C5C4:
cmp si, size scoredat_section_t
jl short loc_C5BB
cmp _hi.sum, cx
jz short loc_C5D4
mov al, 1
jmp short loc_C624
; ---------------------------------------------------------------------------
loc_C5D4:
mov si, scoredat_section_t.score
jmp short loc_C5FC
; ---------------------------------------------------------------------------
loc_C5D9:
mov al, byte ptr _hi2+1[si]
mov [bp+@@byte], al
mov al, _hi2.key2
ror [bp+@@byte], 3
xor [bp+@@byte], al
mov al, byte ptr _hi2+0[si]
mov dl, _hi2.key1
add dl, [bp+@@byte]
add al, dl
mov byte ptr _hi2+0[si], al
inc si
loc_C5FC:
cmp si, size scoredat_section_t - 1
jl short loc_C5D9
mov al, _hi2.key1
add byte ptr _hi2+0[si], al
xor cx, cx
mov si, scoredat_section_t.score
jmp short loc_C619
; ---------------------------------------------------------------------------
loc_C610:
mov al, byte ptr _hi2+0[si]
mov ah, 0
add cx, ax
inc si
loc_C619:
cmp si, size scoredat_section_t
jl short loc_C610
mov al, byte ptr _hi2.sum
sub al, cl
loc_C624:
pop si
leave
retn
sub_C57A endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_C627 proc near
@@byte = byte ptr -1
enter 2, 0
push si
mov _hi.sum, 0
mov si, scoredat_section_t.score
jmp short loc_C642
; ---------------------------------------------------------------------------
loc_C637:
mov al, byte ptr _hi[si]
mov ah, 0
add _hi.sum, ax
inc si
loc_C642:
cmp si, size scoredat_section_t
jl short loc_C637
call IRand
mov _hi.key1, al
call IRand
mov _hi.key2, al
mov [bp+@@byte], 0
mov si, size scoredat_section_t - 1
jmp short loc_C684
; ---------------------------------------------------------------------------
loc_C661:
mov al, byte ptr _hi[si]
mov dl, _hi.key1
add dl, [bp+@@byte]
sub al, dl
mov byte ptr _hi[si], al
mov al, byte ptr _hi[si]
mov [bp+@@byte], al
mov al, _hi.key2
ror [bp+@@byte], 3
xor [bp+@@byte], al
dec si
loc_C684:
cmp si, scoredat_section_t.score
jge short loc_C661
pop si
leave
retn
sub_C627 endp
; =============== S U B R O U T I N E ========================================
; Attributes: bp-based frame
sub_C68C proc near
@@digit = byte ptr -1
enter 2, 0
push si
push di
mov [bp+@@digit], gb_9_
xor si, si
jmp short loc_C700
; ---------------------------------------------------------------------------
loc_C69A:
mov _hi.score.cleared, SCOREDAT_NOT_CLEARED
xor di, di
jmp short loc_C6AE
; ---------------------------------------------------------------------------
loc_C6A3:
mov bx, si
shl bx, 3
mov _hi.score.g_points[bx+di], gb_0_
inc di
loc_C6AE:
cmp di, SCORE_DIGITS
jl short loc_C6A3
or si, si
jnz short loc_C6C3
mov bx, si
shl bx, 3
mov _hi.score.g_points[bx][5], gb_1_
jmp short loc_C6D2
; ---------------------------------------------------------------------------
loc_C6C3:
mov bx, si
shl bx, 3
mov al, [bp+@@digit]
mov _hi.score.g_points[bx][4], al
dec [bp+@@digit]
loc_C6D2:
mov ax, si
cwd
sub ax, dx
sar ax, 1
mov dl, gb_5_
sub dl, al
mov _hi.score.g_stage[si], dl
xor di, di
jmp short loc_C6F0
; ---------------------------------------------------------------------------
loc_C6E5:
mov bx, si
imul bx, (SCOREDAT_NAME_LEN + 1)
mov _hi.score.g_name[bx+di], gs_DOT
inc di
loc_C6F0:
cmp di, SCOREDAT_NAME_LEN
jl short loc_C6E5
mov bx, si
imul bx, (SCOREDAT_NAME_LEN + 1)
mov _hi.score.g_name[bx] + SCOREDAT_NAME_LEN, 0
inc si
loc_C700:
cmp si, SCOREDAT_PLACES
jl short loc_C69A
push ds
push offset aGensou_scr ; "GENSOU.SCR"
call file_create
xor si, si
jmp short loc_C725
; ---------------------------------------------------------------------------
loc_C712:
call sub_C627
call file_write pascal, ds, offset _hi, size scoredat_section_t
call sub_C57A
inc si
loc_C725:
cmp si, RANK_COUNT * PLAYCHAR_COUNT
jl short loc_C712
call file_close
pop di
pop si
leave
retn
sub_C68C endp
include th04/formats/scoredat_decode_both.asm
include th04/formats/scoredat_encode.asm
include th04/formats/scoredat_recreate.asm
; =============== S U B R O U T I N E =======================================
@ -2720,12 +2470,12 @@ scoredat_load proc near
call file_seek pascal, large (RANK_COUNT - 1) * size scoredat_section_t, 1
call file_read pascal, ds, offset _hi2, size scoredat_section_t
call file_close
call sub_C57A
call scoredat_decode_func
or al, al
jz short loc_C79A
loc_C793:
call sub_C68C
call scoredat_recreate
mov al, 1
pop bp
retn

View File

@ -0,0 +1,89 @@
public SCOREDAT_RECREATE_MAINE
scoredat_recreate_maine proc near
@@digit = byte ptr -3
@@i = word ptr -2
enter 4, 0
push si
mov [bp+@@digit], gb_8_
mov [bp+@@i], 0
jmp short @@places_more?
; ---------------------------------------------------------------------------
@@place_loop:
mov _hi.score.cleared, SCOREDAT_NOT_CLEARED
xor si, si
jmp short @@digit_zero_more?
; ---------------------------------------------------------------------------
@@digit_zero_loop:
mov bx, [bp+@@i]
shl bx, 3
mov _hi.score.g_points[bx+si], gb_0_
inc si
@@digit_zero_more?:
cmp si, SCORE_DIGITS
jl short @@digit_zero_loop
cmp [bp+@@i], 0
jnz short @@not_first_place
mov bx, [bp+@@i]
shl bx, 3
mov _hi.score.g_points[bx][6], gb_1_
jmp short @@set_stage
; ---------------------------------------------------------------------------
@@not_first_place:
mov bx, [bp+@@i]
shl bx, 3
mov al, [bp+@@digit]
mov _hi.score.g_points[bx][5], al
add al, -2
mov [bp+@@digit], al
@@set_stage:
mov bx, [bp+@@i]
mov al, gb_6_
sub al, byte ptr [bp+@@i]
mov _hi.score.g_stage[bx], al
xor si, si
jmp short @@name_more?
; ---------------------------------------------------------------------------
@@name_loop:
mov bx, [bp+@@i]
imul bx, (SCOREDAT_NAME_LEN + 1)
mov _hi.score.g_name[bx+si], gs_DOT
inc si
@@name_more?:
cmp si, SCOREDAT_NAME_LEN
jl short @@name_loop
mov bx, [bp+@@i]
imul bx, (SCOREDAT_NAME_LEN + 1)
mov _hi.score.g_name[bx][SCOREDAT_NAME_LEN], 0
inc [bp+@@i]
@@places_more?:
cmp [bp+@@i], SCOREDAT_PLACES
jl short @@place_loop
call file_create pascal, ds, offset aGensou_scr ; "GENSOU.SCR"
mov [bp+@@i], 0
jmp short @@sections_more?
; ---------------------------------------------------------------------------
@@section_loop:
call scoredat_encode
call file_write pascal, ds, offset _hi, size scoredat_section_t
call scoredat_decode
inc [bp+@@i]
@@sections_more?:
cmp [bp+@@i], RANK_COUNT * PLAYCHAR_COUNT
jl short @@section_loop
call file_close
pop si
leave
retn
scoredat_recreate_maine endp

View File

@ -0,0 +1,115 @@
public SCOREDAT_RECREATE_OP
scoredat_recreate_op proc near
@@digit = byte ptr -3
@@i = word ptr -2
enter 4, 0
push si
mov [bp+@@digit], gb_8_
xor si, si
jmp short @@places_more?
; ---------------------------------------------------------------------------
@@place_loop:
mov _hi.score.cleared, SCOREDAT_NOT_CLEARED
mov [bp+@@i], 0
jmp short @@digit_zero_more?
; ---------------------------------------------------------------------------
@@digit_zero_loop:
mov bx, si
shl bx, 3
add bx, [bp+@@i]
mov _hi.score.g_points[bx], gb_0_
inc [bp+@@i]
@@digit_zero_more?:
cmp [bp+@@i], SCORE_DIGITS
jl short @@digit_zero_loop
or si, si
jnz short @@not_first_place
mov bx, si
shl bx, 3
mov _hi.score.g_points[bx][6], gb_1_
jmp short @@set_name
; ---------------------------------------------------------------------------
@@not_first_place:
mov bx, si
shl bx, 3
mov al, [bp+@@digit]
mov _hi.score.g_points[bx][5], al
add al, -2
mov [bp+@@digit], al
@@set_name:
mov [bp+@@i], 0
jmp short @@name_more?
; ---------------------------------------------------------------------------
@@name_loop:
mov bx, si
imul bx, (SCOREDAT_NAME_LEN + 1)
add bx, [bp+@@i]
mov _hi.score.g_name[bx], gs_DOT
inc [bp+@@i]
@@name_more?:
cmp [bp+@@i], SCOREDAT_NAME_LEN
jl short @@name_loop
mov bx, si
imul bx, (SCOREDAT_NAME_LEN + 1)
mov _hi.score.g_name[bx][SCOREDAT_NAME_LEN], 0
inc si
@@places_more?:
cmp si, SCOREDAT_PLACES
jl short @@place_loop
call file_create pascal, ds, offset aGensou_scr ; "GENSOU.SCR"
xor si, si
jmp short @@sections_more?
; ---------------------------------------------------------------------------
@@section_loop:
mov [bp+@@i], 0
jmp short @@stage_more?
; ---------------------------------------------------------------------------
@@stage_loop:
mov ax, si
mov bx, RANK_COUNT
cwd
idiv bx
cmp dx, RANK_EXTRA
jnz short @@not_extra_section
mov bx, [bp+@@i]
mov _hi.score.g_stage[bx], gb_1_
jmp short @@stage_next
; ---------------------------------------------------------------------------
@@not_extra_section:
mov bx, [bp+@@i]
mov al, gb_6_
sub al, byte ptr [bp+@@i]
mov _hi.score.g_stage[bx], al
@@stage_next:
inc [bp+@@i]
@@stage_more?:
cmp [bp+@@i], SCOREDAT_PLACES
jl short @@stage_loop
call scoredat_encode
call file_write pascal, ds, offset _hi, size scoredat_section_t
call scoredat_decode_func
inc si
@@sections_more?:
cmp si, RANK_COUNT * PLAYCHAR_COUNT
jl short @@section_loop
call file_close
pop si
leave
retn
scoredat_recreate_op endp

View File

@ -6559,80 +6559,7 @@ sub_E708 endp
include th04/playperf.asm
include th05/select_for_playchar.asm
include th04/select_for_rank.asm
; =============== S U B R O U T I N E =======================================
sub_E76C proc near
push si
mov bx, offset _hi
mov si, bx
mov cx, size scoredat_t - 1
mov dx, [bx]
add bx, scoredat_section_t.score
loc_E77A:
mov al, [bx+1]
ror al, 3
xor al, dh
add al, dl
add [bx], al
inc bx
loop loc_E77A
add [bx], dl
mov cx, size scoredat_t
xor bx, bx
xor dx, dx
mov ax, [si+scoredat_section_t.sum]
add si, scoredat_section_t.score
loc_E798:
mov bl, [si]
add dx, bx
inc si
loop loc_E798
sub ax, dx
pop si
retn
sub_E76C endp
; =============== S U B R O U T I N E =======================================
sub_E7A3 proc near
push si
mov bx, offset _hi
mov si, bx
xor dx, dx
xor ax, ax
add bx, scoredat_section_t.score
mov cx, size scoredat_t
loc_E7B3:
mov dl, [bx]
add ax, dx
inc bx
loop loc_E7B3
mov [si+scoredat_section_t.sum], ax
call IRand
mov word ptr [si+scoredat_section_t.key1], ax
xor dx, dx
add si, size scoredat_section_t - 1
mov cx, size scoredat_t
loc_E7CC:
add dl, al
sub [si], dl
mov dl, [si]
ror dl, 3
xor dl, ah
dec si
loop loc_E7CC
pop si
retn
sub_E7A3 endp
include th04/formats/scoredat_code_asm.asm
; =============== S U B R O U T I N E =======================================
@ -6669,7 +6596,7 @@ loc_E7E7:
mov ah, 3Eh
int 21h ; DOS - 2+ - CLOSE A FILE WITH HANDLE
; BX = file handle
call sub_E76C
call scoredat_decode
retn
sub_E7DC endp
@ -6678,7 +6605,7 @@ sub_E7DC endp
sub_E813 proc near
call sub_E7A3
call scoredat_encode
mov ax, 3D02h
mov dx, offset aGENSOU_SCR
int 21h ; DOS - 2+ - OPEN DISK FILE WITH HANDLE
@ -6704,7 +6631,7 @@ sub_E813 proc near
mov ah, 3Eh
int 21h ; DOS - 2+ - CLOSE A FILE WITH HANDLE
; BX = file handle
call sub_E76C
call scoredat_decode
retn
sub_E813 endp

View File

@ -1949,211 +1949,9 @@ loc_B4B5:
retn
sub_B3CB endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_B4D6 proc near
@@byte = byte ptr -1
enter 2, 0
push si
mov si, scoredat_section_t.score
jmp short loc_B503
; ---------------------------------------------------------------------------
loc_B4E0:
mov al, byte ptr _hi+1[si]
mov [bp+@@byte], al
mov al, _hi.key2
ror [bp+@@byte], 3
xor [bp+@@byte], al
mov al, byte ptr _hi+0[si]
mov dl, _hi.key1
add dl, [bp+@@byte]
add al, dl
mov byte ptr _hi+0[si], al
inc si
loc_B503:
cmp si, size scoredat_section_t - 1
jl short loc_B4E0
mov al, _hi.key1
add byte ptr _hi+0[si], al
xor cx, cx
mov si, 4
jmp short loc_B51F
; ---------------------------------------------------------------------------
loc_B516:
mov al, byte ptr _hi+0[si]
mov ah, 0
add cx, ax
inc si
loc_B51F:
cmp si, size scoredat_section_t
jl short loc_B516
mov al, byte ptr _hi.sum
sub al, cl
pop si
leave
retn
sub_B4D6 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_B52C proc near
@@byte = byte ptr -1
enter 2, 0
push si
mov _hi.sum, 0
mov si, scoredat_section_t.score
jmp short loc_B547
; ---------------------------------------------------------------------------
loc_B53C:
mov al, byte ptr _hi[si]
mov ah, 0
add _hi.sum, ax
inc si
loc_B547:
cmp si, size scoredat_section_t
jl short loc_B53C
call IRand
mov _hi.key1, al
call IRand
mov _hi.key2, al
mov [bp+@@byte], 0
mov si, size scoredat_section_t - 1
jmp short loc_B588
; ---------------------------------------------------------------------------
loc_B565:
mov al, byte ptr _hi[si]
mov dl, _hi.key1
add dl, [bp+@@byte]
sub al, dl
mov byte ptr _hi[si], al
mov al, byte ptr _hi[si]
mov [bp+@@byte], al
mov al, _hi.key2
ror [bp+@@byte], 3
xor [bp+@@byte], al
dec si
loc_B588:
cmp si, scoredat_section_t.score
jge short loc_B565
pop si
leave
retn
sub_B52C endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_B590 proc near
@@digit = byte ptr -3
@@i = word ptr -2
enter 4, 0
push si
mov [bp+@@digit], gb_8_
mov [bp+@@i], 0
jmp short loc_B60E
; ---------------------------------------------------------------------------
loc_B5A0:
mov _hi.score.cleared, SCOREDAT_NOT_CLEARED
xor si, si
jmp short loc_B5B5
; ---------------------------------------------------------------------------
loc_B5A9:
mov bx, [bp+@@i]
shl bx, 3
mov _hi.score.g_points[bx+si], gb_0_
inc si
loc_B5B5:
cmp si, SCORE_DIGITS
jl short loc_B5A9
cmp [bp+@@i], 0
jnz short loc_B5CD
mov bx, [bp+@@i]
shl bx, 3
mov _hi.score.g_points[bx][6], gb_1_
jmp short loc_B5DF
; ---------------------------------------------------------------------------
loc_B5CD:
mov bx, [bp+@@i]
shl bx, 3
mov al, [bp+@@digit]
mov _hi.score.g_points[bx][5], al
add al, -2
mov [bp+@@digit], al
loc_B5DF:
mov bx, [bp+@@i]
mov al, gb_6_
sub al, byte ptr [bp+@@i]
mov _hi.score.g_stage[bx], al
xor si, si
jmp short loc_B5FB
; ---------------------------------------------------------------------------
loc_B5EF:
mov bx, [bp+@@i]
imul bx, (SCOREDAT_NAME_LEN + 1)
mov _hi.score.g_name[bx+si], gs_DOT
inc si
loc_B5FB:
cmp si, SCOREDAT_NAME_LEN
jl short loc_B5EF
mov bx, [bp+@@i]
imul bx, (SCOREDAT_NAME_LEN + 1)
mov _hi.score.g_name[bx][SCOREDAT_NAME_LEN], 0
inc [bp+@@i]
loc_B60E:
cmp [bp+@@i], SCOREDAT_PLACES
jl short loc_B5A0
push ds
push offset aGensou_scr ; "GENSOU.SCR"
call file_create
mov [bp+@@i], 0
jmp short loc_B638
; ---------------------------------------------------------------------------
loc_B624:
call sub_B52C
call file_write pascal, ds, offset _hi, size scoredat_section_t
call sub_B4D6
inc [bp+@@i]
loc_B638:
cmp [bp+@@i], RANK_COUNT * PLAYCHAR_COUNT
jl short loc_B624
call file_close
pop si
leave
retn
sub_B590 endp
include th04/formats/scoredat_decode.asm
include th04/formats/scoredat_encode.asm
include th05/formats/scoredat_recreate_maine.asm
; =============== S U B R O U T I N E =======================================
@ -2185,12 +1983,12 @@ arg_0 = word ptr 4
call file_seek
call file_read pascal, ds, offset _hi, size scoredat_section_t
call file_close
call sub_B4D6
call scoredat_decode
or al, al
jz short loc_B69D
loc_B694:
call sub_B590
call scoredat_recreate_maine
mov al, 1
pop bp
retn 2
@ -2211,7 +2009,7 @@ sub_B6A3 proc near
push bp
mov bp, sp
push si
call sub_B52C
call scoredat_encode
push ds
push offset aGensou_scr_2 ; "GENSOU.SCR"
call file_append
@ -2239,8 +2037,8 @@ loc_B6E2:
push 0
call file_seek
call file_read pascal, ds, offset _hi, size scoredat_section_t
call sub_B4D6
call sub_B52C
call scoredat_decode
call scoredat_encode
mov ax, si
imul ax, size scoredat_section_t
movzx eax, ax
@ -2251,7 +2049,7 @@ loc_B6E2:
inc si
loc_B723:
cmp si, 14h
cmp si, RANK_COUNT * PLAYCHAR_COUNT
jl short loc_B6E2
call file_close
pop si

View File

@ -2947,282 +2947,9 @@ loc_C790:
retn
musicroom endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_C7D5 proc near
@@byte = byte ptr -1
enter 2, 0
push si
mov si, scoredat_section_t.score
jmp short loc_C802
; ---------------------------------------------------------------------------
loc_C7DF:
mov al, byte ptr _hi+1[si]
mov [bp+@@byte], al
mov al, _hi.key2
ror [bp+@@byte], 3
xor [bp+@@byte], al
mov al, byte ptr _hi+0[si]
mov dl, _hi.key1
add dl, [bp+@@byte]
add al, dl
mov byte ptr _hi+0[si], al
inc si
loc_C802:
cmp si, size scoredat_section_t - 1
jl short loc_C7DF
mov al, _hi.key1
add byte ptr _hi+0[si], al
xor cx, cx
mov si, scoredat_section_t.score
jmp short loc_C81E
; ---------------------------------------------------------------------------
loc_C815:
mov al, byte ptr _hi+0[si]
mov ah, 0
add cx, ax
inc si
loc_C81E:
cmp si, size scoredat_section_t
jl short loc_C815
cmp _hi.sum, cx
jz short loc_C82D
mov al, 1
jmp short loc_C87B
; ---------------------------------------------------------------------------
loc_C82D:
mov si, scoredat_section_t.score
jmp short loc_C855
; ---------------------------------------------------------------------------
loc_C832:
mov al, byte ptr _hi2+1[si]
mov [bp+@@byte], al
mov al, _hi2.key2
ror [bp+@@byte], 3
xor [bp+@@byte], al
mov al, byte ptr _hi2+0[si]
mov dl, _hi2.key1
add dl, [bp+@@byte]
add al, dl
mov byte ptr _hi2+0[si], al
inc si
loc_C855:
cmp si, size scoredat_section_t - 1
jl short loc_C832
mov al, _hi2.key1
add byte ptr _hi2+0[si], al
xor cx, cx
mov si, scoredat_section_t.score
jmp short loc_C871
; ---------------------------------------------------------------------------
loc_C868:
mov al, byte ptr _hi2+0[si]
mov ah, 0
add cx, ax
inc si
loc_C871:
cmp si, size scoredat_section_t
jl short loc_C868
mov al, byte ptr _hi2.sum
sub al, cl
loc_C87B:
pop si
leave
retn
sub_C7D5 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_C87E proc near
@@byte = byte ptr -1
enter 2, 0
push si
mov _hi.sum, 0
mov si, scoredat_section_t.score
jmp short loc_C899
; ---------------------------------------------------------------------------
loc_C88E:
mov al, byte ptr _hi[si]
mov ah, 0
add _hi.sum, ax
inc si
loc_C899:
cmp si, size scoredat_section_t
jl short loc_C88E
call IRand
mov _hi.key1, al
call IRand
mov _hi.key2, al
mov [bp+@@byte], 0
mov si, size scoredat_section_t - 1
jmp short loc_C8DA
; ---------------------------------------------------------------------------
loc_C8B7:
mov al, byte ptr _hi[si]
mov dl, _hi.key1
add dl, [bp+@@byte]
sub al, dl
mov byte ptr _hi[si], al
mov al, byte ptr _hi[si]
mov [bp+@@byte], al
mov al, _hi.key2
ror [bp+@@byte], 3
xor [bp+@@byte], al
dec si
loc_C8DA:
cmp si, scoredat_section_t.score
jge short loc_C8B7
pop si
leave
retn
sub_C87E endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_C8E2 proc near
@@digit = byte ptr -3
@@i = word ptr -2
enter 4, 0
push si
mov [bp+@@digit], gb_8_
xor si, si
jmp short loc_C95A
; ---------------------------------------------------------------------------
loc_C8EF:
mov _hi.score.cleared, SCOREDAT_NOT_CLEARED
mov [bp+@@i], 0
jmp short loc_C90B
; ---------------------------------------------------------------------------
loc_C8FB:
mov bx, si
shl bx, 3
add bx, [bp+@@i]
mov _hi.score.g_points[bx], gb_0_
inc [bp+@@i]
loc_C90B:
cmp [bp+@@i], SCORE_DIGITS
jl short loc_C8FB
or si, si
jnz short loc_C921
mov bx, si
shl bx, 3
mov _hi.score.g_points[bx][6], gb_1_
jmp short loc_C932
; ---------------------------------------------------------------------------
loc_C921:
mov bx, si
shl bx, 3
mov al, [bp+@@digit]
mov _hi.score.g_points[bx][5], al
add al, -2
mov [bp+@@digit], al
loc_C932:
mov [bp+@@i], 0
jmp short loc_C949
; ---------------------------------------------------------------------------
loc_C939:
mov bx, si
imul bx, (SCOREDAT_NAME_LEN + 1)
add bx, [bp+@@i]
mov _hi.score.g_name[bx], gs_DOT
inc [bp+@@i]
loc_C949:
cmp [bp+@@i], SCOREDAT_NAME_LEN
jl short loc_C939
mov bx, si
imul bx, (SCOREDAT_NAME_LEN + 1)
mov _hi.score.g_name[bx][SCOREDAT_NAME_LEN], 0
inc si
loc_C95A:
cmp si, SCOREDAT_PLACES
jl short loc_C8EF
push ds
push offset aGensou_scr ; "GENSOU.SCR"
call file_create
xor si, si
jmp short loc_C9B1
; ---------------------------------------------------------------------------
loc_C96C:
mov [bp+@@i], 0
jmp short loc_C999
; ---------------------------------------------------------------------------
loc_C973:
mov ax, si
mov bx, 5
cwd
idiv bx
cmp dx, 4
jnz short loc_C98A
mov bx, [bp+@@i]
mov _hi.score.g_stage[bx], gb_1_
jmp short loc_C996
; ---------------------------------------------------------------------------
loc_C98A:
mov bx, [bp+@@i]
mov al, gb_6_
sub al, byte ptr [bp+@@i]
mov _hi.score.g_stage[bx], al
loc_C996:
inc [bp+@@i]
loc_C999:
cmp [bp+@@i], SCOREDAT_PLACES
jl short loc_C973
call sub_C87E
call file_write pascal, ds, offset _hi, size scoredat_section_t
call sub_C7D5
inc si
loc_C9B1:
cmp si, RANK_COUNT * PLAYCHAR_COUNT
jl short loc_C96C
call file_close
pop si
leave
retn
sub_C8E2 endp
include th04/formats/scoredat_decode_both.asm
include th04/formats/scoredat_encode.asm
include th05/formats/scoredat_recreate_op.asm
; =============== S U B R O U T I N E =======================================
@ -3252,12 +2979,12 @@ arg_0 = word ptr 4
call file_seek pascal, large eax, 0
call file_read pascal, ds, offset _hi, size scoredat_section_t
call file_close
call sub_C7D5
call scoredat_decode_func
or al, al
jz short loc_CA15
loc_CA0C:
call sub_C8E2
call scoredat_recreate_op
mov al, 1
pop bp
retn 2