Following my previous post, where I questioned whether Gauntlet's code was written in C as opposed to assembler, I've come to the realisation that OutRun's slave CPU code was probably generated by a compiler and is not hand-written assembler.
The slave CPU controls the road rendering. So essentially it generates the curves, height variation, road splitting and appearance, from the level data.
This has added an extra layer of obfuscation to the decompilation, as the resulting code is less logical and is convoluted to follow. Maybe AM2 had spare CPU cycles to play with, and decided to simplify the source code to this complex area by writing the code in C, as opposed to assembly code as used by the main CPU.
One of the first instructions sets one of the address registers to point at the start of RAM:
The a5 register is never changed and there seems to be an over-reliance on using this block of memory, where a data register would be much faster:
move.l d1,$712(a5) ; ... add.l $712(a5),d2 ; Why not use add.l d1,d2?
And then there are blocks of code that are just pure spaghetti or irrelevant. I don't know much about compilers, but back in 1986 it's clear they produced dreadful code.
ROM:00001C80 tst.w $720(a5) ROM:00001C84 beq.w *+4 ; What is this here for? ROM:00001C88 addi.w #$100,d1
On the other hand, a quick look at Gauntlet's code in Mame's debugger does not seem to yield equal levels of insanity. Maybe Gauntlet was coded in assembler after all.
I'd like to know what compiler Sega/AM2 were using. Does anyone know if it's possible to determine from a signature in the code? Is C the likely source language?