“CNC Programming Handbook 3rd Edition” by Peter Smid.
You can also refer to the G CodeProgramming guides for Mach3 and Mach4.