Wednesday, 29 July 2015

Write a program to display the extended ASCII characters (ASCII codes 80h to FFh). Display 10 characters per line, separated by blanks. Stop after the extended characters have been displayed once In Assembly Language Solution Using Function/Procedure.

Write a program to display the extended ASCII characters (ASCII
codes 80h to FFh). Display 10 characters per line, separated by
blanks. Stop after the extended characters have been displayed
once.
/*
    *
    * Prosen Ghosh
    * American International University - Bangladesh (AIUB)
    *
*/
TAG: EASY SOLUTION , 8086 MICROPROCESSOR, ASSEMBLY LANGUAGE CHAPTER 6 , PROGRAMMING EXERCISE ,
 FUNCTION/PROCEDURE ,ASSEMBLY LANGUAGE PROGRAMMING AND ORGANIZATION OF THE IBM PC - CHAPTER 6 .

Solution:

.MODEL SMALL
.STACK 100H
.CODE

MAIN PROC

    CALL INITIALIZE_FUNC
    TOP:
        CMP CL,10
        JE NEWLINE
        CALL DISPLAY_FUNC
       
        JMP TOP
    NEWLINE:
        CALL NEWLINE_FUNC
        JMP TOP  

    MAIN ENDP        

INITIALIZE_FUNC PROC
 
    MOV BL,80H
    MOV CL,0
    RET
 
    INITIALIZE_FUNC ENDP

DISPLAY_FUNC PROC
 
    INC CL
     
    MOV AH,2
    MOV DL,BL
    INT 21H
    INC BL
     
    CMP BL,0FFH
    JE END_
 
    RET
    END_:
        CALL END_FUNC
        RET
     
    DISPLAY_FUNC ENDP

NEWLINE_FUNC PROC  
 
    MOV AH,2
    MOV DL,0AH
    INT 21H
    MOV DL,0DH
    INT 21H
    MOV CL,0
    RET
     
    NEWLINE_FUNC ENDP

END_FUNC PROC  
 
    MOV AH,4CH
    INT 21H
    RET
 
    END_FUNC ENDP

END MAIN

No comments:

Post a Comment