Emuforums.com

Go Back   Emuforums.com > General Discussion > Web development / Programming
Home Register Downloads FAQ Members List Calendar Arcade Mark Forums Read

WON'T YOU JOIN US?
You are not a registered member and
are viewing this site as a guest.
Registration is simple and FREE.
Join this CrowdGather community today.
Registration offers the following perks:

» Less advertising throughout
» Post and participate in discussions
» Network with other forum members
» Free private messaging

join

Closed Thread
 
Thread Tools Display Modes
Old October 26th, 2011, 15:27   #621
refraction
PCSX2 Coder
 
refraction's Avatar
 
Join Date: Jan 2004
Location: Plymouth, UK
Posts: 10,037
Hey dude! good ta hope things are well with you
__________________

http://www.pcsx2.net
Intel i7 920 @ 3.4Ghz, POV GTX 570 1.3Gb, 1.8Tb HD space, 6Gb OCZ Reaper PC3-14400 Triple Channel
Dont PM me for help, use the forums, thats what its for!


My Chip16 Emulator RefChip16 http://code.google.com/p/refchip16/
refraction is offline  

Advertisement [Remove Advertisement]
Old October 26th, 2011, 22:25   #622
paul_nicholls
Registered User
 
Join Date: Sep 2011
Location: Australia, Tasmania
Posts: 180
I was thinking that once these specs are finalised, especially with regards to sounds, that I might try making a PC Chip16 emulator myself

If this works out, I might even try porting it over to the Android OS for some fun!

cheers,
Paul
paul_nicholls is offline  
Old October 26th, 2011, 23:52   #623
refraction
PCSX2 Coder
 
refraction's Avatar
 
Join Date: Jan 2004
Location: Plymouth, UK
Posts: 10,037
Well here is my attempt ;p Ill release sources later once it's been cleaned up and ive tried doing a dynarec for it.

but afaik, it has full sound support, everything seems to work right, just make sure your directx is up to date n it should be fine ;p (i havent error trapped if you havent, so tough!)

edit:

on the note of sound support, 1 op such as

Code:
0D 0X LL HH SNP Play PCM Sound for HHLL miliseconds at the tone specified in address pointed to by Register X
That way you can keep a "bank" of notes and play them out at the speed and pitch you like. Pretty easy to do with a sine wave generator. I don't think there should be anything much more complicated than that, definately no audio samples that for sure. at most, we could have the Y bit of the opcode specifying type of wave (0 = sine, 1 = square, 2 = triangle), but as complexity goes, thats probably far enough!
Attached Files
File Type: 7z Refchip16.7z (10.2 KB, 15 views)
__________________

http://www.pcsx2.net
Intel i7 920 @ 3.4Ghz, POV GTX 570 1.3Gb, 1.8Tb HD space, 6Gb OCZ Reaper PC3-14400 Triple Channel
Dont PM me for help, use the forums, thats what its for!


My Chip16 Emulator RefChip16 http://code.google.com/p/refchip16/

Last edited by refraction; October 27th, 2011 at 00:08..
refraction is offline  
Old October 27th, 2011, 00:03   #624
tykel
Sober coder
 
tykel's Avatar
 
Join Date: Aug 2010
Location: London, UK
Posts: 433
Quote:
Originally Posted by paul_nicholls View Post
I was thinking that once these specs are finalised, especially with regards to sounds, that I might try making a PC Chip16 emulator myself

If this works out, I might even try porting it over to the Android OS for some fun!

cheers,
Paul
Look forward to it

Quote:
Originally Posted by refraction View Post
Well here is my attempt ;p Ill release sources later once it's been cleaned up and ive tried doing a dynarec for it.

but afaik, it has full sound support, everything seems to work right, just make sure your directx is up to date n it should be fine ;p (i havent error trapped if you havent, so tough!)
Nice work, sir.
I have found one slight bug, however - in the SoundTest rom, sounds are played without stopping, even after a different rom has been loaded.

Also, can't wait to see a dynarec for this. I was going to have a go at that in my own emu, mash16 (see sig), although I haven't even finished the interpreting core so it'll have to wait...

EDIT:
Quote:
Originally Posted by refraction
on the note of sound support, 1 op such as

Code:

0D 0X LL HH SNP Play PCM Sound for HHLL miliseconds at the tone specified in address pointed to by Register X

