added poly.asm
This commit is contained in:
parent
39aed69969
commit
fb9dd4d7ec
1 changed files with 57 additions and 0 deletions
57
ass1/poly.asm
Normal file
57
ass1/poly.asm
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
poly START 0
|
||||
|
||||
. potence x^1 .. x^4
|
||||
LDA x
|
||||
STA x1
|
||||
|
||||
MUL x
|
||||
STA x2
|
||||
|
||||
MUL x
|
||||
STA x3
|
||||
|
||||
MUL x
|
||||
STA x4
|
||||
|
||||
|
||||
. x3 = 2 * x^3
|
||||
LDA x3
|
||||
LDB #2
|
||||
MULR A,B
|
||||
STB x3
|
||||
|
||||
. x2 = 3 * x^2
|
||||
LDA x2
|
||||
LDB #3
|
||||
MULR A,B
|
||||
STB x2
|
||||
|
||||
. x1 = 4 * x
|
||||
LDA x1
|
||||
LDB #4
|
||||
MULR A,B
|
||||
STB x1
|
||||
|
||||
. vsota vseh
|
||||
LDA x0
|
||||
ADD x1
|
||||
ADD x2
|
||||
ADD x3
|
||||
ADD x4
|
||||
STA result
|
||||
|
||||
|
||||
HALT J HALT
|
||||
END poly
|
||||
.data
|
||||
x WORD 2 ; vrednost x
|
||||
|
||||
x4 RESW 1
|
||||
x3 RESW 1
|
||||
x2 RESW 1
|
||||
x1 RESW 1
|
||||
x0 WORD 5 ; konstanta
|
||||
|
||||
result RESW 1
|
||||
|
||||
END poly
|
||||
Loading…
Add table
Add a link
Reference in a new issue