Advertisement
rootUser

Rotating_A.asm

Feb 7th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CODE SEGMENT
  2.     ASSUME CS:CODE,DS:CODE,ES:CODE,SS:CODE
  3.    
  4.     PPIC_Control EQU 1EH
  5.     PPIC EQU 1CH
  6.     PPIB EQU 1AH
  7.     PPIA EQU 18H
  8.    
  9.     ORG 1000H
  10.     MOV AL, 10000000B
  11.     OUT PPIC_Control, AL
  12.    
  13.     MOV AL, 11111111B
  14.     OUT PPIA, AL
  15.    
  16.     MOV BL, 1H
  17. L1: MOV AH, BL
  18.     CALL MANY_TIMES_A
  19.     CLC
  20.     ROR BL, 1
  21.     JMP L1
  22.    
  23. ; Displays the letter 'A' 50 times, so ensure that 'A' is displayed
  24. ; for a long time at a fixed position before rotating it to the left
  25. ; --------- Calling this procedure destroys AH, maintains CX
  26. MANY_TIMES_A:
  27.     PUSH CX
  28.     MOV CX, 50 ; Show this letter 50 times
  29. MTA_L: CALL DISPLAY_A
  30.     LOOP MTA_L
  31.     POP CX
  32.     RET
  33.     ;
  34.  
  35.    
  36. ; Displays 'A' once at a position
  37. ; --------- Calling this procedure destroys AH, maintains CX
  38. DISPLAY_A:
  39.     PUSH CX
  40.     MOV SI, OFFSET FONT
  41.     MOV CX, 08H
  42. DISPLOOP: MOV AL, BYTE PTR CS:[SI]
  43.     OUT PPIB, AL    
  44.     MOV AL, AH
  45.     OUT PPIC, AL
  46.     CALL TIMER
  47.     INC SI
  48.     CLC
  49.     ROL AH, 1
  50.     LOOP DISPLOOP
  51.     POP CX
  52.     RET
  53.     ;
  54.  
  55.  
  56. TIMER:  PUSH CX
  57.         MOV CX, 300
  58.  
  59. TIMER1: NOP
  60.         NOP
  61.         NOP
  62.         NOP
  63.         LOOP TIMER1
  64.         POP CX
  65.         RET
  66.         ;
  67.  
  68.  
  69. FONT:   DB 11111111B
  70.         DB 11000000B
  71.         DB 10110111B
  72.         DB 01110111B
  73.         DB 01110111B
  74.         DB 10110111B
  75.         DB 11000000B
  76.         DB 11111111B
  77.         ;
  78.  
  79. CODE ENDS
  80. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement