There's a magic shop in the junkyard. You should be able to find it either after reaching a certain size or by beating the enemies in the forest and going onto the castle area - after doing either of those things you should get a message on the computer telling you about the magic shop