i86_as.1 3.3 KB

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