News:

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

TIMER.ASM generates exception

Started by jj2007, June 23, 2008, 04:09:39 PM

Previous topic - Next topic

jj2007

Is there any known restriction for \masm32\macros\timers.asm of 15.02.2005 ?
I get an exception for this code, which otherwise works smoothly. Full source attached.

Line 184:
LOOP_COUNT EQU NumLoops
; counter_begin LOOP_COUNT, HIGH_PRIORITY_CLASS
if 1 ; both ways to call it don't work
mov edx, offset Dw2BinBuffer
mov eax, 11111000001111100000111111110000b
call Dword2Bin
mov edx, offset Dw2BinBuffer
mov eax, 00001111100000111110000011111111b
call Dword2Bin
else
mov edx, BIN$(11111000001111100000111111110000b)
mov edx, BIN$(00001111100000111110000011111111b)
endif
; counter_end



[attachment deleted by admin]

jj2007

Problem solved - now it works like a charm! It's an attempt to speed up and down size the Masm32 dw2bin_ex algo:

39 cycles timing BIN$            139 bytes      460 LAMPs
45 cycles timing pbin            149 bytes      549 LAMPs
54 cycles timing pbin2           147 bytes      655 LAMPs
134 cycles timing dw2bin_ex      2140 bytes     6199 LAMPs
336 cycles timing Dword2Bin2     57 bytes       2537 LAMPs

LAMPs = Lean And Mean Points = cycles * sqrt(size)

For the record, and for others to learn: I made a stupid error; Sinsi had suggested the pbin algo starting like this:

OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE

pbin PROC PUBLIC num:DWORD,buf:DWORD
...
    ret 8
pbin ENDP

OPTION PROLOGUE:PrologueDef
OPTION EPILOGUE:EpilogueDef


Great. To speed things up (successfully  :green), I dropped num and buf and passed parameters in eax and ecx. What I forgot is to change the ret 8, which made the timers choke.

[attachment deleted by admin]