pdp_as.1 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. .\" $Header$
  2. .TH PDP_AS 1
  3. .ad
  4. .SH NAME
  5. pdp_as \- assembler for PDP 11
  6. .SH SYNOPSIS
  7. /usr/em/lib/pdp_as [options] argument ...
  8. .SH DESCRIPTION
  9. This assembler is made with the general framework
  10. described in \fIuni_ass\fP(6).
  11. .SH SYNTAX
  12. .IP registers
  13. The pdp11 has seven general registers, numbered r0 through r7.
  14. Of these, r6 is the stack pointer and can also be referenced to by \fIsp\fP,
  15. r7 is the program counter and has \fIpc\fP as synonym. There are also six
  16. floating-point registers fr0 through fr5, but the names r0 through r5 can
  17. also be used. From the context will be derived what kind of register is meant.
  18. .IP "addressing modes"
  19. .nf
  20. .ta 8n 16n 24n 32n 40n 48n
  21. syntax meaning (name)
  22. reg contents of register reg is operand.
  23. (register)
  24. (reg) contents of reg is address of operand.
  25. (register deferred)
  26. (reg)+ as (reg), but after the operand is fetched
  27. the contents of reg is incremented by the
  28. size of the operand. (auto-increment)
  29. *(reg)+ contents of reg points to address of the operand.
  30. after the operand is fetched, reg is incremented
  31. by two. (auto-increment deferred)
  32. -(reg) as (reg), but before the operand is fetched
  33. the contents of reg is decremented by the
  34. size of the operand. (auto-decrement)
  35. *-(reg) before the operand is fetched, reg is decremented
  36. by two. then the contents of reg points to the
  37. address of the operand. (auto-decrement deferred)
  38. expr(reg) value of expr + contents of reg yields address
  39. of operand. (index)
  40. *expr(reg) value of expr + contents of reg yields pointer
  41. to address of operand. (index deferred)
  42. $expr the value of expr is the operand. (immediate)
  43. *$expr the value of expr is the address of the operand.
  44. (absolute)
  45. expr expr is address of operand. (relative)
  46. *expr expr points to the address of the operand.
  47. (relative deferred)
  48. .fi
  49. .IP "condition code instructions"
  50. Two or more of the "clear" instructions (clc, cln, clv, clz), or
  51. two or more of the "set" instructions (sec, sen, sev, sez) may be
  52. or-ed together with `|' to yield a instruction that clears or sets two or more
  53. of the condition-bits. Scc and ccc are not predefined.
  54. .IP "extended branches"
  55. The assembler recognizes conditional branches with a "j" substituted for
  56. the "b". When the target is too remote for a simple branch, a converse branch
  57. over a jmp to the target is generated. Likewise jbr assembles into either br
  58. or jmp.
  59. .IP "floating-point instructions"
  60. The names of several floating-point instructions differ from the names
  61. in the handbook mentioned below. Synonyms ending in "d" for instructions ending
  62. in "f" are not recognized. Some instructions have different names; the mapping
  63. is as below.
  64. .nf
  65. .ta 8n 16n 24n 32n 40n 48n
  66. handbook pdp_as
  67. ldcif, ldclf,
  68. ldcid, ldcld movif
  69. stcfi, stcfl,
  70. stcdi, stcdl movfi
  71. ldcdf, ldcfd movof
  72. stcdf, stcfd movfo
  73. ldexp movie
  74. stexp movei
  75. ldd, ldf movf
  76. std, stf movf
  77. .fi
  78. The movf instruction assembles into stf, when the first operand is one of the
  79. first three floating-point registers, otherwise it assembles into ldf.
  80. .IP sys
  81. This instruction is synonymous with trap.
  82. .SH EXAMPLE
  83. An example of pdp11 assembly code.
  84. .nf
  85. .ta 8n 16n 24n 32n 40n 48n
  86. !this is the routine that reads numbers into r0
  87. !the number is terminated by any non digit
  88. !the non digit is left in r1
  89. innum: clr r3 !r3 will accumulate the number
  90. inloop: jsr pc,_getchar !read a character into r0
  91. cmp r0,$0121 !is it a Q?
  92. jeq quit
  93. cmp r0,$48 !is the character a digit?
  94. jlt indone !digits 0-9 have codes 060-071 octal
  95. cmp r0,$56
  96. jgt indone
  97. mul $10,r3 !r3 = 10 * r3
  98. sub $48,r3 !convert ascii code to numerical value
  99. add r0,r3 !r3 = old sum * 10 + new digi
  100. jbr inloop
  101. indone: mov r0,r1 !put the first non digit into r1
  102. mov r3,r0 !put the number read into r0
  103. rts pc !return to caller
  104. .fi
  105. .SH "SEE ALSO"
  106. uni_ass(6),
  107. ack(1),
  108. .br
  109. PDP11/60 processor handbook, Digital Equipment Corporation, 1977
  110. .SH BUGS
  111. You cannot use *reg in place of (reg). Likewise *(reg) is not understood as
  112. *0(reg).