<p><a href="https://3dprinting.stackexchange.com/questions/3586/adding-custom-m-codes-to-marlin">Adding custom M Codes to Marlin</a> doesn't work for Marlin 2.0</p>

<p>How would one go about adding custom G codes or M Codes to Marlin 2.0? The Marlin_main.cpp file does not exist. </p>

<p>In general for Marlin 2.0, things are organized better, but split into more files. </p>

The code in 2.0.x is similar to the old branch 1.1.x, G-code is parsed in
```
gcode.cpp
```
, specifically in
```
process_parsed_command
```
:
```
```
void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/)
```
```
In the case statement the codes read from the G-code files are parsed (interpreted) and the appropriate method is called (e.g.
```
G28()
```
calls
```
void GcodeSuite::G28()
```
)
If you want to create your own codes, it could be an idea to start there. Also think of using a different letter and/or codes in the 10,000 range so that it will not collide with new implemented G-codes.