OpenCores
URL https://opencores.org/ocsvn/eco32/eco32/trunk

Subversion Repositories eco32

[/] [eco32/] [trunk/] [monitor/] [monitor/] [common/] [keyboard.s] - Blame information for rev 78

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 59 hellwig
;
2
; keyboard.s -- a PC keyboard as input device
3
;
4
 
5
;***************************************************************
6
 
7
        .set    kbdbase,0xF0200000      ; keyboard base address
8
 
9
;       .import cout
10
;       .import byteout
11
 
12
        .import xltbl1                  ; kbd translation table 1
13
        .import xltbl2                  ; kbd translation table 2
14
 
15
        .export kbdinit                 ; initialize keyboard
16
        .export kbdinchk                ; check if input available
17
        .export kbdin                   ; do keyboard input
18
 
19
;***************************************************************
20
 
21
        .code
22
        .align  4
23
 
24
kbdinit:
25
        jr      $31
26
 
27
kbdinchk:
28
        add     $8,$0,kbdbase
29
        ldw     $2,$8,0
30
        and     $2,$2,1
31
        jr      $31
32
 
33
kbdin:
34
        sub     $29,$29,12
35
        stw     $31,$29,8
36
        stw     $16,$29,4
37
        stw     $17,$29,0
38
kbdin0:
39
        jal     kbdinp
40
        add     $16,$2,$0                ; key 1 in $16
41
        add     $8,$0,0xF0
42
        bne     $16,$8,kbdin2
43
kbdin1:
44
        jal     kbdinp
45
        j       kbdin0
46
kbdin2:
47
        jal     kbdinp
48
        add     $17,$2,$0                ; key 2 in $17
49
        beq     $17,$16,kbdin2
50
        add     $8,$0,0xF0
51
        beq     $17,$8,kbdin3
52
        j       kbdin5
53
kbdin3:
54
        jal     kbdinp
55
        bne     $2,$16,kbdin2
56
kbdin4:
57
        add     $4,$16,$0                ; use key 1
58
        add     $5,$0,xltbl1             ; with translation table 1
59
        jal     xlat
60
        j       kbdx
61
kbdin5:
62
        jal     kbdinp
63
        add     $8,$0,0xF0
64
        bne     $2,$8,kbdin5
65
kbdin6:
66
        jal     kbdinp
67
        beq     $2,$16,kbdin7
68
        beq     $2,$17,kbdin9
69
        j       kbdin5
70
kbdin7:
71
        jal     kbdinp
72
        add     $8,$0,0xF0
73
        bne     $2,$8,kbdin7
74
kbdin8:
75
        jal     kbdinp
76
        bne     $2,$17,kbdin7
77
        j       kbdin11
78
kbdin9:
79
        jal     kbdinp
80
        add     $8,$0,0xF0
81
        bne     $2,$8,kbdin9
82
kbdin10:
83
        jal     kbdinp
84
        bne     $2,$16,kbdin9
85
        j       kbdin11
86
kbdin11:
87
        add     $8,$0,0x12               ; left shift key
88
        beq     $16,$8,kbdin12
89
        add     $8,$0,0x59               ; right shift key
90
        beq     $16,$8,kbdin12
91
        add     $8,$0,0x14               ; ctrl key
92
        beq     $16,$8,kbdin14
93
        j       kbdin13
94
kbdin12:
95
        add     $4,$17,$0                ; use key 2
96
        add     $5,$0,xltbl2             ; with translation table 2
97
        jal     xlat
98
        j       kbdx
99
kbdin13:
100
        add     $4,$16,$0                ; use key 1
101
        add     $5,$0,xltbl1             ; with translation table 1
102
        jal     xlat
103
        j       kbdx
104
kbdin14:
105
        add     $4,$17,$0                ; use key 2
106
        add     $5,$0,xltbl1             ; with translation table 1
107
        jal     xlat
108
        and     $2,$2,0xFF-0x60         ; then reset bits 0x60
109
        j       kbdx
110
kbdx:
111
        ldw     $17,$29,0
112
        ldw     $16,$29,4
113
        ldw     $31,$29,8
114
        add     $29,$29,12
115
        jr      $31
116
 
117
kbdinp:
118
        add     $8,$0,kbdbase
119
kbdinp1:
120
        ldw     $9,$8,0
121
        and     $9,$9,1
122
        beq     $9,$0,kbdinp1            ; wait until character ready
123
        ldw     $2,$8,4                 ; get character
124
        add     $9,$0,0xE0
125
        beq     $2,$9,kbdinp1           ; ignore E0 prefix
126
        add     $9,$0,0xE1
127
        beq     $2,$9,kbdinp1           ; as well as E1 prefix
128
        jr      $31
129
 
130
xlat:
131
        sub     $29,$29,8
132
        stw     $31,$29,4
133
        stw     $16,$29,0
134
        and     $16,$4,0xFF
135
        add     $8,$16,$5
136
        ldbu    $2,$8,0
137
        bne     $2,$0,xlat1
138
;       add     $4,$0,'<'
139
;       jal     cout
140
;       add     $4,$16,$0
141
;       jal     byteout
142
;       add     $4,$0,'>'
143
;       jal     cout
144
        add     $2,$16,$0
145
xlat1:
146
        ldw     $16,$29,0
147
        ldw     $31,$29,4
148
        add     $29,$29,8
149
        jr      $31

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.