![background image](http://html1.mh-extra.com/html/omron/sysmac-c200h-asc02/sysmac-c200h-asc02_operation-manual_742429078.webp)
68
5-1
Assembly Language Programming
Memory Area
Special memory space for assembly language programs must be reserved
with the MSET command. When programming in assembly language, you
cannot use the BASIC program area to store the assembly program. The
MSET command will move an existing BASIC program to another part of
memory.
There are two ways to write an assembly language program:
•
By using the monitor functions
•
By directly writing the program to the memory using the POKE
statement in BASIC.
In most cases the first method is quicker and easier; however, the second
method can be used to create short programs consisting of only a few steps.
Assembly language programs can be written to and read from RAM using the
S and L commands, respectively. They can also be written to or read from
the EEPROM by using the SAVE and LOAD commands, respectively.
Addresses &H0000 to &H1FFF and &H8000 to &HFFFF are reserved for the
ASCII Unit operating system and must not be altered by the user.
Note When it is necessary to load or save data using a peripheral device other
than the input terminal connected to port 1, perform the peripheral data trans-
fer procedure as follows:
1, 2, 3... 1.
Enter the command and key-in a carriage return.
2.
Disconnect the input terminal from port 1 and connect the peripheral
device.
3.
Press the START/STOP switch on the ASCII Unit to start data transfer.
4.
Reconnect the input terminal and key-in ctrl+x.
An assembly language program can be called from BASIC with the USR
function:
USR [<number>][<argument>]
Before the USR function can be used, the DEF USR statement must be ex-
ecuted to reserve space for the assembly routine. When the USR function is
executed, it calls the specified assembly routine and passes it an argument
defined in the BASIC program. (Refer to Section 4-2-7 Special Functions.)
Variables other than the argument specified by the USR function can also be
passed to the assembly language program by using the VARPTR function.
The following arguments are passed to the assembly program:
Accumulator A contents:
type of <argument>
Index register X contents:
address of <argument>
The RTS command should be the last command of the assembly routine; it
returns execution back to the BASIC program.
The value of the stack pointer must not be altered by the assembly routine.
Therefore, the data should be pushed on the stack at the beginning of the
routine and then pulled off before the RTS command is executed.
The assembly routine must store any data needed by the BASIC program in
the same address as that of the argument(s) passed by the USR or VARPTR
functions. Any data passed back to the BASIC program must be of the same
TYPE as the USR or VARPTR function argument(s).
Writing an Assembly
Program
The Assembly Language
Program
Assembly Language Programming
Section 5-1
Содержание SYSMAC C200H-ASC02
Страница 1: ...Cat No W165 E1 04 ASCII Unit SYSMAC C200H ASC02 ...
Страница 2: ...C200H ASC02 ASCII Unit Operation Manual Revised September 2002 ...
Страница 3: ...iv ...
Страница 5: ...vi ...
Страница 7: ...TABLE OF CONTENTS viii Glossary 159 Index 163 Revision History 165 ...
Страница 122: ...Appendix B Specifications 115 130 35 100 5 ...
Страница 167: ...Cat No W165 E1 04 Note Specifications subject to change without notice Printed in Japan Authorized Distributor ...
Страница 168: ...Cat No W165 E1 04 C200H ASC02 ASCII Unit OPERATION MANUAL ...