I have this assembly program where I need to find the substring in the main string I input. My problem is that it always outputs the "word found" even if I typed two completely different words. I don't know which part of my loop or condition is wrong. Please help me figure it out. Also, please suggest some string instructions that could be used in checking for a substring so that I can shorten my code. I am really confused with how the cmpsb works, I only tried to use it. Btw, I don't know how to use a debugger that's why I can't debug my code and I am just a newbie in assembly language.
Below is the logic part of my code.
.data
prompt1 db "Input String: $"
prompt2 db 10,10, 13, "Input Word: $"
prompt3 db 10,10, 13, "Output: $"
found db "Word Found. $"
notfound db "Word Not Found. $"
invalid db 10,10, 13, "Invalid. $"
InputString db 21,?,21 dup("$")
InputWord db 21,?,21 dup("$")
actlen db ?
strlen dw ($-InputWord)
.code
start:
mov ax, #data
mov ds, ax
mov es, ax
;Getting input string
mov ah,09h
lea dx, prompt1
int 21h
lea si, InputString
mov ah, 0Ah
mov dx, si
int 21h
;Getting input word
mov ah,09h
lea dx, prompt2
int 21h
lea di, InputWord
mov ah, 0Ah
mov dx, di
int 21h
;To check if the length of substring is shorter than the main string
mov cl, [si+1]
mov ch, 0
add si, cx
mov bl, [di+1]
mov bh, 0
cmp bx, cx
ja invalid_length
je valid
jb matching
valid:
cld
repe cmpsb
je found_display
jne notfound_display
matching:
mov al, [si]
mov ah, [di]
cmp al, ah
je check
jne iterate
iterate:
inc si
mov dx, strlen
dec dx
cmp dx, 0
je notfound_display
jmp matching
check:
mov cl, [di+1]
mov ch, 0
mov ax, si
add ax, 1
cld
repe cmpsb
jne again
jmp found_display
again:
mov si, ax
dec dx
lea di, InputWord
jmp matching
invalid_length:
mov ah, 09h
lea dx, invalid
int 21h
strlen dw ($-InputWord)
This does nothing useful. The length that it calculate can not help you in any way!
;To check if the length of substring is shorter than the main string
mov cl, [si+1]
mov ch, 0
add si, cx
mov bl, [di+1]
mov bh, 0
cmp bx, cx
Here (as Jester told you) the add si, cx instruction is wrong. You need add si, 2 to set SI to the start of the string. You will also need to add add di, 2 to set DI to the start of the word. Do this and the valid part of your program will work correctly.
For the matching part:
Consider the case where the string has 7 characters and the word that you're looking for has 6 characters. You can find the word in at most 2 ways.
Consider the case where the string has 8 characters and the word that you're looking for has 6 characters. You can find the word in at most 3 ways.
Consider the case where the string has 9 characters and the word that you're looking for has 6 characters. You can find the word in at most 4 ways.
Notice the regularity? The number of possible finds is equal to the difference in length plus 1.
mov bp, cx ;CX is length string (long)
sub bp, bx ;BX is length word (short)
inc bp
This sets BP to the number of tries in your matching routine.
cld
lea si, [InputString + 2]
lea di, [InputWord + 2]
matching:
mov al, [si] ;Next character from the string
cmp al, [di] ;Always the first character from the word
je check
continue:
inc si ;DI remains at start of the word
dec bp
jnz matching ;More tries to do
jmp notfound_display
The check part will use repe cmpsb to test for a match, but in the event that the match is not found, you must be able to return to the matching code at the continue label. You have to preserve the registers.
check:
push si
push di
mov cx, bx ;BX is length of word
repe cmpsb
pop di
pop si
jne continue
jmp found_display
Related
I am a beginner in assembly and I am trying to make a program where I should input 2 strings from the keyboard. The first string should be the main string and the second input is the substring which I need to look for in the main string. If I find it, I should display that it was found, and if not, I should display that it wasn't found.
I tried to compare the lengths of the strings so that if the first one has less characters than the second, the message "Invalid" would be displayed. Then I tried to compare the substring with the string until the substring is found in the string and the message "string found" gets displayed, if not, the message : "string not found" gets displayed. No matter what words I input, it will always say "Invalid". How can I change that?
Here is my code:
.model small
.stack 200h
.data
prompt1 db "Input String: $"
prompt2 db 10,10, 13, "Input Word: $"
prompt3 db 10,10, 13, "Output: $"
found db "Word Found. $"
notfound db "Word Not Found. $"
invalid db 10,10, 13, "Invalid. $"
InputString db 21,?,21 dup("$")
InputWord db 21,?,21 dup("$")
actlen db ?
.code
start:
mov ax, #data
mov ds, ax
mov es, ax
;Getting input string
mov ah,09h
lea dx, prompt1
int 21h
lea si, InputString
mov ah, 0Ah
mov dx, si
int 21h
;Getting input word
mov ah,09h
lea dx, prompt2
int 21h
lea di, InputWord
mov ah, 0Ah
mov dx, di
int 21h
;To check if the length of substring is shorter than the main string
mov cl, [si+1]
mov ch, 0
add si, 2
add di, 2
mov bl, [di+1]
mov bh, 0
cmp bx, cx
ja invalid_length
je valid
jb matching
valid:
cld
repe cmpsb
je found_display
jne notfound_display
mov bp, cx ;CX is length string (long)
sub bp, bx ;BX is length word (short)
inc bp
cld
lea si, [InputString + 2]
lea di, [InputWord + 2]
matching:
mov al, [si] ;Next character from the string
cmp al, [di] ;Always the first character from the word
je check
continue:
inc si ;DI remains at start of the word
dec bp
jnz matching ;More tries to do
jmp notfound_display
check:
push si
push di
mov cx, bx ;BX is length of word
repe cmpsb
pop di
pop si
jne continue
jmp found_display
again:
mov si, ax
dec dx
lea di, InputWord
jmp matching
invalid_length:
mov ah, 09h
lea dx, invalid
int 21h
jmp done
found_display:
mov dx, offset found
mov ah, 09h
int 21h
jmp done
notfound_display:
mov dx, offset notfound
mov ah, 09h
int 21h
;fallthrough is intentional
done:
mov ax,4C00h
int 21h ;exit program and return to DOS
end start
I see that you have tried to apply some of the advice I gave in the answer at Finding the substring in an input string.
But it's gone wrong mostly because you decided to special-case where the inputted string has the same length as the inputted word. That's not a special case at all! If it so happens, my calculation of the number of possible finds will remain valid and yield a 1 in the BP register. In short, your problems originate from having inserted that valid part and not having edited the program accordingly.
add si, 2
add di, 2
je valid
jb matching
valid:
cld
repe cmpsb
je found_display
jne notfound_display
You don't need all of the above once you drop the redundant valid part.
again:
mov si, ax
dec dx
lea di, InputWord
jmp matching
And don't forget to remove any code that you don't actually need in your program, especially when you use code that you found on the internet.
Solution
...
; To check if the length of substring is shorter than the main string
mov cl, [si+1]
mov ch, 0
mov bl, [di+1]
mov bh, 0
mov bp, cx ; CX is length string (long)
sub bp, bx ; BX is length word (short)
jb notfound_display
inc bp ; -> BP is number of possible finds 1+
cld
lea si, [InputString + 2]
lea di, [InputWord + 2]
matching:
mov al, [si] ; Next character from the string
cmp al, [di] ; Always the first character from the word
je check
continue:
inc si ; DI remains at start of the word
dec bp
jnz matching ; More tries to do
jmp notfound_display
check:
push si
push di
mov cx, bx ; BX is length of word
repe cmpsb
pop di
pop si
jne continue
jmp found_display
...
Some optimization
I have absorbed the instructions cmp bx, cx ja invalid_length in the calculation of the number of possible finds (shaving off 2 bytes). If the subtraction produces a borrow, you know the word is longer than the string and so you can branch away. Whether you jump to invalid_length or notfound_display is up to you...
You can shorten this program by 2 bytes if you replace lea si, [InputString + 2] lea di, [InputWord + 2] by add si, 2 add di, 2.
This should work:
.model small
.stack 100h
print macro p
lea dx,p
mov ah,09h
int 21h
endm
.data
cn db 0
pn db 0
space db 10,13, " $"
msg db 10,13, "hjut$"
msg1 db "Introduceti primul sir:$"
msg2 db "Introduceti al doilea sir:$"
msg3 db "Al doilea sir nu se gaseste in primul.$"
msg4 db "Al doilea sir se gaseste in primul. $"
ar db 20 dup("$")
br db 20 dup("$")
.code
start:
mov ax,#data
mov ds,ax
mov si,01h
mov di,00h
mov cn,00h
print msg1
read1:mov ah,01h
int 21h
mov ar[si],al
inc si
cmp al,0dh
jnz read1
mov si,00h
print msg2
read2:mov ah,01h
int 21h
mov br[si],al
inc si
cmp al,0dh
jnz read2
mov si,00h
mov di,00h
jmp lop1
lop1: mov di,00h
inc si
mov bh,ar[si]
cmp bh,0dh
jz disp
mov bh,br[di]
cmp ar[si],bh
jnz lop1
jz lop2
lop2:inc si
inc di
mov bh,br[di]
cmp bh,0dh
jz l1
mov bh,br[di]
cmp ar[si],bh
jz lop2
jmp lop1
l1:
add cn,01h
dec si
jmp lop1
disp:
cmp cn,00h
jz disp1
print msg4
add cn,30h
mov dl,cn
mov ah,02h
int 21h
jmp exit
disp1:print msg3
exit:mov ah,4ch
int 21h
end start
I am writing an assembly program that capitalizes the first letter of each word in the sentence I input.
My problem is that it doesn't capitalize the first letter of the words. What's wrong with my code?
Below is my code
.model small
.stack 100h
.data
prompt1 db "Input String: $"
prompt2 db "Output String: $"
InputString db 21,?,21 dup("$")
newline db 10,13,"$"
.code
start:
mov ax, #data
mov ds, ax
; Getting input string
mov ah,09h
lea dx, prompt1
int 21h
lea si, InputString
mov ah, 0Ah
mov dx, si
int 21h
nextline:
mov ah, 09h
lea dx, newline
int 21h
loop1:
mov cl, [si+1]
mov ch,0
add si, cx
inc si
dec cx
cmp cx, 0
je exit
jmp checkspace
checkspace:
cmp si, " "
inc si
je checkletter
checkletter:
cmp si, "a"
jae checkletter2
checkletter2:
cmp si, "z"
jbe capital
capital:
mov ah, [si]
xor ah, 00100000b
mov [si], ah
jmp loop1
exit:
mov ah,09h
lea dx, prompt2
int 21h
mov ah, 09h
mov dx, offset InputString+2
int 21h
mov ah, 4ch
int 21h
end start
Below is the updated part of my code. It can now only capitalize the first letter of the word. I don't know if the problem is with the loop. Please help me figure out which part of my code is wrong. I'm so sorry I don't know how to use a debugger for checking. Thank you.
mov cl, [si+1]
mov ch,0
add si,2
jmp checkletter
loop1:
inc si
dec cx
cmp cx, 0
je exit
cmp si, " "
je checkletter3
jmp loop1
checkletter:
cmp si, 41h
jae checkletter2
checkletter2:
cmp si, 5Ah
jbe capital
checkletter3:
inc si
dec cx
jmp checkletter
capital:
mov ah, [si]
xor ah, 00100000b
mov [si], ah
jmp loop1
cmp si, " "
cmp si, "a"
cmp si, "z"
cmp si, 41h
cmp si, 5Ah
All of the above are comparing the address in SI with an immediate value. They are not comparing the byte that can be found at the address that SI is pointing to with the immediate! You need to dereference it.
cmp byte [si], " "
cmp byte [si], "a"
cmp byte [si], "z"
cmp byte [si], 41h
cmp byte [si], 5Ah
To solve the task of capitalizing just the first letter of each word
You first need to find the start of each word. This is done by skipping the whitespace in front of each word.
Once located, you compare to see if the starting character is in small caps, and only if it is, you convert it to uppercase by subtracting 32.
The rest of the word is again skipped until either the end of the line is encountered or another whitespace is found for which the process starts all over again from the top.
It look like this:
mov cl, [si+1]
test cl, cl ;Exit if the input was empty!!!
jz Exit
add si, 2 ;Point at first byte
SkipSpace:
mov al, [si]
cmp al, " "
jne FirstCharacter
inc si ;(*)
dec cl
jz Exit
jmp SkipSpace
FirstCharacter:
cmp al, "a"
jb SkipRemainingCharacters
cmp al, "z"
ja SkipRemainingCharacters
sub al, 32 ;Capitalize
mov [si], al ; and write back in string
SkipRemainingCharacters:
inc si
dec cl
jz Exit
mov al, [si]
cmp al, " " ;If not space then it's part of same word
jne SkipRemainingCharacters
jmp SkipSpace ;This could just as easily jump to (*)
Exit:
I have this assembly code that reverses a string that I input. It only accepts maximum 20 characters. My problem is that when I hit enter to see the output there is an extra character at the end of the reversed string.
Please help me understand why that does occur and how I can remove that in the output.
We're required to only use function 09H int 21h to display the string and function 0Ah int 21h to input the string. We're using TASM.
Your help would be very much appreciated. Thank you.
Here is my code:
.model small
.stack 100h
.data
MSG DB "Input String(max 20 chars): ", 10, 13, "$"
Sentence1 DB 21,?,21 dup("$")
str2 dw 21 dup("$")
.code
start:
mov ax, #data
mov ds, ax
;Getting the string input
mov ah,09h
lea dx, MSG
int 21h
lea si,Sentence1
mov ah,0ah
mov dx,si
int 21h
;Reverse String
mov cl,Sentence1
add cl,1
add si,2
loop1:
inc si
cmp byte ptr[si],"$"
jne loop1
dec si
lea di,str2
loop2:
mov al,byte ptr[si]
mov byte ptr[di],al
dec si
inc di
loop loop2
;Printing the reverse string
mov ah,09h
lea dx,str2
int 21h
mov ah, 4ch
int 21h
end start
str2 dw 21 dup("$")
Normally this would be using the db directive.
mov cl,Sentence1
add cl,1
The reversal loop uses CX as its loop counter, but you don't set it correctly!
The 2nd byte of the "Sentence1" input structure, contains the value that you want in the CX register. You don't need to search for any terminating character. Moreover if you did, you'd rather have to look for ASCII code 13 (carriage return) instead of '$'.
mov cl, [si + 1] ;Number of characters in the string
mov ch, 0 ;Make it a word because LOOP depends on CX (not just CL)
Setting up SI then becomes:
add si, 2 ;To the start of the string
add si, cx ;To the position after the string
dec si ;To the last character of the string
but shorter:
add si, cx
inc si
If ever the user didn't input any text, you will want to by-pass the reversal entirely! That's what the jcxz is for in next code:
lea si, Sentence1
mov ah, 0Ah
mov dx, si
int 21h
;Reverse String
mov cl, [si + 1]
mov ch, 0
add si, cx
inc si
lea di, str2
jcxz EmptyString ;By-pass the reversal entirely!
loop2:
mov al, byte ptr[si]
mov byte ptr[di], al
dec si
inc di
loop loop2
EmptyString:
;Printing the reverse string (could be empty)
mov ah, 09h
lea dx, str2
int 21h
I have to build a Base Converter in 8086 assembly .
The user has to choose his based and then put a number,
after then , the program will show him his number in 3 more bases[he bring a decimal number, and after this he will see his number in hex, oct, and bin.
This first question is, how can I convert the number he gave me, from string, to a number?
the sec question is, how can i convert? by RCR, and then adc some variable?
Here is my code:
data segment
N=8
ERROR_STRING_BASE DB ,10,13, " THIS IS NOT A BASE!",10,13, " TRY AGINE" ,10,13," $"
OPENSTRING DB " Welcome, to the Base Convertor",10,13," Please enter your base to convert from:",10,13," <'H'= Hex, 'D'=Dec, 'O'=oct, 'B'=bin>: $"
Hex_string DB "(H)" ,10,13, "$"
Octalic_string DB "(O) ",10,13, "$"
Binar_string DB "(B)",10,13, "$"
Dece_string DB "(D)",10,13, "$"
ENTER_STRING DB ,10,13, " Now, Enter Your Number (Up to 4 digits) ",10,13, "$"
Illegal_Number DB ,10,13, " !!! This number is illegal, lets Start again" ,10,13,"$"
BASED_BUFFER DB N,?,N+1 DUP(0)
Number_buffer db N, ? ,N+1 DUP(0)
TheBase DB N DUP(0)
The_numer DB N DUP(0)
The_binNumber DB 16 DUP(0)
data ends
sseg segment stack
dw 128 dup(0)
sseg ends
code segment
assume ss:sseg,cs:code,ds:data
start: mov ax,data
mov ds,ax
MOV DX,OFFSET OPENSTRING ;PUTS THE OPENING SRTING
MOV AH,9
INT 21H
call EnterBase
CALL CheckBase
HEXBASE: CALL PRINTtheNUMBER
MOV DX,OFFSET Hex_string
MOV AH,9
INT 21h
JMP I_have_the_numberH
oCTALICbASE: CALL PRINTtheNUMBER
MOV DX,OFFSET Octalic_string
MOV AH,9
INT 21h
JMP I_have_the_numberO
BINBASE:CALL PRINTtheNUMBER
MOV DX,OFFSET Binar_string
MOV AH,9
INT 21h
JMP I_have_the_numberB
DECBASE: CALL PRINTtheNUMBER
MOV DX,OFFSET Dece_string
MOV AH,9
INT 21h
JMP I_have_the_numberD
I_have_the_numberH: CALL BINcalculation
CALL OCTcalculation
CALL DECcalculation
I_have_the_numberO: CALL BINcalculation
CALL DECcalculation
CALL HEXcalculation
I_have_the_numberB: CALL OCTcalculation
CALL DECcalculation
CALL HEXcalculation
I_have_the_numberD: CALL BINcalculation
CALL OCTcalculation
CALL HEXcalculation
exit: mov ax, 4c00h
int 21h
EnterBase PROC
MOV DX,OFFSET BASED_BUFFER ; GETS THE BASE
MOV AH,10
INT 21H
LEA DX,BASED_BUFFER[2]
MOV BL,BASED_BUFFER[1]
MOV BH,0
MOV BASED_BUFFER[BX+2],0
LEA SI, BASED_BUFFER[2]
XOR CX, CX
MOV CL, BASED_BUFFER[1]
LEA DI, TheBase
LOL_OF_BASE: MOV DL, [SI]
MOV [DI], DL
INC SI
INC DI
INC AL
RET
EnterBase ENDP
CheckBase proc
CMP TheBase,'H'
JE HEXBASE
CMP TheBase,'h'
JE HEXBASE
CMP TheBase,'O'
JE oCTALICbASE
CMP TheBase,'o'
JE oCTALICbASE
CMP TheBase,'B'
JE BINBASE
CMP TheBase,'b'
JE BINBASE
CMP TheBase,'D'
JE DECBASE
CMP TheBase,'d'
JE DECBASE
CMP TheBase, ' '
je ERRORoFBASE
ERRORoFBASE: MOV DX,OFFSET ERROR_STRING_BASE ;PUTS WORNG BASE Illegal_Number
MOV AH,9
INT 21H
JMP START
CheckBase ENDP
PRINTtheNUMBER PROC
MOV DX,OFFSET ENTER_STRING
MOV AH,9
INT 21h
MOV DX,OFFSET Number_buffer ; GETS THE number
MOV AH,10
INT 21H
LEA DX,Number_buffer[2]
MOV BL,Number_buffer[1]
MOV BH,0
MOV Number_buffer[BX+2],0
LEA SI, Number_buffer[2]
XOR CX, CX
MOV CL, Number_buffer[1]
LEA DI, The_numer
xor AL,AL
LOL_OF_NUMBER_CHECK: MOV DL, [SI]
MOV [DI], DL
INC SI
INC DI
INC AL
CMP AL,5
JE ERRORofNUMBER
LOOP LOL_OF_NUMBER_CHECK
RET
ERRORofNUMBER: MOV DX,OFFSET Illegal_Number ;PUTS WORNG BASE Illegal_Number
MOV AH,9
INT 21H
JMP START
PRINTtheNUMBER ENDP
PROC BINcalculation
XOR CX,CX
XOR AX,AX
MOV CX,4
MOV AX,16
LEA SI, The_binNumber[0]
TheBinarLoop: RCL The_numer,1
ADC [SI],0
INC SI
LOOP TheBinarLoop
ENDP
PROC OCTcalculation
ENDP
PROC DECcalculation
ENDP
PROC HEXcalculation
ENDP
code ends
end start
It should be look like this:
thanks!
שלו לוי
the algorighm to decode ascii strings from ANY base to integer is the same:
result = 0
for each digit in ascii-string
result *= base
result += value(digit)
for { bin, oct, dec } value(digit) is ascii(digit)-ascii('0')
hex is a bit more complicated, you have to check if the value is 'a'-'f', and convert this to 10-15
converting integer to ascii(base x) is similar, you have to divide the value by base until it's 0, and add ascii representation of the remainder at the left
e.g. 87/8= 10, remainder 7 --> "7"
10/8= 1, remainder 2 --> "27"
1/8= 0, remainder 1 --> "127"
Copy-paste next little program in EMU8086 and run it : it will capture a number as string from keyboard, then convert it to numeric in BX. To store the number in "The_numer", you have to do mov The_numer, bl :
.stack 100h
;------------------------------------------
.data
;------------------------------------------
msj1 db 'Enter a number: $'
msj2 db 13,10,'Number has been converted',13,10,13,10,'$'
string db 5 ;MAX NUMBER OF CHARACTERS ALLOWED (4).
db ? ;NUMBER OF CHARACTERS ENTERED BY USER.
db 5 dup (?) ;CHARACTERS ENTERED BY USER.
;------------------------------------------
.code
;INITIALIZE DATA SEGMENT.
mov ax, #data
mov ds, ax
;------------------------------------------
;DISPLAY MESSAGE.
mov ah, 9
mov dx, offset msj1
int 21h
;------------------------------------------
;CAPTURE CHARACTERS (THE NUMBER).
mov ah, 0Ah
mov dx, offset string
int 21h
;------------------------------------------
call string2number
;------------------------------------------
;DISPLAY MESSAGE.
mov ah, 9
mov dx, offset msj2
int 21h
;------------------------------------------
;STOP UNTIL USER PRESS ANY KEY.
mov ah,7
int 21h
;------------------------------------------
;FINISH THE PROGRAM PROPERLY.
mov ax, 4c00h
int 21h
;------------------------------------------
;CONVERT STRING TO NUMBER IN BX.
proc string2number
;MAKE SI TO POINT TO THE LEAST SIGNIFICANT DIGIT.
mov si, offset string + 1 ;<================================ YOU CHANGE THIS VARIABLE.
mov cl, [ si ] ;NUMBER OF CHARACTERS ENTERED.
mov ch, 0 ;CLEAR CH, NOW CX==CL.
add si, cx ;NOW SI POINTS TO LEAST SIGNIFICANT DIGIT.
;CONVERT STRING.
mov bx, 0
mov bp, 1 ;MULTIPLE OF 10 TO MULTIPLY EVERY DIGIT.
repeat:
;CONVERT CHARACTER.
mov al, [ si ] ;CHARACTER TO PROCESS.
sub al, 48 ;CONVERT ASCII CHARACTER TO DIGIT.
mov ah, 0 ;CLEAR AH, NOW AX==AL.
mul bp ;AX*BP = DX:AX.
add bx,ax ;ADD RESULT TO BX.
;INCREASE MULTIPLE OF 10 (1, 10, 100...).
mov ax, bp
mov bp, 10
mul bp ;AX*10 = DX:AX.
mov bp, ax ;NEW MULTIPLE OF 10.
;CHECK IF WE HAVE FINISHED.
dec si ;NEXT DIGIT TO PROCESS.
loop repeat ;COUNTER CX-1, IF NOT ZERO, REPEAT.
ret
endp
The proc you need is string2number. Pay attention inside the proc : it uses a variable named "string", you have to change it by the name of your own variable. After the call the result is in BX: if the number is less than 256, you can use the number in BL.
By the way, the string is ALWAYS converted to a DECIMAL number.
; multi-segment executable file template.
data segment
string db "THis is LuxUR in Summer."
ends
stack segment
dw 128 dup(0)
ends
code segment
start:
; set segment registers:
mov ax, data
mov ds, ax
mov es, ax
mov bx, offset string
mov al, 0 ; lower letters in word
mov dl,0 ; maximum letters
check:
mov cl, 41h ; from A-Z
mov ch, 5Ah
mov ah, [bx]
cmp ah, "."
je dot
cmp ah, " "
je empty
jne letters
letters:
cmp ah, cl
je uppercase
inc cl
cmp cl, ch
jne letters
mov cl, 61h ; a-z
mov ch, 7Ah
lowercase:
inc al
cmp dl,al
jl maksimum
inc bx
jmp check
maksimum:
mov dl, al
inc bx
jmp check
uppercase:
inc bx
jmp check
empty:
mov al, 0
inc bx
jmp check
dot:
My program count lowercases in a word in al. and then puts in dl. (maximum lowercases)
I have label which name is dot. there I have to put some instruction by which I can print my result:
Summer is the word with the most lower cases 5
I try few instructions to do that but it doesnt work.
If you're using Windows, the easiest way is to use DOS Interrupts. Specifically, try interrupt 09. This takes a string and outputs it to the standard output.