1/* mvme.S -- board support for m68k
2 *
3 * Copyright (c) 1995, 1996 Cygnus Support
4 *
5 * The authors hereby grant permission to use, copy, modify, distribute,
6 * and license this software and its documentation for any purpose, provided
7 * that existing copyright notices are retained in all copies and that this
8 * notice is included verbatim in any distributions. No written agreement,
9 * license, or royalty fee is required for any of the authorized uses.
10 * Modifications to this software may be copyrighted by their authors
11 * and need not follow the licensing terms described here, provided that
12 * the new terms are clearly indicated on the first page of each file where
13 * they apply.
14 */
15
16#include "asm.h"
17
18	.title "mvme.S for m68k-coff"
19
20	.align	2
21	.text
22	.global SYM (_exit)
23	.global SYM (outln)
24	.global SYM (outbyte)
25	.global SYM (putDebugChar)
26	.global SYM (inbyte)
27	.global SYM (getDebugChar)
28	.global SYM (havebyte)
29	.global SYM (exceptionHandler)
30
31	.set	vbr_size, 0x400
32	.comm	SYM (vbr_table), vbr_size
33
34/*
35 * _exit -- Exit from the application. Normally we cause a user trap
36 *          to return to the ROM monitor for another run.
37 */
38SYM (_exit):
39        unlk    a6
40        trap IMM(15)
41        .word return
42
43        .align  2
44
45/*
46 * inbyte -- get a byte from the serial port
47 *	d0 - contains the byte read in
48 */
49	.align	2
50SYM (getDebugChar):		/* symbol name used by m68k-stub */
51SYM (inbyte):
52	link	a6, IMM(-8)
53	trap 	IMM(15)
54	.word	inchr
55	moveb 	sp@, d0
56	extw	d0
57	extl	d0
58	unlk	a6
59	rts
60
61/*
62 * outbyte -- sends a byte out the serial port
63 *	d0 - contains the byte to be sent
64 */
65	.align	2
66SYM (putDebugChar):		/* symbol name used by m68k-stub */
67SYM (outbyte):
68	link	fp, IMM(-4)
69 	moveb	fp@(11), sp@
70	trap 	IMM(15)
71	.word	outchr
72	unlk	fp
73	rts
74
75/*
76 * outln -- sends a string of bytes out the serial port with a CR/LF
77 *	a0 - contains the address of the string's first byte
78 *	a1 - contains the address of the string's last byte
79 */
80	.align	2
81SYM (outln):
82	link	a6, IMM(-8)
83	moveml	a0/a1, sp@
84	trap 	IMM(15)
85	.word 	outln
86	unlk	a6
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	.align	2
95SYM (outstr):
96	link	a6, IMM(-8)
97	moveml	a0/a1, sp@
98	trap 	IMM(15)
99	.word 	outstr
100	unlk	a6
101	rts
102
103/*
104 * havebyte -- checks to see if there is a byte in the serial port,
105 *             returns 1 if there is a byte, 0 otherwise.
106 */
107SYM (havebyte):
108	trap 	IMM(15)
109	.word	instat
110	beqs	empty
111	movel 	IMM(1), d0
112	rts
113empty:
114	movel	IMM(0), d0
115	rts
116
117/*
118 * These constants are for the MVME-135 board's boot monitor. They
119 * are used with a TRAP 15 call to access the monitor's I/O routines.
120 * they must be in the word following the trap call.
121 */
122	.set inchr, 0x0
123	.set instat, 0x1
124	.set inln, 0x2
125	.set readstr, 0x3
126	.set readln, 0x4
127	.set chkbrk, 0x5
128
129	.set outchr, 0x20
130	.set outstr, 0x21
131	.set outln, 0x22
132	.set write, 0x23
133	.set writeln, 0x24
134	.set writdln, 0x25
135	.set pcrlf, 0x26
136	.set eraseln, 0x27
137	.set writd, 0x28
138	.set sndbrk, 0x29
139
140	.set tm_ini, 0x40
141	.set dt_ini, 0x42
142	.set tm_disp, 0x43
143	.set tm_rd, 0x44
144
145	.set redir, 0x60
146	.set redir_i, 0x61
147	.set redir_o, 0x62
148	.set return, 0x63
149	.set bindec, 0x64
150
151	.set changev, 0x67
152	.set strcmp, 0x68
153	.set mulu32, 0x69
154	.set divu32, 0x6A
155	.set chk_sum, 0x6B
156