-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmp1.S
108 lines (79 loc) · 2.79 KB
/
mp1.S
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
106
107
108
# mp1.S - missile-command version
# Good luck, and have fun!
.data
# Constants for accessing the fields of a struct missile,
# struct missile is defined in rtc.h and mp1.h
NEXT = 0
X = 4
Y = 8
VX = 12
VY = 16
DEST_X = 20
DEST_Y = 24
EXPLODED = 28
C = 32
# Character to draw for an explosion - '@'
EXPLOSION = 64
# Data shared between this file and rtc.c helper functions
# This '.globl' directive makes these symbols visible externally
.globl mp1_missile_list, base_alive, mp1_score
mp1_missile_list: .long 0x0 # Head of list pointer
base_alive: .long 0x0 # Array of 3 bytes, plus a padding byte
mp1_score: .long 0x0 # Player's current score
# Data private to this file
base_pic: .string "/^^^\\" # Picture of a live base
dead_base_pic: .string "xxxxx" # Picture of a dead base
crosshairs_x: .long 0x0 # X-position of the crosshairs
crosshairs_y: .long 0x0 # Y-position of the crosshairs
.text
# void mp1_poke(void);
# You can use this function to write to video memory.
#
# Interface: Register-based arguments (not C-style)
# Inputs: %cl - The byte you wish to write
# %eax - Offset from the start of video memory that you wish
# to write to
# Outputs: Text-mode video screen is written to at location %eax with
# the byte in %cl
# Registers: Clobbers EDX
mp1_poke:
movl vmem_base_addr(,1),%edx
movb %cl,(%edx,%eax,1)
ret
# ----------------- Exported functions ---------------------
# void mp1_rtc_tasklet(unsigned long garbage);
# Performs three tasks:
# (1) updates the list of missiles (implement this in update_missiles,
# below, and call it from here).
# (2) Redraw the bases - they may have been overwritten with missiles
# (3) Redraw the crosshairs - it may have been overwritten with missiles
# Inputs : none
# Outputs : none
# Registers: Standard C calling convention
.globl mp1_rtc_tasklet
mp1_rtc_tasklet:
ret
# int mp1_ioctl(unsigned long arg, unsigned int cmd)
# The dispatch function for the MP1 ioctls - should use the cmd argument
# and a jumptable to execute one of the specific ioctls implemented below.
# Inputs : unsigned long arg - parameter to the mp1_ioctl_....
# : unsigned int cmd - specifies which mp1_ioctl_... function
# : to execute
# Outputs : Returns an integer - depends on which ioctl() function is called
# Registers: Standard C calling convention
.globl mp1_ioctl
mp1_ioctl:
ret
# ----------------- Functions private to this file -------------------
update_missiles:
ret
mp1_ioctl_startgame:
ret
mp1_ioctl_addmissile:
ret
mp1_ioctl_movexhairs:
ret
mp1_ioctl_getstatus:
ret
mp1_ioctl_endgame:
ret