- Asked 3/14
- 2073 Magh · 4 marks
- 2069 Poush · 4 marks
- 2068 Magh · 4 marks
8086 assembly language operators
Short answer
Assembly-time operators include arithmetic (+ – * / MOD), logical (AND OR XOR NOT), relational (EQ NE LT LE GT GE), PTR to force operand size, OFFSET/SEG to extract address components, HIGH/LOW to split bytes, and DUP for repeated data. $ returns current location counter.
List out and explain the operators used in 8086 assembly language programming.
Operators are used in assembler statements to build expressions that are evaluated by the assembler at assembly time (not run time). The main types in 8086 (MASM) are:
| Type | Operators | Example |
|---|---|---|
| Arithmetic | + - * / MOD | MOV AL,(5*4)+2 |
| Logical (bitwise) | AND OR XOR NOT | MOV AL,0F0H AND 3CH |
| Shift | SHL SHR | MOV AX,1 SHL 4 (=10H) |
| Relational | EQ NE LT LE GT GE | 5 GT 3 gives 0FFFFH (true), else 0 |
| Segment override | : | MOV AX,ES:[BX] |
| Index | [ ] | MOV AL,ARR[SI] |
| Type / attribute | PTR SHORT THIS | MOV WORD PTR [BX],5 |
| Value returning | OFFSET SEG TYPE LENGTH SIZE | MOV BX,OFFSET ARR |
| Byte extractors | HIGH LOW | MOV AL,HIGH 1234H (=12H) |
| Location counter | $ | LEN EQU $-MSG |
| Data repeat | DUP | BUF DB 10 DUP(0) |
Notes
OFFSET vargives the offset address of a variable;SEG vargives its segment address.PTRforces the size of an operand when it is not clear from the other operand, e.g.INC BYTE PTR [SI].TYPEreturns 1 for byte, 2 for word, 4 for double word;LENGTHreturns the number of DUP elements;SIZE= LENGTH × TYPE.$is the current location counter, so$ - MSGafter a string definition gives its length in bytes.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- 8086 ALP: sum of 100 even numbers · Microprocessor, chapter 3
- 8086 ALP: largest and smallest, display · Microprocessor, chapter 3
- 8086 ALP: words on lines and word count · Microprocessor, chapter 3
- 8086 ALP: count vowels and display string · Microprocessor, chapter 3
- 8086 ALP: vowels and consonants separately · Microprocessor, chapter 3
- 8086 ALP: convert text to uppercase · Microprocessor, chapter 3
- Define programming language · Computer Programming, chapter 1 · asked 3×
- Global vs local; & and * operators · Computer Programming, chapter 3
- Assembly constraints and tolerance fit calculation · Computer Aided Design, chapter 5
- Operators that cannot be overloaded · Object Oriented Programming, chapter 5 · asked 2×