131 lines
1.4 KiB
Plaintext
131 lines
1.4 KiB
Plaintext
JUMP main
|
|
|
|
pgcd
|
|
LOADL 0
|
|
LOAD (1) -2[LB]
|
|
LOAD (1) -1[LB]
|
|
boucle
|
|
LOAD (1) 5[LB]
|
|
JUMPIF (0) fin
|
|
LOAD (1) 4[LB]
|
|
LOAD (1) 5 [LB]
|
|
SUBR IMod
|
|
STORE (1) 3[LB]
|
|
LOAD (1) 5[LB]
|
|
STORE (1) 4[LB]
|
|
LOAD (1) 3[LB]
|
|
STORE(1) 5[LB]
|
|
JUMP boucle
|
|
fin
|
|
LOAD (1) 4[LB]
|
|
RETURN (1) 2
|
|
|
|
norm
|
|
LOAD (1) -2[LB]
|
|
LOAD (1) -1[LB]
|
|
CALL (SB) pgcd
|
|
LOAD (1) -2[LB]
|
|
LOAD (1) 3[LB]
|
|
SUBR IDiv
|
|
LOAD (1) -1[LB]
|
|
LOAD (1) 3[LB]
|
|
SUBR IDiv
|
|
RETURN (2) 2
|
|
|
|
ROut
|
|
LOADL 91
|
|
SUBR COut
|
|
LOAD (1) -2[LB]
|
|
SUBR IOut
|
|
LOADL 124
|
|
SUBR COut
|
|
LOAD (1) -1[LB]
|
|
SUBR IOut
|
|
LOADL 93
|
|
SUBR COut
|
|
POP (0) 1
|
|
RETURN (0) 2
|
|
|
|
RAdd
|
|
LOAD (1) -4[LB]
|
|
LOAD (1) -1[LB]
|
|
SUBR IMul
|
|
LOAD (1) -2[LB]
|
|
LOAD (1) -3[LB]
|
|
SUBR IMul
|
|
SUBR IAdd
|
|
LOAD (1) -3[LB]
|
|
LOAD (1) -1[LB]
|
|
SUBR IMul
|
|
CALL (SB) norm
|
|
POP (2) 4
|
|
RETURN (2) 4
|
|
|
|
multRat
|
|
LOAD (1) -4[LB]
|
|
LOAD (1) -2[LB]
|
|
SUBR IMul
|
|
LOAD (1) -3[LB]
|
|
LOAD (1) -1[LB]
|
|
SUBR IMul
|
|
CALL (SB) norm
|
|
POP (2) 4
|
|
RETURN (2) 4
|
|
|
|
add
|
|
PUSH 1
|
|
LOADL 0
|
|
STORE (1) 3[LB]
|
|
LOADL 0
|
|
LOAD (1) -2[LB]
|
|
SUBR IAdd
|
|
STORE (1) 3[LB]
|
|
LOAD (1) -2[LB]
|
|
LOAD (1) -1[LB]
|
|
LOAD (1) 3[LB]
|
|
SUBR IAdd
|
|
SUBR IAdd
|
|
POP (1) 1
|
|
RETURN (1) 2
|
|
|
|
main
|
|
PUSH 1
|
|
LOADL 3
|
|
STORE (1) 0[SB]
|
|
LOADL 4
|
|
STORE (1) 0[SB]
|
|
PUSH 1
|
|
LOAD (1) 0[SB]
|
|
LOADL 5
|
|
SUBR IAdd
|
|
STORE (1) 1[SB]
|
|
LOAD (1) 0[SB]
|
|
LOADL 0
|
|
SUBR ILss
|
|
JUMPIF (0) label1
|
|
PUSH 1
|
|
LOADL 1
|
|
STORE (1) 2[SB]
|
|
LOADL 0
|
|
STORE (1) 2[SB]
|
|
POP (0) 1
|
|
JUMP label2
|
|
label1
|
|
PUSH 2
|
|
LOADL 4
|
|
LOADL 3
|
|
STORE (2) 2[SB]
|
|
PUSH 1
|
|
LOAD (2) 2[SB]
|
|
POP (0) 1
|
|
LOADL 5
|
|
CALL (SB) add
|
|
STORE (1) 4[SB]
|
|
LOAD (2) 2[SB]
|
|
CALL (SB) ROut
|
|
POP (0) 3
|
|
label2
|
|
POP (0) 2
|
|
|
|
HALT
|