Pointers, memory, and questions

Started by
15 comments, last by Some Guy 22 years ago
quote:Original post by Anonymous Poster
There are these two statues in a park; one of a nude man and one of a nude woman. They had been facing each other across a pathway for a hundred years, when one day an angel comes down from the sky and, with a single gesture, brings the two to life. The angel tells them, "As a reward for being so patient through a hundred blazing summers and dismal winters, you have been given life for thirty minutes to do what you''ve wished to do the most."
He looks at her, she looks at him, and they go running behind the shrubbery. The angel waits patiently as the bushes rustle and giggling ensues. After fifteen minutes, the two return, out of breath and laughing.
The angel tells them, "Um, you have fifteen minutes left. Would you care to do it again?" He asks her, "Shall we?" She eagerly replies, "Oh, yes, let''s! But let''s change positions. This time I hold the pigeon down and you crap on its head!"


In the words of James Brown: "Haha! SHUT UP!"
Advertisement
I was also wondering, if a register is a speical value in the cpu/hardware eg 0x400 (just made up by the way) can you use that value or not? also I''ve heard of ring-0 mode before on some hacker news item, so what exactly is it?

CEO Plunder Studios
[email=esheppard@gmail.com]esheppard@gmail.com[/email]
quote:Original post by elis-cool
I was also wondering, if a register is a speical value in the cpu/hardware eg 0x400...

Registers are memory locations, not values.

quote:
also I''ve heard of ring-0 mode before on some hacker news item, so what exactly is it?

It''s the same thing as kernelmode - operating system level access. On modern protected mode operating systems generally only OS components and drivers have ring-0 access. Very few applications need it.

For more information, STFW.

[ GDNet Start Here | GDNet Search Tool | GDNet FAQ ]
[ MS RTFM [MSDN] | SGI STL Docs | Boost ]
[ Google! | Asking Smart Questions | Jargon File ]
Thanks to Kylotan for the idea!
So if I had:
int *pVar;pVar = 0x400 // 0x400 being a register 

What would happen? eg if I tryed to derefernce it, or plant a value there?
Is there a list of registers for cpu''s/hardware that you can use?

CEO Plunder Studios
[email=esheppard@gmail.com]esheppard@gmail.com[/email]
Registers are not memory-mapped... you can't do things like that.

Edit: Just to clarify, a register is a special piece of memory, which holds just 4 bytes (well, some of them hold more, some less).

A memory-mapped piece of hardware allows you to talk to the hardware by reading/writing to certain memory addresses. The old VGA cards mapped 0x0A000 -> 0x19A00 (that's 64k bytes, or 320x200) as the frame buffer, so you could directly access the framebuffer by reading/writing those memory locations.

High-level languages like C/C++ don't allow direct access to registers, though most compilers have features for writing assembly directly (like the __asm directive under VC++) which would allow you to directly access the registers.

codeka.com - Just click it.

[edited by - Dean Harding on April 20, 2002 6:51:37 AM]
quote:Original post by Dean Harding
A memory-mapped piece of hardware allows you to talk to the hardware by reading/writing to certain memory addresses. The old VGA cards mapped 0x0A000 -> 0x19A00 (that''s 64k bytes, or 320x200) as the frame buffer, so you could directly access the framebuffer by reading/writing those memory locations.


So, what about the higher resolution modes? Ones that consume ~300kb of VRAM (640x480x8 I think) and stuff?




E-mail: i8degrees@cox-internet.com
AIM: i8 degrees
"I am governed by none other than the Laws of the Universe."
Higher resolutions weren''t standard. Different cards did it different ways. That''s why there was the VESA standard, which tried to get venders using the same standard (remember SciTech''s DisplayDoctor? That presented a VESA interface for cards which didn''t support VESA).

There were basically two ways of doing high resolutions, bank-switching and a flat model. Bank switching was where the screen was divided up into "banks", and you wrote to part of the screen, switched banks (with an interrupt) and wrote to another (using the same memory-mapped location). So, depending on which bank you were accessing, 0xA000 could point to the top-left, top-middle, middle-left and the center of the screen (for a 640x400 screen). There were many, many different ways of doing banking. That''s why DirectX is so dang cool, cause there''s only one interface to all hardware.

The flat model was what VESA gave you, and it basically just mapped a larger portion of memory to the frame buffer.

codeka.com - Just click it.

This topic is closed to new replies.

Advertisement