Windows XP only runs on X86 cpus. The Raspberry PI runs on an ARM architecture. I’d just buy an old PC for DOS and XP.
I was wondering the same myself. Is there an x86 emulator of some sort? I know you can run Core on some of them. Maybe recompile? Knowning C language I’d say no.