我在以下代码中遇到错误。代码示例和需要库

问题描述 投票:0回答:0
INCLUDE Irvine32.inc
INCLUDE macros.inc

BUFFER_SIZE = 200

.data
TEN     dword           10  
BUFFER_SIZE =       5000
buffer      dword       BUFFER_SIZE dup (?)
bytesRead   dword           0
inFilename  byte        "inpuattachment_5.txt", 0
infileH     dword           0
cnt     dword           0
ary     dword           20 dup (?) ; Array for storing converted ascii to int
bry     dword           20 dup (?)
size            dword           10
a     dword           10  
b     dword           10  
c     dword           10  
d     dword           10  
e     dword           10  

.code
main PROC
call        zeroOut

; Open input file
mov     edx,    OFFSET inFilename
call        OpenInputFile
mov     infileH,    eax

; Read file into buffer
mov     edx,    OFFSET buffer
mov     ecx,    BUFFER_SIZE
call        ReadFromFile
mov     bytesRead, eax

; Close input file
mov     eax,    infileH
call        CloseFile

    ; Convert ascii to int and store in ary
call        zeroOut
lea     esi,    OFFSET buffer
lea     edi,    OFFSET ary
mov edx, size
L1:
    call convertasciitoint
    mov [edi],  eax
    inc edi
    inc esi
    dec edx
    call DumpRegs
    cmp edx, 0
    jne L1
call    zeroOut

    ; Convert int to ascii for printing
lea     esi,    OFFSET ary
    lea     edi,    OFFSET bry
mov ebx,    size
L2:
    call    convertinttoascii
    mov [edi],  eax
    inc esi
    inc edi
    dec ebx
    cmp ebx,    0
    jne L2

    ; Print output
lea     esi, OFFSET bry
call        myLine
exit
main ENDP

convertasciitoint PROC
mov ecx,    0
mov eax,    0
nextDigit:
    mov bl, [esi]
    cmp bl, '0'
    jl  outOfHere
    cmp bl, '9'
    jg  outOfHere
    add bl, -30h
    imul    eax,    10
    add eax,    ebx
    ;mov    [esi], eax
    ;mov    [edi], eax
    inc ecx
    inc esi
    ;inc    edi
    jmp nextDigit
outOfHere:
    mov cnt,    ecx
    ret
convertasciitoint ENDP

convertinttoascii PROC
mov ecx,    cnt
nextDigit:
    mov al, [esi]
    div TEN
    mov eax,    0
    mov al, dl
    add al, 30h
    ;mov    [edi], dl
    ;mov    dl, [esi]
    ;inc    esi
    ;inc    edi
    call    DumpRegs
    dec ecx
    cmp ecx,    0
    jne nextDigit
    ret
convertinttoascii ENDP

myLine PROC
nextChar:
    mov al, [esi]
    inc esi
    call    WriteChar
    cmp al, NULL
    jne nextChar
    ret
myLine ENDP

zeroOut PROC
mov eax,    0
mov ebx,    0
mov ecx,    0
mov edx,    0
ret
zeroOut ENDP
END main

编译时出现以下错误:

  • 第 47 行错误 A2081 在一元运算符后缺少操作数
  • 第 62 行错误 A2081 在一元运算符后缺少操作数
  • 第 20 行错误 A2008 语法错误:c
  • 第 17 行错误 A2008 语法错误:大小
  • line 70 Error MSB3721 The command "ml.exe /c /nologo /Sg /Zi /Fo"Debug\project1.obj" /Fl"Project.lst" /I -"c:\Irvine" /W3 /errorReport:prompt /Taproject1.asm" 以代码 1 退出。项目 C:\Program Files (x86)\Microsoft Visual Studio�9\Community\MSBuild\Microsoft\VC 160\BuildCustomizations\masm.targets
assembly masm irvine32
© www.soinside.com 2019 - 2024. All rights reserved.