home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
games
/
gags_1.zip
/
CRMBL.8
< prev
next >
Wrap
Text File
|
1987-05-12
|
3KB
|
82 lines
Colormem equ 0B800h ;Color video mem for page 1
Monomem equ 0A300h ;Mon video mem for page 1
Blank equ 20h
jmp Start
Row dw 24 ;Rows to do initially
;First, get current video mode and page.
Start: mov cx,Colormem ;Assume color display
mov ah,15 ;Get current video mode
int 10h
cmp al,2 ;Color?
je A2 ;Yes
cmp al,3 ;Color?
je A2 ;Yes
cmp al,7 ;Mono?
je A1 ;Yes
int 20h ;No,quit
;Come here if 80 col text mode; put video segment in ds.
A1: mov cx,Monomem ;Set for Mono
A2: mov bl,0 ;bx=page offset
add cx,bx ;Video segment
mov ds,cx ;in ds
;Now do crumble.
xor bx,bx ;Start at top left corner
A3: push bx ;Save row start on stack
mov bp,80 ;Reset column counter
;Do next column in a row.
;Give operator a chance to terminate the crumbling.
A4: mov ah,0Bh ;Check if key pressed
int 21h
cmp al,0FFh ;Key pressed?
je A9 ;Yes, quit
;Continue with crumble if no key pressed.
mov si,bx ;Set row top in si
mov ax,w[si] ;Get char & attr from screen
cmp al,Blank ;Is it a blank?
je A7 ;Yes, skip it
mov dx,ax ;No, save it in dx
mov al,Blank ;Make it a space
mov w[si],ax ;and put on screen
add si,160 ;Set for next row
mov di,cs:Row ;Get rows remaining
A5: mov ax,w[si] ;Get the char & attr from screen
mov w[si],dx ;Put top row char & attr there
A6: call Vert ;Wait for 2 vert retraces
mov w[si],ax ;Put original char & attr back
;Do next row, this column.
add si,160 ;Next row
dec di ;Done all rows remaining?
jne A5 ;No, do next one
mov w[si-160],dx ;Put char & attr on line 25 as junk
;Do next column on this row.
A7: add bx,2 ;Next column, same row
dec bp ;Dec column counter; done?
jne A4 ;No, do this column
;Do next row.
A8: pop bx ;Get current row start
add bx,160 ;Next row
dec cs:Row ;All rows done?
jne A3 ;No
A9: int 20h ;Yes, quit to DOS
; Sub to wait for 2 vertical retraces to avoid snow on CGA screen.
Vert: push ax,dx,cx ;Save all registers used
mov cl,2 ;Wait for 2 vert retraces
mov dx,3DAh ;CRT status port
F1: in al,dx ;Read status
test al,8 ;Vert retrace went hi?
je F1 ;No, wait for it
dec cl ;2nd one?
je F3 ;Yes, write during blanking time
F2: in al,dx ;No, get status
test al,8 ;Vert retrace went low?
jne F2 ;No, wait for it
jmp F1 ;Yes, wait for next hi
F3: pop cx,dx,ax ;Restore registers
ret ;and return