Aim: - To write an assembly language program to find sum of cubes of given 'n' numbers.
1
2
3
4
5
6
7
8
9
MOV CL, NUM
MOV SUM, 00
L1: MOV AL, CL
MUL AL
MUL CL
ADD AL, SUM
MOV SUM, AL
LOOP L1
END
Result: Sum of cubes of first 'n' natural numbers is obtained.
TITLE Calculating a Factorial (Fact.asm)
; This program uses recursion to calculate the
; factorial of an integer.
; Last update: 06/01/2006
INCLUDE Irvine32.inc
.code
main PROC
push 12 ; calculate 12 factorial
call Factorial ; calculate factorial (eax)
ReturnMain:
call WriteDec ; display it
call Crlf
exit
main ENDP
Factorial PROC
push ebp
mov ebp,esp
mov eax,[ebp+8] ; get n
cmp eax,0 ; n < 0?
ja L1 ; yes: continue
mov eax,1 ; no: return 1
jmp L2
L1: dec eax
push eax ; Factorial(n-1)
call Factorial
; Instructions from this point on execute when each
; recursive call returns.
ReturnFact:
mov ebx,[ebp+8] ; get n
mul ebx ; ax = ax * bx
L2: pop ebp ; return EAX
ret 4 ; clean up stack
Factorial ENDP
END main
MOV AH,1 ; for taking input from the user
INT 21H ;interrupt
XOR AH, AH ;used xor to make ah=0
SUB AX,30H ; ascii adjustment
MOV CX,AX ; copy the value of ax into cx
MOV AX,1 ;make ax=1
GO:
MUL CX ;multiply the content of AL with CH
LOOP GO ; loop will decrement the value of CX by one
Assembly langue is translated into machine language by an assembler.
An assembly program is a machine-dependent program written in a low-level symbolic code known as assembly language.
use of reserved word in assembly language
How to write the program un Assembly language to set a password for personal computers?
An Assembler converts assembly language instructions into machine language.
Assembly langue is translated into machine language by an assembler.
an assembly language program of traffic light
An assembly program is a machine-dependent program written in a low-level symbolic code known as assembly language.
use of reserved word in assembly language
How to write the program un Assembly language to set a password for personal computers?
write program to concatenating two sting in 8086 assembly language
You will need to have a little bit of computer science knowledge. This will help you to make the programing.
You need an 8086 assembly language pencil.
The only translation program that converts assembly language to machine code is an assembler.
You cannot generate machine code from assembly language without running a program (an assembler). Therefore the machine that generates the machine code must be operational and must be running an assembler program that is appropriate to the target platform. The machine code output from the assembler can then be loaded onto the target platform and executed.
write an assembly language program to find sum of N numbers
An Assembler converts assembly language instructions into machine language.