⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fp_seg.gml

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 GML
字号:
.func FP_SEG
#include <i86.h>
unsigned FP_SEG( void __far *far_ptr );
.funcend
.desc begin
The &func macro can be used to obtain the segment portion of the far
pointer value given in
.arg far_ptr.
.desc end
.return begin
The macro returns an unsigned integer value which is the segment portion
of the pointer value.
.return end
.see begin
.seelist FP_SEG FP_OFF MK_FP segread
.see end
.exmp begin
#include <stdio.h>
#include <i86.h>

char ColourTable[256][3];

void main()
  {
    union REGPACK r;
    int i;
.exmp break
    /* read block of colour registers */
    r.h.ah = 0x10;
    r.h.al = 0x17;
#if defined(__386__)
    r.x.ebx = 0;
    r.x.ecx = 256;
    r.x.edx = FP_OFF( ColourTable );
    r.w.ds = r.w.fs = r.w.gs = FP_SEG( &r );
#else
    r.w.bx = 0;
    r.w.cx = 256;
    r.w.dx = FP_OFF( ColourTable );
#endif
    r.w.es = FP_SEG( ColourTable );
    intr( 0x10, &r );
.exmp break
    for( i = 0; i < 256; i++ ) {
      printf( "Colour index = %d "
              "{ Red=%d, Green=%d, Blue=%d }\n",
              i,
              ColourTable[i][0],
              ColourTable[i][1],
              ColourTable[i][2] );
    }
  }
.exmp end
.class Intel
.system

⌨️ 快捷键说明

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