.com.unity Forums
  The Official e-Store of Shrapnel Games

This Month's Specials

Raging Tiger- Save $9.00
winSPMBT: Main Battle Tank- Save $6.00

   







Go Back   .com.unity Forums > Shrapnel Community > Space Empires: IV & V

Reply
 
Thread Tools Display Modes
  #1  
Old April 2nd, 2008, 12:30 AM
AgentZero's Avatar

AgentZero AgentZero is offline
Captain
 
Join Date: Apr 2003
Location: Burnaby
Posts: 995
Thanks: 0
Thanked 3 Times in 2 Posts
AgentZero is on a distinguished road
Default OT: An odd little question

I'm just wondering if anyone is familiar with a Z80 Digital Trainer. Our instructor gave us one and said that we'd get a bonus 10% if we could make it play music, and since he said the internet was a great resource when we asked him how to do it, I figured I'd ask here since my Google-fu is failing me. I'm just looking for a tutorial on how to make it sing, and maybe a few song sheets to choose from...
__________________
Suction feet are not to be trifled with!
Reply With Quote
  #2  
Old April 2nd, 2008, 01:31 AM
Suicide Junkie's Avatar
Suicide Junkie Suicide Junkie is offline
Shrapnel Fanatic
 
Join Date: Feb 2001
Location: Waterloo, Ontario, Canada
Posts: 11,451
Thanks: 1
Thanked 4 Times in 4 Posts
Suicide Junkie is on a distinguished road
Default Re: OT: An odd little question

Its got a speaker, so its just a matter of running the thing.
Do you have a compiler and a hello world program?

Worst case, you can have your program set the speaker's IO line high and low at the appropriate frequency (yay for delay loops!)

Have a function that takes a pitch and a duration, and emits the appropriate tone.

[cut for spoilerage]

Then have your main loop call it repeatedly with the appropriate values for something recognizable, perhaps a famous clip from Eine kleine Nachtmusik, or the theme to Rocky or Jaws.

Figure out what your prof's favorite music is, and find some sheet music for the chorus.

You've got a speaker, so you could have it recording the input to memory and then get an instant replay of the last N seconds when you press one of the buttons.
Reply With Quote
  #3  
Old April 3rd, 2008, 01:02 AM
AgentZero's Avatar

AgentZero AgentZero is offline
Captain
 
Join Date: Apr 2003
Location: Burnaby
Posts: 995
Thanks: 0
Thanked 3 Times in 2 Posts
AgentZero is on a distinguished road
Default Re: OT: An odd little question

Yeah...

Thing is, the thing has a whopping 8k of memory, so any program we write is in it's own little assembly language, which involves using little 2-4 byte codes that represent a command, then a 2-4 byte code that represents the data that the aforementioned command is supposed to use. So something like 3e10 would mean "Transfer 10 into Register AF", or 770280 would mean "Transfer the contents of memory address 8002 (because you have to enter memory addresses backwards for some reason) to Register C6".

Now apparently, somewhere there's a command for Call Tone, that takes a code that represents a musical note and a duration, so getting this thing to play music would involve entering a series of Call Tone commands with the right combination of notes/durations to play a song.

I know what the code for Call Tone is, but I don't have the combination of notes & durations to produce a song, and I can't simply grab a music sheet since I don't know what the codes are for the various notes & durations either.
__________________
Suction feet are not to be trifled with!
Reply With Quote
  #4  
Old April 3rd, 2008, 02:37 AM
Suicide Junkie's Avatar
Suicide Junkie Suicide Junkie is offline
Shrapnel Fanatic
 
Join Date: Feb 2001
Location: Waterloo, Ontario, Canada
Posts: 11,451
Thanks: 1
Thanked 4 Times in 4 Posts
Suicide Junkie is on a distinguished road
Default Re: OT: An odd little question

Ok, so the function is already written for you.
Odds are good you'll be specifying a frequency.

Try 440 and compare the output to http://upload.wikimedia.org/wikipedi...e_wave_440.ogg

Otherwise, just guess & check, then interpolate.
Google for sheet music, and map it to frequencies.

Then you can have the thing play Free Bird for 10 impressive minutes
Reply With Quote
  #5  
Old April 3rd, 2008, 11:32 PM
AgentZero's Avatar

AgentZero AgentZero is offline
Captain
 
Join Date: Apr 2003
Location: Burnaby
Posts: 995
Thanks: 0
Thanked 3 Times in 2 Posts
AgentZero is on a distinguished road
Default Re: OT: An odd little question

The "code" for making music is already done, it's just a matter of getting some music and converting all the notes into the required hex values and setting the tempo and so forth. I was just hoping there existed somewhere instructions that had the conversions already done & the tempos figured out, since I am not a musically inclined person in the least.

The other issue of course, is that the way programs are entered into the board, if you put in a song and then realize, "Oh, most of the places I have AA, I should have AAA", then you have to recode everything after the first AA, since there's no support for inserting new code in between existing code. And considering a 3 verse melody involves about 4 typed pages of code, that's a lot of recoding to get everything right.

And to top it all off, our prof reduced the value of the assignment from 10% to 5%, so now it will have less a 1% effect on my overall average across all my courses, whereas I have finals next week that are each worth more than 10% of my overall average, so I'm looking to spend as little time on this as possible.
__________________
Suction feet are not to be trifled with!
Reply With Quote
  #6  
Old April 28th, 2008, 04:37 PM
dmm's Avatar

dmm dmm is offline
Captain
 
Join Date: Sep 2000
Location: USA
Posts: 806
Thanks: 0
Thanked 0 Times in 0 Posts
dmm is on a distinguished road
Default Re: OT: An odd little question

Sounds like your prof did his own extensive Googling before announcing the extra credit assignment.
__________________
Give me a scenario editor, or give me death! Pretty please???
Reply With Quote
Reply

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 07:37 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2024, Shrapnel Games, Inc. - All Rights Reserved.