Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Assembly Language Programming (ALP) Forum (http://www.go4expert.com/forums/assembly-language-programming-forum/)
-   -   Help Me Entourage (http://www.go4expert.com/forums/help-me-entourage-t26122/)

agha_reza 22Jun2011 20:11

Help Me Entourage
 
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
Code:

f db 'd:\filetest2.txt'
fh1 dw ?
n db ' '
str db ' $'
i db ?

ends
stack segment
dw 128 dup(0)
ends
code segment
start:
; set segment registers:
mov ax, data
mov ds, ax
mov es, ax

mov n,'0'
mov ah,3dh
mov al,2
lea dx,f
int 21h
mov fh1,ax


mov i,0
l1:


mov ah,42h
mov al,00
mov bx,fh1
mov cx,00h
mov dx,i
int 21h
;------
mov ah,3fh
mov bx,fh1
mov cx,1
lea dx,str
int 21h
;---------------------
cmp str,65
jae l2
jmp ex
l2:
cmp str,90
jbe l3
jmp ex
l3:
inc n
aaa
jmp ex

ex:
inc i
cmp i,10
jbe l1


;-------

mov ah,42h
mov al,2
mov bx,fh1
mov cx,00h
mov dx,00
int 21h
;------
mov ah,40h
mov bx,fh1
mov cx,1
lea dx,n
int 21h
;--------
mov ah,3eh
mov bx,fh1
int 21h

mov ax, 4c00h ; exit to operating system.
int 21h
ends
end start ; set entry point and stop the assembler.



=================================================
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
Code:

f1 db 'd:\filetest3.txt'
fh1 dw ?

str1 db ' $'
str2 db ' $'
i dw ?
j dw ?
n dw -1

ends
stack segment
dw 128 dup(0)
ends
code segment
start:
; set segment registers:
mov ax, data
mov ds, ax
mov es, ax
mov ah,3dh
mov al,00
lea dx,f1
int 21h
mov fh1,ax

mov i,0
l1:
mov ah,42h
mov al,00
mov bx,fh1
mov cx,00h
mov dx,i
int 21h

mov ah,3fh
mov bx,fh1
mov cx,1
lea dx,str1
int 21h

inc n


l3:cmp str1,' '
je l4
jmp continue

l4:cmp n,5
jae l5
jmp l6

l6:mov n,-1
jmp continue

l5:
mov di,i
sub di,n
mov j,di
add di,n
label:
mov ah,42h
mov al,00
mov bx,fh1
mov cx,00h
mov dx,j
int 21h

mov ah,3fh
mov bx,fh1
mov cx,1
lea dx,str2
int 21h

mov dl,str2
mov ah,02h
int 21h
inc j
cmp j,di
jbe label
mov n,-1
jmp continue
continue:

inc i
cmp i,25
jbe l1
mov ax, 4c00h ; exit to operating system.
int 21h
ends
end start ; set entry point and stop the assembler.


================================================== ===
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
Code:


f db 'd:\filetest4.txt'
fh1 dw ?
str db 5 dup (' ')
n db ' '

i dw ?

ends
stack segment
dw 128 dup(0)
ends
code segment
start:
; set segment registers:
mov ax, data
mov ds, ax
mov es, ax
mov n,'0'
mov ah,3dh
mov al,2
lea dx,f
int 21h
mov fh1,ax

mov i,0
l1:

mov ah,42h
mov al,00
mov bx,fh1
mov cx,00h
mov dx,i
int 21h
;------
mov ah,3fh
mov bx,fh1
mov cx,5
lea dx,str
int 21h


;---------------------
cmp str[0],'G'
je l2
jmp continue
l2:
cmp str[1],'R'
je l3
jmp continue
l3:
cmp str[2],'E'
je l4
jmp continue
l4:
cmp str[3],'E'
je l5
jmp continue
l5:
cmp str[4],'N'
je l6
jmp continue
l6:
inc n
aaa
jmp continue

continue:
inc i
cmp i,29
jbe l1
jmp exit

exit:
mov ah,42h
mov al,2
mov bx,fh1
mov cx,00h
mov dx,00
int 21h
;------
mov ah,40h
mov bx,fh1
mov cx,1
lea dx,n
int 21h
;--------
mov ah,3eh
mov bx,fh1
int 21h
mov ax, 4c00h ; exit to operating system.
int 21h
ends
end start ; set entry point and stop the assembler.




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

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
Code:

f1 db 'd:\filetest5.txt'
fh1 dw ?

str1 db 2 dup ' $'
str2 db ' $'
i dw ?
j dw ?
n dw -1
temp db 0
kom dw ?
ends
stack segment
dw 128 dup(0)
ends
code segment
start:
; set segment registers:
mov ax, data
mov ds, ax
mov es, ax
mov ah,3dh
mov al,02
lea dx,f1
int 21h
mov fh1,ax

mov i,0
l1:
mov ah,42h
mov al,00
mov bx,fh1
mov cx,00h
mov dx,i
int 21h

mov ah,3fh
mov bx,fh1
mov cx,2
lea dx,str1
int 21h

inc n

mov di,0
lea si,str1[di]
lea di,str1[di+1]
cmpsb
je l2
jmp l3

l2: mov temp,1
jmp l3


l3:cmp str1[0],32
je l4
jmp continue

l4:cmp temp,1
je l5
jmp l6

l6:mov n,-1
jmp continue

l5:
mov di,i
sub di,n
mov j,di
add di,n
label:
mov ah,42h
mov al,00
mov bx,fh1
mov cx,00h
mov dx,j
int 21h

mov ah,3fh
mov bx,fh1
mov cx,2
lea dx,str2
int 21h

mov dl,str2
mov ah,02h
int 21h
inc j
cmp j,di
jbe label
mov n,-1
mov temp,0
jmp continue
continue:

inc i
cmp i,25
jbe l1


mov ax, 4c00h ; exit to operating system.
int 21h
ends
end start ; set entry point and stop the assembler



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

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


xpi0t0s 23Jun2011 13:02

Re: Help Me Entourage
 
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?


All times are GMT +5.5. The time now is 16:05.