From 6d422052cabfc07076f023cdd378884a6c87bad5 Mon Sep 17 00:00:00 2001 From: nmlgc Date: Sun, 2 Nov 2014 08:27:17 +0100 Subject: [PATCH] [Reduction] #570-573: realcvt --- libs/BorlandC/math/realcvt.asm | 312 +++++++++++++++++++++++ libs/BorlandC/math/realcvt[cvtseg].asm | 1 + libs/BorlandC/realcvt.asm | 8 + th01_fuuin.asm | 338 +----------------------- th01_op.asm | 339 +------------------------ th01_reiiden.asm | 337 +----------------------- 6 files changed, 333 insertions(+), 1002 deletions(-) create mode 100644 libs/BorlandC/math/realcvt.asm create mode 100644 libs/BorlandC/math/realcvt[cvtseg].asm create mode 100644 libs/BorlandC/realcvt.asm diff --git a/libs/BorlandC/math/realcvt.asm b/libs/BorlandC/math/realcvt.asm new file mode 100644 index 00000000..0c5fa66c --- /dev/null +++ b/libs/BorlandC/math/realcvt.asm @@ -0,0 +1,312 @@ + __turboCvt = 0 + public __turboCvt + +; void __near TrimTrailing(void) +TrimTrailing proc near + push bp + mov bp, sp + mov al, 5Fh + and al, dl + cmp al, 'G' + jnz short @@tt_trimPoint + +@@tt_trimLoop: + cmp byte ptr ES_[bx-1], '0' + jnz short @@tt_trimPoint + dec bx + cmp bx, cx + ja short @@tt_trimLoop + jmp short @@tt_trimmed + +@@tt_trimPoint: + cmp ES_[bx-1], ah + jnz short @@tt_trimmed + dec bx + +@@tt_trimmed: + pop bp + ret +TrimTrailing endp + +; void __pascal __near __realcvt(void *valueP, int ndec, char *strP, char formCh, char altFormat, int type) +___realcvt proc near +@@buf = byte ptr -(6 + __XCVTDIG__ + 4) +@@localeDot = byte ptr -5 +@@realcnt = word ptr -4 +@@sign = word ptr -2 +@@type = word ptr 4 +@@altFormat = byte ptr 6 +@@formCh = byte ptr 8 +@@strP = dword ptr 0Ah +@@ndec = word ptr 0Eh +@@valueP = dword ptr 10h + + push bp + mov bp, sp + sub sp, 6 + __XCVTDIG__ + 4 + push si + push di + LES_ bx, __localeconvention + mov al, ES_[bx] + mov [bp+@@localeDot], al + push es +ife LDATA + push ds + pop es +endif + mov ax, [bp+@@ndec] + cmp ax, __XCVTDIG__ + jbe short @@meaningful + mov ax, __XCVTDIG__ + mov [bp+@@ndec], ax + +@@meaningful: + mov [bp+@@realcnt], ax + mov dl, [bp+@@formCh] + and dl, 0DFh + cmp dl, 'F' + jnz short @@overallDigits + neg ax + jle short @@bounded + sub ax, ax + mov [bp+@@ndec], ax + jmp short @@bounded + +@@overallDigits: + or ax, ax + jg short @@bounded + mov ax, 1 + jmp short @@decimalsDecided + +@@bounded: + cmp dl, 'E' + jnz short @@decimalsDecided + inc ax + inc [bp+@@ndec] + +@@decimalsDecided: +if LDATA + push word ptr [bp+@@valueP+2] +endif + push word ptr [bp+@@valueP] + push ax + pushSS_ + lea bx, [bp+@@sign] + push bx + pushSS_ + lea si, [bp+@@buf] + push si + mov ax, [bp+@@type] + push ax + call ___xcvt + xchg ax, bx + LES_ di, [bp+@@strP] + cld + cmp bx, INF_number + jz short @@infinities + cmp bx, NAN_number + jz short @@NANs + jmp short @@regular_number + +@@infinities: + mov ax, 492Bh + cmp [bp+@@sign], 0 + jz short @@store_Isign + inc ax + inc ax + +@@store_Isign: + stosw + mov ax, 464Eh + stosw + jmp @@end + +@@NANs: + mov ax, 4E2Bh + cmp [bp+@@sign], 0 + jz short @@store_Nsign + inc ax + inc ax + +@@store_Nsign: + stosw + mov al, 'A' + stosw + jmp @@end + +@@regular_number: + cmp byte ptr [bp+@@sign], 0 + jz short @@signSet + mov al, '-' + stosb + +@@signSet: + mov dl, [bp+@@formCh] + and dl, 5Fh + cmp dl, 'F' + jz short @@F_format + cmp dl, 'E' + jz short @@E_format + cmp bx, -3 + jl short @@E_format + mov ax, [bp+@@ndec] + or ax, ax + jnz short @@NotZero + inc ax + +@@NotZero: + cmp bx, ax + jg short @@E_format + +@@F_format: + cmp bx, __XCVTDIG__ + jg short @@E_format + or bx, bx + jg short @@FdigitStart + mov ah, [bp+@@localeDot] + mov al, '0' + stosw + mov cx, 1 + jz short @@Fdigits + mov al, '0' + +@@FleadZeroes: + stosb + inc bx + jnz short @@FleadZeroes + +@@FdigitStart: + mov cx, 0 + +@@Fdigits: + lods byte ptr SS_[si] + or al, al + jz short @@Fend + stosb + dec bx + jnz short @@Fdigits + mov al, [bp+@@localeDot] + stosb + inc cx + jmp short @@Fdigits + +@@Fend: + mov ax, [bp+@@ndec] + add cx, [bp+@@realcnt] + cmp ax, cx + jbe short @@no_zero_pad + sub ax, cx + mov cx, ax + add bx, ax + mov al, '0' + rep stosb + dec bx + jz short @@Fz + +@@no_zero_pad: + dec bx + jz short @@Fz + cmp [bp+@@altFormat], 0 + jnz short @@Fz + mov dl, [bp+@@formCh] + mov cx, word ptr [bp+@@strP] + xchg bx, di + mov ah, [bp+@@localeDot] + call TrimTrailing + xchg di, bx + +@@Fz: + cmp di, word ptr [bp+@@strP] + jnz short @@goto_end + mov al, '0' + stosb + +@@goto_end: + jmp short @@end + +@@E_format: + lods word ptr SS_[si] + stosb + mov al, [bp+@@localeDot] + or ah, ah + jnz short @@Edecimal + cmp [bp+@@altFormat], 0 + jz short @@Eexp + stosb + jmp short @@Eexp + +@@Edecimal: + stosb + mov al, ah + +@@Edigits: + stosb + lods byte ptr SS_[si] + or al, al + jnz short @@Edigits + cmp [bp+@@altFormat], 0 + jnz short @@Eexp + mov dl, [bp+@@formCh] + mov cx, word ptr [bp+@@strP] + xchg bx, di + mov ah, [bp+@@localeDot] + call TrimTrailing + xchg di, bx + +@@Eexp: + mov al, 20h + and al, [bp+@@formCh] + or al, 'E' + stosb + mov ax, '-+' + dec bx + jge short @@EexpSigned + xchg al, ah + neg bx + +@@EexpSigned: + stosb + xchg ax, bx + mov cx, '00' + cmp ax, 99 + jbe short @@EtwoDigits + cmp ax, 999 + jbe short @@EthreeDigits + cwd + mov bx, 1000 + div bx + add al, cl + stosb + xchg ax, dx + +@@EthreeDigits: + mov bl, 100 + div bl + add al, cl + stosb + xchg al, ah + cbw + +@@EtwoDigits: + mov bl, 10 + div bl + add ax, cx + stosw + +@@end: + xor al, al + stosb + pop es + pop di + pop si + mov sp, bp + pop bp + ret 10h +___realcvt endp + +turboCvt proc near + push bp + mov bp, sp + pop bp + ret +turboCvt endp diff --git a/libs/BorlandC/math/realcvt[cvtseg].asm b/libs/BorlandC/math/realcvt[cvtseg].asm new file mode 100644 index 00000000..da8128ad --- /dev/null +++ b/libs/BorlandC/math/realcvt[cvtseg].asm @@ -0,0 +1 @@ +__RealCvtVector dw offset ___realcvt diff --git a/libs/BorlandC/realcvt.asm b/libs/BorlandC/realcvt.asm new file mode 100644 index 00000000..75bdd45a --- /dev/null +++ b/libs/BorlandC/realcvt.asm @@ -0,0 +1,8 @@ +__realcvt proc near +ifdef __HUGE__ + mov es, cs:DGROUP@@ + jmp es:[__RealCvtVector] +else + jmp [__RealCvtVector] +endif +__realcvt endp diff --git a/th01_fuuin.asm b/th01_fuuin.asm index 59b16c8a..7a0cede4 100644 --- a/th01_fuuin.asm +++ b/th01_fuuin.asm @@ -1804,329 +1804,7 @@ include libs/master.lib/gdc_outpw.asm db 0 include libs/master.lib/random.asm include libs/BorlandC/emu/nec_fpinit.asm - -; =============== S U B R O U T I N E ======================================= - -; BCC v4.x/5.x DOS runtime -; Attributes: library function bp-based frame - -unknown_libname_1 proc near - push bp - mov bp, sp - mov al, 5Fh ; '_' - and al, dl - cmp al, 47h ; 'G' - jnz short loc_1615 - -loc_1607: - cmp byte ptr es:[bx-1], 30h ; '0' - jnz short loc_1615 - dec bx - cmp bx, cx - ja short loc_1607 - jmp short loc_161C -; --------------------------------------------------------------------------- - -loc_1615: - cmp es:[bx-1], ah - jnz short loc_161C - dec bx - -loc_161C: - pop bp - retn -unknown_libname_1 endp - - -; =============== S U B R O U T I N E ======================================= - -; Attributes: library function bp-based frame - -sub_161E proc near - -var_32 = byte ptr -32h -var_5 = byte ptr -5 -var_4 = word ptr -4 -var_2 = word ptr -2 -arg_0 = word ptr 4 -arg_2 = byte ptr 6 -arg_4 = byte ptr 8 -arg_6 = dword ptr 0Ah -arg_A = word ptr 0Eh -arg_C = word ptr 10h -arg_E = word ptr 12h - - push bp - mov bp, sp - sub sp, 32h - push si - push di - les bx, __localeconvention - mov al, es:[bx] - mov [bp+var_5], al - push es - mov ax, [bp+arg_A] - cmp ax, 28h ; '(' - jbe short loc_163F - mov ax, 28h ; '(' - mov [bp+arg_A], ax - -loc_163F: - mov [bp+var_4], ax - mov dl, [bp+arg_4] - and dl, 0DFh - cmp dl, 46h ; 'F' - jnz short loc_1658 - neg ax - jle short loc_1661 - sub ax, ax - mov [bp+arg_A], ax - jmp short loc_1661 -; --------------------------------------------------------------------------- - -loc_1658: - or ax, ax - jg short loc_1661 - mov ax, 1 - jmp short loc_166A -; --------------------------------------------------------------------------- - -loc_1661: - cmp dl, 45h ; 'E' - jnz short loc_166A - inc ax - inc [bp+arg_A] - -loc_166A: - push [bp+arg_E] - push [bp+arg_C] - push ax - push ss - lea bx, [bp+var_2] - push bx - push ss - lea si, [bp+var_32] - push si - mov ax, [bp+arg_0] - push ax - call ___xcvt - xchg ax, bx - les di, [bp+arg_6] - cld - cmp bx, 7FFFh - jz short loc_1695 - cmp bx, 7FFEh - jz short loc_16A8 - jmp short loc_16BA -; --------------------------------------------------------------------------- - -loc_1695: - mov ax, 492Bh - cmp [bp+var_2], 0 - jz short loc_16A0 - inc ax - inc ax - -loc_16A0: - stosw - mov ax, 464Eh - stosw - jmp loc_17BB -; --------------------------------------------------------------------------- - -loc_16A8: - mov ax, 4E2Bh - cmp [bp+var_2], 0 - jz short loc_16B3 - inc ax - inc ax - -loc_16B3: - stosw - mov al, 41h ; 'A' - stosw - jmp loc_17BB -; --------------------------------------------------------------------------- - -loc_16BA: - cmp byte ptr [bp+var_2], 0 - jz short loc_16C3 - mov al, 2Dh ; '-' - stosb - -loc_16C3: - mov dl, [bp+arg_4] - and dl, 5Fh - cmp dl, 46h ; 'F' - jz short loc_16E4 - cmp dl, 45h ; 'E' - jz short loc_174C - cmp bx, 0FFFDh - jl short loc_174C - mov ax, [bp+arg_A] - or ax, ax - jnz short loc_16E0 - inc ax - -loc_16E0: - cmp bx, ax - jg short loc_174C - -loc_16E4: - cmp bx, 28h ; '(' - jg short loc_174C - or bx, bx - jg short loc_16FE - mov ah, [bp+var_5] - mov al, 30h ; '0' - stosw - mov cx, 1 - jz short loc_1701 - mov al, 30h ; '0' - -loc_16FA: - stosb - inc bx - jnz short loc_16FA - -loc_16FE: - mov cx, 0 - -loc_1701: - lods byte ptr ss:[si] - or al, al - jz short loc_1712 - stosb - dec bx - jnz short loc_1701 - mov al, [bp+var_5] - stosb - inc cx - jmp short loc_1701 -; --------------------------------------------------------------------------- - -loc_1712: - mov ax, [bp+arg_A] - add cx, [bp+var_4] - cmp ax, cx - jbe short loc_1729 - sub ax, cx - mov cx, ax - add bx, ax - mov al, 30h ; '0' - rep stosb - dec bx - jz short loc_1742 - -loc_1729: - dec bx - jz short loc_1742 - cmp [bp+arg_2], 0 - jnz short loc_1742 - mov dl, [bp+arg_4] - mov cx, word ptr [bp+arg_6] - xchg bx, di - mov ah, [bp+var_5] - call unknown_libname_1 ; BCC v4.x/5.x DOS runtime - xchg di, bx - -loc_1742: - cmp di, word ptr [bp+arg_6] - jnz short loc_174A - mov al, 30h ; '0' - stosb - -loc_174A: - jmp short loc_17BB -; --------------------------------------------------------------------------- - -loc_174C: - lods word ptr ss:[si] - stosb - mov al, [bp+var_5] - or ah, ah - jnz short loc_175F - cmp [bp+arg_2], 0 - jz short loc_177F - stosb - jmp short loc_177F -; --------------------------------------------------------------------------- - -loc_175F: - stosb - mov al, ah - -loc_1762: - stosb - lods byte ptr ss:[si] - or al, al - jnz short loc_1762 - cmp [bp+arg_2], 0 - jnz short loc_177F - mov dl, [bp+arg_4] - mov cx, word ptr [bp+arg_6] - xchg bx, di - mov ah, [bp+var_5] - call unknown_libname_1 ; BCC v4.x/5.x DOS runtime - xchg di, bx - -loc_177F: - mov al, 20h ; ' ' - and al, [bp+arg_4] - or al, 45h - stosb - mov ax, 2D2Bh - dec bx - jge short loc_1791 - xchg al, ah - neg bx - -loc_1791: - stosb - xchg ax, bx - mov cx, 3030h - cmp ax, 63h ; 'c' - jbe short loc_17B4 - cmp ax, 3E7h - jbe short loc_17AA - cwd - mov bx, 3E8h - div bx - add al, cl - stosb - xchg ax, dx - -loc_17AA: - mov bl, 64h ; 'd' - div bl - add al, cl - stosb - xchg al, ah - cbw - -loc_17B4: - mov bl, 0Ah - div bl - add ax, cx - stosw - -loc_17BB: - xor al, al - stosb - pop es - pop di - pop si - mov sp, bp - pop bp - retn 10h -sub_161E endp - -; --------------------------------------------------------------------------- - push bp - mov bp, sp - pop bp - retn - +include libs/BorlandC/math/realcvt.asm include libs/BorlandC/math/xcvt.asm include libs/BorlandC/fperr.asm @@ -3005,7 +2683,7 @@ loc_2A98: loc_2A9F: push ax - call sub_9430 + call __realcvt push ss pop es assume es:nothing @@ -3430,15 +3108,7 @@ include libs/BorlandC/cvtfak.asm include libs/BorlandC/doscmd.asm include libs/BorlandC/exec.asm include libs/BorlandC/execl.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: thunk - -sub_9430 proc near - jmp off_13E8C -sub_9430 endp - +include libs/BorlandC/realcvt.asm include libs/BorlandC/setargv.asm include libs/BorlandC/setblock.asm include libs/BorlandC/setenvp.asm @@ -22620,7 +22290,7 @@ include libs/BorlandC/cibmdely[data].asm include libs/BorlandC/coniotyp[data].asm include libs/BorlandC/mbctype[data].asm include libs/BorlandC/loadprog[data].asm -off_13E8C dw offset sub_161E +include libs/BorlandC/math/realcvt[cvtseg].asm include libs/BorlandC/cvtfak[cvtseg].asm include libs/BorlandC/cvtfak[scnseg].asm diff --git a/th01_op.asm b/th01_op.asm index 899ea90d..2403e243 100644 --- a/th01_op.asm +++ b/th01_op.asm @@ -1716,330 +1716,7 @@ include libs/master.lib/dos_ropen.asm include libs/master.lib/egc.asm include libs/master.lib/random.asm include libs/BorlandC/emu/nec_fpinit.asm - -; =============== S U B R O U T I N E ======================================= - -; BCC v4.x/5.x DOS runtime -; Attributes: library function bp-based frame - -unknown_libname_1 proc near - push bp - mov bp, sp - mov al, 5Fh ; '_' - and al, dl - cmp al, 47h ; 'G' - jnz short loc_16D5 - -loc_16C7: - cmp byte ptr es:[bx-1], 30h ; '0' - jnz short loc_16D5 - dec bx - cmp bx, cx - ja short loc_16C7 - jmp short loc_16DC -; --------------------------------------------------------------------------- - -loc_16D5: - cmp es:[bx-1], ah - jnz short loc_16DC - dec bx - -loc_16DC: - pop bp - retn -unknown_libname_1 endp - - -; =============== S U B R O U T I N E ======================================= - -; Attributes: library function bp-based frame - -sub_16DE proc near - -var_32 = byte ptr -32h -var_5 = byte ptr -5 -var_4 = word ptr -4 -var_2 = word ptr -2 -arg_0 = word ptr 4 -arg_2 = byte ptr 6 -arg_4 = byte ptr 8 -arg_6 = dword ptr 0Ah -arg_A = word ptr 0Eh -arg_C = word ptr 10h -arg_E = word ptr 12h - - push bp - mov bp, sp - sub sp, 32h - push si - push di - les bx, __localeconvention - assume es:nothing - mov al, es:[bx] - mov [bp+var_5], al - push es - mov ax, [bp+arg_A] - cmp ax, 28h ; '(' - jbe short loc_16FF - mov ax, 28h ; '(' - mov [bp+arg_A], ax - -loc_16FF: - mov [bp+var_4], ax - mov dl, [bp+arg_4] - and dl, 0DFh - cmp dl, 46h ; 'F' - jnz short loc_1718 - neg ax - jle short loc_1721 - sub ax, ax - mov [bp+arg_A], ax - jmp short loc_1721 -; --------------------------------------------------------------------------- - -loc_1718: - or ax, ax - jg short loc_1721 - mov ax, 1 - jmp short loc_172A -; --------------------------------------------------------------------------- - -loc_1721: - cmp dl, 45h ; 'E' - jnz short loc_172A - inc ax - inc [bp+arg_A] - -loc_172A: - push [bp+arg_E] - push [bp+arg_C] - push ax - push ss - lea bx, [bp+var_2] - push bx - push ss - lea si, [bp+var_32] - push si - mov ax, [bp+arg_0] - push ax - call ___xcvt - xchg ax, bx - les di, [bp+arg_6] - cld - cmp bx, 7FFFh - jz short loc_1755 - cmp bx, 7FFEh - jz short loc_1768 - jmp short loc_177A -; --------------------------------------------------------------------------- - -loc_1755: - mov ax, 492Bh - cmp [bp+var_2], 0 - jz short loc_1760 - inc ax - inc ax - -loc_1760: - stosw - mov ax, 464Eh - stosw - jmp loc_187B -; --------------------------------------------------------------------------- - -loc_1768: - mov ax, 4E2Bh - cmp [bp+var_2], 0 - jz short loc_1773 - inc ax - inc ax - -loc_1773: - stosw - mov al, 41h ; 'A' - stosw - jmp loc_187B -; --------------------------------------------------------------------------- - -loc_177A: - cmp byte ptr [bp+var_2], 0 - jz short loc_1783 - mov al, 2Dh ; '-' - stosb - -loc_1783: - mov dl, [bp+arg_4] - and dl, 5Fh - cmp dl, 46h ; 'F' - jz short loc_17A4 - cmp dl, 45h ; 'E' - jz short loc_180C - cmp bx, 0FFFDh - jl short loc_180C - mov ax, [bp+arg_A] - or ax, ax - jnz short loc_17A0 - inc ax - -loc_17A0: - cmp bx, ax - jg short loc_180C - -loc_17A4: - cmp bx, 28h ; '(' - jg short loc_180C - or bx, bx - jg short loc_17BE - mov ah, [bp+var_5] - mov al, 30h ; '0' - stosw - mov cx, 1 - jz short loc_17C1 - mov al, 30h ; '0' - -loc_17BA: - stosb - inc bx - jnz short loc_17BA - -loc_17BE: - mov cx, 0 - -loc_17C1: - lods byte ptr ss:[si] - or al, al - jz short loc_17D2 - stosb - dec bx - jnz short loc_17C1 - mov al, [bp+var_5] - stosb - inc cx - jmp short loc_17C1 -; --------------------------------------------------------------------------- - -loc_17D2: - mov ax, [bp+arg_A] - add cx, [bp+var_4] - cmp ax, cx - jbe short loc_17E9 - sub ax, cx - mov cx, ax - add bx, ax - mov al, 30h ; '0' - rep stosb - dec bx - jz short loc_1802 - -loc_17E9: - dec bx - jz short loc_1802 - cmp [bp+arg_2], 0 - jnz short loc_1802 - mov dl, [bp+arg_4] - mov cx, word ptr [bp+arg_6] - xchg bx, di - mov ah, [bp+var_5] - call unknown_libname_1 ; BCC v4.x/5.x DOS runtime - xchg di, bx - -loc_1802: - cmp di, word ptr [bp+arg_6] - jnz short loc_180A - mov al, 30h ; '0' - stosb - -loc_180A: - jmp short loc_187B -; --------------------------------------------------------------------------- - -loc_180C: - lods word ptr ss:[si] - stosb - mov al, [bp+var_5] - or ah, ah - jnz short loc_181F - cmp [bp+arg_2], 0 - jz short loc_183F - stosb - jmp short loc_183F -; --------------------------------------------------------------------------- - -loc_181F: - stosb - mov al, ah - -loc_1822: - stosb - lods byte ptr ss:[si] - or al, al - jnz short loc_1822 - cmp [bp+arg_2], 0 - jnz short loc_183F - mov dl, [bp+arg_4] - mov cx, word ptr [bp+arg_6] - xchg bx, di - mov ah, [bp+var_5] - call unknown_libname_1 ; BCC v4.x/5.x DOS runtime - xchg di, bx - -loc_183F: - mov al, 20h ; ' ' - and al, [bp+arg_4] - or al, 45h - stosb - mov ax, 2D2Bh - dec bx - jge short loc_1851 - xchg al, ah - neg bx - -loc_1851: - stosb - xchg ax, bx - mov cx, 3030h - cmp ax, 63h ; 'c' - jbe short loc_1874 - cmp ax, 3E7h - jbe short loc_186A - cwd - mov bx, 3E8h - div bx - add al, cl - stosb - xchg ax, dx - -loc_186A: - mov bl, 64h ; 'd' - div bl - add al, cl - stosb - xchg al, ah - cbw - -loc_1874: - mov bl, 0Ah - div bl - add ax, cx - stosw - -loc_187B: - xor al, al - stosb - pop es - pop di - pop si - mov sp, bp - pop bp - retn 10h -sub_16DE endp - -; --------------------------------------------------------------------------- - push bp - mov bp, sp - pop bp - retn - +include libs/BorlandC/math/realcvt.asm include libs/BorlandC/math/xcvt.asm include libs/BorlandC/fperr.asm @@ -2915,7 +2592,7 @@ loc_2B00: loc_2B07: push ax - call sub_96AB + call __realcvt push ss pop es assume es:nothing @@ -3231,15 +2908,7 @@ include libs/BorlandC/cvtfak.asm include libs/BorlandC/doscmd.asm include libs/BorlandC/exec.asm include libs/BorlandC/execl.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: thunk - -sub_96AB proc near - jmp off_133CC -sub_96AB endp - +include libs/BorlandC/realcvt.asm include libs/BorlandC/setargv.asm include libs/BorlandC/setblock.asm include libs/BorlandC/setenvp.asm @@ -19871,7 +19540,7 @@ include libs/BorlandC/cibmdely[data].asm include libs/BorlandC/coniotyp[data].asm include libs/BorlandC/mbctype[data].asm include libs/BorlandC/loadprog[data].asm -off_133CC dw offset sub_16DE +include libs/BorlandC/math/realcvt[cvtseg].asm include libs/BorlandC/cvtfak[cvtseg].asm include libs/BorlandC/cvtfak[scnseg].asm diff --git a/th01_reiiden.asm b/th01_reiiden.asm index 3b76309a..c3e300ee 100644 --- a/th01_reiiden.asm +++ b/th01_reiiden.asm @@ -2104,328 +2104,7 @@ loc_1A90: retn 14h sub_19D8 endp - -; =============== S U B R O U T I N E ======================================= - -; BCC v4.x/5.x DOS runtime -; Attributes: library function bp-based frame - -unknown_libname_1 proc near - push bp - mov bp, sp - mov al, 5Fh ; '_' - and al, dl - cmp al, 47h ; 'G' - jnz short loc_1AAF - -loc_1AA1: - cmp byte ptr es:[bx-1], 30h ; '0' - jnz short loc_1AAF - dec bx - cmp bx, cx - ja short loc_1AA1 - jmp short loc_1AB6 -; --------------------------------------------------------------------------- - -loc_1AAF: - cmp es:[bx-1], ah - jnz short loc_1AB6 - dec bx - -loc_1AB6: - pop bp - retn -unknown_libname_1 endp - - -; =============== S U B R O U T I N E ======================================= - -; Attributes: library function bp-based frame - -sub_1AB8 proc near - -var_32 = byte ptr -32h -var_5 = byte ptr -5 -var_4 = word ptr -4 -var_2 = word ptr -2 -arg_0 = word ptr 4 -arg_2 = byte ptr 6 -arg_4 = byte ptr 8 -arg_6 = dword ptr 0Ah -arg_A = word ptr 0Eh -arg_C = word ptr 10h -arg_E = word ptr 12h - - push bp - mov bp, sp - sub sp, 32h - push si - push di - les bx, __localeconvention - mov al, es:[bx] - mov [bp+var_5], al - push es - mov ax, [bp+arg_A] - cmp ax, 28h ; '(' - jbe short loc_1AD9 - mov ax, 28h ; '(' - mov [bp+arg_A], ax - -loc_1AD9: - mov [bp+var_4], ax - mov dl, [bp+arg_4] - and dl, 0DFh - cmp dl, 46h ; 'F' - jnz short loc_1AF2 - neg ax - jle short loc_1AFB - sub ax, ax - mov [bp+arg_A], ax - jmp short loc_1AFB -; --------------------------------------------------------------------------- - -loc_1AF2: - or ax, ax - jg short loc_1AFB - mov ax, 1 - jmp short loc_1B04 -; --------------------------------------------------------------------------- - -loc_1AFB: - cmp dl, 45h ; 'E' - jnz short loc_1B04 - inc ax - inc [bp+arg_A] - -loc_1B04: - push [bp+arg_E] - push [bp+arg_C] - push ax - push ss - lea bx, [bp+var_2] - push bx - push ss - lea si, [bp+var_32] - push si - mov ax, [bp+arg_0] - push ax - call ___xcvt - xchg ax, bx - les di, [bp+arg_6] - cld - cmp bx, 7FFFh - jz short loc_1B2F - cmp bx, 7FFEh - jz short loc_1B42 - jmp short loc_1B54 -; --------------------------------------------------------------------------- - -loc_1B2F: - mov ax, 492Bh - cmp [bp+var_2], 0 - jz short loc_1B3A - inc ax - inc ax - -loc_1B3A: - stosw - mov ax, 464Eh - stosw - jmp loc_1C55 -; --------------------------------------------------------------------------- - -loc_1B42: - mov ax, 4E2Bh - cmp [bp+var_2], 0 - jz short loc_1B4D - inc ax - inc ax - -loc_1B4D: - stosw - mov al, 41h ; 'A' - stosw - jmp loc_1C55 -; --------------------------------------------------------------------------- - -loc_1B54: - cmp byte ptr [bp+var_2], 0 - jz short loc_1B5D - mov al, 2Dh ; '-' - stosb - -loc_1B5D: - mov dl, [bp+arg_4] - and dl, 5Fh - cmp dl, 46h ; 'F' - jz short loc_1B7E - cmp dl, 45h ; 'E' - jz short loc_1BE6 - cmp bx, 0FFFDh - jl short loc_1BE6 - mov ax, [bp+arg_A] - or ax, ax - jnz short loc_1B7A - inc ax - -loc_1B7A: - cmp bx, ax - jg short loc_1BE6 - -loc_1B7E: - cmp bx, 28h ; '(' - jg short loc_1BE6 - or bx, bx - jg short loc_1B98 - mov ah, [bp+var_5] - mov al, 30h ; '0' - stosw - mov cx, 1 - jz short loc_1B9B - mov al, 30h ; '0' - -loc_1B94: - stosb - inc bx - jnz short loc_1B94 - -loc_1B98: - mov cx, 0 - -loc_1B9B: - lods byte ptr ss:[si] - or al, al - jz short loc_1BAC - stosb - dec bx - jnz short loc_1B9B - mov al, [bp+var_5] - stosb - inc cx - jmp short loc_1B9B -; --------------------------------------------------------------------------- - -loc_1BAC: - mov ax, [bp+arg_A] - add cx, [bp+var_4] - cmp ax, cx - jbe short loc_1BC3 - sub ax, cx - mov cx, ax - add bx, ax - mov al, 30h ; '0' - rep stosb - dec bx - jz short loc_1BDC - -loc_1BC3: - dec bx - jz short loc_1BDC - cmp [bp+arg_2], 0 - jnz short loc_1BDC - mov dl, [bp+arg_4] - mov cx, word ptr [bp+arg_6] - xchg bx, di - mov ah, [bp+var_5] - call unknown_libname_1 ; BCC v4.x/5.x DOS runtime - xchg di, bx - -loc_1BDC: - cmp di, word ptr [bp+arg_6] - jnz short loc_1BE4 - mov al, 30h ; '0' - stosb - -loc_1BE4: - jmp short loc_1C55 -; --------------------------------------------------------------------------- - -loc_1BE6: - lods word ptr ss:[si] - stosb - mov al, [bp+var_5] - or ah, ah - jnz short loc_1BF9 - cmp [bp+arg_2], 0 - jz short loc_1C19 - stosb - jmp short loc_1C19 -; --------------------------------------------------------------------------- - -loc_1BF9: - stosb - mov al, ah - -loc_1BFC: - stosb - lods byte ptr ss:[si] - or al, al - jnz short loc_1BFC - cmp [bp+arg_2], 0 - jnz short loc_1C19 - mov dl, [bp+arg_4] - mov cx, word ptr [bp+arg_6] - xchg bx, di - mov ah, [bp+var_5] - call unknown_libname_1 ; BCC v4.x/5.x DOS runtime - xchg di, bx - -loc_1C19: - mov al, 20h ; ' ' - and al, [bp+arg_4] - or al, 45h - stosb - mov ax, 2D2Bh - dec bx - jge short loc_1C2B - xchg al, ah - neg bx - -loc_1C2B: - stosb - xchg ax, bx - mov cx, 3030h - cmp ax, 63h ; 'c' - jbe short loc_1C4E - cmp ax, 3E7h - jbe short loc_1C44 - cwd - mov bx, 3E8h - div bx - add al, cl - stosb - xchg ax, dx - -loc_1C44: - mov bl, 64h ; 'd' - div bl - add al, cl - stosb - xchg al, ah - cbw - -loc_1C4E: - mov bl, 0Ah - div bl - add ax, cx - stosw - -loc_1C55: - xor al, al - stosb - pop es - pop di - pop si - mov sp, bp - pop bp - retn 10h -sub_1AB8 endp - -; --------------------------------------------------------------------------- - push bp - mov bp, sp - pop bp - retn +include libs/BorlandC/math/realcvt.asm ; =============== S U B R O U T I N E ======================================= @@ -4926,7 +4605,7 @@ loc_3D83: loc_3D8A: push ax - call sub_AB1E + call __realcvt push ss pop es assume es:nothing @@ -5516,15 +5195,7 @@ include libs/BorlandC/cvtfak.asm include libs/BorlandC/doscmd.asm include libs/BorlandC/exec.asm include libs/BorlandC/execl.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: thunk - -sub_AB1E proc near - jmp off_36BAA -sub_AB1E endp - +include libs/BorlandC/realcvt.asm ; =============== S U B R O U T I N E ======================================= @@ -39381,7 +39052,7 @@ include libs/BorlandC/coniotyp[data].asm include libs/BorlandC/kbhit[data].asm include libs/BorlandC/mbctype[data].asm include libs/BorlandC/loadprog[data].asm -off_36BAA dw offset sub_1AB8 +include libs/BorlandC/math/realcvt[cvtseg].asm include libs/BorlandC/cvtfak[cvtseg].asm off_36BAE dw offset sub_1C66 off_36BB0 dw offset sub_1F84