negar_1366
چهارشنبه 09 دی 1388, 18:20 عصر
وقت بخیر
من برنامه ام درسته
ولی موقعی که اجر میگیرم هیچی تو خروجی نشونم نمیده....و سریع پنجره اش بسته میشه
چراااااااااااا؟
دستوراتی هم که وارد میکنم
tasm pa.asm
tlink pa.obj+io
pa.exe
اینم کدمه
لطف کنید جواب بدین
ممنون
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
من برنامه ام درسته
ولی موقعی که اجر میگیرم هیچی تو خروجی نشونم نمیده....و سریع پنجره اش بسته میشه
چراااااااااااا؟
دستوراتی هم که وارد میکنم
tasm pa.asm
tlink pa.obj+io
pa.exe
اینم کدمه
لطف کنید جواب بدین
ممنون
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