flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Examples and Tutorials > Simple Win32 timer DLL

Author
Thread Post new topic Reply to topic
fasmnewbie



Joined: 01 Mar 2011
Posts: 489

Simple Win32 timer DLL

Have lots of spare time today, so here goes nothing ;D

Attached is a simple timer DLL for Win32 meant to be accessed from C or probably C++. Actually I stole the code from BASELIB's "bkernel.asm" source. These two routines use QueryPerformanceCounter. You can use them without any time.h hassle in your source. Example


Code:
//
// Demo using timer functions from timer32.dll
// gcc -m32 this.c timer32.dll -o this.exe
//
#include <stdio.h>

extern inttimer_on();         //from timer32.dll
extern void timer_off(int *);   //from timer32.dll      

int main()
{
        double x = 45.3345;
        int *p = NULL;

        p = timer_on();
        
        //timed loop
        for (int y=1000; y > 0; y--) 
            printf("%.4f",x);

        timer_off(p);

        return (0);
}



Should print the output of the timed code and the output of timer in seconds. I would probably make the linux and 64-bit versions if time permits.

Source code, the DLL and C test code are attached. Happy working, peeps! ;D


Description:
Download
Filename: timer32.zip
Filesize: 4.3 KB
Downloaded: 34 Time(s)

Post 25 Jan 2018, 04:04
View user's profile Send private message Visit poster's website Reply with quote
yeohhs



Joined: 19 Jan 2004
Posts: 151
Location: N 5.43564° E 100.3091°

Thanks for sharing. Very Happy Happy playing!

_________________
鸟⼉唱歌不是因为它们有了答案,⽽是因为它们有歌要唱。
Post 26 Jan 2018, 00:45
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2017, Tomasz Grysztar.