flat assembler
Message board for the users of flat assembler.
  
       
      Index
      > Main > Assembler i8086 | 
  
| Author | 
  | 
              
| 
                  
                   AsmGuru62 25 Aug 2014, 18:03 
                  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 25 Aug 2014, 19:47 
                  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-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.