Logo 
Search:

Assembly Language Articles

Submit Article
Home » Articles » Assembly Language » Homework HelpRSS Feeds

Store any five 8-bit data check if >30 then add 10 otherwise add 20

Posted By: Jacob Bouchard     Category: Assembly Language     Views: 2298

Store any five 8-bit data check if >30 then add 10 otherwise add 20.

Code for Store any five 8-bit data check if >30 then add 10 otherwise add 20 in Assembly Language

data segment
    value db 10h, 20h, 30h, 40h, 50h
data ends

code segment
    assume cs:code, ds:data
begin:
    mov ax, data
    mov ds, ax
    lea si, value
    mov cx, 05h
    mov bl, 30h
counter:
    mov al, [si]
    mov ah, 0000h
    cmp al, bl
    jg add_10
    jng add_20
    
add_10:
    mov ax, 10h
    add [si], ax
    inc si
    dec cx
    jnz counter
    jmp exit

add_20:
    mov ax, 20h
    add [si], ax
    inc si
    dec cx
    jnz counter
    jmp exit

exit:
    mov ax, 4c00h
    int 21h

code ends
end begin
  
Share: 



Jacob Bouchard
Jacob Bouchard author of Store any five 8-bit data check if >30 then add 10 otherwise add 20 is from Montreal, Canada.
 
View All Articles

Related Articles and Code:


 

Other Interesting Articles in Assembly Language:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!