SGABIOS: fix wrong video attrs for int 10h, ah==13h
[sgabios.git] / sgabios.h
1 /*
2 * Copyright 2010 Google Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 /* don't allocate ebda if new value at 0x40e will be less than this */
18 #define EBDA_MIN_SEG 0x9800
19 #define SGABIOS_EBDA_KB 1
20 /* note: no testing has yet been done logging other than 256 bytes */
21 #define SGABIOS_EBDA_BYTES (SGABIOS_EBDA_KB*1024)
22 #define SGABIOS_EBDA_DELTA (SGABIOS_EBDA_BYTES/16)
23 #define SGABIOS_EBDA_LOG_START 256
24 #define SGABIOS_EBDA_LOG_SIZE 256
25 #define SGABIOS_EBDA_POS_START (SGABIOS_EBDA_LOG_START+SGABIOS_EBDA_LOG_SIZE)
26 #define SGABIOS_EBDA_POS_LAST (SGABIOS_EBDA_POS_START+(SGABIOS_EBDA_LOG_SIZE*2)-2)
27
28 /* serial costants that may require modification */
29 #define COM_BASE_ADDR 0x3f8
30 #define PORT_SPEED 115200
31 #define LCR_VALUE 0x13 /* 8n1 */
32
33 /* serial constants below shouldn't require modification */
34 #define IER_OFFSET 0x01
35 #define FCR_OFFSET 0x02
36 #define LCR_OFFSET 0x03
37 #define MCR_OFFSET 0x04
38 #define LSR_OFFSET 0x05
39 #define MSR_OFFSET 0x06
40 #define SCR_OFFSET 0x07
41 #define LCR_DLAB 0x80
42 #define MCR_DTRRTS 0x03
43 #define FCR_FIFO_ENABLE 0x01
44 #define PORT_DIVISOR 115200
45 #define TRANSMIT_READY_BIT 0x20
46 #define BIOS_BUILD_VERSION "$Id: sgabios.S 7 2009-11-13 00:21:26Z smiles@google.com $"
47
48 #define KBD_HEAD 0x1a
49 #define KBD_TAIL 0x1c
50 #define KBD_BUF_START 0x1e
51 #define KBD_BUF_END 0x3e
52
53 #define VGA_IO_BASE 0x3d4
54 #define BDA_SEG 0x40
55 #define BDA_EBDA 0x0e
56 #define BDA_MEM_SIZE 0x13
57 #define BDA_MODE_NUM 0x49
58 #define BDA_COLS 0x4a
59 #define BDA_PAGE_SIZE 0x4c
60 /* BDA word 40:0c traditionally holds the LPT3 io port address... */
61 /* Reuse it for tracking where the serial console cursor was left */
62 /* Don't send ansi cursor pos update without text ready to output */
63 /* Some operations don't update cursor position, but next int 10h */
64 /* call is often one that might update to where cursor already is */
65 #define BDA_SERIAL_POS 0x0c
66 #define BDA_CURSOR_BUF 0x50
67 #define BDA_CURSOR_COL 0x50
68 #define BDA_CURSOR_ROW 0x51
69 #define BDA_CURSOR_SCAN 0x60
70 #define BDA_ACTIVE_PAGE 0x62
71 #define BDA_6845_ADDR 0x63
72 #define BDA_MODE_SEL 0x65
73 #define BDA_COLOR_VAL 0x66
74 #define BDA_ROM_OFF 0x67
75 #define BDA_ROM_SEG 0x69
76 #define BDA_ROWS 0x84