computerarcheology icon indicating copy to clipboard operation
computerarcheology copied to clipboard

Asteroids DVG / VectorROM scale factor

Open nzeemin opened this issue 3 years ago • 2 comments

Thanks a lot for your great work on Computer Archeology!

I was trying to reproduce some vector "sprites" using description here: https://www.computerarcheology.com/Arcade/Asteroids/VectorROM.html But found a problem with the scale factor description and VEC/SVEC instructions. Everything is alright with the VEC description. But for SVEC I found that the two scale factor bits are not the same scale 0..3 as for the VEC instruction.

Take a look at "y" coordinates for the spaceship here:

ShipDir0:
0A90: 0F F6           SVEC    scale=02(/128) bri=0     x=-3      y=-2      (-6.0000, -4.0000)
0A92: C8 FA           SVEC    scale=03(/64)  bri=12    x=0       y=2       (0.0000, 8.0000)
0A94: BD F9           SVEC    scale=03(/64)  bri=11    x=-1      y=1       (-4.0000, 4.0000)
0A96: 00 65 00 C3     VEC     scale=06(/8)   bri=12    x=768     y=-256    (96.0000, -32.0000)
0A9A: 00 65 00 C7     VEC     scale=06(/8)   bri=12    x=-768    y=-256    (-96.0000, -32.0000)
0A9E: B9 F9           SVEC    scale=03(/64)  bri=11    x=1       y=1       (4.0000, 4.0000)
0AA0: 00 D0           RTS                         

Here we go -32 -32 = -64 by "y" axis for two long vectors (VEC), but on the left side of the same ship looks like we are going +8 +4 +4 = 16, and all of that using short vectors (SVEC). So that's wrong - this sums should be equal - we're returning to the same point here.

After some thought I understood that SVEC scale and VEC scales are not the same. This fragment should (probably) look like this:

ShipDir0:
0A90: 0F F6           SVEC    scale=02(??)   bri=0     x=-3      y=-2      (-??.0000, -??.0000)
0A92: C8 FA           SVEC    scale=03(*16)  bri=12    x=0       y=2       (0.0000, 32.0000)
0A94: BD F9           SVEC    scale=03(*16)  bri=11    x=-1      y=1       (-16.0000, 16.0000)
0A96: 00 65 00 C3     VEC     scale=06(/8)   bri=12    x=768     y=-256    (96.0000, -32.0000)
0A9A: 00 65 00 C7     VEC     scale=06(/8)   bri=12    x=-768    y=-256    (-96.0000, -32.0000)
0A9E: B9 F9           SVEC    scale=03(*16)  bri=11    x=1       y=1       (16.0000, 16.0000)
0AA0: 00 D0           RTS                         

In this case the walk along the "y" axis will match: 32+16+16 = 64. So for SVEC scale = 3 we should have "multiply by 16" scaling operation. I'm not sure about other SVEC scales.

nzeemin avatar May 31 '21 19:05 nzeemin

I'm not sure about other SVEC scales.

It continues scaling from where scaling on VCTR ends (where scale 9 is / 1). For SVEC scale 0 is * 2, scale 1 is * 4, and scale 2 is * 8.

slx7R4GDZM avatar Jul 06 '21 04:07 slx7R4GDZM

Sorry for the delay! Work is crazy. Thanks for the info!

topherCantrell avatar Jul 09 '21 14:07 topherCantrell

Better late than never, eh? I corrected all the SVEC coordinates in the VectorROM. I gave you credit for this in the "corrections" section: https://computerarcheology.com/Arcade/Asteroids/#corrections

topherCantrell avatar Jun 29 '24 14:06 topherCantrell