flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
MariaSM
I need some help...I want to know how can I write something like this: 4*a+a/6-7 in assembler I8086. Thanks a lot!
![]() I need only that part of program.not all the program |
|||
![]() |
|
AsmGuru62
I assume (from i8086) that your variable 'a' is a 16-bit integer value.
Then you need to do the following: 1. load 'a' (with MOV instruction) and multiply it by 4 (use IMUL, MUL or SHL) 2. load 'a' and divide it by 6 (use IDIV or DIV) 3. add (use ADD) results from steps #1 and #2 and subtract 7 from that sum (use SUB) All your instructions are here: http://www.electronics.dit.ie/staff/tscarff/8086_instruction_set/8086_instruction_set.html |
|||
![]() |
|
tthsqe
Code: f: mov ax,[sp+2] mov cx,ax shl cx,2 xor dx,dx idiv ax,6 add cx,-7 add ax,cx ret 2 ; to call f(2) push 2 call f ; f(2) result now in ax |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.