PDA

View Full Version : اشکال یابی



negar_1366
دوشنبه 07 دی 1388, 20:05 عصر
اماکنش هست چند تا از اشکالای این برنامه رو بگین



include io.h ;1
title program1 ;2
;3
stacksg segment para stack 'stack' ;4
stacksg ends ;5
;6
;7
;8
datasg segment para ;9
;10
msg1 db "(1) N!","$" ;11
msg2 db 13,10,"(2) 2^N","$" ;12
msg3 db 13,10,"(3) Is N a prime number?","$" ;13
msg4 db 13,10,"(4) Exit","$" ;14
msg5 db 13,10,"Enter your choice:","$" ;15
msg6 db "Number is not prime","$" ;16
msg7 db "Number is prime","$" ;17
msg8 db "2^N Is : ","$" ;18
msg9 db "Fact Number Is :","$" ;19
msg10 db 13,10,"Enter number between 1 to 8 :","$" ;20
msg11 db 13,10,"Enter number between 1 to 14 :","$" ;21
msg12 db 13,10,"Enter number:","$" ;22
;23
;24
one dw 1 ;25
two dw 2 ;26
three dw 3 ;27
fore dw 4 ;28
;29
number db 7 dup(?) ;30
;31
;32
;33
datasg ends ;34
;35
;36
;37
;38
codesg segment para 'code' ;39
;40
;--------------------------------------- ;41
;42
fact proc far ;43
cmp ax,1 ;44
jg L1 ;45
ret ;46
L1: push ax ;47
dec ax ;48
call fact ;49
pop cx ;50
mul cx ;51
ret ;52
fact endp ;53
;54
;--------------------------------------- ;55
;56
prime proc far ;57
;58
cbw ;59
mov bx,ax ;60
;61
mov cx,3 ;62
compare: ;63
div cx ;64
cmp dl,0 ;65
je notprime ;66
add cx,2 ;67
cmp cx,bx ;68
jae isprime ;69
jmp compare ;70
;71
notprime: ;72
output msg6 ;73
jmp exit ;74
;75
isprime: ;76
output msg7 ;77
;78
exit: ;79
call menu ;80
;81
prime endp ;82
;83
;--------------------------------------- ;84
;85
tavan proc far ;86
mov cx,ax ;87
mov ax,1 ;88
ta: ;89
mul bx ;90
loop ta ;91
output msg8 ;92
itoa number,ax ;93
output number ;94
tavan endp ;95
;96
;--------------------------------------- ;97
;98
menu proc far ;99
output msg1 ;100
output msg2 ;101
output msg3 ;102
output msg4 ;103
output msg5 ;104
menu endp ;105
;106
;--------------------------------------- ;107
;108
;109
;110
main proc far ;111
assume ss:stacksg;ds:datasg;cs:codesg ;112
mov ax,datasg ;113
mov ds,ax ;114
;115
call menu ;116
inputs number,7 ;117
atoi number ;118
;119
cmp ax,one ;120
je one1 ;121
cmp ax,two ;122
je two2 ;123
cmp ax,three ;124
je three3 ;125
cmp ax,fore ;126
je fore4 ;127
;128
;129
;130
one1: ;131
output msg10 ;132
inputs number,7 ;133
atoi number ;134
cmp ax,8 ;135
jg one1 ;136
mov cx,ax ;137
call fact ;138
output msg9 ;139
itoa number,ax ;140
output number ;141
call menu ;142
two2: ;143
output msg11 ;144
inputs number,7 ;145
atoi number ;145
cmp ax,14 ;147
jg two2 ;148
call tavan ;149
call menu ;150
three3: ;151
output msg12 ;152
inputs number,7 ;153
atoi number ;154
mov bx,2 ;155
call prime ;156
call menu ;157
fore4: ;158
mov ax,4c00h ;159
int 21h ;160
;161
;162
;163
;164
;165
main endp ;166
codesg ends ;167
end main

negar_1366
دوشنبه 07 دی 1388, 22:09 عصر
دوستان خواهشا" یه نفر جواب منو بده.............. :اشتباه:
واقعا" مرسی :افسرده:

negar_1366
سه شنبه 08 دی 1388, 10:44 صبح
دوستان این پیغام خطا برا چیه؟


near jump or call to different cs

negar_1366
سه شنبه 08 دی 1388, 15:08 عصر
include io.h
title program1

stacksg segment para stack 'stack'
stacksg ends



datasg segment para

msg1 db "(1) N!","$"
msg2 db 13,10,"(2) 2^N","$"
msg3 db 13,10,"(3) Is N a prime number?","$"
msg4 db 13,10,"(4) Exit","$"
msg5 db 13,10,"Enter your choice:","$"
msg6 db "Number is not prime","$"
msg7 db "Number is prime","$"
msg8 db "2^N Is : ","$"
msg9 db "Fact Number Is :","$"
msg10 db 13,10,"Enter number between 1 to 8 :","$"
msg11 db 13,10,"Enter number between 1 to 14 :","$"
msg12 db 13,10,"Enter number:","$"


number db 32 dup(?)








datasg ends




codesg segment para 'code'




;--------------------------------------- ;110
main proc far
assume ss:stacksg,ds:datasg,cs:codesg
mov ax,datasg
mov ds,ax

start: call menu
inputs number,32
atoi number

cmp ax,1
je one
cmp ax,2
je two
cmp ax,3
je three
cmp ax,4
je fore
cmp ax,5
jge start
one:
output msg10
inputs number,32
atoi number
cmp ax,8
jg one
mov cx,ax
call fact
output msg9
itoa number,ax
output number
call menu
two:
output msg11
inputs number,32
atoi number
cmp ax,14
jg two
call tavan
call menu
three:
output msg12
inputs number,32
atoi number
mov bx,2
call prime
call menu
fore:
mov ax,4c00h
int 21h





main endp

;---------------------------------------

menu proc near

output msg1
output msg2
output msg3
output msg4
output msg5

menu endp



;---------------------------------------

prime proc near

cbw
mov bx,ax

mov cx,3
compare:
div cx
cmp dl,0
je notprime
add cx,2
cmp cx,bx
jae isprime
jmp compare

notprime:
output msg6
jmp exit

isprime:
output msg7

exit:
call menu

prime endp

;---------------------------------------

tavan proc near
mov cx,ax
mov ax,1
ta:
mul bx
loop ta
output msg8
itoa number,ax
output number
tavan endp

;---------------------------------------
fact proc near
cmp ax,1
jg L1
ret
L1: push ax
dec ax
call fact
pop cx
mul cx
ret
fact endp



codesg ends
end





http://f.imagehost.org/0368/err.jpg

پیغام خطاهایی که میده اینا هستند..........
دوستان یکی یکی کمک کنید :ناراحت:

negar_1366
چهارشنبه 09 دی 1388, 10:13 صبح
یه نفر پیدا نمیشه جواب منو بده

دوستان به نظرتون غیر از عوض کردن نسخه چه راهی وجود داره که برام obj بسازه؟




http://i.imagehost.org/0299/errr.jpg


include io.h
title program1

stacksg segment para stack 'stack'
stacksg ends

datasg segment para

msg1 db "(1) N!","$"
msg2 db 13,10,"(2) 2^N","$"
msg3 db 13,10,"(3) Is N a prime number?","$"
msg4 db 13,10,"(4) Exit","$"
msg5 db 13,10,"Enter your choice:","$"
msg6 db "Number is not prime","$"
msg7 db "Number is prime","$"
msg8 db "2^N Is : ","$"
msg9 db "Fact Number Is :","$"
msg10 db 13,10,"Enter number between 1 to 8 :","$"
msg11 db 13,10,"Enter number between 1 to 14 :","$"
msg12 db 13,10,"Enter number:","$"
msg13 db 13,10,"Number is out","$"

number db 7 dup(?)

datasg ends

codesg segment para 'code'

;---------------------------------------
main proc far
assume ss:stacksg,ds:datasg,cs:codesg
mov ax,datasg
mov ds,ax

start: call menu
inputs number,7
atoi number

cmp ax,1
je one1
cmp ax,2
je two2
cmp ax,3
je three3
cmp ax,4
je fore
cmp ax,5
jge erro
erro:
output msg13
jmp start
one1:call one

two2:call two

three3:call three

fore:
mov ax,4c00h
int 21h


main endp

;---------------------------------------
one proc near
output msg10
inputs number,7
atoi number
cmp ax,8
jg one
mov cx,ax
call fact
output msg9
itoa number,ax
output number
jmp start
one endp
;---------------------------------------
two proc near
output msg11
inputs number,7
atoi number
cmp ax,14
jg two
call tavan
jmp start
two endp
;---------------------------------------
three proc near
output msg12
inputs number,7
atoi number
mov bx,2
call prime
jmp start
three endp

;---------------------------------------

menu proc near

output msg1
output msg2
output msg3
output msg4
output msg5

menu endp

;---------------------------------------

prime proc near

cbw
mov bx,ax

mov cx,3
compare:
div cx
cmp dl,0
je notprime
add cx,2
cmp cx,bx
jae isprime
jmp compare

notprime:
output msg6
jmp start

isprime:
output msg7
jmp start

prime endp

;---------------------------------------

tavan proc near
mov cx,ax
mov ax,1
ta:
mul bx
loop ta
output msg8
itoa number,ax
output number
tavan endp

;---------------------------------------
fact proc near
cmp ax,1
jg L1
ret
L1: push ax
dec ax
call fact
pop cx
mul cx
ret
fact endp

;---------------------------------------

codesg ends
end

jaafar1363
چهارشنبه 09 دی 1388, 11:25 صبح
سلام نگار-1366 من هنوز اول راهم وگرنه کمکت می کردم.راستش من هنوز تو همون برنامه معکوس ماتریس 2*2 موندم.هلپ می هلپ می هلپ می...



یه نفر پیدا نمیشه جواب منو بده

دوستان به نظرتون غیر از عوض کردن نسخه چه راهی وجود داره که برام obj بسازه؟




http://i.imagehost.org/0299/errr.jpg


include io.h
title program1

stacksg segment para stack 'stack'
stacksg ends

datasg segment para

msg1 db "(1) N!","$"
msg2 db 13,10,"(2) 2^N","$"
msg3 db 13,10,"(3) Is N a prime number?","$"
msg4 db 13,10,"(4) Exit","$"
msg5 db 13,10,"Enter your choice:","$"
msg6 db "Number is not prime","$"
msg7 db "Number is prime","$"
msg8 db "2^N Is : ","$"
msg9 db "Fact Number Is :","$"
msg10 db 13,10,"Enter number between 1 to 8 :","$"
msg11 db 13,10,"Enter number between 1 to 14 :","$"
msg12 db 13,10,"Enter number:","$"
msg13 db 13,10,"Number is out","$"

number db 7 dup(?)

datasg ends

codesg segment para 'code'

;---------------------------------------
main proc far
assume ss:stacksg,ds:datasg,cs:codesg
mov ax,datasg
mov ds,ax

start: call menu
inputs number,7
atoi number

cmp ax,1
je one1
cmp ax,2
je two2
cmp ax,3
je three3
cmp ax,4
je fore
cmp ax,5
jge erro
erro:
output msg13
jmp start
one1:call one

two2:call two

three3:call three

fore:
mov ax,4c00h
int 21h


main endp

;---------------------------------------
one proc near
output msg10
inputs number,7
atoi number
cmp ax,8
jg one
mov cx,ax
call fact
output msg9
itoa number,ax
output number
jmp start
one endp
;---------------------------------------
two proc near
output msg11
inputs number,7
atoi number
cmp ax,14
jg two
call tavan
jmp start
two endp
;---------------------------------------
three proc near
output msg12
inputs number,7
atoi number
mov bx,2
call prime
jmp start
three endp

;---------------------------------------

menu proc near

output msg1
output msg2
output msg3
output msg4
output msg5

menu endp

;---------------------------------------

prime proc near

cbw
mov bx,ax

mov cx,3
compare:
div cx
cmp dl,0
je notprime
add cx,2
cmp cx,bx
jae isprime
jmp compare

notprime:
output msg6
jmp start

isprime:
output msg7
jmp start

prime endp

;---------------------------------------

tavan proc near
mov cx,ax
mov ax,1
ta:
mul bx
loop ta
output msg8
itoa number,ax
output number
tavan endp

;---------------------------------------
fact proc near
cmp ax,1
jg L1
ret
L1: push ax
dec ax
call fact
pop cx
mul cx
ret
fact endp

;---------------------------------------

codesg ends
end