-
Notifications
You must be signed in to change notification settings - Fork 1
/
boink.asm
48 lines (35 loc) · 1.39 KB
/
boink.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include includes\keyboard.asm
#include includes\video.asm
#include includes\clock.asm
#include includes\strings.asm
#include includes\ball.asm
#include includes\paddles.asm
#include includes\state-handler.asm
#include includes\data.asm
#ORG 0x080000
CALL .InitializeVideo ; Initialize the video
CALL .InitializeClock ; Initialize the clock time
CALL .InitializeFonts ; Font and static strings setup
; Setup game variables
.ResetGame ; Called when we want to fully reset
CALL .ResetScore
CALL .ResetBallServe
CALL .PrepareNewGame
; Primary Game loop screen
.MainGameScreen
; Update clock routine for frame delta time
CALL .HasUpdateTimePassed ; Updates the clock and also returns whether it passed the target frame time
JR NZ, .MainGameScreen ; We loop back until the allowed timeframe is reached
CALL .Update ; Figure out the state
CALL .Draw ; Render objects from state
CALL .IsUserExiting
JR Z, .ExitProgram
JP .MainGameScreen
.ExitProgram
RET
.PrepareNewGame ; Called between rounds to reset only some variables
; Check scores to see if we have a winner
CALL .CheckForWinners
CALL .SetDefaultPaddlePositions
CALL .InitializeBall
RET