Welcome to HBH! If you had an account on hellboundhacker.org you will need to reset your password using the Lost Password system before you will be able to login.

Assembly Basics


Assembly Basics

By ghostghost | 4479 Reads |
0     0

Assembly How-To———————————————————————————–– By blackmind

I have found from my own experience that the easiest and fast way to learn assembly is practice. I also found that the easiest and simplest is MIPS assembly which stands for Microprocessor without Interlocked Pipeline Stages is a type of RISC microprocessor architecture. RISC processors only use simple instructions that can be executed within one clock cycle as opposed to what most people are familiar with which is CISC. A complex instruction set computer (CISC) is a microprocessor instruction set architecture in which each instruction can execute several low-level operations, such as a load from memory, an arithmetic operation, and a memory store, all in a single instruction. (Thanks wiki for the definitions of CISC and RISC)

CISC

• Emphasis on hardware • Includes multi-clock complex instructions • Memory-to-memory: "LOAD" and "STORE" incorporated in instructions • Small code sizes, high cycles per second • Transistors used for storing complex instructions RISC • Emphasis on software • Single-clock, reduced instruction only • Register to register: "LOAD" and "STORE" are independent instructions • Low cycles per second, large code sizes • Spends more transistors on memory registers

The advantage to a CISC processor is that you can perform a complex task with use of very little RAM while the advantage of a RISC processor is that you can perform actions step by step loading the values into registers that you want, and perform simple tasks with great speed.

Now that I have explained what kinds of assembly there are lets get started. To run MIPS you need a program called SPIM which can be downloaded for Linux, Mac, or windows http://pages.cs.wisc.edu/~larus/spim.html

Now before you get started you have to know a few things first how to compile, well start off by saving your files as .asm files. Second when running SPIM you need to know how to compile. For Example if your running Linux you can type: (1)spim Which will load the simulator then (2) load “file” (3) run Then if you want to run it again you need to type: reinit (4) reinit Which reinitializes the file and then follow the step 2-3 to run again

Now to write an actual program:

.text .globl main

main: li $v0,4 # sys call for printing string la $a0,text # prints a break syscall

li $v0,4 # sys call for printing string la $a0,br # prints a break syscall

li $v0, 10 # code to exit syscall # make the call .data br: .asciiz "\n" text: .asciiz “Hello, world”

This will output Hello, world

Now that I have started you view some other ways to work in assembly. I am now writing an article that will better explain the program above and give more examples.

Comments
Sorry but there are no comments to display