-1

Assembly is a human readable language but it typically has a one to one relationship with the corresponding machine code. Therefore an assembler is said to perform isomorphic (one to one mapping) translation.

I need to know what is meant by one to one mapping translation in assembler.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
gihansalith
  • 1,770
  • 5
  • 17
  • 21
  • It means isomorphic. :) It means that a single instruction `ADD AX, 5` will be encoded to a single Machine Language instruction `0x4805`, for example. – David Hoelzer Nov 22 '17 at 19:31
  • understand this is with respect to the instructions themselves, add, xor, store, load, etc. but there is more to the syntax for an assembler, labels and directives which do not necessarily produce any "code", but are still part of the assembly language for that assembler. – old_timer Nov 23 '17 at 23:25

3 Answers3

7

What is meant is that every mnemonic you write in your assembly file corresponds to a single instruction in machine code. In a way, the assembly file is just a way to represent the machine code in a human readable manner.

Note that this is a simplification. On some machines, some instructions can be represented by more than one mnemonic and some instructions cannot be generated by the assembler. This can happen for example, when there are multiple ways to map a single mnemonic to instructions and the compiler just picks one, leaving the other ways unachievable. For example, on the 8086 you can encode the mnemonic mov ax,bx both as 89 c3 and 8b d8 and the assembler generally picks one option, leaving the other one unencodable.

fuz
  • 88,405
  • 25
  • 200
  • 352
  • 1
    `gas` for example has `mov.s` for the alternative encoding. – Jester Nov 22 '17 at 16:46
  • @Jester and you can always use also `db 0x8b, 0xd8` to emit particular opcode you wish. Still a reasonable *simplification* to me, unless the OP is asking exactly because of those tiny exceptions, but then he could have been more specific. On general level this answer is spot on. – Ped7g Nov 22 '17 at 17:20
  • @Ped7g I was just reflecting on the _"leaving the other one unencodable"_. – Jester Nov 22 '17 at 18:04
1

What they mean to say is:

If you have a machine instruction, this is some n-bit code, there's exactly one assembler command that corresponds to this n-bit code. If this is also true the other way around, you have the one-to-one mapping.

Ronald
  • 2,842
  • 16
  • 16
  • 1
    In example on x86 CPU the text mnemonics "add al,al" will assemble as two bytes `00 C0`, and other way around, disassembling two bytes `00 C0` will be shown as `add al,al` (although especially with x86 there's some ambiguity where the same machine code is different instruction for CPU based on current CPU mode (16/32/64) and possible prefix bytes read before the instruction op code .. but as long as you know CPU mode, and opcode starting address in memory, there's only single text mnemonics to encode that opcode (sans some syntax variation allowing different ways to write it)). – Ped7g Nov 22 '17 at 16:41
-2

When you use an assembler to perform an operation, assembler map one by one (means scan only one instruction or mnemonic ) and other will be left and select in next process ( in next scanning process) .