Chapter 5 System Calls; Introduction; Executing System Calls Through Trap #15 - Motorola M68CPU32BUG User Manual

Debug monitor
Table of Contents

Advertisement

5.1 INTRODUCTION

This chapter describes the CPU32Bug TRAP #15 handler, which allows system calls from user
programs. System calls access selected functional routines contained within CPU32Bug,
including input and output routines. TRAP #15 also transfers control back to CPU32Bug at the
end of a user program (refer to the .RETURN function, paragraph 5.2.16).
In the descriptions of some input and output functions, reference is made to the default input port
or the default output port. After power-up or reset, the default input and output port is port 0 (the
BCC terminal port).
5.1.1

Executing System Calls Through TRAP #15

To execute a system call from a user program simply insert a TRAP #15 instruction into the
source program. The code corresponding to the particular system routine is specified in the word
following the TRAP opcode, as shown in the following example.
Format in user program:
TRAP #15
DC.W $xxxx
In some of the examples shown in the following descriptions, a SYSCALL macro is used with
the Motorola Macro Assembler (M68MASM) for MS-DOS/PC-DOS machines. This macro
automatically assembles the TRAP #15 call followed by the define constant for the function
code. The SYSCALL macro is:
SYSCALL
The CPU32Bug input default is hexadecimal, while other assemblers default to decimal. When
programming a CPU32Bug assembler TRAP function it is best to use the SYSCALL macro to
make the conversion.
Using the SYSCALL macro, the system call appears in the user program as:
SYSCALL
M68CPU32BUG/D REV 1
CHAPTER 5
SYSTEM CALLS
System call to CPU32Bug
Routine being requested (xxxx = code)
MACRO
TRAP
#15
DC.W
\1
ENDM
<routine name>
5-1
SYSTEM CALLS

Advertisement

Table of Contents
loading

Table of Contents