9.2.2
Examples of Access to
DW > 255
Example 1:
The content of data word DW 300 in DB 100 is read and transferred to flag
word FW 100 (by changing the STEP 5 operation shown in bold face, it can
also be used to read other data blocks (DB or DX)).
FB 5
SEGMENT 1 0000 Reading out DW 300 from DB 100
NAME :LIR DW
0005 :L DH 000E EC00 Start addr. of the DB list
0008 :L KF +100 plus the DB number
000A :+D = Address list entry of DB 100
000B : (Bits 4 to 19)
000C :LIR 1 Start addr. DB 100 to ACCU 1
000D :SLD 4 Convert addr. to physical addr.
000E :L KF +300 DW 300 is read out
0010 :+D Addr. = start addr. of DB + DW addr.
0011 :LIR 1 Store content of DW 300 to ACCU 1
0012 :T FW 100 in FW 100
0013 :BE
Example 2:
All the data words of a data block will have a constant written to them.
The program shown below writes the constant KH = A5A5 to all data words of
DB 100. After changing the STEP 5 operations shown in bold face, it can
also be used to write values to other data blocks (DB or DX). Non-existent
data blocks are detected and cause a jump to the NIVO marker.
The program uses three accumulators. Within the loop, the accumulator
contents do not change.
ACCU 1 initially contains the address of the first data word and is
incremented by one each time the loop is run through.
ACCU 2 contains the address of the last data word + 1. The loop is
terminated as soon as the content of ACCU 1 is the same as the content of
ACCU 2.
To write the data words, the operation TIR 10 is used which stores the
content of ACCU-3-L (the constant) at the address contained in ACCU 1.
ACCU contents within the loop:
ACCU 1: address of the current data word to be written to
ACCU 2: address of the
last data word to be written to + 1
ACCU 3: constant
Continued on the next page
Memory Access via Address in ACCU 1
CPU 948 Programming Guide
C79000-G8576-C848-04
9 - 15