First grai scale, now SOUND!!!!!

A forum where you can announce your awesome project(s).

Moderator: MaxCoderz Staff

merthsoft
Extreme Poster
Posts: 496
Joined: Tue 21 Dec, 2004 6:49 am
Location: WI

Post by merthsoft »

Wouldn't a caluculation be smaller, and maybe faster then a table?
Shaun
User avatar
benryves
Maxcoderz Staff
Posts: 3089
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

Merthsoft wrote:Wouldn't a caluculation be smaller, and maybe faster then a table?
The main reason to have a table in the first place is that's it's a lot faster to do an addition and maybe one multiplication (if it's a 2-dimensional LUT) to do a calculation rather than the calculation itself.

A good example of this is a 3D tunnel effect, such as:

Image

Now, you could go through each pixel, calculate which angle it's at and how far away it is and then do the colour lookup. This is far too slow to do in realtime. A much better plan would be to have two tables - one for angles, one for distances. Now, as you go through each pixel you look up the angle and add on the rotation (constant per frame) and then look up the distance and add on the distance travelled (constant per frame) and then do the pixel colour magic.

Or, on the TI (where doing all those calculations would be too slow and complex to bother with anyway) you could precompute them all and compile the tables into your source. (in my case, for "Pixel Madness", I quartered each table so it only showed the top-left corner and expanded it to fill the full buffers before loading - this saved a lot of space!)
User avatar
Jim e
Calc King
Posts: 2457
Joined: Sun 26 Dec, 2004 5:27 am
Location: SXIOPO = Infinite lives for both players
Contact:

Post by Jim e »

Yeah thats right. Besides doing square roots in asm takes time i don't want to think about 12th root.

Anyway, I just realised a fatal(yes FATAL) flaw with using my routine as a TSR. The thing is that if something causes an IM 1(archive, power off), tios normal interrupt won't clear the crystal timer interrupts and interrupts would execute constantly. So the only way to prevent this is a hook of some kind, and I am in no mood to play with hooks, I got a migrane the last time I did.

Sorry, I tried, I really did. :(

Well as far as this and the grat scale goes I start work on a shell and see where it goes from there. But i'm working on one more thing before starting that, so wish me luck.
Image
User avatar
benryves
Maxcoderz Staff
Posts: 3089
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

Jim e wrote:I start work on a shell and see where it goes from there.
Why not just create a library in the form of a .inc that you can add to your own projects? (much like Duck's greyscale package).
User avatar
Jim e
Calc King
Posts: 2457
Joined: Sun 26 Dec, 2004 5:27 am
Location: SXIOPO = Infinite lives for both players
Contact:

Post by Jim e »

Well yes thats how it is now, but there are two problems I see.
One it is repetative code that doesn't need to waste space.
Two if there is a flaw I don't know about, it could be fixed via shell update, most of my info on the extra hardware comes from Michael and from what i can tell there are still some unkowns to workout.

I've only found a workaround for the halt bug, but not an actual fix. But yeah I should really release that code officially, I should probably just mimic Ducks gpp because of it's popularity.

On that note, some time ago duck reminded me that bit interlacing produces less noise than any other form. So I decided to rewrite ducks copy routine, the 70,000 clocks is a bit much. After a bit of work I brought the size down a little and it runs in 61,000 clocks. I know not much, but every bit counts. :wink:

I really should release code. :)
Image
User avatar
Jim e
Calc King
Posts: 2457
Joined: Sun 26 Dec, 2004 5:27 am
Location: SXIOPO = Infinite lives for both players
Contact:

Post by Jim e »

Sorry for the double post, but I made one last demo for this, err...well I didn't make the demo but I fused the game with sound.

Its Galaxian by Patrick Davidson & Sam Heald, plus the starfox song by Paul Marks, plus my interrupt sound by me. What s really cool about this is that the CPU speed is still at 6MHZ, I didn't need to step it up. So you can imagine a lot more is possible.

I also reduced the frequency of BPM timer so now on average ther are only 1500 interrupts per second. Meaning more speed.

The sound quality diminished in the game alittle b/c it's running at 6mhz but I think with all things considered it's still pretty good.

I included some source with it so you can see what going on in the sound routine and how the format works. It is not a finally version, please do distribute.

I'm going to give that tsr one last shot, but it will still be affected by that issue.


Oh...almost foregot the link
http://www.geocities.com/jimm09876/calc/GALAXAN2.zip
Image
merthsoft
Extreme Poster
Posts: 496
Joined: Tue 21 Dec, 2004 6:49 am
Location: WI

Post by merthsoft »

Or, on the TI (where doing all those calculations would be too slow and complex to bother with anyway) you could precompute them all and compile the tables into your source.
Yeah, I realized how slow it would be for real time output after thinking about it last night, and making a little piano program in QuickBasic, or QBASIC, or one of those types of BASIC things. Instead of having a predfined table right from the start, I had it make the table right in the beginning, but that took a bit of time, but using a bunch of DATA commands made it faster, and surprisingly didn't take much time...
I made one last demo for this
This is amazing, that's all I can realy think to say...
Shaun
User avatar
Jim e
Calc King
Posts: 2457
Joined: Sun 26 Dec, 2004 5:27 am
Location: SXIOPO = Infinite lives for both players
Contact:

Post by Jim e »

Ok, for all you 83+ owners out there i tried to rework the routine so it runs an 83+. I did and it works. The problem, it's SUPER SHITTY. WHY?, well Interrupts are unbalanced in their placement, they don't care as long as the proper amount of interrupts occur. So here is yet another galaxian demo but this time for the 83+ers. So keep in mind when you listen it will be crappy, but on the se you probably would be able tell the difference my routine and calcmod.

Source included so if an 83 programmer wants to port the demo down thats ok, you would have to change the location the interrupt is copied to.
This is only for 83+, NOT the SE
http://www.geocities.com/jimm09876/calc/GALAXAN3.zip

Hmmm... are any 83+ owners even reading this thread, oh well...
Image
User avatar
DJ_O
Calc King
Posts: 2324
Joined: Mon 20 Dec, 2004 6:47 pm
Location: Quebec (Canada)
Contact:

Post by DJ_O »

I guess most programmers here have the 83+ since it's have been here since 1999 and it's not much expensive (for a graphing calc).
ImageImageImageImage
User avatar
Madskillz
Calc Wizard
Posts: 745
Joined: Fri 17 Dec, 2004 10:22 pm
Location: Wandering around in the Jungle...
Contact:

Post by Madskillz »

wow...simply amazing man! This is awesome...

edit: I don't know if this works on everyone's calc, but when you hit the "on" button while the song is playing, it shuts the song off...but you cant turn it back on...I only tried this in the first download, not the galaxan game.
The Revolution is here...
User avatar
Jim e
Calc King
Posts: 2457
Joined: Sun 26 Dec, 2004 5:27 am
Location: SXIOPO = Infinite lives for both players
Contact:

Post by Jim e »

Oh yeah thats an emergency break I put in alot of experimental programs, I'll have it execute code that sets the hardware back to normal, sometimes restore the stackpointer, and even quit to shell.
Image
merthsoft
Extreme Poster
Posts: 496
Joined: Tue 21 Dec, 2004 6:49 am
Location: WI

Post by merthsoft »

That's a really good idea (the interupt), and this sound thing is amazing, it would be cool if you could make is a program like xLib or CODEX where it uses a string to determine what to play, or an APP, kinda like Omnicalc's play() command, but playing at the same time as the game is going...
Shaun
User avatar
Jim e
Calc King
Posts: 2457
Joined: Sun 26 Dec, 2004 5:27 am
Location: SXIOPO = Infinite lives for both players
Contact:

Post by Jim e »

Well I looked at it again over the weekend and I decided that it's safe for the 83(+), but you won't be able to choose the frequency like I did with the glaxian SE demo
These would be the frequencies:
560 ;MAYBE..
280
172
140
124
86
70
63
59
43
35
31
21.5
17.5
15.5
10.75 ; Brown Noise any one :)

But for SE quality sound, you would need app.

This is on hold untill I finish the greyscale project.
Image
Patori
Maxcoderz Staff
Posts: 1479
Joined: Sat 18 Dec, 2004 3:51 am
Location: Toledo, Ohio, USA

Post by Patori »

Shadow Phoenix wrote:my speakers cable doesnt fit =)
****************************
where can I find adapters?
Build one. Take a calculator cord and headphones, chop um up. Then connect the wires (correctly)... It'll be quiet, but it works... IT isn't like that time I put 12v into the calc's link port cool, but it works....
Currently coming up with a new signature idea... since my forum avatar changer was killed by an upgrade...
User avatar
Shadow Phoenix
Calc Guru
Posts: 835
Joined: Mon 03 Jan, 2005 7:54 pm
Location: out there. seriosly.

Post by Shadow Phoenix »

it actually does... I should Scan mine =D
Life is getting better.
Post Reply