DCPU16
23
[COAL] Uppercase, Lowercase and Toggle using Logic Gates Guest on 18th December 2020 01:30:48 PM
- ;; AND can be used to clear bit or number bits
- ;; OR can be used to set bit, set 1
- ;; NOT - invert whole
- ;; XOR - invert single bits
- ; Write a program which takse 10 character input from user
- ; and convert it into lower case, upper case and toggle
- ; case using logic instruction
- .model small
- .stack 100h
- .data
- arr1 db 30 dup (?)
- .code
- main proc
- mov ax,@data
- mov ds,ax
- mov cx,10
- mov si,offset arr1
- L1:
- mov ah,1
- int 21h
- mov [si],al
- inc si
- loop L1:
- mov cx,10
- mov si, offset arr1
- call newline
- L2:
- mov bl,[si]
- AND bl,11011111b
- mov dl,bl
- mov ah,2
- int 21h
- inc si
- loop L2
- mov cx,10
- mov si, offset arr1
- call newline
- L3:
- mov bl,[si]
- XOR bl,00100000b
- mov dl,bl
- mov ah,2
- int 21h
- inc si
- loop L3
- mov cx,10
- mov si, offset arr1
- call newline
- L4:
- mov bl,[si]
- OR bl,00100000b
- mov dl,bl
- mov ah,2
- int 21h
- inc si
- loop L4
- mov ah,4ch
- int 21h
- main endp
- newline proc
- mov dl,10
- mov ah,2
- int 21h
- mov dl,13
- mov ah,2
- int 21h
- ret
- newline endp
- end main
Recent Pastes