appl.cc.svn-base

来自「德国Erlangen大学教学操作系统源码。」· SVN-BASE 代码 · 共 115 行

SVN-BASE
115
字号
/*****************************************************************************//* Betriebssysteme                                                           *//*---------------------------------------------------------------------------*//*                                                                           *//*                         A P P L I C A T I O N                             *//*                                                                           *//*---------------------------------------------------------------------------*//* Die Klasse Application definiert die einzige Anwendung von OO-Stubs.      *//*****************************************************************************//* INCLUDES */#include "user/appl.h"#include "device/cgastr.h"#include "machine/keyctrl.h"#include "machine/cgascr.h"/* GLOBALE VARIABLEN */extern CGA_Stream kout;extern Keyboard_Controller kbctrl;extern void delay();         void Application::action () {///////// test der operatoren///////////////////////////////////////////////////////////////////	int a= -100, b= -200, c= -300, d= -400;	kout << hex << a <<endl << dec << b <<endl << oct << c <<endl << bin << d << dec <<endl;	kout.flush();///////////////////////////////////////////////////////////////////////////////////////////////////// teste nun die tastatur ////////////////////////////////////////	while (true)		{			int repeat= 0;		int delay= 0;		Key k= kbctrl.key_hit();		if (k.valid())		{///////////////// die kontrol taste wurde gedrueckt			if (k.ctrl())			{				switch (k.scancode())				{				case Key::scan::up:	// arrow up					if (repeat>0) repeat--;					break;				case Key::scan::down:	// arrow down					if (repeat<31) repeat++;					break;				case Key::scan::left:	// arrow left					if (delay>0) delay--;					break;				case Key::scan::right:	// arrow right					if (delay<7) delay++;					break;				}				kbctrl.set_repeat_rate(repeat, delay);							}//////////////////// keine kontrol taste wurde gedrueckt			else			{				int cx, cy;				switch (k.scancode())				{				case Key::scan::up:	// arrow up					kout.getpos(cx, cy);					if (cy>0) cy--;					kout.setpos(cx, cy);					break;				case Key::scan::down:	// arrow down					kout.getpos(cx, cy);					if (cy<CGA_Screen::CGA_Attrib::screen_height-1) cy++;					kout.setpos(cx, cy);					break;				case Key::scan::left:	// arrow left					kout.getpos(cx, cy);					if (cx>0) cx--;					kout.setpos(cx, cy);					break;				case Key::scan::right:	// arrow right					kout.getpos(cx, cy);					if (cx<CGA_Screen::CGA_Attrib::screen_height-1) cx++;					kout.setpos(cx, cy);					break;				default:					kout <<k.ascii();					kout.flush();				}			}					}	}  }

⌨️ 快捷键说明

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