diff --git a/libs/BorlandC/xclose.asm b/libs/BorlandC/xclose.asm new file mode 100644 index 00000000..7a841f15 --- /dev/null +++ b/libs/BorlandC/xclose.asm @@ -0,0 +1,28 @@ +; void _xclose(void) +__xclose proc DIST +@@i = word ptr -2 + + push bp + mov bp, sp + sub sp, 2 + push si + push di + mov [bp+@@i], 2 + jmp short @@check + +@@loop: + push [bp+@@i] + nopcall _close + pop cx + inc [bp+@@i] + +@@check: + mov ax, [bp+@@i] + cmp ax, __nfile + jb short @@loop + pop di + pop si + mov sp, bp + pop bp + ret +__xclose endp diff --git a/th01_fuuin.asm b/th01_fuuin.asm index 554ea5c8..076f0426 100644 --- a/th01_fuuin.asm +++ b/th01_fuuin.asm @@ -4141,42 +4141,7 @@ off_2C18 dw offset loc_2874 dw offset loc_2884 dw offset loc_288A -; =============== S U B R O U T I N E ======================================= - -; Attributes: library function bp-based frame - -__xclose proc far - -handle = word ptr -2 - - push bp - mov bp, sp - sub sp, 2 - push si - push di - mov [bp+handle], 2 - jmp short loc_2C63 -; --------------------------------------------------------------------------- - -loc_2C57: - push [bp+handle] ; handle - nop - push cs - call near ptr _close - pop cx - inc [bp+handle] - -loc_2C63: - mov ax, [bp+handle] - cmp ax, __nfile - jb short loc_2C57 - pop di - pop si - mov sp, bp - pop bp - retf -__xclose endp - +include libs/BorlandC/xclose.asm include libs/BorlandC/xxas.asm include libs/BorlandC/xxv.asm include libs/BorlandC/cputype.asm @@ -5504,8 +5469,8 @@ loc_4B46: loc_4B6B: cmp word ptr [bp-8], 0 jl short loc_4BAD - mov word ptr _exitopen+2, seg seg000 - mov word ptr _exitopen, 2C48h + mov word ptr _exitopen+2, seg __xclose + mov word ptr _exitopen, offset __xclose test byte ptr [bp+0Bh], 3 jz short loc_4B88 mov ax, 1000h diff --git a/th01_op.asm b/th01_op.asm index 079d7587..d62908f1 100644 --- a/th01_op.asm +++ b/th01_op.asm @@ -3843,42 +3843,7 @@ off_2C80 dw offset loc_28DC dw offset loc_28EC dw offset loc_28F2 -; =============== S U B R O U T I N E ======================================= - -; Attributes: library function bp-based frame - -__xclose proc far - -handle = word ptr -2 - - push bp - mov bp, sp - sub sp, 2 - push si - push di - mov [bp+handle], 2 - jmp short loc_2CCB -; --------------------------------------------------------------------------- - -loc_2CBF: - push [bp+handle] ; handle - nop - push cs - call near ptr _close - pop cx - inc [bp+handle] - -loc_2CCB: - mov ax, [bp+handle] - cmp ax, __nfile - jb short loc_2CBF - pop di - pop si - mov sp, bp - pop bp - retf -__xclose endp - +include libs/BorlandC/xclose.asm include libs/BorlandC/xxas.asm include libs/BorlandC/xxv.asm include libs/BorlandC/cputype.asm @@ -5175,8 +5140,8 @@ loc_4E28: loc_4E4D: cmp [bp+handle], 0 jl short loc_4E8F - mov word ptr _exitopen+2, seg seg000 - mov word ptr _exitopen, 2CB0h + mov word ptr _exitopen+2, seg __xclose + mov word ptr _exitopen, offset __xclose test byte ptr [bp+access+1], 3 jz short loc_4E6A mov ax, 1000h diff --git a/th01_reiiden.asm b/th01_reiiden.asm index c0a2bbc1..d302bc6c 100644 --- a/th01_reiiden.asm +++ b/th01_reiiden.asm @@ -7062,42 +7062,7 @@ off_3F03 dw offset loc_3B5F dw offset loc_3B6F dw offset loc_3B75 -; =============== S U B R O U T I N E ======================================= - -; Attributes: library function bp-based frame - -__xclose proc far - -handle = word ptr -2 - - push bp - mov bp, sp - sub sp, 2 - push si - push di - mov [bp+handle], 2 - jmp short loc_3F4E -; --------------------------------------------------------------------------- - -loc_3F42: - push [bp+handle] ; handle - nop - push cs - call near ptr _close - pop cx - inc [bp+handle] - -loc_3F4E: - mov ax, [bp+handle] - cmp ax, __nfile - jb short loc_3F42 - pop di - pop si - mov sp, bp - pop bp - retf -__xclose endp - +include libs/BorlandC/xclose.asm include libs/BorlandC/xxas.asm include libs/BorlandC/xxv.asm @@ -8555,8 +8520,8 @@ loc_619E: loc_61C3: cmp [bp+handle], 0 jl short loc_6205 - mov word ptr _exitopen+2, seg seg000 - mov word ptr _exitopen, 3F33h + mov word ptr _exitopen+2, seg __xclose + mov word ptr _exitopen, offset __xclose test byte ptr [bp+access+1], 3 jz short loc_61E0 mov ax, 1000h