; K11NHD.MAC ; ; 10-Apr-84 09:37:15 Brian Nelson ; ; macros for defing things that may not be available ; for RT11 systems, like MUL, DIV, ASH and SOB. This ; must be prefixed in front of all assembly commands ; for RT version of Kermit-11. .macro mul src,reg .ntype $$,reg mov src ,-(sp) mov reg ,-(sp) .globl k11$mul call @k11$mul .iif eq ,$$-1 ,mov (sp)+ ,r1 .iif eq ,$$-3 ,mov (sp)+ ,r3 .iif eq ,$$-5 ,mov (sp)+ ,r5 .iif ne ,<$$+1>&1, .error ; bad dst reg for MUL macro .endm mul .macro div src,reg .ntype $$,reg mov src ,-(sp) .iif eq ,$$, mov r1 ,-(sp) .iif eq ,$$-2, mov r3 ,-(sp) .iif eq ,$$-4, mov r5 ,-(sp) .globl k11$div call @k11$div .if eq, $$ mov (sp)+ ,r1 mov (sp)+ ,r0 .endc .if eq, $$-2 mov (sp)+ ,r3 mov (sp)+ ,r2 .endc .if eq, $$-4 mov (sp)+ ,r5 mov (sp)+ ,r4 .endc .endm div .macro sob reg,dst dec reg bne dst .endm sob ;- .macro ash amount,reg ;- mov reg ,-(sp) ;- mov amount ,-(sp) ;- .globl $ash ;- call $ash ;- mov (sp)+ ,reg ;- ;- .endm ash .macro ash amount ,reg .ntype $$$0 ,amount .iif ne, 27-$$$0, .error ; must be auto PC for ASH macro $$type = 1 ; assume left shift $$size = 0 ; how may asl/asr's to generate .irpc $a , ; parse the first argument $c = ''$a ; get the character as a literal .iif eq ,$c - '- , $$type = -1 ; if a minus sign then assume right .iif eq ,$c - '. , .error ; only use octal in ash macro please .iif eq ,$c - '^ , .error ; only use default octal radix in ASH $c = $c - '0 ; check for a digit now .if ge ,$c ; perhaps a digit .ift ; well ? .if le ,$c-7 ; got a digit .ift ; add into accum then $$size = <$$size * 10>+$c; simple .endc .endc .endr .rept $$size .iif gt, $$type, asl reg .iif lt, $$type, asr reg .endr .endm