• 카테고리

    질문 & 답변
  • 세부 분야

    게임 프로그래밍

  • 해결 여부

    미해결

mov [a] 상수값 관련해서 질문이 있습니다.

22.05.07 21:33 작성 조회수 187

0

19:50을 보면

레지스터에 값을 넣을 때는 mov al, 0x00을 사용하고, 

메모리에 값을 넣을때는 mov [a], byte 0x55를 사용하셨는데,

메모리에 값을 넣을때는 값을 뜻하는 []를 사용하고, 레지스터에넣을때는 주소값을 사용하는지 알 수 있을까요?

레지스터와 메모리에 접근하는 방식이 달라서 그런걸까요??

답변 1

답변을 작성해보세요.

1

어셈 문법이 그렇습니다.

mov register to register,
mov register to memory

mov — Move (Opcodes: 88, 89, 8A, 8B, 8C, 8E, ...)

The mov instruction copies the data item referred to by its second operand (i.e. register contents, memory contents, or a constant value) into the location referred to by its first operand (i.e. a register or memory). While register-to-register moves are possible, direct memory-to-memory moves are not. In cases where memory transfers are desired, the source memory contents must first be loaded into a register, then can be stored to the destination memory address.

 

Syntax
mov <reg>,<reg>
mov <reg>,<mem>
mov <mem>,<reg>
mov <reg>,<const>
mov <mem>,<const>

Examples
mov eax, ebx — copy the value in ebx into eax
mov byte ptr [var], 5 — store the value 5 into the byte at location var