0
; 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.

Udo Held
  • 12,314
  • 11
  • 67
  • 93
user1011868
  • 23
  • 1
  • 4

1 Answers1

0

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.

Charlie Salts
  • 13,109
  • 7
  • 49
  • 78
  • LEA DX, string MOV AH, 9 INT 21H i try with this intterupt, but I get just the string printed on the screen ( all sentence with all words) I want to print just the result Summer 5 letters – user1011868 Dec 10 '11 at 20:34
  • Sounds like you're printing the input, not the output. Remember you'll need to format the output before printing. – Charlie Salts Dec 10 '11 at 20:59
  • I dont know which interrupt to use, to print the 2 results, one the string Summer and the number of letters 5 the example code for it will be more usefull for me to understand – user1011868 Dec 10 '11 at 21:00
  • i really print the input, i dont understand how to print my output – user1011868 Dec 10 '11 at 21:02