I'm with Ted on this one.... You haven't listed any error codes (e.g. P0300 would be an 'engine misfire').
You probably have a cheap OBD-2 scan tool. When it comes to the Check Engine codes, beware that some are generic while some are Mazda specific. A quick google of the code with your car model will point you in the right direction.
If the engine overheated you could have warped the head. Check the vitals such as oil level, coolant level and battery charge before you do anything.
Best of luck with the fault-finding.
2002 GSi A/C 323F, 1598cc, ZM Engine, Manual Transmission, ODO 140k miles.