CS代写 # mp1.S – missile-command version

# mp1.S – missile-command version
# Good luck, and have fun!

Copyright By PowCoder代写 加微信 powcoder

# Constants for accessing the fields of a struct missile,
# struct missile is defined in rtc.h and mp1.h

NEXT = 0
DEST_X = 20
DEST_Y = 24
EXPLODED = 28

# 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

# 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

movl vmem_base_addr(,1),%edx
movb %cl,(%edx,%eax,1)

# —————– 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:

# 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:

# —————– Functions private to this file ——————-

update_missiles:

mp1_ioctl_startgame:

mp1_ioctl_addmissile:

mp1_ioctl_movexhairs:

mp1_ioctl_getstatus:

mp1_ioctl_endgame:

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com