fixed ass2
This commit is contained in:
parent
c707e3253c
commit
1bbc80de29
37 changed files with 753 additions and 18 deletions
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
arith START 0
|
||||
|
||||
start LDA x
|
||||
|
|
|
|||
21
ass1/fact.log
Normal file
21
ass1/fact.log
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
***** Section <default> *****
|
||||
Stats: size=3127 blocks=3127 symbols=10 literals=0 relocations=0
|
||||
Blocks
|
||||
name start size #ins #dir #sto
|
||||
<default> 00000 00C37 41 4 1
|
||||
Symbols
|
||||
name hex dec scope kind type description
|
||||
fact 00000C 12 local relative code label
|
||||
halt 000009 9 local relative code label
|
||||
prog 000000 0 exported relative code label
|
||||
rec 000018 24 local relative code label
|
||||
sinit 000046 70 local relative code label
|
||||
spop 000067 103 local relative code label
|
||||
spush 000055 85 local relative code label
|
||||
stkA 00007C 124 local relative data label
|
||||
stkRESW 00007F 127 local relative data label
|
||||
stkp 000079 121 local relative data label
|
||||
Literals
|
||||
label definition
|
||||
Relocations
|
||||
address length flag symbol
|
||||
66
ass1/fact.lst
Normal file
66
ass1/fact.lst
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
00000 prog START 0
|
||||
00000 4B2043 JSUB sinit
|
||||
00003 010005 LDA #5
|
||||
00006 4B2003 JSUB fact
|
||||
|
||||
|
||||
|
||||
00009 3F2FFD halt J halt
|
||||
|
||||
. fakulteta
|
||||
0000C 290001 fact COMP #1
|
||||
0000F 372006 JGT rec
|
||||
00012 010001 LDA #1 . base case
|
||||
00015 4F0000 RSUB
|
||||
|
||||
00018 16205E rec STL @stkp
|
||||
0001B 4B2037 JSUB spush
|
||||
0001E 0E2058 STA @stkp
|
||||
00021 4B2031 JSUB spush
|
||||
00024 7A2052 STB @stkp
|
||||
00027 4B202B JSUB spush
|
||||
|
||||
0002A AC03 RMO A,B . shrani n v B
|
||||
0002C 1D0001 SUB #1 . n-1
|
||||
0002F 4B2FDA JSUB fact . fact(n-1)
|
||||
00032 9830 MULR B,A . n * fact(n-1)
|
||||
|
||||
00034 4B2030 JSUB spop
|
||||
00037 6A203F LDB @stkp
|
||||
0003A 4B202A JSUB spop
|
||||
. LDA @stkp da ne povozimo odgovora?
|
||||
0003D 4B2027 JSUB spop
|
||||
00040 0A2036 LDL @stkp
|
||||
|
||||
|
||||
|
||||
00043 4F0000 RSUB
|
||||
|
||||
|
||||
. rutine za sklad
|
||||
00046 0F2033 sinit STA stkA
|
||||
00049 012033 LDA #stkRESW . inicializiraj stkp
|
||||
0004C 0F202A STA stkp
|
||||
0004F 03202A LDA stkA
|
||||
00052 4F0000 RSUB
|
||||
|
||||
00055 0F2024 spush STA stkA
|
||||
00058 03201E LDA stkp . poveca stkp za 3
|
||||
0005B 190003 ADD #3
|
||||
0005E 0F2018 STA stkp
|
||||
00061 032018 LDA stkA
|
||||
00064 4F0000 RSUB
|
||||
|
||||
00067 0F2012 spop STA stkA
|
||||
0006A 03200C LDA stkp . zmanjsa stkp za 3
|
||||
0006D 1D0003 SUB #3
|
||||
00070 0F2006 STA stkp
|
||||
00073 032006 LDA stkA
|
||||
00076 4F0000 RSUB
|
||||
|
||||
. podatki za sklad
|
||||
00079 000000 stkp WORD 0
|
||||
0007C 000000 stkA WORD 0
|
||||
0007F 00....00 stkRESW RESW 1000
|
||||
|
||||
00C37 END prog
|
||||
7
ass1/fact.obj
Normal file
7
ass1/fact.obj
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
Hprog 000000000C37
|
||||
T0000001E4B20430100054B20033F2FFD2900013720060100014F000016205E4B2037
|
||||
T00001E1E0E20584B20317A20524B202BAC031D00014B2FDA98304B20306A203F4B20
|
||||
T00003C1E2A4B20270A20364F00000F20330120330F202A03202A4F00000F20240320
|
||||
T00005A1E1E1900030F20180320184F00000F201203200C1D00030F20060320064F00
|
||||
T0000780700000000000000
|
||||
E000000
|
||||
|
|
@ -17,7 +17,7 @@ start LDT x4
|
|||
MULR S, A
|
||||
ADDR T, A .do sedaj izračunano (((1x+2)x + 3)x + 4)x + 5
|
||||
|
||||
|
||||
.fullline comment
|
||||
STA rez
|
||||
|
||||
halt J halt
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue