home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / assemblr / library / screen / video / viddemo1.asm < prev    next >
Assembly Source File  |  1988-12-22  |  17KB  |  593 lines

  1. TITLE 'Video Demo Program'
  2.  
  3. ;
  4. ; This is a short program to demonstrate the VIDEO.ASM TASM Assembler module.
  5. ; You may use VIDDEMO.MAK to automate the assembly of this program.  It is
  6. ; only designed to work in a 80x25 mode. (Video Modes 2, 3, & 7)
  7. ;
  8. ; All lines that make use of VIDEO.ASM routines or VIDEO.INC equates have
  9. ; been marked with ($) so you can scan through this file and see how to
  10. ; use the routine fairly easily.
  11. ;
  12. ; -- Dave
  13. ;v1.1, 22 Dec 88  Toad Hall Tweak
  14. ; -    Rewritten for MASM (early versions, tho tested with v5.0)
  15. ; -    Rewritten for .COM file format rather than .EXE
  16. ; -    Reformatted to more conventional assembler source format.
  17. ; -    Slightly tightened and tweaked.
  18. ; -    VIDEO1.ASM and VIDEO1.INC are now INCLUDEd files.
  19. ;    No more separate compilation.
  20. ; -    No significant functional changes.
  21. ;David Kirschbaum
  22. ;Toad Hall
  23. ;kirsch@braggvax.ARPA
  24.  
  25.     INCLUDE VIDEO1.INC    ; Global declarations for VIDEO1.ASM
  26. ; ------
  27. ; Macros
  28. ; ------
  29.  
  30. ;MACRO    Pause    Seconds
  31. Pause    macro    seconds
  32.     LOCAL PauseLoop, KeyFound
  33. ;
  34. ; This macro will pause until a key is pressed.
  35. ;
  36. ; Uses:
  37. ;    KeyPressed, ClearKBD
  38. ;
  39.     push    ax        ; Save regs
  40.     push    cx
  41. IFNB <Seconds>
  42.     mov    cx, (Seconds*18)+(Seconds/5)    ; 5 is recip of .2!
  43. ELSE
  44.     mov    cx, 91        ; 5 Seconds
  45. ENDIF
  46. PauseLoop:
  47.     call    KeyPressed    ; check for pressed key
  48.     or    al, al        ; Sets the zero flag if null
  49.     jnz    KeyFound    ; loop until key is pressed
  50.      call    Delay        ; Delay for .055 of a second
  51.      loop    PauseLoop
  52. KeyFound:
  53.     call    ClearKBD    ; Clear the key
  54.     pop    cx        ; Restore registers
  55.     pop    ax
  56. ENDM
  57.  
  58. ; ---------------
  59. ; Program Equates
  60. ; ---------------
  61.  
  62. Version        EQU    '1.0'
  63. Date        EQU    '11/9/88'
  64.  
  65. MAXROWS        EQU    25        ; Maximum rows
  66. CENTERROW    EQU    (MAXROWS/2)    ; Center row
  67. MAXCOLS        EQU    80        ; Maximum columns
  68. CENTERCOL    EQU    (MAXCOLS/2)    ; Center column
  69. FILLROWS    EQU    5        ; Number of rows for fill demo
  70. FILLCOLS    EQU    20        ; Number of cols for fill demo
  71.  
  72. ; -------------
  73. ; Stack Segment
  74. ; -------------
  75. ;v1.1 no stack segment, making this a .COM file
  76. ;STACK    7FFFh        ; 32k Stack (Much more than enough)
  77.  
  78. CSeg    segment public para 'CODE'
  79.     ASSUME    CS:CSeg, DS:CSeg, ES:CSeg, SS:CSeg
  80.     org    100H
  81.  
  82. VidDemo1    proc    near
  83.     jmp    Start        ;jump over data, VIDEO            v1.1
  84.  
  85.     INCLUDE VIDEO1.ASM    ;actual video routines            v1.1
  86.  
  87. ;v1.1 no more data segment
  88. ; -------------
  89. ; Data Segment
  90. ; -------------
  91.  
  92. ; NOTE: Program relies on data being in current order.  Do not reorder, delete
  93. ;    or insert new data into the list.  Data can be appended to this segment
  94. ;    definition.
  95.  
  96. ;DATASEG
  97.  
  98. Title1        DB 'VIDEO.ASM - Direct Screen Writing Routines', 0
  99. T1LEN        EQU    $-Title1
  100.  
  101. Title2        DB 'Author: Dave Bennett / CompuServe 74635,1671', 0
  102. T2LEN        EQU    $-Title2
  103.  
  104. Title3        DB 'Version ', Version, ' - Date: ', Date, 0
  105. T3LEN        EQU    $-Title3
  106.  
  107. Title4        DB 'Features:', 0
  108. Title5        DB ' - Video mode detection', 0
  109. Title6        DB ' - Monochrome/CGA/EGA support', 0
  110. Title7        DB ' - Snow suppression', 0
  111. Title8        DB ' - Direct character & string writing', 0
  112. Title9        DB ' - Screen saving & restoring', 0
  113. Title10        DB ' - Area fills (character, attribute, and both)', 0
  114. Title11        DB ' - Cursor on & off control', 0
  115. Title12        DB ' - All commands w/ or w/o attribute changes',0
  116.  
  117. Msg        DB 'Direct Screen Writing is Fast!!!', 0
  118. MSGLEN        EQU    $-Msg
  119.  
  120. SaveMsg        DB ' Screen has been saved... ', 0
  121. SMSGLEN        EQU    $-SaveMsg
  122.  
  123. CharMsg1    DB ' Character ', 0
  124. CharMsg2    DB ' Writing!! ', 0
  125.  
  126. Wheel        DB 179, '/-\', 179, '/-\'  ; Wheel Chars
  127. MAXWHEEL    EQU    $-Wheel    ;-1)    ; Maximum Wheel offset
  128.  
  129. FillMsg1    DB '-AREA-', 0
  130. FillMsg2    DB '-FILL-', 0
  131.  
  132. RestoreMsg    DB ' Here''s your saved screen image! ', 0
  133. RMSGLEN        EQU    $-RestoreMsg
  134.  
  135. VidModErr    DB 'Invalid Video Mode!', 0Dh, 0Ah, '$'
  136.  
  137. RDir        DB 0            ; Row Direction
  138. CDir        DB 0            ; Col Direction
  139.  
  140. VidDemo1    endp
  141.  
  142. ; --------------------------
  143. ; Uninitialized Data Segment
  144. ; --------------------------
  145. ;v1.1 moved to code end
  146.  
  147. ; ------------
  148. ; Code Segment
  149. ; ------------
  150.  
  151. ;CODESEG
  152.  
  153. Start    proc    near        ;v1.1
  154. ;    mov    ax, @data    ; Set the
  155. ;    mov    ds, ax        ;   Data segment
  156.     call    GetVideoMode    ; Get vid mode data.  MUST BE CALLED FIRST ($)
  157.  
  158.     cmp    VideoMode, BW80    ; ($)
  159.     je    VideoMode_OK        ; Video Mode BW80 is ok
  160.     cmp    VideoMode, CO80    ; ($)
  161.     je    VideoMode_OK        ; Video Mode CO80 is ok
  162.     cmp    VideoMode, Mono    ; ($)
  163.     je    VideoMode_OK        ; Monochrome is ok
  164.  
  165.     mov    dx, OFFSET VidModErr    ; All other modes are unacceptable
  166.     mov    ah, 09            ; DOS print string func
  167.     int    21h            ; Call DOS
  168.     jmp    ErrExit            ; Exit the program
  169.  
  170.     VideoMode_OK:
  171. ;    mov    SnowCheck,0    ; No Snow Checking! ($)
  172.     call    CursorOff    ; Turn the cursor off ($)
  173.  
  174. ; ------------
  175. ; Title Screen
  176. ; ------------
  177.  
  178.     call    ClrScr            ; Clear the screen
  179.     mov    si,OFFSET Title1    ; First Message
  180.     mov    bh, Normal        ; Gray on Black ($)
  181.     mov    ax,(1 SHL 8)+(CENTERCOL-(T1LEN/2))    ;start at top row,
  182.                     ;center the msg            v1.1
  183.     call    DWriteStr        ; Write without attribute ($)
  184.     inc    ah            ; Double
  185.     inc    ah            ;   Space
  186.     mov    al, (CENTERCOL-(T2LEN/2))    ; Center Title Msg 2
  187.  
  188. ; NOTE: SI Already points to Title2 (See DATASEG)
  189.  
  190.     call    DWriteStr        ; Write the string to the scr ($)
  191.     inc    ah            ; Single Space
  192.     mov    al, (CENTERCOL-(T3LEN/2))    ; Center title Msg 3
  193.     call    DWriteStr        ; Write string to scr ($)
  194.     inc    ah            ; Double
  195.     inc    ah            ;   Space
  196.     mov    al, (CENTERCOL-(T1LEN/2)) ; Align with first row
  197.     call    DWriteStr        ; Write str to scr ($)
  198.     inc    ah            ; Double
  199.     inc    ah            ;   Space
  200.     inc    al            ; Indent
  201.     inc    al            ;   2 Spaces
  202.     mov    cx, 8            ; 8 Feature lines
  203. TS_Features:
  204.     call    DWriteStr        ; Write a feature ($)
  205.     inc    ah            ; Double
  206.     inc    ah            ;   Space
  207.     loop    TS_Features        ; Loop for all feature lines
  208.  
  209.     Pause    10            ; Wait for a pressed key (10 seconds)
  210.  
  211. ;---------------
  212. ; DFillAttr Demo
  213. ; --------------
  214.  
  215.     cmp    VideoMode, Mono        ; This code is'nt suited for mono ($)
  216.     je    DWN_Begin        ; So goto DWriteStNA demo if mono
  217.  
  218.     mov    ax, 0101h        ; First row/First column
  219.     mov    bx,(MAXROWS SHL 8)+MAXCOLS    ;all rows, all cols    v1.1
  220.     mov    dh, 1            ; Initialize attribute
  221.  
  222. DDFA_Top:
  223.     and    dh, 00001111b        ; Clear all but foreground
  224.     or    dh,dh            ;check for no attribute        v1.1
  225.     jne    DDFA_Fill        ; Go ahead if attribute
  226.      inc    dh            ; Make sure theres and attr
  227. DDFA_Fill:
  228.     call    DFillAttr        ; Fill screen with attribute ($)
  229.     call    Delay            ; Delay for .055 of a second
  230.     inc    dh            ; Next Attribute
  231.     push    ax            ; Store row/col info
  232.     call    KeyPressed        ; Check for a key
  233.     or    al, al            ; Sets zero flag if no char
  234.     pop    ax            ; Restore row/col info
  235.     jz    DDFA_Top        ; If no key the loop
  236.     call    ClearKBD        ; Clear key(s) from buffer
  237.  
  238. ;-----------------
  239. ; DWriteStrNA Demo
  240. ; ----------------
  241.  
  242. DWN_Begin:
  243.     call    ClrScr        ; Clear the screen
  244.     xor    ax,ax        ;Initialize row/col            v1.1
  245.     mov    bh, Normal    ; Initialize Attribute ($)
  246.  
  247. DWN_MoveMsg:
  248.     mov    si, OFFSET Msg  ; Point to Msg
  249.     test    RDir,1        ; Check the direction
  250.     jz    DWN_RInc    ; If direction is right then goto RInc
  251.  
  252.     dec    ah        ; Decrement the row
  253.     cmp    ah, 1        ; Check to see if row eq 1
  254.     jne    DWN_CheckCol    ;   If not then check columns
  255.     inc    RDir        ; Change the direction
  256.     jmp    short DWN_CheckCol    ; Check columns
  257.  
  258. DWN_RInc:
  259.     inc    ah        ; Increment the row
  260.     cmp    ah, MAXROWS    ; Check to see if row eq MAXROWS
  261.     jne    DWN_CheckCol    ;   If not then check columns
  262.      inc    RDir        ; Change the row-wise direction
  263. DWN_CheckCol:
  264.     test    CDir, 1        ; Check column wise direction
  265.     jz    DWN_CInc    ; If direction is down then goto CInt
  266.     dec    al        ; Decrement the row (Go up)
  267.     cmp    al, 1        ; Check to see if this is column one
  268.     jne    DWN_WriteIt    ;   If not then check attr
  269.     inc    CDir        ; Change the direction
  270.     jmp    short DWN_WriteIt    ; Check the attr
  271.  
  272. DWN_CInc:
  273.     inc    al        ; Increment the row
  274.     cmp    al, (MAXCOLS-MSGLEN) ; Check to see if row eq MAXCOLS
  275.     jne    DWN_WriteIt    ;        If not then check attr
  276.      inc    CDir        ; Change the column-wise direction
  277. DWN_WriteIt:
  278.     call    DWriteStrNA    ; Write the str on scr w/o attr change ($)
  279.     push    ax        ; Store ax reg
  280.     call    KeyPressed    ; Check to see if a key has been pressed
  281.     or    al, al        ; Does AL eq zero?
  282.     pop    ax        ; Restore registers
  283.     jz    DWN_MoveMsg    ; if Yes then Redisplay message
  284.     call    ClearKBD    ; Clear the keyboard
  285.  
  286. ; --------------
  287. ; DWriteStr Demo
  288. ; --------------
  289.  
  290.     cmp    VideoMode, Mono    ; Demo not well suited for mono ($)
  291.     je    STM_Begin    ; so goto StoreToMem demo if mono
  292.  
  293. DW_MoveMsg:
  294.     mov    si, OFFSET Msg  ; Point to Msg
  295.     test    RDir,1        ; Check the direction
  296.     jz    DW_RInc        ; If direction is right then goto RInc
  297.  
  298.     dec    ah        ; Decrement the row
  299.     cmp    ah, 1        ; Check to see if row eq 1
  300.     jne    DW_CheckCol    ;   If not then check columns
  301.      inc    RDir        ; Change the direction
  302.      jmp    short DW_CheckCol    ; Check columns
  303.  
  304. DW_RInc:
  305.     inc    ah        ; Increment the row
  306.     cmp    ah, MAXROWS    ; Check to see if row eq MAXROWS
  307.     jne    DW_CheckCol    ;   If not then check columns
  308.      inc    RDir        ; Change the row-wise direction
  309. DW_CheckCol:
  310.     test    CDir,1        ; Check column wise direction
  311.     jz    DW_CInc        ; If direction is down then goto CInt
  312.     dec    al        ; Decrement the row (Go up)
  313.     cmp    al, 1        ; Check to see if this is column one
  314.     jne    DW_CheckAttr    ;   If not then check attr
  315.     inc    CDir        ; Change the direction
  316.     jmp    short DW_CheckAttr    ; Check the attr
  317.  
  318. DW_CInc:
  319.     inc    al        ; Increment the row
  320.     cmp    al, (MAXCOLS - MSGLEN) ; Check to see if row eq MAXCOLS
  321.     jne    DW_CheckAttr     ;         If not then check attr
  322.      inc    CDir        ; Change the column-wise direction
  323. DW_CheckAttr:
  324.     inc    bh        ; Increment the attribute
  325.     test    bh, Blink    ; Test to see if blink bit is on
  326.     jz    DW_WriteIt    ; If not then skip to WriteIt
  327.      mov    bh, 1        ; Set BH eq 1
  328. DW_WriteIt:
  329.     call    DWriteStr    ; Write the string on the screen ($)
  330.     push    ax        ; Store ax reg
  331.     call    KeyPressed    ; Check to see if a key has been pressed
  332.     or    al, al        ; Does AL eq zero?
  333.     pop    ax        ; Restore registers
  334.     jz    DW_MoveMsg    ; if Yes then Redisplay message
  335.     call    ClearKBD    ; Clear the keyboard
  336.  
  337. ; ----------------------------------------------------------
  338. ; Move current screen image to save area (StoreToMem - Demo)
  339. ; ----------------------------------------------------------
  340.  
  341. STM_Begin:
  342. ;    mov    ax, @data    ; Place data segment into AX
  343. ;    mov    es, ax        ; segment for saved image area
  344.     mov    ax,CS
  345.     mov    ES,ax        ;v1.1
  346.  
  347. ; This might be a good place for some stack checking code. (hint hint)
  348.  
  349.     mov    di, OFFSET SaveScr    ; offset to saved image area (See Stack)
  350.     mov    ax, 0101h    ; Row 1 / Col 1
  351.     mov    bx,(MAXROWS SHL 8)+MAXCOLS    ;capture all rows & cols v1.1
  352.     call    StoreToMem    ; Save the screen to memory ($)
  353.  
  354. ; Note: SI Already points to SaveMsg (See DATASEG)
  355.  
  356.     mov    ax,(CENTERROW SHL 8)+(CENTERCOL-(SMSGLEN/2))    ;center msg v1.1
  357.     mov    bh, Reverse+Blink ; Reverse attr (Black on White) & Blink ($)
  358.     call    DWriteStr    ; Display the string! ($)
  359.  
  360.     Pause    10        ; Macro to pause for 10 seconds
  361.  
  362. ; -------------
  363. ; DWriteCH Demo
  364. ; -------------
  365.  
  366. CHARMSG1COL    =    24
  367. CHARMSG2COL    =    48
  368. ROWSTART    =    1    ; Row to start in
  369. COLSTART    =    6    ; Column to start in
  370.  
  371. ; Note: SI already points to CharMsg1 (See DATASEG)
  372.  
  373.     call    ClrScr            ; Clear the screen
  374.     mov    bh, (Brown*10h+Blue)    ; Blue on Brown (Also ul mono) ($)
  375.     mov    ax,(CENTERROW SHL 8)+CHARMSG1COL    ;AH = middle row of scr
  376.                     ;AL=column for first msg    v1.1
  377.     call    DWriteStr        ; Write the first string ($)
  378.  
  379. ; Note: SI now points to CharMsg2 (See DATASEG)
  380.  
  381.     mov    al, CHARMSG2COL        ; Column for second msg
  382.     call    DWriteStr        ; Write the second string ($)
  383.  
  384.     mov    ax,(ROWSTART SHL 8)+COLSTART    ;start row & col    v1.1
  385.     mov    bh, White        ; White on black ($)
  386.     mov    cx, 1            ; One Character
  387.     mov    si, OFFSET Wheel    ; Offset of wheel characters
  388. DWC_Top:
  389.     mov    bl,[si]            ; Load character into bl
  390. DWC_WriteIt:
  391.     call    DWriteCH        ; Write the character ($)
  392.     inc    ah            ; Next row
  393.     inc    al            ; Next column
  394.     cmp    ah, MAXROWS        ; Check AH against Maximum rows
  395.     jle    DWC_CheckCol        ; If less then then Check columns
  396.      mov    ah, 1            ; Reset row
  397. DWC_CheckCol:
  398.     cmp    al, MAXCOLS        ; Check AL agains max cols
  399.     jle    DWC_WriteIt        ; If less than max cols then write
  400.     mov    ax,(ROWSTART SHL 8)+COLSTART    ;reset row, col        v1.1
  401. ;    call    Delay            ; Wait 1 / 18.2 of a second
  402.     inc    si            ; Point to next character in wheel
  403.     cmp    si, (OFFSET Wheel + MAXWHEEL)    ; Maximum offset of Wheel
  404.     jle    DWC_Top
  405. DWC_InKey:
  406.     push    ax        ; Store row/col info
  407.     call    KeyPressed    ; Check to see if a key has been pressed
  408.     or    al, al        ; Sets zero flag if al eq 0
  409.     pop    ax        ; Restore row/col info
  410.     jnz    DWC_End        ; If a key has been press (not null) then end
  411.     mov    si, OFFSET Wheel ; Set SI to offset zero of wheel
  412.     jmp    DWC_Top        ; If zero flag set then loop
  413.  
  414. DWC_End:
  415.     call    ClearKBD    ; Clear the keyboard
  416.  
  417. ; ------------
  418. ; DFillCH Demo
  419. ; ------------
  420.  
  421. FILLMSGCOL    =    36    ; Fill Msgs in column 25
  422. FILLMSG1ROW    =    3    ; Message one in row 3
  423. FILLMSG2ROW    =    20    ; Message two in row 20
  424. FILLWID        =    15    ; Width of fill
  425. FILLHT        =    4    ; Fill Height
  426. RINC        =    2    ; Row Increment
  427. CINC        =    7    ; Column Increment
  428.  
  429.     call    ClrScr        ; Clear the screen
  430.     mov    ax,(FILLMSG1ROW SHL 8)+FILLMSGCOL    ;AH=row for first msg,
  431.                 ;AL=col for the msg            v1.1
  432.     mov    bh, LightBlue+Blink ; LightBlue on Black w/ Blink (ul mono) ($)
  433.  
  434. ; NOTE: SI Points to first msg already
  435.  
  436.     call    DWriteStr    ; Write the first message (SI points to 2nd) ($)
  437.     mov    ah, FILLMSG2ROW ; Row for the second message
  438.     call    DWriteStr    ; Write the second message to the screen ($)
  439.  
  440.     mov    ax, 0101h    ; Top row / Left Col
  441.     mov    bx,(FILLHT SHL 8)+FILLWID    ;BH=nr of rows,
  442.                 ;BL=nr of cols                v1.1
  443.     xor    dh,dh        ;Initialize attr            v1.1
  444.  
  445. DFCH_Top:
  446.     inc    dh        ; Increment dh
  447.     mov    dl, dh        ; Move attribute to character
  448.     call    DFillCh        ; Do the fill ($)
  449.     add    ah, RINC    ; Increment rows
  450.     add    al, CINC    ; Increment columns
  451.     cmp    ah, (MAXROWS-FILLHT)    ; compare ah to max rows - fill ht
  452. ;    jle    DFCH_CheckCol    ; If less than or equal to then check columns
  453. ;    jmp    DFCH_SecPart    ; Goto the second part
  454.     jnle    DFCH_SecPart    ;TH
  455.  
  456. DFCH_CheckCol:
  457.     cmp    al, (MAXCOLS-FILLWID)    ; compare al to max cols - fill width
  458.     jle    DFCH_Top        ; Jump to the top if in bounds
  459. DFCH_SecPart:
  460.     xor    dh,dh        ;init the attrib            v1.1
  461.     mov    ax,(1 SHL 8) + (MAXCOLS-FILLWID)    ;AH=top row,
  462.                 ;AL=right side                v1.1
  463.  
  464. DFCH_Top2:
  465.     inc    dh        ; Increment dh
  466.     mov    dl, dh        ; Move attribute to character
  467.     call    DFillCh        ; Do the fill
  468.     add    ah, RINC    ; Increment rows
  469.     sub    al, CINC     ; Decrement columns
  470.     cmp    ah, (MAXROWS-FILLHT)    ; compare ah to max rows - fill ht
  471. ;    jle    DFCH_CheckCol2  ; If less than or equal to then check columns
  472. ;    jmp    DFCH_Pause    ; Goto the pause routine
  473.     jnle    DFCH_Pause    ;TH
  474.  
  475. DFCH_CheckCol2:
  476.     cmp    al, 1        ; compare al to 1 (First column)
  477.     jg    DFCH_Top2    ; Jump to the top if in bounds
  478. DFCH_Pause:
  479.     Pause    10        ; Macro to pause 10 seconds
  480.  
  481. ; ---------------
  482. ; StoreToScr Demo
  483. ; ---------------
  484.  
  485.     mov    ax, 0101h    ; First row & col
  486.     mov    bx,(MAXROWS SHL 8)+MAXCOLS    ;all rows, all cols    v1.1
  487.     mov    si, OFFSET SaveScr ; Point to area where screen was saved
  488.     call    StoreToScr    ; Restore the saved screen ($)
  489.  
  490.     mov    si, OFFSET RestoreMsg ; Point to restore screen message
  491.     mov    ax,(CENTERROW SHL 8)+(CENTERCOL-(RMSGLEN/2))
  492.                 ;AH=center of screen,
  493.                 ;AL=center the msg            v1.1
  494.     mov    bh, Reverse+Blink ; Reverse attr (Black on White) & Blink ($)
  495.     call    DWriteStr    ; Display the string! ($)
  496.  
  497.     Pause    10         ; Macro - Pause for 10 secs or until key press
  498.  
  499. Exit:
  500.     call    ClrScr        ; Clean up the display
  501. ErrExit:
  502.     call    CursorOn    ; Turn the cursor on ($)
  503.     mov    ah, 4Ch        ; DOS exit function
  504.     int    21h        ; Call DOS to exit
  505. Start    endp
  506.  
  507. ; -------------------
  508. ; Programs Procedures
  509. ; -------------------
  510.  
  511. ClrScr    proc    near
  512. ;
  513. ; This procedure Clears the screen using VIDEO.ASM
  514. ;
  515.     push    ax        ; Store registers
  516.     push    bx
  517.     push    dx
  518.     mov    ax, 0101h    ; First row & col
  519.     mov    bx,(MAXROWS SHL 8)+MAXCOLS    ;all rows,all cols v1.1
  520.     mov    dx,(NORMAL SHL 8)+' '    ;DH=attr (Grey on Black)($)
  521.                 ;DL=fill scr with spaces    v1.1
  522.     call    DFillCH        ; Do it! ($)
  523.     pop    dx        ; Restore registers
  524.     pop    bx
  525.     pop    ax
  526.     ret
  527.  
  528. ClrScr    endp
  529.  
  530. KeyPressed    proc    near
  531. ;
  532. ; This procedure uses DOS to check if a key has been pressed.
  533. ;
  534. ; Output
  535. ;    AL = FFh/0  Yes/No
  536. ; Modifies
  537. ;    AX
  538. ;
  539.     mov    ah, 0Bh        ; DOS func 0Bh (Check for pressed key)
  540.     int    21h        ; Call DOS
  541.     xor    ah, ah        ; Clear AH reg
  542.     ret
  543.  
  544. KeyPressed    endp
  545.  
  546. ClearKBD    proc    near
  547. ;
  548. ; This procedure uses DOS to clear the keyboard buffer.
  549. ;
  550.     push    ax        ; Store AX reg
  551.     mov    ax, 0C00h    ; Dos func 0Ch = Clear KBD
  552.     int    21h        ; Call DOS
  553.     pop    ax        ; Restore AX
  554.     ret
  555.  
  556. ClearKBD    endp
  557.  
  558. Delay    proc    near
  559. ;
  560. ; This procedure delays the CPU for about 1 timer tick or 1/18.2 of
  561. ; of a second.
  562. ;
  563.     push    ax
  564.     push    cx
  565.     push    dx
  566.     xor    ah,ah        ;Int 1A GetTime function    v1.1
  567.     int    01ah        ; Call timer interrupt
  568.     mov    word ptr LowTick, dx    ; DX returns low timer tick value
  569. DelayLoop:
  570.     xor    ah,ah        ;Int 1A GetTime function    v1.1
  571.     int    01ah        ; Call timer interrupt
  572.     cmp    dx,word ptr LowTick    ; Compare current val to first
  573.     je    DelayLoop    ; If still the same then loop
  574.     pop    dx
  575.     pop    cx
  576.     pop    ax
  577.     ret
  578.  
  579. Delay    endp
  580.  
  581. ; --------------------------
  582. ; Uninitialized Data Segment
  583. ; --------------------------
  584. ;v1.1 moved to code end
  585. ;UDATASEG
  586.  
  587. LowTick    =    $                ; Tick holder for Delay routine
  588. SaveScr    =    $+2    ;DB 4000 dup (?)    ; Screen Save Area
  589.  
  590.  
  591. CSeg    ENDS
  592.     end    VidDemo1
  593.