HP 9835A Programming Manual page 24

35 series desktop computer assembly development rom
Table of Contents

Advertisement

10
Getting Started
3. Assemble the source code into object code, storing the latter into the area of memory set
aside for it.
4. Execute the object code (routines) from BASIC "drivers".
Each of these steps will be discussed at length in the pages of this manual, along with a number
of not-so-incidental side-topics (such as "debugging" techniques). The purpose of this short
section is to give you an impression of the general procedure through which an assembly
language subprogram is created.
As an example to use to demonstrate the process, suppose the following task has been assigned
to you-
Requirement:
Write an assembly language subprogram which takes two integer
values and multiplies them together as integers. If the result overflows the range of
an integer (- 32 768 to
+
32 767), then the subprogram should return the same
error as the system would (Le., error number 20).
With this task in hand, suppose that you have completed a programming analysis that suggests
that the following assembly language sourcecode would fulfill the subprogram's functions-
1
NAM Multipl ication
j
Beginning of module
Multiply:
LDA =Integers
LI1I:~
:::: I
f"fr)l)t
:I.
.
.J~:;j\1
C;E-t
!.).::i.
' i
i)E:'
L..IiA = I
i"Mit E'i;;!l:::' r' O ' : :::_
-+-1
LDE =Input2
-.r:;!',!
=.).:::1.1
i.AE'
Llii:i I
( i t
~=·l;~~.:·t-·:::.
':;BF ':':·+2
Cr'!E
L..DF"i
=~:::~.:.1
.J':::;t-! E[-"["·'::'j·-·
e::-::·j t
.J':::;r-!
FET
-:::1.
r-'
~:'.::2.
·r ()
r-
-i
ri t
i:::'
l;;~
!::'
roo ::::-
c: r-
E'.::t.
t
~::' ij
r·:·.:-.:.~:I-··.::.
~·r!t(·:)
pCiir·~t
·f()'\ 1
()l,',i::::.
i
1(1(:1
-j
C.3.t
=:::' : ::_
:1
-i
!"'it
i:::'i;!I::'!'"
1:)::t.r···.::1i"i"it:·!:.
=::.j .... ::::.
-::if""::'
t::::i~::,::::·!::·c!
i
r'! ti'-i ' :::'
Cl!····dE·r
M
i;~;li
=.)i:::'(i
[):/
tl·-,E':::.t:'
:,::. t·:::i. t
~:'rnE'r-!t
::::' .::j.r-!C! ·::tr-'E'
=~;;!i !,)~:'(i
t"'~::j.rn~:':::·
He
t
i),:3.
1
t:'('i
t
(.~)
F)()'~ t"j
t
(
f"l,3J.iYlE' :
!"I' !
i)
' I
t
'j
ri'i :/ : : : ;
r"
(ii_~
t
'j
i"':
~::'
tH=:"
!;~"j
n :. : :.
L::/ f'
~:'
t
c
~'-i
i
1'''ii;;~
.::a.
c
t
t-i.::t
1
=,},:i
1
!_,l
e c!
f'
t
1' ' ' 1
~::'
i
' - i
f)
i,A
t
~)::i.
r",:::l
ffl f.'
t !:::' (' :::.
from EASIC and storing them where
the routine can use them
arithmetic
accumula~or
and
fin~11
multipli~5
them
overflow is
pe~formed
t~
checking the result for anything
in the B register when it should be 0
and if it isn/t,
Errrn~
20 is selected
and the routine is aborted
If everything is OK,
thE~
result stored
!
The
V~oduct
is then returned to the
c!
i_~
t
~:i t~
t
:.).3. (.
i
·::i
t!
'~E'
i
rHf
E
f:! :::;
I C: l'i :::'
t. t:'
c:1
among the
argumE~ts
We/re finished, so return to EASIC
END Multipl icatlon
i
End of module
1 The fact that
it
is rarely possible to create a running program at this stage should not get in the way of accepting the example.
Usually there is debugging involved in later stages.

Advertisement

Table of Contents
loading

Table of Contents