-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest6.txt
73 lines (73 loc) · 964 Bytes
/
test6.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
inputLoop INP
BRZ sortLoop
store DAT 380
LDA store
ADD increment
STA store
LDA listSize
ADD increment
STA listSize
BRA inputLoop
sortLoop LDA listSize
SUB increment
STA loopCount
LDA zero
STA isChange
load1 DAT 580
STA buffA
load2 DAT 581
STA buffB
cmp SUB buffA
BRP nextItem
swap LDA buffB
store1 DAT 380
LDA buffA
store2 DAT 381
LDA increment
STA isChange
nextItem LDA store1
ADD increment
STA store1
ADD increment
STA store2
LDA load1
ADD increment
STA load1
ADD increment
STA load2
LDA loopCount
SUB increment
STA loopCount
BRZ isFinished
BRA load1
isFinished LDA isChange
BRZ outputList
resetLoop LDA lda1
STA load1
ADD increment
STA load2
LDA sta1
STA store1
ADD increment
STA store2
BRA sortLoop
outputList DAT 580
OUT
LDA outputList
ADD increment
STA outputList
LDA listSize
SUB increment
STA listSize
BRZ end
BRA outputList
end HLT
zero DAT 0
buffA DAT 0
buffB DAT 0
isChange DAT 0
increment DAT 1
listSize DAT 0
loopCount DAT 0
sta1 DAT 380
lda1 DAT 580