0% found this document useful (0 votes)
27 views11 pages

LAB Report 3

The program takes in a string of capital letters from the user and finds the longest consecutive increasing substring within the input. It stores the length and first letter of the longest substring, then outputs the substring. It also handles updating the longest substring if a new longer one is found.

Uploaded by

Saimun Mahumd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views11 pages

LAB Report 3

The program takes in a string of capital letters from the user and finds the longest consecutive increasing substring within the input. It stores the length and first letter of the longest substring, then outputs the substring. It also handles updating the longest substring if a new longer one is found.

Uploaded by

Saimun Mahumd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

8.

model small
.stack 100h
.data
a db 'Md Mehedi Hasan IT-19034$'
b db 10,13,'$'
.code
main proc
mov ax,@data
mov ds,ax
mov ah,9
lea dx,a
int 21h
lea dx,b
int 21h
mov ah,2
mov dl,'?'
int 21h

mov ah,1
int 21h
mov bl,al

int 21h
mov cl,al

mov ah,2
mov dl,10
int 21h
mov dl,13
int 21h

cmp bl,cl
jl next

mov dl,cl
int 21h
mov dl,bl
int 21h
jmp exit

next:
mov dl,bl
int 21h
mov dl,cl
int 21h

exit:
mov ah,4ch
int 21h
main endp
end main

9..

.model small

.stack 100h

.data

a db 'Md Mehedi Hasan IT-19034$'

b db 10,13,'$'

.code

main proc

mov ax,@data

mov ds,ax

mov ah,9

lea dx,a

int 21h

lea dx,b

int 21h

mov cx,127

mov bl,0

print:

mov ah,2

inc cx

cmp cx,255

jg exit

mov dx,cx

int 21h
mov dx,32

int 21h

jmp go

go:

inc bl

cmp bl,10

je nl

jmp print

nl:

mov ah,2

mov dl,10

int 21h

mov dl,13

int 21h

mov bl,0

jmp print

exit:

mov ah,4ch

int 21h

main endp

end main
10..
.model small
.stack 100h
.data
a db 'Md Mehedi Hasan IT-19034$'
b db 10,13,'$'
msg1 db 10,13,'Enter a hax digit $'
msg2 db 10,13,'In decimal is it $'
msg3 db 10,13,'Do you want to do it again $'
msg4 db 10,13,'Illegal character. enter 0-9 or A-F $'
.code
main proc

mov ax,@data
mov ds,ax
mov ah,9
lea dx,a
int 21h
lea dx,b
int 21h
again:
mov ah,9
lea dx,msg1
int 21h
mov ah,1
int 21h
mov bl,al
jmp go

go:
cmp bl,'9'
jg hex
je num
jl num

hex:
cmp bl,'F'
jg illegal
mov ah,9
lea dx,msg2
int 21h
mov dl,49
mov ah,2
int 21h
mov ah,2
sub bl,17
mov dl,bl
int 21h
jmp inp

inp:
mov ah,9
lea dx,msg3
int 21h
mov ah,1
int 21h
mov cl,al
cmp cl,'Y'
je again
cmp cl,'y'
je again
jmp exit

num:
cmp bl,'0'
je illegal
lea dx,msg2
int 21h
mov ah,9
int 21h

mov dl,bl
mov ah,2
int 21h
jmp inp

illegal:
lea dx,msg4
mov ah,9
int 21h
mov ah,1
int 21h
mov bl,al
jmp go

exit:
mov ah,4ch
int 21h

main endp
end main
11..
.model small
.stack 100h
.data
a db 'Md Mehedi Hasan IT-19034$'
b db 10,13,'$'
msg1 db 10,13,'ENTER A HEX DIGIT:$'
msg2 db 10,13,'IN DECIMAL IS IT:$'
msg3 db 10,13,'DO YOU WANT TO DO IT AGAIN?$'
msg4 db 10,13,'ILLEGAL CHARACTER- ENTER 0-9 OR A-F:$'
msg5 db 10,13,'Too Many Try$'
.code
main proc
mov ax,@data
mov ds,ax
mov ah,9
lea dx,a
int 21h
lea dx,b
int 21h
again:
mov cx,0
lea dx,msg1
mov ah,9
int 21h

mov ah,1
int 21h

mov bl,al

jmp go

go:

cmp bl,'9'
ja hex
jb num
je num

hex:
cmp bl,'F'
ja illegal
lea dx,msg2
mov ah,9
int 21h

mov dl,49d
mov ah,2
int 21h

sub bl,17d
mov dl,bl
mov ah,2
int 21h

jmp inp

inp:

lea dx,msg3
mov ah,9
int 21h

mov ah,1
int 21h

mov cl,al
cmp cl,'y'
je again
cmp cl,'Y'
je again
jmp exit

num:

cmp bl,'0'
jb illegal

lea dx,msg2
mov ah,9
int 21h

mov dl,bl
mov ah,2
int 21h
jmp inp

illegal:

inc cx
cmp cx,3
je i2

lea dx,msg4
mov ah,9
int 21h

mov ah,1
int 21h

mov bl,al

jmp go

i2:
lea dx,msg5
mov ah,9
int 21h
jmp exit

exit:
mov ah,4ch
int 21h
main endp
end main
12…
.MODEL SMALL
.STACK 100H
.DATA
A DB 'Md Mehedi Hasan IT-19034$'
B DB 10,13,'$'
INPUTMSG DB 'ENTER A STRING OF CAPITAL LETTERS : $'
OUTPUTMSG DB 0DH,0AH,'THE LONGEST CONSECUTIVE INCREASING STRING
IS : $'
.CODE

MAIN PROC

MOV AX,@DATA
MOV DS,AX
MOV AH,9
LEA DX,A
INT 21H
LEA DX,B
INT 21H
MOV CH,0

MOV AH,9
LEA DX,INPUTMSG
INT 21H

INPUT_1:
MOV AH,1
INT 21H

CMP AL,0DH
JE END_
MOV CL,1
MOV BL,AL
MOV DH,AL
INPUT_2:
INT 21H

CMP AL,0DH
JE END_

INC BL
CMP BL,AL
JNE INIT
INC CL
JMP INPUT_2
INIT:
CMP CH,CL
JL UPDATE

MOV CL,1
MOV BL,AL
MOV DH,AL
JMP INPUT_2

UPDATE:
MOV CH,CL
MOV BH,DH

MOV CL,1
MOV BL,AL
MOV DH,AL
JMP INPUT_2
END_:
CMP CH,CL
JL REUPDATE
JMP END_2

REUPDATE:
MOV CH,CL
MOV BH,DH
JMP END_2
END_2:

MOV AH,9
LEA DX,OUTPUTMSG
INT 21H

MOV AH,2
MOV DL,BH
OUTPUT:
CMP CH,0
JE FINISH

DEC CH
INT 21H
INC DL
JMP OUTPUT
FINISH:

MOV AH,4CH
INT 21H

MAIN ENDP
END MAIN

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy