Omron C500-ASC04 Operation Manual page 111

Ascii unit
Table of Contents

Advertisement

Assembly Language Examples
Assembly Program
$2000
PSHA
Saves registers
PSHB
PSHX
LDD
#$2600 Sets first address of buffer 1 in
STD
$2500
LDD
#$2700 Sets first address of buffer 2 in
STD
$2502
LDAB
0,X
LDX
1,XC
STX
$2504
$2016
LDX
$2504
LDAA
0,X
INX
Character variable address pointer +1
STX
$2504
CMPA
#$30
BLT
$2032
CMPA
#$39
BHI
$2032
LDX
$2500
STAA
0,X
INX
STX
$2500
BRA
$203B
$2032
LDX
$2502
STAA
0,X
INX
STX
$2502
$203B
DECB
Updates counter
BNE
$2016
LDD
$2500
LDX
#$2600 Transfer from buffer 1 to a
Example 2: Use of More than One Parameter
BASIC Program
100 '
*****
110 '
***** Program to single out the larger of two character
120 '
***** strings
Assembly language program operation:
The numbers and characters are separated and stored in the number storage
buffer and the character storage buffer, respectively. Then numeric strings and
character strings are restored as the original character variables. This program
has no practical application; it's just an example.
point 1
point 2
Number of characters to GET
Character variable first ad-
dress GET
DOUNTIL (number of times
equal to the number of charac-
ters)
Character GET
IF (minimum $30)
THEN
IF (numeral less than $39)
THEN
Stores numeral in buffer 1
ENDIF
Stores character in buffer 2
ENDDO
character variable
This program singles out the larger of two character strings.
Three parameters are used (i.e., the two original character strings for compari-
son and the other for result storage).
STX
$2504
SUBD
#$2600
PULX
PSHX
PSHB
LDX
1,X
STX
$2506
JSR
$2100
LDX
#$2700 Transfer from buffer 2 to a
STX
$2504
PULB
PULX
PSHX
LDX
1,X
ABX
STX
$2506
LDD
$2502
SUBD
#$2700
JSR
$2100
PULX
PULB
PULA
RTS
$2100
LDX
$2504
LDAA
0,X
INX
STX
$2504
LDX
$2506
STAA
0,X
INX
STX
$2506
DECB
BNE
$2100
RTS
*****
*****
*****
Section 6-4
character variable
Data transfer subroutine
Assembly language
program $2170 to
$21AF. Work area
101

Advertisement

Table of Contents
loading

Table of Contents