mov rdi, %1
                  
                  
                      xor rsi, rsi
                  
                  
                      xor rax, rax
                  
                  
                      call printf
                  
                  
                  %endmacro
                  
                  
                  
                  
                  
                  %macro PRINTF_SYMB 2
                  
                  
                      mov rdi, %1
                  
                  
                      mov rsi, %2
                  
                  
                      xor rax, rax
                  
                  
                      call printf
                  
                  
                  %endmacro
                  
                  
                  
                  
                  
                  %macro GET_REAL_NUMB 1
                  
                  
                      mov rdi, real_numb_format
                  
                  
                      mov rsi, %1
                  
                  
                      xor rax, rax
                  
                  
                      call scanf
                  
                  
                  %endmacro
                  
                  
                  
                  
                  
                  main:
                  
                  
                      mov rbp, rsp; for correct debugging
                  
                  
                      push rbp
                  
                  
                     
                  
                  
                      mov rdi, real_numb_format
                  
                  
                      mov rsi, a
                  
                  
                      xor rax, rax
                  
                  
                      call scanf
                  
                  
                      
                  
                  
                      pop rbp
                  
                  
                      ret 
                  
                  
                  
                  
                  
                  section .data
                  
                  
                  welcome_msg      db     "This program is available to solve the equations like ax^2 + bx + c = 0.", 0xA
                  
                  
                                   db     "Variables 'a', 'b' and 'c' contain real numbers.", 0xA
                  
                  
                                   db     "Enter their values and get the answer.", 0xA,0
                  
                  
                  enter_coeff_msg  db     "Enter '%c' value: ", 0xA, 0
                  
                  
                  real_numb_format db     "%lf", 0
                  
                  
                          
                  
                  
                  section .bss
                  
                  
                  a   resq    1
                  
                  
                  ;b   dq     ?
                  
                  
                  ;c   dq     ?
                  
                  
                
А зачем тебе это?
Всё работает: nasm -felf64 foo.S -o foo.o && cc -ggdb -no-pie foo.o -o foo && gdb ./foo
Обсуждают сегодня