Search code examples
assemblyemu8086

Need A Good Explanation For An Assembly Language Code (8086 Micro processor)


This is an assembly language code for 8086 Micro processor where I have to multiply two hexa-decimal number. The code works when I use a 0 before the value of AX register in a form it is written now. But if I write it in a manner like just " MOV AX, AB24H " it generates an error. I want to learn the accurate reason of this error and just by using a 0 at beginning why it is sloved? Thanks in advance!

.MODEL SMALL
.STACK
.DATA
.CODE

MOV AX, 0AB24H
MOV BX, 25H
MUL BX

HLT           ; halt!


Solution

  • It is hard in some assembly variants to tell labels and numeric literals apart, which is why some assemblers require you to always start a numeric literal with a digit. You are good with 25H, since it start with a digit, but AB24H isn't necessarily a number. It could be a label defined elsewhere. Adding a leading 0 solves this, since labels cannot start with a digit.