EasyManua.ls Logo

Holtek HT46R47 - Page 120

Holtek HT46R47
162 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...
The following source program refers to the macro Delay ...
The Cross Assembler will expand the macro Delay as shown in the following listing file. Note that
the offset of each line in the macro body, from line 4 to line 17, is 0000. Line 24 is expanded to 11
lines and forms the macro body. In addition the formal parameters, tmp1 and tmp2, are replaced
with the actual parameters, BCnt and SCnt, respectively.
Chapter 4 Assembly Language and Cross Assembler
111
; T . A S M
; S a m p l e p r o g r a m f o r M A C R O .
. L i s t M a c r o
D e l a y M A C R O t m p 1 , t m p 2
L O C A L l a b e l 1 , l a b e l 2
m o v a , 7 0 h
m o v t m p 1 , a
l a b e l 1 :
m o v t m p 2 , a
l a b e l 2 :
c l r w d t 1
c l r w d t 2
s d z t m p 2
j m p l a b e l 2
s d z t m p 1
j m p l a b e l 1
E N D M
d a t a . s e c t i o n ' d a t a '
B C n t d b ?
S C n t d b ?
c o d e . s e c t i o n a t 0 ' c o d e '
D e l a y B C n t , S C n t
e n d
F i l e : T . a s m H o l t e k C r o s s - A s s e m b l e r V e r s i o n 2 . 8 0 P a g e 1
1 0 0 0 0 ; T . A S M
2 0 0 0 0 ; S a m p l e p r o g r a m f o r M A C R O .
3 0 0 0 0 . L i s t M a c r o
4 0 0 0 0 D e l a y M A C R O t m p 1 , t m p 2
5 0 0 0 0 L O C A L l a b e l 1 , l a b e l 2
6 0 0 0 0 m o v a , 7 0 h
7 0 0 0 0 m o v t m p 1 , a
8 0 0 0 0 l a b e l 1 :
9 0 0 0 0 m o v t m p 2 , a
1 0 0 0 0 0 l a b e l 2 :
1 1 0 0 0 0 c l r w d t 1
1 2 0 0 0 0 c l r w d t 2
1 3 0 0 0 0 s d z t m p 2
1 4 0 0 0 0 j m p l a b e l 2
1 5 0 0 0 0 s d z t m p 1
1 6 0 0 0 0 j m p l a b e l 1
1 7 0 0 0 0 E N D M
1 8 0 0 0 0
1 9 0 0 0 0 d a t a . s e c t i o n ' d a t a '
2 0 0 0 0 0 0 0 B C n t d b ?
2 1 0 0 0 1 0 0 S C n t d b ?
2 2 0 0 0 2
2 3 0 0 0 0 c o d e . s e c t i o n a t 0 ' c o d e '
2 4 0 0 0 0 D e l a y B C n t , S C n t
2 4 0 0 0 0 0 F 7 0 1 m o v a , 7 0 h
2 4 0 0 0 1 0 0 8 0 R 1 m o v B C n t , a
2 4 0 0 0 2 1 ? ? 0 0 0 0 :
2 4 0 0 0 2 0 0 8 0 R 1 m o v S C n t , a
2 4 0 0 0 3 1 ? ? 0 0 0 1 :
2 4 0 0 0 3 0 0 0 1 1 c l r w d t 1
2 4 0 0 0 4 0 0 0 5 1 c l r w d t 2
2 4 0 0 0 5 1 7 8 0 R 1 s d z S C n t
2 4 0 0 0 6 2 8 0 3 1 j m p ? ? 0 0 0 1
2 4 0 0 0 7 1 7 8 0 R 1 s d z B C n t
2 4 0 0 0 8 2 8 0 2 1 j m p ? ? 0 0 0 0
2 5 0 0 0 9 e n d
0 E r r o r s

Table of Contents