Vaja2 osnove v1

This commit is contained in:
aljazbrodar. 2025-10-23 18:44:59 +02:00
parent d3a493a7fd
commit 480e0e84ce
12 changed files with 277 additions and 0 deletions

29
vaja2/osnove/horner.asm Normal file
View file

@ -0,0 +1,29 @@
HORNER START 0
. Pretvorimo polinom x^4 + 2x^3 + 3x^2 + 4x+5 v Hornerjevo obliko
. b_n = a_n = 1
. b_n-1 = 2 + b_n * x = 2 + 1 * x = 4
. b_n-2 = 3 + b_n-1 * x = 3 + 4 * x = 11
. b_n-3 = 4 + b_n-2 * x = 4 + 11 * x = 26
. b_n-4 = 5 + b_n-3 * x = 5 + 26 * x = 57
. kjer x = 2
LDA #1
MUL #2
ADD #2
MUL #2
ADD #3
MUL #2
ADD #4
MUL #2
ADD #5
STA res
HALT J HALT
END HORNER
x WORD 2
res RESW 1