truck was running good then all sudden went to 1/2 power,engine shaking on 2001 Mazda B3000

this happenned when I was driving down the road,also check engine light came on

Asked by for the 2001 Mazda B3000
agree with goodguy then post codes so we can adv
1 more answer , 1 more comment
first have it scan tested for codes
Thanks guy's I did have the codes checked and it was running on 4 cyls. It was the Ignition control module.