Project “Moving Message” - Part 2
Executing the program “DV3-Info.bin” with our DV3 we can observe that the message “DV3-Info!” moves one character after another, beginning with “!”, to a determined position from left to right.
designated text is stored at the adress-area 82007Eh to 820098h. As we can see with the Hexeditor, every single character of the text beginning with “!” is treated as an output string of it´s own (see chapter 3).
Every output string starts with a space-character, followed by the actual text-character and the code 00, which marks the end of an output string.
As storage-area for the control variables of our program the adresses
- 8200A0h (adress of present output string -> start value 7Eh),
- 8200A2h (present column-value -> start value 00h),
- 8200A4h (column limitation value -> start value 62h) and
- 8200A6h (end-adress output string area -> 99h)
But now let´s continue the actual description of the program code :
- 82013Ch : MOV DP0, 0082h
The segment-value 0082h is moved to the special register DP0 because some commands used later
only contain a single adress-value and need the connected segment-value in register DP0 !
- 820140h : MOV R2, [00A0h]
- 820144h : MOV R3, 0082h
As described in chapter 3, the “text to
screen”-routine needs at first the adress- and segment-value of the first output string. The command MOV R2, [00A0h] moves indirect the value stored at adress 8200A0h (82h -> DP0) to the register R2 !
- 820148h : PUSH R3; -82014Ah : PUSH R2 (see chapter 3)
- 82014Ch : MOV R2, 0032h; -820150h : PUSH R2 (LCD-output line)
- 820152h : MOVB R2, [00A2h]
The present column-value, stored at 8200A2h, is moved to register R2 !
- 820156h : SCALL 82h: 1EE0h; -82015Ah : ADD R15, 08h; (original “text to screen”-routine)
- 820160h : MOV DP0, 0082h
Because the value of DP0 is changed within the subroutine called by SCALL 82h: 1EE0h, the segment-value has to be restored.
- 820164h : MOVB R2, [00A2h]
- 820168h : ADD R2, 02h
- 82016Ah : MOVB [00A2h], R2
The last column-value is moved from 8200A2h to R2 and is added by 02h. Afterwards this increased value is stored again at adress 8200A2h. It´s our intention to move the present
output string to the right by 2 pixels ! Because the output string starts with a space-character, the character set on the old position is deleted automatically.
- 82016Eh : CMP R2, [00A4h]
column-value in R2 is compared with the column limitation value stored at adress 8200A4h. This is done internally by subtracting the contents of 8200A4h from R2. A signal-register Z (flag Z) is set, if the
subtraction results in 0. Otherwise flag Z remains not set.
- 82017Ch : JMP.NZ 0820140h
On condition that flag Z is not set (NotZ), the program is continued at adress 820140h
and the present output string is printed 2 pixels further to the right while the last position is deleted by the space-character of the output string.
This procedure is repeated until the present column-value is
equal to the column limitation value which indicates also, that the output string has reached its determined position !
Because this procedure is executed in machine-code (assembler) so fast, that we couldn´t
observe it, a delay-loop is installed at 820172h to 820178h with which we will continue in chapter 7 !