A Procedure in Assembly Language receives one value in AL returns sign bit – IGNOU MCA Assignment 2013

By | April 14, 2014

MASTER OF COMPUTER APPLICATIONS
Course Code : MCS-012
Course Title : Computer Organisation and Assembly Language Programming
Assignment Number : MCA(1)/012/Assign/2013 and BCA(II)/012/Assign/2013

 

Write a simple near procedure in 8086 assembly language that receives one parameter value in AL register from the main module and returns sign bit of the input parameter. Make suitable assumptions, if any

 

DATA SEGMENT
MSG DB “CARRY BIT RETURN IS : $”
DATA ENDS

CODE SEGMENT
ASSUME DS:DATA,CS:CODE
START:
MOV AX,DATA
MOV DS,AX

MOV AL,80H
ADD AL,0FFH ;USE 0FH FOR NO CARRY AND USE 0FFH FOR CARRY

LEA DX,MSG
MOV AH,9
INT 21H

CALL CHECKCARRY

ADD DL,30H
MOV AH,2
INT 21H

MOV AH,4CH
INT 21H
CODE ENDS

CHECKCARRY PROC NEAR
RCL AL,1
AND AL,00000001B
MOV DL,AL
RET
CHECKCARRY ENDP

END START

program code :

  1. DATA SEGMENT
  2. MSG DB "CARRY BIT RETURN IS : $"
  3. DATA ENDS
  4. CODE SEGMENT
  5. ASSUME DS:DATA,CS:CODE
  6. START:
  7. MOV AX,DATA
  8. MOV DS,AX
  9. MOV AL,80H
  10. ADD AL,0FFH ;USE 0FH FOR NO CARRY AND USE 0FFH FOR CARRY
  11. LEA DX,MSG
  12. MOV AH,9
  13. INT 21H
  14. CALL CHECKCARRY
  15. ADD DL,30H
  16. MOV AH,2
  17. INT 21H
  18. MOV AH,4CH
  19. INT 21H
  20. CODE ENDS
  21. CHECKCARRY PROC NEAR
  22. RCL AL,1
  23. AND AL,00000001B
  24. MOV DL,AL
  25. RET
  26. CHECKCARRY ENDP
  27. END START

Screen shots :-

Asm_program_Procedure_Bit_Return

Outputs :-

Asm_program_Procedure_Bit_Return_Output1

Asm_program_Procedure_Bit_Return_Output2

 

Leave a Reply