From 93aeccfb4b41ccf4e4704061da17b3eeabc17018 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Wed, 8 Sep 2004 08:46:37 +0000 Subject: [PATCH] Added FBLD Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1950 --- src/fpu/fpu.cpp | 8 ++++++-- src/fpu/fpu_instructions.h | 23 ++++++++++++++++++++++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/fpu/fpu.cpp b/src/fpu/fpu.cpp index a6b587e8..bce87f7e 100644 --- a/src/fpu/fpu.cpp +++ b/src/fpu/fpu.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: fpu.cpp,v 1.21 2004-08-04 09:12:54 qbix79 Exp $ */ +/* $Id: fpu.cpp,v 1.22 2004-09-08 08:46:37 qbix79 Exp $ */ #include "dosbox.h" #if C_FPU @@ -709,7 +709,11 @@ void FPU_ESC7_EA(Bitu rm,PhysPt addr) { FPU_FPOP(); break; case 0x04: /* FBLD packed BCD */ - //Don't think anybody will ever use this. + { + Real64 in = FPU_FBLD(addr); + FPU_PUSH(in); + } + break; default: LOG(LOG_FPU,LOG_WARN)("ESC 7 EA:Unhandled group %d subfunction %d",group,sub); break; diff --git a/src/fpu/fpu_instructions.h b/src/fpu/fpu_instructions.h index c10ce6df..8cb207b0 100644 --- a/src/fpu/fpu_instructions.h +++ b/src/fpu/fpu_instructions.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: fpu_instructions.h,v 1.18 2004-08-04 09:12:54 qbix79 Exp $ */ +/* $Id: fpu_instructions.h,v 1.19 2004-09-08 08:46:37 qbix79 Exp $ */ static void FPU_FINIT(void) { @@ -262,6 +262,27 @@ static void FPU_FBST(PhysPt addr) mem_writeb(addr+9,p); } +static Real64 FPU_FBLD(PhysPt addr) +{ + Real64 val = 0; + Bitu in = 0; + Bit64u base = 1; + for(Bitu i = 0;i < 9;i++){ + in = mem_readb(addr + i); + val += ( (in&9) * base); + base *= 10; + val += ((( in>>4)&9) * base); + base *= 10; + } + + //last number + in = mem_readb(addr + 9); + val += ( (in&9) * base ); + if(in&0x80) val *= -1.0; + return val; +} + + #define BIAS80 16383 #define BIAS64 1023