Thread: Why isnt this code doing anything?

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    118

    Why isnt this code doing anything?

    Im using dgjpp v2 and it compiles with no errors, it gives me exit code 255 (I have no idea what that means).

    But this does nothing, its supposed to draw a pixel and wait for a keypress....

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <dos.h>
    #include <conio.h>
    
    #define SCREEN_WIDTH 320
    #define SCREEN_HEIGHT 200
    
    typedef unsigned char byte;
    
    byte *VGA = (byte*)0xA0000;
    
    void enterMode13()
    {
    	union REGS regs;
    	regs.h.ah = 0x00;
    	regs.h.al = 0x13;
    	int86(0x10, &regs, &regs);
    }
    
    void exitMode13()
    {
    	union REGS regs;
    	regs.h.ah = 0x00;
    	regs.h.al = 0x03;
    	int86(0x10, &regs, &regs);
    }
    
    void plotPixel(int x, int y, byte color);
    
    int main()
    {
    	enterMode13();
    	plotPixel(0, 0, 5);
    	getch();
    	exitMode13();
    	
    	return 0;
    }
    
    void plotPixel(int x, int y, byte color)
    {
    	VGA[y*SCREEN_WIDTH+x] = color;
    }
    Last edited by Marcos; 10-15-2005 at 10:25 PM.
    Why drink and drive when you can smoke and fly?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extended ASCII Characters in an RTF Control
    By JustMax in forum C Programming
    Replies: 18
    Last Post: 04-03-2009, 08:20 PM
  2. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 06:05 PM