-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathIO_subroutine.X68
139 lines (102 loc) · 5.08 KB
/
IO_subroutine.X68
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
*START ORG $1000
*INCLUDE 'OP_EA.x68'
*INCLUDE 'definitions.x68'
*INCLUDE 'newHelper.x68'
*-----------------------------------------------------------
* Title :
* Written by :
* Date :
* Description:
*-----------------------------------------------------------
*Displays welcome message
LEA welcome_msg, A1
MOVE.B #13,D0
TRAP #15
MOVE.B #8,linecount *keeps a counter of how many lines there are
*-----------------------------------------------------------
*Gets the starting and ending inputs
*First, the start address prompt and location
IO_StartLoop LEA location_start_msg,A1
MOVE.B #14,D0
TRAP #15
*Gets the user input for start locatioin
LEA input_buffer,A1
MOVE.B #2,D0
TRAP #15
*Converts that ASCII input into hexadecimal
CLR.L D0
CLR.L D1
JSR sub_AsToHeLoop *this will put the newly converted hex value into D7
MOVE.L D7, location_startData *puts that value into a variable, 'location_startData'
MOVE.L location_startData,A2
MOVEA.L A2,A4
*ADD.L #$2,A4 *moves to next OpCode
LEA linebreak,A1 *appends line at the end of the user input
MOVE.B #14,D0
TRAP #15
JSR sub_StartReadingData *checks the validity of the start address
CMP #1, D7 *checks of subroutine returned 1, if so then invalid
BEQ IO_StartLoop *starts loop over due to invalidity
*-----------------------------------------------------------
*Gets the starting and ending inputs
*Second, gets the ending address prompt and location
*-----------------------------------------------------------
IO_EndLoop LEA location_end_msg,A1
MOVE.B #14,D0
TRAP #15
*Gets the user input for start locatioin
LEA input_buffer,A1
MOVE.B #2,D0
TRAP #15
*Converts that ASCII input into hexadecimal
CLR.L D0
CLR.L D1
JSR sub_AstoHeLoop *this will put the newly converted hex value into D7
MOVE.L D7, location_endData *puts that value into a variable, 'location_startData'
MOVE.L location_endData,A3
LEA linebreak,A1 *appends line at the end of the user input
MOVE.B #14,D0
TRAP #15
JSR sub_endReadingData *checks the validity of the start address
CMP #1, D7 *checks of subroutine returned 1, if so then invalid
BEQ IO_StartLoop *starts loop over due to invalidity
BRA MAIN_LOOP
*-----------------------------------------------------------
* Pause Screen Ouput
* This subroutine will pause the output after 29 lines are shown
**----------------------------------------------------------
IO_PauseOutput LEA pause_msg,A1 *prints pause message to the screen
MOVE.B #14,D0
TRAP #15
MOVE.B #5,D0 *allows user to click enter to continue
TRAP #15
MOVE.B #0,linecount
CMPA.L A3,A2 * checks if the program is at the end
BGE IO_EndProgram
BRA MAIN_LOOP
*-----------------------------------------------------------
* Terminate program
* This subroutine will be used to end the program. It shows the
* end test message and then ask user input for continuing or
* not.
*-----------------------------------------------------------
IO_EndProgram LEA endtest_msg,A1
MOVE.B #14,D0
TRAP #15
*checks and validates user input
LEA input_buffer,A1
MOVE.B #2,D0
TRAP #15
LEA linebreak,A1
MOVE.B #14,D0
TRAP #15
MOVE.B #5,linebreak *used for question and prompts user to answer
MOVE.L input_buffer,D7
CMPI.L #$79657300,D7
BEQ IO_StartLoop
BRA END_PROGRAM
*-----------------------------------------------------------
*~Font name~Courier New~
*~Font size~10~
*~Tab type~1~
*~Tab size~4~