Created
December 1, 2012 13:18
-
-
Save tuttlem/4182214 to your computer and use it in GitHub Desktop.
snow - generate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
no_kbhit: | |
; put a new snowflake at the top | |
; of the screen | |
call get_random | |
mov di, ax | |
mov byte ptr es:[di], 15 | |
decend: | |
; we can't move snowflakes any further | |
; than the bottom of the screen so we | |
; process all other lines | |
mov di, 63680 | |
mov cx, 63680 | |
next_pixel: | |
; test if there is a snowflake at the | |
; current location | |
mov al, es:[di] | |
cmp al, 0 | |
je no_flake | |
; test if there is a snowflake beneath | |
; us at the moment | |
mov al, es:[di+320] | |
cmp al, 0 | |
jne no_flake | |
; move the snowflake from where we are | |
; at the moment to one line below us | |
xor al, al | |
mov byte ptr es:[di], al | |
mov al, 15 | |
mov byte ptr es:[di+320], 15 | |
no_flake: | |
; move our way through video memory | |
dec di | |
dec cx | |
jnz next_pixel | |
; check for a keypress | |
mov ah, 01h | |
int 16h | |
jz no_kbhit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment