This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: jnz second mov n1,ax ; assign it to the first variable jmp start ; read in another number second: mov n2,ax ; or assign to second variable and continue print_cr: mov ah,09 mov dx,offset cr ; print out a carriage return character int 21h addnos: mov ax,n1 ; move numbers to registers . .. mov bx,n2 add ax,bx ; . ..and add mov res,ax ; store the result mov cx,00 setup_string: mov bx,offset number+7 ; put a $ at end of buffer. mov bx,'$' ; we will fill buffer from back forwards dec bx mov ax,res convert_decimal: mov dx,10 div dl ; divide by 10 add ah,48 ; convert remainder to character mov [bx],ah ; and move to buffer for output dec bx mov ah,00 ; quotient becomes new value cmp ax,00 ; if we haven't got all digits divide again jnz convert_decimal printout: mov dx,bx inc dx ; we decremented once too many, go forward one. mov ah,09 int 21h ; output the string close: mov ah,4ch mov al,00 int 21h ; end program main endp end main e...
View Full Document
This note was uploaded on 11/06/2010 for the course UBIT 411 taught by Professor Saleemelahi during the Spring '10 term at University of Karachi.
- Spring '10