From 9d2e695368be048b781583c1d7773a77830d28bd Mon Sep 17 00:00:00 2001 From: Naren Surampudi Date: Mon, 15 Oct 2018 15:21:48 +0530 Subject: [PATCH 1/2] Expanded proto.md --- docs/assembler/masm/proto.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/assembler/masm/proto.md b/docs/assembler/masm/proto.md index 4d6df6754c..fc24ad5fce 100644 --- a/docs/assembler/masm/proto.md +++ b/docs/assembler/masm/proto.md @@ -14,12 +14,22 @@ ms.workload: ["cplusplus"] --- # PROTO -Prototypes a function. +Prototypes a function/procedure. The prototype created by the PROTO directive can then be called with the [INVOKE](https://docs.microsoft.com/en-us/cpp/assembler/masm/invoke?view=vs-2017) directive. ## Syntax > *label* PROTO [[*distance*]] [[*langtype*]] [[, [[*parameter*]]:*tag*]]... +> *langtype*: Parameter that sets the calling and naming convention for procedures and public symbols. They can be divided into: +>1. 32-bit: C, STDCALL +>2. 16-bit: C, BASIC, FORTRAN, PASCAL SYSCALL, STDCALL + +>Choice of *langtype* (16 or 32-bit) depends on the target platform. + +>Example:
addup3 PROTO NEAR C, argcount:WORD, arg1:VARARG + ## See also -[Directives Reference](../../assembler/masm/directives-reference.md)
\ No newline at end of file +[Directives Reference](../../assembler/masm/directives-reference.md)
+[.MODEL Reference](https://msdn.microsoft.com/en-us/library/ss9fh0d6.aspx)
+[MASM Programmer's Guide (Version 6.1)](http://people.sju.edu/~ggrevera/arch/references/MASM61PROGUIDE.pdf)
From 0022c9e7126a12861338932f5686d26e9f6c8873 Mon Sep 17 00:00:00 2001 From: Colin Robertson Date: Mon, 22 Oct 2018 14:16:51 -0700 Subject: [PATCH 2/2] Update proto.md @nsurampu Thanks for your useful additions here. I've done some editing to bring the whole topic up to our current documentation standards. --- docs/assembler/masm/proto.md | 44 +++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/docs/assembler/masm/proto.md b/docs/assembler/masm/proto.md index fc24ad5fce..25491dc441 100644 --- a/docs/assembler/masm/proto.md +++ b/docs/assembler/masm/proto.md @@ -1,7 +1,7 @@ --- title: "PROTO | Microsoft Docs" ms.custom: "" -ms.date: "08/30/2018" +ms.date: "10/22/2018" ms.technology: ["cpp-masm"] ms.topic: "reference" f1_keywords: ["PROTO"] @@ -14,22 +14,44 @@ ms.workload: ["cplusplus"] --- # PROTO -Prototypes a function/procedure. The prototype created by the PROTO directive can then be called with the [INVOKE](https://docs.microsoft.com/en-us/cpp/assembler/masm/invoke?view=vs-2017) directive. +Prototypes a function or procedure. You can call the function prototyped by the PROTO directive by using the [INVOKE](https://docs.microsoft.com/en-us/cpp/assembler/masm/invoke?view=vs-2017) directive. ## Syntax -> *label* PROTO [[*distance*]] [[*langtype*]] [[, [[*parameter*]]:*tag*]]... +> *label* **PROTO** \[*distance*] \[*langtype*] \[__,__ \[*parameter*]__:__*tag*] ... -> *langtype*: Parameter that sets the calling and naming convention for procedures and public symbols. They can be divided into: ->1. 32-bit: C, STDCALL ->2. 16-bit: C, BASIC, FORTRAN, PASCAL SYSCALL, STDCALL +### Parameters ->Choice of *langtype* (16 or 32-bit) depends on the target platform. +*label*
+The name of the prototyped function. ->Example:
addup3 PROTO NEAR C, argcount:WORD, arg1:VARARG +*distance*
+(Optional) Used in 16-bit memory models to override the default and indicate **NEAR** or **FAR** calls. + +*langtype*
+(Optional) Sets the calling and naming convention for procedures and public symbols. Supported conventions are: + +- 32-bit **FLAT** model: **C**, **STDCALL** + +- 16-bit models: **C**, **BASIC**, **FORTRAN**, **PASCAL**, **SYSCALL**, **STDCALL** + +*parameter*
+The optional name for a function parameter. + +*tag*
+The type of a function parameter. + +The *parameter* and *tag* parameters may appear multiple times, once for each passed argument. + +## Example + +This sample shows a **PROTO** declaration for a function named `addup3` that uses a **NEAR** call to override the 16-bit model default for procedure calls, and uses the **C** calling convention for stack parameters and return values. It takes two arguments, a **WORD** and a **VARARG**. + +```MASM +addup3 PROTO NEAR C, argcount:WORD, arg1:VARARG +``` ## See also -[Directives Reference](../../assembler/masm/directives-reference.md)
-[.MODEL Reference](https://msdn.microsoft.com/en-us/library/ss9fh0d6.aspx)
-[MASM Programmer's Guide (Version 6.1)](http://people.sju.edu/~ggrevera/arch/references/MASM61PROGUIDE.pdf)
+[Directives Reference](directives-reference.md)
+[.MODEL Reference](dot-model.md)