i86_as.1 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. .\" $Header$
  2. .TH I86_AS 1
  3. .ad
  4. .SH NAME
  5. i86_as \- assembler for Intel 8086
  6. .SH SYNOPSIS
  7. /usr/em/lib/i86_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 segments
  13. An address on the Intel 8086 consists of two pieces:
  14. a segment number and an offset. A memory address is computed as
  15. the segment number shifted left 4 bits + the offset.
  16. Assembly language addresses only give the offset, with the exception of
  17. the address of an inter-segment jump or call (see \fIaddressing modes\fP
  18. below).
  19. For each segment type (.org, .text, .data, or .bss) the segment number
  20. must be given with the .sbase pseudo-instruction.
  21. The syntax is:
  22. .br
  23. .sbase <segment-id> expression
  24. .br
  25. with segment-id one of .org, .text, .data, or .bss.
  26. Example:
  27. .br
  28. .sbase .text 0x1000
  29. .IP registers
  30. The Intel 8086 has the following 16-bit registers:
  31. .br
  32. Four general registers: ax (accumulator), bx (base), cx (count), and dx (data).
  33. The upper halves and lower halves of these registers are separately
  34. addressable as ah, bh, ch, dh, and al, bl, cl, dl respectively.
  35. .br
  36. Two pointer registers: sp (stack pointer) and bp (base pointer).
  37. .br
  38. Two index registers: si (source index) and di (destination index).
  39. .br
  40. Four segment registers: cs (code), ds (data), ss (stack), and es (extra).
  41. .IP "addressing modes"
  42. .nf
  43. .ta 8n 16n 24n 32n 40n 48n
  44. syntax meaning
  45. expr the value of \fIexpr\fP is immediate data or
  46. an address offset. There is no special
  47. notation for immediate data.
  48. register one of the aforementioned general registers
  49. or their upper or lower halves, or one of the
  50. four segment registers.
  51. (expr) the value of expr is the address of the operand.
  52. (reg)
  53. expr (reg) the value of \fIexpr\fP (if present) + the contents of
  54. \fIreg\fP (which must be a pointer or an index register)
  55. is the address of the operand.
  56. (preg) (ireg)
  57. expr (preg) (ireg)
  58. the value of \fIexpr\fP (if present) + the contents of
  59. \fIpreg\fP (which must be a pointer register) + the
  60. contents of \fIireg\fP (which must be an index register)
  61. is the address of the operand.
  62. The next addressing mode is only allowed with the instructions
  63. "callf" or "jmpf".
  64. expr : expr the value of the first \fIexpr\fP is a segment number,
  65. the value of the second \fIexpr\fP is an address offset.
  66. The (absolute) address of the operand is computed
  67. as described above.
  68. .fi
  69. .IP instructions
  70. Each time an address is computed the assembler decide which segment register
  71. to use. You can override the assembler's choice by prefixing the instruction
  72. with one of eseg, cseg, sseg, or dseg; these prefixes indicate that the
  73. assembler should choose es, cs, ss, or ds instead.
  74. .br
  75. Example:
  76. .ti +8
  77. dseg movs
  78. .SH "SEE ALSO"
  79. uni_ass(6),
  80. ack(1),
  81. .br
  82. MCS-86 assembly language reference manual, 1978, Intel Corporation
  83. .SH EXAMPLE
  84. .nf
  85. .ta 8n 16n 24n 32n 40n 48n
  86. An example of Intel 8086 assembly language:
  87. _panic:
  88. push bp
  89. mov bp,sp
  90. .data
  91. _35:
  92. .word 24944
  93. .word 26990
  94. .word 14947
  95. .word 32
  96. .text
  97. call _disable
  98. mov ax,_35
  99. push ax
  100. call _str
  101. pop si
  102. push 4(bp)
  103. call _str
  104. pop si
  105. call _nlcr
  106. call _exit
  107. mov sp,bp
  108. pop bp
  109. ret
  110. .extern _nopanic
  111. _nopanic:
  112. push bp
  113. mov bp,sp
  114. .data
  115. _38:
  116. .word 28526
  117. .word 24944
  118. .word 26990
  119. .word 14947
  120. .word 32
  121. .text
  122. mov ax,_38
  123. push ax
  124. call _str
  125. pop si
  126. push 4(bp)
  127. call _str
  128. pop si
  129. push 6(bp)
  130. call _octal
  131. pop si
  132. mov sp,bp
  133. pop bp
  134. ret
  135. .fi