;The int3 instruction is your first assembly instruction. It is special, but why it is special will be explained later. int3 is known as the "breakpoint." It's meant to freeze the program and let a debugger know. This kernel automatically handles the int3 instruction so that it prints the general registers on the screen and when a button is pressed on the keyboard, the screen gets restored to what it looked like before the int3 occured and continues normally. Although the numbers do not contain a prefix or suffix, they are hex numbers. They do not have to have the prefix or suffix when being displayed: only when they are to be part of the code. However, clarity is also important: just know that these numbers are hex.

;What's a register you ask? It's a special chip inside the CPU that allows you to store small amounts of data so it doesn't have to take all the time to ask the ever slow RAM to store and retreive it. The following is a table of the registers currently available for you to use (you have more, but it would require you to be in 64bit long mode instead of 32bit protected mode) Some of these you cannot access directly. And no, you do not have to memorize them all. You will want to remember certain ones though, but for now knowing the general registers is important, so I've only included them here. Wikipedia has a nice article on it if you're not afraid of seeing large sections you don't understand, wikipedia is there for you.

;General Registers 32bit: EAX, EBX, ECX, EDX, ESP, EBP, ESI, EDI

;General Registers 16bit:
;AX: lower half of EAX
;BX: lower half of EBX
;CX: lower half of ECX
;DX: lower half of EDX
;SP: lower half of ESP
;BP: lower half of EBP
;SI: lower half of ESI
;DI: lower half of EDI

;General Registers 8bit:
;AL: lower half of AX
;AH: upper half of AX
;BL: lower half of BX
;BH: upper half of BX
;CL: lower half of CX
;CH: upper half of CX
;DL: lower half of DX
;DH: upper half of DX

include "macros.inc"


;Notice the registers all were filled with seemingly random hex values? This is because our program has control given to it. This means that something happened before our program ran. We cannot trust the values of the registers when someone else's code runs. We can trust int3, however, since it preserves what it can, otherwise it wouldn't do it's job very well.

;Oh, and ebp's value naturally responds to the ID. I did this because ebp is not really used for very much, so using it for debugging is usuall not a problem. If need be, it can always be preserved.

;Next we get to start learning the instruction set. After we know all the instructions, we can learn macros. Once you know macros, I'll teach how to use all of the OSes functions. Then you get to learn algorithms. After that, you get to learn how to make your own kernel. After that, you're done with my tutorials and you'll basically want to learn how to code for the OS that you use. By the time you're ready for that, you'll have enough knowledge to figure out how to do it on your own.

;Also, it's important to know that the value for esp might be misleading. In the next lesson, you'll have enough knowledge to figure out for yourself how misleading it really is.

Get your own web kitty here!
┬ęCopyright 2010, 2011, 2012, 2013, 2014, 2017. All rights reserved.