Chapter 5 Detailed Applications
- 73 -
5.2 Program Coding Procedure in Assembly Language
This section describes how to write an application using the assembly language.

5.2.1 Writing Task

This section describes how to write an application using the assembly language.
1. Be sure to include "mr308.inc" at the beginning of file.
2. For the symbol indicating the task start address, make the external declaration.51
3. Be sure that an infinite loop is formed for the task or the task is terminated by the ext_tsk
service call.
.INCLUDE mr308.inc ----- (1)
.GLB task ----- (2)
task:
; process
jmp task ----- (3)
Figure 5.6 Example Infinite Loop Task Described in Assembly Language
.INCLUDE mr308.inc
.GLB task
task:
; process
ext_tsk
Figure 5.7 Example Task Terminating with ext_tsk Described in Assembly Language
4. The initial register values at task startup are indeterminate except the PC, SB, R0 and FLG
registers.
5. To specify a task, use the string written in the task definition item “name” of the configura-
tion file.
wup_tsk #ID_task
6. To specify an event flag, semaphore, or mailbox, use the respective strings defined in the
configuration file.
For example, if a semaphore is defined in the configuration file as shown below,:
semaphore[1]{
name = abc;
};
To specify this semaphore, write your specification as follows:
sig_sem #ID_abc
7. To specify a cyclic or alarm handler, use the string written in the cyclic or alarm handler
definition item “name” of the configuration file
For example, if you want to specify a cyclic handler "cyc," write your specification as follows:
sta_cyc #ID_cyc
51 Use the .GLB pseudo-directive