Vaja2 osnove v1
This commit is contained in:
parent
d3a493a7fd
commit
480e0e84ce
12 changed files with 277 additions and 0 deletions
18
vaja1/0001-update.patch
Normal file
18
vaja1/0001-update.patch
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
From d3a493a7fdd111cdd65a8185dbb72391b6623340 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "aljazbrodar." <aljaz.brodar@gmail.com>
|
||||||
|
Date: Thu, 16 Oct 2025 14:49:13 +0200
|
||||||
|
Subject: [PATCH] update
|
||||||
|
|
||||||
|
---
|
||||||
|
vaja1/temp1.txt | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/vaja1/temp1.txt b/vaja1/temp1.txt
|
||||||
|
index e69de29..021090e 100644
|
||||||
|
--- a/vaja1/temp1.txt
|
||||||
|
+++ b/vaja1/temp1.txt
|
||||||
|
@@ -0,0 +1 @@
|
||||||
|
+sdfsdfss
|
||||||
|
--
|
||||||
|
2.43.0
|
||||||
|
|
||||||
33
vaja2/osnove/arith.asm
Normal file
33
vaja2/osnove/arith.asm
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
arith START 0
|
||||||
|
LDA x
|
||||||
|
ADD y
|
||||||
|
STA sum
|
||||||
|
|
||||||
|
LDA x
|
||||||
|
SUB y
|
||||||
|
STA diff
|
||||||
|
|
||||||
|
LDA x
|
||||||
|
MUL y
|
||||||
|
STA prod
|
||||||
|
|
||||||
|
LDA x
|
||||||
|
DIV y
|
||||||
|
STA quot
|
||||||
|
|
||||||
|
LDA y
|
||||||
|
MUL quot
|
||||||
|
STA mod
|
||||||
|
LDA x
|
||||||
|
SUB mod
|
||||||
|
STA mod
|
||||||
|
HALT J HALT
|
||||||
|
END arith
|
||||||
|
|
||||||
|
x WORD 11
|
||||||
|
y WORD 5
|
||||||
|
sum RESW 1
|
||||||
|
diff RESW 1
|
||||||
|
prod RESW 1
|
||||||
|
quot RESW 1
|
||||||
|
mod RESW 1
|
||||||
40
vaja2/osnove/arithr.asm
Normal file
40
vaja2/osnove/arithr.asm
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
arithr START 0
|
||||||
|
LDS #11
|
||||||
|
LDT #5
|
||||||
|
|
||||||
|
LDA ZERO
|
||||||
|
ADDR S, A
|
||||||
|
ADDR T, A
|
||||||
|
STA sum
|
||||||
|
|
||||||
|
LDA ZERO
|
||||||
|
ADDR S, A
|
||||||
|
SUBR T, A
|
||||||
|
STA diff
|
||||||
|
|
||||||
|
LDA ZERO
|
||||||
|
ADDR S, A
|
||||||
|
MULR T, A
|
||||||
|
STA prod
|
||||||
|
|
||||||
|
LDA ZERO
|
||||||
|
ADDR S, A
|
||||||
|
DIVR T, A
|
||||||
|
STA quot
|
||||||
|
|
||||||
|
LDA ZERO
|
||||||
|
ADDR S, A
|
||||||
|
LOOP SUBR T, A
|
||||||
|
COMPR A, T
|
||||||
|
JGT LOOP
|
||||||
|
JEQ LOOP
|
||||||
|
STA mod
|
||||||
|
HALT J HALT
|
||||||
|
END arithr
|
||||||
|
|
||||||
|
ZERO WORD 0
|
||||||
|
sum RESW 1
|
||||||
|
diff RESW 1
|
||||||
|
prod RESW 1
|
||||||
|
quot RESW 1
|
||||||
|
mod RESW 1
|
||||||
29
vaja2/osnove/horner.asm
Normal file
29
vaja2/osnove/horner.asm
Normal 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
|
||||||
15
vaja2/osnove/horner.log
Normal file
15
vaja2/osnove/horner.log
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
***** Section <default> *****
|
||||||
|
Stats: size=39 blocks=39 symbols=4 literals=0 relocations=0
|
||||||
|
Blocks
|
||||||
|
name start size #ins #dir #sto
|
||||||
|
<default> 00000 00027 11 3 1
|
||||||
|
Symbols
|
||||||
|
name hex dec scope kind type description
|
||||||
|
HALT 00001E 30 local relative code label
|
||||||
|
HORNER 000000 0 exported relative code label
|
||||||
|
res 000024 36 local relative data label
|
||||||
|
x 000021 33 local relative data label
|
||||||
|
Literals
|
||||||
|
label definition
|
||||||
|
Relocations
|
||||||
|
address length flag symbol
|
||||||
29
vaja2/osnove/horner.lst
Normal file
29
vaja2/osnove/horner.lst
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
00000 HORNER START 0
|
||||||
|
. Pretvorimo polinom x^4 + 2x^3 + 3x^2 + 4x+3 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
|
||||||
|
|
||||||
|
00000 010001 LDA #1
|
||||||
|
|
||||||
|
00003 210002 MUL #2
|
||||||
|
00006 190002 ADD #2
|
||||||
|
|
||||||
|
00009 210002 MUL #2
|
||||||
|
0000C 190003 ADD #3
|
||||||
|
|
||||||
|
0000F 210002 MUL #2
|
||||||
|
00012 190004 ADD #4
|
||||||
|
|
||||||
|
00015 210002 MUL #2
|
||||||
|
00018 190005 ADD #5
|
||||||
|
|
||||||
|
0001B 0F2006 STA res
|
||||||
|
0001E 3F2FFD HALT J HALT
|
||||||
|
00021 END HORNER
|
||||||
|
|
||||||
|
00021 000002 x WORD 2
|
||||||
|
00024 000000 res RESW 1
|
||||||
4
vaja2/osnove/horner.obj
Normal file
4
vaja2/osnove/horner.obj
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
HHORNER000000000027
|
||||||
|
T0000001E0100012100021900022100021900032100021900042100021900050F2006
|
||||||
|
T00001E063F2FFD000002
|
||||||
|
E000000
|
||||||
39
vaja2/osnove/poly.asm
Normal file
39
vaja2/osnove/poly.asm
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
POLY START 0
|
||||||
|
.x^4
|
||||||
|
LDA x
|
||||||
|
MUL x
|
||||||
|
MUL x
|
||||||
|
MUL x
|
||||||
|
STA res
|
||||||
|
CLEAR A
|
||||||
|
.+2x^3
|
||||||
|
LDA x
|
||||||
|
MUL x
|
||||||
|
MUL x
|
||||||
|
MUL #2
|
||||||
|
ADD res
|
||||||
|
STA res
|
||||||
|
CLEAR A
|
||||||
|
.+3x^2
|
||||||
|
LDA x
|
||||||
|
MUL x
|
||||||
|
MUL #3
|
||||||
|
ADD res
|
||||||
|
STA res
|
||||||
|
CLEAR A
|
||||||
|
.+4x
|
||||||
|
LDA x
|
||||||
|
MUL #4
|
||||||
|
ADD res
|
||||||
|
STA res
|
||||||
|
CLEAR A
|
||||||
|
.+5
|
||||||
|
LDA res
|
||||||
|
ADD #5
|
||||||
|
STA res
|
||||||
|
CLEAR A
|
||||||
|
HALT J HALT
|
||||||
|
END POLY
|
||||||
|
|
||||||
|
x WORD 2
|
||||||
|
res RESW 1
|
||||||
15
vaja2/osnove/poly.log
Normal file
15
vaja2/osnove/poly.log
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
***** Section <default> *****
|
||||||
|
Stats: size=88 blocks=88 symbols=4 literals=0 relocations=0
|
||||||
|
Blocks
|
||||||
|
name start size #ins #dir #sto
|
||||||
|
<default> 00000 00058 29 3 1
|
||||||
|
Symbols
|
||||||
|
name hex dec scope kind type description
|
||||||
|
HALT 00004F 79 local relative code label
|
||||||
|
POLY 000000 0 exported relative code label
|
||||||
|
res 000055 85 local relative data label
|
||||||
|
x 000052 82 local relative data label
|
||||||
|
Literals
|
||||||
|
label definition
|
||||||
|
Relocations
|
||||||
|
address length flag symbol
|
||||||
39
vaja2/osnove/poly.lst
Normal file
39
vaja2/osnove/poly.lst
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
00000 POLY START 0
|
||||||
|
. x^4
|
||||||
|
00000 03204F LDA x
|
||||||
|
00003 23204C MUL x
|
||||||
|
00006 232049 MUL x
|
||||||
|
00009 232046 MUL x
|
||||||
|
0000C 0F2046 STA res
|
||||||
|
0000F B400 CLEAR A
|
||||||
|
. +2x^3
|
||||||
|
00011 03203E LDA x
|
||||||
|
00014 23203B MUL x
|
||||||
|
00017 232038 MUL x
|
||||||
|
0001A 210002 MUL #2
|
||||||
|
0001D 1B2035 ADD res
|
||||||
|
00020 0F2032 STA res
|
||||||
|
00023 B400 CLEAR A
|
||||||
|
. +3x^2
|
||||||
|
00025 03202A LDA x
|
||||||
|
00028 232027 MUL x
|
||||||
|
0002B 210003 MUL #3
|
||||||
|
0002E 1B2024 ADD res
|
||||||
|
00031 0F2021 STA res
|
||||||
|
00034 B400 CLEAR A
|
||||||
|
. +4x
|
||||||
|
00036 032019 LDA x
|
||||||
|
00039 210004 MUL #4
|
||||||
|
0003C 1B2016 ADD res
|
||||||
|
0003F 0F2013 STA res
|
||||||
|
00042 B400 CLEAR A
|
||||||
|
. +5
|
||||||
|
00044 03200E LDA res
|
||||||
|
00047 190005 ADD #5
|
||||||
|
0004A 0F2008 STA res
|
||||||
|
0004D B400 CLEAR A
|
||||||
|
0004F 3F2FFD HALT J HALT
|
||||||
|
00052 END POLY
|
||||||
|
|
||||||
|
00052 000002 x WORD 2
|
||||||
|
00055 000000 res RESW 1
|
||||||
5
vaja2/osnove/poly.obj
Normal file
5
vaja2/osnove/poly.obj
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
HPOLY 000000000058
|
||||||
|
T0000001E03204F23204C2320492320460F2046B40003203E23203B2320382100021B
|
||||||
|
T00001E1E20350F2032B40003202A2320272100031B20240F2021B400032019210004
|
||||||
|
T00003C191B20160F2013B40003200E1900050F2008B4003F2FFD000002
|
||||||
|
E000000
|
||||||
11
vaja2/osnove/primer.asm
Normal file
11
vaja2/osnove/primer.asm
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
primer START 0
|
||||||
|
. kaj naredi naslednji programček?
|
||||||
|
first LDA #42
|
||||||
|
ADD x
|
||||||
|
STA x
|
||||||
|
. kaj dela naslednji ukaz
|
||||||
|
halt J halt
|
||||||
|
. podatki
|
||||||
|
x WORD 22
|
||||||
|
END first
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue