News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Help Me Entourage

Started by agha_reza, June 22, 2011, 04:29:58 PM

Previous topic - Next topic

agha_reza

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  VE ry  BA d.
    Output in file :rezAVEry VEry BAd 7 .


data segment
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.

  data segment
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 .

  data segment

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 ) :   aa li saew st uu frty  99  he ll o  6po.
Outpot (in new file ) : aali  stuu 99 hello .

data segment
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

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

dedndave

well - that's a lot of code to be thumbing through - lol
let's start with the basics......

these are 16-bit programs
we have a special 16-bit sub-forum for this - scroll down near bottom of main forum page

many people have difficulty assembling 16-bit programs for the first time because they are not using the right linker
LINK.EXE is intended for 32-bit programs
you will want to use LINK16.exe or LINK563.EXE (same program with different names)

see if you can assemble a known-good program, without errors...
        .MODEL  Small
        .STACK  2048

;--------------------------------------------------

        .DATA

TestMsg db 'Hello',0Dh,0Ah,24h

;--------------------------------------------------

        .CODE
        ASSUME  DS:DGROUP

_main   PROC    FAR

        mov     ax,@DATA       ;@DATA is an alias for DGROUP
        mov     ds,ax

        mov     dx,offset TestMsg
        mov     ah,9
        int     21h

        mov     ax,4C00h
        int     21h

_main   ENDP

;--------------------------------------------------

        END     _main

qWord

working with JWASM is much easier: simply assemble the code using
>jwasm.exe /mz yourcode.asm
--> yourcode.exe
FPU in a trice: SmplMath
It's that simple!

agha_reza


BogdanOntanu

Hi, the rules of this forums do not allow us to do or to write your homework for you.

People here did try to help you by offering simple examples that will compile and can serve as a base for you to change and to do your own work and learning and in the end hopefully solve your whole set of questions in your homework / assignment

Be polite and patient ... and try to read an understand what people say to you. Explain in more elaborate ways where and what you do not understand...

"not help me" is not an acceptable answer for somebody that takes some of his own time in order to try and help you...

Then show us your own work and what your did in order to understand and solve the questions / tasks.

Try to focus on one single problem / subproblem at a time and ask more exact questions about what and where your have problems in solving your own homework ...

This thread is Locked...

If you decide to create a new one THEN I do suggest that you respect the rules and my suggestions from above ...
Ambition is a lame excuse for the ones not brave enough to be lazy.
http://www.oby.ro