Yes, but it depends on the kind of code. Some codes can be patched by simply adding or subtracting a value to get the ROM address from the RAM address, depending on whether the file the bytes are in is always loaded in the same area of RAM or not. Some codes can be patched to ROM by writing some assembly code (button activators, etc.) but this can lead to problems with getting your code to always be loaded in RAM since there is very limited free space in files that are always loaded. The best way to handle this is probably to modify the game's boot code to load your code into RAM when the game is started, providing there's somewhere in RAM that's safe to put it (so it doesn't get overwritten).