The way it's supposed to work is that pressing F2 toggles between keyboard and gamepad mode while the game is running so you should be able to do it at any time, but on my current setup I can't get the gamepad to work at all so who knows. It probably depends on what kind of gamepad you're using. I certainly don't know why I programmed it that way all those years ago.
I'm thrilled you're enjoying the game, though. Let me know if you beat it.