本文介绍了\ ch03 \ AddSub.asm(45):致命错误A1010:不匹配的块嵌套: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

有人可以帮助我解决错误消息吗?

Can anyone help with the error msg im getting?

推荐答案

您有IsPrime ENDP行,但没有相应的IsPrime PROC.

You have a IsPrime ENDP line but no corresponding IsPrime PROC.

这就是为什么它抱怨嵌套.

That's why it's complaining about the nesting.

您需要弄清楚PROC行应该走到哪里(可能紧接在mov ebx, 2 ; sets minimum divisor之前),然后...把它放在那里:-)

You need to work out where the PROC line should go (probably immediately before mov ebx, 2 ; sets minimum divisor) and, ... well, put it there :-)

这篇关于\ ch03 \ AddSub.asm(45):致命错误A1010:不匹配的块嵌套:IsPrime的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 16:12