how to get 1024*764 resolution in turbo borland c++?

This will require assembly language + c++

Page 1 of 1

4 Replies - 3200 Views - Last Post: 22 December 2007 - 06:53 AM Rate Topic: -----

#1 zakariyya ahmed  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 6
  • Joined: 20-December 07

how to get 1024*764 resolution in turbo borland c++?

Post icon  Posted 20 December 2007 - 11:50 AM

how to get 1024*764 (256 colors if possible) resolution in turbo borland c++ running in windows xp (vesa graphic mode or any other)?
(i can use vc++ and other 32 bit compilers......but no!!......id like to use the 'traditional' 16-bit compiler using dos interrupts.)
any suggestions?any books to refer?? or should i be asking this in an asm forum???

second problem is that i dont know much about 256 graphic modes.any articles on this???

Is This A Good Question/Topic? 1

Replies To: how to get 1024*764 resolution in turbo borland c++?

#2 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5801
  • View blog
  • Posts: 12,640
  • Joined: 16-October 07

Re: how to get 1024*764 resolution in turbo borland c++?

Posted 20 December 2007 - 12:26 PM

If you are in Windows XP, then the resolution and color depth are moot. You have to go through the Windows settings at some point.

If you're in DOS then you can directly write to the address of the display buffer and manipulate the bits manually. Of course, higher resolutions usually require bit shifts and paging. Ah, the bad old days. :P

This post has been edited by baavgai: 20 December 2007 - 12:27 PM

Was This Post Helpful? 0
  • +
  • -

#3 zakariyya ahmed  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 6
  • Joined: 20-December 07

Re: how to get 1024*764 resolution in turbo borland c++?

Posted 22 December 2007 - 01:34 AM

View Postbaavgai, on 20 Dec, 2007 - 12:26 PM, said:

If you're in DOS then you can directly write to the address of the display buffer and manipulate the bits manually. Of course, higher resolutions usually require bit shifts and paging. Ah, the bad old days. :P


yeah! Dos is what iam talking about!
i know how to initailize the graphic mode (SVGA)
(ax=0x4f02 ,bx=0x11A or bx=0x107
interrupt 0x10)

but i dont know how(or where) to plot the pixels!!!
i tried this
void putpixel(unsigned int x,unsigned int y,unsigned int color)
{
  unsigned int* memory=(unsigned int*)0xA000;
  memory=memory+(y*1280)+x;
  *memory=color;
}

Blank screen!!!
obviously i dont know where to write what!!!!( :blink: )

so let me try 11Ah - 1280x1024x64K mode
how would u plot the pixels???
---------------
thanks

*Mod Edit: added code tags: :code:

This post has been edited by NickDMax: 22 December 2007 - 06:05 AM

Was This Post Helpful? 0
  • +
  • -

#4 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2250
  • View blog
  • Posts: 9,245
  • Joined: 18-February 07

Re: how to get 1024*764 resolution in turbo borland c++?

Posted 22 December 2007 - 06:27 AM

Well, I would suggest that you start by looking up the VESA VBE standard. You can find a copy on wotsit.

Also, if you are going to be programming at this low a level I recommend that you read "Graphics Programming Black Book" by Michael Abrash which can be downloaded (chapter by chapter) from BYTE.com. This book is a classic written by one of the masters of graphics programming -- but sometimes it is hard to find the information you are looking for. Most of the information you are going to be looking for starts in chapter 23 ("Bones and Sinew") the chapters before that are all about assembly language and how it applies to computer graphics.

Basically you can plot pixels using memory access, but you have to make sure that the right 'page' is loaded. You only have 1 segment worth of memory accessible at a time, which at first gives you the very upper strip of the 1024x768 screen. So you will need to make sure that the right bank is loaded into memory. By the way, in a 256 color mode 1 pixel = 1 byte, so it is better to use (unsigned char *) to access the buffer.

BY the way, since modern graphics cards have a good bit of memory, the video card buffer tends to be capable of holding MANY screens (great for creating panning graphics) so you need to make sure that the right part of the buffer is being displayed. That is you can write to areas of the buffer that are not currently displayed. So you need to make sure that the area you are plotting to gets displayed.
Was This Post Helpful? 0
  • +
  • -

#5 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2250
  • View blog
  • Posts: 9,245
  • Joined: 18-February 07

Re: how to get 1024*764 resolution in turbo borland c++?

Posted 22 December 2007 - 06:53 AM

I also wanted to add that you can find a bunch of old graphics libraries at Programmers Heaven.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1