Progs

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Progs as PDF for free.

More details

  • Words: 2,317
  • Pages: 34
TITLE BLINK TEXT .MODEL SMALL .STACK 64 .DATA MSG DB 'WELCOME TO ASCET$' .CODE MOV AX, @DATA MOV DS, AX MOV MOV MOV INT

AH, 02H DH, 12 DL, 18 10H

MOV MOV MOV INT

AH,09H BX, 97H CX, 10H 10H

MOV AH, 09H LEA DX, MSG INT 21H MOV AH, 4CH INT 21H END ; OUTPUT ;********************* ; WELCOME TO ASCET

TITLE CONCATINATION DISP MACRO MSG MOV AH,09H LEA DX,MSG INT 21H ENDM .MODEL SMALL .STACK 64 .DATA LIN DB 0AH,0DH,'$' MSG1 DB "ENTER FIRST STRING:$" MSG2 DB 0AH,0DH,"ENTER SECOND STRING:$" MSG3 DB 0AH,0DH,"THE CONCATINATION OF TWO STRINGS:$" FSTR MAXLEN ACTLEN STR1 SSTR MLEN ALEN STR2 RES

LABEL DB DB DB LABEL DB DB DB DB

.CODE BEGIN MOV AX,@DATA MOV DS,AX DISP LIN DISP MSG1 MOV AH,0AH LEA DX,FSTR INT 21H DISP MSG2 MOV AH,0AH LEA DX,SSTR

BYTE 20 0 20 DUP('$') BYTE 20 0 20 DUP('$') 20 DUP('$')

INT LEA LEA MOV MOV

21H SI,STR1 DI,RES CH,00H CL,ACTLEN

ADV: MOV AL,[SI] MOV [DI],AL INC SI INC DI LOOP ADV LEA SI,STR2 MOV CH,00H MOV CL,ALEN NEXT: MOV AL,[SI] MOV [DI],AL INC SI INC DI LOOP NEXT DISP LIN DISP MSG3 DISP RES MOV AH,4CH INT 21H END ; OUTPUT ;********************* ;ENTER FIRST STRING:RAMA ;ENTER SECOND STRING:RAO ;THE CONCATINATION OF TWO STRINGS:RAMARAO

TITLE DISPLAY TEST .MODEL SMALL .STACK 100H .DATA X DB "HELLO, WELCOME TO ASCET$" .CODE MOV AX, @DATA MOV DS, AX MOV AH, 09H LEA DX, X INT 21H MOV AH, 4CH INT 21H END

; OUTPUT ;********************* ;HELLO, WELCOME TO ASCET

TITLE EVEN OR ODD DISP MACRO ST MOV AH,09H LEA DX,ST INT 21H ENDM .MODEL SMALL .STACK 64 .DATA ST1 DB "ENTER ANY NUMBER: $" ST2 DB 0AH,0DH,'THE GIVEN NUMBER IS ODD','$' ST3 DB 0AH,0DH,'THE GIVEN NUMBER IS EVEN','$' N DB 0 .CODE MOV AX,@DATA MOV DS,AX DISP ST1 MOV BH,00H LOOP1: MOV AH,01H INT 21H CMP AL,13 JE LOOP2 SUB AL,'0' MOV BL,AL MOV AL,N MOV CL,10 MUL CL ADD AL,BL MOV N,AL JMP LOOP1 LOOP2: MOV AL,N MOV BL,02H DIV BL

CMP AH,00H JE LOOP3 DISP ST2 JMP LOOP4 LOOP3: DISP ST3 LOOP4: MOV AH,4CH INT 21H END

; OUTPUT ;********************* ;ENTER ANY NUMBER: 3 ;THE GIVEN NUMBER IS ODD ;ENTER ANY NUMBER: 2 ;THE GIVEN NUMBER IS EVEN

TITLE FACTORIAL .MODEL SMALL .STACK 64 .DATA MSG1 DB 0AH,0DH,"ENTER ANY NUMBER:$" MSG2 DB 0AH,0DH,"FACTORIAL VALUE IS:$" N DB 0 RES DB 10 DUP('$') .CODE BEGIN PROC MOV AX,@DATA MOV DS,AX MOV AH,09H LEA DX,MSG1 INT 21H LOOP1: MOV AH,01H INT 21H CMP AL,13 JE LOOP2 SUB AL,'0' MOV BL,AL MOV AL,N MOV CL,10 MUL CL ADD AL,BL MOV N,AL JMP LOOP1 LOOP2: MOV CH,00H MOV CL,N MOV AX,00001H CALPARA: MUL CX LOOP CALPARA MOV BX,AX

MOV AH,09H LEA DX,MSG2 INT 21H MOV AH,00H MOV AX,BX LEA SI,RES CALL HEX2ASC MOV AH,09H LEA DX,RES INT 21H MOV AH,004CH INT 21H BEGIN ENDP HEX2ASC PROC PUSH AX PUSH BX PUSH CX PUSH DX PUSH SI MOV BX,000AH MOV CX,0000H LOOP3: MOV DX,0000H DIV BX ADD DL,'0' PUSH DX INC CX CMP AX,000AH JGE LOOP3 ADD AL,'0' MOV [SI],AL LOOP4: POP AX INC SI MOV [SI],AL LOOP LOOP4 POP SI POP DX POP CX

POP BX POP AX RET HEX2ASC ENDP END BEGIN

; OUTPUT ;********************* ;ENTER ANY NUMBER:5 ;FACTORIAL VALUE IS:120

TITLE FIBANACCI DISP MACRO MSG MOV AH,09H LEA DX,MSG INT 21H END READ MACRO NUM MOV AH,01H INT 21H SUB AL,'0' MOV BL,0AH MUL BL MOV NUM,AL MOV AH,01H INT 21H SUB AL,'0' ADD NUM,AL ENDM .MODEL SMALL .STACK 64 .DATA MSG1 DB "ENTER SIZE OF THE SERIES:$" MSG2 DB "THE FIBANOCCI SERIES IS:$" LIN DB 0AH,0DH,'$' A DW 0 B DW 1 C DW 0 RES DB 15 DUP('$') NUM DB ? .CODE BEGIN PROC NEAR MOV AX,@DATA MOV DS,AX DISP MSG1 READ NUM

MOV CH,00H MOV CL,NUM DISP LIN DISP MSG2 NEXT: MOV AX,C LEA SI,RES CALL HEX2ASC DISP LIN DISP RES MOV AX,B MOV A,AX MOV AX,C MOV B,AX ADD AX,A MOV C,AX LOOP NEXT MOV AH,4CH INT 21H BEGIN ENDP HEX2ASC PROC NEAR PUSH AX PUSH BX PUSH CX PUSH DX PUSH SI MOV CX,00H MOV BX,0AH LOOP1: MOV DX,00H DIV BX ADD DL,'0' PUSH DX INC CX CMP AX,0AH JGE LOOP1 ADD AL,'0' MOV [SI],AL LOOP2: POP AX INC SI

MOV [SI],AL LOOP LOOP2 POP SI POP DX POP CX POP BX POP AX RET HEX2ASC ENDP END BEGIN

; OUTPUT ;********************* ENTER SIZE OF THE SERIES:10 THE FIBANOCCI SERIES IS: ; 00 ; 01 ; 01 ; 02 ; 03 ; 05 ; 08 ; 13 ; 21 ; 34

TITLE LEAP YEAR DISP MACRO MSG MOV AH,09H LEA DX,MSG INT 21H ENDM .MODEL SMALL .STACK 64 .DATA LIN MSG1 MSG2 MSG3 Y DB

DB DB DB DB 0

0AH,0DH,'$' 'ENTER A YEAR : $' 'GIVEN YEAR IS A LEAP YEAR $' 'GIVEN YEAR IS NOT A LEAP YEAR $'

.CODE MOV AX,@DATA MOV DS,AX DISP MSG1 MOV BH, 0H LOOP1: MOV AH,01H INT 21H CMP AL,13 JE NEXT SUB AL,'0' MOV BL,AL MOV AL, Y MOV CL, 10 MUL CL ADD AL, BL MOV Y, AL JMP LOOP1 NEXT: MOV AL, Y MOV BL, 4 DIV BL

CMP AH, 0 JE LEAP DISP LIN DISP MSG3 JMP LAST LEAP: DISP LIN DISP MSG2 JMP LAST LAST: MOV AH,4CH INT 21H END

; OUTPUT ;********************* ;ENTER A YEAR : 2004 ;GIVEN YEAR IS A LEAP YEAR ;ENTER A YEAR : 2003 ;GIVEN YEAR IS NOT A LEAP YEAR

