News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Test Programs

Started by NightWare, June 08, 2007, 08:31:33 PM

Previous topic - Next topic

NightWare

hi all,

here, noting to see with speed test programs (in fact, not directly), it's just programs to test some of my algos, i post them because it could be interesting for someone who whant to understand mmx stuff... i hope...

1) Demo_Starfield :
it's a draw line/point test (i've already posted it, but this one is, for several reasons, a bit better)

2) Demo_Sprites :
it's a draw sprite/gfx string test (i know, there is a lot of "asm code" for sprites, but those codes are NOT asm code !, it's just poor win api calls by asm, you must admit it's completly different...)

ho... and, as always... it's in french... apologies...  :red




[attachment deleted by admin]

rags

Thanks for the demos.
On my AMD 2500 Sempron, with 1.5 GB ram and  ATI 9550 video card, I am getting 144 FPS for the starfield demo,
and 154 FPS for the sprite demo. Are these good results for your demos?
Rags
God made Man, but the monkey applied the glue -DEVO

NightWare

Quote from: rags on June 09, 2007, 11:39:29 PM
Are these good results for your demos?

:dazzled: no idea... i've just 40 fps on my celeron 700, or 130 fps on my P4... both are obsolet machine, but it's better to produce really optimized code...

the purpose of those programs is to quicly draw stuff on screen without using gdi/direct draw/etc... and without the need of an expensive gfx board. so if you consider the fps result is acceptable then it's acceptable...  :wink


sinsi

I'm getting ~147 for starfield and 255 for sprites on an Athlon 2600, 1 gig RAM and ATI 9600 Pro on XPHSP2 - the sprite demo sticks at 255 - could it go higher?
Light travels faster than sound, that's why some people seem bright until you hear them.

askm

The Starfield works with no error message.

The Sprites does not.
Windows 2000, Service Pack 4, Pentium 4 CPU 1.6GHz.
Message:
Program Error
Sprites.exe has generated errors...

askm

NightWare

to sinsi,

255 ? in that case i suppose you speak about the sprite alpha (you can increase/decrease it with pageup/pagedown keys with a step of 8), so it can't exceed 255. otherwise there is no fps limit (in fact there is one, but it's 7FFFFFFFh)

but in that case, it seems you can't see the moving "fps" gfx string... and i don't known how it's possible...


to askm,

i haven't win2000 OS, can you give me more informations (for example with ollydbg... where the problem happen...)


to all,

wow, it's seems there is problems with sprtite demo... anyone else has a problem with this code ?

askm


OllyDbg - Sprites.exe - [CPU - main thread, module user32]

77E41DCB   A1 78D3E677      MOV EAX,DWORD PTR DS:[77E6D378]
77E41DD0   F640 02 04       TEST BYTE PTR DS:[EAX+2],4
77E41DD4   0F85 D11C0000    JNZ user32.77E43AAB
77E41DDA   8B45 DC          MOV EAX,DWORD PTR SS:[EBP-24]
77E41DDD   8906             MOV DWORD PTR DS:[ESI],EAX

-pane
EAX=00000000
DS:[FFFFFFA3]=???
-pane

-registers
EAX 00000000
ECX 00000000
EDX 00000000
EBX C0000000
ESP 0012FF3C
EBP 0012FFAC
ESI FFFFFFA3
EDI FFFFFF97
EIP 77E41DDD user32.77E41DDD
C 0  ES 0023 32bit 0(FFFFFFFF)
P 1  CS 001B 32bit 0(FFFFFFFF)
A 0  SS 0023 32bit 0(FFFFFFFF)
Z 1  DS 0023 32bit 0(FFFFFFFF)
S 0  FS 0038 32bit 7FFDE000(FFF)
T 1  GS 0000 NULL
D 0
O 0  LastErr ERROR_SUCCESS (00000000)
EFL 00200346 (NO,NB,E,BE,NS,PE,GE,LE)
ST0 empty 0.0
ST1 empty 0.0
ST2 empty 0.0
ST3 empty 0.0
ST4 empty 0.0
ST5 empty 0.0
ST6 empty 0.0
ST7 empty -UNORM C4C0 00000020 00000000
               3 2 1 0      E S P U O Z D I