That way you can keep a "bank" of notes and play them out at the speed and pitch you like. Pretty easy to do with a sine wave generator. I don't think there should be anything much more complicated than that, definately no audio samples that for sure. at most, we could have the Y bit of the opcode specifying type of wave (0 = sine, 1 = square, 2 = triangle), but as complexity goes, thats probably far enough!
Fair points, audio samples are expensive in memory and cpu time. It makes things easier for the chip16 programmer, though, to have a DMA-ish play and forget sound instruction. But if you can't squeeze more than 4-5 seconds of audio in, what's the point eh?
So if I understand right, you suggest playing one tone at a time, with a variable rate (ie HHLL ms)? With a bit of effort, you could play something that resembles an audio sample
__________________
tchip16 (chip16 assembler) Js16 (browser chip16 emulator)
mash16 (chip16 emulator) img16 (chip16 sprite converter)
______________________________________

Desktop: i5 750 @ 3.6 Ghz, 4GB ram, GTX 570 OC | Windows 7 Pro 64
Laptop: (Thinkpad) i5 430M, 4GB ram, Intel IGP | Arch Linux, Windows 7 Pro 64

Last edited by tykel; October 27th, 2011 at 00:15..
tykel is offline  
Old October 27th, 2011, 00:09   #625
refraction
PCSX2 Coder
 
refraction's Avatar
 
Join Date: Jan 2004
Location: Plymouth, UK
Posts: 10,037
Quote:
Originally Posted by tykel View Post
I have found one slight bug, however - in the SoundTest rom, sounds are played without stopping, even after a different rom has been loaded.
You're right! apparently the sound decides to loop forever if you interrupt it lol. Ive forced it to stop the sound now on reset/rom change so it won't do that anymore

reuploaded the attachment on the previous post
__________________

http://www.pcsx2.net
Intel i7 920 @ 3.4Ghz, POV GTX 570 1.3Gb, 1.8Tb HD space, 6Gb OCZ Reaper PC3-14400 Triple Channel
Dont PM me for help, use the forums, thats what its for!


My Chip16 Emulator RefChip16 http://code.google.com/p/refchip16/
refraction is offline  
Old October 27th, 2011, 00:18   #626
paul_nicholls
Registered User
 
Join Date: Sep 2011
Location: Australia, Tasmania
Posts: 180
Quote:
Originally Posted by refraction View Post
on the note of sound support, 1 op such as

Code:
0D 0X LL HH SNP Play PCM Sound for HHLL miliseconds at the tone specified in address pointed to by Register X
That way you can keep a "bank" of notes and play them out at the speed and pitch you like. Pretty easy to do with a sine wave generator. I don't think there should be anything much more complicated than that, definately no audio samples that for sure. at most, we could have the Y bit of the opcode specifying type of wave (0 = sine, 1 = square, 2 = triangle), but as complexity goes, thats probably far enough!
I like it! Simple, but should be quite useful

EDIT: hmm...thinking about this more, should we have some sort of attack/release time (variable, or hard coded) to stop any pops, etc. when starting/stopping notes?

cheers,
Paul
paul_nicholls is offline  
Old October 27th, 2011, 00:40   #627
paul_nicholls
Registered User
 
Join Date: Sep 2011
Location: Australia, Tasmania
Posts: 180
Maybe we could do something like this (taken from C64 sound programming)

Code:
ADSR Envelope Values
VALUE  ATTACK RATE DECAY RATE RELEASE RATE
0      2 ms        6 ms       6 ms
1      8 ms        24 ms      24 ms
2      16 ms       48 ms      48 ms
3      24 ms       72 ms      72 ms
4      38 ms       114 ms     114 ms
5      56 ms       168 ms     168 ms
6      68 ms       204 ms     204 ms
7      80 ms       240 ms     240 ms
8      100 ms      .3 sec     .3 sec
9      .25 sec     .75 sec    .75 sec
10     .5 sec      1.5 sec    1.5 sec
11     .8 sec      2.4 sec    2.4 sec
12     1 sec       3 sec      3 sec
13     3 sec       9 sec      9 sec
14     5 sec       15 sec     15 sec
15     8 sec       24 sec     24 sec
so maybe the mnemonics could be like so:

Code:
0D 0X LL HH AD SR  SNP Play PCM Sound for HHLL miliseconds at the tone specified in address pointed to by Register X, using the ADSR nibble values for attack, decay, sustain (volume), release respectively.
The AD SR values + milliseconds duration would build up the envelope prior to playing the tone...

I think this should be very easy to do, and not too complex...then lots of cool sounds would be possible!

What do you guys/gals think?

cheers,
Paul

Last edited by paul_nicholls; October 27th, 2011 at 00:45..
paul_nicholls is offline  
Old October 27th, 2011, 00:48   #628
paul_nicholls
Registered User
 
Join Date: Sep 2011
Location: Australia, Tasmania
Posts: 180
Or to save on code size when making 'songs', we could make a separate ADSR instruction maybe which sets the values prior to doing a bunch of notes?

Oh, and are we limiting ourselves to just one voice/note at a time? Or will the next sound not stop the previous sound and just mix with it to make polyphonic music?

EDIT: one other thing, what are we doing about the volume of sounds, and the type of sound being generated (square, sine, sawtooth, triangle, noise, ?) with this latest version of the single sound instruction?

cheers,
Paul

Last edited by paul_nicholls; October 27th, 2011 at 01:21..
paul_nicholls is offline  
Old October 27th, 2011, 01:39   #629
paul_nicholls
Registered User
 
Join Date: Sep 2011
Location: Australia, Tasmania
Posts: 180
Maybe we COULD do something like so:

Code:
...
09 00 00 00	SND0			Stop playing sounds.
0A 00 LL HH	SND1 HHLL		Play 500Hz tone for HHLL miliseconds (uses current sound generator settings; ADSR, etc.).
0B 00 LL HH	SND2 HHLL		Play 1000Hz tone for HHLL miliseconds (uses current sound generator settings; ADSR, etc.).
0C 00 LL HH	SND3 HHLL		Play 1500Hz tone for HHLL milliseconds (uses current sound generator settings; ADSR, etc.).

0D 0X LL HH     SNP                     Play Sound for HHLL miliseconds at the tone specified in address pointed to by Register X (uses current sound generator settings; ADSR, etc.).

0E AD SR VT     SNG                     Sound generator setup (applies to all sound tones which follow).
                                        A = attack  (0..15)
                                        D = decay   (0..15)
                                        S = sustain (0..15, volume)
                                        R = release (0..15)
                                        V = volume  (0..15)
                                        T = type of sound:
                                          00 = square wave
                                          01 = sine wave
                                          02 = sawtooth wave
                                          03 = triangle wave
                                          04 = noise
                                          non-valid values default to sine wave or something?

// Jumps
10 00 LL HH	JMP HHLL		Jump to the specified address.
...
Just a thought

cheers,
Paul

Last edited by paul_nicholls; October 27th, 2011 at 06:26..
paul_nicholls is offline  
Old October 27th, 2011, 09:05   #630
refraction
PCSX2 Coder
 
refraction's Avatar
 
Join Date: Jan 2004
Location: Plymouth, UK
Posts: 10,037
I like it, but remember this is going to be someone's first emulator, we should be introducing them to the basics of everything. Its hard enough making a wave generator, let alone play with mixer dsp's xD We just have to make sure we don't get too excessive, without being too primitive. Happy Medium ;P

Quote:
Originally Posted by tykel View Post
EDIT:
Fair points, audio samples are expensive in memory and cpu time. It makes things easier for the chip16 programmer, though, to have a DMA-ish play and forget sound instruction. But if you can't squeeze more than 4-5 seconds of audio in, what's the point eh?
So if I understand right, you suggest playing one tone at a time, with a variable rate (ie HHLL ms)? With a bit of effort, you could play something that resembles an audio sample

Edit from me: Sorry i missed this! Yeh thats pretty much the point. There is never going to be an epic musical masterpiece on this thing, thats for sure, but on a menu when you arent doing anything you can dedicate time to playing a note, causing a jmp if x = y, y +=1, type wait loop (y could be counting the ms or smth), play another note, so you can do a little tune or something, but more to the point, if you can choose the notes, it gives a bit more variation for movement/death/hitting stuff noises.
__________________

http://www.pcsx2.net
Intel i7 920 @ 3.4Ghz, POV GTX 570 1.3Gb, 1.8Tb HD space, 6Gb OCZ Reaper PC3-14400 Triple Channel
Dont PM me for help, use the forums, thats what its for!


My Chip16 Emulator RefChip16 http://code.google.com/p/refchip16/

Last edited by refraction; October 27th, 2011 at 13:07..
refraction is offline  
Old October 27th, 2011, 13:20   #631
SCHUMI_4EVER
Hackin 'n Slashin
 
SCHUMI_4EVER's Avatar
 
