Not sure how to perform ZOH upsampling
You are correct. There is a trick you can use to code this process very easily. Assuming Matlab syntax, define a rectangular impulse response with M ones:

ir = ones(1,M);


Then, filter the upsampled train of impulses x:

zoh = conv(x,ir);


and you're done!