A melzi has a 1284p (or 644p if its older) you need to select this as a board or its just not going to work...
Take a look at [
dustsreprap.blogspot.co.nz]
This will add support for the 1284p
regarding endstops, when you have it talking send the printer M119 commands, it till tell you the current endstop status
Basicly make sure no endstops are triggered, send a M119, it should tell you they are all open. Then manual trigger each end stop in turn and send a M119 for each test, it should display triggered for the endstop your testing.
NB if you have switch based endstop, make sure to plug them in the correct way!, putting them on the wrong way will burn out the voltage regulator on the mega.
(its shorts +5v to gnd via the switch, vs shorting S to gnd as it should)