EasyManua.ls Logo

Holtek HT48R05A-1 - Page 78

Default Icon
125 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Syntax
ORG expression
·
Description
This directive sets the location counter to expression. The subsequent code and data offsets
begin at the new offset specified by expression. The code or data offset is relative to the be
-
ginning of the section where the directive ORG is defined. The attribute of a section determines
the actual value of offset, absolute or relative.
·
Example
ORG 8
mov A, 1
In this example, the statement mov A, 1 begins at location 8 in the current section.
Syntax
PUBLIC name1 [,name2 [,...]]
EXTERN name1:type [,name2:type [, ...]]
·
Description
The PUBLIC directive marks the variable or label specified by a name that is available to other
modules in the program. The EXTERN directive, on the other hand, declares an external vari
-
able, label or symbol of the specified name and type. The type can be one of the four types:
BYTE, WORD and BIT (these three types are for data variables), and NEAR (a label type and
used by call or jmp).
·
Example
PUBLIC start, setflag
EXTERN tmpbuf:byte
CODE .SECTION ¢CODE¢
start:
mov a, 55h
call setflag
....
setflag proc
mov tmpbuf, a
ret
setflag endp
end
In this example, both the label start and the procedure setflag are declared as public vari-
ables. Programs in other sources may refer to these variables. The variable tmpbuf is also de
-
clared as external. There should be a source file defining a byte that is named tmpbuf and is
declared as a public variable.
Chapter 4 Assembly Language and Cross Assembler
71

Table of Contents