No patcher ever "writes" firmware.
Only the company writes firmware. It's written in a programming language like C and then compiled with a special compiler designed for the applicable chipset.
A patcher then modifies this firmware created by the company. Either by disassembling the compiled firmwares in order to look at a few specfic instructions in the firmware, and then changing a handful of bytes to change a handful of instructions (for example, change "if blah, then jump to location A" to "if blah, then jump to location B") and thus tweak the behavior of the drive (i.e., region removal). Or by looking at well-ordered data tables and copying-and-pasting entries around in the data tables (NEC media hacks).