1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Help Me Entourage

Discussion in 'Assembly Language Programming (ALP) Forum' started by agha_reza, Jun 22, 2011.

  1. agha_reza

    agha_reza New Member

    hello FRIEND'S
    iam reza , from iran. eng languge me very very poor.
    iam writeing 4 program in assembly , but 4 problem in 4 program . OOps!
    please HELP ME , ""EMERGENCY"" .
    ================================================
    Q1) i will program , read 1 file(string) , count alphabet BIG and insert in the File num count.

    Example : (in file): rezA VEry VEry BAd.
    Output in file :rezA VEry VEry BAd 7 .


    Code:
    data segment[/FONT][/SIZE]
    [FONT=Calibri][SIZE=3]f db 'd:\filetest2.txt'[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]fh1 dw ?[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]n db ' '[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]str db ' $' [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]i db ? [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]ends[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]stack segment[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]dw 128 dup(0)[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]ends[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]code segment[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]start:[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]; set segment registers:[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ax, data[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ds, ax[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov es, ax[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov n,'0'[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ah,3dh[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov al,2[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]lea dx,f[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov fh1,ax [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov i,0[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]l1:[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ah,42h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov al,00[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov bx,fh1 [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov cx,00h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov dx,i[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3];------[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ah,3fh[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov bx,fh1[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov cx,1[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]lea dx,str[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3];---------------------[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]cmp str,65[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jae l2[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jmp ex[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]l2:[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]cmp str,90[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jbe l3[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jmp ex[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]l3:[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]inc n[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]aaa[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jmp ex[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]ex:[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]inc i[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]cmp i,10[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jbe l1[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3];------- [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ah,42h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov al,2[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov bx,fh1 [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov cx,00h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov dx,00[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3];------[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ah,40h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov bx,fh1[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov cx,1[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]lea dx,n[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3];--------[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ah,3eh[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov bx,fh1[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ax, 4c00h ; exit to operating system.[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]ends[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]end start ; set entry point and stop the assembler.[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]


    =================================================
    Q2) i will program ,read 2 file(read 1 ..100 char),and word more 5 char, save in new file.

    Example(in file1) : reza gooooood boy in word.
    Example(in file2) : reza student in Tehran.
    Outpot : (in New file) : gooood student tehran.

    Code:
    data segment[/FONT][/SIZE]
    [FONT=Calibri][SIZE=3]f1 db 'd:\filetest3.txt'[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]fh1 dw ? [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]str1 db ' $' [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]str2 db ' $'[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]i dw ? [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]j dw ?[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]n dw -1 [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]ends[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]stack segment[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]dw 128 dup(0)[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]ends[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]code segment[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]start:[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]; set segment registers:[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ax, data[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ds, ax[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov es, ax[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ah,3dh[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov al,00[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]lea dx,f1[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov fh1,ax[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov i,0[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]l1:[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ah,42h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov al,00[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov bx,fh1 [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov cx,00h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov dx,i[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ah,3fh[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov bx,fh1[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov cx,1[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]lea dx,str1[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]inc n[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]l3:cmp str1,' '[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]je l4[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jmp continue[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]l4:cmp n,5[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jae l5[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jmp l6[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]l6:mov n,-1[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jmp continue[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]l5:[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov di,i[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]sub di,n[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov j,di[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]add di,n[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]label:[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ah,42h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov al,00[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov bx,fh1 [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov cx,00h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov dx,j[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ah,3fh[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov bx,fh1[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov cx,1[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]lea dx,str2[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov dl,str2[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ah,02h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]inc j[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]cmp j,di[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jbe label[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov n,-1[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jmp continue[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]continue:[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]inc i[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]cmp i,25[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jbe l1 [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ax, 4c00h ; exit to operating system.[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]ends[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]end start ; set entry point and stop the assembler.[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]

    =====================================================
    Q3 ) i will program , count word GREEN in file , and insert the file num count.

    Example( in file ) : red blue green green reza iran id usa 86562 green .
    Output : red blue green green reza iran id usa 86562 green 3.

    Code:
    data segment[/FONT][/SIZE]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]f db 'd:\filetest4.txt'[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]fh1 dw ? [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]str db 5 dup (' ')[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]n db ' '[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]i dw ? [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]ends[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]stack segment[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]dw 128 dup(0)[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]ends[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]code segment[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]start:[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]; set segment registers:[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ax, data[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ds, ax[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov es, ax[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov n,'0'[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ah,3dh[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov al,2[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]lea dx,f[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov fh1,ax [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov i,0[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]l1: [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ah,42h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov al,00[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov bx,fh1 [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov cx,00h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov dx,i[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3];------[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ah,3fh[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov bx,fh1[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov cx,5[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]lea dx,str[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3];---------------------[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]cmp str[0],'G'[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]je l2[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jmp continue[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]l2:[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]cmp str[1],'R'[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]je l3[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jmp continue[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]l3: [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]cmp str[2],'E'[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]je l4[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jmp continue [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]l4: [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]cmp str[3],'E'[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]je l5[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jmp continue[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]l5: [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]cmp str[4],'N'[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]je l6[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jmp continue[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]l6:[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]inc n[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]aaa[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jmp continue[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]continue:[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]inc i[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]cmp i,29[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jbe l1[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jmp exit[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]exit: [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ah,42h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov al,2[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov bx,fh1 [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov cx,00h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov dx,00[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3];------[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ah,40h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov bx,fh1[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov cx,1[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]lea dx,n[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3];--------[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ah,3eh[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov bx,fh1[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ax, 4c00h ; exit to operating system.[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]ends[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]end start ; set entry point and stop the assembler.[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]



    ===================================================

    Q4) i will program , two charcter in file , save in new file .
    Example (in the file ) : aali saew stuu frty 99 hello 6po.
    Outpot (in new file ) : aali stuu 99 hello .

    Code:
    data segment[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]f1 db 'd:\filetest5.txt'[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]fh1 dw ? [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]str1 db 2 dup ' $' [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]str2 db ' $'[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]i dw ? [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]j dw ?[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]n dw -1 [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]temp db 0 [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]kom dw ?[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]ends[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]stack segment[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]dw 128 dup(0)[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]ends[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]code segment[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]start:[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]; set segment registers:[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ax, data[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ds, ax[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov es, ax[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ah,3dh[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov al,02[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]lea dx,f1[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov fh1,ax[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov i,0[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]l1:[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ah,42h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov al,00[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov bx,fh1 [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov cx,00h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov dx,i[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ah,3fh[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov bx,fh1[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov cx,2[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]lea dx,str1[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]inc n[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov di,0[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]lea si,str1[di][/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]lea di,str1[di+1][/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]cmpsb[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]je l2 [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jmp l3[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]l2: mov temp,1[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jmp l3[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]l3:cmp str1[0],32[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]je l4[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jmp continue[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]l4:cmp temp,1[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]je l5[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jmp l6[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]l6:mov n,-1[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jmp continue[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]l5:[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov di,i[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]sub di,n[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov j,di[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]add di,n[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]label:[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ah,42h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov al,00[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov bx,fh1 [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov cx,00h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov dx,j[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ah,3fh[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov bx,fh1[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov cx,2[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]lea dx,str2[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov dl,str2[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ah,02h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]inc j[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]cmp j,di[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jbe label[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov n,-1[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov temp,0[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jmp continue[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]continue:[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]inc i[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]cmp i,25[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]jbe l1 [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3] [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]mov ax, 4c00h ; exit to operating system.[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]int 21h [/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]ends[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]end start ; set entry point and stop the assembler[/SIZE][/FONT]
    [FONT=Calibri][SIZE=3]


    Thanks All .
    Iam Sorry For All ...
    PLEASE HELP ME .
    ""EMERGENCY""
    Emu8086

    ..........................................

     
  2. xpi0t0s

    xpi0t0s Mentor

    How exactly do you need help? You appear to have written *some* software.
    Does it work?
    Do the programs go wrong?
    How exactly do they go wrong?
    Do they assemble OK or do you get errors? If you get errors, what errors, and have you tried thinking about the plain meaning of those errors: for example, if it says "Missing bracket at line 7" have you tried checking for correct bracketing at and around line 7?
    If they assemble OK do they run correctly or do they produce wrong results or behaviour?
    What wrong results or behaviour do you get?
    What results and behaviour did you expect?
     

Share This Page