\ch03\AddSub.asm(45):致命错误 A1010:不匹配的块嵌套:IsPrime
\ch03\AddSub.asm(45): fatal error A1010: unmatched block nesting : IsPrime
INCLUDE Irvine32.inc
.code
main PROC
.REPEAT
mov edx, OFFSET fPrompt ;display a prompt
call WriteString
call ReadInt ;recordes users number
mov var1, eax ;gives var1 the users number
.IF var1 == -1 ;jumps to L3 if the user want's to quit
jmp L3
.ENDIF
call IsPrime ;calls the IsPrime procedure
L3:
.UNTIL var1 == -1 ;jumps up to repeat if var1 != -1
ret
main ENDP
mov ebx, 2 ; sets minimum divisor
mov eax, var1 ; set dividend
cdq ; converts to 64-bit edx:eax
mov ecx, ebx ; stores divisor in ecx
div ecx ; Proformes division
mov b, eax ; Gets remainder, b is half var2
.WHILE ebx != b ;loops until ebx has reached var1/2
mov eax, var1 ; set dividend
cdq ; converts to 64-bit edx:eax
mov ecx, ebx ; stores divisor in ecx
div ecx ; Proformes division
mov a, edx ; Gets remainder
.IF a == 0 ;if there was no remainder, then var1 is not prime
jmp L1 ;jumps out of the loop if above is correct
.ENDIF
inc ebx ;increments until ebx reaches b
.ENDW
mov edx, OFFSET pPrompt ;tells the user their number was prime
call WriteString
jmp L2
L1:
mov edx, OFFSET cPrompt ;tells the user their number was not prime
call WriteString
L2: ret
IsPrime ENDP
END main
任何人都可以帮助解决我收到的错误信息吗?
您有 IsPrime ENDP
行但没有相应的 IsPrime PROC
。
这就是它抱怨嵌套的原因。
你需要弄清楚 PROC
行应该去哪里(可能 紧接在 mov ebx, 2 ; sets minimum divisor
之前)并且,......好吧,把它放在那里:-)
INCLUDE Irvine32.inc
.code
main PROC
.REPEAT
mov edx, OFFSET fPrompt ;display a prompt
call WriteString
call ReadInt ;recordes users number
mov var1, eax ;gives var1 the users number
.IF var1 == -1 ;jumps to L3 if the user want's to quit
jmp L3
.ENDIF
call IsPrime ;calls the IsPrime procedure
L3:
.UNTIL var1 == -1 ;jumps up to repeat if var1 != -1
ret
main ENDP
mov ebx, 2 ; sets minimum divisor
mov eax, var1 ; set dividend
cdq ; converts to 64-bit edx:eax
mov ecx, ebx ; stores divisor in ecx
div ecx ; Proformes division
mov b, eax ; Gets remainder, b is half var2
.WHILE ebx != b ;loops until ebx has reached var1/2
mov eax, var1 ; set dividend
cdq ; converts to 64-bit edx:eax
mov ecx, ebx ; stores divisor in ecx
div ecx ; Proformes division
mov a, edx ; Gets remainder
.IF a == 0 ;if there was no remainder, then var1 is not prime
jmp L1 ;jumps out of the loop if above is correct
.ENDIF
inc ebx ;increments until ebx reaches b
.ENDW
mov edx, OFFSET pPrompt ;tells the user their number was prime
call WriteString
jmp L2
L1:
mov edx, OFFSET cPrompt ;tells the user their number was not prime
call WriteString
L2: ret
IsPrime ENDP
END main
任何人都可以帮助解决我收到的错误信息吗?
您有 IsPrime ENDP
行但没有相应的 IsPrime PROC
。
这就是它抱怨嵌套的原因。
你需要弄清楚 PROC
行应该去哪里(可能 紧接在 mov ebx, 2 ; sets minimum divisor
之前)并且,......好吧,把它放在那里:-)