Gazi Üniversitesi Bilgisayar Mühendislii Bölümü

Size: px
Start display at page:

Download "Gazi Üniversitesi Bilgisayar Mühendislii Bölümü"

Transcription

1 !"!"!#$ %%% % % %% % % & ' ( )$)!"!#*!"!!'!"+!#*!"+!!'!",!#'!"-!#'!".!#' / ' / / /) ' / ((' / (((' /.) ) '/ '( 1)23 4'/ ) 5'(6"+-+73."3#',""#& 8 & ' 6' 6'!"!!!"!# )$) / ' ( 1)' 619 ' 5 9 ' $$)2. 4'/ ) 5 '"+-"7-"!+.',"",& ':) $ ' & ':) < $ '!"=!#( /<< $ < $ > '? '( 1)2. 4'/ ) 5 ',"",& 1

2 #$# # %&#& ' ='='<='?='6('?('/'6/ ( %&#& ' (/'@>AB(6BAC>A( # #& '& <6'?6'B6'66 ) * # ='='<='?='5'>'>'5'<5'<>'?5'?>'?('6('/'6/& #?6'B6'66'<62 ) )$ 4& +, + D=E'D=F6(F3E' '& + +,-.,G',.'-@'+"""++"+'& $/&* H $& $& H )%%& 1 H % %%2 4& 23 $ 4 ORG 1h MOV AL, var1 MOV BX, var2 program durur VAR1 DB 7 var2 DW 1234h ( a DB 48h, 65h, 6Ch, 6Ch, 6Fh, h b DB 'Hello', 2

3 MOV AL, a[3] MOV S, 3 MOV AL, a[s] ) 5,.67 )2 4 c DB 5 DUP(9) c DB 9, 9, 9, 9, 9 d DB 5 DUP(1, 2) d DB 1, 2, 1, 2, 1, 2, 1, 2, 1, J1 K k EQU 5 MOV AX, k MOV AX, 5 $/$ <H<@ 6 H6@ H /H/@ HM@ ( ( $@?? )@ 9 & /N 65'//'>B'>?6'>?6'>?6'>?68 '66'66'668 ' O6' O6' O68 '( 6'( 6' ( 68 'N 6'N 6'N 68 '=<5 '>5@'65@'=>'('N & &??'( <'?<'6N '?B<'6'< /' N >'( N >P?(O'(?(O'<8 '<8?'?'?6''?' '6'?'A'=A'B6' ' B'65 >'65 A'6>'6A'A>'A<>'A<A'AA'6<6'< /6 )# & : /':':B':':B':<':B':L':':B':>':>B': <': B': L': <': B': L': ': 6':/':/' :':/':/B':6':<=L'>/'<>>'( '(5 >' / 3

4 #$# ) & $ %6<(( $& <?%Q% % $ %5 > & if low nibble of AL > 9 or AF = 1 then AL = AL + 6 AH = AH + 1 AF = 1 CF = 1 AF = CF = P >C%1%%& MOV AX, 15 AH =, AL = Fh AAA AH = 1, AL = 5 < L 6 / R R R R %6<(( $& P<? Q%& AL = (AH * 1) + AL AH = MOV AX, 15h AH = 1, AL = 5 AAD AH =, AL = Fh (15) < L 6 / R R R 4

5 : 'AB AB ' S$ %6<(( $& P<? Q$ ) & AH = AL / 1 AL = remainder MOV AL, 15 AL = Fh AAM AH = 1, AL = 5 < L 6 / R R R S% %6<(( $& <?%Q% % Q% %5 > & if low nibble of AL > 9 or AF = 1 then AL = AL - 6 AH = AH - 1 AF = 1 CF = 1 AF = CF = P >C%1%%& MOV AX, 2FFh AH = 2, AL = FFh AAS AH = 1, AL = 9 < L 6 / R R R R $ $& operand1 = operand1 + operand2 MOV AL, 5 AL = 5 ADD AL, -3 AL = 2 < L 6 / 5

6 : :$4 'AB AB ' $). P$ % %%% %OB $ )$ &? 1 AND 1 = 1 1 AND = AND 1 = AND = MOV AL, 'a' AL = 111b AND AL, b AL = 11b ('A') < L 6 / " " $ Q%% 2(/4)C$ &. %Q% $%&+,-.G#3! ) 11 &1Q% % (/ <6)C$ & ORG 1h for COM file. CALL p1 ADD AX, 1 return to DOS. p1 PROC procedure declaration. MOV AX, 1234h return to caller. p1 ENDP < L 6 / 9 C Q & if high bit of AL = 1 then AH = 255 (FFh) AH = MOV AX, AH =, AL = MOV AL, -5 AX = FBh (251) CBW AX = FFFBh (-5) < L 6 / 6

7 :: : :& :: %2<14%1%%& CF = < "? )%2? )14%1%%&6(?( C%< /6' < /68 '>?6'>?68 ' O6' O68 '66'668 %$% %%%& DF =? " ( $ %2( $ 14%1%%& % $C%% $& F = ( " %2<14 2) $ 4& if CF = 1 then CF = if CF = then CF = 1 < A 7

8 :) :)$ :)4 'AB AB ' T % % $&6$ C% Q%%) $ ) & operand1 - & MOV AL, 5 MOV BL, 5 CMP AL, BL AL=5, ZF=1 (eit) < L 6 / B6D?(E?6D6(E% %%%& DS:[S] - & if DF = then S = S + 1 D = D + 1 S = S - 1 D = D - 1 < L 6 / B6D?(E?6D6(E%9 %%%& DS:[S] - & if DF = then S = S + 2 D = D + 2 S = S - 2 D = D - 2 < L 6 / 8

9 :4 P %9 9 & if high bit of AX = 1 then DX = (FFFFh) DX = MOV DX, DX = MOV AX, AX = MOV AX, -5 DX AX = h:fffbh CWD DX AX = FFFFh:FFFBh < L 6 / $ % $& P<? $ ) & if low nibble of AL > 9 or AF = 1 then AL = AL + 6 AF = 1 if AL > 9Fh or CF = 1 then AL = AL + 6h CF = 1 MOV AL, Fh AL = Fh (15) DAA AL = 15h < L 6 / S% % $& P<? Q% ) & if low nibble of AL > 9 or AF = 1 then AL = AL - 6 AF = 1 if AL > 9Fh or CF = 1 then AL = AL - 6h CF = 1 MOV AL, FFh AL = FFh (-1) DAS AL = 99h, CF = 1 < L 6 / 9

10 : & AB AB $& operand = operand - 1 MOV AL, 255 AL = FFh (255 or -1) DEC AL AL = FEh (254 or -2) < L 6 / <@ U P $& operand byte ise: AL = AX / operand AH = remainder (kalan) operand word ise: AX = (DX AX) / operand DX = remainder (kalan) MOV AX, 23 AX = CBh MOV BL, 4 DV BL AL = 5 (32h), AH = 3 < L 6 / R R R R R R / $%%& MOV AX, 5 HLT < L 6 / 1

11 && & & AB AB >' & >'?= =' & ='?= P $& operand byte ise: AL = AX / operand AH = remainder (kalan) operand word ise: AX = (DX AX) / operand DX = remainder (kalan) MOV AX, -23 AX = FF35h MOV BL, 4 DV BL AL = -5 (CEh), AH = -3 (FDh) < L 6 / R R R R R R P Q$ $& operand byte ise: AX = AL * operand operand word ise: (DX AX) = AX * operand MOV AL, -2 MOV BL, -4 MUL BL AX = 8 < L 6 / R R R R 6Q$ <@V@V"%1%& > =C $ %& P)$ $ %%& 6 )$ $ &B,GG $?= C%%%& N AX, 4 get status of traffic lights. N AL, 7 get status of stepper-motor. < L 6 / 11

12 &: & & AB % $& operand = operand + 1 MOV AL, 4 NC AL AL = 5 L 6 / <@ U $ $C%Q% %%& 6)C$ C% <6 (/ (@V" / % %% $$ % MOV AH, Eh teletype. MOV AL, 'A' NT 1h BOS interrupt. < L 6 / ( " 19 %+ $.CQ% %& if OF = 1 then NT = -132 (not in ) the result of SUB is wrong (124), so OF = 1 is set: MOV AL, -5 SUB AL, 127 AL = 7Ch (124) NTO process error. 12

13 & < ( $ & Stack tan pop et: P CS flags register < L 6 / $$ B )$ ) % 2W $$4& P % % $& if (CF = ) and (ZF = ) then jump include 'emu886.inc' ORG 1h MOV AL, 25 CMP AL, 5 JA etiket1 PRNT 'AL 5 ten büyük deil' PRNT 'AL 5 ten büyük' < L 6 / 13

14 < <$ B )$ ) % 2 W $$4&P % % $& if CF = then jump include 'emu886.inc' ORG 1h MOV AL, 5 CMP AL, 5 JAE etiket1 PRNT 'AL is not above or equal to 5' PRNT 'AL is above or equal to 5' < L 6 / B )$ ) Q % 2W $$4& P % % $& if CF = 1 then jump include 'emu886.inc' ORG 1h MOV AL, 1 CMP AL, 5 JB etiket1 PRNT 'AL is not below 5' PRNT 'AL is below 5' < L 6 / 14

15 <$ <: B )$ ) Q % 2 W $$4&P % % $& if CF = 1 or ZF = 1 then jump include 'emu886.inc' ORG 1h MOV AL, 5 CMP AL, 5 JBE etiket1 PRNT 'AL is not below or equal to 5' PRNT 'AL is below or equal to 5' < L 6 / + % $& if CF = 1 then jump include 'emu886.inc' ORG 1h MOV AL, 255 ADD AL, 1 JC etiket1 PRNT 'tama yok' PRNT tama var' < L 6 / 15

