Dick Smith VZ200 Technical Reference Manual page 20

Personal colour computer
Table of Contents

Advertisement

F. COMPARE DE & HL REGISTER PAIRS -- RST 18H
The instruction RST 18H may be used to call a routine which
compares the contents of the DE and HL register pairs. The
routine uses the A register only, but will only work for
unsigned or positive numbers. Upon returning, the result of the
comparison will be in the status register:
HL < DE : carry set
HL > DE : no carry
HL <> DE : NZ
HL = DE : Z
Here is an example of its use. Assume the DE pair contains a
number and we want to check that it falls within a certain
range -- say between 100 and 500 (decimal):
LD
HL,500
;load HL with upper limit
RST 18H
;& call comparison routine
JR
C,ERR
;carry means num > 500
LD
HL,100
;now set for lower limit
RST 18H
;& try again
JR
NC,ERR
;no carry means num < 100
;if still here, must be OK
G. SOUND DRIVER
Located at 345C hex is a routine which can be used to produce
sounds via the VZ-200's internal piezo speaker. Before calling
the routine, the HL register pair must be loaded with a number
representing the pitch (frequency) of the tone to be produced,
while the BC register pair must be loaded with the number of
cycles of the tone required (i.e., the duration in cycles). All
registers are used. The frequency coding used is inversely
proportional to frequency, i.e., the smaller the number loaded
into the HL register pair, the higher the frequency. As a
guide, the low C produced by VZ-200's SOUND command in BASIC
can be produced using the decimal number 526, the middle C
using 259 and the high C using 127. Here is how you would call
the routine to get say 75 cycles of the middle C:
LD
HL, 259
;set frequency code
LD
BC, 75
;set number of cycles
CALL 345CH
;& call sound routine
H. 'BEEP' ROUTINE
The routine which is used by BASIC to produce the short 'beep'
when a key is pressed is located at address 3450 hex. It
disturbs all registers except the HL pair. All you have to do
to produce a beep is call it:
CALL 3450
;make a 'beep'
- 19 -

Advertisement

Table of Contents
loading

Related Products for Dick Smith VZ200

Table of Contents