A Look Into Assembly Programming
I don't really get much opportunity to do too much extra right now with university and recently starting a full-time job in web development. This weekend, however, I've found the time to begin exploring assembly programming- something that's been on my to-do list for a while now!
There are a couple of reasons I'm doing this. Firstly, I feel it will massively develop my understanding of how software works at a lower level. It wil also make exploring other topics I have an interest in easier such as reverse engineering and malware development.
I've been going along with https://www.udemy.com/share/101Dms3@qpkqJpasC_eySfiGbYJ6eOoGmMK-ZNrsawyohSuDzpmtypBSmHPeUu6_dMYPHkKA/. The course presenter doesn't speak the most fluent of English; however, this doesn't matter massively as the course is more hands-on and practical. :)
The course focuses on assembly language for Intel 8086 microprocessors, the first processors to feature x86. As is the case in the course, I am using emu8086, a microprocessor emulator.
Although very basic, I've included the code to a simple program that simply assigns the value of a constant to a variable and then swaps the values of two variables.
Some important points:
For handling values 8 bits in size, we can use the lower part of a register (denoted by an appended 'l') or the higher part (a 'h'.) Each register is 16 bits in size. For example, I use the lower part of the ax register when referencing 'al' and the higher part when referencing 'ah'.
We can define variables as bytes (using db during variable initialization) or words (using dw.) The value following this is the initial value of the variable. A question mark means the variable doesn't have a value yet.
To define the data type of the value during variable initialization, we append a character to the end of the value. For instance, we would append 'h' to a hexadecimal value or 'b' to a binary value. Ignore the 'd' up there as it was unneeded!
But yeah, that's it really. xD Nothing too exciting but I'm finding it interesting so. ^_^















