pdp_as.6 4.1 KB

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