16 <:=( < <= C%+ % $& if CX = then jump include 'emu886.inc' ORG 1h MOV CX, JCXZ etiket1 PRNT 'CX sıfır deildir.' PRNT 'CX sıfırdır.' < L 6 / B )$ )$ % 2W $ $4&P % % $& if ZF = 1 then jump include 'emu886.inc' ORG 1h MOV AL, 5 CMP AL, 5 JE etiket1 PRNT 'AL 5 e eit deil.' PRNT 'AL 5 e eit.' < L 6 / 16

17 <# <# B )$ ) % 2 W $$4&P % % $& if (ZF = ) and (SF = OF) then jump include 'emu886.inc' ORG 1h MOV AL, 5 CMP AL, -5 JG etiket1 PRNT 'AL -5 ten büyük deildir.' PRNT ' AL -5 ten büyüktür.' < L 6 / B )$ ) % 2 W $$4&P % % $& if SF = OF then jump include 'emu886.inc' ORG 1h MOV AL, 2 CMP AL, -5 JGE etiket1 PRNT 'AL < -5' PRNT 'AL >= -5' < L 6 / 17

18 < < B )$ ) Q % 2W $$4& P % % $& if SF <> OF then jump include 'emu886.inc' ORG 1h MOV AL, -2 CMP AL, 5 JL etiket1 PRNT 'AL >= 5.' PRNT 'AL < 5.' < L 6 / B )$ ) Q % 2 W $$4&P % % $& if SF <> OF or ZF = 1 then jump include 'emu886.inc' ORG 1h MOV AL, -2 CMP AL, 5 JLE etiket1 PRNT 'AL > 5.' PRNT 'AL <= 5.' < L 6 / 18

19 < ) <. X% $&. +,-.G#3! &P ) 11 & always jump include 'emu886.inc' ORG 1h MOV AL, 5 JMP etiket1 jump over 2 lines! PRNT 'Not Jumped!' MOV AL, PRNT 'Got Here!' < L 6 / B )$ ) % 2W $4 $&P % % $& if CF = 1 or ZF = 1 then jump include 'emu886.inc' ORG 1h MOV AL, 2 CMP AL, 5 JNA etiket1 PRNT 'AL is above 5.' PRNT 'AL is not above 5.' < L 6 / 19

20 < <$ B )$ ) % 2W $4$&P % % $& if CF = 1 then jump include 'emu886.inc' ORG 1h MOV AL, 2 CMP AL, 5 JNAE etiket1 PRNT 'AL >= 5.' PRNT 'AL < 5.' < L 6 / B )$ ) Q % 2W $4 $&P % % $& if CF = then jump include 'emu886.inc' ORG 1h MOV AL, 7 CMP AL, 5 JNB etiket1 PRNT 'AL < 5.' PRNT 'AL >= 5.' < L 6 / 2

21 <$ <: B )$ ) Q % 2W $4$&P % % $& if (CF = ) and (ZF = ) then jump include 'emu886.inc' ORG 1h MOV AL, 7 CMP AL, 5 JNBE etiket1 PRNT 'AL <= 5.' PRNT 'AL > 5.' < L 6 / 2)14" % 2W $4$& if CF = then jump include 'emu886.inc' ORG 1h MOV AL, 2 ADD AL, 3 JNC etiket1 PRNT 'has carry.' PRNT 'no carry.' < L 6 / 21

22 < <# B )$ ) % 2W $4 $&P % % $& if ZF = then jump nclude 'emu886.inc' ORG 1h MOV AL, 2 CMP AL, 3 JNE etiket1 PRNT 'AL = 3.' PRNT 'Al <> 3.' < L 6 / B )$ ) % 2W $4 $&P % % $& if (ZF = 1) and (SF <> OF) then jump include 'emu886.inc' ORG 1h MOV AL, 2 CMP AL, 3 JNG etiket1 PRNT 'AL > 3.' PRNT 'Al <= 3.' < L 6 / 22

23 <# < B )$ ) % 2W $4$&P % % $& if SF <> OF then jump include 'emu886.inc' ORG 1h MOV AL, 2 CMP AL, 3 JNGE etiket1 PRNT 'AL >= 3.' PRNT 'Al < 3.' < L 6 / B )$ ) Q % 2W $4 $&P % % $& if SF = OF then jump include 'emu886.inc' ORG 1h MOV AL, 2 CMP AL, -3 JNL etiket1 PRNT 'AL < -3.' PRNT 'Al >= -3.' < L 6 / 23

24 < < B )$ ) Q % 2W $4$&P % % $& if (SF = OF) and (ZF = ) then jump include 'emu886.inc' ORG 1h MOV AL, 2 CMP AL, -3 JNLE etiket1 PRNT 'AL <= -3.' PRNT 'Al > -3.' < L 6 / 19 " % 2W $4$& if OF = then jump -5-2 = -7 (inside ) the result of SUB is correct, so OF = : include 'emu886.inc' ORG 1h MOV AL, -5 SUB AL, 2 AL = F9h (-7) JNO etiket1 PRNT 'overflow!' PRNT 'no overflow.' < L 6 / 24

25 <) < /2 4" 2 4% 2W $4$& 6 ) $! &< /'6N '??' B6'?'A'=A % & if PF = then jump include 'emu886.inc' ORG 1h MOV AL, 111b AL = 7 OR AL, just set flags. JNP etiket1 PRNT 'parity even.' PRNT 'parity odd.' < L 6 / P $14% 2W $4 $&< /'6N '??'B6'?'A'=A % & if SF = then jump include 'emu886.inc' ORG 1h MOV AL, 111b AL = 7 OR AL, just set flags. JNS etiket1 PRNT 'signed.' PRNT 'not signed.' < L 6 / 25

26 <( < 2$14% 2W $4$& < /'6N '??'B6'?'A'=A % & if ZF = then jump include 'emu886.inc' ORG 1h MOV AL, 111b AL = 7 OR AL, just set flags. JNZ etiket1 PRNT 'zero.' PRNT 'not zero.' < L 6 / 19 2@4+ % 2W $4$& if OF = 1 then jump = -132 (not in ) the result of SUB is wrong (124), so OF = 1 is set: include 'emu886.inc' org 1h MOV AL, -5 SUB AL, 127 AL = 7Ch (124) JO etiket1 PRNT 'no overflow.' PRNT 'overflow!' < L 6 / 26

27 <) <) / Q14% 2W $4 $&6 ) $! &< /'6N '??'B6'?'A'=A % & if PF = 1 then jump include 'emu886.inc' ORG 1h MOV AL, 11b AL = 5 OR AL, just set flags. JP etiket1 PRNT 'parity odd.' PRNT 'parity even.' < L 6 / /Q1 2 4% 2W $4$&6 ) $! &< /'6N '??'B6'?'A'=A % & if PF = 1 then jump include 'emu886.inc' ORG 1h MOV AL, 11b AL = 5 OR AL, just set flags. JPE etiket1 PRNT 'parity odd.' PRNT 'parity even.' < L 6 / 27

28 <) < / 24% 2W $4$&6 ) $! &< /'6N '??'B6'?'A'=A % & if PF = then jump include 'emu886.inc' ORG 1h MOV AL, 111b AL = 7 OR AL, just set flags. JPO etiket1 PRNT 'parity even.' PRNT 'parity odd.' < L 6 / % 2W $4$&< /' 6N '??'B6'?'A'=A % & if SF = 1 then jump include 'emu886.inc' ORG 1h MOV AL, 1b AL = -128 OR AL, just set flags. JS etiket1 PRNT 'not signed.' PRNT 'signed.' < L 6 / 28

29 <( 9 B %1% 2L@V+4% 2W $4$&< /'6N '??' B6'?'A'=A % & if ZF = 1 then jump include 'emu886.inc' ORG 1h MOV AL, 5 CMP AL, 5 JZ etiket1 PRNT 'AL is not equal to 5.' PRNT 'AL is equal to 5.' < L 6 / 5 C% C%%21 4 $!C & AH = flags register AH: [SF] [ZF] [] [AF] [] [PF] [1] [CF] 1, 3, 5 bitleri ayrılmıtır. < L 6 / 5 1%% 9 % 1$ C?6C & REG = first word DS = second word ORG 1h LDS AX, m m DW 1234h DW 5678h END AX is set to 1234h, DS is set to 5678h. < L 6 / 29

30 B1 1 & REG = adres of memory (offset) ORG 1h LEA AX, m m DW 1234h END =C "+". %& >B - 'AB + C%&"+"" %%Q C "+".& < L 6 / 5 1%% 9 % 1$ C B6C & REG = first word ES = second word ORG 1h LES AX, m m DW 1234h DWG#3! END = C%% +,-. B6 C%% G#3!& < L 6 / 3

31 $ 4 > C%?6D6(E &6( ) 2+%%%2?V"4'+%%2?V+44 AL = DS:[S] if DF = then S = S + 1 S = S - 1 ORG 1h LEA S, a1 MOV CX, 5 MOV AH, Eh m: LODSB NT 1h LOOP m a1 DB 'H', 'e', 'l', 'l', 'o' < L 6 / = C%?6D6(E 9 &6( ) 2,%%%2?V"4',%%2?V+44 AX = DS:[S] if DF = then S = S + 2 S = S - 2 ORG 1h LEA S, a1 MOV CX, 5 REP LODSW finally there will be 555h in AX. a1 dw 111h, 222h, 333h, 444h, 555h < L 6 / 31

32 ) ) <=%% <=%1% %& CX = CX - 1 if CX <> then jump no jump, continue include 'emu886.inc' ORG 1h MOV CX, 5 PRNTN 'loop!' LOOP etiket1 < L 6 / <=%% <=%1% 2 $ %42L@V+4 & CX = CX - 1 if (CX <> ) and (ZF = 1) then jump no jump, continue Loop until result fits into AL alone, or 5 times. The result will be over 255 on third loop (1+1+1), so loop will exit. include 'emu886.inc' ORG 1h MOV AX, MOV CX, 5 PUTC '*' ADD AX, 1 CMP AH, LOOPE etiket1 < L 6 / 32

33 ) )( <=%% <=%1% 2 $ %42L@V"4 CX = CX - 1 if (CX <> ) and (ZF = ) then jump no jump, continue Loop until '7' is found, or 5 times. include 'emu886.inc' ORG 1h MOV S, MOV CX, 5 PUTC '*' MOV AL, v1[s] NC S next byte (S=S+1). CMP AL, 7 LOOPNE etiket1 v1 db 9, 8, 7, 6, 5 < L 6 / <=%% <=%1% L@V" & CX = CX - 1 if (CX <> ) and (ZF = ) then jump no jump, continue Loop until '7' is found, or 5 times. include 'emu886.inc' ORG 1h MOV S, MOV CX, 5 PUTC '*' MOV AL, v1[s] NC S next byte (S=S+1). CMP AL, 7 LOOPNZ etiket1 v1 db 9, 8, 7, 6, 5 < L 6 / 33

34 )( 'AB AB ' 6 '6AB 6AB 6AB <=%% <=%1% L@V+ & CX = CX - 1 if (CX <> ) and (ZF = 1) then jump no jump, continue Loop until result fits into AL alone, or 5 times. The result will be over 255 on third loop (1+1+1), so loop will exit. include 'emu886.inc' ORG 1h MOV AX, MOV CX, 5 PUTC '*' ADD AX, 1 CMP AH, LOOPZ etiket1 < L 6 / P)$ )$ $%& O <6 (/ C% & P C%% % 2) Q% C% %%4& operand1 = operand2 ORG 1h MOV AX, B8h set AX = B8h (VGA memory). MOV DS, AX copy value of AX to DS. MOV CL, 'A' CL = 41h (ASC code). MOV CH, b CL = color attribute. MOV BX, 15Eh BX = position on screen. MOV [BX], CX w.[b8h:15eh] = CX. returns to operating system. < L 6 / 34

35 $ 4?6D6(E B6D?(E $&6(?( C%) & ES:[D] = DS:[S] if DF = then S = S + 1 D = D + 1 S = S - 1 D = D - 1 ORG 1h LEA S, a1 LEA D, a2 MOV CX, 5 REP MOVSB a1 DB 1,2,3,4,5 a2 DB 5 DUP() < L 6 /?6D6(E B6D?(E 9 $&6(?( C%) & ES:[D] = DS:[S] if DF = then S = S + 2 D = D + 2 S = S - 2 D = D - 2 ORG 1h LEA S, a1 LEA D, a2 MOV CX, 5 REP MOVSW a1 DW 1,2,3,4,5 a2 DW 5 DUP() < L 6 / 35

36 # ) AB AB P Q$ $& operand byte ise: AX = AL * operand. operand word ise: (DX AX) = AX * operand. MOV AL, 2 AL = C8h MOV BL, 4 MUL BL AX = 32h (8) < L 6 / R R R R <@V@V"9 )1 & %% 2 4& nvert all bits of the operand Add 1 to inverted operand MOV AL, 5 AL = 5h NEG AL AL = FBh (-5) NEG AL AL = 5h (5) < L 6 / P $ & Do nothing do nothing, 3 times: NOP NOP NOP < L 6 / 36

37 AB 'AB AB ' & '> & '=?='>?='= $ 2 4& if bit is 1 turn it to. if bit is turn it to 1. MOV AL, 1111b NOT AL AL = 1111b < L 6 / P$ %%% Q % $&? 1 OR 1 = 1 1 OR = 1 OR 1 = 1 OR = MOV AL, 'A' AL = 11b OR AL, 1b AL = 111b ('a') < L 6 / " " R > = C% $ & P$ $ %%&B,GGC $?= C%%%& MOV AX, FFFh Turn on all OUT 4, AX traffic lights. MOV AL, 1b Turn on the third OUT 7, AL magnet of the stepper-motor. < L 6 / 37

38 )) )) ))9 AB 6AB 6)C+# % $ %& operand = SS:[SP] (stack ın en üstü) SP = SP + 2 MOV AX, 1234h PUSH AX POP DX DX = 1234h < L 6 / Q% C%2?('6('/'6/'='?=' <='=4)C$$ &6/ % & )!"+!# ) %%& POP D POP S POP BP POP xx (SP gözardı edilir) POP BX POP DX POP CX POP AX < L 6 C%)C $$ & flags = SS:[SP] (top of the stack) SP = SP + 2 < L 6 / /$ 38

39 ) ) )9 AB 6AB +# )C%& 6 +# )& /N65 )!"+!# ) %%& SP = SP - 2 SS:[SP] (top of the stack) = operand MOV AX, 1234h PUSH AX POP DX DX = 1234h < L 6 / Q% C%2='<='?='='6/' /'6('?(4)C$ &6/ C%%/N 65 ) %%& )!"+!# ) %%& PUSH AX PUSH CX PUSH DX PUSH BX PUSH SP PUSH BP PUSH S PUSH D < L 6 C%)C& SP = SP - 2 SS:[SP] (top of the stack) = flags < L 6 / 39

40 : : ) ' '<> <> ' '<> <> ) )$ % %2)14 & %%)$ & shift all bits left, the bit that goes off is set to CF and previous value of CF is inserted to the right-most position. STC set carry (CF=1). MOV AL, 1Ch AL = 111b RCL AL, 1 AL = 1111b, CF=. )$ & )$ % %2)14 & %%)$ & shift all bits right, the bit that goes off is set to CF and previous value of CF is inserted to the left-most position. STC set carry (CF=1). MOV AL, 1Ch AL = 111b RCR AL, 1 AL = 1111b, CF=. )$ & O6' O68 '>?6'>?68 '66'668 %%<= 1 & check_cx: if CX <> then do following chain instruction CX = CX - 1 go back to check_cx exit from REP cycle L 4

41 ) ) )( ) ) ) < /6'< /68 '6<6'6<68 %%L@V+ ) 2Q 4 1<= & check_cx: if CX <> then do following chain instruction CX = CX - 1 if ZF = 1 then m go back to check_cx m exit from REPE cycle exit from REPE cycle L < /6'< /68 '6<6'6<68 %%L@V" ) 2Q 4 1<= & check_cx: if CX <> then do following chain instruction CX = CX - 1 if ZF = then go back to check_cx m exit from REPNE cycle exit from REPNE cycle L < /6'< /68 '6<6'6<68 %%L@V" ) 2Q %1% 4 1<= & check_cx: if CX <> then do following chain instruction CX = CX - 1 if ZF = then m go back to check_cx m exit from REPNZ cycle exit from REPNZ cycle L 41

42 )( 9 ) < /6'< /68 '6<6'6<68 %%L@V+ ) 2Q %1%4 1<= & check_cx: if CX <> then do following chain instruction CX = CX - 1 if ZF = 1 then go back to check_cx exit from REPZ cycle exit from REPZ cycle L $ $& Pop from stack: P if immediate operand is present: SP = SP + operand ORG 1h for COM file. CALL p1 ADD AX, 1 return to OS. p1 PROC procedure declaration. MOV AX, 1234h return to caller. p1 ENDP < L 6 $& Pop from stack: P CS if immediate operand is present: SP = SP + operand < L 6 / 42

43 9 ' '<> <> ' '<> <> )$ %& %%)$ & shift all bits left, the bit that goes off is set to CF and the same bit is inserted to the right-most position. MOV AL, 1Ch AL = 111b ROL AL, 1 AL = 111b, CF=. )$ % & )$ %& %%)$ & shift all bits right, the bit that goes off is set to CF and the same bit is inserted to the left-most position& MOV AL, 1Ch AL = 111b ROR AL, 1 AL = 111b, CF=. )$ % & 5 C%1 C%% $!C & flags register = AH AH bit: [SF] [ZF] [] [AF] [] [PF] [1] [CF] 1, 3, 5 bitler ayrılmıtır. < L 6 / 43

44 $$ ' '<> <> ' '<> <> 'AB AB ' )$ % %%&T% %%) $ & Shift all bits left, the bit that goes off is set to CF. Zero bit is inserted to the right-most position. MOV AL, Eh AL = 111b SAL AL, 1 AL = 11b, CF=1. )$ & )$ % %%&T% %%) $ & Shift all bits right, the bit that goes off is set to CF. The sign bit that is inserted to the left-most position has the same value as before shift. MOV AL, Eh AL = 111b SAR AL, 1 AL = 1111b, CF=. MOV BL, 4Ch BL = 111b SAR BL, 1 BL = 111b, CF=. < Q Q% $& operand1 = operand1 - operand2 - CF STC MOV AL, 5 SBB AL, 3 AL = = 1 < L 6 / 44

45 :$ :4 ' '<> <> > B6D?(E % %%& ES:[D] - AL set flags according to result: OF, SF, ZF, AF, PF, CF if DF = then D = D + 1 D = D - 1 < L 6 / = B6D?(E % %%& ES:[D] - AX set flags according to result: OF, SF, ZF, AF, PF, CF if DF = then D = D + 2 D = D - 2 < L 6 / )$ %%%&T% %%)$ & Shift all bits left, the bit that goes off is set to CF. Zero bit is inserted to the right-most position. MOV AL, 111b SHL AL, 1 AL = 11b, CF=1. )$ & 45

46 : & ' '<> <> )$ %%%&T% %%)$ & Shift all bits right, the bit that goes off is set to CF. Zero bit is inserted to the left-most position. MOV AL, 111b SHR AL, 1 AL = 11b, CF=1. )$ & %2)14 & CF = 1 < + Y%2 )14 &< /6'< /68 '>?6'>?68 ' O6' O68 '66'668 %1%6(?(%% 2?V+4 %%%2?V"4& DF = 1? + T %2 $14 &% $C%% $& F = 1 ( + 46

47 $ 4 > C%% B6D?(E $&?() & ES:[D] = AL if DF = then D = D + 1 D = D - 1 ORG 1h LEA D, a1 MOV AL, 12h MOV CX, 5 REP STOSB a1 DB 5 dup() < L 6 / = C%% B6D?(E $&?() & ES:[D] = AX if DF = then D = D + 2 D = D - 2 ORG 1h LEA D, a1 MOV AX, 1234h MOV CX, 5 REP STOSW a1 DW 5 dup() < L 6 / 47

48 $ =:# 'AB AB ' 'AB AB ' 'AB AB S% $& operand1 = operand1 - operand2 MOV AL, 5 SUB AL, 1 AL = 4 < L 6 / P$ % %%% $ & $ % L@'6@ /@ &? 1 AND 1 = 1 1 AND = AND 1 = AND = MOV AL, 11b TEST AL, 1 ZF =. TEST AL, 1b ZF = 1. < L 6 / " " P$ % & operand1 < - > operand2 MOV AL, 5 MOV AH, 2 XCHG AL, AH AL = 2, AH = 5 XCHG AL, AH AL = 5, AH = 2 < L 6 / 48

49 = $ = 'AB AB ' Q &?6D=F >E > C%$& AL = DS:[BX + unsigned AL] ORG 1h LEA BX, dat MOV AL, 2 XLATB AL = 33h dat DB 11h, 22h, 33h, 44h, 55h < L 6 / P$ % %%% =A $%%&6Q) $ %&? 1 XOR 1 = 1 XOR = 1 XOR 1 = 1 XOR = MOV AL, 111b XOR AL, 1b AL = 11b < L 6 / " " R 49

50 hafizada yeralan ve herbirisi 2 rakamdan olusan 16'lik tabandaki iki sayinin toplamini yapar. ilk sayi 1h-19h ikinci sayi 1Ah-113h sonuc 114h-11Dh m.ali akcayol org 1h mov [1h],8A76h mov [12h],6557h mov [14h],1A98h mov [16h],713Eh mov [18h],8797h mov [1Ah],2587h mov [1Ch],8B96h mov [1Eh],2588h mov [11h],46D1h mov [112h],9854h mov si, 18h 1.sayinin en sagdaki 4 rakam (1 word) aliniyor mov bx,[si] add bx,[si+ah] 2.sayinin en sagdaki 4 rakami ile toplaniyor mov [si+14h],bx sonuc hafizaya yaziliyor jnc atla1 carry= ise atla mov dx,1 sub isleminden once carry dx'e saklaniyor atla1: sub si,2 sola dogru 4 rakam (1 word) gidiliyor dongu: mov bx,[si] 1.sayinin onceki 4 rakami (1 word) aliniyor add bx,[si+ah] 2.sayinin onceki 4 rakami ile toplaniyor add bx,dx varsa carry ekleniyor xor dx,dx saklanan carry degeri sifirlaniyor mov [si+14h],bx sonuc hafizaya yaziliyor jnc atla2 carry= ise atla mov dl,1 atla2: sub si,2 sola dogru 4 rakam (1 word) gidiliyor cmp si,1h en sola gelindimi? jae dongu gelinmediyse basa doner call mesajyaz hlt mesajyaz proc mov dx, offset mesajvar mov ah, 9 int 21h ret mesajvar db "toplama islemi tamamlandi... $" mesajyaz endp 5

51 hafizada yeralan toplam 1 karakterden ADET ile belirtilen kadarini kendi yerinde siralayan algoritma - bubblesort m.ali akcayol org 1h dizi db 'v','a','z','b','t','r','z','k','m','a' dizi1 db 'v','a','z','b','t','r','z','k','m','a' dizi2 db 'v','a','z','b','t','r','z','k','m','a' dizi3 db 'v','a','z','b','t','r','z','k','m','a' dizi4 db 'v','a','z','b','t','r','z','k','m','a' dizi5 db 'v','a','z','b','t','r','z','k','m','a' dizi6 db 'v','a','z','b','t','r','z','k','m','a' dizi7 db 'v','a','z','b','t','r','z','k','m','a' dizi8 db 'v','a','z','b','t','r','z','k','m','a' dizi9 db 'v','a','z','b','t','r','z','k','m','a' ADET dw 9 mov dx,adet call ekranayazdir ilk 1 karakter siralanir eleman sayisi-1 dongu: toplam eleman sayisi kadar tekrar mov cx, siralanmamis eleman sayisi icdongu: kalan eleman sayisi kadar tekrar mov si,cx mov al,[dizi+si] soldaki eleman mov bl,[dizi+si+1] sagdaki eleman cmp al,bl jbe devam soldaki kucukse degistrme yapma call degistir soldaki buyukse degistir devam: inc cx siralanmamis elemanlarda bir artir cmp cx,dx siralanmamis elemanlarin sonuna geldimi jnb icdongusonu siralanmamis elemanlarin sonu jmp icdongu siralanmamis eleman devam ediyor icdongusonu: ic dongude siralanmamis eleman kalmadi dec dx sirasiz kalan eleman sayisini bir azalt cmp dx, sirasiz eleman sayisi mi? je bitir sirasiz eleman sayisi ise bitir jmp dongu sirasiz eleman varsa basa git bitir: call ekranayazdir sirali yazdir hlt program bitisi degistir proc mov [dizi+si],bl mov [dizi+si+1],al ret degistir endp yanyana iki karakter yer degistirir ekranayazdir proc push dx dl ye deger atanacak mov cx, karakter sayaci mov ah, 2 int 21, ah=2, ekrana karakter yazdir tekrar: 51

52 mov si,cx mov dl, [dizi+si] int 21h inc cx cmp cx, ADET ja cikis jmp tekrar cikis: mov dl, Dh int 21h mov dl, Ah int 21h pop dx ret ekranayazdir endp int 21, ah=2, ekrana karakter yazdir return yeni satir dl nin eski degeri alindi 52

53 binary search --- sirali bir dizide en cok log(2)sayiadedi kadar kontrolle aranan sayinin olup olmadigini bulur m.ali akcayol org 1h mov [1h], 1 mov [11h], 2 mov [12h], 3 mov [13h], 4 mov [14h], 6 mov [15h], 8 mov [16h], 9 mov [17h], 1 mov [18h], 11 mov [19h], 13 mov [1Ah], 14 mov [1Bh], 15 mov [1Ch], 16 mov [1Dh], 17 mov [1Eh], 19 mov [1Fh], 2 mov [11h], 22 mov [111h], 23 mov [112h], 25 mov [113h], 27 mov [114h], 28 mov [115h], 3 mov dl,2 bolen mov dh,28 aranan sayi mov bx,1h en kucuk adres mov cx,115h en buyuk adres mov si,1h mov ax,cx eleman sayisi hesaplaniyor dec bx sub ax,bx div dl ortadaki sayi bulunuyor xor ah,ah kalan atiliyor add si,ax ortadaki sayinin adresi dongu: cmp [si],dh ortadaki sayi arananla karsilastiriliyor jb sagtaraf kucukse saga gidilir ja soltaraf buyukse sola gidilir je bulundu esitse bulunmustur sagtaraf: mov bx,si mov ax,cx eleman sayisi hesaplaniyor sub ax,bx div dl ortadaki sayi bulunuyor cmp al, jz kalanal1 xor ah,ah kalan atiliyor add si,ax ortadaki sayinin adresi 53

54 jmp dongu kalanal1: xchg al,ah add si,ax cmp [si],dh je bulundu jne sayiyok soltaraf: mov cx,si mov ax,cx sub ax,bx div dl cmp al, jz kalanal2 xor ah,ah sub si,ax jmp dongu kalanal2: xchg al,ah sub si,ax cmp [si],dh je bulundu jne sayiyok basa don son kalan eleman kontrol ediliyor eleman sayisi hesaplaniyor ortadaki sayi bulunuyor kalan atiliyor ortadaki sayinin adresi basa don son kalan eleman kontrol ediliyor yazdirma islemleri bulundu: mov dx, offset mesajvar mov ah, 9 int 21h ret mesajvar db "sayi bulundu $" jmp cikis sayiyok: mov dx, offset mesajyok mov ah, 9 int 21h ret mesajyok db "sayi yok $" cikis: hlt 54

Complete 8086 instruction set

Complete 8086 instruction set Page 1 of 53 Complete 8086 instruction set Quick reference: AAA AAD AAM AAS ADC ADD AND CALL CBW CLC CLD CLI CMC CMP CMPSB CMPSW CWD DAA DAS DEC DIV HLT IDIV IMUL IN INC INT INTO I JA JAE JB JBE JC JCXZ

More information

How To Use A Computer With A Screen On It (For A Powerbook)

How To Use A Computer With A Screen On It (For A Powerbook) page 44,100 TITLE ASMXMPLE Video equ 10h ;video functions interrupt number Keyboard equ 16h ;keyboard functions interrupt number DOS equ 21h ;call DOS interrupt number PrtSc equ 5h ;Print Screen Bios interrupt

More information

Computer Organization and Assembly Language

Computer Organization and Assembly Language Computer Organization and Assembly Language Lecture 8 - Strings and Arrays Introduction We already know that assembly code will execute significantly faster than code written in a higher-level language

More information

x64 Cheat Sheet Fall 2015

x64 Cheat Sheet Fall 2015 CS 33 Intro Computer Systems Doeppner x64 Cheat Sheet Fall 2015 1 x64 Registers x64 assembly code uses sixteen 64-bit registers. Additionally, the lower bytes of some of these registers may be accessed

More information

BCD (ASCII) Arithmetic. Where and Why is BCD used? Packed BCD, ASCII, Unpacked BCD. BCD Adjustment Instructions AAA. Example

BCD (ASCII) Arithmetic. Where and Why is BCD used? Packed BCD, ASCII, Unpacked BCD. BCD Adjustment Instructions AAA. Example BCD (ASCII) Arithmetic We will first look at unpacked BCD which means strings that look like '4567'. Bytes then look like 34h 35h 36h 37h OR: 04h 05h 06h 07h x86 processors also have instructions for packed

More information

The 80x86 Instruction Set

The 80x86 Instruction Set Thi d t t d ith F M k 4 0 2 The 80x86 Instruction Set Chapter Six Until now, there has been little discussion of the instructions available on the 80x86 microprocessor. This chapter rectifies this situation.

More information

Faculty of Engineering Student Number:

Faculty of Engineering Student Number: Philadelphia University Student Name: Faculty of Engineering Student Number: Dept. of Computer Engineering Final Exam, First Semester: 2012/2013 Course Title: Microprocessors Date: 17/01//2013 Course No:

More information

Unpacked BCD Arithmetic. BCD (ASCII) Arithmetic. Where and Why is BCD used? From the SQL Server Manual. Packed BCD, ASCII, Unpacked BCD

Unpacked BCD Arithmetic. BCD (ASCII) Arithmetic. Where and Why is BCD used? From the SQL Server Manual. Packed BCD, ASCII, Unpacked BCD BCD (ASCII) Arithmetic The Intel Instruction set can handle both packed (two digits per byte) and unpacked BCD (one decimal digit per byte) We will first look at unpacked BCD Unpacked BCD can be either

More information

8085 INSTRUCTION SET

8085 INSTRUCTION SET DATA TRANSFER INSTRUCTIONS Opcode Operand Description 8085 INSTRUCTION SET INSTRUCTION DETAILS Copy from source to destination OV Rd, Rs This instruction copies the contents of the source, Rs register

More information

A Tiny Guide to Programming in 32-bit x86 Assembly Language

A Tiny Guide to Programming in 32-bit x86 Assembly Language CS308, Spring 1999 A Tiny Guide to Programming in 32-bit x86 Assembly Language by Adam Ferrari, ferrari@virginia.edu (with changes by Alan Batson, batson@virginia.edu and Mike Lack, mnl3j@virginia.edu)

More information

8. MACROS, Modules, and Mouse

8. MACROS, Modules, and Mouse 8. MACROS, Modules, and Mouse Background Macros, Modules and the Mouse is a combination of concepts that will introduce you to modular programming while learning how to interface with the mouse. Macros

More information

ASCII and BCD Arithmetic. Chapter 11 S. Dandamudi

ASCII and BCD Arithmetic. Chapter 11 S. Dandamudi ASCII and BCD Arithmetic Chapter 11 S. Dandamudi Outline Representation of Numbers ASCII representation BCD representation» Unpacked BCD» Packed BCD Processing ASCII numbers» ASCII addition» ASCII subtraction»

More information

COMPUTERS ORGANIZATION 2ND YEAR COMPUTE SCIENCE MANAGEMENT ENGINEERING JOSÉ GARCÍA RODRÍGUEZ JOSÉ ANTONIO SERRA PÉREZ

COMPUTERS ORGANIZATION 2ND YEAR COMPUTE SCIENCE MANAGEMENT ENGINEERING JOSÉ GARCÍA RODRÍGUEZ JOSÉ ANTONIO SERRA PÉREZ COMPUTERS ORGANIZATION 2ND YEAR COMPUTE SCIENCE MANAGEMENT ENGINEERING UNIT 1 - INTRODUCTION JOSÉ GARCÍA RODRÍGUEZ JOSÉ ANTONIO SERRA PÉREZ Unit 1.MaNoTaS 1 Definitions (I) Description A computer is: A

More information

The x86 PC: Assembly Language, Design, and Interfacing 5 th Edition

The x86 PC: Assembly Language, Design, and Interfacing 5 th Edition Online Instructor s Manual to accompany The x86 PC: Assembly Language, Design, and Interfacing 5 th Edition Muhammad Ali Mazidi Janice Gillispie Mazidi Danny Causey Prentice Hall Boston Columbus Indianapolis

More information

King Fahd University of Petroleum and Minerals. College of Computer Science and Engineering. Computer Engineering Department COE 205

King Fahd University of Petroleum and Minerals. College of Computer Science and Engineering. Computer Engineering Department COE 205 King Fahd University of Petroleum and Minerals College of Computer Science and Engineering Computer Engineering Department COE 205 Computer Organization and Assembly Language Lab Manual Prepared By: Mr.

More information

Analysis of Win32.Scream

Analysis of Win32.Scream Analysis of Win32.Scream 1. Introduction Scream is a very interesting virus as it combines a lot of techniques written inside of it. In this paper I ll cover all of its features and internals. I ll dissect

More information

Systems Design & Programming Data Movement Instructions. Intel Assembly

Systems Design & Programming Data Movement Instructions. Intel Assembly Intel Assembly Data Movement Instruction: mov (covered already) push, pop lea (mov and offset) lds, les, lfs, lgs, lss movs, lods, stos ins, outs xchg, xlat lahf, sahf (not covered) in, out movsx, movzx

More information

CS 16: Assembly Language Programming for the IBM PC and Compatibles

CS 16: Assembly Language Programming for the IBM PC and Compatibles CS 16: Assembly Language Programming for the IBM PC and Compatibles Start basic with some string primitive instructions Get choosy with some selected string procedures Look both ways before crossing two-dimensional

More information

Assembly Language Tutorial

Assembly Language Tutorial Assembly Language Tutorial ASSEMBLY LANGUAGE TUTORIAL by tutorialspoint.com tutorialspoint.com i ABOUT THE TUTORIAL Assembly Programming Tutorial Assembly language is a low-level programming language for

More information

Character Translation Methods

Character Translation Methods Supplement to: Irvine, Kip R. Assembly Language for Intel-Based Computers, 4th Edition. This file may be duplicated or printed for classroom use, as long as the author name, book title, and copyright notice

More information

Writing an 8086 emulator in Python

Writing an 8086 emulator in Python Writing an 8086 emulator in Python Cesare Di Mauro PyCon 2015 Florence April 2015 April 2015 Cesare Di Mauro PyCon 2015 Writing an 8086 emulator in Python 1 The geek experience Writing your own o.s.: A

More information

Machine-Level Programming II: Arithmetic & Control

Machine-Level Programming II: Arithmetic & Control Mellon Machine-Level Programming II: Arithmetic & Control 15-213 / 18-213: Introduction to Computer Systems 6 th Lecture, Jan 29, 2015 Instructors: Seth Copen Goldstein, Franz Franchetti, Greg Kesden 1

More information

Z80 Instruction Set. Z80 Assembly Language

Z80 Instruction Set. Z80 Assembly Language 75 Z80 Assembly Language The assembly language allows the user to write a program without concern for memory addresses or machine instruction formats. It uses symbolic addresses to identify memory locations

More information

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 20: Stack Frames 7 March 08

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 20: Stack Frames 7 March 08 CS412/CS413 Introduction to Compilers Tim Teitelbaum Lecture 20: Stack Frames 7 March 08 CS 412/413 Spring 2008 Introduction to Compilers 1 Where We Are Source code if (b == 0) a = b; Low-level IR code

More information

MS-DOS, PC-BIOS, and File I/O Chapter 13

MS-DOS, PC-BIOS, and File I/O Chapter 13 Thi d t t d ith F M k 4 0 2 MS-DOS, PC-BIOS, and File I/O Chapter 13 A typical PC system consists of many component besides the 80x86 CPU and memory. MS-DOS and the PC s BIOS provide a software connection

More information

TIn 1: Lecture 3: Lernziele. Lecture 3 The Belly of the Architect. Basic internal components of the 8086. Pointers and data storage in memory

TIn 1: Lecture 3: Lernziele. Lecture 3 The Belly of the Architect. Basic internal components of the 8086. Pointers and data storage in memory Mitglied der Zürcher Fachhochschule TIn 1: Lecture 3 The Belly of the Architect. Lecture 3: Lernziele Basic internal components of the 8086 Pointers and data storage in memory Architektur 8086 Besteht

More information

PART B QUESTIONS AND ANSWERS UNIT I

PART B QUESTIONS AND ANSWERS UNIT I PART B QUESTIONS AND ANSWERS UNIT I 1. Explain the architecture of 8085 microprocessor? Logic pin out of 8085 microprocessor Address bus: unidirectional bus, used as high order bus Data bus: bi-directional

More information

Overview of IA-32 assembly programming. Lars Ailo Bongo University of Tromsø

Overview of IA-32 assembly programming. Lars Ailo Bongo University of Tromsø Overview of IA-32 assembly programming Lars Ailo Bongo University of Tromsø Contents 1 Introduction... 2 2 IA-32 assembly programming... 3 2.1 Assembly Language Statements... 3 2.1 Modes...4 2.2 Registers...4

More information

Computer Organization and Architecture

Computer Organization and Architecture Computer Organization and Architecture Chapter 11 Instruction Sets: Addressing Modes and Formats Instruction Set Design One goal of instruction set design is to minimize instruction length Another goal

More information

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer About the Tutorial Assembly language is a low-level programming language for a computer or other programmable device specific to a particular computer architecture in contrast to most high-level programming

More information

Instruction Set. Microcontroller Instruction Set. Instructions that Affect Flag Settings (1) The Instruction Set and Addressing Modes

Instruction Set. Microcontroller Instruction Set. Instructions that Affect Flag Settings (1) The Instruction Set and Addressing Modes Microcontroller For interrupt response time information, refer to the hardware description chapter. Instructions that ffect Flag Settings (1) Instruction Flag Instruction Flag C OV C C OV C DD X X X CLR

More information

Outline. Lecture 3. Basics. Logical vs. physical memory. 8086 physical memory. x86 byte ordering

Outline. Lecture 3. Basics. Logical vs. physical memory. 8086 physical memory. x86 byte ordering Outline Lecture 3 bout Memory ddressing memory Data types MOV instruction ddressing modes Instruction format Dr. Dimitrios S. Nikolopoulos SL/UIU Basics Logical vs. physical memory Memory in the x processors

More information

Using Debug 1 INTRODUCING DEBUG

Using Debug 1 INTRODUCING DEBUG Using Debug Copyright Prentice-Hall Publishing, 1999. All rights reserved B.1 Introducing Debug B.2 Debug Command Summary Command Parameters B.3 Individual Commands? (Help) A (Assemble) C (Compare) D (Dump)

More information

Instruction Set Architecture

Instruction Set Architecture CS:APP Chapter 4 Computer Architecture Instruction Set Architecture Randal E. Bryant adapted by Jason Fritts http://csapp.cs.cmu.edu CS:APP2e Hardware Architecture - using Y86 ISA For learning aspects

More information

Victims Compensation Claim Status of All Pending Claims and Claims Decided Within the Last Three Years

Victims Compensation Claim Status of All Pending Claims and Claims Decided Within the Last Three Years Claim#:021914-174 Initials: J.T. Last4SSN: 6996 DOB: 5/3/1970 Crime Date: 4/30/2013 Status: Claim is currently under review. Decision expected within 7 days Claim#:041715-334 Initials: M.S. Last4SSN: 2957

More information

Software Fingerprinting for Automated Malicious Code Analysis

Software Fingerprinting for Automated Malicious Code Analysis Software Fingerprinting for Automated Malicious Code Analysis Philippe Charland Mission Critical Cyber Security Section October 25, 2012 Terms of Release: This document is approved for release to Defence

More information

Appendix C: Keyboard Scan Codes

Appendix C: Keyboard Scan Codes Thi d t t d ith F M k 4 0 2 Appendix C: Keyboard Scan Codes Table 90: PC Keyboard Scan Codes (in hex) Key Down Up Key Down Up Key Down Up Key Down Up Esc 1 81 [ { 1A 9A, < 33 B3 center 4C CC 1! 2 82 ]

More information

CS61: Systems Programing and Machine Organization

CS61: Systems Programing and Machine Organization CS61: Systems Programing and Machine Organization Fall 2009 Section Notes for Week 2 (September 14 th - 18 th ) Topics to be covered: I. Binary Basics II. Signed Numbers III. Architecture Overview IV.

More information

8051 hardware summary

8051 hardware summary 8051 hardware summary 8051 block diagram 8051 pinouts + 5V ports port 0 port 1 port 2 port 3 : dual-purpose (general-purpose, external memory address and data) : dedicated (interfacing to external devices)

More information

MICROPROCESSOR BCA IV Sem MULTIPLE CHOICE QUESTIONS

MICROPROCESSOR BCA IV Sem MULTIPLE CHOICE QUESTIONS MICROPROCESSOR BCA IV Sem MULTIPLE CHOICE QUESTIONS 1) Which is the microprocessor comprises: a. Register section b. One or more ALU c. Control unit 2) What is the store by register? a. data b. operands

More information

Flash Microcontroller. Architectural Overview. Features. Block Diagram. Figure 1. Block Diagram of the AT89C core

Flash Microcontroller. Architectural Overview. Features. Block Diagram. Figure 1. Block Diagram of the AT89C core Features 8-Bit CPU Optimized for Control Applications Extensive Boolean Processing Capabilities (Single-Bit Logic) On-Chip Flash Program Memory On-Chip Data RAM Bidirectional and Individually Addressable

More information

INTRODUCTION TO PROGRAMMING THE 8086

INTRODUCTION TO PROGRAMMING THE 8086 SAMPLE HELLO WORLD PROGRAM The following example shows a program that displays the traditional Hello, world! message on the screen. It contains the essential ingredients of an assembly language application.

More information

Writing a Simple Operating System from Scratch

Writing a Simple Operating System from Scratch Writing a Simple Operating System from Scratch i by Nick Blundell School of Computer Science, University of Birmingham, UK Draft: December 2, 2010 Copyright c 2009 2010 Nick Blundell Contents Contents

More information

MACHINE ARCHITECTURE & LANGUAGE

MACHINE ARCHITECTURE & LANGUAGE in the name of God the compassionate, the merciful notes on MACHINE ARCHITECTURE & LANGUAGE compiled by Jumong Chap. 9 Microprocessor Fundamentals A system designer should consider a microprocessor-based

More information

Machine Programming II: Instruc8ons

Machine Programming II: Instruc8ons Machine Programming II: Instrucons Move instrucons, registers, and operands Complete addressing mode, address computaon (leal) Arithmec operaons (including some x6 6 instrucons) Condion codes Control,

More information

LABORATORY MANUAL EE0310 MICROPROCESSOR & MICROCONTROLLER LAB

LABORATORY MANUAL EE0310 MICROPROCESSOR & MICROCONTROLLER LAB LABORATORY MANUAL EE0310 MICROPROCESSOR & MICROCONTROLLER LAB DEPARTMENT OF ELECTRICAL & ELECTRONICS ENGINEERING FACULTY OF ENGINEERING & TECHNOLOGY SRM UNIVERSITY, Kattankulathur 603 203 1 LIST OF EXEPRIMENTS

More information

ELEG3924 Microprocessor Ch.7 Programming In C

ELEG3924 Microprocessor Ch.7 Programming In C Department of Electrical Engineering University of Arkansas ELEG3924 Microprocessor Ch.7 Programming In C Dr. Jingxian Wu wuj@uark.edu OUTLINE 2 Data types and time delay I/O programming and Logic operations

More information

Lecture 7: Machine-Level Programming I: Basics Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com

Lecture 7: Machine-Level Programming I: Basics Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com CSCI-UA.0201-003 Computer Systems Organization Lecture 7: Machine-Level Programming I: Basics Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com Some slides adapted (and slightly modified)

More information

8086 Microprocessor (cont..)

8086 Microprocessor (cont..) 8086 Microprocessor (cont..) It is a 16 bit µp. 8086 has a 20 bit address bus can access upto 2 20 memory locations ( 1 MB). It can support upto 64K I/O ports. It provides 14, 16-bit registers. It has

More information

IA-32 Intel Architecture Software Developer s Manual

IA-32 Intel Architecture Software Developer s Manual IA-32 Intel Architecture Software Developer s Manual Volume 2B: Instruction Set Reference, N-Z NOTE: The IA-32 Intel Architecture Software Developer s Manual consists of four volumes: Basic Architecture,

More information

by Kip Irvine. Last update: 12/11/2003

by Kip Irvine. Last update: 12/11/2003 Loading and Executing a Child Process by Kip Irvine. Last update: 12/11/2003 MS-DOS has always taken a fairly straightforward approach to loading and executing programs. From the start, it was designed

More information

The PC Serial Ports Chapter 22

The PC Serial Ports Chapter 22 Thi d t t d ith F M k 4 0 2 The PC Serial Ports Chapter 22 The RS-232 serial communication standard is probably the most popular serial communication scheme in the world. Although it suffers from many

More information

X86-64 Architecture Guide

X86-64 Architecture Guide X86-64 Architecture Guide For the code-generation project, we shall expose you to a simplified version of the x86-64 platform. Example Consider the following Decaf program: class Program { int foo(int

More information

Introduction. Application Security. Reasons For Reverse Engineering. This lecture. Java Byte Code

Introduction. Application Security. Reasons For Reverse Engineering. This lecture. Java Byte Code Introduction Application Security Tom Chothia Computer Security, Lecture 16 Compiled code is really just data which can be edit and inspected. By examining low level code protections can be removed and

More information

64-Bit NASM Notes. Invoking 64-Bit NASM

64-Bit NASM Notes. Invoking 64-Bit NASM 64-Bit NASM Notes The transition from 32- to 64-bit architectures is no joke, as anyone who has wrestled with 32/64 bit incompatibilities will attest We note here some key differences between 32- and 64-bit

More information

Abysssec Research. 1) Advisory information. 2) Vulnerable version

Abysssec Research. 1) Advisory information. 2) Vulnerable version Abysssec Research 1) Advisory information Title Version Discovery Vendor Impact Contact Twitter CVE : Apple QuickTime FlashPix NumberOfTiles Remote Code Execution Vulnerability : QuickTime player 7.6.5

More information

HC12 Assembly Language Programming

HC12 Assembly Language Programming HC12 Assembly Language Programming Programming Model Addressing Modes Assembler Directives HC12 Instructions Flow Charts 1 Assembler Directives In order to write an assembly language program it is necessary

More information

An Introduction to Assembly Programming with the ARM 32-bit Processor Family

An Introduction to Assembly Programming with the ARM 32-bit Processor Family An Introduction to Assembly Programming with the ARM 32-bit Processor Family G. Agosta Politecnico di Milano December 3, 2011 Contents 1 Introduction 1 1.1 Prerequisites............................. 2

More information

INTRODUCTION TO MALWARE & MALWARE ANALYSIS

INTRODUCTION TO MALWARE & MALWARE ANALYSIS INTRODUCTION TO MALWARE & MALWARE ANALYSIS by Quick Heal R&D lab Security Simplified INTRODUCTION Very often people call everything that corrupts their system a virus without being aware about what it

More information

MICROPROCESSOR AND MICROCOMPUTER BASICS

MICROPROCESSOR AND MICROCOMPUTER BASICS Introduction MICROPROCESSOR AND MICROCOMPUTER BASICS At present there are many types and sizes of computers available. These computers are designed and constructed based on digital and Integrated Circuit

More information

Flash Microcontroller. Memory Organization. Memory Organization

Flash Microcontroller. Memory Organization. Memory Organization The information presented in this chapter is collected from the Microcontroller Architectural Overview, AT89C51, AT89LV51, AT89C52, AT89LV52, AT89C2051, and AT89C1051 data sheets of this book. The material

More information

Embedded x86 Programming: Protected Mode

Embedded x86 Programming: Protected Mode by JEAN GAREAU Embedded x86 Programming: Protected Mode The x86 architecture is ubiquitous on the desktop and is spilling over into embedded systems environments. This article begins a series designed

More information

8085 MICROPROCESSOR PROGRAMS

8085 MICROPROCESSOR PROGRAMS 8085 MICROPROCESSOR PROGRAMS 1 ADDITION OF TWO 8 BIT NUMBERS AIM: To perform addition of two 8 bit numbers using 8085. ALGORITHM: 1) Start the program by loading the first data into Accumulator. 2) Move

More information

esrever gnireenigne tfosorcim seiranib

esrever gnireenigne tfosorcim seiranib esrever gnireenigne tfosorcim seiranib Alexander Sotirov asotirov@determina.com CanSecWest / core06 Reverse Engineering Microsoft Binaries Alexander Sotirov asotirov@determina.com CanSecWest / core06 Overview

More information

Hydra. Advanced x86 polymorphic engine. Incorporates existing techniques and introduces new ones in one package. All but one feature OS-independent

Hydra. Advanced x86 polymorphic engine. Incorporates existing techniques and introduces new ones in one package. All but one feature OS-independent Hydra Advanced x86 polymorphic engine Incorporates existing techniques and introduces new ones in one package All but one feature OS-independent Random register operations Different synonymous instructions

More information

PCI BIOS SPECIFICATION. Revision 2.1

PCI BIOS SPECIFICATION. Revision 2.1 PCI BIOS SPECIFICATION Revision 2.1 August 26, 1994 ii PCI BIOS Specification Revision 2.1 REVISION REVISION HISTORY DATE 1.0 Original issue distributed by Intel 9/28/92 2.0 Updated to be in synch with

More information

Mouse Programming. 25.1 Mouse Interrupts. 25.2 Useful Mouse functions. 25.2.1 Mouselib.h. 25.2.2 Mouselib.c

Mouse Programming. 25.1 Mouse Interrupts. 25.2 Useful Mouse functions. 25.2.1 Mouselib.h. 25.2.2 Mouselib.c 25 Show respect for all people. Mouse Programming As everyone knows, mouse is one of the inputting devices. In this chapter, I explain interrupts for mouse programming and a few concepts regarding mouse

More information

CHAPTER 6 TASK MANAGEMENT

CHAPTER 6 TASK MANAGEMENT CHAPTER 6 TASK MANAGEMENT This chapter describes the IA-32 architecture s task management facilities. These facilities are only available when the processor is running in protected mode. 6.1. TASK MANAGEMENT

More information

Hardware and Software Requirements

Hardware and Software Requirements C Compiler Real-Time OS Simulator Training Evaluation Boards Installing and Using the Keil Monitor-51 Application Note 152 May 31, 2000, Munich, Germany by Keil Support, Keil Elektronik GmbH support.intl@keil.com

More information

REpsych. : psycholigical warfare in reverse engineering. def con 2015 // domas

REpsych. : psycholigical warfare in reverse engineering. def con 2015 // domas REpsych : psycholigical warfare in reverse engineering { def con 2015 // domas Warning This serves no purpose Taking something apart to figure out how it works With software Interfacing Documentation Obsolescence

More information

Attacks on Virtual Machine Emulators

Attacks on Virtual Machine Emulators SYMANTEC ADVANCED THREAT RESEARCH 1 Attacks on Virtual Machine Emulators Peter Ferrie, Senior Principal Researcher, Symantec Advanced Threat Research peter_ferrie@symantec.com Abstract As virtual machine

More information

Instruction Set Architecture

Instruction Set Architecture Instruction Set Architecture Consider x := y+z. (x, y, z are memory variables) 1-address instructions 2-address instructions LOAD y (r :=y) ADD y,z (y := y+z) ADD z (r:=r+z) MOVE x,y (x := y) STORE x (x:=r)

More information

UIL Computer Science for Dummies by Jake Warren and works from Mr. Fleming

UIL Computer Science for Dummies by Jake Warren and works from Mr. Fleming UIL Computer Science for Dummies by Jake Warren and works from Mr. Fleming 1 2 Foreword First of all, this book isn t really for dummies. I wrote it for myself and other kids who are on the team. Everything

More information

1. Convert the following base 10 numbers into 8-bit 2 s complement notation 0, -1, -12

1. Convert the following base 10 numbers into 8-bit 2 s complement notation 0, -1, -12 C5 Solutions 1. Convert the following base 10 numbers into 8-bit 2 s complement notation 0, -1, -12 To Compute 0 0 = 00000000 To Compute 1 Step 1. Convert 1 to binary 00000001 Step 2. Flip the bits 11111110

More information

Abysssec Research. 1) Advisory information. 2) Vulnerable version

Abysssec Research. 1) Advisory information. 2) Vulnerable version Abysssec Research 1) Advisory information Title Version Analysis Vendor Impact Contact Twitter CVE : Microsoft MPEG Layer- 3 Audio Stack Based Overflow : l3codeca.acm (XP SP2 XP SP3) : http://www.abysssec.com

More information

Hacking Techniques & Intrusion Detection. Ali Al-Shemery arabnix [at] gmail

Hacking Techniques & Intrusion Detection. Ali Al-Shemery arabnix [at] gmail Hacking Techniques & Intrusion Detection Ali Al-Shemery arabnix [at] gmail All materials is licensed under a Creative Commons Share Alike license http://creativecommonsorg/licenses/by-sa/30/ # whoami Ali

More information

CS:APP Chapter 4 Computer Architecture Instruction Set Architecture. CS:APP2e

CS:APP Chapter 4 Computer Architecture Instruction Set Architecture. CS:APP2e CS:APP Chapter 4 Computer Architecture Instruction Set Architecture CS:APP2e Instruction Set Architecture Assembly Language View Processor state Registers, memory, Instructions addl, pushl, ret, How instructions

More information

THUMB Instruction Set

THUMB Instruction Set 5 THUMB Instruction Set This chapter describes the THUMB instruction set. Format Summary 5-2 Opcode Summary 5-3 5. Format : move shifted register 5-5 5.2 Format 2: add/subtract 5-7 5.3 Format 3: move/compare/add/subtract

More information

T.C. Yeditepe University. Department of Electrical-Electronics Engineering

T.C. Yeditepe University. Department of Electrical-Electronics Engineering T.C. Yeditepe University Department of Electrical-Electronics Engineering Microcontrollers Term Project Report Digital Frequencymeter Prof.Dr.Herman Sedef Enis Ürel Fatih Erdem 25.12.2008 Purpose: To design

More information

1. General function and functionality of the malware

1. General function and functionality of the malware 1. General function and functionality of the malware The malware executes in a command shell, it begins by checking to see if the executing file contains the MZP file extension, and then continues to access

More information

2 ASCII TABLE (DOS) 3 ASCII TABLE (Window)

2 ASCII TABLE (DOS) 3 ASCII TABLE (Window) 1 ASCII TABLE 2 ASCII TABLE (DOS) 3 ASCII TABLE (Window) 4 Keyboard Codes The Diagram below shows the codes that are returned when a key is pressed. For example, pressing a would return 0x61. If it is

More information

TitanMist: Your First Step to Reversing Nirvana TitanMist. mist.reversinglabs.com

TitanMist: Your First Step to Reversing Nirvana TitanMist. mist.reversinglabs.com TitanMist: Your First Step to Reversing Nirvana TitanMist mist.reversinglabs.com Contents Introduction to TitanEngine.. 3 Introduction to TitanMist 4 Creating an unpacker for TitanMist.. 5 References and

More information

Atmel 8051 Microcontrollers Hardware Manual

Atmel 8051 Microcontrollers Hardware Manual Atmel 8051 Microcontrollers Hardware Manual Table of Contents Section 1 The 8051 Instruction Set... 1-2 1.1 Program Status Word...1-2 1.2 Addressing Modes...1-3 1.3 Arithmetic Instructions...1-5 1.4 Logical

More information

Using Heap Allocation in Intel Assembly Language

Using Heap Allocation in Intel Assembly Language Using Heap Allocation in Intel Assembly Language Copyright 2005, Kip R. Irvine. All rights reserved. Dynamic memory allocation is a feature we take for granted in high-level languages such as C++ and Java.

More information

M6800. Assembly Language Programming

M6800. Assembly Language Programming M6800 Assembly Language Programming 1 3. MC6802 MICROPROCESSOR MC6802 microprocessor runs in 1MHz clock cycle. It has 64 Kbyte memory address capacity using 16-bit addressing path (A0-A15). The 8-bit data

More information

How It All Works. Other M68000 Updates. Basic Control Signals. Basic Control Signals

How It All Works. Other M68000 Updates. Basic Control Signals. Basic Control Signals CPU Architectures Motorola 68000 Several CPU architectures exist currently: Motorola Intel AMD (Advanced Micro Devices) PowerPC Pick one to study; others will be variations on this. Arbitrary pick: Motorola

More information

TOSHIBA CMOS DIGITAL INTEGRATED CIRCUIT SILICON MONOLITHIC T6963C

TOSHIBA CMOS DIGITAL INTEGRATED CIRCUIT SILICON MONOLITHIC T6963C TOSHIBA CMOS DIGITAL INTEGRATED CIRCUIT SILICON MONOLITHIC T6963C DOT MATRIX LCD CONTROLLER LSI The T6963C is an LCD controller designed to be used with LCD control driver LSIs and data display memories.

More information

Return-oriented programming without returns

Return-oriented programming without returns Faculty of Computer Science Institute for System Architecture, Operating Systems Group Return-oriented programming without urns S. Checkoway, L. Davi, A. Dmitrienko, A. Sadeghi, H. Shacham, M. Winandy

More information

Self Protection Techniques in Malware

Self Protection Techniques in Malware DSIE 10 5 th Doctoral lsymposium on Informatics Engineering i January 28 29, 2010 Porto, Portugal Self Protection Techniques in Malware Tiago Santos Overview Introduction Malware Types Why Self Protection?

More information

Programmer s Model = model of µc useful to view hardware during execution of software instructions

Programmer s Model = model of µc useful to view hardware during execution of software instructions HC12/S12 Programmer s Model Programmer s Model = model of µc useful to view hardware during execution of software instructions Recall: General Microcontroller/Computer Architecture note: Control Unit &

More information

Manpower Codes Lookup

Manpower Codes Lookup 00 NO PREFERENCE RECORDED 01 NO RELIGIOUS PREFERENCE 02 SEVENTH-DAY ADVENTIST 04 ASSEMBLIES OF GOD 05 GRACE GOSPEL FELLOWSHIP 06 AMERICAN BAPTIST CHURCHES 07 INDEPENDENT BAPTIST BIBLE MISSION 08 SOUTHERN

More information

Future Trends in Airline Pricing, Yield. March 13, 2013

Future Trends in Airline Pricing, Yield. March 13, 2013 Future Trends in Airline Pricing, Yield Management, &AncillaryFees March 13, 2013 THE OPPORTUNITY IS NOW FOR CORPORATE TRAVEL MANAGEMENT BUT FIRST: YOU HAVE TO KNOCK DOWN BARRIERS! but it won t hurt much!

More information

AN108 IMPLEMENTING A REALTIME CLOCK. Relevant Devices. Introduction. Key Points. Overview

AN108 IMPLEMENTING A REALTIME CLOCK. Relevant Devices. Introduction. Key Points. Overview IMPLEMENTING A REALTIME CLOCK Relevant Devices This application note applies to the following devices: C8051F000, C8051F001, C8051F002, C8051F005, C8051F006, C8051F007, C8051F010, C8051F011, and C8051F012.

More information

Numeral Systems. The number twenty-five can be represented in many ways: Decimal system (base 10): 25 Roman numerals:

Numeral Systems. The number twenty-five can be represented in many ways: Decimal system (base 10): 25 Roman numerals: Numeral Systems Which number is larger? 25 8 We need to distinguish between numbers and the symbols that represent them, called numerals. The number 25 is larger than 8, but the numeral 8 above is larger

More information

Where we are CS 4120 Introduction to Compilers Abstract Assembly Instruction selection mov e1 , e2 jmp e cmp e1 , e2 [jne je jgt ] l push e1 call e

Where we are CS 4120 Introduction to Compilers Abstract Assembly Instruction selection mov e1 , e2 jmp e cmp e1 , e2 [jne je jgt ] l push e1 call e 0/5/03 Where we are CS 0 Introduction to Compilers Ross Tate Cornell University Lecture 8: Instruction Selection Intermediate code synta-directed translation reordering with traces Canonical intermediate

More information

EE 261 Introduction to Logic Circuits. Module #2 Number Systems

EE 261 Introduction to Logic Circuits. Module #2 Number Systems EE 261 Introduction to Logic Circuits Module #2 Number Systems Topics A. Number System Formation B. Base Conversions C. Binary Arithmetic D. Signed Numbers E. Signed Arithmetic F. Binary Codes Textbook

More information

DATING YOUR GUILD 1952-1960

DATING YOUR GUILD 1952-1960 DATING YOUR GUILD 1952-1960 YEAR APPROXIMATE LAST SERIAL NUMBER PRODUCED 1953 1000-1500 1954 1500-2200 1955 2200-3000 1956 3000-4000 1957 4000-5700 1958 5700-8300 1959 12035 1960-1969 This chart displays

More information

SD Specifications Part A2 SD Host Controller Simplified Specification

SD Specifications Part A2 SD Host Controller Simplified Specification SD Specifications Part A2 SD Host Controller Simplified Specification Version 2.00 February 8, 2007 Technical Committee SD Association Revision History Date Version Changes compared to previous issue April

More information

Divide: Paper & Pencil. Computer Architecture ALU Design : Division and Floating Point. Divide algorithm. DIVIDE HARDWARE Version 1

Divide: Paper & Pencil. Computer Architecture ALU Design : Division and Floating Point. Divide algorithm. DIVIDE HARDWARE Version 1 Divide: Paper & Pencil Computer Architecture ALU Design : Division and Floating Point 1001 Quotient Divisor 1000 1001010 Dividend 1000 10 101 1010 1000 10 (or Modulo result) See how big a number can be

More information

1 Classical Universal Computer 3

1 Classical Universal Computer 3 Chapter 6: Machine Language and Assembler Christian Jacob 1 Classical Universal Computer 3 1.1 Von Neumann Architecture 3 1.2 CPU and RAM 5 1.3 Arithmetic Logical Unit (ALU) 6 1.4 Arithmetic Logical Unit

More information