Emergent dynamics of a macroeconomic agent based model with capital and credit