Monday, August 15

Determining The Mean Character/s In A String Input Using Assembly Programming Language

.model small
.code
org 100h
jmp process
    parlist label byte
    maxlen db 30
    actlen db ?
    kbdata db 30 dup('')
    printf db 'Enter Word:','$'
   
    olabel db 'Mean Character/s: ','$'
process proc near
    call clr_scr
    mov dx,0000h
    call set_cur
    lea dx,printf
    call printing
    mov dx,0305h
    call set_cur
    call input
    mov dx,0605h
    call set_cur
    lea dx,olabel
    call printing
    call processing
process endp


input:
    mov ah,0ah
    lea dx,parlist
    int 21h
    cmp actlen,00h
    je term
    ret
term:
    int 20h
processing:
    mov dl,actlen
    shr dl,1
    mov bl,dl
    mov bh,00
    shl dl,1
    cmp dl,actlen
    je a30
    jne a20
a30:
    mov dl,kbdata[bx-1]
    call printing1
    mov dl,kbdata[bx]
    call printing1
    ret
   
a20:
    mov dl,kbdata[bx]
    call printing1
    ret
printing1:
    mov ah,02h
    int 21h
    ret
printing:
    mov ah,09h
    int 21h
    ret
clr_scr:
    mov ax,0600h
    mov bh,07h
    mov cx,0000h
    mov dx,184fh
    int 10h
    ret
set_cur:
    mov ah,02h
    mov bh,00h
    int 10h
    ret
end process

/*Program Preview*/



No comments:

Post a Comment