New to assembly. Working on printing a copy of incremented values with C++ and MASM and it looked fine to me. I got this error:
..\..\..\..\Downloads\MASM\project.asm(24): error A2005: symbol redefinition : Store
..\..\..\..\Downloads\MASM\project.asm(32): fatal error A1010: unmatched block nesting : Store
CONSOLE equ -11
KEYBOARD equ -10
extrn Store: PROC
extrn increment: PROC
extrn Show: PROC
extrn ExitProcess: PROC
.data
.data?
c1 byte ? ;pass in usual reg /byte=8-bit char char
s1 word ? ;pass in usual reg /word=16-bit short short
us1 word ? ;pass in usual reg /word=16-bit short unsigned short
i1 dword ? ;pass in usual reg /dword=32-bit int or long int int
ull1 qword ? ;offset 48,56,64 /qword=64-bit long long int unsigned long long int
ll1 qword ? ;offset 48,56,64 /qword=64-bit long long int long long int
uc1 byte ? ;offset 48,56,64 /byte=8-bit char unsigned char
.code
Store PROC
mov rcx, c1 ;store param1
mov rdx, s1 ;store param2
mov r8, us1 ;store param3
mov r9, i1 ;store param4
mov r10, ull1 ;store param5
mov r11, ll1 ;store param6
mov r12, uc1 ;store param7
Store ENDP
Increment PROC
inc c1 ;increment param1
inc s1 ;increment param2
inc us1 ;increment param3
inc i1 ;increment param4
inc ull1 ;increment param5
inc ll1 ;increment param6
inc uc1 ;increment param7
Increment ENDP
Show PROC
Display
Show ENDP
Display:
mov c1, rcx ;
mov s1, rdx ;
mov us1, r8 ;
mov i1, r9 ;
mov ull1, r10 ;
mov ll1, r11 ;
mov uc1, r12 ;
pop rcx ;
pop rdx ;
pop r8 ;
pop r9 ;
pop r10 ;
pop r11 ;
pop r12 ;
You are defining Store
, Increment
and Show
as extrn
, so you can't define them here afterwards - the are already defined, as coming from an external source!
Remove those extrn
definitions. (Only ExitProcess
has to stay since it's actually coming from an external source.)
The "unmatched" part is probably just a result of the previous error and the Store PROC
line being ignored due to the error, which will make Store ENDP
unmatched. So, this error should go away as well once the extrn
issue is fixed.
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加