print string result in assembly

Question!
; 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.



Answers

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.



This video can help you solving your question :)
By: admin