• Keine Ergebnisse gefunden

ROUTINE DELIMITING DIRECTIVES

Im Dokument 3 System 1 (Seite 103-107)

- Absolute Ref

1.9.4 ASSEMBLER DIRECTIVES: OVERVIEW

1.9.4.1 ROUTINE DELIMITING DIRECTIVES

valuelist = is a list of one or more values separated by commas.

idlist = a list of one or more identifiers separated bV commas.

expression = any legal expre5~ion a~ defined in Section 1.9.3.

identifier: integer l~st

=

a list of one or more identifier-integer pairs seperated by ~omma~. The

colon-integer is optional in ea~h pair and the default is 1.

Small examples are included after each p~eudo-op definition to supply the user with a reference to the specific synta~ and form of that directive. The larger examp Ie, inc luded in section 3.3.2, is used to show the combined use and detailed examples of directive operations.

1.9.4.1 ROUTINE DELIMITING DIRECTIVES

Every assembly must include at least one .PROC o~ . FUNC, and one . END, even in the case of stand-alone code which will not be linked

into a Pascal host (i. e. an interpreter>. The most frequent use of the assembler, hO~lever, will be small routines intended to be linked with a Pascal host. In this case, .PROCs and . FUNCs are used to identify and delimit the assembly code to be accessed by a Pascal external procedure or function. The . END appears at the end of the last routine and

serves as the final delimiter.

References to a .PROC or . FUNC are made in the Pascal host by use of EXTERNAL declarations. At the time of this declaration the actual parameter names must be given. For example, if the Pascal declaration is:

PROCEDURE FARKLE(X, Y: REAL); EXTERNALi

the associated declaTation for the .PROC ~ould be PROC FARKl.E,4

A .PROC, . FUNC, or any assembly routine should be inserted into the *SYSTEM.LIBRARY (execute LIBRARIAN) 50 that i t can be referenced by the *SYSTEM.LINKER and linked in at run time An alternate method ~ould

be to execute the LINKER and tell i t what files to link in. Either method works. Howeverl if the Pascal host is updated and the assembly routines aren't in the *SYSTEM.LIBRARY, the linker will have to be

executed after each update. Therefore, we suggest that the routines be inserted into the *SYSTEM. LIBRARY to avoid this repetition. If the

Page 106

linker is called auttHhstlcally using the Runc:ommand, it will search the *SYSTEM.LIBRARY for the appropriate definition of the assembly routine and link the two together.

· PROC

· FUNC

· END

1.9,4.2

· ASCII

Identifies a procedure that returns no value. A .PROC is ended by the occurrence of a new .PROC,.FUNC, or . END.

FQRt'1:

EXAMPLE:

.PROC <identifier>C,expression]

[expression) indicates the number of words of parameters expected by this routine.

The deft~ult is O.

. PROC DLDRIVE.2

Identifies a function that returns a value.

Two words of space to be used fOT the function value will be placed on the stack before any parameters A . FUNC is ended the same way as the .PROC .

FORM:

EXA!'1PLE~

. FUNC <identifier>C,expressionl

[exp~essionJ indicates the number of words of parameters expected by this routine.

The def~ult is 0, . FUNC RANDOM. ·4·

Used to denote the physical end of an assembly_

Converts cha~acte~ values to ASCII equivalent bijte constants and plac@s the equivalents into the cod~ stream.

FORM:

r.

1 abe 1 ) . AS C I I l! <: c h a 'r a. c t e 1" s t T' i n 9

> ,.

where <character string> is any string of printable ASCII chaT'acters~ including a space. The length of the string mu~t less than 80 characters. The double quotes are used as delimeters for the

characters to be converted. If a double quote is

dt?~ired· in the string; i t must be specifically inserted ustng a . BYTE.

Page 107

. BYTE

. BLOCK.

Page 108

EXAMPLE: · ASe r r lIHELLO"

for the in5~rtian of AB~CD the code must be constructed as:

· ASCII

· BYTE

· ASCI I

Note: The 34 is the ASCII number far a double quote in hex.

The representation actually used will depend on the default radiI of the particular machine in use .

Allocates a byte of space into the code stream for each value

list~d_ Assigns the assoc:iated label, i-F any, to the address at which the byte was stored. Expression must have a value between -128 and +255. I ' the value is outside of this range an error will be flagged.

FORJ1: [ 1 abe 1 ] . B VTE rVf.l.luelistJ

the default for no stated value is 0 EXAMPLE:.: TEt1P . BYTE 4

AlloCBt~s a block of spac~ jnto code stream for ~ach value listed Amount allocated is in bytes. Associates the label (if pr~sent) with the starting address of the block allocated.

[ 1 f~ bel J . BLOC f.<.

<:length:> is thr:> th~ nl~mb·eT' of tH~t~s to held the <:value:>

s pee i fie d T h P. d f.~ fat! 1. t .p 0" n (1 s t r3 ted v {:t 1 U ~ i sO.

EXAMPLE: TEMP . BLOCK 4 , 6

the a$sociated output would be:

Of;)

06 ( f D wr' h y t ~~ ~ ll,~ i t i l t he val tJ e 06 ) 06

06

. WORD

. EQU

. ORG

Allocates a word of space in the code stream for each value in the v~lu~list. As~o(jatp.s th€* decla'ration label with the word space allocation.

FOR~1:

EXAMPLE:

EXAMPLE:

CIa bel] . WOR D <valuelist>

TEMP . WORD 0,2,4, . . .

the associated output would be:

0000 0002

000,,1 (words with these values in them )

Ll . WORD L;2

if L.C l!J·mt;; 50 4~t ttH! ,EQU

t h Eo ;~ ~ soc i .;,;y t ~ d Gut; p n t IJJ n v 1 d be:

0050 (* assign(r,t::nt due to tho L2 valLIe * )

0005 (* a~signment due to tho WORD 5 *)

Assigns a value to a label. Labels may be equated to an

~?~pT'e!i!:~!:ion cont~ining either lables and/or absolutes. Dne must deFine a label before it is used unless it will simply be equated to another label. A local label may not appear on the left hand side of an equate ( .EGU ).

FORI'-1: . EGU <value:>

R6

S IJ~ t ~, t h ~ cur T' en t 1 0 cat i 0 it C 0 U T'I t ? r ( L C) t o t h e 'of a 1 u e 0 f the . OR G . It would normally be used in a stand-alone program. For example, there is one. ORG In the 8G80/Z80 interpreter .

. ORG .L6 cuNLenUy impiemented oni..lj 60ft advancing the iocation c..oun..tetL. It.-iA not cunnentilj po~~ibie to ~et the iocation count~ back.

Page 109

Im Dokument 3 System 1 (Seite 103-107)