Megalextoria
Retro computing and gaming, sci-fi books, tv and movies and other geeky stuff.

Home » Digital Archaeology » Computer Arcana » Apple » Apple II » Dragon sound effect that doesn't work in Virtual II
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Dragon sound effect that doesn't work in Virtual II [message #392099] Sat, 14 March 2020 21:36 Go to next message
bloomer_au is currently offline  bloomer_au
Messages: 92
Registered: October 2012
Karma: 0
Member
The other day I was showing my nephew a Youtube video of my 1996 game Dragon

https://www.youtube.com/watch?v=icGZ467p2IU

Next, we tried to play the game in Virtual II. When I pressed button 0 to breathe fire, a long flat tone emerged rather than the sound effect I'd programmed. In this game, the sounds stop gameplay, but are all short or timed to at least flatter the action. With the duration change of this sound effect, the game becomes very tedious and you wouldn't want to keep playing it.

If the game is played in Sweet16, however, you hear the true sound effect at the normal duration when you press fire.

I identified this anomaly ages ago. I mean, the video I linked to is 11 years old, and I already knew of the issue back then. I have a vague memory the weird tone occurred when the game was played on some other Mac-II emulator that no longer exists, too (called OS 2? It had a name like OS/OX...)

Did I use some horrible bit of assembly to create this effect? One that the emulator can't handle or that no-one should be using? I have no idea, so I'd like to pass this question to the assembly heads on this forum!

To this end, I've pulled out the bit of assembly source that makes the effect. You can see it here:

https://wadeclarke.com/no/dragon_breathe_sound.png

The highlighted definition at the top of image is to show that TONE is just a memory address, nothing special. Down below, you'll see the whole, inoffensive-looking sound routine, called FXBREATHE

Thanks. I'm definitely curious for an explanation.

-Wade
Re: Dragon sound effect that doesn't work in Virtual II [message #392100 is a reply to message #392099] Sat, 14 March 2020 22:20 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Frank M.

On Saturday, March 14, 2020 at 6:36:08 PM UTC-7, bloomer_au wrote:
> The other day I was showing my nephew a Youtube video of my 1996 game Dragon
>
> https://www.youtube.com/watch?v=icGZ467p2IU
>
> Next, we tried to play the game in Virtual II. When I pressed button 0 to breathe fire, a long flat tone emerged rather than the sound effect I'd programmed. In this game, the sounds stop gameplay, but are all short or timed to at least flatter the action. With the duration change of this sound effect, the game becomes very tedious and you wouldn't want to keep playing it.
>
> If the game is played in Sweet16, however, you hear the true sound effect at the normal duration when you press fire.
>
> I identified this anomaly ages ago. I mean, the video I linked to is 11 years old, and I already knew of the issue back then. I have a vague memory the weird tone occurred when the game was played on some other Mac-II emulator that no longer exists, too (called OS 2? It had a name like OS/OX...)
>
> Did I use some horrible bit of assembly to create this effect? One that the emulator can't handle or that no-one should be using? I have no idea, so I'd like to pass this question to the assembly heads on this forum!
>
> To this end, I've pulled out the bit of assembly source that makes the effect. You can see it here:
>
> https://wadeclarke.com/no/dragon_breathe_sound.png
>
> The highlighted definition at the top of image is to show that TONE is just a memory address, nothing special. Down below, you'll see the whole, inoffensive-looking sound routine, called FXBREATHE
>
> Thanks. I'm definitely curious for an explanation.
>
> -Wade

TYX is only available on '816, not a 6502/65c02.
f
Re: Dragon sound effect that doesn't work in Virtual II [message #392104 is a reply to message #392100] Sun, 15 March 2020 00:41 Go to previous messageGo to next message
bloomer_au is currently offline  bloomer_au
Messages: 92
Registered: October 2012
Karma: 0
Member
Hm, well that sounds like the problem :) Thanks.

I wrote the game for 8-bit Apples, but on a IIGS, so presumably I never noticed the problem.

Question 1 - Does this mean the 65816 is happy using TYX in its 8-bit emulation mode?

Question 2 - Would a real Apple II react to the appearance of this instruction any differently than an emulator? I don't know how the code for an instruction not in the computer's set is parsed inside the Apple.

-Wade
Re: Dragon sound effect that doesn't work in Virtual II [message #392109 is a reply to message #392104] Sun, 15 March 2020 07:08 Go to previous messageGo to next message
Antoine Vignau is currently offline  Antoine Vignau
Messages: 1860
Registered: October 2012
Karma: 0
Senior Member
Hi,
if you wrote it with Merlin, use the xc directive to limit to strict 6502 opcodes. I never remember if two are needed or only one,

av
Re: Dragon sound effect that doesn't work in Virtual II [message #392110 is a reply to message #392109] Sun, 15 March 2020 07:09 Go to previous messageGo to next message
Antoine Vignau is currently offline  Antoine Vignau
Messages: 1860
Registered: October 2012
Karma: 0
Senior Member
Saw the pic, it is a Merlin source code, so xc will help you write pure 6502 code, Wade.