TITLE MAXIMUM OF TWO NUMBERS DISP MACRO MSG MOV AH,09H LEA DX,MSG INT 21H ENDM READNUM MACRO NUM MOV AH,01H INT 21H SUB AL,'0' MOV BL,0AH MUL BL MOV NUM,AL MOV AH,01H INT 21H SUB AL,'0' ADD NUM,AL ENDM .MODEL SMALL .STACK 64 .DATA LIN MSG1 MSG2 MSG3 MSG4 A DB B DB

DB DB DB DB DB ? ?

0AH,0DH,'$' 'ENTER VALUE OF A : $' 'ENTER VALUE OF B : $' 'A IS MAXIMUM.$' 'B IS MAXIMUM.$'

.CODE MOV AX,@DATA MOV DS,AX DISP MSG1

READNUM A DISP LIN DISP MSG2 READNUM B MOV AL, A CMP AL, B JG ABIG DISP LIN DISP MSG4 JMP LAST ABIG: DISP LIN DISP MSG3 LAST: MOV AH,4CH INT 21H END

; OUTPUT ;********************* ;ENTER VALUE OF A : 5 ;ENTER VALUE OF B : 6 ;B IS MAXIMUM. ;ENTER VALUE OF A : 4 ;ENTER VALUE OF B : -4 ;A IS MAXIMUM.

TITLE PALINDROME DISP MACRO MSG MOV AH,09H LEA DX,MSG INT 21H ENDM .MODEL SMALL .STACK 64 .DATA MSG1 DB 'ENTER ANY STRING:$' MSG2 DB 0AH,0DH,'THE GIVEN STRING IS PALINDROME $' MSG3 DB 0AH,0DH,'THE GIVEN STRING IS NOT PALINDROME $' STR1 LABEL BYTE MAX DB 20 ACT DB ? INFO DB 10 DUP('$') .CODE BEGIN PROC NEAR MOV AX,@DATA MOV DS,AX DISP MSG1 MOV AH,0AH LEA DX,STR1 INT 21H MOV CH,00H MOV CL,ACT LEA SI,INFO LEA DI,INFO ADV: INC DI LOOP ADV MOV AH,00H MOV AL,ACT MOV BL,02H

DIV BL MOV CH,00H MOV CL,AL DEC DI MOV AL,[SI] CMP AL,[DI] JE NEXT JMP NOTPALIN NEXT: INC SI DEC DI MOV AL,[SI] CMP AL,[DI] JNE NOTPALIN LOOP NEXT DISP MSG2 JMP LAST NOTPALIN: DISP MSG3 LAST: MOV AH,4CH INT 21H BEGIN ENDP END BEGIN ; OUTPUT ;********************* ;ENTER ANY STRING:RAJA ;THE GIVEN STRING IS NOT PALINDROME ;ENTER ANY STRING:MADAM ;THE GIVEN STRING IS PALINDROME

TITLE PRIME NUMBER .MODEL SMALL .STACK 64 .DATA LIN DB 0AH,0DH,'$' MSG1 DB 'ENTER A NUMBER :$' MSG2 DB 0AH,0DH,'THE GIVEN NUMBER IS PRIME $' MSG3 DB PRIME $' N MAXLEN ACTLEN NUM TEN TEMP

0AH,0DH,'THE GIVEN NUMBER IS NOT LABEL DB DB DB DB DW

.CODE BEGIN PROC MOV AX,@DATA MOV DS,AX MOV AH,09H LEA DX,MSG1 INT 21H MOV AH,0AH LEA DX,LIN INT 21H MOV AH,0AH LEA DX,N INT 21H MOV CL,ACTLEN MOV AH,00H LEA SI,NUM MOV AX,000H START: MOV BL,[SI] AND BX,000FH MUL TEN ADD AX,BX

BYTE 4 ? 4 DUP('$') 10 0

INC SI LOOP START MOV TEMP,AX CMP AX,02 JE PRIME MOV CX,2 MOV BX,AX NEXT: MOV AX,TEMP MOV DX,0000H DIV CX CMP DX,0000H JE NOTPRIME INC CX CMP BX,CX JE NEXT PRIME: CALL CLEA CALL SET MOV AH,02H MOV DH,11 MOV DL,20 INT 10H MOV AH,09H LEA DX,MSG2 INT 21H JMP LAST NOTPRIME: CALL CLEA CALL SET MOV AH,02H MOV DH,12 MOV DL,20 INT 10H MOV AH,09H LEA DX,MSG3 INT 21H JMP LAST CLEA PROC NEAR MOV AL,06H MOV AH,02H

MOV CX,0000H MOV DX,184FH INT 10H RET CLEA ENDP SET PROC NEAR MOV AH,02H MOV BH,00H MOV DX,0000H INT 10H RET SET ENDP LAST: MOV AH,4CH INT 21H BEGIN ENDP END BEGIN ; OUTPUT ;********************* ;ENTER A NUMBER :5 ;THE GIVEN NUMBER IS PRIME ;ENTER A NUMBER :6 ;THE GIVEN NUMBER IS NOT PRIME

TITLE REPALACEMENT OF THE STRING DISP MACRO MSG MOV AH,09H LEA DX,MSG INT 21H ENDM .MODEL SMALL .STACK 64 .DATA LIN DB 0AH,0DH,'$' MSG1 DB "ENTER THE MAIN STRING:$" MSG2 DB "ENTER THE SUB STRING:$" MSG3 DB "ENTER THE THIRD STRING:$" MSG4 DB "THE RESULTANT STRING IS:$" MSG5 DB "THE GIVEN SUB STRING NOT FOUND:$" MAINSTR LABEL BYTE MAXLEN DB 21 ACTLEN DB ? STR1 DB 20 DUP('$') SUBST LABEL BYTE MLEN DB 21 ALEN DB ? STR2 DB 20 DUP('$') THIRD LABEL BYTE MAX DB 21 ACT DB ? STR3 DB 20 DUP('$') COUNT DB ? POS DW 1 P DW 0 S DW 0 .CODE BEGIN PROC NEAR MOV AX,@DATA MOV DS,AX

DISP LIN DISP MSG1 MOV AH,0AH LEA DX,MAINSTR INT 21H DISP LIN DISP MSG2 MOV AH,0AH LEA DX,SUBST INT 21H DISP LIN DISP MSG3 MOV AH,0AH LEA DX,THIRD INT 21H LEA SI,STR1 LEA BX,STR2 MOV CH,00H MOV AL,ALEN MOV COUNT,AL CHECK: MOV AX,POS MOV P,AX MOV S,SI MOV AL,[SI] CMP AL,[BX] JE NEXT INC SI INC POS DEC ACTLEN JNZ CHECK JMP NOTFOUND NEXT: DEC JZ DEC JZ INC INC INC

COUNT FOUND ACTLEN NOTFOUND SI POS BX

MOV AL,[SI] CMP AL,[BX] JE NEXT LEA BX,STR2 MOV AL,ALEN MOV COUNT,AL JMP CHECK FOUND: MOV SI,S LEA BX,STR3 MOV CH,00H MOV CL,ACT LP1: MOV AL,[BX] MOV [SI],AL INC SI INC BX LOOP LP1 DISP LIN DISP MSG4 DISP LIN DISP STR1 JMP LAST NOTFOUND: DISP LIN DISP MSG5

LAST: MOV AH,4CH INT 21H BEGIN ENDP END BEGIN

; OUTPUT ;********************* ;ENTER THE MAIN STRING:RAMARAJU ;ENTER THE SUB STRING:RAJU ;ENTER THE THIRD STRING:RAO ;THE RESULTANT STRING IS:RAMARAOU

TITLE STRING REVERSE DISP MACRO MSG MOV AH,09H LEA DX,MSG INT 21H ENDM .MODEL SMALL .STACK 64 .DATA LIN DB 0AH,0DH,('$') MSG1 DB 'ENTER ANY STRING :$' MSG2 DB 'THE REVERSE STRING IS :$' STR1 LABEL BYTE MAX DB 20 ACT DB 0 INFO DB 20 DUP('$') RES DB 20 DUP('$') .CODE BEGIN PROC MOV AX,@DATA MOV DS,AX DISP LIN DISP MSG1 MOV AH,0AH LEA DX,STR1 INT 21H MOV CH,00H MOV CL,ACT LEA SI,INFO LEA DI,RES

ADV: INC DI LOOP ADV MOV CH,00H MOV CL,ACT MOV AL,'$' MOV [DI],AL DEC DI NEXT: MOV AL,[SI] MOV [DI],AL I C SI DEC DI LOOP NEXT DISP LIN DISP MSG2 DISP RES MOV AH,4CH INT 21H BEGIN ENDP END BEGIN ; OUTPUT ;********************* ;ENTER ANY STRING :ASCET ;THE REVERSE STRING IS :TECSA

TITLE SUM OF THE DIGITS DISP MACRO MSG MOV AH,09H LEA DX,MSG INT 21H ENDM .MODEL SMALL .STACK 64 .DATA LIN DB 0AH,0DH,'$' MSG1 DB 'ENTER ANY NUMBER:$' MSG2 DB 'SUM OF THE DIGITS IS:$' SUM DB 0 RES DB 15 DUP('$') .CODE BEGIN

