Skip to content

Commit e948479

Browse files
committed
Prepare for submission
1 parent a7e74b7 commit e948479

38 files changed

+1285
-1056
lines changed

Check_Mailbox.S

-26
This file was deleted.

Clear_Screen.S

-58
This file was deleted.

Create_Food.S

+43-22
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,84 @@
1+
# ************************************************************* #
2+
# ECE 344L - Microprocessors - Spring 2015
3+
#
4+
# Name: Matthew Greci and Mitchell Jackson
5+
#
6+
# Laboratory Number: 6 Due Date: 7 May 2015
7+
#
8+
#
9+
# Lab Group: Matthew Greci and Mitchell Jackson
10+
#
11+
#
12+
# #*************************************************************** #
13+
# This is used to create food. Using both timers to obtain 'random'
14+
# values, we then mod it with whatever we need to create the char
15+
# value (2-9), the x (4-20), and y (4-78)
16+
# #***************************************************************
117
#include <p32xxxx.h>
2-
.global Create_Food
18+
.global create_food
19+
.data
320
.text
421
.set noreorder
5-
.ent Create_Food
6-
.set Food_Location, 0xA00004F8
7-
.set TO_PRINT, 0xA0000400
22+
.set Food_Location, 0xA00002F8
23+
.set TO_PRINT, 0xA0000220
824

9-
Create_Food:
10-
li s1, 0
11-
or s1, s1, ra
25+
.ent create_food
1226

13-
lw t0, TMR1
27+
create_food:
28+
li s0, 0
29+
or s0, s0, ra
30+
31+
#char (2-9)
32+
lw t0, TMR2
1433
li t1, 8
1534
div t0, t1
1635
mfhi t1
1736
addi t1, 0x30
37+
38+
#x (4-20)
39+
#ones place
1840
lw t0, TMR1
1941
li t2, 7
2042
div t0, t2
2143
mfhi t2
22-
lw t0, TMR1
44+
#tens place
45+
lw t0, TMR2
2346
li t3, 2
2447
div t0, t3
2548
mfhi t3
2649
sll t3, 4
2750
or t2, t2, t3
2851

29-
lw t0, TMR1
52+
#y (4-78)
53+
#ones place
54+
lw t0, TMR2
3055
li t3, 7
3156
div t0, t3
3257
mfhi t3
33-
lw t0, TMR1
58+
#tens place
59+
lw t0, TMR2
3460
li t4, 6
3561
div t0, t4
3662
mfhi t4
3763
sll t4, 4
3864
or t3, t3, t4
3965

40-
la t0, Food_Location
66+
#shift values to stay on gameboard
4167
addi t3, 4
4268
addi t2, 4
4369
addi t1, 2
44-
sw zero, Food_Location
45-
46-
#TEMP, only to test erase this
47-
#li t3, 0x35
48-
#li t2, 0x12
49-
#li t1, 0x35
5070

71+
#store values into food box and print
72+
la t0, Food_Location
5173
sb t3, 0(t0) #y
5274
sb t2, 1(t0) #x
5375
sb t1, 2(t0) #char
5476
lw t1, 0(t0)
5577
sw t1, TO_PRINT
56-
bal Print_Char_X_Y
57-
nop
78+
bal print_Y_X_Char
5879
nop
5980

60-
jr s1
81+
jr s0
6182
nop
6283

63-
.end Create_Food
84+
.end create_food

Create_Worm.S

+32-15
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,36 @@
1+
# ************************************************************* #
2+
# ECE 344L - Microprocessors - Spring 2015
3+
#
4+
# Name: Matthew Greci and Mitchell Jackson
5+
#
6+
# Laboratory Number: 6 Due Date: 7 May 2015
7+
#
8+
#
9+
# Lab Group: Matthew Greci and Mitchell Jackson
10+
#
11+
#
12+
# #*************************************************************** #
13+
# This is used to initially create the worm. The head, and 6 body
14+
# values are loaded into the worm's place in memory.
15+
# #***************************************************************
116
#include <p32xxxx.h>
2-
.global Create_Worm
17+
.global create_worm
318
.data
419
.text
520
.set noreorder
6-
.set TO_PRINT, 0xA0000400
7-
.set MAILBOX, 0xA0000440
8-
.set WORM_LENGTH, 0xA00004FC
9-
.set WORM, 0xA0000500
21+
.set TO_PRINT, 0xA0000220
22+
.set WORM_BOX, 0xA0000230
23+
.set WORM_LENGTH, 0xA00002FC
24+
.set WORM, 0xA0000300
1025

