From: sparky4 Date: Fri, 28 Nov 2014 18:51:32 +0000 (-0600) Subject: modified: Project 16.bfproject X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=d03dce3e0df47637bf23f9e2a5b26cf4d32a79f5;p=16.git modified: Project 16.bfproject new file: lib/wtest/WTEST.EXE new file: lib/wtest/makefile new file: lib/wtest/wtest.c new file: lib/wtest/wtest.h modified: scroll.c modified: scroll.exe --- diff --git a/Project 16.bfproject b/Project 16.bfproject index 19290bca..af705867 100644 --- a/Project 16.bfproject +++ b/Project 16.bfproject @@ -1,13 +1,13 @@ c2e.convert_special: 0 e2c.convert_num: 0 openfiles: /dos/z/16/doc/project.txt:60:0:0: -openfiles: /dos/z/16/scroll.c:3046:2949:1: +openfiles: /dos/z/16/scroll.c:10823:10140:1: openfiles: /dos/z/16/modex16.c:6838:6141:0: openfiles: /dos/z/16/modex16.h:1057:344:0: openfiles: /dos/z/16/pcxtest.c:753:655:0: -openfiles: /dos/z/16/dos_kb.c:3759:2440:0: +openfiles: /dos/z/16/dos_kb.c:3759:0:0: openfiles: /dos/z/16/dos_kb.h:464:0:0: -openfiles: /dos/z/16/lib/lib_head.h:1738:1347:0: +openfiles: /dos/z/16/lib/lib_head.h:2536:0:0: openfiles: /dos/z/16/makefile:181:0:0: openfiles: /dos/z/keen-src/id_mm.c:1835:14248:0: openfiles: /dos/z/keen-src/id_mm.h:0:1024:0: @@ -33,6 +33,7 @@ ssearch_text: dxThresh snr_casesens: 1 view_blocks: 1 name: project 16 +replacelist: wPage(spri replacelist: 34); replacelist: bg replacelist: dest @@ -47,7 +48,6 @@ replacelist: modexShowPage(spri replacelist: player.tx == player.ty replacelist: TRIGGY replacelist: TRIGGX -replacelist: play-> fb_show_hidden_f: 0 editor_tab_width: 4 show_visible_spacing: 1 @@ -95,22 +95,22 @@ recent_files: file:///dos/z/16/16/lib/x/MODEX.H recent_files: file:///dos/z/16/16/modex16/dos_kb.h recent_files: file:///dos/z/16/doc/16.16 recent_files: file:///dos/z/16/doc/16story.txt +recent_files: file:///dos/z/16/README recent_files: file:///dos/z/16/scroll.c recent_files: file:///dos/z/16/doc/project.txt -recent_files: file:///dos/z/16/lib/lib_head.h recent_files: file:///dos/z/16/dos_kb.h recent_files: file:///dos/z/16/dos_kb.c -recent_files: file:///dos/z/16/modex16.h -recent_files: file:///dos/z/16/pcxtest.c -recent_files: file:///dos/z/16/README +recent_files: file:///dos/z/16/lib/lib_head.h recent_files: file:///dos/z/16/modex16.c -recent_files: file:///dos/z/16/makefile +recent_files: file:///dos/z/16/modex16.h +recent_files: file:///dos/z/keen-src/id_rf.h recent_files: file:///dos/z/16/types.h recent_files: file:///dos/z/keen-src/id_mm.h -recent_files: file:///dos/z/keen-src/id_mm.c +recent_files: file:///dos/z/16/makefile +recent_files: file:///dos/z/16/pcxtest.c recent_files: file:///dos/z/keen-src/id_rf_a.asm +recent_files: file:///dos/z/keen-src/id_mm.c recent_files: file:///dos/z/keen-src/id_rf.c -recent_files: file:///dos/z/keen-src/id_rf.h snr_replacetype: 0 savedir: file:///dos/z/16 spell_check_default: 1 @@ -122,6 +122,7 @@ snr_escape_chars: 0 htmlbar_view: 0 spell_lang: en ssearch_dotmatchall: 0 +searchlist: return searchlist: enter searchlist: bg->tx == bg->ty searchlist: data @@ -136,7 +137,6 @@ searchlist: MAPY/2 searchlist: MAPX/2 searchlist: mapDrawTile searchlist: dxThresh -searchlist: player. autocomplete: 1 outputb_show_all_output: 0 bookmarks_show_mode: 0 diff --git a/lib/wtest/WTEST.EXE b/lib/wtest/WTEST.EXE new file mode 100644 index 00000000..c02a8f8c Binary files /dev/null and b/lib/wtest/WTEST.EXE differ diff --git a/lib/wtest/makefile b/lib/wtest/makefile new file mode 100644 index 00000000..8e16c03f --- /dev/null +++ b/lib/wtest/makefile @@ -0,0 +1,14 @@ +CFLAGS=-0 + +all: wtest.exe + +wtest.exe: wtest.obj + wcl $(CFLAGS) $< + +wtest.obj: wtest.c + wcl $(CFLAGS) -c $< + +.NOCHECK +clean: + del *.exe + del *.obj diff --git a/lib/wtest/wtest.c b/lib/wtest/wtest.c new file mode 100644 index 00000000..dacabb25 --- /dev/null +++ b/lib/wtest/wtest.c @@ -0,0 +1,63 @@ +/* tab size = 8 */ + +#include "lib\wtest\wtest.h" + +static unsigned char detectcpu() +{ + unsigned char cputype; + __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; +} + +/*int main(int argc, char **argv) +{ + const char *cpus; + unsigned char cput; + + cput = detectcpu(); + switch(cput) + { + case 0: cpus = "8086/8088 or 186/88"; break; + case 1: cpus = "286"; break; + case 2: cpus = "386 or newer"; break; + default: cpus = "internal error"; break; + } + printf("detected CPU type: %s\n", cpus); + return 0; +}*/ + diff --git a/lib/wtest/wtest.h b/lib/wtest/wtest.h new file mode 100644 index 00000000..81455803 --- /dev/null +++ b/lib/wtest/wtest.h @@ -0,0 +1,7 @@ +#ifndef _WTEST_H_ +#define _WTEST_H_ +#include + +static unsigned char detectcpu(void); + +#endif/*_WTEST_H_*/ diff --git a/scroll.c b/scroll.c index 919aabcb..846fcff5 100644 --- a/scroll.c +++ b/scroll.c @@ -2,6 +2,7 @@ #include #include #include "dos_kb.h" +#include "lib\wtest\wtest.c" //word far *clock= (word far*) 0x046C; /* 18.2hz clock */ @@ -68,6 +69,7 @@ void animatePlayer(map_view_t *src, map_view_t *dest, /*map_view_t *top, */short void main() { bitmap_t ptmp; // player sprite word q=1; + const char *cpus; static int persist_aniframe = 0; /* gonna be increased to 1 before being used, so 0 is ok for default */ page_t screen, screen2, screen3; map_t map; @@ -337,7 +339,15 @@ break; printf("player.triggy: %d\n", player.triggery); printf("dxThresh: %d\n", bg->dxThresh); printf("dyThresh: %d\n", bg->dyThresh); - printf("temporary player sprite http://www.pixiv.net/member_illust.php?mode=medium&illust_id=45556867"); + printf("temporary player sprite http://www.pixiv.net/member_illust.php?mode=medium&illust_id=45556867\n"); + switch(detectcpu()) + { + case 0: cpus = "8086/8088 or 186/88"; break; + case 1: cpus = "286"; break; + case 2: cpus = "386 or newer"; break; + default: cpus = "internal error"; break; + } + printf("detected CPU type: %s\n", cpus); } @@ -598,5 +608,5 @@ animatePlayer(map_view_t *src, map_view_t *dest, /*map_view_t *top, */short d1, //modexClearRegion(top->page, 66, 66, 2, 40, 0); //modexCopyPageRegion(dest->page, top->page, 66, 66, 66, 66, 2, 40); //turn this off if XT - modexWaitBorder(); + if(detectcpu() > 0) modexWaitBorder(); } diff --git a/scroll.exe b/scroll.exe index 8f65d820..b7a01727 100644 Binary files a/scroll.exe and b/scroll.exe differ