http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

Wise2Food



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mode 13h



i accept muh mistake. i apologize fer that... i guess
real mode programming habits die hard. ya what u said
is correct.


--- Don Williamson <DonWilliamson@aqua-pacific.com>
wrote:
> This is just a polite request, but could you PLEASE
> check your sources
> before you go giving example information to people?
> The memory location you
> specified in the mail is wrong.
> 
> The location number is dependant upon whether you're
> programming in real
> mode or protected mode. In real mode, memory is
> wildly segmented and the
> location of video memory is at 0xA000:0000, that's
> segment 0xA000, offset 0,
> which is completely different. In this case your
> pointer would be...
> 
> unsigned char far *vbuf = (unsigned char far
> *)0xA0000000L;
> 
> It looks like most people use DJGPP though, which
> means addressing is in
> protected mode. Usually this means you can have
> access to memory linearly,
> all your segments and offsets are disolved and you
> can calculate an
> equivalent protected mode address like so...
> 
> linear address = segment * 10h + offset
> 
> This is because each segment in real mode is
> seperated by a 16-byte
> boundary. So for DJGPP (or, protected mode), your
> address would become...
> 
> A000h * 10h + 0 = A0000h
> unsigned char *vbuf = (unsigned char *)0xA0000L;
> 
> It can be a little more complicated than that I
> believe with DJGPP since in
> protected mode we still have segments, albeit much
> more bigger and flexible
> ones (up to 4 gig in size, depending on the
> granularity bit). The thing is,
> DOS extenders like DOS4G/W will allow you to do the
> above but the extender
> that comes with DJGPP (CWSDPMI?) needs you to do the
> following...
> 
> unsigned char *vbuf = (unsigned char *)0xA0000 +
> __djgpp_conventional_base;
> 
> (DOS4G/W actually does this calculation for you
> dynamically, reducing your
> worries - great extender that :0)
> 
> Seeya,
> - Don
> 
> -----Original Message-----
> From: Nick Hill <nikhilwiz@yahoo.com>
> To: gameprogrammer@gameprogrammer.com
> <gameprogrammer@gameprogrammer.com>
> Date: 08 September 1999 08:37
> Subject: Re: Mode 13h
> 
> 
> >make a pointer to 0xA000
> >unsigned char *VidMem=0xA000. This makes a pointer
> to tha vid. mem.
> >Mode 13h is a linear buffer where 1 byte represents
> one pixel. u can
> >plot a pixel by writing the color of tha pixel to
> tha particular mem.
> >loc. Since the data in the vid. mem. start from
> (0,0) and proceeds
> >along tha row, the first 320 bytes represents tha
> first row., u get tha
> >idea. so tha formula to calc. tha byte at (x,y) on
> screen will be :
> >
> >pos=y * 320 + x;
> >VidMem[pos]=color;
> >
> >where color is tha color of tha pixel u wanna plot.
> Keep it under 255,
> >as Mode 13h s'portz only that much. thazz why tha
> data type on VidMem
> >also is defined as unsigned char... so that u wont
> end up writing
> >NEthin' oth' than 0-255. Hope this helped.
> >
> >Nikhil.
> >
> >--- Peter Peterssen <getoutnow@Hotmail.com> wrote:
> >> Hello..
> >>
> >> Mode 13H. Wow. Then, perhaps you can tell me how
> the
> >> heck I draw a dot on
> >> the screen like X and Y ?
> >>
> >> I do call 0xA0000 and the use the..
> >> outportb(0x3c9, red);
> >> outportb(0x3c9, green);
> >> outportb(0x3c9, blue);
> >>
> >> .. for the background layout and then ..
> >>
> >> b= 0;
> >> pokeb(0xa0000, B,30)
> >>
> >> .. for the actual dot.
> >>
> >> This doensnt work unless i add 1 to red OR green
> OR
> >> blue. ( I dont see the
> >> dot on the screen).
> >>
> >> So, as you see Im totaly lost and really dont get
> >> the whole thing. Do you
> >> have an example how to structure something?
> >>
> >>
>
______________________________________________________
> >> Get Your Private, Free Email at
> >> http://www.hotmail.com
> >>
>
=================================================================
> >> To SUBSCRIBE or UNSUBSCRIBE please visit
> >> http://gameprogrammer.com/mailinglist.html
> >>
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Bid and sell for free at http://auctions.yahoo.com
>
>=================================================================
> >To SUBSCRIBE or UNSUBSCRIBE please visit
> >http://gameprogrammer.com/mailinglist.html
> >
> >
> 
> 
>
=================================================================
> To SUBSCRIBE or UNSUBSCRIBE please visit
> http://gameprogrammer.com/mailinglist.html
> 

__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com
=================================================================
To SUBSCRIBE or UNSUBSCRIBE please visit
http://gameprogrammer.com/mailinglist.html