PAGE 60,80 STSG SEGMENT PARA STACK 'STACK' DW 12 DUP(0) STSG ENDS DATASG SEGMENT PARA 'DATA' ILK DW 1 IKI DW 1 UC DW ? BULUNCAK DW 10 DATASG ENDS CODESG SEGMENT PARA 'CODE' ASSUME CS:CODESG,SS:STSG,DS:DATASG MAIN PROC FAR PUSH DS XOR AX,AX PUSH AX MOV AX,DATASG MOV DS,AX MOV AX,ILK MOV BX,IKI MOV CX,BULUNCAK SUB CX,2;dongumuz 3'ten sayiya eşit olana kadar döner L1: MOV UC,AX ADD UC,BX MOV AX,BX MOV BX,UC LOOP L1 MOV AX,UC RETF MAIN ENDP CODESG ENDS END MAIN
LST Çıktısı :
Microsoft (R) Macro Assembler Version 5.00 11/17/13 04:51:25
Page 1-1
PAGE 60,80
0000 STSG SEGMENT PARA STACK 'STACK'
0000 000C[ DW 12 DUP(0)
0000
]
0018 STSG ENDS
0000 DATASG SEGMENT PARA 'DATA'
0000 0001 ILK DW 1
0002 0001 IKI DW 1
0004 ???? UC DW ?
0006 000A BULUNCAK DW 10
0008 DATASG ENDS
0000 CODESG SEGMENT PARA 'CODE'
ASSUME CS:CODESG,SS:STSG,DS:DATASG
0000 MAIN PROC FAR
0000 1E PUSH DS
0001 33 C0 XOR AX,AX
0003 50 PUSH AX
0004 B8 ---- R MOV AX,DATASG
0007 8E D8 MOV DS,AX
0009 A1 0000 R MOV AX,ILK
000C 8B 1E 0002 R MOV BX,IKI
0010 8B 0E 0006 R MOV CX,BULUNCAK
0014 83 E9 02 SUB CX,2
0017 L1:
0017 A3 0004 R MOV UC,AX
001A 01 1E 0004 R ADD UC,BX
001E 8B C3 MOV AX,BX
0020 8B 1E 0004 R MOV BX,UC
0024 E2 F1 LOOP L1
0026 A1 0004 R MOV AX,UC
0029 CB RETF
002A MAIN ENDP
002A CODESG ENDS
END MAIN
Microsoft (R) Macro Assembler Version 5.00 11/17/13 04:51:25
Symbols-1
Segments and Groups:
N a m e Length Align Combine Class
CODESG . . . . . . . . . . . . . 002A PARA NONE 'CODE'
DATASG . . . . . . . . . . . . . 0008 PARA NONE 'DATA'
STSG . . . . . . . . . . . . . . 0018 PARA STACK 'STACK'
Symbols:
N a m e Type Value Attr
BULUNCAK . . . . . . . . . . . . L WORD 0006 DATASG
IKI . . . . . . . . . . . . . . L WORD 0002 DATASG
ILK . . . . . . . . . . . . . . L WORD 0000 DATASG
L1 . . . . . . . . . . . . . . . L NEAR 0017 CODESG
MAIN . . . . . . . . . . . . . . F PROC 0000 CODESG Length = 002A
UC . . . . . . . . . . . . . . . L WORD 0004 DATASG
@FILENAME . . . . . . . . . . . TEXT DEM
33 Source Lines
33 Total Lines
14 Symbols
51062 + 461290 Bytes symbol space free
0 Warning Errors
0 Severe Errors
16 Kasım 2013 Cumartesi
Assemblyde fibonacci
Assembly 80x86 dizi içindeki en büyük eleman
PAGE 60,80
TITLE ENBUYUK
STACKSG SEGMENT PARA STACK 'STACK'
DW 32 DUP(0)
STACKSG ENDS
DATASG SEGMENT PARA 'DATA'
ADIZI DW 13,81,11,22 ;Dizi Elemanlari
SZ DW 4 ;Dizinin Sizeini tutar
ENBUYUK DW (0) ;En buyuk sayi
DATASG ENDS
CODESG SEGMENT PARA 'CODE'
ASSUME CS:CODESG,DS:DATASG,SS:STACKSG
MAIN PROC FAR
PUSH DS
XOR AX,AX
PUSH AX
MOV AX,DATASG
MOV DS,AX
MOV AX,ENBUYUK ;AX e en buyuk sayisi atanır
MOV CX,SZ ; CX e size atanır
LEA SI,ADIZI; ADIZI degiskeninin adresi SI ya atanır
L1:
MOV DI,[SI] ;DI ya adresteki değişken atanır ve büyük,küçük kontrol edilir.
CMP DI,AX
JA BUYUKMUS
JMP EXIT
BUYUKMUS:
MOV AX,DI;buyukse AX registerina DI daki değer atanır
MOV ENBUYUK,AX
EXIT:
ADD SI,2;DW olduğundan dolayı dizi elemanlarımız 2 2 artmaktadır
LOOP L1;CX(SZ değerinde) 0 olana kadar döner
RETF
MAIN ENDP
CODESG ENDS
END MAIN
Kaydol:
Kayıtlar (Atom)