PROC NEAR MOV AX,@DATA MOV DS,AX DISP MSG1

AGAIN: MOV AH, 01H INT 21H CMP AL,13 JE NEXT SUB AL,'0' ADD AL, SUM MOV SUM, AL JMP AGAIN

NEXT: DISP LIN DISP MSG2 MOV AH,00H MOV AL,SUM LEA SI,RES CALL HEX2ASC DISP RES MOV AH,4CH INT 21H BEGIN ENDP

HEX2ASC PROC NEAR PUSH AX PUSH BX PUSH CX PUSH DX PUSH SI MOV BX,000AH MOV CX,0000H LOOP1: MOV DX,0000H DIV BX ADD DL,'0' PUSH DX INC CX CMP AX,000AH JGE LOOP1 ADD AL,'0' MOV [SI],AL

LOOP2: POP AX INC SI MOV [SI],AL LOOP LOOP2 POP SI POP DX POP CX POP BX POP AX RET HEX2ASC ENDP END BEGIN ; OUTPUT ;********************* ;ENTER ANY NUMBER:123 ;SUM OF THE DIGITS IS:06

TITLE SUBSTRING DISP MACRO MSG MOV AH,09H LEA DX,MSG INT 21H ENDM .MODEL SMALL .STACK 64 .DATA LIN DB 0AH,0DH,'$' MSG1 DB 'ENTER ANY STRING:$' MSG2 DB 'ENTER ANY SUBSTRING:$' MSG3 DB 'SUB STRING IS FOUND AT POSITION:$' MSG4 DB 'SUBSTRING IS NOT FOUND:$' MAINSTR LABEL MAXLEN ACTLEN STR1 SUBSTR1 LABEL MLEN ALEN STR2 RES COUNT POS P ADDR ACT .CODE BEGIN PROC MOV AX,@DATA MOV DS,AX DISP LIN DISP MSG1 MOV AH,0AH

BYTE DB 20 DB 0 DB 20 DUP('$') BYTE DB 20 DB 0 DB 15 DUP('$') DB 15 DUP('$') DB 0 DW 1 DW 0 DW 0 DW 0

LEA DX,MAINSTR INT 21H MOV AH,ACTLEN MOV ALEN,AH DISP LIN DISP MSG2 MOV AH,0AH LEA DX,SUBSTR1 INT 21H LEA SI,STR1 LEA BX,STR2 MOV CH,00H MOV CL,ALEN MOV COUNT,CL CHECK: MOV AX,POS MOV P,AX MOV AX,SI MOV ADDR,AX MOV AL,[SI] CMP AL,[BX] JE NEXT INC SI INC POS DEC ACTLEN JNZ CHECK JMP NOTFOUND NEXT: DEC COUNT JZ FOUND DEC ACTLEN INC SI INC POS INC BX MOV AL,[SI] CMP AL,[BX] JE NEXT JZ NOTFOUND LEA BX,STR2 MOV AX,ADDR MOV SI,AX

INC SI MOV AX,ACT SUB AX,P MOV ACTLEN,AH INC P MOV AX,P MOV POS,AX MOV ACTLEN,AH MOV AH,00H MOV AL,ALEN MOV COUNT,AL JMP CHECK FOUND: DISP LIN DISP MSG3 MOV AX,P LEA SI,RES CALL HEX2ASC DISP RES JMP LAST NOTFOUND: DISP LIN DISP MSG4 LAST: MOV AH,4CH INT 21H BEGIN ENDP

HEX2ASC PROC NEAR PUSH AX PUSH BX PUSH CX PUSH DX PUSH SI MOV BX,000AH MOV CX,0000H LOOP1: MOV DX,0000H DIV BX ADD DL,'0' PUSH DX INC CX CMP AX,000AH JGE LOOP1 ADD AL,'0' MOV [SI],AL LOOP2: POP AX INC SI MOV [SI],AL LOOP LOOP2 POP SI POP DX POP CX POP BX POP AX RET HEX2ASC ENDP END BEGIN ; OUTPUT ;********************* ; ENTER ANY STRING:RANGARAO ; ENTER ANY SUBSTRING:RAO ; SUB STRING IS FOUND AT POSITION:06

Related Documents

Progs
November 2019 5
Progs
November 2019 7
Progs
November 2019 8
Bailout Progs
April 2020 23