I got an early Commodore 64 Computer, and needed to write assembly code for it.
Problem was, there was no Assembler Program for the C64 (either that, or I couldn't afford one).
So I wrote an assembler by looking up the 6502 opcodes in a book, and creating the program out of the raw bytes.
At some point it was able to take assembly code as its input, and assemble into a program.
A friend of mine had written a disassembler for his PET in BASIC. I used this program to disassemble my assembler, and was then able to use my assembler to assemble newer versions of itself.
Oh, the hoops we had to jump through in the old days :)