home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / pdp11 / k11nhd.mac < prev    next >
Text File  |  2020-01-01  |  2KB  |  86 lines

  1. ;    K11NHD.MAC
  2. ;
  3. ;    10-Apr-84  09:37:15  Brian Nelson
  4. ;
  5. ;    macros for defing things that may not be available
  6. ;    for RT11 systems, like MUL, DIV, ASH and SOB. This
  7. ;    must be prefixed in front of all assembly commands
  8. ;    for RT version of Kermit-11.
  9.  
  10.     .macro    mul    src,reg
  11.     .ntype $$,reg
  12.     mov    src    ,-(sp)
  13.     mov    reg    ,-(sp)
  14.     .globl    k11$mul
  15.     call    @k11$mul
  16.     .iif eq    ,$$-1    ,mov    (sp)+    ,r1
  17.     .iif eq    ,$$-3    ,mov    (sp)+    ,r3
  18.     .iif eq    ,$$-5    ,mov    (sp)+    ,r5
  19.     .iif  ne ,<$$+1>&1, .error    ; bad dst reg for MUL macro
  20.     .endm    mul
  21.  
  22.     .macro    div    src,reg
  23.     .ntype    $$,reg
  24.     mov    src    ,-(sp)
  25.     .iif eq    ,$$,    mov r1    ,-(sp)
  26.     .iif eq    ,$$-2,    mov r3    ,-(sp)
  27.     .iif eq    ,$$-4,    mov r5    ,-(sp)
  28.     .globl    k11$div
  29.     call    @k11$div
  30.     .if    eq, $$
  31.     mov    (sp)+    ,r1
  32.     mov    (sp)+    ,r0
  33.     .endc
  34.     .if    eq, $$-2
  35.     mov    (sp)+    ,r3
  36.     mov    (sp)+    ,r2
  37.     .endc
  38.     .if    eq, $$-4
  39.     mov    (sp)+    ,r5
  40.     mov    (sp)+    ,r4
  41.     .endc
  42.     .endm    div
  43.  
  44.     .macro    sob    reg,dst
  45.     dec    reg
  46.     bne    dst
  47.     .endm    sob
  48.  
  49. ;-    .macro    ash    amount,reg
  50. ;-    mov    reg    ,-(sp)
  51. ;-    mov    amount    ,-(sp)
  52. ;-    .globl    $ash
  53. ;-    call    $ash
  54. ;-    mov    (sp)+    ,reg
  55. ;-
  56. ;-    .endm    ash
  57.  
  58.  
  59.     .macro    ash    amount    ,reg
  60.     .ntype    $$$0    ,amount
  61.     .iif ne, 27-$$$0, .error    ; must be auto PC for ASH macro
  62.     $$type    =    1        ; assume left shift
  63.     $$size    =    0        ; how may asl/asr's to generate
  64.     .irpc    $a    ,<amount>    ; parse the first argument
  65.     $c    =    ''$a        ; get the character as a literal
  66.     .iif eq    ,$c - '- , $$type = -1    ; if a minus sign then assume right
  67.     .iif eq    ,$c - '. , .error    ; only use octal in ash macro please
  68.     .iif eq    ,$c - '^ , .error    ; only use default octal radix in ASH
  69.     $c    =    $c - '0        ; check for a digit now
  70.     .if    ge    ,$c        ; perhaps a digit
  71.     .ift                ; well ?
  72.     .if    le    ,$c-7        ; got a digit
  73.     .ift                ; add into accum then
  74.     $$size    =    <$$size * 10>+$c; simple
  75.     .endc
  76.     .endc
  77.     .endr
  78.  
  79.     .rept    $$size
  80.     .iif gt, $$type, asl reg
  81.     .iif lt, $$type, asr reg
  82.     .endr
  83.  
  84.     .endm
  85.  
  86.