Problem 5 on Project Euler with x86 Assembly

In order to practice x86 Assembly (NASM especifically) I am solving some problems on Project Euler with it. Here’s problem 5: 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of […]

Solution to Problem 19 on Project Euler

The problem: You are given the following information, but you may prefer to do some research for yourself. 1 Jan 1900 was a Monday. Thirty days has September, April, June and November. All the rest have thirty-one, Saving February alone, Which has twenty-eight, rain or shine. And on leap years, twenty-nine. A leap year occurs […]

Printing “Hello World” with x86 NASM Assembly

After playing a lot with ARM assembly I am starting to code a bit in x86 Assembly (especifically Linux NASM, so the AT&T syntax). Below you’ll find three basic programs to print “Hello World” and variations. 1. Using Syscall Write .text .globl main main:   movl $4, %eax   movl $1, %ebx   movl $string1,%ecx   movl $20, %edx […]

IAS Simulator in ARM Assembly

This project was done for the ‘Computer Organization and Assembly Language’ class, with Prof. Borin from Unicamp. Below you’ll find an IAS Computer simulator, written entirely in ARM assembly. The ias_engine.s file is the core that simulates the IAS computer. Interface.s is the simulator interface that lets the user run the whole program, run a […]

Matrices Multiplication in ARM Assembly

Below is the ARM assembly code that multiply two matrices: .extern printf .extern scanf .global main .text main:   push {ip, lr}   @–read lines and columns of matrix A   ldr r0, =scanf2   ldr r1, =linesA   ldr r2, =columnsA   bl scanf   @–read all values of matrix A   ldr r4, =linesA   ldr r4, [r4]   ldr r5, =columnsA   ldr […]

Hamming 7-4 Code in ARM Assembly

This project was done for the ‘Computer Organization and Assembly Language’ class, with Prof. Borin from Unicamp. The Hamming Code (also called 7-4 code) is an error-correcting code used to make transmission and store of data less error-prone. It adds 3 parity bits to every 4 bits (hence 7-4). You can read the details here. […]