mwenge / tempest2k

Tempest 2000 (1994) by Jeff Minter
22 stars 2 forks source link

Source not shiftable #2

Open Wuerfel21 opened 1 week ago

Wuerfel21 commented 1 week ago

Just saw that there's some cleanup activity here now. So as you may have noticed, the source as presented here is not shiftable and will break when instructions are added/removed.

I actually fixed most of this in my fork repo (https://github.com/Wuerfel21/tempest2k), though it's perhaps not directly mergeable because maintaining a 1:1 match to the original binary wasn't the point there. (Though it should/does build a functioning Jaguar binary still - maybe go back a few revisions to avoid all the ifdef noise). In particular, all of the """padding""" files referenced in images_sounds.s are actually important and contain hardcoded pointers (the music pointers IIRC are even for some reason appended to one of the image files). And then there's hardcoded pointers to those inside the main yak.s

mwenge commented 1 week ago

Coincidentally I've been prodding that part of the buiild the last couple of days. You're referring to the sample table I think right? This guy:

;                              Prio-                             Ze   Repeat     Repeat
;      Name                    rity   Period Start      Length   ro   Start      Length      
;      ----------------------  -----  ------ ---------  -------  --   ---------  ---------
; dc.b 'Engine Noise 1      ', $0001, $01ac, $009acd00, $0011a0, $00, $009acd02, $00119e, $00
; dc.b 'Player Shot Normal 2', $0002, $01ac, $009adea4, $0008e8, $00, $009adea4, $000000, $00
; dc.b 'Engine Noise        ', $0003, $01ac, $009ae290, $003378, $00, $009aee9e, $002594, $00
; dc.b 'Player Death        ', $0004, $00d6, $00000000, $00549a, $00, $00000000, $000000, $00
; dc.b 'Player Death 2      ', $0005, $01ac, $00000000, $002458, $00, $00000000, $000000, $00
; dc.b 'Player Shot Normal  ', $0006, $01ac, $009b160c, $0007a4, $00, $009b160c, $000000, $00
; dc.b 'Player Jump         ', $0007, $01ac, $009b1db4, $0018de, $00, $009b1db4, $000000, $00
; dc.b 'Crackle             ', $0008, $00d6, $009b3696, $004594, $00, $009b3696, $000000, $00
; dc.b 'Cleared Level       ', $0009, $01ac, $009b7c2e, $0037a2, $00, $009b7c2e, $000000, $00
; dc.b 'Warp                ', $000a, $0238, $009bb3d4, $006ec8, $00, $009bb3d4, $000000, $00
; dc.b 'Large Explosion     ', $000b, $01ac, $009c22a0, $0050c2, $00, $009c22a0, $000000, $00
; dc.b 'Powered Up Shot     ', $000c, $01ac, $009c7366, $001976, $00, $009c7366, $000000, $00
; dc.b 'Get Power Up        ', $000d, $01ac, $009c8ce0, $001aea, $00, $009c8ce0, $000000, $00
; dc.b 'Tink For Spike      ', $000e, $00fe, $009ca7ce, $00040e, $00, $009ca7ce, $000000, $00
; dc.b 'NME At Top Of Web   ', $000f, $01ac, $009cabe0, $00001e, $00, $009cabe0, $000000, $00
; dc.b 'Pulse For Pulsar    ', $0010, $0358, $009cac02, $0019fe, $00, $009cac02, $000000, $00
; dc.b 'Normal Explosion    ', $0011, $00d6, $009cc604, $002ab6, $00, $009cc604, $000000, $00
; dc.b 'Extra Explosion     ', $0012, $0358, $009cf0be, $0018ca, $00, $009cf0be, $000000, $00
; dc.b 'Static or Pulsar    ', $0013, $011c, $009d098c, $003fe4, $00, $009d098c, $000000, $00
; dc.b 'Pulsar Pulse        ', $0014, $0358, $009d4974, $000f0c, $00, $009d4974, $000000, $00
; dc.b 'Off Shielded NME    ', $0015, $00aa, $009d5884, $0027ca, $00, $009d5884, $000000, $00
; dc.b 'Excellent           ', $0016, $0200, $009d8052, $005976, $00, $009d8052, $000000, $00
; dc.b 'Superzapper Recharge', $0016, $0200, $009dd9cc, $00a958, $00, $009dd9cc, $000000, $00
; dc.b 'yes                 ', $0018, $0200, $009e8328, $005a6c, $00, $009e832a, $005a6a, $00
; dc.b 'oneup               ', $0019, $0200, $009edd98, $0043ae, $00, $009edd98, $000000, $00
; dc.b 'screeeam            ', $001a, $0200, $009f214a, $004568, $00, $009f214a, $000000, $00
; dc.b 'sexy yes 1          ', $001b, $0200, $009f66b6, $002c54, $00, $009f66b6, $000000, $00
; dc.b 'sexy yes 2          ', $001c, $0200, $009f9362, $003236, $00, $009f9362, $000000, $00
; dc.b 'tink                ', $001e, $0200, $009fc59c, $0005ce, $00, $009fc59c, $000000, $00
; dc.b 'zero                ', $001f, $0200, $009fcb6e, $000008, $00, $009fcb6e, $000000, $00
; dc.b 'dummy               ', $0020, $0200, $009fcb7a, $00a1d8, $00, $009fcb7a, $000000, $00

The last bit of mystery meat I'm looking at there is this blob of data:

.incbin "incbin/paddingbetweentunesandsmp.bin"

I think it's a sample, it kind of sounds like one if you play it, e.g.:

!play -t raw -r 8k -e signed-integer -b 8 -c 2 \
    ../tempest2k/src/incbin/paddingbetweentunesandsmp.bin

It doesn't appear to be part of the previous mod file (but I was going to parse out the mod files fully to try and prove that).

Any thoughts?

Wuerfel21 commented 1 week ago

What I was referring to specifically is the music pointer table. That's the "xtra" in beasty8-xtra.cry. This is really just pointers to the MOD files and some zero-padding. The main code has the address of this hardcoded as modbase. But the samples table, too. Can you really format it like that, with everything on one dc.b line? I did something awful like

.dc.b "Engine Noise 1      "
.dc.w 1, 428 ; prio, period
.dc.l smp01, 1155072 ; start, len
.dc.l smp01+2, 1154560 ; repstart, replen
.dc.b "Player Shot Normal 2"
.dc.w 2, 428 ; prio, period
.dc.l smp02, 583680 ; start, len
.dc.l smp02, 0 ; repstart, replen

paddingbetweentunesandsmp.bin appears to be unused as it were. Certainly not part of the preceding MOD file, I think that'd cause an error message when opening it in a tracker. Removing it didn't cause any problems (noticable to me, anyways).

mwenge commented 1 week ago

What I was referring to specifically is the music pointer table. That's the "xtra" in beasty8-xtra.cry. This is really just pointers to the MOD files and some zero-padding. The main code has the address of this hardcoded as modbase.

Ah, thanks for that - will fix that up on my side too.

But the samples table, too. Can you really format it like that, with everything on one dc.b line? I did something awful like No, that was just for display! :)

paddingbetweentunesandsmp.bin appears to be unused as it were. Certainly not part of the preceding MOD file, I think that'd cause an error message when opening it in a tracker. Removing it didn't cause any problems (noticable to me, anyways).

I added it to the mod file and was able to play it but agree it doesn't seem to be part of the mod file. Curious!

Wuerfel21 commented 1 week ago

I meant that if something was missing from the MOD file itself, it would probably cause an error when opening it in OpenMPT or smth.