Untitled

 avatar
unknown
plain_text
5 months ago
4.1 kB
14
Indexable
org 100h
.model small
.stack 100h
.data
 msg1 db "Original Number : $"
 msg2 db "Decrement : $"
 msg3 db "increment : $"
 .code
 main proc
 lea dx,msg1
 mov ah,9
 int 21h 
 
 mov al,7
 add al,48
 mov dl,al
 mov ah,2
 int 21h 
 
 mov dl,10  ;new line
 mov ah,2
 int 21h  
 
 mov dl,13  ;cret
 mov ah,2
 int 21h 
 
 lea dx,msg2
 mov ah,9
 int 21h
 
 mov al,7
 add al,48
 dec al
 mov dl,al
 mov ah,2
 int 21h  
 
 mov dl,10
 mov ah,2
 int 21h 
 
 mov dl,13
 mov ah,2
 int 21h 
 
 lea dx,msg3
 mov ah,9
 int 21h  
 
 mov al,7
 add al,48
 inc al
 mov dl,al
 mov ah,2
 int 21h
main endp
ret


name and reg


; You may customize this and other start-up templates; 
; The location of this template is c:\emu8086\inc\0_com_template.txt

org 100h


.model small
.stack 100h
.data  


.code

main proc
    mov al, 'M'
    mov dl, al
    mov ah, 2
    int 21h
    
    mov al, 'U'
    mov dl, al
    mov ah, 2
    int 21h
    
    mov al, 'S'
    mov dl, al
    mov ah, 2
    int 21h
    
    mov al, 'T'
    mov dl, al
    mov ah, 2
    int 21h
    
    mov al, 'A'
    mov dl, al
    mov ah, 2
    int 21h
    
    mov al, 'F'
    mov dl, al
    mov ah, 2
    int 21h
    
    mov al, 'A'
    mov dl, al
    mov ah, 2
    int 21h 
    
    mov al,0
    mov dl, al
    mov ah, 2
    int 21h
    
    mov al, 2
    add al, 48
    mov dl, al
    mov ah, 2
    int 21h  
    
    mov al, 3
    add al, 48
    mov dl, al
    mov ah, 2
    int 21h
    
    mov al, 1
    add al, 48
    mov dl, al
    mov ah, 2
    int 21h
    
    mov al, 2
    add al, 48
    mov dl, al
    mov ah, 2
    int 21h
    
    mov al, 2
    add al, 48
    mov dl, al
    mov ah, 2
    int 21h   
    
    mov al, 5
    add al, 48
    mov dl, al
    mov ah, 2
    int 21h
    
    mov al, 1
    add al, 48
    mov dl, al
    mov ah, 2
    int 21h
    
    main endp 




ret



add 16 bit


org 100h
.model small
.stack 100h

.data



Q db ? ;Quotient
R db ? ;Remainder
   
msg1 db "remainder is :$"  
msg2 db "quotient is :$" 

.code

main proc

    ;Add 16bits
    
    mov al,65
    mov bl, 30
    add al, bl
    
    AAM
    
    mov cl, al
    mov ch, ah
    
    mov dl, ch ; Move the value into DL for printing
    add dl,48 ; Convert to ASCII character
    mov ah,2 ; Set AH to 02h for the print character function
    int 21h; Call DOS interrupt to exit the program
    
    mov dl, cl ; Move the value into DL for printing
    add dl,48 ; Convert to ASCII character
    mov ah,2 ; Set AH to 02h for the print character function
    int 21h
    
    
    
endp main
ret
   
  

mul and div 16

org 100h
.model small
.stack 100h

.data



Q db ? ;Quotient
R db ? ;Remainder
   
msg1 db "remainder is :$"  
msg2 db "quotient is :$" 

.code

main proc
    ;DIVIDE 16 bits
    mov ax, 31
    mov bl, 6
    div bl
    
    mov Q, al
    mov R, ah
    
    
    lea dx, msg1
    mov ah, 9
    int 21h
    
    mov dl, R
    add dl, 48
    mov ah, 2
    int 21h
    
    mov dl, 0
    mov ah, 2
    int 21h 
    
    lea dx, msg2
    mov ah, 9
    int 21h
    
    mov dl, Q
    add dl, 48
    mov ah, 2
    int 21h
    
    ;Printing blank
    mov dl, 0
    mov ah, 2
    int 21h 
    
    mov dl, 0
    mov ah, 2
    int 21h 
    
    
    
    ;Multiply 16bits
    
    mov al, 10
    mov bl, 10
    mul bl
    
    AAM
    
    mov cl, al
    mov ch, ah
    
    mov dl, ch ; Move the value into DL for printing
    add dl,48 ; Convert to ASCII character
    mov ah,2 ; Set AH to 02h for the print character function
    int 21h; Call DOS interrupt to exit the program
    
    mov dl, cl ; Move the value into DL for printing
    add dl,48 ; Convert to ASCII character
    mov ah,2 ; Set AH to 02h for the print character function
    int 21h
    
    
    
endp main
ret
   
  





Editor is loading...
Leave a Comment