📄 c-switch.s
字号:
# start of the file.include "defines.h" # system call numbers.include "c-switch.literals" # include the string literal file .global _start .bss .align 4_data:.text .align 4_start: pushl %ebp # save the ebp address movl %esp, %ebp subl $4, %esp # allocate space for local variables movl $116, -4(%ebp) pushl %eax popl %eax pushl -4(%ebp) popl %eax cmpl $1, %eax je S0CASElabel0 cmpl $2, %eax je S0CASElabel1 cmpl $116, %eax je S0CASElabel2S0CASElabel0: leal -4(%ebp), %eax pushl %eax popl %eax push (%eax) incl (%eax) popl %eax jmp ENDSWITCHlabel0S0CASElabel1: leal -4(%ebp), %eax pushl %eax pushl $2 popl %ebx popl %eax addl %ebx, (%eax) pushl (%eax) popl %eax jmp ENDSWITCHlabel0S0CASElabel2: movl $113, -4(%ebp) pushl %eax popl %eax jmp ENDSWITCHlabel0ENDSWITCHlabel0: movl $SYS_write, %eax # load the write call number movl $STDOUT, %ebx # get the output channel movl $literal0,%ecx # get the literal string movl $len0,%edx # string length int $0x80 movl -4(%ebp),%eax # pass the char call cshow call newline pushl $0 popl %eax # save the return value in eax movl %ebp, %esp popl %ebp # restore the ebp address movl $SYS_exit,%eax # load the exit call number movl $0,%ebx # load the exit code int $0x80 # and exit! # end of the file
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -