Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 通过dos.h(turboc+;+;)获取像素颜色_C++_Turbo C++ - Fatal编程技术网

C++ 通过dos.h(turboc+;+;)获取像素颜色

C++ 通过dos.h(turboc+;+;)获取像素颜色,c++,turbo-c++,C++,Turbo C++,我目前正在做一个项目,要求我在屏幕上画东西而不需要图形。h,我正在做DOSBOX(turbo c++) 以下功能通过中断(dos.h)将颜色“color”(1-256)的像素置于屏幕的x、y方向: 返回x,y中像素颜色的函数的代码是什么?我想象的是: type getPixel(int x, int y){ //code return color; } 另外,有人能解释一下像素是如何工作的吗?我知道它会修改寄存器,但我不知道每个值的含义(除了_CX、_DX、_AL基于上下文)。我猜getPix

我目前正在做一个项目,要求我在屏幕上画东西而不需要图形。h,我正在做DOSBOX(turbo c++)

以下功能通过中断(dos.h)将颜色“color”(1-256)的像素置于屏幕的x、y方向:

返回x,y中像素颜色的函数的代码是什么?我想象的是:

type getPixel(int x, int y){
//code
return color;
}

另外,有人能解释一下像素是如何工作的吗?我知道它会修改寄存器,但我不知道每个值的含义(除了_CX、_DX、_AL基于上下文)。

我猜
getPixel()
可以这样实现:

int getPixel(int x, int y)
{
    _AH = 0x0D;
    _CX = x;
    _DX = y;
    _BX = 0x01;
    geninterrupt (0x10);
    return _AL;
}
这些东西通过调用存储在计算机BIOS中的代码(中断处理程序)来工作


你可以在

中阅读更多的信息,比如考虑使用一个现代编译器,在那里你可以编写符合标准的C++。即使是上个世纪,4标准-Relabase-Ag编译器也会比这更好。如果在任何地方,这属于RealCutoCurn.SE,除了CordOrf64和ZX84问题。Turbo C++和DoSbox的使用是对任务的要求,其目的是模仿一台真正的旧计算机。该项目涉及从头开始(逐像素)制作GUI。
int getPixel(int x, int y)
{
    _AH = 0x0D;
    _CX = x;
    _DX = y;
    _BX = 0x01;
    geninterrupt (0x10);
    return _AL;
}