Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 121185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:55:48+00:00 2026-05-11T03:55:48+00:00

I am writing an assignment in MASM32 Assembly and I almost completed it but

  • 0

I am writing an assignment in MASM32 Assembly and I almost completed it but I have 2 questions I can’t seem to answer. First, when I compile I get the message:

INVOKE requires prototype for procedure

&

invalid instruction operands

the first is due to this piece of code:

.data? Freq    DWORD ? Time1   DWORD ? Time2   DWORD ?  .code start: invoke QueryPerformanceFrequency, addr Freq invoke QueryPerformanceCounter, addr Time1  

now, I know that

The INVOKE directive must be preceded by a PROTO statement for the procedure being called.

but even though I found out the syntax for the PROTO statement:

label PROTO [distance] [langtype] [,[parameter]:tag] 

I don’t understand exactly what I should write so as to make it work and I don’t even know what is causing the second error or how to fix it…=/


Edit

I already have those libraries and these also:

.386 .model flat, stdcall option casemap :none  include \masm32\include\windows.inc include \masm32\include\kernel32.inc include \masm32\include\masm32.inc includelib \masm32\lib\kernel32.lib includelib \masm32\lib\masm32.lib 

I’m working under Windows Vista just in case that helps as well.


Edit 2

If I write the Freq :QWORD after the .data I get this error message:

use of register assumed to ERROR

and also where should I add the

QueryPerformanceCounter PROTO :DWORD 

Which as far as I know didn’t make an error but still I’m not sure changed anything (I placed it before .data and after the libraries).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T03:55:49+00:00Added an answer on May 11, 2026 at 3:55 am

    In order to call an external API you need to include the appropriate *.inc file as well as the respective *.lib file.
    Try to add these statements to your listing:

    include \masm32\include\kernel32.inc includelib \masm32\lib\kernel32.lib 

    (assuming \masm32 referes to your masm32 dir)

    Update:
    The prototype definition basically tells the assembler how many parameters the respective function expects on the stack. In your case the API expects one 32bit parameter to be on the stack, which is reflected by the prototype like this:

    QueryPerformanceCounter PROTO :DWORD 

    Update2:
    In order to use the performance counter API you need a quadword. The reason is, that the API expects a pointer to a quadword (64 bit) as the parameter (therefore the DWORD in the prototype):

    LOCAL Freq  :QWORD invoke QueryPerformanceFrequency, ADDR Freq 

    This should do the trick.

    Update3:
    So here’s a complete example which works for me:

        .486     .model flat, stdcall     option casemap :none      include \masm32\include\windows.inc     include \masm32\include\kernel32.inc     include \masm32\include\masm32.inc      includelib \masm32\lib\kernel32.lib     includelib \masm32\lib\masm32.lib      doPerf     PROTO  .code  start:      invoke doPerf     invoke ExitProcess,eax      doPerf proc          LOCAL Freq  :QWORD         invoke QueryPerformanceFrequency, ADDR Freq         mov esi, dword ptr Freq         mov edi, dword ptr Freq+4          ret      doPerf endp  end start  

    I guess that’s it 🙂 ESI and EDI now contain the result.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is part of my first comp sci assignment, we are writing a C
I have an assignment where I am writing input on various things (in the
I'm writing a little thing for an assignment, and I have to manage TCP
I'm writing a program for a homework assignment. The program compiles and runs, but
I'm writing an assignment which involves adding some functionality to PostgreSQL on a Solaris
I'm currently writing a very simple game engine for an assignment and to make
I'm writing a little genetic algorithm in Java, as a school assignment. Up until
In a simple RMI game I'm writing (an assignment in uni), I reveice: java.rmi.MarshalException:
I was writing two implementations of a Linked List for an assignment, a Doubly
BACKGROUND: I'm writing a single level cache simulator in C for a homework assignment,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.