0% found this document useful (0 votes)
2K views2 pages

A Forward Reference Problem & It's Solution

A forward reference problem occurs when a label is used as an operand in an assembly instruction before it is defined. The assembler does not know the address of the forward referenced label until it reads the label's definition. Backpatching solves this issue by leaving the operand field blank initially, maintaining a table of incomplete instructions, and using a backpatching list to fill in the address of the forward referenced label after it is defined.

Uploaded by

Derek Smith
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views2 pages

A Forward Reference Problem & It's Solution

A forward reference problem occurs when a label is used as an operand in an assembly instruction before it is defined. The assembler does not know the address of the forward referenced label until it reads the label's definition. Backpatching solves this issue by leaving the operand field blank initially, maintaining a table of incomplete instructions, and using a backpatching list to fill in the address of the forward referenced label after it is defined.

Uploaded by

Derek Smith
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

A forward reference problem & it’s

solution
A forward reference occurs when a label is used as an operand, for example in MOVEM instruction
,the assembler cannot know the address of the forward reference label until it reads the definition of
the label.

Eg. Assembly program


START 200
MOVER AREG, = ‘5’
MOVEM AREG , X
L1 MOVER BREG, = ‘3’
LTORG
X DS 1
END

The back patching is a solution to the forward reference problem that occurs in one pass assemblers.

Backpatching
• Initially the operand field of an instruction
containing a forwarded reference is left blank.
• A table of instruction containing forwarded
reference is maintained separately called table of
incomplete instruction.(TII).
• This table can be used to fill up the address in
incomplete instruction.
• The address of the forwarded reference symbol is
put in the black field with the help of back
patching list.

You might also like