Download presentation

Presentation is loading. Please wait.

Published byThomas Andrus Modified over 2 years ago

1
ASSEMBLER M. Antczak, S. Wąsik

2
Debug session: starting of the example.exe program debugging process debug example.exe checking the value that is stored in the AX register -rax AX 0000 : setting the value that will be stored in the AX register -rax AX 0000 : 1 program execution (go) -g debug session termination (quit) -q

3
Hexadecimal arithmetic: DecDig Base=10 HexDig A 10 B 11 C 12 D 13 E 14 F 15 Base=16 Addition 2A8 + 34C 8 C – 16 = A – F F4 5F4 Subtraction F 2 F B 3 BF 3BF HexDig Negation 0 F 1 E 2 D 3 C 4 B 5 A A 5 B 4 C 3 D 2 E 1 F 0 Negation (U2) FFD3 negation Negation (U2) FFD3 002C Negation (U2) FFD3 002C Negation (U2) FFD3 002C D

4
Basic assembler instructions set: ADD AX, BX AX = AX + BX SUB AX, BX AX = AX - BX NEG AX AX = (-1)*AX INC AX AX = AX + 1 DEC AX AX = AX – 1 MOV AX, BX AX = BX IMUL BX AX = AX * BX IDIV BX AX = AX / BX and DX = AX % BX while(a==b) { instrs } Jump instructions – used to jump to the memory place identified by particular address (e.g. code block label) : direct jump (without condition) JMP loop conditional jumps (when the condition is fulfilled) CMP AX, BX ; flags setting JNE finish Different possibilities: JNE != ; JE == ; JG > ; JL = ; Assume: a AX; b BX loop: instrs finish: int 3 Assume: a AX; b BX loop: CMP AX, BX instrs finish: int 3 Assume: a AX; b BX loop: CMP AX, BX instrs JMP loop finish: int 3 Assume: a AX; b BX loop: CMP AX, BX JNE finish instrs JMP loop finish: int 3 if(a>=b) instr1 else instr2 Assume: a AX; b BX ifCond: instr1 elseCond: instr2 finish: int 3 Assume: a AX; b BX ifCond: CMP AX, BX instr1 elseCond: instr2 finish: int 3 Assume: a AX; b BX ifCond: CMP AX, BX JL elseCond instr1 elseCond: instr2 finish: int 3 Assume: a AX; b BX ifCond: CMP AX, BX JL elseCond instr1 JMP finish elseCond: instr2 finish: int 3

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google