Join Date: Jan 2007
Location: Most-expensive-Internet-on-the-Planet Land : South Africa
Posts: 26,427
Quote:
Originally Posted by refraction View Post
Hey dude! good ta hope things are well with you
Yup things are fine Good to see you're finally over WoW, at least that you were stuck on that was the last report we got from GP ages ago.
__________________
Intel Core2Quad Q9550 (2.83Ghz stock) | ASUS P5Q | 2x2GB Transcend JetRam DDR2-800 | ASUS ENGTX260\HDTP\896M | Windows Vista Home Premium 64bit SP1
The Champ has retired but may his Legacy live on FOREVER !!!!
Get it right fools! The glass is HALF-EMPTY, not half-full!!!
!!! WARNING: Emulation requires a brain !!! WARNING: Emulation =/= Piracy !!!
SCHUMI_4EVER is offline  
Old October 27th, 2011, 20:40   #632
paul_nicholls
Registered User
 
Join Date: Sep 2011
Location: Australia, Tasmania
Posts: 180
Quote:
Originally Posted by refraction View Post
I like it, but remember this is going to be someone's first emulator, we should be introducing them to the basics of everything. Its hard enough making a wave generator, let alone play with mixer dsp's xD We just have to make sure we don't get too excessive, without being too primitive. Happy Medium ;P
LOL! I forgot about that very valid point, that this is to enable someone make an emulator fairly easily, and I guess I did get carried away in my excitement

Thanks for reminding me!

Ok, just ignore my SNG command then

So are we going to use sine waves then for all sounds with a fixed volume?

cheers,
Paul
paul_nicholls is offline  
Old October 28th, 2011, 00:54   #633
ShendoXT
Moderator
 
ShendoXT's Avatar
 
Join Date: Feb 2006
Location: Croatia
Posts: 4,550
Just found about BytePusher, another system based off Chip8 but way different then Chip16.
__________________
Shendo's software blog

Core i5 2400 3.1 Ghz | ASRock H67M | GTX460 768Mb | 8GB DDR3 1333 | 1500 Gb HDD
Grundig VLC 7121 C (1080p) 32" | Razer DeathAdder | Logitech G110 | Windows 7 x64

Don't PM or ask me about VMP-MCR conversions. I will ignore you if you do.
ShendoXT is offline  
Old October 28th, 2011, 05:59   #634
Prads
Registered User
 
Prads's Avatar
 
Join Date: Sep 2011
Location: Australia
Posts: 89
Quote:
Originally Posted by ShendoXT View Post
Just found about BytePusher, another system based off Chip8 but way different then Chip16.
Same old hex keyboard, yuck!
__________________
My Programming Projects: www.pradsprojects.com
Prads is offline  
Old October 28th, 2011, 08:55   #635
refraction
PCSX2 Coder
 
refraction's Avatar
 
Join Date: Jan 2004
Location: Plymouth, UK
Posts: 10,037
Quote:
Originally Posted by ShendoXT View Post
Just found about BytePusher, another system based off Chip8 but way different then Chip16.
Pff, chip16 is way better
__________________

http://www.pcsx2.net
Intel i7 920 @ 3.4Ghz, POV GTX 570 1.3Gb, 1.8Tb HD space, 6Gb OCZ Reaper PC3-14400 Triple Channel
Dont PM me for help, use the forums, thats what its for!


My Chip16 Emulator RefChip16 http://code.google.com/p/refchip16/
refraction is offline  
Old October 28th, 2011, 18:50   #636
tykel
Sober coder
 
tykel's Avatar
 
Join Date: Aug 2010
Location: London, UK
Posts: 433
Quote:
Originally Posted by ShendoXT View Post
Just found about BytePusher, another system based off Chip8 but way different then Chip16.
Looks less intuitive to program for and has a horrible keyboard, as was said.
Only things going for it are big memory and decent sound/gfx.
So, Chip16 is my fav
__________________
tchip16 (chip16 assembler) Js16 (browser chip16 emulator)
mash16 (chip16 emulator) img16 (chip16 sprite converter)
______________________________________

Desktop: i5 750 @ 3.6 Ghz, 4GB ram, GTX 570 OC | Windows 7 Pro 64
Laptop: (Thinkpad) i5 430M, 4GB ram, Intel IGP | Arch Linux, Windows 7 Pro 64
tykel is offline  
Old October 28th, 2011, 22:25   #637
ShendoXT
Moderator
 
ShendoXT's Avatar
 
Join Date: Feb 2006
Location: Croatia
Posts: 4,550
Yay