11-
.ent Create_Worm
26+
.ent create_worm
1227

13-
Create_Worm:
28+
create_worm:
1429
li s0, 0
1530
or s0, s0, ra
1631

32+
#create the initial head and body values
33+
#store into memory for print_worm
1734
la t0, WORM
1835
li t1, 0x1240
1936
sh t1, 0x0(t0)
@@ -36,15 +53,15 @@ Create_Worm:
3653
li t1, 0x1246
3754
sh t1, 0xC(t0)
3855

56+
#initial length is 6
57+
li t0, 6
58+
sw t0, WORM_LENGTH
3959

40-
#set initial length to 6
41-
li t1, 6
42-
sw t1, WORM_LENGTH
43-
44-
#set initial direction to left
45-
li t1, 0x68
46-
sw t1, MAILBOX
60+
#initial direction is left
61+
li t0, 0x68
62+
sw t0, WORM_BOX
4763

4864
jr s0
4965
nop
50-
.end Create_Worm
66+
67+
.end create_worm

ISR_Timer1.S

+35-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,42 @@
1+
# ************************************************************* #
2+
# ECE 344L - Microprocessors - Spring 2015
3+
#
4+
# Name: Matthew Greci and Mitchell Jackson
5+
#
6+
# Laboratory Number: 6 Due Date: 7 May 2015
7+
#
8+
#
9+
# Lab Group: Matthew Greci and Mitchell Jackson
10+
#
11+
#
12+
# #*************************************************************** #
13+
# Interrupt service routine for Timer 1 (move worm, update score).
14+
# #***************************************************************
115
#include <p32xxxx.h>
2-
.global ISR_Timer1
16+
.global ISR_timer1
17+
.data
318
.text
419
.set noreorder
5-
.ent ISR_Timer1
20+
.ent ISR_timer1
621

7-
ISR_Timer1:
8-
sw zero, IFS0 #clear flag
9-
bal Move_Snake
22+
ISR_timer1:
23+
#clear interrupt flag
24+
sw zero, IFS0
25+
26+
#move worm
27+
bal move_worm
28+
nop
29+
30+
#print worm
31+
bal print_worm
1032
nop
11-
bal Print_Snake
33+
34+
#update score
35+
bal update_score
1236
nop
13-
eret #return to main
37+
38+
#return to main
39+
eret
1440
nop
15-
.end ISR_Timer1
41+
42+
.end ISR_timer1

ISR_Timer2.S

+34-17
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,50 @@
1+
# ************************************************************* #
2+
# ECE 344L - Microprocessors - Spring 2015
3+
#
4+
# Name: Matthew Greci and Mitchell Jackson
5+
#
6+
# Laboratory Number: 6 Due Date: 7 May 2015
7+
#
8+
#
9+
# Lab Group: Matthew Greci and Mitchell Jackson
10+
#
11+
#
12+
# #*************************************************************** #
13+
# Interrupt service routine for Timer 2 (control clocks).
14+
# #***************************************************************
115
#include <p32xxxx.h>
2-
.global ISR_Timer2
16+
.global ISR_timer2
17+
.data
318
.text
419
.set noreorder
5-
.set PAUSED, 0xA00004D0
6-
.ent ISR_Timer2
20+
.set PAUSED_BOX, 0xA0000240
21+
.ent ISR_timer2
722

8-
ISR_Timer2:
9-
sw zero, IFS0 #clear flag
23+
ISR_timer2:
24+
#clear interrupt flag
25+
sw zero, IFS0
1026

11-
bal Increment_Clock_Time
12-
nop
13-
bal Update_Score
27+
#increment clock
28+
bal incr_clk
1429
nop
1530

16-
lw t0, PAUSED
17-
# check PAUSED != 0, do not increment elapsed
18-
bne t0, zero, Skip
31+
# check PAUSED_BOX != 0, do not increment elapsed
32+
lw t0, PAUSED_BOX
33+
bne t0, zero, PAUSED_BOX
1934
nop
2035
# otherwise increment elapsed
21-
bal Increment_Elapsed_Time
36+
bal incr_elapsed
2237
nop
2338

24-
Skip:
39+
PAUSED_BOX:
2540
# update and print normally afterwords
26-
bal Update_Time
41+
bal update_time
2742
nop
28-
bal Print_Time
43+
bal print_time
2944
nop
30-
eret #return to main
45+
46+
#return to main
47+
eret
3148
nop
3249

33-
.end ISR_Timer2
50+
.end ISR_timer2

0 commit comments

Comments
 (0)