Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | \ ========== Copyright Header Begin ========================================== |
2 | \ | |
3 | \ Hypervisor Software File: syskey.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 | \ syskey.fth 2.5 98/10/21 | |
43 | \ Copyright 1985-1994 Bradley Forthware | |
44 | ||
45 | \ Console I/O using the C wrapper program | |
46 | ||
47 | headerless | |
48 | decimal | |
49 | ||
50 | : sys-emit ( c -- ) 1 syscall drop ; \ Outputs a character | |
51 | : sys-key ( -- c ) 0 syscall retval ; \ Inputs a character | |
52 | : sys-(key? ( -- f ) 8 syscall retval ; \ Is a character waiting? | |
53 | : sys-cr ( -- ) 27 syscall #out off 1 #line +! ; \ Go to next line | |
54 | ||
55 | \ Is the input stream coming from a keyboard? | |
56 | ||
57 | : sys-interactive? ( -- f ) 12 syscall retval 0= ; | |
58 | ||
59 | headers | |
60 | \ Reads at most "len" characters into memory starting at "adr". | |
61 | \ Performs keyboard editing (erase character, erase line, etc). | |
62 | \ The operation terminates when either a "return" is typed or "len" | |
63 | \ characters have been read. | |
64 | \ The operating system does the line editing until we load the line editor | |
65 | ||
66 | : sys-accept ( adr len -- actual ) | |
67 | 14 syscall 2drop retval #out off 1 #line +! | |
68 | ; | |
69 | headerless | |
70 | ||
71 | \ Outputs "len" characters from memory starting at "adr" | |
72 | ||
73 | : sys-type ( adr len -- ) 13 syscall 2drop ; | |
74 | ||
75 | \ Returns to the OS | |
76 | ||
77 | : sys-bye ( -- ) 0 9 syscall ; | |
78 | ||
79 | \ Memory allocation | |
80 | ||
81 | : sys-alloc-mem (s #bytes -- adr ) 26 syscall drop retval ; | |
82 | : sys-free-mem (s adr #bytes -- ) 32 syscall 2drop ; | |
83 | ||
84 | \ Cache flushing - needed for copyback data caches (e.g. 68040) | |
85 | ||
86 | : sys-sync-cache ( adr len -- ) swap 29 syscall 2drop ; | |
87 | ||
88 | : install-wrapper-io ( -- ) | |
89 | ['] sys-alloc-mem is alloc-mem | |
90 | ['] sys-free-mem is free-mem | |
91 | ||
92 | ['] sys-cr is cr | |
93 | ['] sys-type is (type | |
94 | ['] sys-emit is (emit | |
95 | ['] sys-key is (key | |
96 | ['] sys-(key? is key? | |
97 | ['] sys-bye is bye | |
98 | ['] sys-accept is accept | |
99 | ['] sys-interactive? is (interactive? | |
100 | ||
101 | ['] sys-sync-cache is sync-cache | |
102 | ; | |
103 | headers |