aboutsummaryrefslogtreecommitdiffstats
path: root/core/plaincon.c
blob: 2b7c4a63036652b36bf27b3ba42a463e30451832 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <sys/io.h>
#include <fs.h>
#include <com32.h>

#include "bios.h"
#include "graphics.h"
#include <syslinux/video.h>

/*
 * Write a single character in AL to the console without
 * mangling any registers; handle video pages correctly.
 */
__export void writechr(char data)
{
	com32sys_t ireg, oreg;

	write_serial(data);	/* write to serial port if needed */

	if (UsingVGA & 0x8)
		syslinux_force_text_mode();

	if (!(DisplayCon & 0x1))
		return;

	ireg.eax.b[0] = data;
	ireg.eax.b[1] = 0xE;
	ireg.ebx.b[0] = 0x07;	/* attribute */
	ireg.ebx.b[1] = *(uint8_t *)BIOS_page; /* current page */
	__intcall(0x10, &ireg, &oreg);
}

void pm_writechr(com32sys_t *regs)
{
	writechr(regs->eax.b[0]);
}