Basic Linux Shell Commands

Below you’ll find a list of some basic yet useful Linux commands for the command line interface (i.e., the shell), which is the interface provided by users to interact with services and programs provided by the operating system kernel. 1. man pages When in doubt about a specific command or program, check is manual pages. […]

GDB Basic Commands

If you never use GDB (The GNU Project Debugger), well, you should! It’s easy to underestimate its usefulness when debugging programs. Below you’ll find some very basic commands that will get you started: First of all you need to compile/assemble your program with the -g flag, which will include in the executable the necessary code […]

A Simple Multi-Tasking Operating System in ARM Assembly

This project was done for the ‘Computer Organization and Assembly Language’ class, with Prof. Borin from Unicamp. Below you’ll find the code that runs a very simple operating system in ARM Assembly. On system start the OS will configure some pieces of hardware (e.g., GPT, UART and TZIC) and it will setup the environment (supervisor […]

Solution to Problem 24 on Project Euler

The problem: — A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we call it lexicographic order. The lexicographic permutations of 0, 1 and 2 are: 012 021 102 120 201 […]

Problem 7 on Project Euler with x86 Assembly

The problem: — By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10 001st prime number? — My solution: .text .globl main main:   /*-enter stack frame-*/   pushl %ebp   movl %esp, %ebp   movl $3, %edi   movl $1, %esi   mainLoop: […]

Solution to Project 22 on Project Euler

The problem: — Using names.txt (right click and ‘Save Link/Target As…’), a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical value for each name, multiply this value by its alphabetical position in the list to obtain a name score. For example, when the […]