Sunday 31 January 2016

Assembly

During our Lab 3 in class we were assigned the task of learning more about how Assemblers work and what they are used for. First though we had to learn the differences between X86_64 Register and aarch64 Register. It's interesting to see and take away the different design philosophy that each platform decides on.

An important thing to note is the differences and the similarities. For example, ARM instructions are RISC (Reduced instruction set computer) like instructions. The benefit is that instructions are all very simple and fixed length. X86 has more complicated instructions as it is CISC (Complex instruction set computer).

For the lab itself, the task required building a simple program ran in x86_64 and aarch64. The program first had it looping from 0 to 9 but by then it had to be 0 to 30. I'm just going to focus on the x86_64 portion of the lab, as the logic for one, was same for the other, just with minor tweaks I'll elaborate later on.

The main differences between assembly and higher level languages for me are:
  1. Symbols
  2. Keeping Track of Registers
  3. A Different Way of Thinking

 

Symbols

Although the program is simple in nature, it still taught me the basic learning blocks for what more complicated programs will ask for. It is important to allocate memory without the need of moving it for later. Symbols make sure all of this corresponds to the correct memory addresses, registers or other values.


Keeping Track of Registers

I found it very unique how registers are handled. They help speed up the processor operations with internal memory storage locations. The only problem and challenge is that there are so few registers to use. I am assuming later on you will need to dynamically point to memory storage instead of just using registers but that is still yet to be seen. It will be interesting to compare these thoughts later down the road as I learn more in SPO600.


A Different Way of Thinking

If the task was asked for in a higher level language, it could be finished in a few lines like this psuedocode suggests:
for count in range(0,30):
        print "Loop:" + count

But this was a bit more complicated. For example, although counting out looud in your head pass 10 is simple, for assembly doing this in ASCII isn't simple. Instead we had to take the number, divide it by 10 using an instruction, taking that reminder and displaying it.


No comments:

Post a Comment