Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / SLOF / board-qemu / slof / hvterm.fs
1 \ *****************************************************************************
2 \ * Copyright (c) 2011 IBM Corporation
3 \ * All rights reserved.
4 \ * This program and the accompanying materials
5 \ * are made available under the terms of the BSD License
6 \ * which accompanies this distribution, and is available at
7 \ * http://www.opensource.org/licenses/bsd-license.php
8 \ *
9 \ * Contributors:
10 \ *     IBM Corporation - initial implementation
11 \ ****************************************************************************/
12
13 \ PAPR hvterm console.  Enabled very early.
14
15 0 CONSTANT default-hvtermno
16 \ Buffer for pre-display
17 4096 CONSTANT disp-size
18 CREATE prevga-disp-buf 4096 allot
19 0 value disp-ptr
20 true value store-prevga?
21
22 : store-to-disp-buffer         ( ch  --  )
23     prevga-disp-buf disp-ptr disp-size MOD + c!
24     disp-ptr 1 + to disp-ptr
25 ;
26
27 : hvterm-emit
28     store-prevga? IF
29         dup store-to-disp-buffer
30     THEN
31     default-hvtermno SWAP hv-putchar
32 ;
33 : hvterm-key?  default-hvtermno hv-haschar ;
34 : hvterm-key   BEGIN hvterm-key? UNTIL default-hvtermno hv-getchar ;
35
36 ' hvterm-emit to emit
37 ' hvterm-key  to key
38 ' hvterm-key? to key?
39
40 \ Override serial methods to make term-io.fs happy
41 : serial-emit hvterm-emit ;
42 : serial-key? hvterm-key? ;
43 : serial-key  hvterm-key  ;