أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.
To set the video mode, call interrupt 0x10 (BIOS video functions) with 0 (zero) in the AH register and the desired mode number in the AL register. For mode 0x13, the code (Borland C) would be as follows:
union REGS regs; regs.h.ah = 0x00; /* function 00h = mode set */ regs.h.al = 0x13; /* 256-color */ int86(0x10,®s,®s); /* do it! */To return to text mode after the program finishes, simply set the mode number to 3.
union REGS regs; regs.h.ah = 0x00; regs.h.al = 0x03; /* text mode is mode 3 */ int86(0x10,®s,®s); Plotting a pixelAn easy way to plot a pixel is by using function 0x0C under BIOS interrupt 0x10. For this function, set CX and DX to the pixel x and y location. The color displayed depends on the value in AL. See Table I for a list of common colors.
union REGS regs; regs.h.ah = 0x0C; /* function 0Ch = pixel plot */ regs.h.al = color; regs.x.cx = x; /* x location, from 0..319 */ regs.x.dx = y; /* y location, from 0..199 */ int86(0x10,®s,®s);This pixel-plotting method is easy, but it is also very slow. BIOS will do certain checks to make sure that the input is valid, and then it will test to see if the (x,y) coordinates are within the screen boundaries, and finally it will calculate the offset to video memory. A faster way to plot a pixel is to write directly to video memory.