⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 max.asm

📁 关于linux环境下的nasm代码的生成和使用
💻 ASM
字号:
;; file: max.asm; This example demostrates how to avoid conditional branches%include "asm_io.inc"segment .datamessage1 db "Enter a number: ",0message2 db "Enter another number: ", 0message3 db "The larger number is: ", 0segment .bssinput1  resd    1        ; first number entered segment .text        global  asm_mainasm_main:        enter   0,0               ; setup routine        pusha        mov     eax, message1     ; print out first message        call    print_string        call    read_int          ; input first number        mov     [input1], eax        mov     eax, message2     ; print out second message        call    print_string        call    read_int          ; input second number (in eax)        xor     ebx, ebx          ; ebx = 0        cmp     eax, [input1]     ; compare second and first number        setg    bl                ; ebx = (input2 > input1) ?          1 : 0        neg     ebx               ; ebx = (input2 > input1) ? 0xFFFFFFFF : 0        mov     ecx, ebx          ; ecx = (input2 > input1) ? 0xFFFFFFFF : 0        and     ecx, eax          ; ecx = (input2 > input1) ?     input2 : 0        not     ebx               ; ebx = (input2 > input1) ?          0 : 0xFFFFFFFF        and     ebx, [input1]     ; ebx = (input2 > input1) ?          0 : input1        or      ecx, ebx          ; ecx = (input2 > input1) ?     input2 : input1        mov     eax, message3     ; print out result        call    print_string        mov     eax, ecx        call    print_int        call    print_nl        popa        mov     eax, 0            ; return back to C        leave                             ret

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -