Sunday | 23 JUN 2024
[ previous ]
[ next ]

Learning Assembly - Day 2

Title:
Date: 2023-09-06
Tags:  

Today was a short day.

Lesson 8 - Passing Arguments

pretty cool to see that arguments are passed via the stack. The number of arguments is last so that the first pop will get you the argument count. This lets you then loop over the arguments.

Lesson 9 - User Input

Very easy to add some user input. This involved setting up the bss and then doing a new system call. This was the sys_read. Juggling registers is relatively straightforward. I can see how programming in assembly will force you to simplify as much as possible. I wonder how complex it will be to make an http server.

Lesson 10 - Counting to 10

I read this but i wish i had given this a shot before I read the code. The logic of it is fun to see. sys_write takes in an address so you need to somehow convert a register into an address. This is done by pushing the register which causes the esp register to get the memory address of the last element in the stack. This can then be moved into eax and used to print something.