aboutsummaryrefslogtreecommitdiffstats
path: root/com32
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2010-03-06 14:49:40 -0800
committerH. Peter Anvin <hpa@zytor.com>2010-03-06 14:49:40 -0800
commitc25c83df767519d1a9919dcebda9a58611671cc1 (patch)
tree9a1e200755ef1ff6f813ea85cef01f65a11e6537 /com32
parent600217eb7036a64630a3edd6b093d97b883a9b5c (diff)
downloadsyslinux-c25c83df767519d1a9919dcebda9a58611671cc1.tar.gz
syslinux-c25c83df767519d1a9919dcebda9a58611671cc1.tar.xz
syslinux-c25c83df767519d1a9919dcebda9a58611671cc1.zip
stdcon: make the screen size available
Make the screen size available when using stdcon, not just ansicon. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'com32')
-rw-r--r--com32/lib/sys/stdcon_write.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/com32/lib/sys/stdcon_write.c b/com32/lib/sys/stdcon_write.c
index 8cc6b5f5..9cb2f7db 100644
--- a/com32/lib/sys/stdcon_write.c
+++ b/com32/lib/sys/stdcon_write.c
@@ -37,6 +37,23 @@
#include <minmax.h>
#include "file.h"
+#define BIOS_ROWS (*(uint8_t *)0x484) /* Minus one; if zero use 24 (= 25 lines) */
+#define BIOS_COLS (*(uint16_t *)0x44A)
+
+static int __stdcon_open(struct file_info *fp)
+{
+ fp->o.rows = BIOS_ROWS + 1;
+ fp->o.cols = BIOS_COLS;
+
+ /* Sanity check */
+ if (fp->o.rows < 12)
+ fp->o.rows = 24;
+ if (fp->o.cols < 40)
+ fp->o.cols = 80;
+
+ return 0;
+}
+
static ssize_t __stdcon_write(struct file_info *fp, const void *buf,
size_t count)
{
@@ -68,5 +85,5 @@ const struct output_dev dev_stdcon_w = {
.fileflags = O_WRONLY | O_CREAT | O_TRUNC | O_APPEND,
.write = __stdcon_write,
.close = NULL,
- .open = NULL,
+ .open = __stdcon_open,
};