by flohofwoe · 1y ago · 0 comments
That's common for machine code written without an assembler but typed directly into a hex monitor (don't know if Invaders was developed that way though). You kept a couple of nops in 'reserve' - usually after branches and returns - so that fixes can be applied without having to move the rest of the code around (which would mean retyping everything).
Manually add up all cycles for each instruction in each branch, then pad the shorter with noop to make them the same. Repeat for each code path, and cry when you need to make a change.
[1] https://www.mouser.com/c/semiconductors/integrated-circuits-...
I’m a neophyte. What do you mean by this? You mean “100100101…” by hand or…?
From my C transliteration: https://github.com/loadzero/si78c/blob/master/si78c.c
// xref 0462
//
// This code is using the shot counter as an index into the ROM
// (where some code resides), for the purposes of random number generation.
//
// For the saucer direction logic, only bit 0 of each bytecode is used.
//
// The 256 bytes used reside at 0800 -> 08FF
//
// If you check bit 0 of each byte in that ROM section, you will find that there is no bias,
// and there are exactly 128 0's and 128 1's.
//
// It seems unlikely that this was an accident, I think Nishikado deliberately constructed
// the ROM this way, and used some well placed NOPs to achieve fair balance.
//
// E.g. these NOPs
//
// 0854: 00 00 00
// 0883: 00 00 00
//
// This information can be exploited to the player's advantage.
//
// If using the shot counting trick to get high scores, the
// expected saucer direction for the first 6 saucers (if counting),
// will be as follows:
//
// [22,37,52,67,82,97]
// [0, 1, 1, 0, 1, 1]
// [L, R, R, L, R, R]