Absolute measurement has consistently been the primary focus in the development of precision linear and angular displacement measurements. The scheme design of binary zero position codes is an important factor for absolute measurement. Designing and optimizing high-bit zero position codes with over 100 bits face considerable challenges. Simultaneously, the working parameters of zero position codes [unit code width (b), distance (d), and yaw angle (α)] remarkably affect their post-installation performance, particularly in absolute positioning and limit code application in multi-degree-of-freedom measurement schemes. This study addresses these challenges by proposing a design method for zero position codes that considers diffraction based on generative adversarial networks and aims to explore a design with increased efficiency and accuracy as well as optimization for high-bit zero position codes. Additionally, the tolerance range of zero positioning performance for each working parameter is examined. By leveraging the adversarial network structure, this study generates the optimization of a 150-bit code and processes the tests of the zero position code by using simulation results. The following working parameter ranges for code design are recommended on the basis of theoretical and experimental results: b greater than 10 μm, d and α within 1000 μm and 3490 μrad, and avoidance of intervals with sharp changes in the full width at half maximum. The proposed code design and parameter optimization lay a solid foundation for research and engineering applications in absolute measurement field and have considerable potential for generalization and wide applicability.