在汇编中是用 mov 目的操作数, 源操作数
mov reg8,reg8
mov reg16,reg16
mov reg32,reg32
mov reg8/16/32,mem
HLA中使用
源操作数 目的操作数
mov( source_operand, destination_operand ) 像高级语言中的 source_operand = destination_operand
program DemoMOVAddSub;
#include("stdlib.hhf");
static
i8: int8 :=-8;
i16: int16 := -16;
i32: int32 := -32;
begin DemoMOVAddSub;
//打印初始值
stdout.put
(
nl,
"初始值: i8=",i8,
",i16=",i16,
",i32=",i32,
nl
);
//mov add sub操作
mov(0,al); //al+0 =>al=0;
sub(i8,al); //al-i8 => al=16
mov(al,i8); // i8 + al => 8
mov(0,ax);
sub(i16,ax);
mov(ax,i16);
mov(0,eax);
sub(i32,eax);
mov(eax,i32);
//显示
stdout.put(
nl,
"操作之后: i8=",i8,
",i16=",i16,
",i32=",i32,
nl
);
add(32223222,i32);
stdout.put(nl,"相加后:i32=",i32,nl);
end DemoMOVAddSub;