RedPlus 1585 ارسال شده در دی 93 گزارش بازنشر ارسال شده در دی 93 سلام به دوستان ! از دوستان کسی هست کد یکی از این برنامه ها رو در اسمبلی داشته باشه ؟! اسمبلی 80861-نمایش اعداد اول بین دو عدد که از ورودی گرفته شده2- نمایش اعداد اول قبل از یک عدد که از ورودی گرفته شده !3- تشخیص اول بودن یا نبودن یک عدد که از ورودی گرفته شده !دو مورد اول باشه که خیلی بهتره ممنون ! لینک به ارسال
S@eid 154 ارسال شده در دی 93 گزارش بازنشر ارسال شده در دی 93 مبحث یکم سنگینه اونم برای اسمبلی که واقعا سخته 1 لینک به ارسال
RedPlus 1585 ارسال شده در دی 93 مالک گزارش بازنشر ارسال شده در دی 93 (ویرایش شده) ممنون پیدا کردم خودم ! البته برنامه اصلی این بود که بین دو عدد پیدا کنه ولی ویرایشش کردم الان قبل یک عدد پیدا میکنه ! ; multi-segment executable file template.data segmentm dw ?n dw ?msg1 db 10,13 ,'-$'msg2 db 10,13, 'Please Enter number :$'msg3 db 10,13, 'number aval is :$'temp db 50 Dup(?)temp2 db 1 Dup(?)enter1 db 3,13 Dub(?), ' $'endsstack segmentdw 128 dup(0)endscode segmentstart:assume cs:code,ds:data ;============MACRO RAFTAN BE KHATE BADi============enter macro push ax push dx mov dx,offset enter1 mov ah,09 int 21h pop dx pop ax enter endm;============macro print========================print macro tmp push ax push dx lea dx,tmp mov ah,09 int 21h pop dx pop axprint endm;================================================printint macro valpush axpush bxpush cxpush dxpush simov dl,','mov ah,2int 21hmov si,10xor cx,cxmov ax,valadd ax ,0jns faprint msg1 ; adad manfi chap '-' aVAL KAR dec ax not axfa:l1:xor dx,dx div si add dl,'0' push dx inc cx or ax,ax jnz l1l2: pop dx mov ah,2 int 21h loop l2 pop si pop dx pop cx pop bx pop axprintint endm;=====================I=N=P=U=T=I=N=T=E=G=E=R===================inputint macro valpush axpush bxpush cxpush dxpush sipush dicall getnumbercall asctobinmov val ,axpop dipop sipop dxpop cxpop bxpop axinputint endm;=================================================search macro add1,add2push axpush bxpush cxpush dxpush sipush dimov di,add1mov si,add2mov cx,3repe cmpsbjnz f1cmp cx,0jne f1print msg3f1:pop dipop sipop dxpop cxpop bxpop axsearch endm;==============================end print intigermain proc mov ax,data mov ds,ax mov bx,offset temp ; maximom number ha mov si,1 print msg2 inputint n mov di,n dec di print msg3 lab: cmp si,di jg lab1 mov ax ,si mov bp,si inc si call aval cmp dx,0 je lab: printint bp jmp lab lab1: ;printint [bx] ;loop lab7 mov ah,8 int 21h mov ah,4ch int 21h retmain endp;==============================getstring procpush axpush dxnext: mov ah,08 int 21h cmp al,13 je finish mov [bx],al inc bx mov dl,al mov ah,2 int 21h jmp next finish: mov byte ptr [bx],'$' pop dx pop ax retgetstring endp ;==================================================getch procmov ah,1int 21hmov [si],alretgetch endp ;===================================getnumber procpush axpush bxpush dxnext11: mov ah,08 int 21h cmp al,13 je finish11 cmp al,'-' je manfi cmp al,'9' jg next11 cmp al,'0' jl next11 manfi: mov [bx],al inc bx mov dl,al mov ah,2 int 21h jmp next11 finish11: mov [bx],al pop dx pop bx pop ax retgetnumber endp;====================end get number ================asctobin procpush bxpush cxpush dxpush simov si,10mov m,0xor ax,axxor ch,chnext2:mov cl,[bx] inc bxcmp cl,13je finish2cmp cl,'-'jne lgfmov m,1jmp next2 lgf:mul sisub cl,'0'add ax,cxjmp next2finish2:cmp m,1jne finish3 mov bp,-1 imul bpfinish3:pop sipop dxpop cxpop bxretasctobin endp;=====================================aval procpush bxpush cxmov cx,axmov bx,2label1:mov dx,0mov ax,cxcmp bx,axjge fin ; agar bx az adad bishtar shavaddiv bx ; taghasim bar blinc bx ; ezafe shodan be blcmp dx,0 ; baraye moghaiese baghi mandejne label1 ; agar baghi mane sefr naboodjmp fin2 ; agar sefr bood adad aval nist dx = 0fin:mov dx,1jmp label2fin2:mov dx,0label2:pop cxpop bxretaval endpcode endsend mainendsend start ; set entry point and stop the assembler. ویرایش شده دی 93 توسط Morteza 1 لینک به ارسال
پست های پیشنهاد شده
لطفا برای ارسال دیدگاه وارد شوید
شما بعد از اینکه وارد حساب کاربری خود شدید می توانید دیدگاهی ارسال کنید
ورود به حساب کاربری