SASM程序集中的gcc.exe错误

时间:2016-03-20 04:11:57

标签: gcc assembly

我正在尝试学习汇编并开始理解基础知识,并且我在网上发现了这部分代码并且一直在搞乱它。这是代码:

%include "io.inc"
prompt1 db "Enter a number: ", 0
prompt2 db "Enter another number: ", 0 
outmsg1 db "You entered ", 0 
outmsg2 db " and ", 0
outmsg3 db ", the sum of these is ", 0
segment .bss  
input1 resd 1 
input2 resd 1
segment .text 
    global _asm_main 
 _asm_main:
    mov ebp, esp; for correct debugging 
    enter 0,0 ; setup routine 
    pusha
    mov eax, prompt1 ; print out prompt 
    call print_string
    call read_int ; read integer 
    mov [input1], eax ; store into input1
    mov eax, prompt2 ; print out prompt
    call print_string
    call read_int ; read integer 
    mov [input2], eax ; store into input2
    mov eax, [input1] ; eax = dword at input1 
    add eax, [input2] ; eax += dword at input2 
    mov ebx, eax ; ebx = eax
    dump_regs 1 ; print out register values
    dump_mem 2, outmsg1, 1 ; print out memory 
    mov eax, outmsg1 
    call print_string ; print out first message 
    mov eax, [input1] 
    call print_int ; print out input1 
    mov eax, outmsg2 
    call print_string ; print out second message 
    mov eax, [input2] 
    call print_int ; print out input2 
    mov eax, outmsg3
    call print_string ; print out third message 
    mov eax, ebx 
    call print_int ; print out sum (ebx) 
    call print_nl ; print new-line
    popa
    mov eax, 0 ; return back to C 
    leave 
    ret

我使用SASM编译器,这些是错误:

C:\Users\*my user name*\AppData\Local\Temp\SASM\program.asm:27: error: parser: instruction expected
C:\Users\*my user name*\AppData\Local\Temp\SASM\program.asm:28: error: parser: instruction expected
gcc.exe: error: C:\Users\*my user name*\AppData\Local\Temp\SASM\program.o: No such file or directory

我仍然不知道装配是否足以调试这个,并且想知道你们中是否有人可以帮助我。

[EDIT]第27和28行如下:

dump_regs 1 ; print out register values
dump_mem 2, outmsg1, 1 ; print out memory 

0 个答案:

没有答案