Technical data

9.2.2
Examples of using the
Registers
Example 1: You want all the data words of a data block to contain a
constant.
The program shown below writes the constant KH=A5A5 to all data words in
DB 50. After changing the STEP 5 operations shown in bold face, it can
also be used to write any values required to different data blocks (DB
or DX). Non-existent data blocks or data blocks with no data words are
detected and cause a jump to the NIVO label.
The start address (DBA) and length (DBL) of the data block are
determined by the special function OB 181 "test data block (DB/DX)".
The program uses all four accumulators. In the figure, you can see the
occupation of the accumulators during the program as far as the LOOP
label. Within the loop, the accumulator occupation does not change.
ACCU 1 initially contains the address of the last data word
(DBA + DBL - 1) and is reduced by 1 each time the loop is run through.
ACCU 2 contains the address of the first data word (DBA). The loop is
abandoned as soon as the contents of ACCU 1 are less than the contents
of ACCU 2.
The operation TIR 10 that stores the contents of ACCU-3-L (the constant)
under the address located in ACCU-1-L is used to write to the data
words.
:
:L KHA5A5 constant to be written to
: all data words
:L KY 1,50 type and number of the data block
:ENT
:JU OB 181 special function OB "test data blocks"
:JC =NIVO abandon if DB 50 does not exist
:TAK
:ENT
:+F
: ACCU 1 := address of last data word + 1
: ACCU 2 := address of the first data word
: ACCU 3 := constant
:!=F abandon if DB 50 contains
:JC =NIVO no data words
:
LOOP :ADD BN-1 the constant contained in ACCU-3-L
:TIR 10 is written to all data words beginning
: with the last data word
:><F scan: 1st data word reached?
:JC =LOOP return to loop if 1st data word not reached
:
: continuation of the program...
Continued on next page
Access using the Address in ACCU 1
CPU 928B Programming Guide
9 - 16 C79000-B8576-C898-01