Assembly Language & x86 Low-Level Systems Programming · 강의

비트 연산 및 시프트 명령어

x86에서 비트를 조작하는 방법을 익힙니다. 마스킹, 플래그 전환, 빠른 곱셈에 사용되는 AND, OR, XOR, NOT과 시프트 및 회전 명령어를 다룹니다.

레슨 4/413개 단계

비트 연산 및 시프트 명령어은(는) CoddyKit의 무료 Assembly Language & x86 Low-Level Systems Programming 강의입니다. 이것은 4개 중 4번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Assembly Language & x86 Low-Level Systems Programming 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Assembly Language & x86 Low-Level Systems Programming 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

Why Bit Operations?

Low-level code constantly manipulates individual bits: setting flags, packing fields, masking, and fast math. x86 provides dedicated bitwise and shift instructions.

AND for Masking

AND keeps only the bits set in both operands, the standard way to mask out unwanted bits.

and eax, 0x0F   ; keep low nibble

OR for Setting Bits

OR forces specific bits to 1 while leaving others unchanged.

or eax, 0x80    ; set bit 7

XOR for Toggling

XOR flips bits where the mask is 1. A famous idiom zeroes a register quickly:

xor eax, eax    ; eax = 0

NOT for Inversion

NOT flips every bit (ones complement).

not eax

Logical Shift Left (SHL)

SHL shifts bits left, filling with zeros. Each shift left multiplies an unsigned value by two.

shl eax, 1      ; eax = eax * 2

Logical Shift Right (SHR)

SHR shifts right with zero fill, dividing an unsigned value by powers of two.

shr eax, 2      ; unsigned eax / 4

Arithmetic Shift (SAR)

SAR shifts right but preserves the sign bit, so it divides signed values correctly.

sar eax, 1      ; signed eax / 2

Rotate Instructions

ROL and ROR rotate bits around, wrapping the bit that falls off back in on the other side, used in hashing and crypto.

rol eax, 4

Bit Test Instructions

BT copies a chosen bit into CF so you can test it, while BTS/BTR test and set/reset it.

bt eax, 3       ; CF = bit 3 of eax

Common Idioms

Handy patterns:

  • xor reg, reg to zero
  • shl/shr for power-of-two math
  • and reg, mask to extract fields

Quick Check

Test your understanding of bit operations.

Recap

You learned bitwise and shift instructions:

  • AND mask, OR set, XOR toggle, NOT invert
  • SHL/SHR for unsigned power-of-two math
  • SAR preserves sign for signed division
  • ROL/ROR rotate; BT tests a bit into CF
무료로 시작

AI 튜터와 함께 Assembly을(를) 배우세요 — 무료

브라우저에서 실제 코드를 작성하고 실행하며, 24/7 AI 튜터로부터 즉각적인 도움을 받고, 웹이나 앱에서 중단한 부분부터 계속 학습하세요.

코스
12
레슨
48

자주 묻는 질문

“비트 연산 및 시프트 명령어” 강의는 무료인가요?

네 — “비트 연산 및 시프트 명령어” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Assembly Language & x86 Low-Level Systems Programming 강의 전체를 잠금 해제할 수 있습니다. Assembly Language & x86 Low-Level Systems Programming 강의에는 총 4개의 강의가 포함되어 있습니다.

“비트 연산 및 시프트 명령어”에서 뭘 배우나요?

x86에서 비트를 조작하는 방법을 익힙니다. 마스킹, 플래그 전환, 빠른 곱셈에 사용되는 AND, OR, XOR, NOT과 시프트 및 회전 명령어를 다룹니다. 브라우저에서 직접 실행하는 실습 코드로 Assembly Language & x86 Low-Level Systems Programming을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

Assembly Language & x86 Low-Level Systems Programming을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 Assembly Language & x86 Low-Level Systems Programming은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 4번째 강의입니다.

“비트 연산 및 시프트 명령어” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 Assembly Language & x86 Low-Level Systems Programming 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 Assembly Language & x86 Low-Level Systems Programming 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. 데이터 이동 명령어 (MOV, PUSH, POP)
  2. 산술 및 논리 연산
  3. 조건부 점프와 반복문
  4. 비트 연산 및 시프트 명령어
← Assembly Language & x86 Low-Level Systems Programming(으)로 돌아가기