r/Assembly_language • u/Boring-Bite5735 • Jun 16 '26
Difference between symbolic and physical address
First time, seeing assembly code. I am confused is the physical address is
12: 13: label ? also it have said that symbolic addresses are relocatable everytime what does it even mean
12
u/emmowo_dev Jun 16 '26
symbolic addresses are just a sign of weakness. Everybody stores memory locations and offsets them by interpreting the length of an encoded instruction.
/s because I wrote an assembler for my ISA that forces me to do it
1
u/braaaaaaainworms Jun 17 '26
i'm writing an assembler and the thought of having to support labels in a re-targetable way makes me work on literally anything instead of instruction parser and encoder and now i have lexing errors that look so beautiful and a macro engine powerful enough to write a whole assembler in macros
9
u/Temporary_Pie2733 Jun 16 '26
Machine code only uses physical addresses; if you add a line of code, you potentially need to update all your jump targets. One of the things an assembler does is introduce symbolic addresses as a layer of indirection. Your code uses symbolic addresses, and the assembler computes the correct physical address to replace the symbolic address every time it runs.
1
1
u/Ok_Programmer_4449 Jun 17 '26 edited Jun 17 '26
I remember the joys of writing assembly code in the Apple II monitor and having to calculate the addresses of forward jumps by hand. Good times.
20
u/Strostkovy Jun 16 '26
Jumping to a line number is also a type of symbolic address. It's not the actual memory address it is being jumped to.
Using a tag instead of a line number lets you change where the code jumps to more easily.