I'm just curious whether or not there was a pre-HRE.
NB: I'm far from being an expert on the Middle Ages, so I would be happy for any corrections if they are needed!
Okay, so there are a bunch of misconceptions here. First of all: It wasn't called the "Holy Roman Empire" because it was in possession of Rome. In fact, throughout it's thousand-year long history (depending on where you set the beginning, at least), Rome never formed part of its territories and to my never knowledged also never was invaded by Imperial forces with one exception: the famous "Sack of Rome" in 1527, when Imperial troops entered Rome during the war between the Empire and the League of Cognac (which was led by France, but also included the Papacy). The Empire had been calling itself "Roman" long before that, though.
So, to emphasise it again: Possession of the city of Rome didn't have anything to do with calling yourself "Roman". "Roman" had come to refer to the old Roman Empire as a whole, and later on to the idea of Empire as well. You can see the adjective "Roman" being decoupled from the actual city bounds quite nicely with the Byzantine/East Roman Empire, whose inhabitants called themselves "Rhomaioi" (=Roman) up until the end of the Empire and even beyond.
It's hard to pinpoint a starting point for the history of the HRE, but at least in contemporary theory it was the imperial coronation of Charlemagne in 800 that started it. Charlemagne deliberately called himself "Roman Emperor" for several reasons: 1. The political prestige connected with the memory of "Rome" was still strong in the West, and he wanted that for him; 2. Charlemagne used his new title as part of a political manouevre aimed aganinst the Eastern Empire, and 3. there was the widespread idea during that time that the four kingdoms referred to in the Biblical book of Daniel were actually meant to be a prophecy, and that after the end of the fourth kingdom the end of the world was to come about. This fourth and last kingdom was commonly identified as the Roman Empire, and so it was in everybody's best interests to keep it going.
This is where the idea of "translatio imperii" (=transfer of rule) comes into play. Even though the city of Rome had nothing to do anymore with the idea of the Roman Empire, Charlemagne and his advisors still needed to come up with a legitimate reason for styling himself "Roman Emperor". The translatio was just that: The idea that Roman rule had legitimately and legally passed on to Charlemagne. Just how this was supposed to have worked differed greatly between the various scholar involved, and throughout the Middle Ages and the Early Modern Era there were lots of people who claimed the inheritance of Rome for themselves.
So, what came before? Well, there was the Kingdom of the Franks ruled over by Charlemagne, but the idea of the Roman Empire was distinct from that. When Charlemagne took that title, he also brought forth a claim over all of Christendom, essentially: His "old" Frankish kingdom had ceased to be his only possession and merely formed the direct powerbase of the rightful Emperor claiming dominion over a continent. This distinct idea of a Roman Empire lived on when Otto I claimed the imperial throne again 162 years later and was kept alive only coincidentally (at least according to legal theory of the time) in the areas that would later come to be known as "Germany". This was also why the Emperors of the HRE actually carried two titles: King of the Germans, and Roman Emperor. These titles were distinct, they were assumed during different occasions and under different ceremonies.
To sum up: The HRE didn't came about because a German king conquered the city of Rome and decided to style himself Roman Emperor from then on. Instead, according to the legal philosophy of the time, the title "Roman Emperor" was still alive though dormant, at least in the west, and in this view Charlemagne only assumed this title in addition to his other function as King of the Franks when he was crowned Emperor by the Pope in 800. The City of Rome didn't really come into play here, although many still saw it as a requirement that the Roman Emperor also be crowned in Rome. This practice endured throughout the Middle Ages, but was eventually also abandoned: Maximilian was the first Emperor of the HRE to be crowned outside of Rome in 1508, and his successor Charles V was the last Emperor to be crowned by the Pope in 1530. After that, the decoupling of the Roman Emperor to the city of Rome was complete.