Friday, 28 October 2016

macro programming

;;mocro programming standard

macroname       macro   par1,par2,par3,parn


                endm


bgnmac  name    par1,par2,par3,par4
dfltlbls        name_bgn,name_end,name_ov,name_strt
labels          name_a,name_b,name_c,name_d
variables       v1,v2,v3,v4
registers       bx,cx,dx,xi,ix,all
name_strt:


name_ov:
endmac  name

...............................................................................


macro name(par1,par2,par3,parn)
{

        exitm;


}

name(arg1,arg2,arg3,argn);;


...............................................................................
what is the advantage of new macro programming?

already macros are being used in every assembler and it is being implemented as #defines in c and
an extension as templates in c++.  So the question raises in the minds of programmers what additioan
l value is there using new macros.  A little.  That is flavoring c or pascal type of function appera
nce. This gives a fealing of macros are similar to functions but not functions known to every one.



you can delcare labels but the names are a little standardised. This standardisation makes the
user to declare same variables in every macro, so it is ease of programming.

explain all the default macros

next we are going use standard labels for all the other controls also using a suffix and alphabet.




;;---------------------------------------------------------------------------------

What is the next major advantage in macro programming?

You can use all 4 types of commenting. Like ; // COMMENT /*  */ compatible with legacy

what is the 3rd advatange of usng new macro programming?

You can extend the instruction set of the CPU with macros as pseudo instructions. You can group
a few instructions as a single instruction that gives meaningful pseudo instruction. For example
you want to push all ?x registers then you can create pushx instruction that do the job of pushing
3 variables that names like bx,cx,dx.  So a new instruction that is equally meaningful as if it is
implemented in the CPU.  This is one type of instruction set extention.

There is another way of extending the instructions set by creating variable dependant instructions
rather register dependant instructions.  Take an example of loop that works with a cx register. But
many times in the programming we need to depend concurrently multiple level looping here we can't
use the same cx register or we need to swap the values of the variable into the cx and use this
loop instruction.  But it is very discomfort for the programming and finallyit is dependng on a
variable instead a register.  So we can create a new instruction like loopvcntr means loop variable
counter so we pass a variable as an operand to the loopvcntr additionally to handle this looping.
There is a great advantage of using this type of variable dependant instruction set.

Using this type of pseudo instructions we can we increase the power of CPU and the capability of
the CPU from the programming perspective.  It reduces the programming instrtuctions to use for
doing a task.

What is the over all advantage of using new macro progrmaming?

The instruction set available on the Hard ware of a CPU is n we can make it mn instruction set.
Just it is not increasing the number of macros to support pseudo instructions, we are able to
generate the instructions while using them with good naming convention like push pushx pushi these
instructions are easy to memorise and use. That is very much important in extending instructions,
otherwise it would be a big overhead on thedeveloper to learn more instructions, the developer
should generate or extend instructions what are available and not learn to use. No learning overhead
should be there in new macros.

No comments:

Post a Comment