Antoine
Re: Dragon sound effect that doesn't work in Virtual II [message #392112 is a reply to message #392104] Sun, 15 March 2020 08:03 Go to previous messageGo to next message
TomCh is currently offline  TomCh
Messages: 242
Registered: November 2012
Karma: 0
Senior Member
On Sunday, 15 March 2020 04:41:38 UTC, bloomer_au wrote:
> Hm, well that sounds like the problem :) Thanks.
>
> I wrote the game for 8-bit Apples, but on a IIGS, so presumably I never noticed the problem.
>
> Question 1 - Does this mean the 65816 is happy using TYX in its 8-bit emulation mode?
>
> Question 2 - Would a real Apple II react to the appearance of this instruction any differently than an emulator? I don't know how the code for an instruction not in the computer's set is parsed inside the Apple.
>
> -Wade

TYX is ('816) opcode $BB
6502 (NMOS) $BB = undefined LAS (abs16),Y ; ie. 3 bytes
65C02 (CMOS) $BB = NOP ; ie. 1 byte

On a 6502(NMOS), then "TYX; BIT SPKR; DEX" = "$BB $2C $30 $C0 $CA" = "LAS $302C,Y" (which updates A,X,SP) + CPY #$CA... since SP has changed then the RTS at the end of FXBREATHE will give you undesired(!) behaviour. Most likely a crash.

On a 65C02(CMOS), since TYA and NOP are both 1 byte, then this'll just affect your inner X-dependent loop, so you'll get a differnt speaker noise.

Tom
Re: Dragon sound effect that doesn't work in Virtual II [message #392113 is a reply to message #392112] Sun, 15 March 2020 08:05 Go to previous messageGo to next message
TomCh is currently offline  TomCh
Messages: 242
Registered: November 2012
Karma: 0
Senior Member
On Sunday, 15 March 2020 12:03:11 UTC, TomCh wrote:
> On Sunday, 15 March 2020 04:41:38 UTC, bloomer_au wrote:
>> Hm, well that sounds like the problem :) Thanks.
>>
>> I wrote the game for 8-bit Apples, but on a IIGS, so presumably I never noticed the problem.
>>
>> Question 1 - Does this mean the 65816 is happy using TYX in its 8-bit emulation mode?
>>
>> Question 2 - Would a real Apple II react to the appearance of this instruction any differently than an emulator? I don't know how the code for an instruction not in the computer's set is parsed inside the Apple.
>>
>> -Wade
>
> TYX is ('816) opcode $BB
> 6502 (NMOS) $BB = undefined LAS (abs16),Y ; ie. 3 bytes
> 65C02 (CMOS) $BB = NOP ; ie. 1 byte
>
> On a 6502(NMOS), then "TYX; BIT SPKR; DEX" = "$BB $2C $30 $C0 $CA" = "LAS $302C,Y" (which updates A,X,SP) + CPY #$CA... since SP has changed then the RTS at the end of FXBREATHE will give you undesired(!) behaviour. Most likely a crash.
>
> On a 65C02(CMOS), since TYA and NOP are both 1 byte, then this'll just affect your inner X-dependent loop, so you'll get a differnt speaker noise.
>
> Tom

typo:

On a 65C02(CMOS), since *TYX* and...
Re: Dragon sound effect that doesn't work in Virtual II [message #392114 is a reply to message #392110] Sun, 15 March 2020 08:14 Go to previous messageGo to next message
bloomer_au is currently offline  bloomer_au
Messages: 92
Registered: October 2012
Karma: 0
Member
On Sunday, 15 March 2020 22:09:43 UTC+11, Antoine Vignau wrote:
> Saw the pic, it is a Merlin source code, so xc will help you write pure 6502 code, Wade.
>
> Antoine

Hehe. Last time I used Merlin was to write this game. Now that I've been reminded of it, I remember reading all that stuff about the flags. I may need it if I get around to recompiling this game without this bug.

-Wade
Re: Dragon sound effect that doesn't work in Virtual II [message #392121 is a reply to message #392114] Sun, 15 March 2020 10:43 Go to previous messageGo to next message
Michael AppleWin Debu is currently offline  Michael AppleWin Debu
Messages: 1262
Registered: March 2013
Karma: 0
Senior Member
You'll love Merlin32! It is the best Apple 2 assembler out there that I've used. i.e. It beats sb-asm and ca65.
Re: Dragon sound effect that doesn't work in Virtual II [message #392259 is a reply to message #392104] Thu, 19 March 2020 18:20 Go to previous message
Anonymous
Karma:
Originally posted by: MG

On 2020-03-15 04:41:36 +0000, bloomer_au said:
> Question 1 - Does this mean the 65816 is happy using TYX in its 8-bit
> emulation mode?

Since nobody answered it explicitly: All of the new 65816 opcodes work
in any processor mode, however, instructions using 65816-specific
addressing modes always have 65816-specific behaviors, e.g. they do not
wrap at certain boundaries or other effects.

The canonical example being in emulation mode, PEI $FF with the stack
pointer at $100 doesn't read from $FF and $00 and write to $100 and
$1FF, it reads from $FF and $100 and writes to $100 and $FF.
Additionally, PEI always pushes a 16-bit value to the stack, regardless
of the m or e flag.

MG
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How much for a NIB - never opened Apple II
Next Topic: Apple III Files at Mac GUI Vault
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Apr 19 11:53:38 EDT 2024

Total time taken to generate the page: 0.00338 seconds