sfl-examples/slide-examples/assembly/ex10.asm

32 lines
817 B
NASM
Raw Permalink Normal View History

2023-12-14 14:12:51 +01:00
bits 64
SECTION .data
; empty
SECTION .text
global _start
_start:
%include "header.asm.inc"
; init constants eax/ebx; ecx will be our playground
mov eax, 0x00FF00FF
mov ebx, 0xFF000000
; bit-wise OR
mov ecx, 0x00000000
or ecx, eax ; ---> ecx = 0x00FF00FF
or ecx, ebx ; ---> ecx = 0xFFFF00FF
or ecx, 0xFF00 ; ---> ecx = 0xFFFFFFFF
; bit-wise AND
and ecx, 0x00FFFFFF ; ---> ecx = 0x00FFFFFF
and ecx, eax ; ---> ecx = 0x00FF00FF
and ecx, 0 ; ---> ecx = 0x00000000
; bit-wise exclusive-OR (XOR)
xor ecx, 0xdeadbeef ; ---> ecx = 0xdeadbeef
xor ecx, 0xd0a0b0e0 ; ---> ecx = 0x0e0d0e0f
xor ecx, ecx ; ---> ecx = 0
%include "sysexit.asm.inc"