Skip to main content
gamedev.net
🔒 Locked

About HAL

Started by sunmozhou 1 reply 1.3k views
Original Post
sunmozhou
sunmozhou
I read a technical document about HAL in msdn: DirectDraw provides device independence through the hardware abstraction layer (HAL). The HAL is a device-specific interface, provided by the device manufacturer, that DirectDraw uses to work directly with the display hardware. Applications never interact with the HAL. Rather, with the infrastructure that the HAL provides, DirectDraw exposes a consistent set of interfaces and methods that an application uses to display graphics. The device manufacturer implements the HAL in a combination of 16-bit and 32-bit code under Windows. Under Windows NT/Windows 2000, the HAL is always implemented in 32-bit code. The HAL can be part of the display driver or a separate DLL that communicates with the display driver through a private interface that driver's creator defines. The DirectDraw HAL is implemented by the chip manufacturer, board producer, or original equipment manufacturer (OEM). The HAL implements only device-dependent code and performs no emulation. If a function is not performed by the hardware, the HAL does not report it as a hardware capability. Additionally, the HAL does not validate parameters; DirectDraw does this before the HAL is invoked But i don't know what's HAL,please tell me in detail thanks!
GroZZleR
GroZZleR
HAL is the Hardware Abstraction Layer. It's basically the layer of communication between the operating system and the device.

1. You tell DirectDraw to draw something.
2. DirectDraw tells the Windows Kernel to draw something.
3. The Kernel goes through the HAL to ask the driver if it can draw something.
3.a If the driver is capable of handling the task, the driver reports to the HAL that it can and the Kernel tells it what to draw.
3.b If the driver is unable to handle to task, the driver reports to the HAL that it is unable to do what the Kernel wants and the Kernel emulates it (software rendering in this case).

That's my understanding, atleast.
Aldenar
Aldenar
As the name implies, HAL is a layer between the hardware and your application. It is some kind of unified interface to access seamlessly all kind of similar devices.

All the graphic cards have different inner workings, and so without a HAL, you would have tens of different paths in your code to do the same thing depending on the hardware brand, model or revision. That was the way to go for DOS games, but as you can see, it is painful and you would spend more time coding support for different hardware than writing actual game code. So that's why they introduced the concept of HAL.

Now, if you want to change the display mode, you just need to call SetDisplayMode() or something like that and the driver will do the right things for the graphic card you are using to change the video mode. That's what DirectDraw (and DirectX in general) is all about. You'll be able to perform many operations without needing to know anything about how it is done at the driver level (Change the display mode, create surfaces, blit images and so on).

I Hope this was helpful..

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.