Presentation is loading. Please wait.

Presentation is loading. Please wait.

ASSEMBLER M. Antczak, S. Wąsik. Debug session: starting of the example.exe program debugging process debug example.exe checking the value that is stored.

Similar presentations


Presentation on theme: "ASSEMBLER M. Antczak, S. Wąsik. Debug session: starting of the example.exe program debugging process debug example.exe checking the value that is stored."— Presentation transcript:

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 0 1 2 3 4 5 6 7 8 9 Base=10 HexDig 0 1 2 3 4 5 6 7 8 9 A 10 B 11 C 12 D 13 E 14 F 15 Base=16 Addition 2A8 + 34C 8 C 12 ---------- 20 – 16 = 4 4 11 A 10 4 ---------- 15 – F F4 5F4 Subtraction 437 - 78 7 + 16 8 -------- 15 - F 2 F 2 + 16 7 -------- 11 - B 3 BF 3BF HexDig Negation 0 F 1 E 2 D 3 C 4 B 5 A 6 9 7 8 8 7 9 6 A 5 B 4 C 3 D 2 E 1 F 0 Negation (U2) FFD3 negation Negation (U2) FFD3 002C Negation (U2) FFD3 002C + 0001 Negation (U2) FFD3 002C + 0001 002D

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


Download ppt "ASSEMBLER M. Antczak, S. Wąsik. Debug session: starting of the example.exe program debugging process debug example.exe checking the value that is stored."

Similar presentations


Ads by Google