From 86b99b9265d974fa26c991078a5d3c372fcdc7dd Mon Sep 17 00:00:00 2001 From: nmlgc Date: Fri, 26 Sep 2014 23:15:24 +0200 Subject: [PATCH] [Reduction] #511: segread --- libs/BorlandC/regs.inc | 33 ++++++++++++++++ libs/BorlandC/segread.asm | 38 ++++++++++++++++++ th01_fuuin.asm | 81 ++------------------------------------- th01_op.asm | 81 ++------------------------------------- th01_reiiden.asm | 81 ++------------------------------------- 5 files changed, 83 insertions(+), 231 deletions(-) create mode 100644 libs/BorlandC/regs.inc create mode 100644 libs/BorlandC/segread.asm diff --git a/libs/BorlandC/regs.inc b/libs/BorlandC/regs.inc new file mode 100644 index 00000000..f9c8b9fd --- /dev/null +++ b/libs/BorlandC/regs.inc @@ -0,0 +1,33 @@ +BYTEREGS struc ; (sizeof=0x8, standard type) +_al db ? +_ah db ? +_bl db ? +_bh db ? +_cl db ? +_ch db ? +_dl db ? +_dh db ? +BYTEREGS ends + +WORDREGS struc ; (sizeof=0x10, standard type) +_ax dw ? +_bx dw ? +_cx dw ? +_dx dw ? +_si dw ? +_di dw ? +_cflags dw ? +_flags dw ? +WORDREGS ends + +REGS union ; (sizeof=0x10, standard type) +x WORDREGS ? +h BYTEREGS ? +REGS ends + +SREGS struc ; (sizeof=0x8, standard type) +_es dw ? +_cs dw ? +_ss dw ? +_ds dw ? +SREGS ends diff --git a/libs/BorlandC/segread.asm b/libs/BorlandC/segread.asm new file mode 100644 index 00000000..d862b8a3 --- /dev/null +++ b/libs/BorlandC/segread.asm @@ -0,0 +1,38 @@ +; void __cdecl segread(struct SREGS *segp) +_segread proc DIST +@@segp = DPTR_ 2 + dPtrSize + + push bp + mov bp, sp + push si + push di +if LDATA + mov bx, es +endif + LES_ si, [bp+@@segp] +if LDATA + mov es:[si], bx +else + mov [si]._es, es +endif +if LPROG + mov ax, [bp+4] + mov ES_[si]._cs, ax +else + mov ES_[si]._cs, cs +endif + mov word ptr ES_[si]._ss, ss +ifdef __HUGE__ + mov ax, [bp+4] + mov ES_[si]._ds, ax +else + mov word ptr ES_[si]._ds, ds +endif +if LDATA + mov es, bx +endif + pop di + pop si + pop bp + ret +_segread endp diff --git a/th01_fuuin.asm b/th01_fuuin.asm index 3b18429d..0d0e14c7 100644 --- a/th01_fuuin.asm +++ b/th01_fuuin.asm @@ -1,46 +1,3 @@ -; --------------------------------------------------------------------------- - -BYTEREGS struc ; (sizeof=0x8, standard type) -_al db ? -_ah db ? -_bl db ? -_bh db ? -_cl db ? -_ch db ? -_dl db ? -_dh db ? -BYTEREGS ends - -; --------------------------------------------------------------------------- - -WORDREGS struc ; (sizeof=0x10, standard type) -_ax dw ? -_bx dw ? -_cx dw ? -_dx dw ? -_si dw ? -_di dw ? -_cflag dw ? -_flags dw ? -WORDREGS ends - -; --------------------------------------------------------------------------- - -REGS union ; (sizeof=0x10, standard type) -x WORDREGS ? -h BYTEREGS ? -REGS ends - -; --------------------------------------------------------------------------- - -SREGS struc ; (sizeof=0x8, standard type) -_es dw ? -_cs dw ? -_ss dw ? -_ds dw ? -SREGS ends - - ; ; +-------------------------------------------------------------------------+ ; | This file has been generated by The Interactive Disassembler (IDA) | @@ -77,6 +34,7 @@ SREGS ends .model large include ReC98.inc +include libs/BorlandC/regs.inc ; =========================================================================== @@ -3359,34 +3317,7 @@ include libs/BorlandC/newarray.asm include libs/BorlandC/N_LXMUL.ASM include libs/BorlandC/N_PCMP.ASM include libs/BorlandC/reada.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: library function bp-based frame - -; void __cdecl segread(struct SREGS *segp) -_segread proc far - -segp = dword ptr 6 - - push bp - mov bp, sp - push si - push di - mov bx, es - les si, [bp+segp] - mov es:[si], bx - mov ax, [bp+4] - mov es:[si+2], ax - mov word ptr es:[si+4], ss - mov word ptr es:[si+6], ds - mov es, bx - pop di - pop si - pop bp - retf -_segread endp - +include libs/BorlandC/segread.asm include libs/BorlandC/setupio.asm include libs/BorlandC/cconv.asm include libs/BorlandC/toupper.asm @@ -4272,9 +4203,7 @@ outregs = dword ptr 0Ch push ss lea ax, [bp+segp] push ax ; segp - nop - push cs - call near ptr _segread + nopcall _segread pop cx pop cx push ss @@ -4406,9 +4335,7 @@ outregs = dword ptr 0Ah push ss lea ax, [bp+segp] push ax ; segp - nop - push cs - call near ptr _segread + nopcall _segread pop cx pop cx push ss diff --git a/th01_op.asm b/th01_op.asm index a06aba6a..0ba8bdf9 100644 --- a/th01_op.asm +++ b/th01_op.asm @@ -1,46 +1,3 @@ -; --------------------------------------------------------------------------- - -BYTEREGS struc ; (sizeof=0x8, standard type) -_al db ? -_ah db ? -_bl db ? -_bh db ? -_cl db ? -_ch db ? -_dl db ? -_dh db ? -BYTEREGS ends - -; --------------------------------------------------------------------------- - -WORDREGS struc ; (sizeof=0x10, standard type) -_ax dw ? -_bx dw ? -_cx dw ? -_dx dw ? -_si dw ? -_di dw ? -_cflag dw ? -_flags dw ? -WORDREGS ends - -; --------------------------------------------------------------------------- - -REGS union ; (sizeof=0x10, standard type) -x WORDREGS ? -h BYTEREGS ? -REGS ends - -; --------------------------------------------------------------------------- - -SREGS struc ; (sizeof=0x8, standard type) -_es dw ? -_cs dw ? -_ss dw ? -_ds dw ? -SREGS ends - - ; ; +-------------------------------------------------------------------------+ ; | This file has been generated by The Interactive Disassembler (IDA) | @@ -76,6 +33,7 @@ SREGS ends .model large include ReC98.inc +include libs/BorlandC/regs.inc ; =========================================================================== @@ -3061,34 +3019,7 @@ include libs/BorlandC/newarray.asm include libs/BorlandC/N_LXMUL.ASM include libs/BorlandC/N_PCMP.ASM include libs/BorlandC/reada.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: library function bp-based frame - -; void __cdecl segread(struct SREGS *segp) -_segread proc far - -segp = dword ptr 6 - - push bp - mov bp, sp - push si - push di - mov bx, es - les si, [bp+segp] - mov es:[si], bx - mov ax, [bp+4] - mov es:[si+2], ax - mov word ptr es:[si+4], ss - mov word ptr es:[si+6], ds - mov es, bx - pop di - pop si - pop bp - retf -_segread endp - +include libs/BorlandC/segread.asm include libs/BorlandC/setupio.asm include libs/BorlandC/cconv.asm include libs/BorlandC/toupper.asm @@ -3974,9 +3905,7 @@ outregs = dword ptr 0Ch push ss lea ax, [bp+segp] push ax ; segp - nop - push cs - call near ptr _segread + nopcall _segread pop cx pop cx push ss @@ -4108,9 +4037,7 @@ outregs = dword ptr 0Ah push ss lea ax, [bp+segp] push ax ; segp - nop - push cs - call near ptr _segread + nopcall _segread pop cx pop cx push ss diff --git a/th01_reiiden.asm b/th01_reiiden.asm index 457fadac..12ac9255 100644 --- a/th01_reiiden.asm +++ b/th01_reiiden.asm @@ -1,46 +1,3 @@ -; --------------------------------------------------------------------------- - -BYTEREGS struc ; (sizeof=0x8, standard type) -_al db ? -_ah db ? -_bl db ? -_bh db ? -_cl db ? -_ch db ? -_dl db ? -_dh db ? -BYTEREGS ends - -; --------------------------------------------------------------------------- - -WORDREGS struc ; (sizeof=0x10, standard type) -_ax dw ? -_bx dw ? -_cx dw ? -_dx dw ? -_si dw ? -_di dw ? -_cflags dw ? -_flags dw ? -WORDREGS ends - -; --------------------------------------------------------------------------- - -REGS union ; (sizeof=0x10, standard type) -x WORDREGS ? -h BYTEREGS ? -REGS ends - -; --------------------------------------------------------------------------- - -SREGS struc ; (sizeof=0x8, standard type) -_es dw ? -_cs dw ? -_ss dw ? -_ds dw ? -SREGS ends - - ; ; +-------------------------------------------------------------------------+ ; | This file has been generated by The Interactive Disassembler (IDA) | @@ -102,6 +59,7 @@ SREGS ends .model large include ReC98.inc +include libs/BorlandC/regs.inc ; =========================================================================== @@ -5884,34 +5842,7 @@ loc_3673: retn __scantol endp - -; =============== S U B R O U T I N E ======================================= - -; Attributes: library function bp-based frame - -; void __cdecl segread(struct SREGS *segp) -_segread proc far - -segp = dword ptr 6 - - push bp - mov bp, sp - push si - push di - mov bx, es - les si, [bp+segp] - mov es:[si], bx - mov ax, [bp+4] - mov es:[si+2], ax - mov word ptr es:[si+4], ss - mov word ptr es:[si+6], ds - mov es, bx - pop di - pop si - pop bp - retf -_segread endp - +include libs/BorlandC/segread.asm include libs/BorlandC/setupio.asm include libs/BorlandC/cconv.asm include libs/BorlandC/toupper.asm @@ -7349,9 +7280,7 @@ outregs = dword ptr 0Ch push ss lea ax, [bp+segp] push ax ; segp - nop - push cs - call near ptr _segread + nopcall _segread pop cx pop cx push ss @@ -7485,9 +7414,7 @@ outregs = dword ptr 0Ah push ss lea ax, [bp+segp] push ax ; segp - nop - push cs - call near ptr _segread + nopcall _segread pop cx pop cx push ss