Hi guys,

I was always curious about Battlezone and I've been trying to figure out how it all works. My main goal is to find out where the 3d models for the tanks and objects are stored.

But first, I wanted to find the sin/cos table, since it's got to have one.

Sure enough, there's one at 5e77 to 5ef7.

A little bit of lua to visualize it: (we'll render it 3 times to make it brighter)


Code

function hex(a) return string.format("%x",a) end
mem=manager:machine().devices[":maincpu"].spaces["program"]

emu.pause()

for brightloop=1,3 do
xo=0 yo=200 xpos=xo
for wave=1,2 do
--middle to under
ibits=7 for i=0x5e77,0x5ef7,2 do val=mem:read_u16(i) x=math.floor(val/0x7fff*100) print(hex(i),hex(val),hex(x)) manager:machine().screens[":screen"]:draw_line(xpos,yo+x,xpos,yo+x,0xff000000 | (math.floor((ibits/11)*0xff)<<8)) xpos=xpos+1 end
--under to middle
for i=0x5ef7-2,0x5e77,-2 do val=mem:read_u16(i) x=math.floor(val/0x7fff*100) print(hex(i),hex(val),hex(x)) manager:machine().screens[":screen"]:draw_line(xpos,yo+x,xpos,yo+x,0xff000000 | (math.floor((ibits/11)*0xff)<<8)) xpos=xpos+1 end
-- middle to top
for i=0x5e77+2,0x5ef7,2 do val=mem:read_u16(i) x=math.floor(val/0x7fff*100) print(hex(i),hex(val),hex(x)) manager:machine().screens[":screen"]:draw_line(xpos,yo-x,xpos,yo-x,0xff000000 | (math.floor((ibits/11)*0xff)<<8)) xpos=xpos+1 end
--top to middle
for i=0x5ef7-2,0x5e77+2,-2 do val=mem:read_u16(i) x=math.floor(val/0x7fff*100) print(hex(i),hex(val),hex(x)) manager:machine().screens[":screen"]:draw_line(xpos,yo-x,xpos,yo-x,0xff000000 | (math.floor((ibits/11)*0xff)<<8)) xpos=xpos+1 end
print("wave"..wave.."done")
end -- wave
end --brightloop



[Linked Image from i.imgur.com]

A few more sine waves and I could be at the Outer Limits.

[Linked Image from i.imgur.com]

Just out of curiosity, I noticed that the vectors don't line up perfectly at the bottom on the self test screen.

A video that shows the self test screen close up on a real machine where the vectors don't line up exactly:

https://www.youtube.com/watch?v=YGMdVn0sN80&t=80s

I looked at the self test for a few of the other vector games and the one for quantum doesn't line up perfectly (I overlaid 2 of the pattern screenshots using gimp)

[Linked Image from i.imgur.com]