|
||||||
| General Programming Non language specific, Assembly, Linux/Unix, Mac and anything not covered in other topics. Talk about Programming Theory here. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Before visiting this forum I had never heard of Assembly programming. Does anybody know of any applications written in assembly? If anyone does I would like to check them out to help me understand what assembly was used for.
|
| Sponsored Links |
|
|
|
|||
|
This is a program I wrote a couple years ago. It is written in MIPS assembly language
Code:
#
# mktab.s: evaluate arithmetic expressions using the first
# 12 natural numbers
#
#
#$s0: counter
#$s1: the final value is passed to this for each problem
#$s2: used as a "counter" in the Fn problem
#$s3: used as a "counter" in the Fn problem
#$s4: used as a "counter" in the n! problem
#
.data
print_int = 1
print_str = 4
Fn_1 = 1
FINAL = 12 #the last number
first_line: .asciiz "******************************\n"
second_line: .asciiz "Welcome to the 'mktab' program\n"
space_char: .asciiz " "
newline: .asciiz "\n"
labels: .asciiz "n n2 n3 Fn n!\n"
first_fib: .word 1
second_fib: .word 1
#
#
# ***main***
# ====
#
.text
main:
move $s0,$0 #counter = 0
move $s2,$0 #initializes as zero
move $s3,$0
add $s3,$s3,1 #initializes as one
move $s5,$s3
# --Display the Greeting--
la $a0, first_line
li $v0, print_str
syscall
la $a0, second_line
li $v0, print_str
syscall
la $a0, first_line
li $v0, print_str
syscall
la $a0, labels
li $v0, print_str
syscall
#^L
MAIN_LOOP:
# -- display n --
move $a0,$s0
li $v0,print_int
syscall
la $a0, space_char #adds a space
li $v0, print_str
syscall
# -- display n2 --
mul $s1,$s0,$s0
move $a0,$s1
li $v0,print_int
syscall
la $a0, space_char #adds a space
li $v0, print_str
syscall
# -- display n3 --
mul $s1,$s1,$s0
move $a0,$s1
li $v0,print_int
syscall
la $a0, space_char #adds a space
li $v0, print_str
syscall
# -- display Fn --
move $s4,$s3
add $s3,$s2,$s3
move $a0,$s3
li $v0,print_int
syscall
move $s2,$s4
la $a0, space_char #adds a space
li $v0, print_str
syscall
# -- display n! --
mul $s5,$s0,$s5
bnez $s0,NOT_E
add $s5,$s5,1
NOT_E: move $a0,$s5
li $v0,print_int
syscall
la $a0, newline #adds a newline
li $v0, print_str
syscall
add $s0,$s0,1 #increment counter
bne $s0,FINAL,MAIN_LOOP #loops if not done
jr $ra #return to OS
__________________
<!-- comment comment comment --></ |
|
|||||
|
Well I dont use delphi but I saw that on a site! but cant find it! but you just write
Code:
asm Assembly code here end; |
|
|||||
|
C and C++ also support inline assembly. Many C/C++ libraries use assembly at to perform low-level system-specific tasks.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Programming is a branch of mathematics. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Free Assembly Tutorials | Jordan | General Programming | 39 | 10-05-2008 05:40 PM |
| Executing applications and CMD commands from C++ | N00bDaan | C and C++ | 3 | 07-03-2007 01:51 PM |
| Console Applications | Ronin | Java Help | 4 | 08-23-2006 08:24 PM |
| Companies That Hire Assembly Programmers | encoder | General Programming | 14 | 08-01-2006 05:28 PM |
| Assembly usage | DevilsCharm | General Programming | 2 | 07-13-2006 01:54 PM |
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |
Goal: 100,000 Posts
Complete: 98%