Symbol Table

Conventional Machine Language consists of 0's and 1's. This makes Conventional Machine Languange inconvenient for people. Hence, Assembly Language was created. However, assembly language is not a very complicated language, the hardest thing that it does is to look up symbolic names in a table and return the associated number. This table is called the Symbol Table. It is used so that programmers refer to memory locations using symbolic names instead of using the actual numeric addresses. Here is an example of a data segment, a partial code segment, the associated memory that is created, and the symbol table that the assembler would create.

	.DATA
Num	DB	5
BigNum	DW	0ABCDh
Huge	DD	12345678h
Pres	DB	'Bill'
Arr	DW	0,1,2,3
Undef	DD	2 DUP(?)
Dozen	EQU	12
	.CODE
start:	mov	ax,@DATA
	mov	ds,ax

Here is the memory that would be allocated for this data. Notice that 'Dozen' and 'start' do not generate any memory. Also, 'undef' would not initialize its memory, so I have just placed some random values there.

Hex Address	Byte Content (hex)	Comment

0000		05			Num
0001		CD			BigNum, Notice the byte swapping
0002		AB
0003		78			Huge, byte swapping
0004		56
0005		34
0006		12
0007		42			Pres, no byte swapping
0008		69
0009		6C
000A		6C
000B		00			Arr, each word is byte swapped
000C		00
000D		01			Arr+2
000E		00
000F		02			Arr+4
0010		00
0011		03			Arr+6
0012		00
0013		89			Undef, random values in the next 8 bytes
0014		FA
0015		01
0016		99
0017		5F
0018		4E
0019		D4
001A		8E

Here is the symbol table for the above .DATA and .CODE segments

Symbol		Hex Offset	Segment		Size
Num		00		DS		Byte
BigNum		01		DS		Word
Huge		03		DS		Double
Pres		07		DS		Byte
Arr		0B		DS		Word
Undef		13		DS		Double
Dozen		0C	
Start		00		CS		Byte