DATADIR=data$(DIRSEP)
SPRI=$(DATADIR)/spri
SRC=src
-SRCLIB=src/lib
-JSMNLIB=src/lib/jsmn
-NYANLIB=src/lib/nyan
-EXMMLIB=src/lib/exmm
-MODEXLIB16=src/lib/16_vl
-MODEXLIB=src/lib/modex
-VGMSNDLIB=src/lib/vgmsnd
-DOSLIB=src/lib/doslib
-WCPULIB=src/lib/wcpu
-
-DOSLIB_CPU=src/lib/doslib/hw/cpu
-DOSLIB_DOS=src/lib/doslib/hw/dos
-DOSLIB_VGA=src/lib/doslib/hw/vga
-DOSLIB_8250=src/lib/doslib/hw/8250
-DOSLIB_JOYSTICK=src/lib/doslib/hw/joystick
+UTIL=$(SRC)/util
+SRCLIB=$(SRC)/lib
+JSMNLIB=$(SRCLIB)/jsmn
+NYANLIB=$(SRCLIB)/nyan
+EXMMLIB=$(SRCLIB)/exmm
+MODEXLIB16=$(SRCLIB)/16_vl
+MODEXLIB=$(SRCLIB)/modex
+VGMSNDLIB=$(SRCLIB)/vgmsnd
+DOSLIB=$(SRCLIB)/doslib
+WCPULIB=$(SRCLIB)/wcpu
+
+DOSLIB_CPU=$(DOSLIB)/hw/cpu
+DOSLIB_DOS=$(DOSLIB)/hw/dos
+DOSLIB_VGA=$(DOSLIB)/hw/vga
+DOSLIB_8250=$(DOSLIB)/hw/8250
+DOSLIB_JOYSTICK=$(DOSLIB)/hw/joystick
DOSLIB_MEMMODE=dos86$(MEMORYMODE)
#
VGMSNDOBJ = vgmSnd.$(OBJ) 16_snd.$(OBJ)
OLDLIBOBJS=bitmap.$(OBJ) 16render.$(OBJ)
GFXLIBOBJS = 16_vl.$(OBJ) 16text.$(OBJ) bakapee.$(OBJ) scroll16.$(OBJ) 16_vrs.$(OBJ) 16_sprit.$(OBJ) $(OLDLIBOBJS)
-16LIBOBJS = 16_mm.$(OBJ) 16_pm.$(OBJ) 16_ca.$(OBJ) 16_tail.$(OBJ) 16_in.$(OBJ) 16_head.$(OBJ) 16_dbg.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ) wcpu.$(OBJ) 16_timer.$(OBJ) jsmn.$(OBJ) 16_map.$(OBJ) 16text.$(OBJ)
+16LIBOBJS = 16_mm.$(OBJ) 16_pm.$(OBJ) 16_ca.$(OBJ) 16_tail.$(OBJ) 16_in.$(OBJ) 16_head.$(OBJ) 16_dbg.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ) 16_wcpu.$(OBJ) 16_timer.$(OBJ) jsmn.$(OBJ) 16_map.$(OBJ) 16text.$(OBJ)
#16planar.$(OBJ) planar.$(OBJ) mapread.$(OBJ)
DOSLIBOBJ = adlib.$(OBJ) 8254.$(OBJ) 8259.$(OBJ) dos.$(OBJ) cpu.$(OBJ)
!ifeq DEBUGSERIAL 1
#
# Files locations
#
-.c : $(SRC);$(SRCLIB);$(MODEXLIB16);$(JSMNLIB);$(NYANLIB);$(VGMSNDLIB);$(WCPULIB)
+.c : $(SRC);$(SRCLIB);$(MODEXLIB16);$(JSMNLIB);$(NYANLIB);$(VGMSNDLIB);$(WCPULIB);$(UTIL)
-.asm : $(MODEXLIB)
+.asm : $(MODEXLIB);$(UTIL)
.lib : .;$(DOSLIB_CPU)/$(DOSLIB_MEMMODE);$(DOSLIB_DOS)/$(DOSLIB_MEMMODE);$(DOSLIB_VGA)/$(DOSLIB_MEMMODE);$(DOSLIB_8250)/$(DOSLIB_MEMMODE)
#
# List of executables to build
#
+EXTERNTESTEXEC = &
+ joytest.exe &
+ wcpu.exe &
+ db.exe
TESTEXEC = &
tesuto.exe &
0.exe &
test0.exe &
pcxtest.exe &
pcxtest2.exe &
- db.exe
+ $(EXTERNTESTEXEC)
UTILEXEC = &
palettel.exe &
palettec.exe
$(UTILEXEC) &
$(TESTEXEC)
-all: $(EXEC) joytest.exe
-testexec: $(EXEC) joytest.exe $(TESTEXEC2)
+all: $(EXEC) $(EXTERNTESTEXEC)
+testexec: $(EXEC) $(TESTEXEC2)
#
# game and bakapi executables
exmmtest.exe: exmmtest.$(OBJ) $(16LIB) $(DOSLIBLIBS)
vgmtest.exe: vgmtest.$(OBJ) vgmsnd.lib $(16LIB) $(DOSLIBLIBS)
db.exe: db.$(OBJ)
+wcpu.exe: wcpu.$(OBJ) $(16LIB) $(DOSLIBLIBS)
#
# executable's objects
#tsthimem.$(OBJ): $(SRC)/tsthimem.c
exmmtest.$(OBJ):$(SRC)/exmmtest.c
vgmtest.$(OBJ):$(SRC)/vgmtest.c
-db.$(OBJ):$(SRC)/util/db.c
+db.$(OBJ): $(UTIL)/db.c
#
# non executable objects libraries
jsmn.$(OBJ): $(JSMNLIB)/jsmn.c $(JSMNLIB)/jsmn.h
kitten.$(OBJ): $(NYANLIB)/kitten.c $(NYANLIB)/kitten.h
vgmSnd.$(OBJ): $(VGMSNDLIB)/vgmSnd.c $(VGMSNDLIB)/vgmSnd.h
-wcpu.$(OBJ): $(WCPULIB)/wcpu.c $(WCPULIB)/wcpu.h
+16_wcpu.$(OBJ): $(WCPULIB)/16_wcpu.c $(WCPULIB)/16_wcpu.h
#memory.$(OBJ):$(EXMMLIB)/memory.c $(EXMMLIB)/memory.h
c_utils.$(OBJ):$(MODEXLIB)/c_utils.asm
modex.$(OBJ): $(MODEXLIB)/modex.asm
#include "src/16.h"\r
\r
engi_stat_t engi_stat;\r
-const char *cpus;\r
byte *dpal, *gpal;\r
player_t player[MaxPlayers];\r
\r
shinku(&gvar);\r
_DEBUGF("Serial debug output printf test %u %u %u\n",1U,2U,3U);\r
}\r
- switch(detectcpu())\r
- {\r
- case 0: cpus = "8086/8088 or 186/88"; break;\r
- case 1: cpus = "286"; break;\r
- case 2: cpus = "386 or newer"; break;\r
- default: cpus = "internal error"; break;\r
- }\r
Shutdown16(&gvar);\r
VGAmodeX(0, 1, &gvar);\r
printf("Project 16 16.exe. This is supposed to be the actual finished game executable!\n");\r
printf("version %s\n", VERSION);\r
- printf("detected CPU type: %s\n", cpus);\r
+ WCPU_cpufpumesg();\r
modexFadeOn(4, dpal);\r
}\r
#include "src/lib/16_head.h"\r
#include "src/lib/16_tail.h"\r
#include "src/lib/16_vl.h"\r
-#include "src/lib/wcpu/wcpu.h"\r
+#include "src/lib/wcpu/16_wcpu.h"\r
#include "src/lib/scroll16.h"\r
#include "src/lib/16_timer.h"\r
#include "src/lib/16_dbg.h"\r
//gv->kurokku.frames_per_second = 60;\r
\r
//turn this off if XT\r
- switch(detectcpu())\r
+ switch(WCPU_detectcpu())\r
{\r
case 0:\r
gv->kurokku.fpscap=0;\r
#ifndef _TIMER_H_\r
#define _TIMER_H_\r
#include "src/lib/16_head.h"\r
-#include "src/lib/wcpu/wcpu.h"\r
+#include "src/lib/wcpu/16_wcpu.h"\r
\r
clock_t start_timer(global_game_variables_t *gv);\r
double elapsed_timer(global_game_variables_t *gv);\r
#include "src/lib/16render.h"\r
//#include "src/lib/16_map.h" //new map stuff\r
#include "src/lib/16_timer.h"\r
-#include "src/lib/wcpu/wcpu.h"\r
+#include "src/lib/wcpu/16_wcpu.h"\r
\r
#include <hw/cpu/cpu.h>\r
#include <hw/dos/dos.h>\r
--- /dev/null
+/* Project 16 Source Code~\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
+ *\r
+ * This file is part of Project 16.\r
+ *\r
+ * Project 16 is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Project 16 is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program. If not, see <http://www.gnu.org/licenses/>, or\r
+ * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
+ * Fifth Floor, Boston, MA 02110-1301 USA.\r
+ *\r
+ */\r
+/* tab size = 8 */\r
+\r
+#include "src/lib/wcpu/16_wcpu.h"\r
+\r
+//#define USECPUPROBE\r
+\r
+byte WCPU_detectfpu()\r
+{\r
+ byte fputype=0;\r
+ word funk=0;\r
+ boolean errflag=0;\r
+ __asm {\r
+ PUSHF ; we gonna modify flags, so back them up\r
+.8087 fninit ; Initialize FPU\r
+// mov [WORD PTR funk], 55AAh ; Set junk value\r
+// fnstsw funk ; Store status word\r
+// cmp [BYTE PTR funk], 0 ; If it's not 0, no FPU\r
+ mov funk, 55AAh ; Set junk value\r
+ fnstsw funk ; Store status word\r
+ cmp funk, 0 ; If it's not 0, no FPU\r
+// jne short _done\r
+ jne short _err\r
+ jmp _fpu\r
+ _err:\r
+ mov errflag, 1\r
+ _fpu:\r
+/* }\r
+ if(!errflag){\r
+ printf(".");\r
+ __asm {*/\r
+ fnstcw funk ; Store control word\r
+ mov ax, funk ; If the bits are not the way\r
+ and ax, 103Fh ; they should be, no FPU\r
+ cmp ax, 3Fh\r
+// jne short _done\r
+ je short __err\r
+ jmp __fpu\r
+ __err:\r
+ mov errflag, 1\r
+ __fpu:\r
+ /*}}\r
+ if(!errflag){\r
+ printf(".");\r
+ __asm {*/\r
+// and [WORD PTR funk], 0FF7Fh ; Clear interrupt bit\r
+ and funk, 0FF7Fh ; Clear interrupt bit\r
+ fldcw funk ; Load control word\r
+ fdisi ; Disable interrupts\r
+ fstcw funk ; Store control word\r
+// test [BYTE PTR funk], 80h ; If it changed, it's an 8087\r
+ test funk, 80h ; If it changed, it's an 8087\r
+ mov fputype, 1\r
+\r
+ _done:\r
+ POPF ; restore flags we backed up earlier\r
+ }//}\r
+ //printf("WCPU_detectfpu():\n fputype=%u\n funk=%u errflag=%u\n", fputype, funk, errflag);\r
+#ifdef USECPUPROBE\r
+ if (cpu_flags & CPU_FLAG_FPU) printf(" - With FPU\n");\r
+#endif\r
+ return fputype;\r
+}\r
+\r
+byte WCPU_detectcpu()\r
+{\r
+ byte cputype=0;\r
+ __asm {\r
+ PUSHF ; we gonna modify flags, so back them up\r
+ ; first check if its 8086/8088 or 80186/80188\r
+ PUSHF ; FLAGS -> STACK\r
+ POP AX ; STACK -> AX\r
+ AND AX, 00FFFh ; clear 12-15 bits (they are always 1 on 8086/8088 and 80186/80188)\r
+ PUSH AX ; AX -> STACK\r
+ POPF ; STACK -> FLAGS\r
+ ; this is where magic happen\r
+ PUSHF ; FLAGS -> STACK\r
+ POP AX ; STACK -> AX\r
+ AND AX, 0F000h ; 0-11 bits aren't important to us\r
+ CMP AX, 0F000h ; check if all 12-15 bits are set (simple comparision)\r
+ JNE _286p ; if no, 286+ CPU\r
+ MOV cputype, 0 ; if yes, we are done, set cputype to 0 and end this\r
+ JMP _done\r
+ _286p:\r
+ ; now check if its 286 or newer\r
+ PUSHF ; FLAGS -> STACK\r
+ POP AX ; STACK -> AX\r
+ OR AX, 07000h ; set 12-14 bits (they are always cleared by 286 if its real mode)\r
+ PUSH AX ; AX -> STACK\r
+ POPF ; STACK -> FLAGS\r
+ ; this is where magic happen\r
+ PUSHF ; FLAGS -> STACK\r
+ POP AX ; STACK -> AX\r
+ TEST AX, 07000h ; check if at least 1 bit in 12-14 bits range is set (15th won't be set anyway)\r
+ JNZ _386p ; not all bits clear, its 386+\r
+ MOV cputype, 1 ; all bits clear, its 286, we are done\r
+ JMP _done\r
+ _386p:\r
+ MOV cputype, 2 ; its 386 or newer, but we don't care if its newer at this point\r
+ _done:\r
+ POPF ; restore flags we backed up earlier\r
+ }\r
+ return cputype;\r
+}\r
+\r
+const char *WCPU_cpudetectmesg()\r
+{\r
+ const char *cpus;\r
+ unsigned char cput;\r
+\r
+ cput = WCPU_detectcpu();\r
+ switch(cput)\r
+ {\r
+ case 0: cpus = "8086/8088 or 186/88"; break;\r
+ case 1: cpus = "286"; break;\r
+ case 2: cpus = "386 or newer"; break;\r
+ default: cpus = "internal error"; break;\r
+ }\r
+ return cpus;\r
+}\r
+\r
+const char *WCPU_fpudetectmesg()\r
+{\r
+ const char *fpus;\r
+ unsigned char fput;\r
+\r
+ fput = WCPU_detectfpu();\r
+ switch(fput)\r
+ {\r
+ case 0: fpus = "none"; break;\r
+ case 1: fpus = "8087"; break;\r
+ default: fpus = "internal error"; break;\r
+ }\r
+ return fpus;\r
+}\r
+\r
+void WCPU_cpufpumesg()\r
+{\r
+#ifdef USECPUPROBE\r
+ cpu_probe();\r
+#endif\r
+ printf("detected CPU type: %s\n", WCPU_cpudetectmesg());\r
+ printf("detected FPU type: %s\n", WCPU_fpudetectmesg());\r
+}\r
--- /dev/null
+/* Project 16 Source Code~\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
+ *\r
+ * This file is part of Project 16.\r
+ *\r
+ * Project 16 is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Project 16 is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program. If not, see <http://www.gnu.org/licenses/>, or\r
+ * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
+ * Fifth Floor, Boston, MA 02110-1301 USA.\r
+ *\r
+ */\r
+\r
+#ifndef _WCPU_H_\r
+#define _WCPU_H_\r
+#include <stdio.h>\r
+#include "src/lib/16_t.h"\r
+\r
+#ifdef __WATCOMC__\r
+#include <hw/cpu/cpu.h>\r
+#endif\r
+\r
+byte WCPU_detectfpu(void);\r
+byte WCPU_detectcpu(void);\r
+const char *WCPU_cpudetectmesg();\r
+const char *WCPU_fpudetectmesg();\r
+void WCPU_cpufpumesg();\r
+\r
+#endif/*_WCPU_H_*/\r
*/
/* tab size = 8 */
-#include "src/lib/wcpu/wcpu.h"
+#include "src/lib/wcpu/16_wcpu.h"
-byte detectcpu()
+void main(int argc, char **argv)
{
- byte cputype=0;
- __asm
- {
- PUSHF ; we gonna modify flags, so back them up
- ; first check if its 8086/8088 or 80186/80188
- PUSHF ; FLAGS -> STACK
- POP AX ; STACK -> AX
- AND AX, 00FFFh ; clear 12-15 bits (they are always 1 on 8086/8088 and 80186/80188)
- PUSH AX ; AX -> STACK
- POPF ; STACK -> FLAGS
- ; this is where magic happen
- PUSHF ; FLAGS -> STACK
- POP AX ; STACK -> AX
- AND AX, 0F000h ; 0-11 bits aren't important to us
- CMP AX, 0F000h ; check if all 12-15 bits are set (simple comparision)
- JNE _286p ; if no, 286+ CPU
- MOV cputype, 0 ; if yes, we are done, set cputype to 0 and end this
- JMP _done
- _286p:
- ; now check if its 286 or newer
- PUSHF ; FLAGS -> STACK
- POP AX ; STACK -> AX
- OR AX, 07000h ; set 12-14 bits (they are always cleared by 286 if its real mode)
- PUSH AX ; AX -> STACK
- POPF ; STACK -> FLAGS
- ; this is where magic happen
- PUSHF ; FLAGS -> STACK
- POP AX ; STACK -> AX
- TEST AX, 07000h ; check if at least 1 bit in 12-14 bits range is set (15th won't be set anyway)
- JNZ _386p ; not all bits clear, its 386+
- MOV cputype, 1 ; all bits clear, its 286, we are done
- JMP _done
- _386p:
- MOV cputype, 2 ; its 386 or newer, but we don't care if its newer at this point
- _done:
- POPF ; restore flags we backed up earlier
- }
- return cputype;
-}
-
-#ifdef TEST
-int main(int argc, char **argv)
-{
- const char *cpus;
- unsigned char cput;
+ /*const char *cpus, *fpus;
+ unsigned char cput, fput;
- cput = detectcpu();
+ cput = WCPU_detectcpu();
+ fput = WCPU_detectfpu();
switch(cput)
{
case 0: cpus = "8086/8088 or 186/88"; break;
case 2: cpus = "386 or newer"; break;
default: cpus = "internal error"; break;
}
+
+ switch(fput)
+ {
+ case 0: fpus = "none"; break;
+ case 1: fpus = "8087"; break;
+ default: fpus = "internal error"; break;
+ }
printf("detected CPU type: %s\n", cpus);
- return 0;
+ printf("detected FPU type: %s\n", fpus);*/
+ WCPU_cpufpumesg();
+ //if (cpu_flags & CPU_FLAG_FPU) printf(" - With FPU\n");
}
-#endif
-
//#define TEST
-byte detectcpu(void);
+byte WCPU_detectfpu(void);
+byte WCPU_detectcpu(void);
+const char *WCPU_cpudetectmesg();
+const char *WCPU_fpudetectmesg();
+void WCPU_cpufpumesg();
#endif/*_WCPU_H_*/
\r
#include "src/lib/scroll16.h"\r
#include "src/lib/16_timer.h"\r
-#include "src/lib/wcpu/wcpu.h"\r
#include "src/lib/16_dbg.h"\r
\r
//#define FADE\r
boolean panswitch=0;//1\r
//extern boolean pageflipflop=1;\r
unsigned int i;\r
- const char *cpus;\r
//static int persist_aniframe = 0; /* gonna be increased to 1 before being used, so 0 is ok for default */\r
\r
//map_view_db_t pgid[4];\r
printf("\nProject 16 scroll.exe. This is just a test file!\n");\r
printf("version %s\n", VERSION);\r
SCROLLEXITMESG;\r
- switch(detectcpu())\r
- {\r
- case 0: cpus = "8086/8088 or 186/88"; break;\r
- case 1: cpus = "286"; break;\r
- case 2: cpus = "386 or newer"; break;\r
- default: cpus = "internal error"; break;\r
- }\r
- printf("detected CPU type: %s\n", cpus);\r
+ WCPU_cpufpumesg();\r
#ifdef MODEX\r
#ifdef FADE\r
modexFadeOn(4, dpal);\r
--- /dev/null
+; To assemble the code using MASM 5.10:
+; MASM cputype;
+; LINK cputype;
+; EXE2COM cputype;
+; Version: 1.00b
+
+; Author: Ben Lunt (Forever Young Software)
+
+; Date: 20 Nov 1997
+
+; If you need an EXE to COM converter, you can get one here
+;
+; The following code won't assemble with NBASM yet, since
+; I have not added all the FPU instructions. I hope to get to them soon.
+; Until then, you will have to use a different assembler. Sorry.
+;
+
+CodeSeg segment
+ assume cs:CodeSeg, ds:CodeSeg, es:CodeSeg
+.186
+ org 100h
+start: mov ax,cs ; free unused part of Mem Block
+ mov es,ax ; for .COM file format
+ mov bx,4096 ;
+ mov ah,4Ah ;
+ int 21h ;
+
+ mov cx,0121h ; If CH can be shifted by 21h,
+ shl ch,cl ; then it's an 8086, because
+ jz short p1_8086 ; a 186+ limits shift counts.
+ push sp ; If SP is pushed as its
+ pop ax ; original value, then
+ cmp ax,sp ; it's a 286+.
+ jne short p1_186
+ mov ax,7000h ; if bits 12,13,14 are still set
+ push ax ; after pushing/poping to/from
+ popf ; the flags register then we have
+ pushf ; a 386+
+ pop ax
+ and ax,7000h
+ cmp ax,7000h
+ jne short p1_286 ; it's a 386+
+.386
+ push bp ; Align stack to dword
+ mov bp,sp
+ and sp,0FFFCh
+ pushfd ; Save eflags
+ cli ; No interrupts
+ pushfd ; EAX = eflags
+ pop eax
+ mov ebx,eax ; EBX = eflags
+ xor eax,40000h ; Toggle AC bit
+ push eax ; Eflags = EAX
+ popfd
+ pushfd ; EAX = eflags
+ pop eax
+ popfd ; Restore eflags
+ mov sp,bp ; Restore stack
+ pop bp
+ cmp eax,ebx ; If the bit was not
+ je short p1_386 ; reset, it's a 486+
+ pushfd ; Save eflags
+ cli ; No interrupts
+ pushfd ; EAX = eflags
+ pop eax
+ xor eax,200000h ; Toggle ID bit
+ push eax ; Eflags = EAX
+ popfd
+ pushfd ; EBX = eflags
+ pop ebx
+ popfd ; Restore eflags
+ cmp eax,ebx ; If the bit was not
+ jne short p1_486 ; reset, it's a 586+
+ mov dx,offset CPUType5 ; 586+
+ jmp short cpudone
+p1_486: mov dx,offset CPUType4 ; 486
+ jmp short cpudone
+p1_386: mov dx,offset CPUType3 ; 386
+ jmp short cpudone
+p1_286: mov dx,offset CPUType2 ; 286
+ jmp short cpudone
+p1_186: mov dx,offset CPUType1 ; 186
+ jmp short cpudone
+p1_8086: mov dx,offset CPUType0 ; 8086
+cpudone: mov ah,09
+ int 21h
+.186 ; make sure we set proc back to 186
+.8087 fninit ; Initialize FPU
+ mov _Junk,55AAh ; Set junk value
+ fnstsw _Junk ; Store status word
+ cmp _Junk,0 ; If it's not 0, no FPU
+ jne short p2_nofpu
+ fnstcw _Junk ; Store control word
+ mov ax,_Junk ; If the bits are not the way
+ and ax,103Fh ; they should be, no FPU
+ cmp ax,3Fh
+ jne short p2_nofpu
+
+ and _Junk,0FF7Fh ; Clear interrupt bit
+ fldcw _Junk ; Load control word
+ fdisi ; Disable interrupts
+ fstcw _Junk ; Store control word
+ test _Junk,80h ; If it changed, it's an 8087
+ jnz short p2_8087
+.286 ; allowes .287 also
+ finit ; Re-initialize
+ fld1 ; Divide 1 by 0 to get
+ fldz ; a positive infinity
+ fdiv
+ fld st ; Get a negative infinity
+ fchs
+ fcompp ; Compare them
+ fstsw ax ; Store status word
+ sahf ; If the FPU thought that they
+ je short p2_287 ; were equal, it's a 287
+ mov dx,offset FPUType3 ; 387
+ finit ; Init processor
+ jmp short fputypeD
+p2_287: mov dx,offset FPUType2 ; 287
+ finit ; Init processor
+ jmp short fputypeD
+p2_8087: mov dx,offset FPUType0 ; 8087
+ finit ; Init processor
+ jmp short fputypeD
+p2_nofpu: mov dx,offset FPUType
+fputypeD: mov ah,09
+ int 21h
+.186
+.8087
+ ret
+
+
+_Junk dw 00h
+CPUType0 db 13,10,'You have an 8086/88 processor.$'
+CPUType1 db 13,10,'You have an 186/88 processor.$'
+CPUType2 db 13,10,'You have an 286 processor.$'
+CPUType3 db 13,10,'You have an 386 processor.$'
+CPUType4 db 13,10,'You have an 486 processor.$'
+CPUType5 db 13,10,'You have an 586 or better processor.$'
+
+FPUType db 13,10,"You don't have a math coprocessor.$"
+FPUType0 db 13,10,'You have an 8087 math coprocessor.$'
+FPUType2 db 13,10,'You have an 287 math coprocessor.$'
+FPUType3 db 13,10,'You have an 387 or better math coprocessor.$'
+
+CodeSeg ends
+ end start
\r
#include "src/lib/scroll16.h"\r
#include "src/lib/16_timer.h"\r
-#include "src/lib/wcpu/wcpu.h"\r
#include "src/lib/16render.h"\r
#include "src/lib/16_dbg.h"\r
\r
boolean panswitch=0,baka=0;\r
//extern boolean pageflipflop=1;\r
unsigned int i;\r
-const char *cpus;\r
//static int persist_aniframe = 0; /* gonna be increased to 1 before being used, so 0 is ok for default */\r
\r
//map_view_db_t pgid[4];\r
printf("\nProject 16 zcroll.exe. This is just a test file!\n");\r
printf("version %s\n", VERSION);\r
SCROLLEXITMESG;\r
- switch(detectcpu())\r
- {\r
- case 0: cpus = "8086/8088 or 186/88"; break;\r
- case 1: cpus = "286"; break;\r
- case 2: cpus = "386 or newer"; break;\r
- default: cpus = "internal error"; break;\r
- }\r
- printf("detected CPU type: %s\n", cpus);\r
+ WCPU_cpufpumesg();\r
#ifdef FADE\r
modexFadeOn(4, dpal);\r
#endif\r