home *** CD-ROM | disk | FTP | other *** search
- ;; WINDOW.ASM - Super fast direct video windows.
- ;;
- ;; This program can be assembled using the A86 or TASM assemblers
- ;;
- ;; Not tested with Masm, should work?
- ;;
- ;; This code is "PUBLIC DOMAIN"
- ;;
- ;; by William Cravener 11/28/92
- ;;
- ;-----------------------------------------------------------------------------
- ;;
- code SEGMENT
- ASSUME cs:code, ds:code, es:code, ss:code
- ORG 100h ; COM files begin here
- start:
- jmp begin ; go show off
- ;;
- ;-----------------------------------------------------
- ;;
- columns EQU 80 ; dealing with 80 columns
- ;;
- video_seg DW 0 ; video segment
- status_reg DW 0 ; status register
- string_length DW 57 ; string length (can be any length)
- color_to_use DB 0 ; color values
- row DB 6 ; screen row
- column DB 12 ; screen column
- colorflag DB 0 ; equal 1 for snow checking
- ;; ; otherwise it equals 0
- ;;
- window DB '╔═══════════════════════════════════════════════════════╗'
- DB '║ Public Domain by ║'
- DB '║ ▄▄▄▄ ▄ ▄ ▄ ▄▄▄▄ ▄▄▄▄▄ ║'
- DB '║ ──█──────█───█───█─ █ ──█────────── ║'
- DB '║ ─────█▄▄▄───█─█─█─ █ ──█▄▄────█───── ║'
- DB '║ █ █ █ █ █ █ █ ║'
- DB '║ ────────────█─ █ █ ───█───█─── █ - WARE. ║'
- DB '║ ▀▀▀▀ ▀ ▀ ▀ ▀ ▀ ║'
- DB '║ ║'
- DB '║ William Cravener ║'
- DB '║ 520 N. Stateline Rd. ║'
- DB '║ Sharon, Pa. 16146 ║'
- DB '║ CIS: 72230,1306 ║'
- DB '╚═══════════════════════════════════════════════════════╝'
-
- ;;
- ;-----------------------------------------------------
- ;;
- begin:
- call get_video ; get current video state
- mov si, OFFSET window ; point to example
- mov bp, 14 ; write 14 rows total
- boxloop:
- mov dh, row ; current row
- mov dl, column ; and column
- call fast_write ; fast screen writes
- inc row ; increment row
- dec bp ; do 14 rows total
- jnz boxloop ; go write next
- ; all finished
- mov ah, 2 ; set cursor off screen
- mov bh, 0 ; while we -
- mov dx, 1900h
- int 10h
- mov ah, 0 ; wait for user
- int 16h ; to press a key
- int 20h ; yes - exit to DOS
- ;;
- ;;**************************************
- ;; very fast video write
- fast_write:
- push es ; save ES register
- mov ax, video_seg ; current video segment
- mov es, ax ; need it in ES for STOSW
- xor ax, ax ; zero out AX
- xor bx, bx ; zero out BX
- mov al, dh ; place row in AL
- xor dh, dh ; zero out DH
- mov di, dx ; place column in DI
- mov bl, columns ; dealing with 80 columns
- mul bx ; mutiply
- add di, ax ; add to columns
- shl di, 1 ; offset of video memory
- mov cx, string_length ; length of string to write
- mov ah, color_to_use ; color value to use
- string_loop:
- cmp colorflag, 0 ; if = 1 check for retrace
- je noneed ; if = 0 skip to noneed
- mov dx, status_reg ; status register
- cli ; disable interrupts
- @low:
- in al, dx ; get port value
- test al, 1
- jnz @low ; if not zero
- @high:
- in al, dx ; get port value
- test al, 1
- jz @high ; if zero
- sti ; enable interrupts
- noneed:
- lodsb ; get character
- stosw ; store character and color
- loop string_loop ; get all 80 character
- pop es ; restore ES register
- ret
- ;;
- ;;**********************************
- ;; gets video information needed by "fast_write"
- get_video:
- mov ah, 0fh ; BIO's get
- int 10h ; current video mode
- cmp al, 7 ; if 7 its monochrome
- je mono_vid ; go setup for it
- mov video_seg, 0b800h ; must be a color mode
- mov status_reg, 03dah ; segment and status
- mov color_to_use, 15 ; brite white
- jmp video_out ; leave
- mono_vid:
- mov video_seg, 0b000h ; segment
- mov status_reg, 03bah ; status
- mov color_to_use, 15 ; brite white
- video_out:
- ret
- ;;
- ;-------------------------------
- ;; 1 second delay
- delay:
- push es ; save ES
- mov ax, 40h ; BIO's
- mov es, ax ; segment
- mov bx, 6ch ; tick count
- mov ax, es:[bx] ; place in AX
- mov cx, 18 ; about 1 second
- dl1:
- cmp ax, es:[bx] ; are they equal
- je dl1 ; yes
- mov ax, es:[bx] ; no get new count
- loop dl1 ; loop for 18
- pop es ; restore ES
- ret
- ;;
- ;-------------------------------
- ;;
- code ENDS ; end of coding
-
- END start
-
-