Wednesday, January 23, 2019

Finding Stellar 7's cos table

I really love the mame debugger. I've got a new project: to figure out how Stellar 7's code works. It's such a genius game, I want to know how it was done.

So how does it do the math?

It stores the cos table in 0xF00 to 0xFFF, where the angle goes from 0 to 255. The high bit of the entry is the sign bit and the cos value is the low 7 bits. A value of 127 represents a value of 1.0, and a value of 0 represents 0.0. 128 represents the value of -0. 255 represents a value of -1.0.

In the next installment I'll show how it does the multiplication using the table.








To display the cos table, let's do a little bit of lua to render it to the apple's screen memory. If you've got the debugger open, just single step to get the screen to update.



No comments:

Post a Comment