-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.asm
More file actions
105 lines (87 loc) · 1.97 KB
/
Copy pathmain.asm
File metadata and controls
105 lines (87 loc) · 1.97 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
CR .EQU 0DH
LF .EQU 0AH
oldStackPointer .EQU 89F0H ;Old Stack Location
originalBC .EQU 89F2H ;BC before manipulation, used for calculating board position
.ORG 9000H
ld (oldStackPointer), SP
ld sp,0FFFFH
gameTop:
CALL initMap
LD HL, cls ;Clear screen
CALL print
LD HL, hideCursor ;Hide Cursor
CALL print
CALL printMap
JP displayTitleScreen
startGame:
CALL initPacman
CALL initGhost
CALL initMap
LD HL, cls ;Clear screen
CALL print
CALL printMap
CALL countdown
LD HL, home ;Go home
CALL print
CALL printMap
gameLoop:
call input
call getMove
call clearPM
call movePM
call printPM
call eatPellet
call initPathFind
call calculatePathMap
call ghostNextMove
call clearGhost
call colideGhost
call moveGhost
call printGhost
call colideGhost
;call printPFMap
call printHUD
call newline
call checkNextLevel
call checkFruit
LD B,0FH ;delay
LD C,0FFH
CALL DELAY
JP gameLoop
LD SP,(oldStackPointer)
ret
quit: LD HL, showCursor ;Hide Cursor
CALL print
LD SP,(oldStackPointer)
RET
;-------------- Input --------------------------
include input.asm
;----------Pacman------;
include pacman.asm
;------------Ghost
include ghosts.asm
;-----------Spesific Libs -----;
include movelibs.asm
include mapLibs.asm
;------HUD;
include hud.asm
include countdown.asm
include titlescreen.asm
include gameOver.asm
;------- Libs ------------;
include libs.asm
;Strings
wall: .BYTE 1BH,"[34m#",1BH,"[0m",0
powerPellet: .BYTE 1BH,"[97mo",1BH,"[0m",0
pellet: .BYTE 1BH,"[37m*",1BH,"[0m",0
superFruit: .BYTE 1BH,"[31m@",1BH,"[0m",0
void: .BYTE " ",0
home: .BYTE 1BH,"[H",0
cls: .BYTE 1BH,"[H",1BH,"[2J",0
hideCursor: .BYTE 1BH,"[?25l",0
showCursor: .BYTE 1BH,"[?25h",0
;----- Map ------
include map.asm
;-----Path find map
pathFindMap .EQU 0D000H
liveMap .EQU 0E000H