어셈블리어 하노이탑 관련 소스 문제입니다..ㅠㅠ

sadmysoul24의 이미지

include irvine32.inc
.data
cnt dd 0
n dd 0
mains byte "하노이탑에서 옮기려는 원반의 수는?? : ",0
s1 byte ": 말뚝 ",0
s2 byte "에서 말뚝 ",0
s3 byte "로 원반 ",0
s4 byte "을 이동",0

from Dword ?
to dword ?
temp dword ?

from2 dword ?
to2 dword ?
temp2 dword ?

count dd 0

.code
main proc
mov edx,offset mains
call writestring
call readint
mov n,eax
mov from,'A'
mov temp,'B'
mov to,'C'
; mov ecx,5

call hanoi
exit
main endp

hanoi proc
; mov count,ecx
; .if(ecx==0)
; exit
; .endif
.if(n==1)
inc cnt
mov eax,cnt
call writeint
mov edx,offset s1
call writestring
mov edx,offset from
call writestring
mov edx,offset s2
call writestring
mov edx,offset to
call writestring
mov edx,offset s3
call writestring
mov eax,1
call writeint
mov edx,offset s4
call writestring
.else
mov eax,from
mov ebx,to
mov edx,temp
mov from2,eax
mov temp2,ebx
mov to2,edx
dec n
call hanoi

inc cnt
mov eax,cnt
call writeint
mov edx,offset s1
call writestring
mov edx,offset from
call writestring
mov edx,offset s2
call writestring
mov edx,offset to
call writestring
mov edx,offset s3
call writestring
mov eax,n
call writeint
mov edx,offset s4
call writestring

mov eax,temp
mov ebx,to
mov edx,from
mov from2,eax
mov temp2,ebx
mov to2,edx
call hanoi
.endif
; mov ecx,count
hanoi endp

end main

이거를 실행시키면 1까지만 돌고 그 이후부터는 오류창 뜨면서 실행이 안되네요..

C소스를 바탕으로 어셈으로 제가 작성한것이다만 상담을 해보니 메모리 관련으로 오버되었다고만 가르쳐 주시고...

ㅠㅠ

아직 스스로 하기엔 부족한 실력인지라 도움을 요청해봅니다.

내일 당장에 발표인데 이거 어떻게 해야할지 난감할 따름이네요..ㅠㅠ 부탁드립니다..

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.