Reputation: 366
I want to output a string without using a $ sign. Whether I get it right, i need to count the characters of my string and put the value in cx register. I tried to do so, but the program simply prints the whole buffer out and not the string I need.
This is Turbo assembler, btw.
.model small
.stack 200h
.data
text1 db 0ah, 0dh, 'Your text : $'
text2 db 0ah, 0dh, 'Text in lowercase: $'
string db 255 dup(?)
.code
begin:
mov ax, @data
mov ds, ax
lea dx, text1
mov ah, 09h
int 21h
lea si, string
mov ah, 01h
read:
int 21h
cmp al, 0dh
je print
cmp al, 'A'
jl not_upper
cmp al, 'Z'
jg not_upper
add al, 20h
mov [si], al
inc si
;****************************
inc cx
;****************************
jmp read
not_upper:
mov [si], al
inc si
jmp read
print:
mov al, 00h
mov [si], al
lea dx, text2
mov ah, 09h
int 21h
;****************************
lea dx, string
mov ah, 40h
mov bx, 1
int 21h
;****************************
mov ah, 4ch
int 21h
.exit
end begin
Upvotes: 3
Views: 1202
Reputation: 39256
jl
/jg
into jb
/ja
.Upvotes: 3