Dear sir,
i am really beginner of assembly low level language. so, please help me.
how to program this example.
program to evaluates 4*(x^2)+3x+7 if flag==1 or evaluates 9x+3 if flag==0. assume x is a 16 bits unsigned integer.

waiting your prompt.
bir

Use Switch fucntion if you are using C.

I don't think we are to help with your homework unless you actually try something yourself.

Sir, i am not doing my home work, please try understand. actually i want to learn assembly language. im not talking about c programing! i can do that in c programing. my question is depend on low level assembly language.
anyway thank you for your answer.

reagrds

So which ops are confusing you?
addition, multiply?

You should at least be able to string a few instructions together to attempt one of the expressions.

Dear sir,
i am really beginner of assembly low level language. so, please help me.
how to program this example.
program to evaluates 4*(x^2)+3x+7 if flag==1 or evaluates 9x+3 if flag==0. assume x is a 16 bits unsigned integer.

waiting your prompt.
bir

mov flag,cl
cmp cl,1
jne a
mov ax,x
push ax
mul ax //x^2
mul 4 //4*(x^2)
pop bx
push ax
mov ax,bx
mul 3 (3x)
push bx // bx=4*(x^2)
add ax,bx
add ax,7
jmp end
a:
mov ax,x
mul 9
add,ax,3

one suggestion, when I was learning assembler then dissasembly from C source function helped me a lot.

Anyway Thank you very much for example source code.
thank you

I am also beginner. I want to no how to start learning assembly leagues.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.