;+ ; MWAIT_MACROS ; ; Author : Nick de Smith ; Creation date : 09-Dec-91 ; ; Description ; ; MACROs to support the MWAIT utility. ; ; Notes ; ; Edit Edit date By Why ; 02 09-Jan-92 NMdS Add in action routine to RWPC ; 01 09-Dec-91 NMdS New ;- ; ; BxxxW [source,] destination ; ; Same as the VAX branch instruction, except that they allow a word offset. ; .macro blbcw src, dest, ?label blbs src, label brw dest label: .endm .macro beqluw dest, ?label bnequ label brw dest label: .endm .macro bgtruw dest, ?label blequ label brw dest label: .endm .macro blssuw dest, ?label bgequ label brw dest label: .endm .macro SCH list .macro SCH_ENTRY name, ?label .address s'label .save_psect .psect $text pic, shr, rd, nowrt, noexe, byte s'label: .ascic "'name'" .restore_psect .endm .irp name, SCH_ENTRY name .endr .endm .macro MTX list .macro MTX_ENTRY addr, name, ?label .iif different , <-1>, .weak addr .long addr .address s'label .save_psect .psect $rodata pic, shr, rd, nowrt, noexe, byte s'label: .ascic "'name'" .restore_psect .endm .irp entry, MTX_ENTRY entry .endr .endm .macro RWPC start, offset, text, action=0, backoff=0, ?label .address s'label .long start .long offset .long backoff .long action .save_psect .psect $rodata1 pic, shr, rd, nowrt, noexe, byte s'label: .ascid "'text'" .restore_psect .endm ; ; $PUSH ; ; Internal macro to push an argument onto the stack. ; ; If the argument is not an address expression then ; PUSHL arg ; else ; if the register is the PC then ; PUSHAL arg ; else ; PUSHL arg ; endif ; endif ; .macro $push arg .ntype $$$mode arg $$$mode = $$$mode@-4&^xf $$$addr = 1 ; Assume address .iif equal $$$mode , $$$addr=0 ; If literal.. .iif equal $$$mode-1, $$$addr=0 ; ..immediate.. .iif equal $$$mode-5, $$$addr=0 ; ..or register .if equal $$$addr pushl arg .if_false .ntype $$$mode arg $$$reg = $$$mode&^xf .if equal $$$reg-^xf pushal arg .if_false pushl arg .endc .endc .endm ; ; PRINTF format=,arg1,... ; ; This is a nice macro to FAO format according to the passed string and data. ; $printf is a variant where the format parameter is the address of an ASCID ; control string. ; .macro printf format, p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,?l .save_psect .psect $text t'l: .ascid "'format'" .restore_psect $printf t'l',,,,,,,,,,,,,,,,, .endm .macro $printf faoctl, p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17 pushr #^m ; Save R0 and R1 subl #8, sp ; Allocate some space for a descriptor movl sp, r0 ; R0 => allocated descriptor clrq (r0) ; Initialise the descriptor as dynamic movb #DSC$K_DTYPE_T, DSC$B_DTYPE(r0) movb #DSC$K_CLASS_D, DSC$B_CLASS(r0) $$$cnt = 0 $$$arg = 0 .irp $arg, .if not_blank $arg $$$cnt = $$$cnt + 4 $$$arg = 1 $push $arg .endc .endr .iif not_equal $$$arg, pushal (sp) ; Address of argument list (if any) pushaq (r0) ; Address of output descriptor clrl -(sp) ; No returned length address pushaq faoctl ; Address of format control string calls #<3+$$$arg>, g^LIB$SYS_FAOL .iif not_equal $$$arg, addl #$$$cnt, sp pushaq (sp) ; Address of the output string... calls #1, g^LIB$PUT_OUTPUT ; ...print the string pushaq (sp) calls #1, g^STR$FREE1_DX ; ...and de-allocate it addl #8, sp ; Release the allocated descriptor popr #^m ; Restore R0 and R1 .endm ; ; PRINT ; ; Outputs a string of text to the screen ; .macro print text, ?l .save_psect .psect $text t'l: .ascid "'text'" .restore_psect pushaq t'l calls #1, g^LIB$PUT_OUTPUT .endm ; end