News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Assembly do exponential with for

Started by Program, February 08, 2014, 03:52:29 AM

Previous topic - Next topic

Program

Friends, i new here, and new in assembly, i learning in my college

I need help to do a exponential with two "for", but it just brings me exponential pair (2,4...) but i cannot think a way to bring sequential exponential numbers are even or odd, see my code:

I can only use these specific commands, for example, can not use "sub", I have to use complement 2 to do a artificial "sub", without sub command. The exponential same way:

(Example my multiplication works well) --------multiplication (A * B)

1:mvi R0 #3 %(A)
3:mvi R1 #2 %(B)
5:mvi R2 #-1
7:mvi R3 #0
9:mv  R6,R7
10:add R3,R3,R0
% --- sub R1,R1,R2 ----
11:add R1,R1,R2
12:mvz R7,R6

----exponential(A^B)------------------

1:mvi R1 #3 %(A)
3:mvi R2 #2 %(B)
5:mvi R3 #1
7:mv R5,R7
%- for -%
8:mv R0,R1
     9:mv  R6,R7
         %- for -%
           10:add R4,R1,R1

          % --- sub R0,R0,R3 ----
            11:not R0
            12:add R0,R0,R3
            13:add R0,R0,R3
            14:mvnz R7,R6

          %- for -%

%----sub R2,R2,R3----
15:not R2
16:add R2,R2,R3
17:add R2,R2,R3
18:mvnz R7,R5
%- for -%


hutch--

This forum is only for x86 Intel processors, you need to find a venue that supports the assembler you are using. Perhaps one of the members can help you but you are in the wrong place here.

dedndave

 :biggrin:

most of us have done enough programming with modern computers
that we have forgotten all about mainframe code - lol