TÌM KÝ TỰ CÓ MÃ ASCII LỚN NHẤT TRONG CHUỖI


Mã:
.Model Small
.Stack
.Data
	s1 db 'Nhap vao 1 chuoi: $'
	s2 db 10,13,'Ky tu lon nhat: $'
	s3 db 10,13,'Chuoi rong!$'
	s db 100,?,101 dup('$')
	max db ?
.Code
Begin:
	Mov ax, @data
	Mov ds,ax

	Mov ah,09h		;xuat chuoi s1
	Lea dx,s1
	Int 21h

	Mov ah,0Ah		;nhap chuoi s
	Lea dx,s
	Int 21h

	Lea si,s+1		;tim max
	Xor cx,cx
	Mov cl,[si]		;gan do dai that su cua choi vao cl
	Inc si
	Mov al,[si]
	Mov max,al
	Inc si
	Cmp al,13
	Je ChuoiRong
	Cmp al,'$'
	Je ChuoiRong
	Dec cx
	Lap:
		Mov al,[si]
		Cmp al,max
		Jbe	kk
			Mov max,al
		kk:
			Inc si
	Loop Lap
	
	Mov ah,09h		;xuat chuoi s2
	Lea dx,s2
	Int 21h
	
	Mov dl,max		;xuat ky tu lon nhat
	Mov ah,02h
	Int 21h
	jmp Thoat
	
	ChuoiRong:
		Mov ah,09h		;xuat chuoi s3
		Lea dx,s3
		Int 21h
	Thoat:
		Mov ah,4ch
		Int 21h
End Begin