forked from peterstanton/TeamAwesome-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIO_subroutine.L68
205 lines (201 loc) · 14.4 KB
/
IO_subroutine.L68
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
00006000 Starting Address
Assembler used: EASy68K Editor/Assembler v5.15.04
Created On: 5/13/2017 2:46:00 PM
00000000 1 *-----------------------------------------------------------
00000000 2 * Title : Disassembler Final Project
00000000 3 * Written by : Team Awesome (Olga Rocheeva, Dwina Solihin, Peter Stanton)
00000000 4 * Date : April 15, 2017
00000000 5 * Description: CSS 422 Final Project
00000000 6 *-----------------------------------------------------------
00000000 7 *First test will be with NOP
00000000 8 *Machine code is 01 00 111 001 110 010
00000000 9 *Use test code
00000000 10 *-----------------------------------------------------------
00000000 11 *Displays the welcome message
Line 12 ERROR: Undefined symbol
00000000 43F9 004DBB8E 12 LEA welcome_msg, A1 *loads welcome message to A1
00000006 103C 000D 13 MOVE.B #13,D0
0000000A 4E4F 14 TRAP #15
0000000C 15
Line 16 ERROR: Undefined symbol
0000000C 13FC 0007 00544488 16 MOVE.B #7,linecount *initializes counter
00000014 17 *-----------------------------------------------------------
00000014 18 *Get Input
00000014 19 *Shows start location prompt
Line 20 ERROR: Undefined symbol
00000014 43F9 004DBB8E 20 IO_StartLoop LEA location_start_msg,A1 *Store the console message for output.
0000001A 103C 000E 21 MOVE.B #14,D0
0000001E 4E4F 22 TRAP #15 *Display to console.
00000020 23
00000020 24 *Get User Input
Line 25 ERROR: Undefined symbol
00000020 43F9 004DBB8E 25 LEA input_buffer,A1 *Raw input stored
00000026 103C 0002 26 MOVE.B #2,D0 *Read string from keyboard to A1
0000002A 4E4F 27 TRAP #15 *Get the user input from console
0000002C 28
0000002C 29 *Convert ASCII input to hexadecimal
0000002C 4280 30 CLR.L D0
0000002E 4281 31 CLR.L D1
00000030 32
Line 33 ERROR: Undefined symbol
00000030 4EB9 004DBB8E 33 JSR sub_AstoHeLoop *conversion method for raw input characters
00000036 2447 34 MOVE.L D7, A2 *store hex value
00000038 35
Line 36 ERROR: Undefined symbol
00000038 43F9 004DBB8E 36 LEA linebreak,A1 *appends a linefeed to the end of the user input
0000003E 103C 000E 37 MOVE.B #14,D0 *no next line when displaying
00000042 4E4F 38 TRAP #15
00000044 39
Line 40 ERROR: Undefined symbol
00000044 4EB9 004DBB8E 40 JSR sub_startReadingData *reads the location_StartData and returns D7
0000004A BE3C 0001 41 CMP.B #1,D7 *checks of D7 == 1. If it is, then input is invalid
0000004E 67C4 42 BEQ IO_StartLoop *starts all over
00000050 43 *-----------------------------------------------------------
00000050 44 *Show end location prompt
Line 45 ERROR: Undefined symbol
00000050 43F9 004DBB8E 45 IO_EndLoop LEA location_end_msg,A1 *Store the console message for output.
00000056 103C 000E 46 MOVE.B #14,D0
0000005A 4E4F 47 TRAP #15 *Display to console.
0000005C 48
0000005C 49 *Get User Input
Line 50 ERROR: Undefined symbol
0000005C 43F9 004DBB8E 50 LEA input_buffer,A1 *Raw input stored
00000062 103C 0002 51 MOVE.B #2,D0 *Read string from keyboard to A1
00000066 4E4F 52 TRAP #15 *Get the user input from console
00000068 53
00000068 54 *Convert ASCII input to hexadecimal
00000068 4280 55 CLR.L D0
0000006A 4281 56 CLR.L D1
0000006C 57
Line 58 ERROR: Undefined symbol
0000006C 4EB9 004DBB8E 58 JSR sub_AstoHeLoop *conversion method for raw input characters
Line 59 ERROR: Undefined symbol
00000072 23C7 0054448C 59 MOVE.L D7, location_endData *store hex value
00000078 60
Line 61 ERROR: Undefined symbol
00000078 43F9 004DBB8E 61 LEA linebreak,A1 *appends a linefeed to the end of the user input
0000007E 103C 000E 62 MOVE.B #14,D0 *no next line when displaying
00000082 4E4F 63 TRAP #15
00000084 64
Line 65 ERROR: Undefined symbol
00000084 4EB9 004DBB8E 65 JSR sub_endReadingData *reads the location_StartData and returns D7
0000008A BE3C 0001 66 CMP.B #1,D7 *checks of D7 == 1. If it is, then input is invalid
0000008E 67C0 67 BEQ IO_EndLoop *starts all over
00000090 68
00000090 6000 0002 69 BRA IO_commandPars
00000094 70 *-----------------------------------------------------------
00000094 71 *Parser through the various commands
00000094 72 IO_commandPars
00000094 73 * LEA jumptable, A0 *goes to the jump table
00000094 74 ** MOVE.L location_startData, A2
00000094 75 *** MOVE.L location_endData, A3
00000094 76
Line 77 ERROR: Undefined symbol
00000094 0C39 001D 005444A4 77 cmParsLoop CMPI.B #29, linecount *will pause output if the screen lines equal 30
0000009C 6700 002A 78 BEQ IO_pause
000000A0 79
Line 80 ERROR: Undefined symbol
000000A0 4EB9 004DBB8E 80 cmParsReturn JSR sub_PrintAddress *goes to helper subroutine
Line 81 ERROR: Undefined symbol
000000A6 5239 00544490 81 ADDQ.B #1,linecount increments screen line counter
000000AC 82
000000AC 4287 83 CLR.L D7 *clears D7 which holds the hex value
000000AE 84
000000AE 3E12 85 MOVE.W (A2),D7 *puts the next opcode in D7
000000B0 103C 000C 86 MOVE.B #12,D0 *set to shift 12 bits
000000B4 E06F 87 LSR.W D0,D7 *uses the shift call to isolate bits from root
000000B6 88
000000B6 CEFC 0006 89 MULU #6,D7
000000BA 4EB0 7000 90 JSR 0(A0,D7)
000000BE 91 *ASL.W #2,D7 *4 byte table entries
000000BE 92 *MOVEA.L (0,A0,D7.W),A1
000000BE 93 *JSR (A1) *jumps to specific subroutine in jumptable
000000BE 94
000000BE 95 *MOVEA.L location_endData,A6
000000BE 96
000000BE B5CE 97 CMPA.L A6,A2 *checks if the end of input is reached
000000C0 6C00 0022 98 BGE IO_endProg *if it is reached, then exits the loop
000000C4 99
000000C4 544A 100 ADDA.W #2,A2 *if not, it will go to the next opcode in test
000000C6 60CC 101 BRA cmParsLoop *continues the loop
000000C8 102 *-----------------------------------------------------------
000000C8 103 *Pause the program
Line 104 ERROR: Undefined symbol
000000C8 43F9 004DBB8E 104 IO_pause LEA pause_msg, A1 *displays pause_msg
000000CE 103C 000E 105 MOVE.B #14,D0 *without next line
000000D2 4E4F 106 TRAP #15
000000D4 107
000000D4 103C 0005 108 MOVE.B #5,D0 *Press enter key
000000D8 4E4F 109 TRAP #15
000000DA 110
Line 111 ERROR: Undefined symbol
000000DA 13FC 0000 00544480 111 MOVE.B #0,linecount
000000E2 60BC 112 BRA cmParsReturn *start program again
000000E4 113 *-----------------------------------------------------------
000000E4 114 *Terminate Program
Line 115 ERROR: Undefined symbol
000000E4 43F9 004DBB8E 115 IO_endProg LEA endTest_msg,A1
000000EA 103C 000E 116 MOVE.B #14,D0
000000EE 4E4F 117 TRAP #15
000000F0 118
000000F0 119 *checks what the user inputs (yes or no)
Line 120 ERROR: Undefined symbol
000000F0 43F9 004DBB8E 120 LEA input_buffer,A1 *the input is put in buffer
000000F6 103C 0002 121 MOVE.B #2,D0
000000FA 4E4F 122 TRAP #15
000000FC 123
Line 124 ERROR: Undefined symbol
000000FC 43F9 004DBB8E 124 LEA linebreak,A1 *puts a linebreak between the input and question
00000102 103C 000E 125 MOVE.B #14,D0
00000106 4E4F 126 TRAP #15
00000108 127
Line 128 ERROR: Undefined symbol
00000108 13FC 0005 005444A8 128 MOVE.B #5,linebreak *this is used for the question and prompts user input
00000110 129
Line 130 ERROR: Undefined symbol
00000110 2E39 004DBB8E 130 MOVE.L input_buffer,D7
00000116 131
00000116 0C87 79657300 132 CMPI.L #$79657300,D7 *if they type in yes, go to program again
0000011C 6700 FEF6 133 BEQ IO_StartLoop
00000120 134 *-----------------------------------------------------------
Line 135 ERROR: Undefined symbol
00000120 6000 BA6C 135 BRA END_PROGRAM *else end program
00000124 136
00000124 137
00000124 138
00000124 139
00000124 140
00000124 141
00000124 142
00000124 143
00000124 144
00000124 145
00000124 146
00000124 147
00000124 148
00000124 149
00000124 150
00000124 151
00000124 152
00000124 153
00000124 154
00000124 155
00000124 156
00000124 157
00000124 158
00000124 159
00000124 160
00000124 161
Line 162 WARNING: END directive missing, starting address not set
24 errors detected
1 warning generated
SYMBOL TABLE INFORMATION
Symbol-name Value
-------------------------
CMPARSLOOP 94
CMPARSRETURN A0
IO_COMMANDPARS 94
IO_ENDLOOP 50
IO_ENDPROG E4
IO_PAUSE C8
IO_STARTLOOP 14