projects
/
YACASL2.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Doxygenコメントを修正
[YACASL2.git]
/
as
/
misc
/
hanoi.casl
1
; ハノイの塔を解くプログラム
2
MAIN START
3
LD GR0,N
4
LD GR1,A
5
LD GR2,B
6
LD GR3,C
7
CALL HANOI
8
RET
9
HANOI CPA GR0,=1
10
JZE DISP
11
SUBA GR0,=1
12
PUSH 0,GR2
13
PUSH 0,GR3
14
POP GR2
15
POP GR3
16
CALL HANOI
17
PUSH 0,GR2
18
PUSH 0,GR3
19
POP GR2
20
POP GR3
21
CALL DISP
22
PUSH 0,GR1
23
PUSH 0,GR2
24
POP GR1
25
POP GR2
26
CALL HANOI
27
PUSH 0,GR1
28
PUSH 0,GR2
29
POP GR1
30
POP GR2
31
ADDA GR0,=1
32
RET
33
DISP ST GR1,MSG1
34
ST GR3,MSG2
35
OUT MSG,LNG
36
RET
37
N DC 3 ; 輪の総数
38
LNG DC 11 ; メッセージの長さ
39
A DC 'A'
40
B DC 'B'
41
C DC 'C'
42
MSG DC 'from '
43
MSG1 DS 1
44
DC ' to '
45
MSG2 DS 1
46
END