Figure 2-1. Pseudo-Code Algorithm Of Sample Program - HP 64700 Series User Manual

64000-ux case solutions for microprocessors, softkey interface
Hide thumbs Also See for 64700 Series:
Table of Contents

Advertisement

Initialize the stack pointer.
AGAIN:
Save the two previous random numbers.
Call the RAND random number generator subroutine.
Test the two least significant bits of the previous random number.
If 00B then goto CALLER_0.
If 01B then goto CALLER_1.
If 10B then goto CALLER_2.
If 11B then goto CALLER_3.
CALLER_0:
Call the WRITE_NUMBER subroutine.
Goto AGAIN (repeat program).
CALLER_1:
Call the WRITE_NUMBER subroutine.
Goto AGAIN (repeat program).
CALLER_2:
Call the WRITE_NUMBER subroutine.
Goto AGAIN (repeat program).
CALLER_3:
Call the WRITE_NUMBER subroutine.
Goto AGAIN (repeat program).
WRITE_NUMBER:
Write the random number to a 256 byte data area, using the second
previous random number as an offset into that area.
RETURN from subroutine.
RAND:
Pseudo-random number generator which returns a random number
from 0-0FFH.
RETURN from subroutine.

Figure 2-1. Pseudo-Code Algorithm of Sample Program

The sample program is not intended to represent a real routine.
The program uses four different callers of the WRITE_NUMBER
subroutine to simulate situations in real programs where routines
are called from many different places. An example later in this
chapter shows you how to use the analyzer prestore feature to
determine where a routine is called from.
An assembler listing of the sample program is shown in figure 2-2.
It is provided so that you can see the addresses associated with the
program labels. The program area, which contains the instructions
to be executed by the microprocessor, is located at 400H when
linking the program. The RESULTS area, to which the random
numbers are written, is located at 500H. The area which contains a
variable used by the RAND subroutine and memory locations for
the stack is located at 600H.
Getting Started 2-3

Advertisement

Table of Contents
loading

Table of Contents