Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | \ ========== Copyright Header Begin ========================================== |
2 | \ | |
3 | \ Hypervisor Software File: debug.fth | |
4 | \ | |
5 | \ Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
6 | \ | |
7 | \ - Do no alter or remove copyright notices | |
8 | \ | |
9 | \ - Redistribution and use of this software in source and binary forms, with | |
10 | \ or without modification, are permitted provided that the following | |
11 | \ conditions are met: | |
12 | \ | |
13 | \ - Redistribution of source code must retain the above copyright notice, | |
14 | \ this list of conditions and the following disclaimer. | |
15 | \ | |
16 | \ - Redistribution in binary form must reproduce the above copyright notice, | |
17 | \ this list of conditions and the following disclaimer in the | |
18 | \ documentation and/or other materials provided with the distribution. | |
19 | \ | |
20 | \ Neither the name of Sun Microsystems, Inc. or the names of contributors | |
21 | \ may be used to endorse or promote products derived from this software | |
22 | \ without specific prior written permission. | |
23 | \ | |
24 | \ This software is provided "AS IS," without a warranty of any kind. | |
25 | \ ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, | |
26 | \ INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A | |
27 | \ PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN | |
28 | \ MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR | |
29 | \ ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR | |
30 | \ DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN | |
31 | \ OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR | |
32 | \ FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE | |
33 | \ DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, | |
34 | \ ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF | |
35 | \ SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. | |
36 | \ | |
37 | \ You acknowledge that this software is not designed, licensed or | |
38 | \ intended for use in the design, construction, operation or maintenance of | |
39 | \ any nuclear facility. | |
40 | \ | |
41 | \ ========== Copyright Header End ============================================ | |
42 | \ id: @(#)debug.fth 1.3 99/02/25 | |
43 | \ purpose: | |
44 | \ copyright: Copyright 1997 Sun Microsystems, Inc. All Rights Reserved | |
45 | \ | |
46 | ||
47 | : .line-dump ( -- ) ." DUMP: " kbd-char-ptr @ insert-ptr @ do i c@ . loop cr ; | |
48 | : .rbase ( base -- ) .r base ! space ; | |
49 | : .pdec ( xx -- ) base @ swap decimal 2 .rbase ; | |
50 | : .poct ( xx -- ) base @ swap 8 base ! 3 .rbase ; | |
51 | : .phex ( xx -- ) base @ swap hex 2 .rbase ; | |
52 | ||
53 | : .decode-key ( code -- ) | |
54 | case | |
55 | h# 8 of ." bs " endof | |
56 | h# 9 of ." tab " endof | |
57 | h# a of ." linefeed" endof | |
58 | h# d of ." carret " endof | |
59 | h# 1b of ." esc " endof | |
60 | h# 20 of ." bl " endof | |
61 | ||
62 | h# 82 of ." shift " endof | |
63 | h# 83 of ." power " endof | |
64 | h# 84 of ." ctrl " endof | |
65 | h# 85 of ." altg " endof | |
66 | h# 86 of ." nop " endof | |
67 | h# 87 of ." oops " endof | |
68 | h# 88 of ." hole " endof | |
69 | ||
70 | h# 90 of ." error " endof | |
71 | h# 91 of ." idle " endof | |
72 | h# 92 of ." mon-off/on" endof | |
73 | ||
74 | h# 7e of ." error " endof | |
75 | h# 7f of ." del " endof | |
76 | ||
77 | dup h# 0 h# 20 between if ( char ) | |
78 | ." h# " dup .phex 2 spaces ( -- ) | |
79 | else ( char ) | |
80 | dup h# 90 > if ( char ) | |
81 | ." o# " dup .poct space ( char ) | |
82 | else ( char ) | |
83 | ." ascii " dup emit space ( char ) | |
84 | then ( char ) | |
85 | then ( char ) | |
86 | endcase space ( -- ) | |
87 | ; | |
88 | ||
89 | \ interact | |
90 | ||
91 | : .empty ( -- ) d# 9 spaces ; | |
92 | : insert@ ( n -- ) insert-ptr @ + c@ ; | |
93 | : .entry ( str,len -- ) 1 insert@ ." d# " .pdec type space ; | |
94 | : 1st@ ( -- ) 2 insert@ .decode-key ; | |
95 | : 2nd@ ( -- ) 3 insert@ .decode-key ; | |
96 | : 3rd@ ( -- ) 4 insert@ .decode-key ; | |
97 | ||
98 | : .delta-debug ( type -- ) | |
99 | case | |
100 | 0 of | |
101 | cr | |
102 | ." >> decimal" cr ." >>" cr | |
103 | ." >> d# " kbddata-buffer >kbd-type c@ .d ." keyboard: " | |
104 | current-table$ type cr | |
105 | ." >> \ Normal Shift Alt Key#" | |
106 | endof | |
107 | 2 of | |
108 | cr ." >> kend" cr | |
109 | endof | |
110 | endcase | |
111 | insert-ptr @ c@ ( bits ) | |
112 | ?dup if ( bits ) | |
113 | cr ." >> " ( bits ) | |
114 | case | |
115 | \ Normal Shifted Alt Code | |
116 | d# 0 of .empty .empty .empty " none???" .entry endof | |
117 | d# 1 of .empty .empty 1st@ " ak" .entry endof | |
118 | d# 2 of .empty 1st@ .empty " sk" .entry endof | |
119 | d# 3 of .empty 2nd@ 1st@ " sak" .entry endof | |
120 | d# 4 of .empty .empty .empty " normal?" .entry endof | |
121 | d# 5 of 2nd@ .empty 1st@ " nak" .entry endof | |
122 | d# 6 of 2nd@ 1st@ .empty " nsk" .entry endof | |
123 | d# 7 of 3rd@ 2nd@ 1st@ " allk" .entry endof | |
124 | endcase ( -- ) | |
125 | then ( -- ) | |
126 | ; | |
127 | ||
128 | : .table-debug ( -- ) | |
129 | cr ." >> : do8 8keys ;" cr | |
130 | ." >> d# " kbddata-buffer >kbd-coding c@ .d | |
131 | ." full-keyboard: " current-table$ type cr | |
132 | key-table 3 0 do ( addr ) | |
133 | i case | |
134 | 0 of ." >> \ Normal Keys" endof | |
135 | 1 of ." >> \ Shifted Keys" endof | |
136 | 2 of ." >> \ Alt Keys" endof | |
137 | endcase cr | |
138 | keymap-size 0 do ( addr ) | |
139 | ." >> " ( addr ) | |
140 | d# 8 0 do ( addr ) | |
141 | dup i + c@ .decode-key ( addr ) | |
142 | loop ." do8" cr ( addr ) | |
143 | d# 8 + ( addr' ) | |
144 | 8 +loop ( addr' ) | |
145 | loop drop ( -- ) | |
146 | ; | |
147 | ||
148 | : show3 ( addr -- ) | |
149 | dup >k-altgmap c@ .decode-key | |
150 | dup >k-shiftmap c@ .decode-key | |
151 | >k-normalmap c@ .decode-key | |
152 | ; | |
153 | ||
154 | : show-index ( index -- ) | |
155 | dup | |
156 | ." Alt Shift Normal" cr | |
157 | ." Keytable : " key-table + show3 cr | |
158 | ." Basetable : " base-table + show3 cr | |
159 | ; | |
160 | : si show-index ; | |
161 | ||
162 | [ifndef] complete-tables? | |
163 | ' .delta-debug is delta-debug | |
164 | [else] | |
165 | ' .table-debug is table-debug | |
166 | [then] |