Created
November 30, 2012 12:36
-
-
Save tuttlem/4175519 to your computer and use it in GitHub Desktop.
plasma - frame
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
plasma_frame: | |
; jump over the local variables | |
jmp plasma_frame_code | |
temp_phase_1 DB 0 | |
temp_phase_2 DB 0 | |
temp_phase_3 DB 0 | |
temp_phase_4 DB 0 | |
y_loc DW 0 | |
plasma_frame_code: | |
; setup where we'll draw to | |
xor di, di | |
; setup a pointer to our cos table | |
lea si, costab | |
; iterate over every pixel | |
mov cx, 64000 | |
; setup temp state into 3 and 4 | |
mov al, phase_3 | |
mov temp_phase_3, al | |
mov al, phase_4 | |
mov temp_phase_4, al | |
reset_1_and_2: | |
; re-setup temp state into 1 and 2 | |
mov al, phase_1 | |
mov temp_phase_1, al | |
mov al, phase_2 | |
mov temp_phase_2, al | |
; save our overall progress | |
push cx | |
; process the next row of pixels | |
mov cx, 320 | |
plasma_frame_pixel: | |
; calculate the pixel value | |
; col = costab[t1] + costab[t2] + costab[t3] + costab[t4] | |
xor bx, bx | |
mov bl, temp_phase_1 | |
mov al, ds:[si + bx] | |
mov bl, temp_phase_2 | |
add al, ds:[si + bx] | |
adc ah, 0 | |
mov bl, temp_phase_3 | |
add al, ds:[si + bx] | |
adc ah, 0 | |
mov bl, temp_phase_4 | |
add al, ds:[si + bx] | |
adc ah, 0 | |
; draw the pixel | |
mov es:[di], al | |
; adjust counter 1 | |
mov al, temp_phase_1 | |
add al, 2 | |
mov temp_phase_1, al | |
; adjust counter 2 | |
mov al, temp_phase_2 | |
sub al, 1 | |
mov temp_phase_2, al | |
; move onto the next pixel | |
inc di | |
dec cx | |
jnz plasma_frame_pixel | |
; adjust the y location by 1 | |
inc y_loc | |
pop cx | |
; adjust counter 3 | |
mov al, temp_phase_3 | |
add al, 2 | |
mov temp_phase_3, al | |
; adjust counter 4 | |
mov al, temp_phase_4 | |
sub al, 1 | |
mov temp_phase_4, al | |
sub cx, 320 | |
jnz reset_1_and_2 | |
ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment