Reading over some assembly for a 8051 project and I'm having difficulty understanding why some hex values have leading zeros and some don't, am I right in presuming both examples set acc.5 to 1?
mov a, #020h
mov a, #20h
am I right in presuming both examples set acc.5 to 1?
Yes.
But your hidden question is: "Why have hex values a leading zero even if it seems not to be necessary?"
Well, that's just for visual consistency with values beginning with 'A' to 'F'. If those would not start with a digit they would not be recognized as numbers but as identifiers.
mov a, #0E0H ; loads hex E0 (= dec 224) into ACC
mov a, #E0H ; loads the value of "E0H" into ACC, with any value defined as "E0H"
The author likes to write all values the same way. If there's a value without zero it might be a typo, a missed case, from another author, or for any other reason.