Anyway, I think we either should remove all current sound related opcodes and make new ones or leave the thing as it is.
Combining various methods of sound creation/playing would make the system inconsistent (as it happened with Cotton's additions; opcodes are not "in order".
__________________
Shendo's software blog

Core i5 2400 3.1 Ghz | ASRock H67M | GTX460 768Mb | 8GB DDR3 1333 | 1500 Gb HDD
Grundig VLC 7121 C (1080p) 32" | Razer DeathAdder | Logitech G110 | Windows 7 x64

Don't PM or ask me about VMP-MCR conversions. I will ignore you if you do.
ShendoXT is offline  
Old October 28th, 2011, 22:47   #638
refraction
PCSX2 Coder
 
refraction's Avatar
 
Join Date: Jan 2004
Location: Plymouth, UK
Posts: 10,037
Quote:
Originally Posted by ShendoXT View Post
Yay

Anyway, I think we either should remove all current sound related opcodes and make new ones or leave the thing as it is.
Combining various methods of sound creation/playing would make the system inconsistent (as it happened with Cotton's additions; opcodes are not "in order".
Could be an idea tbh, it will mean modifying all current Roms to support it, but a single op for sound would be better!
__________________

http://www.pcsx2.net
Intel i7 920 @ 3.4Ghz, POV GTX 570 1.3Gb, 1.8Tb HD space, 6Gb OCZ Reaper PC3-14400 Triple Channel
Dont PM me for help, use the forums, thats what its for!


My Chip16 Emulator RefChip16 http://code.google.com/p/refchip16/
refraction is offline  
Old November 5th, 2011, 15:55   #639
Chris2Balls
Le French Touch
 
Chris2Balls's Avatar
 
Join Date: Apr 2011
Posts: 15
Hey guys, it's been a while since I haven't checked the thread out but lately I've been trying to optimize the chip16's palette. I was wondering if there was a quick way for me to change the palette in one of the image converters posted here, and if not, if somebody could explain how I can do this. :/
In the meantime with Tronix's image converter I did this, with the palette currently used:


The original files:


It's interesting because if you look at the original Wikipedia page, the C16's palette covers quite a good range in comparison to those of other systems!

Latest update on the C16's palette:


The reason why I'd like to find a quick way of switching the palette and converting images is so I can establish what kind of hue/value ramp I'm aiming for to maximize the palette's effectiveness.

Thanks in advance, and good luck guys
__________________
Mitsubishi.
Chris2Balls is offline  
Old November 5th, 2011, 23:57   #640
tykel
Sober coder
 
tykel's Avatar
 
Join Date: Aug 2010
Location: London, UK
Posts: 433
Quote:
Originally Posted by Chris2Balls View Post
Hey guys, it's been a while since I haven't checked the thread out but lately I've been trying to optimize the chip16's palette. I was wondering if there was a quick way for me to change the palette in one of the image converters posted here, and if not, if somebody could explain how I can do this. :/
In the meantime with Tronix's image converter I did this, with the palette currently used:


The original files:


It's interesting because if you look at the original Wikipedia page, the C16's palette covers quite a good range in comparison to those of other systems!

Latest update on the C16's palette:


The reason why I'd like to find a quick way of switching the palette and converting images is so I can establish what kind of hue/value ramp I'm aiming for to maximize the palette's effectiveness.

Thanks in advance, and good luck guys
To change the colors: you can hack a binary with a hex editor like HxD. Just perform a Find for a series of hex-values representing colors (e.g. FFFFFF for white, 000000 for black)
EDIT: Look between offsets E19E8 - E1A27 in imgconv.exe (Tronix's), that's where the palette is stored. Just modify from there (each color is 4B, so 8 characters in the editor)
Or you can just send me the new palette in text format, and I can send you a custom build of my image converter.
__________________
tchip16 (chip16 assembler) Js16 (browser chip16 emulator)
mash16 (chip16 emulator) img16 (chip16 sprite converter)
______________________________________

Desktop: i5 750 @ 3.6 Ghz, 4GB ram, GTX 570 OC | Windows 7 Pro 64
Laptop: (Thinkpad) i5 430M, 4GB ram, Intel IGP | Arch Linux, Windows 7 Pro 64

Last edited by tykel; November 6th, 2011 at 00:06..
tykel is offline  
Closed Thread

Thread Tools
Display Modes

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 Off

Forum Jump

All times are GMT +1. The time now is 02:38.

© 2006 - 2012 Emu Forums | About Emu Forums | Advertisers | Investors | Legal | A member of the Crowdgather Forum Community


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.