Jump to content


A test file for JSW

version 007

  • Please log in to reply
21 replies to this topic

#21 IRF


    Advanced Member

  • Contributor
  • 4,462 posts

Posted 12 January 2018 - 06:28 PM

I like that its very good. :) My only slight suggestion (and it is off topic somewhat) the attribute cycling does not seem to suit it. I'd suggest either just blue/black or perhaps none ? Blue/Black is quite easy to do, the 'C' projects both have this.


Yes, I think just black would be suitably sombre.


EDIT: For what it's worth, I've just re-uploaded the file with the above suggestion implemented (attached to original post on previous page of this thread).


If anyone should be apologising for taking the thread off-topic, it's me, as this doesn't really have anything to do with Norman Sword's original post/attachment (I'm not sure how I ended up diverting it with this particular micro-project!)

Edited by IRF, 13 January 2018 - 08:57 PM.

#22 IRF


    Advanced Member

  • Contributor
  • 4,462 posts

Posted 04 October 2018 - 04:59 PM

Re Game Over.

In JSW their are a multitude of sound effects.

The title tune and in game tune plays their notes in a differing method to all the other sound FX's.
Both the title tune and in game tune attempt to play the note over a fixed period of time.

Your simple demo routine plays the tune, were each notes length is dictated by its pitch. The overall length of each note is the product of a fixed length and a pitch variable. This has several repercussions. The obvious visual one is the speed change in the boot as it descends. The obvious audio effect would be shifting tempo.

Your routine might benefit from using a routine more similar to the in game tune routine. Whereby the length of each note is fixed (sort of).

;in game tune
;Pitch of note held in D which should be copied to E before playing
;a=border colour
8B60 LD BC,$0003 ;length of the note overall
8B63 OUT ($FE),A
8B65 DEC E
8B66 JR NZ,$8B6B
8B68 LD E,D
8B69 XOR $18
8B6B DJNZ $8B63
8B6E JR NZ,$8B63

I think I've figured out the reason behind the "sort of" comment highlighted in bold in the above quote from Norman Sword.

My first attempt at the Funeral March caused a fixed number of oscillations of the speaker diaphragm. That meant that the higher the pitch, the shorter the delay between each oscillation and therefore the shorter the overall duration of the note.

As Norman said, the tune routines play each note for a fixed period, in an attempt to make each note of equal duration. However, there is a slight over-compensation involved, because in reality each execution of the Z80 operation which causes the speaker to oscillate (i.e. each XOR #18) takes a short but finite amount of time (i.e. a certain number of T-States).

This is usually insignificant in terms of the overall length of the notes, but when you have an extremely high pitch note, it can start to cause a perceptible increase in the duration of the note.

In the previous test file which I uploaded a while ago - 'Game Over Test 3' - I used data bytes with value #01 in the table of Funeral March notes, in order to punctuate the tune. This means that the tune routine attempts to oscillate the diaphragm during each and every pass through the inner loop controlled by the B register via a DJNZ command (that's 256 times per pass through the outer loop, controlled via the C register). The cumulative effect is that those notes are sustained for slightly longer, and the descending foot perceptively slows down at those moments in the tune when the 'silent notes' are being played.

I have now created a further test file - 'Game Over Test 4' - in which data bytes holding the value #00 are used to punctuate the Funeral March, instead of #01. The oscillation of the diaphragm now only occurs once for every 256 passes through the inner loop, which is only once during each pass through the outer loop (i.e. 256 times less often than before), so the cumulative impact of the T-States of time spent executing XOR #18 commands becomes insignificant. As a result, the 'silent notes' are of roughly the same duration as the notes of intermediate pitch, and therefore the foot descends much more smoothly (at an even pace) down the Game Over screen.

I have attached to this post both of the files referred to above, for convenient comparing and contrasting of the Game Over sequence.

Attached Files

Edited by IRF, 04 October 2018 - 06:00 PM.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users