16位汇编

2014-06-21  本文已影响92人  金发萌音

Logic Instructions

Jump Instructions

```
Conditional Jump (Jcc)
    Assembly    Operation       Tested Condition                        判断条件
    JC          Jump            if Carry CF=1 
    JNC         Jump            if no Carry CF=0 
    JZ/JE       Jump            if equal or Zero ZF=1 
    JNZ/JNE     Jump            if no equal or no Zero ZF=0 
    JS          Jump            if sign (negative) SF=1 
    JNS         Jump            if no sign (positive) SF=0 
    JO          Jump            if overflow OF=1 
    JNO         Jump            if no overflow OF=0 
    JP/JPE      Jump            if parity even PF=1 
    JNP/JPO     Jump            if parity odd PF=0 
    JCXZ        Jump            if CX is Zoro CX=0 
    JECXZ       Jump            if ECX is Zero ECX=0
    JA JNBE                     ZF=0 and CF=0                           A>B Unsigned number
    JB JNAE                     ZF=0,CF=1                               A<B Unsigned number
    JAE JNB                     ZF=1 or CF=0                            A>=B Unsigned number
    JBE JNA                     ZF=1 or CF=1                            A<=B Unsigned number
    
    JG JNLE                     SF=OF and ZF=0                          A>B Signed number
    JL JNGE                     SF<>OF and ZF=0                         A<B Signed number
    JGE JNL                     SF=OF or ZF=1                           A>=B Signed number
    JLE JNG                     SF<>OF或ZF=1                            A<=B Signed number
```

Loop Instructions

LOOP LABEL ; LOOP
LOOPZ/LOOPE LABEL ; Condition LOOP 配合CMP语句可以判断相等
LOOPNZ/LOOPNE LABEL ; Condition LOOP

这一部分的关键在于使用CMP 和JCC的组合...之后会写几个程序练练手

String Instructions

对于所有的串操作:SI里一般村原串地址,DI存目标串地址(段地址DS,ES同理)
并且SI,DI里面的值会自动改变,改变的方式依赖于DF位的设立,如果DF=0则为"正方向"每次自增1个单位,DF=1时为"反方向",每次操作递减1个单位(一个单位具体代表多少看具体的命令,就用LODS指令来说,LODSB 一个单位=1,LODSW =2 LODSD=4

LEA SI, SOURCE
LEA DI, DESTIN
CLD
MOV CX,100
REPZ CMPSB
JCXZ MATCH
DEC SI ; When terminal the loop, (E)SI and
; (E)DI point to the next position
LODSB
...
MATCH:
```

程序指令

简单来说就是利用CALL指令和RET指令来完成函数调用
用寄存器或者堆栈来传参

上一篇 下一篇

猜你喜欢

热点阅读