; ; Program: MACRO LIBRARY ALWAYS.MAR ; ; Author: David G. North, CCP ; 1333 Maywood Ct ; Plano, Texas 75023-1914 ; (214) 902-3957 ; ; Date: 90.11.16 ; ; Revisions: ; Who Date Description ; D.North 901116 DECUS release (Fall '90) ; D.North 911113 DECUS release (Fall '91) ; ; License: ; Ownership of and rights to these programs is retained by the author(s). ; Limited license to use and distribute the software in this library is ; hereby granted under the following conditions: ; 1. Any and all authorship, ownership, copyright or licensing ; information is preserved within any source copies at all times. ; 2. Under absolutely *NO* circumstances may any of this code be used ; in any form for commercial profit without a written licensing ; agreement from the author(s). This does not imply that such ; a written agreement could not be obtained. ; 3. Except by written agreement under condition 2, source shall ; be freely provided with all binaries. ; 4. Library contents may be transferred or copied in any form so ; long as conditions 1, 2, and 3 are met. Nominal charges may ; be assessed for media and transferral labor without such charges ; being considered 'commercial profit' thereby violating condition 2. ; ; Warranty: ; These programs are distributed in the hopes that they will be useful, but ; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ; or FITNESS FOR A PARTICULAR PURPOSE. ; ; ItmLst3 definition macro .MACRO .ITEM3 - LEN=0,ITMCOD,DATA,RETADDR=0 .word LEN .word ITMCOD .long DATA .long RETADDR .ENDM .ITEM3 ; Uninitialized .ASCID string .MACRO .UDESC - LENGTH = <^x100> - TYPE = <^x01>, - CLASS = <^x0e> .long !!LENGTH .address .+4 .blkb LENGTH .ENDM .UDESC ; Branch (Word) on low bit clear .MACRO BLBCW - SRC,DST,?LCL BLBS SRC,LCL BRW DST LCL: .ENDM BLBCW ; Branch (Word) on low bit set .MACRO BLBSW - SRC,DST,?LCL BLBC SRC,LCL BRW DST LCL: .ENDM BLBSW ; Generate a debug message with FAO control string and arguments .MACRO DBG_MSG msg = ,- V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,- ?L_$$L1 .IF NDF,DBG_OFF .save_psect local_block .save_psect .psect _DBG_DATA .iif ndf,DBG_Q_FAOBUF, DBG_Q_FAOBUF: .udesc <^x200> .iif ndf,DBG_K_CALLCNT, DBG_K_CALLCNT = 0 DBG_K_CALLCNT = DBG_K_CALLCNT + 1 L_$$L1: .ascid ~%DBG-I-DBGMSG_!UL, msg~ .restore_psect movq r0,-(SP) DBG_K_ACNT = 4 .irp faoarg,<,,,,,,,,,> .if nb, pushl faoarg DBG_K_ACNT = DBG_K_ACNT + 1 .endc .endr pushl #DBG_K_CALLCNT pushaq DBG_Q_FAOBUF pushaw DBG_Q_FAOBUF movw #^x200,DBG_Q_FAOBUF pushaq L_$$L1 calls #DBG_K_ACNT,@#SYS$FAO pushaq DBG_Q_FAOBUF calls #1,G^LIB$PUT_OUTPUT movq (SP)+,r0 $$$dot = . .restore_psect . = $$$dot .ENDC .ENDM DBG_MSG ; PRINTF macro for MACRO access to LIB$PUT_OUTPUT with FAO control string .MACRO PRINTF msg,- V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,- usefao,?L_$$L1 .save_psect local_block .save_psect .psect _DBG_DATA .iif ndf,DBG_Q_FAOBUF, DBG_Q_FAOBUF: .udesc <^x200> L_$$L1: .ascid ~msg~ .restore_psect movq r0,-(SP) DBG_K_ACNT = 3 DBG_K_ACNT_TEST = 3 .irp faoarg,<,,,,,,,,,> .if nb, pushl faoarg DBG_K_ACNT = DBG_K_ACNT + 1 .endc .endr .IIF NB,, DBG_K_ACNT_TEST=0 .IF EQ, DBG_K_ACNT-DBG_K_ACNT_TEST pushaq L_$$L1 .IFF pushaq DBG_Q_FAOBUF pushaw DBG_Q_FAOBUF movw #^x200,DBG_Q_FAOBUF pushaq L_$$L1 calls #DBG_K_ACNT,@#SYS$FAO pushaq DBG_Q_FAOBUF .ENDC calls #1,G^LIB$PUT_OUTPUT movq (SP)+,r0 $$$dot = . .restore_psect . = $$$dot .ENDM PRINTF ; SPRINTF macro to call FAO easily (caller responsibility to keep descriptor ; for target intact .MACRO SPRINTF targ,msg,- V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,- ?L_$$L1 .save_psect local_block .save_psect .psect _DBG_DATA .iif ndf,DBG_Q_FAOBUF, DBG_Q_FAOBUF: .udesc <^x200> L_$$L1: .ascid ~msg~ .restore_psect movq r0,-(SP) DBG_K_ACNT = 3 .irp faoarg,<,,,,,,,,,> .if nb, pushl faoarg DBG_K_ACNT = DBG_K_ACNT + 1 .endc .endr pushaq targ pushaw targ movw #^x200,DBG_Q_FAOBUF pushaq L_$$L1 calls #DBG_K_ACNT,@#SYS$FAO movq (SP)+,r0 $$$dot = . .restore_psect . = $$$dot .ENDM SPRINTF ; INQUIRE macro for MACRO access to LIB$GET_INPUT with FAO control string .MACRO INQUIRE targ,msg,- V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,- usefao,?L_$$L1 .save_psect local_block .save_psect .psect _DBG_DATA .iif ndf,DBG_Q_FAOBUF, DBG_Q_FAOBUF: .udesc <^x200> L_$$L1: .ascid ~msg~ .restore_psect movq r0,-(SP) DBG_K_ACNT = 3 DBG_K_ACNT_TEST = 3 .irp faoarg,<,,,,,,,,,> .if nb, pushl faoarg DBG_K_ACNT = DBG_K_ACNT + 1 .endc .endr .IIF NB,, DBG_K_ACNT_TEST=0 .IF EQ, DBG_K_ACNT-DBG_K_ACNT_TEST pushaw targ pushaq L_$$L1 .IFF pushaq DBG_Q_FAOBUF pushaw DBG_Q_FAOBUF movw #^x200,DBG_Q_FAOBUF pushaq L_$$L1 calls #DBG_K_ACNT,@#SYS$FAO pushaw targ pushaq DBG_Q_FAOBUF .ENDC pushaq targ calls #3,G^LIB$GET_INPUT movq (SP)+,r0 $$$dot = . .restore_psect . = $$$dot .ENDM INQUIRE ; Case statement generation macro .macro case source,displist,base=#0,type=b,?table,?etable .iif ne %LENGTH(TYPE)-1, .ERROR 1;illegal case: type .iif ne %LENGTH(TYPE)-1, .MEXIT .iif eq %LOCATE(TYPE,)-6, .ERROR 1 ;illegal case: type .iif eq %LOCATE(TYPE,)-6, .MEXIT case'type source,base,#</2>-1 table: .IRP dest, .word dest-table .ENDR etable: .endm case ; Quadword macros ADDQ and SUBQ .MACRO SUBQ3 op1,op2,op3 SUBQ op1,op2,op3 .ENDM .MACRO SUBQ op1,op2,op3 .IF NB, pushaq op3 .IFF pushaq op2 .ENDC movq r2,-(SP) movq r0,-(SP) movq op1,r0 movq op2,r2 subl r0,r2 sbwc r1,r3 movq (SP)+,r0 movq r2,@8(SP) movq (SP)+,r2 moval 4(SP),SP .ENDM SUBQ .MACRO ADDQ3 op1,op2,op3 ADDQ op1,op2,op3 .ENDM ADDQ3 .MACRO ADDQ op1,op2,op3 .IF NB, pushaq op3 .IFF pushaq op2 .ENDC movq r2,-(SP) movq r0,-(SP) movq op1,r0 movq op2,r2 addl r0,r2 adwc r1,r3 movq (SP)+,r0 movq r2,@8(SP) movq (SP)+,r2 moval 4(SP),SP .ENDM ADDQ