| | |
Assembly Code Help
Please support our Assembly advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jun 2009
Posts: 1
Reputation:
Solved Threads: 0
I am trying to do this: z=(5*a-b/7)/(3/b+a*a) in assembly code and I keep getting some errors.
Here is the code & the errs.
Where are my sins? Thank you !
Here is the code & the errs.
Assembly Syntax (Toggle Plain Text)
assume cs:code,ds:data data segment a dw 5 b dw 6 z dw 10 intermed dw ? rez db ? data ends code segment start: mov ax,data mov ds,ax mul 5 ; ERROR Argument needs type override & Illegal immediate ; in ax we will have a*5; mov bx,ax ; we move the ax data in the bx register bx:ax mov ax,b; we move the b in the ax register ax:b cwd ; ERROR Argument needs type override& Illegal immediate ;we convert the word from ax in doubleword, in dx:ax idiv 7 ; ax=b/7 sub bx,ax; we substract ax out of bx ( ax: ax-bx <=> 5*a-b/7 ) mov intermed, ax ;we move all the data from ax to interm=(5*a-b*7) mov al,3 idiv b; ax:3/b mov bx,a; bx:a mul a; bx:a*a add ax, bx; ax=ax+bx; mov bx,intermed; Err. Undefined symbol Intermed idiv ax; we obtain the result in al and the reminder in ah mov rez,al mov ax, 4C00h int 21h code ends end start
Where are my sins? Thank you !
Last edited by ovidiu82; Nov 9th, 2009 at 1:12 am. Reason: i clarified some potential confusing aspects
•
•
Join Date: May 2004
Posts: 95
Reputation:
Solved Threads: 10
0
#2 Nov 9th, 2009
As a general recommendation, you should read some technical documentation on the x86 instructions... this page is a good start, but the Intel processor manuals are the real deal.
As for your specific questions:
operands to
Not sure what's wrong off the top of my head.
As for your specific questions:
Assembly Syntax (Toggle Plain Text)
mul 5 ; ERROR Argument needs type override & Illegal immediate
operands to
mul are either registers or memory locations; immediate values aren't supported. Assembly Syntax (Toggle Plain Text)
cwd ; ERROR Argument needs type override& Illegal immediate ;we convert the word from ax in doubleword, in dx:ax idiv 7 ; ax=b/7
cwd should be fine... this error might be for your idiv , which has the same restriction as mul --only registers or memory locations. Assembly Syntax (Toggle Plain Text)
mov bx,intermed; Err. Undefined symbol Intermed
Not sure what's wrong off the top of my head.
--smg
![]() |
Similar Threads
- how to get signature of function from arm assembly code (Assembly)
- assembly code of 'type command' (Assembly)
- Assembly code generated from C program (C)
- Porting assembly code in to Mobile based application (Assembly)
- IF statment with assembly code (Assembly)
- i need an assembly code program (Assembly)
- C code to Assembly code (Assembly)
Other Threads in the Assembly Forum
- Previous Thread: Trying to analyse code
- Next Thread: Assembly MIPS help
Views: 619 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for assembly






