Re: Assembler Macros



On Sat, 23 Jun 2007 12:29:06 -0400, Steve Myers <noone@xxxxxxxxxxx>
wrote:

SkippyPB wrote:
On Fri, 22 Jun 2007 17:07:32 -0400, Steve Myers <noone@xxxxxxxxxxx>
wrote:

SkippyPB wrote:
On Fri, 22 Jun 2007 01:35:53 -0700, Karan <maranmeetsu@xxxxxxxxx>
wrote:

Can any one give me the source for macros in assembler with examples?
Most IBM Assembler text books can give you this information. Here's a
simple Macro for getting the system date:

MACRO
&LABEL GETDATE &FLD
* THE OPERAND FIELD SHOULD BE AT LEAST 4 BYTES
&LABEL TIME
MVC &FLD.(4),0(1)
MEND

Remove nospam to email me.

Steve
Now, if it was only right. Reg 1 contains a date after TIME, not
the address of the date.

I believe it is right. The MVC would move the contents of the data
addressed by at 0(1) into the 4 bytes at &fld.

Regards,
Remove nospam to email me.

Steve

Actually, we're both right, sort of. See
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IEA2A971/75.5.5?SHELF=IEA2BK71&DT=20070126061230&CASE=

According to that, the contents of reg 1 are unpredictable if
TIME is used the way you showed.

Karan, do not let the dispute between SkippyPB and me discourage
you. Many macros are quite simple. Many of the IBM macros are
exceedingly complex, but there are some easy ones, like, for
example, SYS1.MACLIB(PUT).

Back in the early 70s I stole something like this from Assembler
G, and have used it ever since.

MACRO
SETR
LCLA &A
.LOOP AIF (&A GT 15).EXIT
R&A EQU &A
&A SETA &A+1
AGO .LOOP
.EXIT MEND

As a way of clarification, the Macro I listed was one I used on a
360/370 system and just happened to be still residing in my "toolbox".
Under 360/370 Assembler, the TIME macro places the address of the
current date in register 1. Which means the MVC instruction would
work as I described.

Regards,
////
(o o)
-oOO--(_)--OOo-


"Girls shouldn't play with men's balls.
Their hands are too small."
-- Iowa State Senator Wally Horn (addressing a
curious question: what sort of basketball
should be used by girls in Iowa schools?)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Remove nospam to email me.

Steve
.



Relevant Pages

  • Re: variable declration in 8051 assembly
    ... I used the metalink assembler to create an expansion to BASIC-52 and created constants and tables required in my program, as well as the tables, flags, and vector addresses required by the interpreter at the addresses specified in the MCS-51 BASIC Manual. ... The MAKE_TOKEN macro is defined below the code examples, and shows how to generate a basic "structure" in this assembler. ... SMALL_SCRN EQU 0; SHORTEN MOST DISPLAYS TO FIT ON 40 CHAR SCREENS ... REG < OR = VALUE ...
    (comp.arch.embedded)
  • Re: From the LuxAsm list.
    ... the entirity of the Luxasm source), ... > to discribe an Assembler that can neither be called Mono-pass, ... even with a complex macro system. ... AST and preforms incremental modifi- ...
    (alt.lang.asm)
  • Re: Assembler Macros
    ... &LABEL GETDATE &FLD ... addressed by at 0into the 4 bytes at &fld. ... Only if register 1 contains an address. ... after the code generated by the TIME macro executes? ...
    (comp.lang.asm370)
  • Re: Between Assemblers
    ... the semantics of the language have to be dealt with. ... only reasonable thing to do is to including a macro expander for the ... Of course, if the "translator" is perfect, this isn't an issue. ... > "All" you'd have to do is duplicate the functionallity of each assembler ...
    (alt.lang.asm)
  • Re: The Lib debate
    ... without further support from the assembler. ... nasm is released under an open source-compatible license. ... has enough macro facilities to allow source-portability among OSes. ... and plenty of external libraries. ...
    (alt.lang.asm)