111 lines
1.2 KiB
Plaintext
111 lines
1.2 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 '['
|
|
SUBR COut
|
|
LOAD (1) -2[LB]
|
|
SUBR IOut
|
|
LOADL '|'
|
|
SUBR COut
|
|
LOAD (1) -1[LB]
|
|
SUBR IOut
|
|
LOADL ']'
|
|
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
|
|
|
|
fact
|
|
PUSH 1
|
|
LOADL 0
|
|
STORE (1) 3[LB]
|
|
LOAD (1) -2[LB]
|
|
LOAD (1) -1[LB]
|
|
SUBR IEq
|
|
JUMPIF (0) label3
|
|
LOAD (1) -2[LB]
|
|
STORE (1) 3[LB]
|
|
POP (0) 0
|
|
JUMP label4
|
|
label3
|
|
LOAD (1) -2[LB]
|
|
LOAD (1) -2[LB]
|
|
LOADL 1
|
|
SUBR IAdd
|
|
LOAD (1) -1[LB]
|
|
CALL (SB) fact
|
|
SUBR IMul
|
|
STORE (1) 3[LB]
|
|
POP (0) 0
|
|
label4
|
|
LOAD (1) 3[LB]
|
|
RETURN (1) 2
|
|
|
|
main
|
|
PUSH 1
|
|
LOADL 1
|
|
LOADL 5
|
|
CALL (SB) fact
|
|
STORE (1) 0[SB]
|
|
LOAD (1) 0[SB]
|
|
SUBR IOut
|
|
POP (0) 1
|
|
HALT
|