3 * Video mode setup, etc. for NEC PC-9800 series.
5 * Copyright (C) 1997,98,99 Linux/98 project <seraphim@kmc.kyoto-u.ac.jp>
7 * Based on the video.S for IBM PC:
8 * copyright (C) Martin Mares <mj@atrey.karlin.mff.cuni.cz>
11 /* Positions of various video parameters passed to the kernel */
12 /* (see also include/linux/tty.h) */
13 #define PARAM_CURSOR_POS 0x00
14 #define PARAM_VIDEO_PAGE 0x04
15 #define PARAM_VIDEO_MODE 0x06
16 #define PARAM_VIDEO_COLS 0x07
17 #define PARAM_VIDEO_EGA_BX 0x0a
18 #define PARAM_VIDEO_LINES 0x0e
19 #define PARAM_HAVE_VGA 0x0f
20 #define PARAM_FONT_POINTS 0x10
22 #define PARAM_VIDEO98_COMPAT 0x0a
23 #define PARAM_VIDEO98_HIRESO 0x0b
24 #define PARAM_VIDEO98_MACHTYPE 0x0c
25 #define PARAM_VIDEO98_LINES 0x0e
26 #define PARAM_VIDEO98_COLS 0x0f
28 # PARAM_LFB_* and PARAM_VESAPM_* are unused on PC-9800.
30 # This is the main entry point called by setup.S
31 # %ds *must* be pointing to the bootsector
33 movw %ax, %es # %es = 0
35 movb %es:BIOS_FLAG, %al
36 movb %al, PARAM_VIDEO_MODE
38 movb $0, PARAM_VIDEO98_HIRESO # 0 = normal
39 movw $NORMAL_TEXT, PARAM_VIDEO_PAGE
41 movw $(80 * 256 + 25), %ax
44 movb $1, PARAM_VIDEO98_HIRESO # !0 = hi-reso
45 movb $(HIRESO_TEXT >> 8), PARAM_VIDEO_PAGE + 1
46 movw $(80 * 256 + 31), %ax
47 1: movw %ax, PARAM_VIDEO98_LINES # also sets VIDEO98_COLS
49 movb $0xc0, %ch # 400-line graphic mode
53 movw $80, PARAM_VIDEO_COLS
55 movw $msg_probing, %si
58 # Check vendor from font pattern of `A'...
60 1: inb $0x60, %al # wait V-sync
67 movb $0x00, %al # select font of `A'
73 movw PARAM_VIDEO_PAGE, %ax
74 cmpw $NORMAL_TEXT, %ax
76 movb $24, %cl # for hi-reso machine
77 3: addw $0x400, %ax # %ax = CG window segment
80 xorw %dx, %dx # get sum of `A' pattern...
89 xorw %bx, %bx # vendor info will go into %bx
90 testb $8, %es:BIOS_FLAG
91 jnz check_hireso_vendor
96 cmpw $0x9639, %ax # XXX: NOT VERIFIED!!!
98 6: incw %bx # compatible machine
100 5: movb %bl, PARAM_VIDEO98_COMPAT
103 movw $msg_fontdata, %si
104 call prtstr_cs # " (CG sum of A = 0x"
107 call prtstr_cs # ") PC-98"
118 call prtstr_cs # "1 "
120 movb $0, PARAM_VIDEO98_MACHTYPE
121 #if 0 /* XXX - This check is bogus? [0000:BIOS_FLAG2]-bit7 does NOT
122 indicate whether it is a note machine, but merely indicates
123 whether it has ``RAM drive''. */
125 testb $0x80, %es:BIOS_FLAG2
132 cmpb $0x20, %al # EPSON note A
134 cmpb $0x22, %al # EPSON note W
136 cmpb $0x27, %al # EPSON note AE
138 cmpb $0x2a, %al # EPSON note WR
141 movb $1, PARAM_VIDEO98_MACHTYPE
147 # print h98 ? (only NEC)
148 cmpb $0, PARAM_VIDEO98_COMPAT
149 jnz 8f # not NEC -> not H98
151 testb $0x80, %es:BIOS_FLAG5
152 jz 8f # have NESA bus -> H98
155 orb $2, PARAM_VIDEO98_MACHTYPE
156 8: testb $0x40, %es:BIOS_FLAG5
159 call prtstr_cs # only prints it :-)
161 movw $msg_normal, %si # "normal"
162 testb $0x8, %es:BIOS_FLAG
164 movw $msg_hireso, %si
167 movw $msg_sysclk, %si
170 testb $0x80, %es:BIOS_FLAG
177 testb $0x40, %es:(0x45c)
178 jz no_30line # no 30-line support
180 movb %es:KB_SHFT_STS, %al
181 testb $0x01, %al # is SHIFT key pressed?
184 testb $0x10, %al # is CTRL key pressed?
187 # switch to 30-line mode
188 movb $30, PARAM_VIDEO98_LINES
189 movw $msg_30line, %si
193 movb $37, PARAM_VIDEO98_LINES
194 movw $40, PARAM_VIDEO_LINES
195 movw $msg_40line, %si
200 int $0x18 # switch video mode
202 int $0x18 # turn on text plane
203 movw %cs:cursor_address, %dx
205 int $0x18 # move cursor to correct place
207 int $0x18 # turn on text plane
209 call prtstr_cs # "Ok.\r\n"
222 # prthex is for debugging purposes, and prints %ax in hexadecimal.
237 msg_probing: .string "Probing machine: "
239 msg_nec: .string "NEC"
240 msg_compat: .string "compatible"
242 msg_fontdata: .string " (CG sum of A = 0x"
246 msg_gs: .string "(GS) "
247 msg_h98: .string "(H98) "
249 msg_normal: .string "normal"
250 msg_hireso: .string "Hi-reso"
252 msg_sysclk: .string " mode, system clock "
256 msg_40line: # cpp will concat following lines, so the assembler can deal.
258 Video mode will be adjusted to 37-line (so-called ``40-line'') mode later.\r\n\
259 THIS MODE MAY DAMAGE YOUR MONITOR PHYSICALLY. USE AT YOUR OWN RISK.\r\n"
260 msg_30line: .string "Switching video mode to 30-line (640x480) mode... "