FST 0000  Cond 0 0 0 0  Err 0 0 0 0 0 0 0 0  (GT)
FCW 027F  Prec NEAR,53  Mask    1 1 1 1 1 1

askm

sinsi

Oops, excuse my French - it was late, I was drunk, etc.
Yes, ~153 fps for sprites.
Light travels faster than sound, that's why some people seem bright until you hear them.

NightWare

sinsi,

:wink

askm,

:U thanks, i don't need more, i'll take a look to see what's wrong...

NightWare

#9
Quote from: askm on June 10, 2007, 10:08:39 PM
77E41DCB   A1 78D3E677      MOV EAX,DWORD PTR DS:[77E6D378]
77E41DD0   F640 02 04       TEST BYTE PTR DS:[EAX+2],4
77E41DD4   0F85 D11C0000    JNZ user32.77E43AAB
77E41DDA   8B45 DC          MOV EAX,DWORD PTR SS:[EBP-24]
77E41DDD   8906             MOV DWORD PTR DS:[ESI],EAX

it clearly appear the problem doesn't happen inside my code, so it's win2000 (coz i'm pretty sure of my code... and it work on another OS...), so there is a prob with a win 2000 api... i'm going to suppose all the api do their job (yeah... i known i souldn't...), so it's possibly the interaction... humm... register preservation ? (in theory no !, coz the rules are clear since win nt... but laws and microsoft...), so i quickly made a macro and replace all invoke by Invoke2000 (with theorical unnecessary pushs pops)... askm, can you test it ?
i hope it will solve the problem, otherwise it will become difficult without win2000...
there is no slowdown coz none api are used intensively in this code, and this one should work even on win9x...

[attachment deleted by admin]

askm

With your latest exe these results.

<Win98SEerrror>
SPRITES caused an invalid page fault in
module KERNEL32.DLL at 0177:bff73641.
Registers:
EAX=00000000 CS=0177 EIP=bff73641 EFLGS=00210246
EBX=0063fd34 SS=017f ESP=ffffff83 EBP=0063fd00
ECX=00000000 DS=017f ESI=000000b2 FS=221f
EDX=00008d74 ES=017f EDI=ffffff83 GS=0000
Bytes at CS:EIP:
5f 5e c9 c2 0c 00 52 51 33 c0 48 50 50 65 ff 32
Stack dump:

</Win98SEerrror>



<win2000error>

These occur in a loop...

"Breakpoint at ntdll.KiUserExceptionDispatcher" in OllyDbg statusbar...

ntdll.77F91BB8 > 8B4C24 04        MOV ECX,DWORD PTR SS:[ESP+4]
77F91BBC   8B1C24           MOV EBX,DWORD PTR SS:[ESP]
77F91BBF   51               PUSH ECX
77F91BC0   53               PUSH EBX
77F91BC1   E8 ECAF0100      CALL ntdll.77FACBB2

Registers copy at this breakpoint:
EAX 00000000
ECX 00000000
EDX 00000000
EBX C0000000
ESP 0012FC3C
EBP 0012FF9C
ESI 0000009E
EDI FFFFFFF1
EIP 77F91BB8 ntdll.KiUserExceptionDispatcher
C 0  ES 0023 32bit 0(FFFFFFFF)
P 1  CS 001B 32bit 0(FFFFFFFF)
A 0  SS 0023 32bit 0(FFFFFFFF)
Z 1  DS 0023 32bit 0(FFFFFFFF)
S 0  FS 003B 32bit 7FFDE000(FFF)
T 1  GS 0000 NULL
D 0
O 0  LastErr ERROR_SUCCESS (00000000)
EFL 00200346 (NO,NB,E,BE,NS,PE,GE,LE)
ST0 empty 0.0
ST1 empty 0.0
ST2 empty 0.0
ST3 empty 0.0
ST4 empty 0.0
ST5 empty 0.0
ST6 empty 0.0
ST7 empty -UNORM C4C0 00000020 00000000
               3 2 1 0      E S P U O Z D I
FST 0000  Cond 0 0 0 0  Err 0 0 0 0 0 0 0 0  (GT)
FCW 027F  Prec NEAR,53  Mask    1 1 1 1 1 1

...

kernel32.7C5989B3   E8 95340000      CALL kernel32.UnhandledExceptionFilter
...
7C59BEB4   E8 6CBAFFFF      CALL kernel32.GetCurrentProcess

...
ntdll.77F91BDC   E8 7B6EFFFF      CALL ntdll.ZwRaiseException

...

user32.77E41DC3   50               PUSH EAX
77E41DC4   E8 AEF7FFFF      CALL user32.77E41577
77E41DC9   8BC8             MOV ECX,EAX
77E41DCB   A1 78D3E677      MOV EAX,DWORD PTR DS:[77E6D378]
77E41DD0   F640 02 04       TEST BYTE PTR DS:[EAX+2],4
77E41DD4   0F85 D11C0000    JNZ user32.77E43AAB
77E41DDA   8B45 DC          MOV EAX,DWORD PTR SS:[EBP-24]
77E41DDD   8906             MOV DWORD PTR DS:[ESI],EAX

EAX=00000000
DS:[0000009E]=???

Shift + F7 press here and returns to ntdll.77F91BB8 above ^

77E41DDF   8BC1             MOV EAX,ECX
77E41DE1   8B4D F0          MOV ECX,DWORD PTR SS:[EBP-10]
77E41DE4   64:890D 00000000 MOV DWORD PTR FS:[0],ECX
77E41DEB   5F               POP EDI
77E41DEC   5E               POP ESI
77E41DED   5B               POP EBX
77E41DEE   C9               LEAVE
77E41DEF   C2 0800          RETN 8


Notice the ESI 0000009E above in registers copy ?

</win2000error>

sinsi

Just tried sprites on win2k/sp4 and crash! here's what the event log said
Quote
The application, , generated an application error The error occurred on 06/15/2007 @ 09:30:45.859 The exception generated was c0000005 at address 77E1463D (TranslateMessageEx)
It seems to happen when the mouse moves into the window.
Light travels faster than sound, that's why some people seem bright until you hear them.

hutch--

On my Win2000 sp4, with the sprites demo it runs for a second or so then GP faults. This is the disassembly of the fault from DrWatson.


function: GetWindowLongW
        77e41d27 f6801818e47780   test  byte ptr [eax+0x77e41818],0x80 ds:77e41818=00
        77e41d2e 0f85d878ffff     jne     GetQueueStatus+0x23 (77e3960c)
        77e41d34 3d19020000       cmp     eax,0x219
        77e41d39 0f84d91b0000     je      CharUpperBuffA+0x312 (77e43918)
        77e41d3f 33c0             xor     eax,eax
        77e41d41 3bc6             cmp     eax,esi
        77e41d43 0f85de1b0000     jne     CharUpperBuffA+0x321 (77e43927)
        77e41d49 8b5f04           mov     ebx,[edi+0x4]          ds:00a79f7c=4900000b
        77e41d4c 81fb13010000     cmp     ebx,0x113
        77e41d52 0f8429010000     je      DispatchMessageW+0xe (77e41e81)
        77e41d58 81fb18010000     cmp     ebx,0x118
        77e41d5e 0f841d010000     je      DispatchMessageW+0xe (77e41e81)
        77e41d64 3bce             cmp     ecx,esi
        77e41d66 0f849978ffff     je      GetQueueStatus+0x1c (77e39605)
        77e41d6c 8d7708           lea     esi,[edi+0x8]          ds:00a79f7c=4900000b
        77e41d6f 8b16             mov     edx,[esi]              ds:000000c8=????????
        77e41d71 8955dc           mov     [ebp+0xdc],edx         ss:00ba9e92=????????
        77e41d74 8a4116           mov     al,[ecx+0x16]                ds:00a79ee6=00
        77e41d77 a804             test    al,0x4
        77e41d79 0f8591a0ffff     jne     IntersectRect+0x75 (77e3be10)
        77e41d7f 83fb0f           cmp     ebx,0xf
        77e41d82 0f8488a0ffff     je      IntersectRect+0x75 (77e3be10)
        77e41d88 33c9             xor     ecx,ecx
        77e41d8a 394d0c           cmp     [ebp+0xc],ecx          ss:00ba9e92=????????
        77e41d8d 0f94c1           sete    cl
        77e41d90 f6d0             not     al
        77e41d92 c1e803           shr     eax,0x3
        77e41d95 6a01             push    0x1
        77e41d97 5b               pop     ebx
        77e41d98 23c3             and     eax,ebx
        77e41d9a 3bc8             cmp     ecx,eax
        77e41d9c 0f85c15cfeff     jne     DefWindowProcA+0x29 (77e27a63)
        77e41da2 bb000000c0       mov     ebx,0xc0000000
        77e41da7 8b4de4           mov     ecx,[ebp+0xe4]         ss:00ba9e92=????????
        77e41daa 8b415c           mov     eax,[ecx+0x5c]         ds:00a79ee6=00004a00
        77e41dad 8bd0             mov     edx,eax
        77e41daf 23d3             and     edx,ebx
        77e41db1 3bd3             cmp     edx,ebx
        77e41db3 0f84d81c0000     je      CharUpperBuffA+0x48b (77e43a91)
        77e41db9 ff770c           push    dword ptr [edi+0xc]    ds:00a79f7c=4900000b
        77e41dbc ff36             push    dword ptr [esi]        ds:000000c8=????????
        77e41dbe ff7704           push    dword ptr [edi+0x4]    ds:00a79f7c=4900000b
        77e41dc1 ff37             push    dword ptr [edi]        ds:00000096=????????
        77e41dc3 50               push    eax
        77e41dc4 e8aef7ffff       call    GetTopWindow+0x47a4 (77e41577)
        77e41dc9 8bc8             mov     ecx,eax
        77e41dcb a178d3e677       mov     eax,[77e6d378]         ds:77e6d378=003b0650
        77e41dd0 f6400204         test    byte ptr [eax+0x2],0x4       ds:00a79ee6=00
        77e41dd4 0f85d11c0000     jne     CharUpperBuffA+0x4a5 (77e43aab)
        77e41dda 8b45dc           mov     eax,[ebp+0xdc]         ss:00ba9e92=????????
FAULT ->77e41ddd 8906             mov     [esi],eax              ds:000000c8=????????
        77e41ddf 8bc1             mov     eax,ecx
        77e41de1 8b4df0           mov     ecx,[ebp+0xf0]         ss:00ba9e92=????????
        77e41de4 64890d00000000   mov     fs:[00000000],ecx      fs:00000000=????????
        77e41deb 5f               pop     edi
        77e41dec 5e               pop     esi
        77e41ded 5b               pop     ebx
        77e41dee c9               leave
        77e41def c20800           ret     0x8
        77e41df2 90               nop
        77e41df3 90               nop
        77e41df4 90               nop
        77e41df5 90               nop
        77e41df6 90               nop
        77e41df7 90               nop
        77e41df8 ffff             ???
        77e41dfa ffff             ???
        77e41dfc 53               push    ebx
        77e41dfd 39e4             cmp     esp,esp
        77e41dff 776b             ja      CharUpperBuffA+0x2166 (77e4576c)
        77e41e01 39e4             cmp     esp,esp
        77e41e03 7790             ja      CharUpperBuffA+0x788f (77e4ae95)
        77e41e05 90               nop
        77e41e06 90               nop
        77e41e07 90               nop
        77e41e08 90               nop
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

NightWare

i've updated the version for win2K

i haven't win2k, but i have an old version of win98se, so i spent some time to install it... i've fixed the code for win9x... and i hope it's also the case for win2k... as expected it was a register preservation problem... but it could'nt been fixed by the macro i've previously made... coz it was situated inside the windproc...

i hope it work for win2K now... please test it  :'(


sinsi

Light travels faster than sound, that's why some people seem bright until you hear them.