103
21A0
A7
00
STAA
$00, X
’Writes the larger character string to ANS$.
21A2
08
INX
21A3
FF
20
04
STX
$2004
21A6
5A
DECB
21A7
26
DE
BNE
$2187
’Complete?
21A9
39
RTS
Work Area
$2000
$2001
$2002
$2003
$2004
$2005
Storage address memory area of parameter SDX$.
Storage address memory area of parameter SDY$.
Storage address memory area of parameter ANS$.
Example 3: FCS Calculation
This program calculates the FCS to be used in the host link assembly language.
Character strings to be calculated are DA$ and character strings in which cal-
culation results are stored as FCS$.
BASIC Program (100 to 230 Lines)
100 ’
***** FCS calculation (using
*****
110’
***** assembly language function)
*****
Assembly language program $2100 to $213F.
120 ’
***** Calculate the FCS of DA$ and *****
Work area $2000 to $2001.
130 ’
***** obtain the result as ANS$
*****
140
DA$=”@10RR00310123”
’The DATA string to calculate the FCS.
150
FCS$=”43”
’FCS storage character string. (The contents of “XX” will be
substituted and converted when the program runs.)
160
DEFUSR0=&H2100
’Storage address definition of assembly language function
170
B%=VARPTR(FCS$)+1
’Calculation of the storage address of FCS$.
180
POKE &H2000, B% \ 256
’Leftmost storage address of FCS$ --> Work area
190
POKE &2001, B% MOD 256
’Rightmost storage address of FCS$ --> Work area
200
DA$=USR0(DA$)
’Execute assembly language function.
210
ANS$=DA$+FCS$
’Create a character string added with the FCS.
220
PRINT ANS$
230
END
240 ’
500 ’
***** FCS calculations (BASIC
*****
510 ’
***** instructions only)
*****
520 ’
*****Calculate the FCS of DA$ and *****
530 ’
***** obtain the result as ANS$
*****
540
DA$=”@10RR00310123”
550
L=LEN(DA$)
560
Q=0
570
FOR N=1 TO L
580
Q=ASC(MID$(DA$, N, 1)) XOR Q
590
NEXT
600
FCS$=HEX$(Q)
Assembly Language Examples
Содержание C500-ASC04
Страница 1: ...C500 ASC04 ASCII Unit Operation Manual Revised February 2001 ...
Страница 5: ...iv ...
Страница 7: ...vi ...