Assembly 8086 program that calculates c = ((22-7)/5)*113?

In general code not looks correct. But anyway let's review main parts.

Up vote 0 down vote favorite 1 share g+ share fb share tw.

Hi I really have no idea how this is working data segment db 22 db 7 db 5 db 113 data ends code segment assume cs:code,ds:data start:mov si,500H mov di,1500H mov ah,0 mov al,22 cbw sub ax,7 mov cx,5 idiv cx mov bx,113 imul bx mov dl,ax mov di,al code ends end start I really don't know what's going on in this program so any help would be appreciated assembly 8086 link|improve this question edited Mar 20 '11 at 12:03Paul R48.9k43288 asked Mar 20 '11 at 11:42Max31.

– Paul Sasik Mar 20 '11 at 11:45 If I were you I'd use Google to find some decent tutorial on assembly programming. There are also developer's manuals (e.g. From Intel) that describe each and every assembly function, which you can consult if you find something you don't understand (such as cbw). – Andreas Rejbrand Mar 20 '11 at 11:47 1 mov cs, 5 is an illegal mnemonic.

Are you trying to do mov cx, 5? – Nathan Fellman Mar 20 '11 at 11:49 yeah it's mov cx, 5 and no it's not a homework – Max Mar 20 '11 at 11:52.

In general code not looks correct. But anyway let's review main parts: data segment - declares 3 bytes of data that would be used for calc (but unfortunately doesn't used at all). Db - is declaration of byte (compare with dw - d eclare w ord, ...) code segment - declares that program code starts there totally for perform calculation you need only following: mov AX, 22; place number 22 to processor register AX sub AX, 7; now we have subtract 7 from AX and place it back to AX mov CX, 5; 5 is placed to CX register idiv cx ; divide AX / CX mov bx,113; BX now contains 113 imul bx; at last mul result of AX on BX and place back to AX.

– Max Mar 20 '11 at 11:57 @Max for some operation yes, you can place 22 or sub 7 from BX. But some operation (div / idiv / mul / imul ) can be performed with AX only. But you have to study these questions systematically take some book on assembly language (e.g. Arl.wustl.edu/~lockwood/class/cs306/books/artofasm/toc.html) – Dewfy Mar 20 '11 at 12:20.

Here are some useful tips: mov dst, src copies the src into the dest operand *dst*, src performs the operand on the src and the dest and copies the result into the dest. For instance, sub ax, 7 calculates ax - 7 and puts the result in ax. Idiv src multiplies the src by ax, and puts the result in ax.

Imul does the same with multiplication. This should be enough to get you started.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions