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