Convert SCALE.ASM to C