To do this the BASIC program compiles a routine into a block reserved in the RMA. It also sets the variable 'CLI$Prompt' as a Macro which uses the CSD variable 'Direction$Prompt'. Direction$Prompt will remain updated until a reset, CLI$Prompt can be changed at any time by the user.
This is a 32 bit clean version re-written from scratch after I found the original version would bring the machine down if the Filing System that contained the CSD was quit (discovered surprise, surprise, while developing Memphis 3).