Skip to content

Commit

Permalink
Console now clears on each move
Browse files Browse the repository at this point in the history
  • Loading branch information
QFSW committed Jul 11, 2019
1 parent 796634a commit 59c1e1f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions 2048x86_64.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
<MASM Include="src\game\pinput.asm" />
<MASM Include="src\game\grid\printgrid.asm" />
<MASM Include="src\game\grid\rotategrid.asm" />
<MASM Include="src\libs\io\csclr.asm" />
<MASM Include="src\libs\io\printdp.asm" />
<MASM Include="src\libs\io\readl.asm" />
<MASM Include="src\libs\math\logn.asm" />
Expand Down
3 changes: 3 additions & 0 deletions 2048x86_64.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,8 @@
<MASM Include="src\game\grid\gameover\checknumadj.asm">
<Filter>Source Files</Filter>
</MASM>
<MASM Include="src\libs\io\csclr.asm">
<Filter>Source Files</Filter>
</MASM>
</ItemGroup>
</Project>
4 changes: 3 additions & 1 deletion src/game/game_main.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PUBLIC game_main
EXTERN checkgrid:PROC
EXTERN printgrid:PROC, initgrid:PROC, mergegrid:PROC, rotategridn:PROC
EXTERN addnum:PROC
EXTERN print:PROC, readl:PROC
EXTERN print:PROC, readl:PROC, csclr:PROC
EXTERN pinput:PROC
EXTERN rseedt:PROC

Expand Down Expand Up @@ -69,6 +69,8 @@ legalmoveskp:
CALL rotategridn

gameoverchk:
CALL csclr

LEA RCX, grid
MOV RDX, GRID_WIDTH
MOV R8, GRID_SIZE
Expand Down
15 changes: 15 additions & 0 deletions src/libs/io/csclr.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
PUBLIC csclr
EXTERN system:PROC

.data
clrstr db "@cls||clear", 0

.code
; clears the console
csclr PROC
LEA RCX, clrstr
CALL system
RET
csclr ENDP

END

0 comments on commit 59c1e1f

Please sign in to comment.