xref: /netbsd/sys/arch/vax/boot/boot/consio2.S (revision 6550d01e)
1/*	$NetBSD: consio2.S,v 1.1 2002/02/24 01:04:24 matt Exp $ */
2/*
3 * Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 *    notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 *    notice, this list of conditions and the following disclaimer in the
13 *    documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 *    must display the following acknowledgement:
16 *     This product includes software developed at Ludd, University of Lule}.
17 * 4. The name of the author may not be used to endorse or promote products
18 *    derived from this software without specific prior written permission
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#include <machine/asm.h>
33
34/*
35 * int rom_putchar (int c)	==> putchar() using ROM-routines
36 */
37ENTRY(rom_putchar, 0x0004)		# save-mask: R2
38	movl	4(%ap), %r2		# move argument to R2
39	jsb	*_C_LABEL(rom_putc)	# write it
40	ret				# that is all
41
42
43/*
44 * int rom_getchar (void)	==> getchar() using ROM-routines
45 */
46ENTRY(rom_getchar, 0x0002)		# save-mask: R1
47loop:					# do {
48	jsb	*_C_LABEL(rom_getc)	#   call the getc-routine
49	tstl	%r0			#   check if char ready
50	beql	loop			# } while (R0 == 0)
51	movl	%r1, %r0			# R1 holds char
52	ret				# we are done
53
54ENTRY(rom_testchar, 0)
55	mnegl	$1,%r0
56	jsb	*_C_LABEL(rom_getc)
57	tstl	%r0
58	beql	1f
59	movl	%r1,%r0
601:	ret
61
62ENTRY(_rtt, 0)
63	halt
64
65
66/*
67 * int ka630_rom_getchar (void) ==> getchar() using ROM-routines on KA630
68 */
69ENTRY(ka630_rom_getchar, 0x0802)	# save-mask: R1, R11
70	movl	_C_LABEL(ka630_conspage),%r11  # load location of console page
711:					# do {
72	jsb	*0x1C(%r11)		#   call the getc-routine (KA630_GETC)
73	blbc	%r0,1b			# } while (R0 == 0)
74	movl	%r1,%r0			# R1 holds char
75	ret				# we are done
76
77ENTRY(ka630_rom_testchar, 0)
78	movl	_C_LABEL(ka630_conspage),%r3
79	jsb	*0x1C(%r3)
80	blbc	%r0,1f
81	movl	%r1,%r0
821:	ret
83
84/*
85 * int ka630_rom_putchar (int c) ==> putchar() using ROM-routines on KA630
86 */
87ENTRY(ka630_rom_putchar, 0x802)	# save-mask: R1, R11
88	movl	_C_LABEL(ka630_conspage),%r11
89				# load location of console page
901:				# do {
91	jsb	*0x20(%r11)	#   is rom ready? (KA630_PUTC_POLL)
92	blbc	%r0,1b		# } while (R0 == 0)
93	movl	4(%ap),%r1	# R1 holds char
94	jsb	*0x24(%r11)	# output character (KA630_PUTC)
95	ret			# we are done
96
97/*
98 * int ka53_rom_getchar (void)	==> getchar() using ROM-routines on KA53
99 */
100ENTRY(ka53_rom_getchar, 0x0802)	# save-mask: R1, R11
101	movl	_C_LABEL(ka53_conspage),%r11
102				# load location of console page
1031:				# do {
104	jsb	*0x64(%r11)	#   test for char
105	blbc	%r0,1b		# } while (R0 == 0)
106	jsb	*0x6c(%r11)	# get the char
107	ret			# we are done
108
109ENTRY(ka53_rom_testchar, 0)
110	movl	_C_LABEL(ka53_conspage),%r3
111	jsb	*0x64(%r3)
112	blbc	%r0,1f
113	jsb	*0x6c(%r3)	# get the char
1141:	ret
115
116/*
117 * int ka53_rom_putchar (int c) ==> putchar() using ROM-routines on KA53
118 */
119ENTRY(ka53_rom_putchar, 0x0802)	# save-mask: R1, R11
120	movl	_C_LABEL(ka53_conspage),%r11
121				# load location of console page
1221:				# do {
123	jsb	*0x20(%r11)	#   is rom ready?
124	blbc	%r0,1b		# } whi	le (R0 == 0)
125	movl	4(%ap),%r1	# R1 holds char
126	jsb	*0x24(%r11)	# output character
127	ret			# we are done
128