--- RESOUND ---

Written by Sander Alsema for the 10-liner competition 2017.
Language: Commodore 64 Basic v2
Category: PUR-80


I prefer VICE, but you can use any emulator that works with *.d64 files.
If you haven't installed it yet, it can be downloaded from their website.

Here's how to use it:
 Click : - File
         - Attach disk image -> Drive 8
 Select: Tenliner.d64
 Click : Attach

Now, just as you would with a normal Commodore 64, you can type:
 LOAD"$",8             (to load the directory)
 LOAD"RESOUND",8       (to load the RESOUND game)
 LOAD"RESOUND(LONG)",8 (to load the LONGVERSION of the RESOUND game)
 LIST                  (to view the directory or game listing)
 RUN                   (to run the game)

Be aware that you are now using a virtual Commodore 64 keyboard.
Therefore the keys will differ slightly from your physical keyboard:
use <SHIFT> '2' to display quotation marks.
use <SHIFT> '8' to display '('.
use <SHIFT> '9' to display ')'.


NOTES:
1. This game will start immediately after run is typed, so pay attention!
2. This game uses sounds, so make sure you have your speakers on.

---

RESOUND is a memory game, using sight and hearing.

The computer plays a sequence of sounds, while lighting up squares with numbers.
The objective of the game: Repeat the sequence by typing those numbers.
If the sequence is correct the player will be told so, and scores 10 points.
After every correct sequence a new - extended - sequence will be played.

The game is over and restarts when the player makes a mistake.

---

Line 0: Set variables for accessing graphics and sound chips.
	Set level to zero.
	Set backgroundcolour and bordercolour to green.
	Prepare sound chip.
	Set textcolour to black and clear screen.
	Set wrong to zero (meaning false).

Line 1: Place all sprites next to each other on screen, 32 pixels apart.
	Place numbers in the middle of each sprite.
	Set all spritecolours to blue.
	Place all sprites halfway up the screen.

Line 2: Tell sprites where to find their data.
	Make sure the sprite data forms squares.
	Turn all sprites on.
	Make sure the numbers are in front of the sprites.

Line 3: Create random numbers, 1 more than the current level.
	store those numbers somewhere in memory.
	Play the sounds and light up the sprites those numbers represent.
	Prepare for the player to repeat the sprite/sound sequence.
	Display "REPEAT" in the top left corner.

Line 4: Read the keyboard.
	Turn keyboard stroke into a number.
	If that number is between 1 and 8 then:
	- Adjust that number.
	- Play the sound and light up the sprite that number represents.
	- Increase the index variable.
	- If the number doesn't match the stored number then wrong = true.

Line 5: If wrong is true then:
	- Display "GAME OVER, SCORE:" in the top left corner.
	- Followed by the actual score, being the current level times 10.
	- Wait for a short while.
	- Clear the keyboard buffer.
	- Begin the game all over again.

Line 6: If the index variable matches the current level then:
	- Display "CORRECT" in the top left corner.
	- Wait for a short while.
	- Clear the top left corner.
	- Increase the level.
	- Go back to line 3 to make a new sequence.

Line 7: Go back to line 4 to read the next key.

The last two lines are called to play a sound and light up a sprite.

Line 8: Set the appropriate spritecolour to light blue.
	Set the sound to the appropriate frequency.
	Turn on the sound.
	wait for a short while.
	Set the appropriate spritecolour back to blue.

Line 9: Turn off the sound.
	Return to where this subroutine was called from.
