home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 15 / CDACTUAL15.iso / cdactual / program / asm / PJGRAPH.ZIP / CHAP09.4 < prev    next >
Encoding:
Text File  |  1989-09-26  |  2.2 KB  |  83 lines

  1. ; Program to demonstrate screen blanking via bit 5 of the
  2. ; Attribute Controller Index register.
  3. ;
  4. ; Updated 6/29/89.
  5. ;
  6. AC_INDEX        equ     3c0h    ;Attribute Controller Index register
  7. INPUT_STATUS_1  equ     3dah    ;color-mode address of the Input
  8.                                 ; Status 1 register
  9. ;
  10. ; Macro to wait for and clear the next keypress.
  11. ;
  12. WAIT_KEY        macro
  13.         mov     ah,8    ;DOS input without echo function
  14.         int     21h
  15.         endm
  16. ;
  17. stackseg        segment para stack 'STACK'
  18.         db      512 dup (?)
  19. stackseg        ends
  20. ;
  21. Data    segment word 'DATA'
  22. SampleText db   'This is bit-mapped text, drawn in hi-res '
  23.         db      'EGA graphics mode 10h.', 0dh, 0ah, 0ah
  24.         db      'Press any key to blank the screen, then '
  25.         db      'any key to unblank it,', 0dh, 0ah
  26.         db      'then any key to end.$'
  27. Data    ends
  28. ;
  29. Code    segment
  30.         assume  cs:Code, ds:Data
  31. Start   proc    near
  32.         mov     ax,Data
  33.         mov     ds,ax
  34. ;
  35. ; Go to hi-res graphics mode.
  36. ;
  37.         mov     ax,10h  ;AH = 0 means mode set, AL = 10h selects
  38.                         ; hi-res graphics mode
  39.         int     10h     ;BIOS video interrupt
  40. ;
  41. ; Put up some text, so the screen isn't empty.
  42. ;
  43.         mov     ah,9    ;DOS print string function
  44.         mov     dx,offset SampleText
  45.         int     21h
  46. ;
  47.         WAIT_KEY
  48. ;
  49. ; Blank the screen.
  50. ;
  51.         mov     dx,INPUT_STATUS_1
  52.         in      al,dx   ;reset port 3c0h to index (rather than data)
  53.                         ; mode
  54.         mov     dx,AC_INDEX
  55.         sub     al,al   ;make bit 5 zero...
  56.         out     dx,al   ;...which blanks the screen
  57. ;
  58.         WAIT_KEY
  59. ;
  60. ; Unblank the screen.
  61. ;
  62.         mov     dx,INPUT_STATUS_1
  63.         in      al,dx   ;reset port 3c0h to index (rather than data)
  64.                         ; mode
  65.         mov     dx,AC_INDEX
  66.         mov     al,20h  ;make bit 5 one...
  67.         out     dx,al   ;...which unblanks the screen
  68. ;
  69.         WAIT_KEY
  70. ;
  71. ; Restore text mode.
  72. ;
  73.         mov     ax,2
  74.         int     10h
  75. ;
  76. ; Done.
  77. ;
  78. Done:
  79.         mov     ah,4ch  ;DOS terminate function
  80.         int     21h
  81. Start   endp
  82. Code    ends
  83.         end     Start