Alien Planet Probe: the manufacturing and test phase

this is the reference picture of the post describing the the manufacturing and test phase of Alien Planet Probe

Manufacturing and Testing

Manufacturing and testing the code works exactly the opposite way around of design: that is to say bottom-up. So I will start with some general setup and then from the most simple (and independent) procedure to the topmost one which is the main procedure.

Setup the workbench

I have to work within 0x200 bytes (512 in decimal) of space because this is the size of the boot sector that GRUB will load in RAM, so I use the region from SEG1:0100 to SEG:02FF. I fill this region with 0x90 (= NOP) and I sign it with the boot signature 0xAA55 (see fig. A).

Best practice with DEBUG.EXE
Fig. A

To do this I use first the command f 100 2ff 90 (fill the RAM, from SEG:0100 to SEG:02FF, with the following list of bytes: 0x90) and then e 2fe (edit starting at SEG:02FE). The command e shows the current byte, then I can insert the new byte. Pressing [SPACE] it goes to the next byte and by pressing [RETURN] it ends. Soon after that, I prepare the pre-formatted string immediatelly starting at address SEG:0100, since I don't know how long the string would be (of course I could have calculated it, but this way is much easier and faster).

Best practice with DEBUG.EXE
Fig. B

Fig. B shows the insertion of the pre-formatted string. Now that, I know (or better I see) how long this is, I can shift it down at the end of the available space (Fig. C and Fig. D).

Best practice with DEBUG.EXE
Fig. C

Best practice with DEBUG.EXE
Fig. D

To do that I look at the available space and then I use the command m 100 17f 270 ( "m" stands for "move", but in reality, it copies all bytes that are included from SEG:0100 to SEG:017F in the new position starting at SEG:0270). Similarly, I insert the second string and then I save the current layout in a file called "inwork.bin" (Fig. E, Fig. F and Fig. G).

Best practice with DEBUG.EXE
Fig. E

Best practice with DEBUG.EXE
Fig. F

Best practice with DEBUG.EXE
Fig. G

In order to keep the thing as simple as possible for a handmade code, I keep the data in a sort of paragraphs aligned structure. This generates a "waste" of bytes (cost) but in turns, it is easier to make it by hands (benefit). If at any point in time, later on, I will run short of space than I will have to rework this and gain the unused bytes back again.



  1. SEG can be any segment. The exact value is only knows when DEBUG.EXE is loaded. In my case here it is equal to 0x1521 this time (see al figures in this post), but next time it could be different. [click back]

<PREV.  -  ALL  -  NEXT>

Comments