Jump to content

Making a Programming Language From Scratch/Function Definitions

From Wikibooks, open books for an open world

Function definitions

[edit | edit source]

There is nothing called functions in assembly. However, there is a mildly resembling counterpart called procedures. However procedures do not return any values. This critical problem will be discussed later on.

Syntax of function definition using PROC

[edit | edit source]

It is not a necessity to use the PROC keyword for all your function declarations. However it is much easier to do it this way instead of its counterpart method involving code segment pointers. The syntax for function definitions using PROC is as follows:

[ Func name ] PROC [param1] [param2]...
.
.
.
[ Func name ] ENDP

All functions have to be declared this way.