📄 screen.cpp
字号:
// ******************************************************************** //
// //
// SCREEN.CPP //
// Copyright (c) 1993, Michael Holmes and Bob Flanders //
// C++ Communication Utilities //
// //
// This file contains the routines for moving to and from //
// the window buffers for saving and restoring the screen. //
// //
// ******************************************************************** //
char huge *vid_seg = // video adapter address
(char huge *) MK_FP(0xb800, 0);
/* ******************************************************************** *
*
* screen_move() -- move between the video adapter and work buffer
*
* ******************************************************************** */
void screen_move(int left, int top, // left and top corner
int right, int bottom, // right and bottom corner
char *buffer, // work buffer
int dir) // direction (0=to screen)
{
char huge *p1, huge *p2; // work pointers
int y, // loop variable
p1size, p2size, size; // bytes per line
size = (right - left + 1) * 2; // length of window line
y = ((top - 1) * 160) + ((left - 1) * 2); // offset into video buffer
if (dir) // q. moving to buffer?
{
p1 = buffer; // a. yes .. dest is buffer
p1size = size; // ..and line length
p2 = &vid_seg[y]; // source is video ram
p2size = 160; // ..and length is 80 * 2
}
else
{
p1 = &vid_seg[y]; // else .. source is video ram
p1size = 160; // ..and length is 80 * 2
p2 = buffer; // destination is buffer
p2size = size; // ..and line length
}
for (y = bottom - top + 1; y--; // loop thru for whole
p1 += p1size, p2 += p2size) // ..screen window moving
memcpy((void *) p1, (void *) p2, size); // ..from one to the other
}
/* ******************************************************************** *
*
* gettext() -- get text data from the video memory
*
* ******************************************************************** */
void gettext(int left, int top, // left and top corner
int right, int bottom, // right and bottom corner
char *buffer) // work buffer
{
screen_move(left, top, right, bottom, // set up common call
buffer, 1); // ..to screen move routine
}
/* ******************************************************************** *
*
* puttext() -- put text data from a work buffer into the video memory
*
* ******************************************************************** */
void puttext(int left, int top, // left and top corner
int right, int bottom, // right and bottom corner
char *buffer) // work buffer
{
screen_move(left, top, right, bottom, // set up common call
buffer, 0); // ..to screen move routine
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -