Pages

Saturday, February 12, 2011

Sample programs in assembly using a86.com(3)

This program displays the vowels of the inputted string.


.model small
.code 
org 100h


jmp main
temp1 db 00
paralist label byte
maxlen db 40
actulen db ?
kbname db 41 dup('')


main:
call clear
mov dh, 00h
mov dl, 00h
call set_curs
mov ah, 0Ah
lea dx, paralist
int 21h


lea si, kbname
mov dh, 0000h
mov dl, actulen
mov cx, dx


repeater:
mov ah, [si]
cmp ah, 'a'
if e jmp next
cmp ah. 'e'
if e jmp next

cmp ah, 'i'
if e jmp next
cmp ah. 'o'
if e jmp next
cmp ah, 'u'
if e jmp next
jmp next1

next1:
cmp cx, 00h
if e jmp terminate
inc si
loop repeater

next:
call set_curs2
mov ah, 02h
mov dl, [si]
int 21h
jmp next1

terminate:
int 20h
main endp
end main

clear proc near
mov ah, 06h
mov al, 00
mov bh, 07h
mov cx, 0000h
mov dx, 184Fh
int 10h
ret
clear endp

ser_curs proc near
mov ah, 02
mov bh, 00
int 10h
ret
set_curs endp

set_curs2 proc near
add temp1, 01h
mov dh, 12
mov dl, temp1
mov ah, 02
mov bh, 00
int 10h
ret
set_curs2 endp

----------------------------------
INPUT:    luthsie
OUTPUT:   uie

0 comments:

Post a Comment