News for hackers. Stuff that matters.
Re:Show HN: Space Invaders in C by matsemann on Friday December 06, 2019 @03:56AM (#21720181)
I'd like to read more about this setup!
Re:Show HN: Space Invaders in C by loadzero on Friday December 06, 2019 @04:18AM (#21720258)
Yeah, there's probably a good article or two in that.

Cliff notes:

It's basically an extension of the Dual CPU setup mentioned in http://www.gtoal.com/sbt/

In that article, Graham Toal discusses a hack where you can bootstrap a new emulator core from an existing one by making a custom emulator that drives both cores at the same time.

After each clock tick, you check the states of both processors for divergence and halt with the diff if there is one.

Re:Show HN: Space Invaders in C by zentiggr on Friday December 06, 2019 @08:34AM (#21721597)
First I've heard of the technique, that is amazing.

Makes me consider getting back to lower level coding again, even just test code, just to see it in action.

Re:Show HN: Space Invaders in C by FullyFunctional on Friday December 06, 2019 @09:30PM (#21728061)
Co-simulation is widely used for verifying RTL implementations, see fx. dromajo.org but it's a general useful thing and I've used in many contexts, even for verifying a compiler against an interpreter.
Re:Show HN: Space Invaders in C by loadzero on Friday December 06, 2019 @08:47AM (#21721689)
It's a great technique.

Using it, and a suitable test program, you can bootstrap an emulator core for something simple like a mips, z80 or 6502 in a day or two.

I highly recommend it as a low-level itch scratching programming exercise.

Re:Show HN: Space Invaders in C by exlurker on Friday December 06, 2019 @11:06AM (#21723001)
Thank you for this, amazing labour of love! And this article really gets my mind churning ... :)