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

39 lines
813 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"
; negate: reverse two's complement
mov eax, -1 ; ---> eax = 0xFFFFFFFF
neg eax ; ---> eax = 0x00000001
mov eax, 3 ; ---> eax = 0x00000003
neg eax ; ---> eax = 0xFFFFFFFD
; not: flip all bits
mov eax, -1 ; ---> eax = 0xFFFFFFFF
not eax ; ---> eax = 0x00000000
mov eax, 3 ; ---> eax = 0x00000003
not eax ; ---> eax = 0xFFFFFFFC
; challenge
mov eax, 0 ; ---> eax = 0x00000000
not eax
neg eax
not eax
neg eax
not eax
neg eax
not eax
neg eax
not eax
neg eax
%include "sysexit.asm.inc"