-
Notifications
You must be signed in to change notification settings - Fork 0
/
program2.txt
123 lines (95 loc) · 1.73 KB
/
program2.txt
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
; Brandon Sandoval
; Name: "program2.txt"
; Description:Write a program which will perform the following operations,
;store each result in a separate memory address and display each value.
;This program must use every instruction available,
; with the exception of jump and jumpz.
;A9 + 2B
;A9 - 2B
;A9 AND 2B
;A9 OR 2B
;ASHR A9
;AF + 1
;NOT D1
JMP start
;Variables
varA: A9 ; Hex A9 = 169
varB: 2B ; Hex 2B = 43
varC: AF ; Hex AF = 175
varD: D1 ; Hex D1 = 209
;Variables used to store the results of the operations
OpOne: 0
OpTwo: 0
OpThree: 0
OpFour: 0
OpFive: 0
OpSix: 0
OpSeven: 0
;-----------------------------------
start: ; JMP statement starts here
;A9 - 2B = D4
LDAC varB
MVAC
LDAC varA
ADD
STAC OpOne
CLAC
;-----------------------------------
;A9 - 2B = 7E
MOVR
MVAC
LDAC varA
SUB
STAC OpTwo
CLAC
;-----------------------------------
;A9 AND 2B = 29
MOVR
MVAC
LDAC varA
AND
STAC OpThree
CLAC
;-----------------------------------
;A9 OR 2B = AB
LDAC varB
MVAC
LDAC varA
OR
STAC OpFour
CLAC
;-----------------------------------
;ASHR A9 = 54
LDAC varA
ASHR
STAC OpFive
CLAC
;-----------------------------------
;AF + 1 = B0
LDAC varC
INC
STAC OpSix
CLAC
;-----------------------------------
;NOT D1 = FF2E
LDAC varD
NOT
STAC OpSeven
CLAC
;-----------------------------------
;Displays all the results from the operations
LDAC OpOne ;D4
OUT
LDAC OpTwo ;7E
OUT
LDAC OpThree ;29
OUT
LDAC OpFour ;AB
OUT
LDAC OpFive ;54
OUT
LDAC OpSix ;B0
OUT
LDAC OpSeven ;FF2E
OUT
HALT ;Stops the program