{"id":"mcode-m70","model_id":"M70","name":"LinuxCNC M70 Save Modal State","summary":"M70 explicitly saves the current modal state at the current call level in LinuxCNC. The saved state can later be restored exactly by executing M72. A typical use is to protect a program against inadvertent modal changes inside subroutines.","study_notes":["M70 saves modal state at the current call level; M72 restores that saved state.","A pair of M70 and M72 instructions is typically used to protect a program against inadvertent modal changes within subroutines.","At the main program level there is a single storage location for state; if several M70 instructions are executed in turn, only the most recently saved state is restored when M72 is executed.","Within a G-code subroutine, state saved with M70 behaves like a local named parameter: it can be used with M72 only within that subroutine invocation and goes away when the subroutine exits.","A recursive invocation of a subroutine introduces a new call level.","M70 saves G20/G21 units, selected plane, cutter compensation status, distance mode, feed mode, current coordinate system, tool length compensation status, retract mode, spindle mode, arc distance mode, lathe radius/diameter mode, path control mode, current F and S values, spindle status, mist and flood status, speed and feed override settings, adaptive feed setting, and feed hold setting.","The motion mode, such as G1, is not restored.","Modal state saved with M70 at the current call level can be invalidated with M71; a subsequent M72 at the same call level will fail.","M73 saves modal state within a subroutine and restores state on endsub or return; aborting a running program in a subroutine with an M73 operation will not restore state."],"safety_notes":[],"sources":[{"url":"https://linuxcnc.org/docs/html/gcode/m-code.html#mcode:m70","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":"M70","group":"modal state","syntax":"M70","parameters":[],"dialect":"LinuxCNC","related":[],"standards":[]},"url":"https://machineschema.com/instruction/mcode-m70","license":"https://creativecommons.org/licenses/by/4.0/"}