dis51 - Disassembler for 8051 code in Intel Hex format
emu8051 - Emulator and simulator for 8051 microcontrollers
mcu8051ide - Integrated Development Enviroment for 8051
You can run your code in these simulators or disassemble and check.
However the easy way is to add a serial monitor.
http://www.pjrc.com/tech/8051/paulmon2.html