Don't judge the unknown - Grindordie
Tuesday, January 06, 2009
Navigation
Members Online
Total Online: 28
Web Spiders: 3
Guests Online: 22
Members Online: 6

Registered Members: 37854
Newest Member: gnw_007
Most Users online: 523
Latest Articles

Assembly Basics


advertisement



website security this is a newer updated version of assembly and how to compile and run it. I will have a new one coming out soon that i am writting soon@!



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 <enter>
Which will load the simulator then
(2) load “file” <enter>
(3) run
Then if you want to run it again you need to type:
reinit
(4) reinit <enter>
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.
Guest
Username

Password

Remember Me


Bookmark This Page
Affiliates
Adverts

 


By using, viewing or obtaining any information contained on this site, you agree to the disclaimer.

© HellBound Hackers 2007- 2008. Since 3rd December 2004.