diff --git a/libs/master.lib/bfnt_entry_pat.asm b/libs/master.lib/bfnt_entry_pat.asm index 9e24fba9..6558d63c 100644 --- a/libs/master.lib/bfnt_entry_pat.asm +++ b/libs/master.lib/bfnt_entry_pat.asm @@ -121,8 +121,12 @@ func BFNT_ENTRY_PAT ; bfnt_entry_pat() { mov AH,3fh int 21h ;read handle +if LDATA jnb @@NEXT_PATTERN_1 jmp BFTENTRY_INVAL +else + jb BFTENTRY_INVAL +endif @@NEXT_PATTERN_1: cmp AX,CX jz @@NEXT_PATTERN_2 diff --git a/th01_zunsoft.asm b/th01_zunsoft.asm index cd2c01db..89a4326b 100644 --- a/th01_zunsoft.asm +++ b/th01_zunsoft.asm @@ -852,282 +852,8 @@ sub_ACE proc near sub_ACE endp include libs/master.lib/bfnt_header_read.asm -; START OF FUNCTION CHUNK FOR sub_B2E - -loc_B1A: - push ds - mov ds, word ptr cs:loc_BFF+1 - call sub_1162 - mov ax, 0FFF3h - -loc_B26: - pop si - pop di - pop ds - pop bp - retn 6 -; END OF FUNCTION CHUNK FOR sub_B2E -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_B2E proc near - -arg_0 = word ptr 4 -arg_2 = word ptr 6 -arg_4 = word ptr 8 - -; FUNCTION CHUNK AT 0B1A SIZE 00000013 BYTES - - push bp - mov bp, sp - push ds - push si - push di - mov ax, [bp+arg_0] - mov word ptr cs:loc_C0D+1, ax - mov word ptr cs:loc_BFF+1, ds - mov ax, [bp+arg_4] - mov word ptr cs:loc_B90+1, ax - mov bx, [bp+arg_2] - mov ax, [bx+8] - mov cx, [bx+0Ah] - mov bp, [bx+0Eh] - sub bp, [bx+0Ch] - inc bp - shr ax, 3 - mov byte ptr cs:loc_BA9+1, al - mov dh, al - mov dl, cl - mov word ptr cs:loc_C04+1, dx - mov byte ptr cs:loc_BA7+1, cl - mul cx - mov word ptr cs:loc_BA2+1, ax - shl ax, 2 - mov word ptr cs:loc_B8B+1, ax - xchg ax, bx - push bx - call sub_112C - jb short loc_B26 - xchg ax, cx - push bx - call sub_112C - jb short loc_B26 - mov es, ax - assume es:nothing - mov ds, cx - -loc_B8B: - mov cx, 1234h - xor dx, dx - -loc_B90: - mov bx, 1234h - mov ah, 3Fh - int 21h ; DOS - 2+ - READ FROM FILE WITH HANDLE - ; BX = file handle, CX = number of bytes to read - ; DS:DX -> buffer - jb short loc_B1A - cmp ax, cx - jz short loc_BA0 - jmp loc_B1A -; --------------------------------------------------------------------------- - -loc_BA0: - xor si, si - -loc_BA2: - mov dx, 1234h - xor bx, bx - -loc_BA7: - mov ch, 11h - -loc_BA9: - mov cl, 11h - -loc_BAB: - push cx - push dx - push bx - lodsw - mov bx, ax - lodsw - mov dx, ax - mov di, 4 - -loc_BB7: - rol bl, 1 - rcl ch, 1 - rol bl, 1 - rcl cl, 1 - rol bl, 1 - rcl ah, 1 - rol bl, 1 - rcl al, 1 - rol bl, 1 - rcl ch, 1 - rol bl, 1 - rcl cl, 1 - rol bl, 1 - rcl ah, 1 - rol bl, 1 - rcl al, 1 - mov bl, bh - mov bh, dl - mov dl, dh - dec di - jnz short loc_BB7 - pop bx - pop dx - mov es:[bx+di], al - add di, dx - mov es:[bx+di], ah - add di, dx - mov es:[bx+di], cl - add di, dx - mov es:[bx+di], ch - pop cx - inc bx - dec cl - jnz short loc_BAB - dec ch - jnz short loc_BA9 - push ds - -loc_BFF: - mov ax, 1234h - mov ds, ax - assume ds:nothing - -loc_C04: - mov ax, 1234h - push es - push ax - push es - xor ax, ax - push ax - -loc_C0D: - mov ax, 1234h - push ax - call super_entry_pat - pop es - pop ds - assume ds:seg000 - jb short loc_C1E - dec bp - jz short loc_C38 - jmp loc_B8B -; --------------------------------------------------------------------------- - -loc_C1E: - push ds - mov ds, word ptr cs:loc_BFF+1 - mov cx, ax - push es - call sub_1162 - call sub_1162 - mov ax, cx - stc - pop si - pop di - pop ds - pop bp - retn 6 -; --------------------------------------------------------------------------- - nop - -loc_C38: - push ds - mov ds, word ptr cs:loc_BFF+1 - push es - call sub_1162 - call sub_1162 - mov ax, 0 - clc - pop si - pop di - pop ds - pop bp - retn 6 -sub_B2E endp - - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_C50 proc near - -arg_0 = word ptr 4 -arg_2 = word ptr 6 - - push bp - mov bp, sp - push si - cld - mov bx, [bp+arg_0] - mov cx, [bx+1Ch] - mov si, [bx+1Eh] - mov ax, 0 - jcxz short loc_CA5 - push cx - call sub_112C - jb short loc_CA5 - push ds - mov ds, ax - xor dx, dx - mov bx, [bp+arg_2] - mov ah, 3Fh - int 21h ; DOS - 2+ - READ FROM FILE WITH HANDLE - ; BX = file handle, CX = number of bytes to read - ; DS:DX -> buffer - mov ax, 0FFF3h - jb short loc_C9E - mov dx, si - xor si, si - -loc_C7E: - lodsb - cmp al, 10h - jz short loc_C98 - add si, dx - sub si, 3 - lodsw - or ax, ax - jz short loc_C93 - sub cx, dx - mov dx, ax - ja short loc_C7E - -loc_C93: - xor ax, ax - jmp short loc_C9E -; --------------------------------------------------------------------------- - nop - -loc_C98: - lodsw - lodsb - and ax, 0Fh - nop - -loc_C9E: - mov bx, ds - pop ds - push bx - call sub_1162 - -loc_CA5: - pop si - pop bp - retn 4 -sub_C50 endp - +include libs/master.lib/bfnt_entry_pat.asm +include libs/master.lib/bfnt_header_analysis.asm include libs/master.lib/bfnt_palette_set.asm include libs/master.lib/dos_close.asm include libs/master.lib/dos_ropen.asm @@ -1171,7 +897,7 @@ arg_0 = word ptr 4 push cx push bx push cx - call sub_C50 + call bfnt_extend_header_analysis pop cx pop bx mov si, ax @@ -1193,7 +919,7 @@ loc_D66: push bx push cx push si - call sub_B2E + call bfnt_entry_pat pop bx jb short loc_D84 push bx @@ -1525,65 +1251,8 @@ loc_1112: retn sub_10E0 endp -; --------------------------------------------------------------------------- -; START OF FUNCTION CHUNK FOR sub_112C - -loc_1126: - call mem_assign_all - jb short loc_115B - nop -; END OF FUNCTION CHUNK FOR sub_112C - -; =============== S U B R O U T I N E ======================================= - - -sub_112C proc near - -; FUNCTION CHUNK AT 1126 SIZE 00000006 BYTES - - cmp mem_TopSeg, 0 - jz short loc_1126 - push bx - mov bx, sp - mov bx, ss:[bx+4] - add bx, 0Fh - rcr bx, 1 - shr bx, 1 - shr bx, 1 - shr bx, 1 - mov ax, ds:334Eh - add bx, ax - jb short loc_115A - cmp ds:334Ah, bx - jb short loc_115A - mov ds:334Eh, bx - pop bx - retn 2 -; --------------------------------------------------------------------------- - -loc_115A: - pop bx - -loc_115B: - mov ax, 0FFF8h - retn 2 -sub_112C endp ; sp-analysis failed - -; --------------------------------------------------------------------------- - nop - -; =============== S U B R O U T I N E ======================================= - - -sub_1162 proc near - push bx - mov bx, sp - mov bx, ss:[bx+4] - mov ds:334Eh, bx - pop bx - retn 2 -sub_1162 endp - +include libs/master.lib/smem_wget.asm +include libs/master.lib/smem_release.asm include libs/master.lib/memheap.asm include libs/master.lib/mem_assign.asm