You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MOVDL,':' ; To Print : in DOSMOVAH,02HINT21H;Seconds PartSeconds:MOVAH,2CH ; To get System TimeINT21HMOVAL,DH ; Seconds is in DHAAMMOVBX,AXCALL DISP;To terminate the ProgramMOVAH,4CH ; To Terminate the ProgramINT21H;Display PartDISP PROCMOVDL,BH ; Since the values are in BX, BH PartADDDL,30H ; ASCII AdjustmentMOVAH,02H ; To Print in DOSINT21HMOVDL,BL ; BL Part
To check palindrome (18BCE0557 - Kushal)
.MODEL SMALL .STACK 100H.DATA ; The string to be printed STRING DB 'kushhsuk','$' ; string is given hereSTRING1 DB 'String is palindrome','$'STRING2 DB 'String is not palindrome','$'.CODE MAIN PROC FAR MOVAX, @DATA MOVDS,AX ; check if the string is; ;palindrome or not CALL Palindrome ;interrupt to exitMOVAH,4CHINT21H MAIN ENDP Palindrome PROC ; load the starting address ; of the string MOVSI,OFFSET STRING ; traverse to the end of; ;the string LOOP1 : MOVAX,[SI]CMPAL,'$'JE LABEL1 INCSIJMP LOOP1 ;load the starting address; ;of the string LABEL1 : MOVDI,OFFSET STRING DECSI ; check if the string is plaindrome; ;or not LOOP2 : CMPSI,DIJL OUTPUT1 MOVAX,[SI]MOVBX,[DI]CMPAL,BLJNE OUTPUT2 DECSIINCDIJMP LOOP2 OUTPUT1: ;load address of the string LEADX,STRING1 ; output the string; ;loaded in dx MOVAH,09HINT21HRET OUTPUT2: ;load address of the string LEADX,STRING2 ; output the string ; loaded in dx MOVAH,09HINT21HRETPalindrome ENDP END MAIN
Reversing a String (18BCE0557 KUSHAL | DA4 MICRO LAB)
.MODEL SMALL .STACK 100H.DATA ; The string to be printed STRING DB 'Sometimes I do my DA on my own but very rarely','$'.CODE MAIN PROC FAR MOVAX,@DATA MOVDS,AX; call reverse function CALL REVERSE ; load address of the string LEADX,STRING ; output the string ; loaded in dx MOVAH,09HINT21H; interrupt to exitMOVAH,4CHINT21HMAIN ENDP REVERSE PROC ; load the offset of ; the string MOVSI, OFFSET STRING ; count of characters of the; ;string MOVCX,0H LOOP1: ; compare if this is; ;the last character MOVAX,[SI]CMPAL,'$'JE LABEL1 ; else push it in the; ;stack PUSH[SI] ; increment the pointer; ;and count INCSIINCCXJMP LOOP1 LABEL1: ; again load the starting; ;address of the string MOVSI, OFFSET STRING LOOP2: ;if count not equal to zero CMPCX,0JE EXIT ; pop the top of stack POPDX ; make dh, 0 XORDH,DH ; put the character of the; ;reversed string MOV[SI],DX ; increment si and; ;decrement count INCSIDECCXJMP LOOP2 EXIT: ; add $ to the end of string MOV[SI],'$ 'RETREVERSE ENDP END MAIN
Finding vowels in a string
.MODEL SMALL.STACK 64.DATAMAXLEN Db 100 ACTCHAR Db ?STR DB 100 DUP('$') VL DB "AEIOUaeiou",'$' STR1 DB "NO. OF VOWELS IS ",'$'.CODE MAIN PROC FARMOVAX,@DATAMOVDS,AXMOVCX,00MOVDI,00MOVAX,00LEADX, MAXLENMOVAH,0AHINT21HMOVCH,00HMOVCL, ACTCHARMOVDX,00L2: MOVSI,000BHL1: MOVAL, VL [SI]CMPAL,STR[DI]JNZ L3INCDHCMPDH,0AHJB L3MOVDH,00INCDLL3: SUBSI,01JNZ L1INCDILOOP L2MOVBX,DXMOVAH,02HMOVDL,0AHINT21HMOVDL,0DHINT21HLEADX, STR1MOVAH,09HINT21HMOVDX,bXADDDL,30HMOVAH,02HINT21HADDDH,30HMOVDL,DHMOVAH,02HINT21HMOVAX,4C00HINT21HMAIN ENDPEND MAIN