source: trunk/libs/newlib/src/libgloss/m68k/cpu32bug.S @ 480

Last change on this file since 480 was 444, checked in by satin@…, 7 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 2.5 KB
Line 
1/*
2 * cpu32bug.S -- board support for the CPU32BUG monitor.
3 *
4 * Copyright (c) 1995, 1996 Cygnus Support
5 *
6 * The authors hereby grant permission to use, copy, modify, distribute,
7 * and license this software and its documentation for any purpose, provided
8 * that existing copyright notices are retained in all copies and that this
9 * notice is included verbatim in any distributions. No written agreement,
10 * license, or royalty fee is required for any of the authorized uses.
11 * Modifications to this software may be copyrighted by their authors
12 * and need not follow the licensing terms described here, provided that
13 * the new terms are clearly indicated on the first page of each file where
14 * they apply.
15 */
16
17#include "asm.h"
18#include "cpu32bug.h"
19
20        .title "cpu32bug.S for m68k-coff"
21
22        .text
23        .global SYM (_exit)
24        .global SYM (outln)
25        .global SYM (outbyte)
26        .global SYM (putDebugChar)
27        .global SYM (inbyte)
28        .global SYM (getDebugChar)
29        .global SYM (havebyte)
30
31/*
32 * _exit -- Exit from the application. Normally we cause a user trap
33 *          to return to the ROM monitor for another run.
34 */
35        .text
36        .align  2
37SYM (_exit):
38        link    fp, IMM(0)
39        trap    IMM(15)
40        .word   RETURN
41
42/*
43 * inbyte -- get a byte from the serial port
44 *      d0 - contains the byte read in
45 */
46        .text
47        .align  2
48SYM (getDebugChar):             /* symbol name used by m68k-stub */
49SYM (inbyte):
50        link    fp, IMM(-8)
51        trap    IMM(15)
52        .word   INCHR
53        moveb   sp@, d0
54        extw    d0
55        extl    d0
56        unlk    fp
57        rts
58
59/*
60 * outbyte -- sends a byte out the serial port
61 *      d0 - contains the byte to be sent
62 */
63        .text
64        .align  2
65SYM (putDebugChar):             /* symbol name used by m68k-stub */
66SYM (outbyte):
67        link    fp, IMM(-4)
68        moveb   fp@(11), sp@
69        trap    IMM(15)
70        .word   OUTCHR
71        unlk    fp
72        rts
73
74/*
75 * outln -- sends a string of bytes out the serial port with a CR/LF
76 *      a0 - contains the address of the string's first byte
77 *      a1 - contains the address of the string's last byte
78 */
79        .text
80        .align  2
81SYM (outln):
82        link    fp, IMM(-8)
83        moveml  a0/a1, sp@
84        trap    IMM(15)
85        .word   OUTLN
86        unlk    fp
87        rts
88
89/*
90 * outstr -- sends a string of bytes out the serial port without a CR/LF
91 *      a0 - contains the address of the string's first byte
92 *      a1 - contains the address of the string's last byte
93 */
94        .text
95        .align  2
96SYM (outstr):
97        link    fp, IMM(-8)
98        moveml  a0/a1, sp@
99        trap    IMM(15)
100        .word   OUTSTR
101        unlk    fp
102        rts
103
104/*
105 * havebyte -- checks to see if there is a byte in the serial port,
106 *             returns 1 if there is a byte, 0 otherwise.
107 */
108        .text
109        .align  2
110SYM (havebyte):
111        trap    IMM(15)
112        .word   INSTAT
113        beqs    empty
114        movel   IMM(1), d0
115        rts
116empty:
117        movel   IMM(0), d0
118        rts
Note: See TracBrowser for help on using the repository browser.