rendered paste body.model small
.stack 100h
.data
msgIntro DB "4-a uzd: Programa pakeicia ivestos eilutes raidziu skyriu ir eilutes ilgi.$"
msgIvesk DB 0Dh, 0Ah, "Iveskite(iki 9 simboliu):$"
msgIsvesk DB 0Dh, 0Ah, "Pakeista eilute:$"
msgIlgis DB 0Dh, 0Ah, "Eilutes ilgis:$"
msgError DB 0Dh, 0Ah, "Klaida!$"
BUFMAX DB 121
DB ?
BUFRES DB 121 DUP(?)
.code
START:
mov ax, @data
mov ds, ax
mov es, ax
mov dx, offset msgIntro
call WRITE
mov dx, offset msgIvesk
call WRITE
mov dx, offset BUFMAX
mov ah, 0Ah
int 21h
mov dx, offset msgIsvesk
call WRITE
;nuskaitom eilutes ilgi
cld
mov si, offset BUFMAX+1
lodsb
mov cl, al
xor ch, ch
push cx
;
push si
pop di
;ciklas
CHECK:
lodsb
cmp al, 'A'
jb DoNothing
cmp al, 'Z'
jbe Keisk_i_Mazaja
cmp al, 'a'
jb DoNothing
cmp al, 'z'
jbe Keisk_i_Didziaja
cmp al, 'z'
ja DoNothing
Keisk_i_Didziaja:
sub al, 20h
jmp DoNothing
Keisk_i_Mazaja:
add al, 20h
jmp DoNothing
DoNothing:
stosb
loop CHECK
;
mov al, "$"
stosb
cld
mov dx, offset BUFRES
mov ah, 9
int 21h
pop cx
mov ax, cx
mov dx, offset msgIlgis
call WRITE
xor dx, dx
cmp al, 9
jle Spausdink
jg Dvizenklis
Dvizenklis:
mov dl, 10
div dl
push ax
mov dl, al
add dl, 30h
mov ah, 02h
int 21h
pop ax
mov dl, ah
add dl, 30h
mov ah, 02h
int 21h
jmp fsio
Spausdink:
mov dl, al
add dl, 30h
mov ah, 02h
int 21h
fsio:
mov ax, 4C00h
int 21h
WRITE PROC
push ax
mov ah, 9h
int 21h
pop ax
ret
WRITE ENDP
END START