Context: writing an assembler. Imagine you write code from scratch, with no toolchain support. You are alone with the computer in front of you and you get the cpu documentation. Back in the days.
When you need to write in binary, how do you know how to shape the bits at the lowest level?
For example convert #253 (can be any value up to 2^32, and could be hexadecimal as well) to a binary immediate. Am I obliged to parse it byte per byte from right to left, multiply by 10 (or 16 for hex) )everytime and store the result in the accumulating register?
Is this what assemblers do at the lowest level to form the stream of bits? (adding and shifting)?