User manual

Table Of Contents
SYSTEM CALLS
M68CPU32BUG/D REV 1 5-12
.INLN Input Line Routine .INLN
5.2.8 Input Line Routine
SYSCALL .INLN
TRAP CODE: $0002
Reads a line from the default input port. The minimum buffer size is 256 bytes.
Entry Conditions:
SP ==> Address of string buffer <long>
Exit Conditions:
SP ==> Address of last character in the string+1 <long>
EXAMPLE
If A0 contains the string destination address:
SUBQ.L #4,A7
Allocate space for result
PEA (A0)
Push pointer to destination
TRAP #15
(May also invoke by SYSCALL
DC.W 2
macro (’’SYSCALL .INLN’’)
MOVE.L (A7)+,A1
Retrieve address of last character+1
NOTE
A line is a string of characters terminated by a carriage return
(<CR>). The maximum allowed size is 254 characters. The
terminating <CR> is not included in the string. See Terminal
Input/Output Control character processing as described in Chapter
1.
SYSTEM CALLS
M68CPU32BUG/D REV 1 5-13
.INSTAT Input Serial Port Status .INSTAT
5.2.9 Input Serial Port Status
SYSCALL .INSTAT
TRAP CODE: $0001
Checks the default input port buffer for characters. The condition codes are set to indicate the
result of the operation.
Entry Conditions:
No arguments or stack allocation required
Exit Conditions:
Z (zero) = 1 if the receiver buffer is empty
EXAMPLE
LOOP SYSCALL .INSTAT
Any characters?
BEQ.S EMPTY
If no, branch
SUBQ.L #2,A7
If yes, then read them in buffer
SYSCALL .INCHR
MOVE.B (A7)+,(A0)+
BRA.S LOOP
Check for more
EMPTY
Fr
eescale S
emiconduct
or
, I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
nc...