shabbyheart

Microprocessor lab 3 assignment

Dec 16th, 2019
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. org 100h
  2.  
  3. .data
  4.     string db 'We are DUET', 10,13,'$'
  5. .code
  6.     main proc
  7.         mov ax,@data
  8.         mov ds,ax;
  9.        
  10.         ;mov ah,09
  11.         ;mov dx,offset string
  12.         ;int 21h
  13.        
  14.         mov si,offset string
  15.        
  16.         again:
  17.             cmp [si],'$'
  18.             je last
  19.            
  20.             cmp [si],90
  21.             jle upper_to_lower
  22.            
  23.             cmp [si],97
  24.             jge lower_to_upper
  25.            
  26.         upper_to_lower:
  27.             cmp [si],64
  28.             jle ignore
  29.            
  30.            
  31.             add [si],32
  32.             mov ah,02
  33.             mov dl,[si]
  34.             int 21h
  35.             inc si
  36.             jmp again
  37.            
  38.         ignore:  
  39.             inc si
  40.             jmp again
  41.              
  42.         lower_to_upper:
  43.             sub [si],32
  44.             mov ah,02
  45.             mov dl,[si]
  46.             int 21h
  47.             inc si
  48.             jmp again
  49.        
  50.         last:
  51.             ret
  52.        
  53.         main endp
  54.         end main
  55.  
  56. ret
  57.  
  58.  
  59.  
  60. program 2
  61.  
  62. ; You may customize this and other start-up templates;
  63. ; The location of this template is c:\emu8086\inc\0_com_template.txt
  64.  
  65. org 100h
  66.  
  67.     string db 'We are DUET Students',10, 13,'$'
  68. .code
  69.     main proc
  70.         mov ax,@data
  71.         mov ds,ax
  72.        
  73.         ;mov ah,09
  74.         ;mov dx,offset string
  75.         ;int 21h
  76.        
  77.         mov di,offset string
  78.        
  79.        
  80.         check_first_lower_case:
  81.             cmp [di],'$'
  82.             je last
  83.            
  84.             cmp [di],97
  85.             jge first_lower_latter
  86.             inc di
  87.             jmp check_first_lower_case  
  88.            
  89.         first_lower_latter:
  90.             mov ah,02
  91.             mov dl,[di]
  92.             int 21h
  93.             inc di
  94.             jmp again
  95.         again:
  96.             cmp [di],'$'
  97.             je last
  98.            
  99.             cmp [di],97
  100.             jge last_lower_letter
  101.            
  102.             inc di
  103.             jmp again
  104.            
  105.         last_lower_letter:
  106.             cmp [di],64
  107.             jle ignore
  108.            
  109.             mov bl,[di]
  110.             inc di
  111.             jmp again
  112.        
  113.         ignore:
  114.             inc di
  115.             jmp again
  116.         last:
  117.             mov ah,02
  118.             mov dl,10
  119.             int 21h
  120.            
  121.             mov dl,13
  122.             int 21h
  123.            
  124.             mov dl,bl
  125.             int 21h
  126.             ret
  127.            
  128.        main endp
  129.     end main
  130. ret
Add Comment
Please, Sign In to add comment