1. مهمان گرامی، جهت ارسال پست، دانلود و سایر امکانات ویژه کاربران عضو، ثبت نام کنید.
    بستن اطلاعیه

برنامه دریافت یک رشته و محاسبه کدهای فرد و زوج

شروع موضوع توسط MiTra ‏14/12/10 در انجمن Assembly

  1. پیشکسوت انجمن کاربر ارزشمند❤

    تاریخ عضویت:
    ‏11/11/10
    ارسال ها:
    11,734
    تشکر شده:
    3,539
    امتیاز دستاورد:
    113
    */*/*/*/*/*/*/*/*/* STACK SEGMENT *\*\*\*\*\*\*\*\*\*\

    stacksg segment para stack 'stack'
    , , , , , , , dw 32 dup('?')
    stacksg ends

    ;*/*/*/*/*/*/*/*/*/* DATA SEGMENT *\*\*\*\*\*\*\*\*\*\

    datasg segment para 'data'
    msg , db "-----------------------------​
    -------------------------------",'$'
    msg0 db "This program split zoj & fard digits and found sum asci code",'$'
    msg1 db "Enter , a String: ",'$'
    msg2 db "Sum of Zoj number: ",'$'
    msg3 db "Sum of Fard number: ",'$'
    msg4 db "Zoj Chars: ",'$'
    msg5 db "Fard chars: ",'$'
    msg6 db "Made by REZA AKHLAGHY & MOHAMMAD SHERAFAT",'$'
    strlist , , label , byte
    max db 10
    len , , db ?
    input_string db 10 dup(' ')
    count db 0
    o_char db 10 dup(' '),'$'
    e_char , db 10 dup(' '),'$'
    e_sum dw ?
    o_sum dw ?
    e_sum_2_str db , 5 dup (?),'$'
    o_sum_2_str db , 5 dup (?),'$'
    datasg ends

    ;*/*/*/*/*/*/*/*/*/* CODE SEGMENT *\*\*\*\*\*\*\*\*\*\

    codesg segment para 'code'

    main proc far
    assume cs:codesg,ds:datasg,es:codesg , ,
    mov , ax,datasg
    mov , ds,ax

    ;*/*/*/*/*/*/*/*/*/* CLEAR SCREEN *\*\*\*\*\*\*\*\*\*\

    mov ax,0600h
    , , , , , , , mov bh,28
    , , , , , , , mov cx,0000
    , , , , , , , mov dx,184fh
    , , , , , , , int 10h

    ;*/*/*/*/*/*/*/*/*/* MOVE CURSOR *\*\*\*\*\*\*\*\*\*\

    mov ah,2h
    mov dh,1
    mov dl,8
    mov bh,0
    int 10h

    ;*/*/*/*/*/*/*/*/*/* PRINT MASSAGE *\*\*\*\*\*\*\*\*\*\

    lea , , , dx,msg
    mov al,0
    , , , , , , , mov ah,09h
    , , , , , , , int 21h

    ;*/*/*/*/*/*/*/*/*/* MOVE CURSOR *\*\*\*\*\*\*\*\*\*\

    mov ah,2h
    mov dh,2
    mov dl,8
    mov bh,0
    int 10h

    ;*/*/*/*/*/*/*/*/*/* PRINT MASSAGE0 *\*\*\*\*\*\*\*\*\*\

    lea , , , dx,msg0
    mov al,0
    , , , , , , , mov ah,09h
    , , , , , , , int 21h

    ;*/*/*/*/*/*/*/*/*/* MOVE CURSOR *\*\*\*\*\*\*\*\*\*\

    mov ah,2h
    mov dh,3
    mov dl,8
    mov bh,0
    int 10h

    ;*/*/*/*/*/*/*/*/*/* PRINT MASSAGE *\*\*\*\*\*\*\*\*\*\

    lea , , , dx,msg
    mov al,0
    , , , , , , , mov ah,09h
    , , , , , , , int 21h

    ;*/*/*/*/*/*/*/*/*/* MOVE CURSOR *\*\*\*\*\*\*\*\*\*\

    mov ah,2h
    mov dh,5
    mov dl,14
    mov bh,0
    int 10h

    ;*/*/*/*/*/*/*/*/*/* PRINT MASSAGE6 *\*\*\*\*\*\*\*\*\*\

    lea , , , dx,msg6
    mov al,0
    , , , , , , , mov ah,09h
    , , , , , , , int 21h


    ;*/*/*/*/*/*/*/*/*/* MOVE CURSOR *\*\*\*\*\*\*\*\*\*\

    mov ah,2h
    mov dh,10
    mov dl,30
    mov bh,0
    int 10h

    ;*/*/*/*/*/*/*/*/*/* PRINT MASSAGE1 *\*\*\*\*\*\*\*\*\*\

    lea , , , dx,msg1
    mov ah,9h
    int , , , 21h

    ;*/*/*/*/*/*/*/*/*/* GET THE STRING *\*\*\*\*\*\*\*\*\*\

    mov ah,0ah
    lea dx,strlist
    int 21h
    ;*/*/*/*/*/*/*/*/*/* -------------MAIN OPRATION----------- *\*\*\*\*\*\*\*\*\*\

    lea si,o_char
    lea di,e_char
    lea bx,input_string
    mov cl,0
    start_of_loop:
    cmp cl,len
    je , end_of_program
    mov al,[bx]
    mov ah,0
    mov dl,2
    div dl
    mov al,[bx]
    cmp ah,1
    je , case_o
    cbw
    add e_sum,ax
    mov dh,[bx]
    mov [di],dh
    inc di
    ;74
    inc bx
    inc cl
    jmp start_of_loop
    case_o:
    cbw
    add o_sum,ax
    mov dh,[bx]
    mov [si],dh
    inc si
    inc bx
    inc cl
    jmp start_of_loop
    end_of_program:

    ;*/*/*/*/*/*/*/*/*/* CONVERT NUMBER 2 STRING _ FARD *\*\*\*\*\*\*\*\*\*\

    , , , , , , , lea bx, o_sum_2_str
    mov ax, o_sum
    mov cx,1000
    mov dx,0
    div cx
    add al,30h
    mov [bx],al
    mov o_sum,dx
    inc bx
    ;-------
    , , , , , , , mov ax, o_sum
    mov cl,100
    div cl
    add al,30h
    mov [bx],al
    mov al,ah
    mov ah,0
    mov o_sum,ax
    inc bx
    ;-------
    mov ax, o_sum
    mov cl, 10
    div cl
    add al,30h
    mov [bx],al
    mov al,ah
    mov ah,0
    inc bx
    ;-------
    add al,30h
    mov [bx],al

    ;*/*/*/*/*/*/*/*/*/* CONVERT NUMBER 2 STRING _ ZOJ *\*\*\*\*\*\*\*\*\*\

    , , , , , , , lea bx, e_sum_2_str
    mov ax, e_sum
    mov cx,1000
    mov dx,0
    div cx
    add al,30h
    mov [bx],al
    mov e_sum,dx
    inc bx
    ;-------
    , , , , , , , mov ax, e_sum
    mov cl,100
    div cl
    add al,30h
    mov [bx],al
    mov al,ah
    mov ah,0
    mov e_sum,ax
    inc bx
    ;-------
    mov ax, e_sum
    mov cl, 10
    div cl
    add al,30h
    mov [bx],al
    mov al,ah
    mov ah,0
    inc bx
    ;-------
    add al,30h
    mov [bx],al

    ;*/*/*/*/*/*/*/*/*/* CLEAR SCREEN *\*\*\*\*\*\*\*\*\*\

    , , , , , , , mov ax,0600h
    , , , , , , , mov bh,28
    , , , , , , , mov cx,0000
    , , , , , , , mov dx,184fh
    , , , , , , , int 10h

    ;*/*/*/*/*/*/*/*/*/* MOVE CURSOR *\*\*\*\*\*\*\*\*\*\

    mov ah,2h
    mov dh,10
    mov dl,30
    mov bh,0
    int 10h

    ;*/*/*/*/*/*/*/*/*/* PRINT MASSAGE2 *\*\*\*\*\*\*\*\*\*\

    lea , , , dx,msg2
    mov al,0
    , , , , , , , mov ah,09h
    , , , , , , , int 21h

    ;*/*/*/*/*/*/*/*/*/* PRINT SUM OF ZOJ *\*\*\*\*\*\*\*\*\*\

    lea , , dx,e_sum_2_str
    mov al,0
    , , , , , , , mov ah,09h
    , , , , , , , int 21h

    ;*/*/*/*/*/*/*/*/*/* MOVE CURSOR *\*\*\*\*\*\*\*\*\*\

    mov ah,2h
    mov dh,11
    mov dl,30
    mov bh,0
    int 10h

    ;*/*/*/*/*/*/*/*/*/* PRINT MASSAGE3 *\*\*\*\*\*\*\*\*\*\

    lea , , , dx,msg3
    mov al,0
    , , , , , , , mov ah,09h
    , , , , , , , int 21h

    ;*/*/*/*/*/*/*/*/*/* PRINT SUM OF FARD *\*\*\*\*\*\*\*\*\*\

    lea , , dx,o_sum_2_str
    , , , , , , , mov al,0
    , , , , , , , mov ah,09h
    , , , , , , , int 21h

    ;*/*/*/*/*/*/*/*/*/* MOVE CURSOR *\*\*\*\*\*\*\*\*\*\

    mov ah,2h
    mov dh,12
    mov dl,30
    mov bh,0
    int 10h

    ;*/*/*/*/*/*/*/*/*/* PRINT MASSAGE4 *\*\*\*\*\*\*\*\*\*\

    lea , , , dx,msg4
    mov al,0
    , , , , , , , mov ah,09h
    , , , , , , , int 21h

    ;*/*/*/*/*/*/*/*/*/* PRINT ZOJ CHARS *\*\*\*\*\*\*\*\*\*\

    lea , , , dx,e_char
    mov al,0
    , , , , , , , mov ah,09h
    , , , , , , , int 21h

    ;*/*/*/*/*/*/*/*/*/* MOVE CURSOR *\*\*\*\*\*\*\*\*\*\

    mov ah,2h
    mov dh,13
    mov dl,30
    mov bh,0
    int 10h

    ;*/*/*/*/*/*/*/*/*/* PRINT MASSAGE5 *\*\*\*\*\*\*\*\*\*\

    lea , , , dx,msg5
    mov al,0
    , , , , , , , mov ah,09h
    , , , , , , , int 21h

    ;*/*/*/*/*/*/*/*/*/* PRINT FARD CHARS *\*\*\*\*\*\*\*\*\*\

    lea , , , dx,o_char
    mov al,0
    , , , , , , , mov ah,09h
    , , , , , , , int 21h

    ;*/*/*/*/*/*/*/*/*/* MOVE CURSOR *\*\*\*\*\*\*\*\*\*\

    mov ah,2h
    mov dh,18
    mov dl,14
    mov bh,0
    int 10h

    ;*/*/*/*/*/*/*/*/*/* PRINT MASSAGE6 *\*\*\*\*\*\*\*\*\*\

    lea , , , dx,msg6
    mov al,0
    , , , , , , , mov ah,09h
    , , , , , , , int 21h

    ;*/*/*/*/*/*/*/*/*/* CLOSE PROGRAM *\*\*\*\*\*\*\*\*\*\

    ;*/*/*/*/*/*/*/*/*/* MOVE CURSOR *\*\*\*\*\*\*\*\*\*\
    mov ah,2h
    mov dh,23
    mov dl,8
    mov bh,0
    int 10h

    mov , ax,4c00h
    int , , , , 21h

    main endp
    , , , , , , codesg ends
    , , , end main​