Skip to main content

Posts

Reading Disk Properties in Assembler - INT 13H

This post is a continuation from the previous post [ Writting a Bootloader ] which was an attempt to build a Bootloader for the x86 architecture. Although the executable size is limited to 512 Bytes, there are several important tasks that can be accomplished during booting process. One of them is to read the Geometry from several storage devices. Interrupt 13h [ INT 13h ] provides sector-based disk access services using the CHS addressing  method (Cylinder/Head/Sectors). This values provide the physical location of the data (although this is not completely true nowadays). The code below is an example of this interrupt. It reads the CHS from the first Hard Disk using Interrupt 13h. Briefly, interrupt parameters are set in AX and DX registers. After interrupt is completed, its values can be read from the appropriate registers (CX, DX). The rest of the code includes helper functions to print numbers and strings to present results properly. After booting our virtu...

Writing a Bootloader

I am starting to think of any reason to Write a Bootloader ... I've been always interested not only how to write applications but understanding how the whole system works, from the moment the machine boots. The first steps in computer booting can be described in general as follows: Power Up Start Processing ROM BIOS Execute POS (Power-on self Test) Check hardware devices Look for OS to load During the last step, BIOS will search for Storage Devices (described in the device Boot Order). These are usually CD-Rom, Hard Drives,  USB Drives,  Disk Drives, etc. For each Device (In order), BIOS will look for MBR (Master Boot Record) which corresponds to the first 512 bytes of the Device Image.  These 512 Bytes are loaded then into the memory and executed. It's a very small space in memory to be able to achieve many tasks.  Bootloaders are commonly used to access the kernel loader located in the boot sector of the drive. Other tasks includes initi...

nvidia Cookies

Last week I was re-installing Windows Vista in my wife's Dell Inspiron 1520. Everything was going well, when suddenly the screen was showing random pixels on the screen. I experienced the same issue few years ago when my favorite machine start showing the same pattern. It starts with few pixels, then you can barely understand what's going on in the desktop and finally screen becomes black or the computer restarts itself. At that time the only solution was to throw my precious to the trash can (I am talking about the PC!). It was already old and almost impossible to find spare parts that will cost less than a new computer. I was concerned that the faith of my wife's computer will be the same. We tried different things, like disabling some hardware in the BIOS and running RivaTuner to try to keep the GPU cool by "underclocking it". As expected, nothing actually worked. The machine was behaving worst and worst. After some research I found that it was possible to ...

My First Game Program

Although I don't have the original source code (It was done more than 24 years ago) and was programmed a little bit after starting computer classes in 6th grade (Sept-1987) I think this piece of code resembles the "game". This game is a guess-the-number kind. Pretty simple but rewarding. For the first time I found that such a device "TRS-80" could be nice source of income and make a living for my future. There was a simple trick I used in this game to always beat my friends (although game was not exciting and they got bored after couple minutes) and complete it in less attempts. I guess you already know how to solve it (log2(100)) 1 Year later I learnt how to get some money from my school friends by doing their programming homework. At that time very few people was interested in computers and programming (moreover when you are 12 years old).

Fallout 3

Year has ended and so I finished playing Fallout 3. I enjoyed a lot this game. I have few thing to say about it. The story is well constructed and the environment is really cool. I've been before in D.C, and the post-apocalyptic landscape looks terrifying in Fallout 3. Two things impression me: First, loading times. Game start pretty quick, and reloading a saved game or changing to a different level/screen is fast. Probably faster than any other game I've played lately. Second, graphics have the best quality you can find in 2008 games. As you can see above, characters are well detailed. I have to criticize that characters lack of emotion. They look the same when they are happy or sad, angry or laughing. This sometimes confuses the player, specially when you want to decide the next chat action. Playability is good and controls are easy to handle. The V.A.T.S feature give a different dimension to the game, turning battles into cinematic shots; even sounds seem to go in slow motio...

Embedded database - SQLite

First of all .... H A P P Y N E W Y E A R ! ! ! I whish you dear readers the best of all during this 2009 (Although It didn't start good in Middle East and Africa). -- Political crap start here -- My whish for 2009 is that all religion Gods meet some day and kick some bad humans asses (i.e. Mr. B, Mr. Ch and Mr. Uribe)! -- Political crap end here -- When building applications, one of the main issues is the data storage. If you take a look at C++, persistence is not part of the specification so, use third party components. Serialization is a good way to convert objects directly to a binary data and saving in files or being transferred through a network. Building systems doesn't mean only storing data. Storing seem to be an easy task for C++ but, what about data management? That's a different subject and, if you want to administer data II can think of two ways: - Build your own code to read/write and manage files (add, remove, and link objects). Moreover, you hav...

Rotate text in Web Generated Excel File

There are many reasons to generate Excel files from your website, mainly generating data reports. As far as I know there are a couple of ways to generate Excel file from your web server regardless the platform: - Component Server Side: There are several server-side components available to create excel files. Moreover, if you have MS Excel installed in your computer you can create excel files without third-party components. -Client Side: If there's Excel installed in the client machine, a client vbscript can generate the file you need. I am not sure if it works under Firefox and, running client-side scripts can create a security hole in your system. - XML Server Side. One nice feature of excel is that you can generate an excel file without the need of a component. That is, you generate an HTML-like document with the appropriate header and it will be available in Excel. Well, this is just an introduction, not the subject of this post. I will focus on XML server side Excel file, but y...

Queues with STL

In this project, I was requested to build an application to manage Queues (something like the ones you find when you want to view the latest Blockbuster movie). OK, It sounds simple, use a STL queue. Unfortunately, this is not the whole requirement. Being a graphical application, it requested to refresh the screen from time to time showing all the items in the queue. After some research I was not able to find a way to access elements inside the queue, only the Front and Back elements were accessible [if this is possible, let me know]. So, I had to take a look at other containers in STL in order to be able to get the functionality with good performance. I have selected 4 containers to accomplish this task : Queue (Only to measure it's performance), Lists, Vectors and Deques. All of them included members to work like Queues: - Queue: push(int), front(), pop() - List: push_back(int), front() and pop_front() - Vector: push_back(int), front() and erase(vector::begin()) - Deque: ...