本章提要
80x86 的指令格式與分類 搬動資料的指令群 算術指令群、邏輯運算指令群 平移與旋轉指令 流程控制與旗標控制指令 字串處理指令群 I/O 指令群、 CPU 控制指令群
80x86 的指令格式
[ 前置指令 ] 指令 [ 運算元 1 [ , 運算元 2 [ , 運算元 3 ]]]
其中 , [ ] 內的項目依指令之性質而使用 , 有的指令可以加上前置指令 , 有的不能。
指令與運算元之間要以空格隔開 , 而運算元之間要以逗號隔開。
80x86 指令的分類
資料傳送指令群 算術運算指令群 位元運算指令群 流程控制指令群 字串處理指令群 I/O 指令群 系統控制指令群
80x86 的 3 種定址法
暫存器定址法 Register addressing mode
立即定址法 Immediate addressing mode
記憶位址定址法 Memory addressing mode
記憶位址定址法的分類
直接定址法 Direct addressing mode 間接定址法 Indirect addressing mode 基底定址法 Based addressing mode 索引定址法 Indexed addressing mode 基底索引定址法 Based indexed
addressing mode
間接定址類的寫法
mov ax, [bx + di + 6] mov ax, [bx + 6] [di] mov ax, 6 [bx + di] mov ax, [bx] [di] [6]
搬動資料的指令 MOV
只有一般暫存器的值才能 mov 至節區暫存器 , 所以:
認識 BCD
BCD 為 Binary Coded Decimal 的簡寫 , 就是以 Binary 來表示十進數的意思。
aaa:(Ascii Adjust after Addition)
aas:(Ascii Adjust after Substraction)
aam:(Ascii Adjust after Multiplication)
aad:(Ascii Adjust before Division)
daa:(Decimal Adjust AL after Addition)
das:(Decimal Adjust After Substraction)
邏輯與算術移動說明
mov ah,82h ; 82h 即有號數的 -126
sar ah,1 ;除以 2