x86汇编
来源:互联网 发布:拍摄淘宝图片技巧 编辑:程序博客网 时间:2024/05/16 19:04
segment*16+offset hex excursion
cs ip code segment ip instruct pointer
then ip+num
when 8086 cpu start it begin excuting from base cs=FFFFH IP=0000H the result is FFFF0H
jmp s:o
ds data segment mov bx,1000H
mov ds,bx
mov al,[0] mov ds 1000H is illegal must use a register for transfer
sub reverse add function
push pop
when the stack is empty sp is below the high memory
pop sp+2 push sp-2
10000H~1000FH sp is 1000FH+1=10010H
segment register CS DS SS ES
(ax) mov ax,[ax]
mov bx,idata
loop (cx)=(cx)-1 if cx=0 goto next code
mov cx,11
s: add ax,ax
loop s
inc bx bx=bx+1
[bx] is offset
architecture
assume cs:code
code segment
code ends
end
si di the function is same with bx
[bx+si] [bx+si+idata]
when you want to store data you should use stack
[....] bx si di bp
[bp] the segment is ss
word byte ptr
div be dived is ax or ax+dx and is double of div dx is high ax is low
al is integer ah is remainder
div word ptr [bx+si+8]
ax=[(dx)*10000h+ax]/(ds*16+bx+si+8)
dd doubleword
db 3 dup(0) db 0 ,0, 0
jmp ax
jmp 1000:0
offset mov ax,offset start
jmp short s
s:inc ax short range from -128~127
the location is next line jmp s s location -end
jmp far ptr flag
jmp word ptr segment transfer
mov dword ptr ds:[0]
cs=ds[2] ip=ds[0]
mov ax,0123H
mov [bx],ax
mov word ptr [bx+2],0
jmp dword ptr [bx] cs=high is 0 ip =low is 0123H
jcxz jmp with options short transfer from -128~127
cx=0 jmp flag
cx!=0 do next
B8000H~BFFFFH show in the terminal
B800:0000
ret use stack data to modify ip
retf to mofiy cs ip
ret
retf ip=ss*16+sp
sp+2
cs=ss*16+sp
sp+2
pop ip
pop cs
call push transfer long transfer
push ip
jmp near ptr flag
call far ptr flag long transfer
push cs
push ip
jmp far ptr flag
call register
push ip
jmp register
call word ptr memory
push ip
jmp word ptr memory
call dword prt memory
push cs
push ip
jmp dword ptr memory
mul multiply bit is same 8 or 16 together
8 store in al other is in reg or memory result is in ax
16 store in ax other is in reg or memory result h is in dx l is in ax
jcxz ok
zf 0 flag pf 1 count is even pf=1 or is uneven pf =0
cf carry
sf result <0 sf=1
cf carry
of override flag is true is 1
adc ax,bx ax=ax+bx+cf
sbb ax,bx ax=ax-bx-cf
cmp ax,bx flag chang ax=bx zf =1
je
jne
jb
jnb
ja
jna
df =0 si di inc else des
movsb es*16+di=ds*16+si
if df=0 di si inc
pushf popf flag operation
0000:0000~0000:03FF break table
iret pop ip
pop cs popf
n
ip=n*4 cs =n*4+2
shl left move write last byte into cf and add 0
int 9h key
int 13h disk
lea reg mem
disp proc forge instruct proc near or far subprocess
ret
disp endp
DATA SEGMENT
str db 'Hello!'
len equ $-str ; len为str所指字符串长度
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA
MOV DS, AX
MOV CX, len ; CX保存循环次数
LEA SI, str ; 字符串首地址送SI
DISPLAY:
MOV DL, [SI] ; 依次取str所指字符串中单个字符送DL
CALL DISP ; 调用显示字符子程序
INC SI ; 字符串偏移地址加1
LOOP DISPLAY
MOV AH, 4CH
INT 21H
;显示字符子程序,入口参数在DL
DISP PROC
PUSH AX
MOV AH,02H
INT 21H
POP AX
RET
str db 'Hello!'
len equ $-str ; len为str所指字符串长度
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA
MOV DS, AX
MOV CX, len ; CX保存循环次数
LEA SI, str ; 字符串首地址送SI
DISPLAY:
MOV DL, [SI] ; 依次取str所指字符串中单个字符送DL
CALL DISP ; 调用显示字符子程序
INC SI ; 字符串偏移地址加1
LOOP DISPLAY
MOV AH, 4CH
INT 21H
;显示字符子程序,入口参数在DL
DISP PROC
PUSH AX
MOV AH,02H
INT 21H
POP AX
RET
DISP ENDP
CODE ENDS
END START
int 02h the data must be in dl
bp base pointer store stack and heap call function when function is over it make sure it can call back right
push ebp
mov ebp, esp the top of stack point to ebp
common reg si di
bp point to top of stack below
stosb transfer al to es:di if df=0 di+1
MOV ES:DI,AL INC DI
MOV ES:DI,AL DEC DI
ebp donot change point to bottom of stack
rep replicate
两者的区别在于SAR右移时保留操作数的符号,即用符号位来补足,而SHR右移时总是用0来补足。
ES寄存器 附加段寄存器:定义附加段的起始地址
例如10000000算数右移一位是11000000,而逻辑右移一位是01000000。
ds:si es:di
前面的表示源,后面的表示目的地。
test and
cmp sub
0 0
- x86汇编
- X86 汇编
- x86汇编
- x86汇编
- 简明x86汇编
- x86汇编指令详解
- X86汇编子程序设计
- x86汇编指令(1)
- x86汇编指令(2)
- 80x86 汇编指令
- X86汇编学习中
- x86汇编经验之谈
- X86汇编指令格式
- 80x86汇编小站
- X86汇编学习小结
- x86汇编指令手册
- x86汇编学习资源
- X86汇编 伪指令
- 逻辑回归学习总结
- .\Opt\TMES.axf: Error: L6406E: No space in execution regions with .ANY selector matching indicate_se
- 线程的创建
- 4.2 使用工厂方法创建Bean
- python 使用CGI进行远程编辑1
- x86汇编
- Will , will be 的差別以及用法
- filter配置url-pattern问题
- 【DFS】(一)最简单的递归dfs——水坑问题(poj2386)
- 破解版sublimeText3重新安装Package Control方法
- try、catch、finally
- 怎么进行响应式设计
- yii2框架(二):控制器和视图
- c#读书笔记三:类型转换