Cura just generates the g-codes.
M104 sets the hot-end temperature but the printer is allowed to keep processing commands (it does not have to wait until the hot-end reaches that temperature). M109 says it has to wait until the temperature is reached before it can go any further.
Similarly there is M140 and M190 for the bed temperature. M140 sets the temp. M190 tells it to “wait” for the bed temp.
Typically the printer gets an M104 and M109 to start things warming up, then does an M140 to “wait” for the printer to reach “softening” temperature so that it’s safe to retract a bit of filament (it wouldn’t be safe to assume it has reached softening temp just because the M104 was issued). At that point it retracts a little filament, then issues an M109 to drop to the “wiping” temp, then another M109 to drop to the “probe” temp (and meanwhile the bed is still heating up with that M109 command).
After the probe temp is reached, it’ll do a bed level.
After the bed level is completed it’ll issue another M140 to raise the hot-end temp to the printing temperature and will issue an M190 to reach the bed temp … all before laying down the filament at the start of the print.
The print head may go to a start position and re-prime the filament and sometimes there’s an M400 code which tells the printer to wait for the re-prime to complete and any other moves to complete before going any farther.
The Marlin G-codes are documented here:
You can look up codes if you want to know what they do. Generally the “G” codes execute moves (G is thought of as a “GO” command). But these are temporal codes in that once they’ve been executed there is no memory of the fact that they were ever done. The “M” codes are modal in that whatever they change sticks … until it’s changed again. That’s why temperature changes are done with “M” codes. With that said… there are some oddball exceptions. For example you can put the machine in “absolute” or “relative” position mode. In “absolute” mode, Telling the printer to do a G0 X10 would move the X-axis to 10 “units” (usually millimeters) from the 0-position (typically the end-stop). But in “relative” mode that would just move the printer +10 units from wherever it is now. So you’d think that would be a “modal” change because once you change the mode, all subsequent commands are interpreted in that mode (the printer “remembers” what mode it is in). The same is true of the units… you can set it to work in millimeters or inches and that’s done with a “G” code even though it’s really a modal change.
But most g-codes live in the moment… once the command is processed there is nothing that “sticks” (no modes were changed). And most “M” commands are modal changes (but an argument could be made that some are not).
The semi-colon ; is a comment delimiter… anything after a semicolon is ignored until the end of the line.