1/*        $NetBSD: adbsysasm.s,v 1.13 2020/05/31 09:00:25 rin Exp $   */
2
3/*-
4 * Copyright (C) 1994         Bradley A. Grantham
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 *    notice, this list of conditions and the following disclaimer in the
14 *    documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#include "opt_adb.h"
29#include "akbd.h"
30#include "ams.h"
31#include <machine/asm.h>
32
33/*
34 * ADB subsystem routines in assembly
35 */
36
37/* This routine is called when a keyboard has sent us some data. */
38/* (provided it has been set up with SetADBInfo) */
39GLOBAL(adb_kbd_asmcomplete)
40#if NAKBD > 0
41          moveml    #0x80e0,%sp@-       | save scratch regs
42          movl      %d0,%sp@- /* ADB command byte */
43          movl      %a2,%sp@- /* data area pointer */
44          /*        %a1 is the pointer to this routine itself. */
45          movl      %a0,%sp@- /* device data buffer */
46          jbsr      _C_LABEL(kbd_adbcomplete)
47          addl      #12,%sp             /* pop params */
48          moveml    %sp@+,#0x0701       | restore scratch regs
49#endif
50          rts
51
52/* This routine is called when a mouse has sent us some data. */
53/* (provided it has been set up with SetADBInfo) */
54GLOBAL(adb_ms_asmcomplete)
55#if NAMS > 0
56          moveml    #0x80e0,%sp@-       | save scratch regs
57          movl      %d0,%sp@- /* ADB command byte */
58          movl      %a2,%sp@- /* data area pointer */
59          /*        %a1 is the pointer to this routine itself. */
60          movl      %a0,%sp@- /* device data buffer */
61          jbsr      _C_LABEL(ms_adbcomplete)
62          addl      #12,%sp             /* pop params */
63          moveml    %sp@+,#0x0701       | restore scratch regs
64#endif
65          rts
66
67#if defined(ADB_DEBUG) && 0
68GLOBAL(adb_jadbprochello)
69          .asciz    "adb: hello from adbproc\n"
70          .even
71#endif
72
73GLOBAL(adb_jadbproc)
74#if defined(ADB_DEBUG) && 0
75          moveml    #0xc0c0,%sp@-       | save scratch regs
76          movl      _C_LABEL(adb_jadbprochello),%sp@-
77          jbsr      _C_LABEL(printf)
78          addl      #4,%sp              /* pop params */
79          moveml    %sp@+,#0x0303       | restore scratch regs
80#endif
81                    /* Don't do anything; adbattach fixes dev info for us. */
82          rts
83
84          /* ADBOp's completion routine used by extdms_init() in adbsys.c. */
85GLOBAL(extdms_complete)
86          movl      #-1,%a2@  | set done flag
87          rts
88