Index | PAL Intro | Commands | Registers | Indices | Stack | Macros | Classes | Attributes | Errors


Manual Reference Pages  - pal_macros (5)

NAME

pal_macros - Introduction to PAL macros

CONTENTS

Pre-requisite Reading
Description
Macros
Examples
See Also
Author

PRE-REQUISITE READING

Please see pal_intro(5) for a general description of PAL.

DESCRIPTION

PAL data entry macros are used for inserting sequences of data (known as "data segments") into a PROSE binary. This data can then be referenced by assembly commands.

A new data segment is begun when a data label is encountered in a PAL source file, using the syntax ~data_label. All data entry macros that appear immediately following this label, and before the next label, insert data into this data segment. The data segment is identified by the data_label, which must be unique within the source file.

MACROS

Data within a macro is enclosed within curly braces {}, and multiple data items within curly braces are separated by commas. All data is stored in the current data segment, whether it is provided within one set of braces, or with multiple data entry macros.

There are five types of macro:
EQUS The "equate string" macro is used for entering a sequence of ASCII characters. Each data item is a text string enclosed within square brackets [], and follows the same rules as for arbitrary text indices (see pal_indices(5)). The text string will be terminated by a zero byte.
EQUB The "equate byte" macro is used for entering a sequence of bytes. Each data item may be an 8-bit number, represented as decimal, hexadecimal or octal.
EQUW The "equate word" macro is used for entering a sequence of 16-bit words. Each data item may be a 16-bit number, represented as decimal, hexadecimal or octal.
EQUD The "equate double-word" macro is used for entering a sequence of 32-bit words. Each data item may be a 32-bit number, represented as decimal, hexadecimal or octal.
EQUI The "equate index" macro is used for entering a sequence of 32-bit raw index numbers. This is functionally equivalent to EQUD except that the data is stored more efficiently for numbers in the hexadecimal range 0 - ffff.
EQUP The "equate pointer" macro is used for entering code or data pointers.

EXAMPLES

The following example encodes six names in a single data segment. Each name will be separated by a zero byte:

~composers  
EQUS {[Mozart], [Beethoven], [Shostakovich]}
EQUS {[Liszt], [Handel], [Vivaldi]}

The following example encodes the same six names, but using a combination of bytes, words and double-words:

~composers  
EQUD { 0x4d6f7a61, 0x72740042, 0x65657468, 0x6f76656e }
EQUD { 0x0053686f, 0x7374616b, 0x6f766963, 0x68004c69 }
EQUD { 0x737a7400, 0x48616e64, 0x656c0056, 0x6976616c }
EQUW { 0x6469 }
EQUB { 0 }

The following example encodes a combination of code and data segment pointers:

~pointers  
EQUP { &[~data1], &[.code1] }
EQUP { &[~data2], &[.code2] }
EQUP { &[~data3], &[.code3] }

SEE ALSO

pal_intro(5), pal_commands(5), reg_load_segment(5), prism(1),
PROSE Assembly Language at prose.sourceforge.net.

AUTHOR

Copyright (c) 2002-2009 Mark R. Bannister <cambridge@users.sourceforge.net>.

This is free software and can be downloaded from prose.sourceforge.net; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


PAL 1.0 pal_macros (5) 4 December 2009
Generated by manServer 1.07 from man5/pal_macros.5 using man macros.