Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <dos.h>
- #include <stdlib.h>
- #include <stdio.h>
- unsigned short int far *Video = (unsigned short int far *)MK_FP(0xA000, 0x0000);
- unsigned short loopbreak = 0;
- unsigned incx = 0;
- unsigned incy = 0;
- unsigned short inccolor = 0;
- void setpixel(unsigned x, unsigned y, unsigned short color){
- /*set initial values for what segment to write to*/
- unsigned int segment = 0xA000;
- unsigned int offset = 0x0000;
- /* first ensure that the pixel is within bounds */
- if(x > 319 || y > 199){
- return;
- }
- /* now calculate segments and offset for x and y */
- segment = segment + (20 * y);
- offset = x;
- /* now set the pointer to the needed location and write the pixel*/
- Video = (unsigned short int far *)MK_FP(segment, offset);
- *Video = color;
- }
- void gameloop(){
- setpixel(incx,incy,inccolor);
- inccolor++;
- incx++;
- if(incx == 319 && incy == 199){
- loopbreak = 1;
- return;
- }
- if(incx == 319){
- incy++;
- incx = 0;
- }
- }
- int main(void){
- unsigned short incpal = 1;
- /* do initializations*/
- printf("\nThis test will slowly fill the screen with colour");
- printf("\nPress enter to continue...");
- getchar();
- _AH = 0x00;
- _AL = 0x13;
- geninterrupt(0x10);
- while(loopbreak == 0){
- gameloop();
- delay(1);
- }
- getchar();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement