Skip to content

Commit

Permalink
Fix: flickering on screen redraw
Browse files Browse the repository at this point in the history
Don't clear screen, just draw new cells on top of old
  • Loading branch information
NikitaIvanovV committed Feb 13, 2022
1 parent cbb239d commit 6b609ce
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions snake.asm
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@

section .data

%assign SCREEN_Y SIZE_Y+2
%assign SCREEN_Y SIZE_Y+1
%defstr SCREEN_Y_STR SCREEN_Y

; ANSI escape seqences
Expand Down Expand Up @@ -245,8 +245,6 @@ draw_map:
push rbx
push r11

PRINT_BUF_APPEND text_controls

mov bh, 0 ; x counter
mov bl, 0 ; y counter
mov r11, 0 ; map cell
Expand Down Expand Up @@ -285,7 +283,6 @@ draw_map:

clear_screen:
PRINT_BUF_APPEND cur_reset_seq
PRINT_BUF_APPEND clear_seq
ret

move_snake:
Expand Down Expand Up @@ -415,8 +412,8 @@ update_state:
ret

update:
call clear_screen
call move_snake
call clear_screen
call draw_map

inc qword [frame]
Expand Down Expand Up @@ -514,7 +511,9 @@ init:

call set_noncanon

PRINT_STR_DATA cur_home_seq
PRINT_BUF_APPEND cur_home_seq
PRINT_BUF_APPEND clear_seq
PRINT_BUF_APPEND text_controls

ret

Expand Down

0 comments on commit 6b609ce

Please sign in to comment.