diff --git a/ass1/polySubrutine.asm b/ass1/polySubrutine.asm index af8de5d..0363c11 100644 --- a/ass1/polySubrutine.asm +++ b/ass1/polySubrutine.asm @@ -1,49 +1,39 @@ poly START 0 -start LDA x - STA arg1 - JSUB startSubrutine - LDA subRez - STA rez +startSubrutine LDA x0 .pristejemo x0 v A + LDB x + LDS x + LDT x1 + MULR S, T + ADDR T, A .pristejemo x0 * x + + LDT x2 + MULR B, S .izracunamo x^2 + MULR S, T + ADDR T, A + + LDT x3 + MULR B, S .izracunamo x^3 + MULR S, T + ADDR T, A + + LDT x4 + MULR B, S .izracunamo x^4 + MULR S, T + ADDR T, A + + STA rez + halt J halt END start -.subrutina za izračun tega polinoma v točki arg1 -startSubrutine STA regA - STB regB - STT regT - STS regS .shranimo registre - - LDA x0 .pristejemo x0 v A - - LDX #3 .odmik v arrayu - LDS arg1 -loop LDT x0, X .preberemo x_n - MULR S, T .izračunamo x_n * x^n - ADDR T, A .pristejemo v vsoto - LDT arg1 - MULR T, S .zmožimo naslednjo potenco - LDT #3 - ADDR T, X .povečamo odmik - LDT #13 - COMPR T, X - JGT loop - - STA subRez .shranimo rez - - LDA regA .obnovimo registre - LDB regB - LDT regT - LDS regS - - RSUB .polinom +x4 WORD 1 +x3 WORD 2 +x2 WORD 3 +x1 WORD 4 x0 WORD 5 - WORD 4 - WORD 3 - WORD 2 - WORD 1 .tocka x WORD 2 @@ -55,10 +45,4 @@ rez RESW 1 arg1 RESW 1 .rezultat subrutine -subRez RESW 1 - -.registri -regA RESW 1 -regB RESW 1 -regT RESW 1 -regS RESW 1 +subRez RESW 1 \ No newline at end of file