{"id":"mcode-m73","model_id":"M73","name":"LinuxCNC M73 Save and Autorestore Modal State","summary":"M73 is a LinuxCNC M-code that saves the interpreter's modal state within a subroutine and restores that state on subroutine endsub or on any return path. It is intended to be programmed at the beginning of an O-word subroutine so the subroutine can modify modal state while the calling program is protected from those changes. No explicit restore command is needed, because endsub or an explicit return restores the caller's state automatically.","study_notes":["M73 saves modal state in the current call context and restores it on return or endsub; no M72 is needed after it.","The suggested placement is the first line of an O-word subroutine that needs to change modal state.","Aborting a running program inside a subroutine that contains M73 does not restore state.","The normal end (M2) of a main program that contains an M73 does not restore state.","An M72 or a return from a subroutine containing M73 restores all modal state saved; preserving only selected aspects requires predefined named parameters, local parameters and conditional statements.","M73 relates to M70 (explicit save) and M72 (explicit restore), and M71 invalidates state saved by M70 or M73."],"safety_notes":["Aborting a running program in a subroutine which has an M73 operation will not restore state.","The normal end (M2) of a main program which contains an M73 will not restore state."],"sources":[{"url":"https://linuxcnc.org/docs/html/gcode/m-code.html#mcode:m73","title":"M-Codes","accessed":"2026-10-26"}],"verification":{"status":"source_checked","checked_at":"2026-10-26","values":3,"method":"llm_source_check"},"updated_at":"2026-10-26","type":"instruction","spec":{"language":"gcode","code":"M73","group":"modal state","syntax":"M73","parameters":[],"dialect":"LinuxCNC","related":["mcode-m02"],"standards":[]},"url":"https://machineschema.com/instruction/mcode-m73","license":"https://creativecommons.org/licenses/by/4.0/"}