aboutsummaryrefslogtreecommitdiff
path: root/tests/stack_machine_multiinstructions_load_store/instructions.s.tcl
blob: 10b874b604f9dfba4055c9a61887d520ada4a240 (about) (plain)
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
### set stack to 0, store 4 numbers (h11223344, h55667788, h8899AABB and
### hCCDDEEFF) at addresses h00002E, h00003E, h00004E and h00005E and load them
### back to stack (only 2 will really get written to stack's memory, other 2
### will remain in r0 and r1). Then, write them to h00F0F0, h08F0F0, h10F0F0 and
### h18F0F0.
### At the and use operand-addressing to load back value h55667788 from h00003E
### (expressed as h000040 in im + (-2) in operand) and store it to h1FFFCD
### (expressed as h1F0F0D in im + h00F0C0 in operand).

## set up stack
set_sp 0

## get number h11223344 into r1, and store it - repeat for other 3 numbers;
const h11223344
store h00002E

const h55667788
store h00003E

const h8899AABB
store h00004E

const hCCDDEEFF
store h00005E

## get numbers back on stack
load h00002E
load h00003E
load h00004E
load h00005E

## store copies to new locations
store h18F0F0
store h10F0F0
store h08F0F0
store h00F0F0

## prepare operand for later store operation
const h00F0C0

## use operand addressing to load back value from h00003E
const -2
load+ h000040

## use operand addressing to store value to h1FFFCD = h1F0F0D + h00F0C0
store+ h1F0F0D

## finish test
halt