Sunday, 27 March 2016

Keyboard and display controller:Hardware Interfacing(Properly Commented)

Q: Write a ALP to display the word Hello using keyboard and display controller.


Operating System: Fedora -64 bit
Software Used : Minicom



;code for rolling right display
Dyna-86>U 1000                                                                   
0000:1000  MOV AL, 18           ;right entry 16 character                                                
0000:1002  OUT 31, AL                                                           
0000:1004  MOV AL, D3   ;clearing of display ram                                                          
0000:1006  OUT 31, AL                                                           
0000:1008  MOV AL, 90           ;writing of characters                                                
0000:100A  OUT 31, AL                                                           
0000:100C  MOV SI, 2000         ;moving si to location where the character codes are stored                                                 
0000:100F  MOV CL, 10           ;mov 16 in cl for displaying 16 chars                                                
0000:1011  MOV AL, [SI]                                                         
0000:1013  OUT 30, AL           ;display single character                                                 
0000:1015  INC SI                                                               
0000:1016  CALL 3000            ;delay                       
0000:1019  DEC CL                                                               
0000:101B  JNZ 1011                                                             
0000:101D  JMP 100C      

;;below is the code for the display codes


E 2000                                                                  
0000:2000  4E-4E                ;h                                                
0000:2001  BE-BE                ;e                                                
0000:2002  8A-8A                ;l                                                
0000:2003  8A-8A                ;l                                                
0000:2004  FA-FA                ;o                                                
0000:2005  FF-00                ;zeroes after hello                                                
0000:2006  FF-00                                                                
0000:2007  FF-00                                                                
0000:2008  FF-00                                                                
0000:2009  FF-00                                                                
0000:200A  FF-00                                                                
0000:200B  FF-00                                                                
0000:200C  FF-00                                                                
0000:200D  FF-00                                                                
0000:200E  FF-00                                                                
0000:200F  FF-00                                                                
0000:2010  FF-00                                                                
0000:2011  FF-00                                                                
0000:2012  FF-00                                                                
0000:2013  FF-00                                                                
0000:2014  FF-00                                                                
0000:2015  FF-00                                                                
0000:2016  FF-00                                                                
0000:2017  FF-00                                                                
0000:2018  FF-00                                                                
0000:2019  FF-00                                                                
0000:201A  FF-00   


;;code for the delay procedure

Dyna-86>U 3000                ;procedure for delay                                                  
0000:3000  MOV BX, FFFF       ;never use cl here                                                   
0000:3003  DEC BX                                                               
0000:3004  JNZ 3003                                                             
0000:3006  RET 


;code for the blinking and left entry for the word "hello"
Dyna-86>U 6000                                                                  
0000:6000  MOV AL, 08       ;left entry 16 character mode                                                    
0000:6002  OUT 31, AL                                                           
0000:6004  MOV AL, D1       ;clear display ram                       
0000:6006  OUT 31, AL                                                           
0000:6008  MOV AL, 90       ;writing of characters                                                  
0000:600A  OUT 31, AL                                                           
0000:600C  MOV SI, 1FFF     ;if 2000 is used ello will be displayed                                                    
0000:600F  MOV CL, 10       ;so use one location prior to 2000 is 1FFF                                                    
0000:6011  MOV AL, [SI]                                                         
0000:6013  OUT 30, AL                                                           
0000:6015  CALL 3000                                                            
0000:6018  INC SI                                                               
0000:6019  DEC CL                                                               
0000:601B  JNZ 6011                                                             
0000:601D  MOV AL, A3    ;turns the lights off/enable blanking
0000:601F  OUT 31, AL                                                           
0000:6021  CALL 3000                                                            
0000:6024  MOV AL, A0      ;turn the lights on/disable blanking                                                     
0000:6026  OUT 31, AL                                                           
0000:6028  CALL 3000                                                            
0000:602B  JMP 601D                                                             
0000:602D  INT 3

No comments:

Post a Comment