-
Contributing Member
Assembly Program
Hi,
Can Anybody help me in writing a simple assembly program, like adding of two nos or assembly program for printf??
-
Contributing Member
Re: Assembly Program
mov al, 5 ; bin=00000101b
mov bl, 10 ; hex=0ah or bin=00001010b
; 5 + 10 = 15 (decimal) or hex=0fh or bin=00001111b
add bl, al
; 15 - 1 = 14 (decimal) or hex=0eh or bin=00001110b
sub bl, 1
; print result in binary:
mov cx, 8
print: mov ah, 2 ; print function.
mov dl, '0'
test bl, 10000000b ; test first bit.
jz zero
mov dl, '1'
zero:int 21h
shl bl, 1
loop print
; print binary suffix:
mov dl, 'b'
int 21h
; wait for any key press:
mov ah, 0
int 16h
ret
The above one using for 8086 processor and if you want more detail for sample programs then go through the following URL...
http://www.emu8086.com/dr/asm2html/a...r_source_code/
----------------------
suresh
Last edited by psuresh1982; 07-16-2007 at 07:27 AM.
-
Junior Member
Re: Assembly Program
Yes i , can i have many solved programs of assembly here is your program
data segment
num1 db 20h
num2 db 18h
res db ?
data ends
code segment
assume cs:code, ds:data
mov ax, data ;initialize data segment
mov ds, ax mov al, num1 ;take first number in al
add al, num2 ;add the second to the number
mov res, al ;store the result in location res
mov dl,res
sub dl,30h
mov ah,02h
int 21h
code ends
mov ax, 4c00h ;exit to operating system
int 21h
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules