sfl-examples/slide-examples/ex13.asm

35 lines
557 B
NASM
Raw 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"
; switch example
mov eax, 1234;
cmp eax, 1 ; a == 1?
je c1
cmp eax, 2 ; a == 2?
je c2
cmp eax, 3 ; a == 3?
je c3
def: mov ebx, 0 ; default case
jmp fin
c1: mov ebx, 1 ; case 1
jmp fin
c2: mov ebx, 2 ; case 2
jmp fin
c3: mov ebx, 3 ; case 3
jmp fin
; end of switch
fin: nop
%include "sysexit.asm.inc"