Click to See Complete Forum and Search --> : hi, i need help(((


king-gideon
April 4th, 2009, 04:25 PM
thanks so much its ok.i have so many things to learn in assembly language and i rily appreciate ur help.
but i still got more things:).
i showed the fist program i did that is the one that counts the number of occurences of a character in a string to my teacher and he says it is correct but i should write it in a diferent way:(.he referred to the REPNE SCASB line and said i shud write it in a different way:).he also said i shud write the program in such a way that i dnt have to input with the keyboard.meaning the program is jud=st gonna run itself.
here is d code:
CLEAR MACRO COLOR
MOV AX, 0600H
MOV BH, COLOR
XOR CX, CX
MOV DX, 184FH
INT 10H
ENDM

TEXTOUT MACRO TEXT ;string output using the function 21H
MOV AH, 09
LEA DX, TEXT
INT 21H
ENDM

TEXTIN MACRO BUF ;string input
MOV AH, 0AH
LEA DX, BUF
INT 21H
ENDM

StackS SEGMENT PARA STACK 'STACK'
DW 32 DUP(?)
StackS ENDS


MAX_TEXT EQU 80
DATA SEGMENT PARA PUBLIC 'DATA'
MESS1 DB 0AH,0DH,"input string: $"
MESS2 DB 0AH,0DH,"input letter: $"
MESSNOT DB 0AH,0DH,"letter not found.$"
MESSYES DB 0AH,0DH,"it contains $ "

BUF1 DB MAX_TEXT
QNT1 DB 0
TEXT1 DB MAX_TEXT DUP(?)

DATA ENDS

CODE SEGMENT PARA PUBLIC 'CODE'
ASSUME CS:CODE, DS:DATA, SS:StackS

START: MOV AX, DATA ;load into DS
MOV DS, AX ;selects the given segment
MOV ES, AX

CLEAR 30
TEXTOUT MESS1
TEXTIN BUF1
TEXTOUT MESS2
MOV AH,1
INT 21H

XOR CH, CH ;clears upper bite
MOV CL, QNT1 ;loads the number of symbols into the substring
JCXZ NOTFOUND ;empty string is a part of string
LEA DI, TEXT1 ;address of the substring in source input
XOR BX,BX
CLD ;sets the flag in the direction of ascending order

NEXT:
*REPNE SCASB ; continuously scan until a match is found or CX is 0
*JNE CONTINUE ; if no match, goto show the result
*ADD BX,1 ; if match, increment our count
*JCXZ CONTINUE ; if nothing more to process, goto show the result
*JMP NEXT ; otherwise, continue with our loop

*CONTINUE:

*CMP BX,0 ;compare string
*JE NOTFOUND

PUSH BX ; save our count into the stack
TEXTOUT MESSYES
POP AX ; put the count (from the stack) to AX

; PRINT the value of AX

mov bx, sp
divide_by10:
xor dx, dx
mov cx, 10
div cx
push dx
or ax, ax
jnz divide_by10
print_result:
mov ah, 2
pop dx
add dl, '0'
int 21h
cmp sp, bx
jne print_result

JMP EXIT

NOTFOUND:
TEXTOUT MESSNOT

EXIT: XOR AL, AL
MOV AH, 4CH
INT 21H
CODE ENDS
END START
he askd me to rewrite the parts i marked with asteriks in the program.

secondly he askd me to write another program that puts a frame around a string wen i input with the keyboard.
example: hello
wud appear on the screen as
*******
*hello *
*******
the size of the frame changes with the lenght of the word inputed.
thks:)))

rxbagain
April 5th, 2009, 03:34 PM
Check my reply to your previous thread (http://www.codeguru.com/forum/showthread.php?p=1829956).

And please take a look at the Before you post.... (http://www.codeguru.com/forum/announcement.php?f=69).

svn_11@yahoo.com
October 16th, 2009, 08:17 AM
pls help me..i im nobe in assembly language i dont know the nxt step.
this is the code but i dont know the nxt
a100
mov ax, 00
int 33
mov ax, 01
int 33
mov ax, 03
int 10
mov ah, 02
mov dx, 001c
mov bh, 00
int 10
mov ah, 09
mov dx, 01d3
int 21
mov ah, 02
mov dx, 031c
int 10
mov ah, 09
mov dx, 0228
int 21
mov ah, 02
mov dx, 041d
int 10
mov ah, 09
mov dx, 01de
int 21
mov ah, 02
mov dx, 051c
int 10
mov ah, 09
mov dx, 01e7
int 21
mov ah, 02
mov dx, 061a
int 10
mov ah, 09
mov dx, 01f3
int 21
mov ah, 02
mov dx, 071d
int 10
mov ah, 09
mov dx, 0202
int 21
mov ah, 02
mov dx, 0a1e
int 10
mov ah, 09
mov dx, 0232
int 21
mov cx, 0000
mov dx, 0000
mov bx, 0000
mov ax, 03
int 33
cmp bx, 1
jne 017c
cmp cx, 0120
jg 17c
cmp cx, 00d0
jl 17c
cmp dx, 0020
je 01ad
cmp dx, 0028
je 01b2
cmp dx, 0030
je 01b7
cmp dx, 0038
je 01bc
cmp dx, 0050
je 01d1
jne 17c
mov dx, 020b
jmp 01bf
mov dx, 020f
jmp 01bf
mov dx, 0218
jmp 01bf
mov dx, 0221
mov ah, 02
mov bx, 0000
mov di, dx
mov dx, 0c1d
int 10
mov dx, di
mov ah, 09
int 21
int 20
db "Calculator$"
db "Addition$"
db "Subtraction$"
db "Multiplication$"
db "Division$"
db "Add$"
db "Subtract$"
db "Multiply$"
db "Divide$"
db "Menu$"
db "Exit$"

this is the frame

menu
add
sub
mul
divide
exit
1st screen
The 1st frame nid to be clicakble to do the 2 screen frame
example if u click the a,d,d,i.t,i,o,n any of the letters we going to second frame to do the operation the same in subtraction and multiplication but the division nid a two answer the quotient and remainder

1st number___
2nd number___
result___
press any key 2 return to menu
second screen
note 3 digits max including negative value and the numbers be in ascii code...

pls help me..tnx