mode3.c

来自「linux 下svgalib编的一个界面程序示例」· C语言 代码 · 共 53 行

C
53
字号
/*Set mode to VESA mode 3 (80x25 text mode)*/#include <stdio.h>#include <string.h>#include <unistd.h>#include <stdlib.h>#include <sys/ioctl.h>#include <sys/kd.h>#include <sys/stat.h>#include "lrmi.h"void set_vesa_mode(int mode){	struct LRMI_regs r;	memset(&r, 0, sizeof(r));	r.eax = 0x4f02;        r.ebx = mode;	if (!LRMI_int(0x10, &r))		{		fprintf(stderr, "Can't set video mode (vm86 failure)\n");		}	}int main(int argc, char *argv[]){   	int i;                if((argc>1)&&(!strcmp(argv[1],"-h"))){           	printf("Usage: mode3 [ modenum [ font ] ]\n"                       "\n"                       "uses VESA bios to set video mode to modenum (3 by default)\n"                       "if font is given, uses setfont to change the screen font\n\n");   	                return 0;        };	if (!LRMI_init())		return 1;	ioperm(0, 0x400, 1);	iopl(3);        i=3;        if(argc>1){           	sscanf(argv[1],"%i",&i);                if((i<=0))i=3;        };	set_vesa_mode(i);        if(argc>2){           	execlp("setfont",argv[2],NULL);                return 1;        };	return 0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?