Dušan began to fight against the Byzantine Empire in 1334, and warfare continued with interruptions of various duration until his death in 1355. Twice he became involved in larger conflicts with the Hungarians, but these clashes were mostly defensive. Dušan's armies were initially defeated by Charles I of Hungary's 80,000-strong royal armies in Šumadija in 1336. As the Hungarians advanced south towards a hostile terrain, Dušan's cavalry launched several attacks in the narrow open fields, resulting in a rout of Hungarian troops, which retreated to the north of Danube. Charles I was wounded by an arrow but survived. As a result, the Hungarians lost Mačva and Belgrade. Dušan then focused his attention on the internal affairs of his country, writing, in 1349, the first statute book of the Serbs.