Jump to content
Jet Set Willy & Manic Miner Community

Playing around with the in-game tune in JSW


IRF

Recommended Posts

15 hours ago, IRF said:

That's similar to my solution, but not identical. You seem to have a spare byte in there, so you could afford to retain the original two-byte LD D, #00 command, instead of the single-byte LD D, A. That would mean the patch isn't reliant on A having been reset to zero beforehand. (Since a lot of game designers ditch the preceding inactivity code which sets A=0.)

Yes , it assumes that A is still set to zero as a result of the command at #8B3C

Link to comment
Share on other sites

Posted (edited)

I must admit I used AND #01 to affect the Zero flag - to decide when to increment (or not) the music note index - but it never occurred to me to just directly add the value of A (after the AND command) to the note index, which has the same effect since A can only hold 00 or 01 at that point. A very elegant and efficient solution!

(Mine might be slightly more adaptable, as you can decide whether to advance the music on an 'odd' or an 'even' game tick, by selecting the polarity of the conditional jump: JR Z or JR NZ. However, mine needed an extra precious byte compared to yours, so yours wins!) 

Edited by IRF
Link to comment
Share on other sites

  

17 hours ago, IRF said:

Indeed! Only 64 bytes per tune though. If you had 20 tunes of 256 bytes each, that wouldn't leave much room for anything else! 

 

5 hours ago, jetsetdanny said:

Exactly. Even with 64-byte-long tunes there was no room left for any extras. A suggestion was made after the game was released that it could do with a non-standard font. It was a very good suggestion, but unfortunately impossible to apply without far-reaching changes to the game engine that would optimise the code 'a la Norman Sword' and free up enough space to implement a new font.

 

Actually, I need to correct both yourself, Ian, and myself! (I let myself be carried by your erroneous and, in fact, slightly blasphemous suggestion! 🤪)

Each of the 20 in-game tunes in "Manic Person" is 128 bytes long. If they were 'only' 64 bytes long, there would be enough spare space also for a custom font (1280 spare bytes versus 768 needed for a full font).

Link to comment
Share on other sites

Posted (edited)
On 1/5/2024 at 6:45 PM, Spider said:

Nopping out #8B47 and #8B49 would do but its too fast then. So...

 







XOR A                            ;8B3C      ;                  clear the inactivity timer at L85E0 
    LD (inactivity),A            ;8B3D      ;L85E0
    LD D,A                           ;8B40      ;                   initialise the mSB
    LD a,(game ticker)       ;8B41      ;L85CB        the game ticker at 85CB
    AND 1                            ;8B44      ;                   issolate odd or even game ticker bit
    LD HL,(ingame_music) ;8B46      ;L865F        set HL to the music offset pointer
    LD E,(HL)                       ;8B49      ;                   get the present offset
    ADD A,E                        ;8B4A      ;                   add the ticker (odd/even) value
    LD (HL),A                      ;8B4B      ;                   store the updated offset
   NOP                              ; 8b4C      ;
back to the original code
   LD HL,ingame_music    ;8B4D     ;L865F
   ADD HL,DE                    ; 8B50    ;
>>> HL IS POINTING AT THE NOTE value 

 

Actually Andy, you might need to think again there. Did you actually try that out? Because looking at it again, E isn't actually updated when the tune note index is increased, so when DE is added to HL (the second definition of HL) at #8B50, it won't pick up the new note during the current pass through the Main Loop.

So you would need to use that spare, NOPped out byte at #8B4C for a LD E, A instruction.

Edit: Thinking about it, the effect of E not being updated straight away probably just means that the tune will be playing 'one note behind'. It should play at the right speed. But the first note (first pitch value) will only play half as long as it should when you start playing the game. (And the normal fix for that - setting the music note index to #FF during game initialisation - won't work this time; I think that would cause the last note of the tune to be played during the first pass through the Main Loop.)

Edited by IRF
Link to comment
Share on other sites

  • 8 months later...

I just saw this on a Facebook post:

"MATTHEW SMITH!

The creator of Manic Miner and Jet Set Willy.

Seen back when he was writing games, and then around 2013.

Jet Set Willy was the first game to include continuous music (such as music was on the Spectrum) while you played the game, a feat which up to that point was thought to be impossible.

He actually wrote Manic Miner on a Tandy TRS-80."

It got me wondering - is that claim in bold actually true?

Link to comment
Share on other sites

15 hours ago, IRF said:

It got me wondering - is that claim in bold actually true?

🙂 

No, because Manic Miner was first by a fair way (a year or just under I think) which discounts the "JSW First" part of it. 🙂

I'm also not convinced at all it was the first game to have an in-game tune that "played continuously" during play either, but I would need to research that to find an 82 or early pre-June*** 83 game that did. It could be the first ZX game to do this but as said I'm not convinced.

*** I'm only about 90% sure on that month, the Software Projects re-release of it was late 83

 

 

Link to comment
Share on other sites

2 minutes ago, Spider said:

🙂 

No, because Manic Miner was first by a fair way (a year or just under I think) which discounts the "JSW First" part of it. 🙂

I'm also not convinced at all it was the first game to have an in-game tune that "played continuously" during play either, but I would need to research that to find an 82 or early pre-June*** 83 game that did. It could be the first ZX game to do this but as said I'm not convinced.

*** I'm only about 90% sure on that month, the Software Projects re-release of it was late 83

 

 

The internal contradiction in the statement did occur to me (JSW vs MM), but then I suppose the in-game tune in Manic Miner doesn't play during the portal air countdown*, so in that sense it doesn't play continuously.

(*Except in Manic Mixup. 😉

Link to comment
Share on other sites

3 hours ago, Spider said:

I'm also not convinced at all it was the first game to have an in-game tune that "played continuously" during play either, but I would need to research that to find an 82 or early pre-June*** 83 game that did. It could be the first ZX game to do this but as said I'm not convinced.

Manic Miner's (maybe) the first to have in-game music on the Spectrum, but obviously there are a fair few arcade games that did it earlier; while I suspect everyone here is aware of that I do see it often claimed as though it's the first game ever to do it on any platform, when it clearly wasn't. Rally X is probably the best example of an arcade game doing it earlier:

I can certainly believe it was the first game on the Spectrum to have in-game music though - it was fairly early on in the Spectrum's lifespan and music in games wasn't as ubiquitous at the time.

The part of the claim I doubt is the "thought to be impossible" part - I'm pretty sure the music in Space Invaders is done exactly the same way as Manic Miner does it, and as much as Matthew Smith did a great job with the game design he wasn't the most amazing programmer in the world, at least not at the age of 17, and plenty of others would surely know it to be possible. I imagine most simply chose a higher framerate over trying to have something somewhat resembling music playing; after all, if you want in-game music you have a tape player attached - just play it yourself.

As for the "plays continuously" comment, I suspect it means as opposed to something like Virtua Racing, where short jingles play at checkpoints but leaves periods without music, or Road Blasters, where the music only comes in towards the end of each level. I doubt it's claiming the air countdown doesn't count and has simply confused the two games.

Link to comment
Share on other sites

@DigitalDuck A few years ago now I had a very very old memory of playing that game (when it was new!) at an arcade on holiday but moving back to recently I could not remember what it was called but the tune did stick in my head. I know there's two of them , the original and the 'new' , I actually have it on Mame and play it every few weeks. I'm still terrible at it! 🙂 Also its "another good Z80 CPU" game too.

 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.