Let me try to explain g-code and m-codes....ok 1st m-codes are for turning on a function like a coolant pump or turning I off or turning on a spindle or there are m codes that turn them both on at the same time ......
Now g-code ...g code tells the machine where to go to start cutting go - rapid , or g1 feed or even turning on a canned drilling cycle like g83, or g81 this is for fanuc controls for yours this is a sample program I found on the site
0 BEGIN PGM 12345678 MM
1 L M09
2 L M05
3 TOOL CALL 03 Z S15000
4 L M06
5 L M03
6 L X-51,000 Y+4,748 R0 F9999
7 L Z-5,000
8 L Z-13,320 R0 M08
9 L Z-18,570 R0 F1500
10 L X-51,181 Y+4,472 R0 F3000
11 L X-51,341 Y+4,278 R0
12 L X-51,509 Y+4,115 R0
13 CR X-51,858 Y+3,875 R+1,774 DR- R0
14 CR X-52,259 Y+3,736 R+1,448 DR- R0
15 CR X-52,698 Y+3,728 R+1,315 DR- R0
16 CR X-53,232 Y+3,925 R+1,450 DR- R0
17 CR X-53,538 Y+4,157 R+1,859 DR- R0
18 CR X-54,000 Y+4,748 R+2,454 DR- R0
2005 CR X-68,438 Y+16,043 R+1,592 DR- R0
2245 L X-34,194 Y+15,929 R0
2246 CR X-34,177 Y+15,531 R+1,592 DR- R0
2247 CR X-34,264 Y+15,087 R+2,005 DR- R0
2248 L X-34,352 Y+14,851 R0
2249 L X-34,500 Y+14,557 R0
2250 L X-42,872 Y+0,055 R0
2251 L Z-5,000 R0 F9999
2252 L M09
2253 L M05
2254 STOP M30
2255 END PGM 12345678 MM
Anyway I hope this helps