Sound bits

Discussions on programming older machines

Sound bits

Postby Vorticon » Sat Feb 20, 2010 5:18 pm

Hello.
I'm looking at writing a short program that sets the PB5 and PB6 bits of the 8255 so I can have sound when using Tandy mode for certain games. What is the address of the 8255 PB byte? I can't seem to find it in the PCjr tech manual...

Walid
Vorticon
 
Posts: 276
Joined: Fri Nov 27, 2009 7:25 am

Re: Sound bits

Postby Brutman » Sat Feb 20, 2010 6:14 pm

Have you considered using Cartridge BASIC as a quick test? I assume you are trying to set the sound source to the TI chip - Cartridge BASIC can definitely do that.

If you want to do it using assembler or by poking the bits directly, the tech ref on page 2-29 says the 8255 is at port addresses 60 through 67. Only 60 through 63 are used. 61 is Port B, which is what you are interested in. (All numbers are in Hex.)
Brutman
Site Admin
 
Posts: 951
Joined: Sat Jun 21, 2008 5:03 pm

Re: Sound bits

Postby Vorticon » Sat Feb 20, 2010 11:47 pm

Thanks! I must have missed it somehow. Yes, I want to change the bits using assembly or maybe TP prior to running a game program, something I can include in the autoexec.bat. Cartridge Basic will require to go into the Basic environment, poke the changes, then exit, which is a bit cumbersome, and I am not sure if the bits get reset after I exit the environment. I'll play with it a bit (no pun intended) tomorrow.

Walid
Vorticon
 
Posts: 276
Joined: Fri Nov 27, 2009 7:25 am

Re: Sound bits

Postby Vorticon » Sun Feb 21, 2010 11:05 am

OK here's the situation:
- Using the Sound On command from within Basic does not work upon exiting the Basic environment.
- Using Debug, it appears that the default setup of port 61 is 0D, which selects the 8253-5 timer output. Changing the setting to 7D will turn off the internal speaker and enable to TI sound chip output. Any value for the second nibble that sets bit 2 (alpha graphics mode) will essentially work, otherwise you get a corrupted random screen. This does work and I am able to now hear sounds from within Battle Chess using Tandy mode. The problem though is that when the TI sound chip is enabled a low amplitude constant tone appears on the monitor speaker. One can ignore it and it does not take away too much from the sound effects, however it is still annoying especially at higher volume levels. Given that this obviously does not happen in the Basic environment, what am I missing???

Walid
Vorticon
 
Posts: 276
Joined: Fri Nov 27, 2009 7:25 am

Re: Sound bits

Postby Vorticon » Thu Jul 08, 2010 12:57 am

This is a simple command line utility I wrote in Turbo Pascal that activates or deactivates Tandy sound on the PCjr.

Command format: tsound [s]

If no parameter is entered, then Tandy sound is activated through the monitor and the internal speaker is deactivated. The s parameter does the reverse by restoring the internal speaker.

Walid
Attachments
tsound.zip
(8.62 KiB) Downloaded 1227 times
Vorticon
 
Posts: 276
Joined: Fri Nov 27, 2009 7:25 am

Re: Sound bits

Postby Brutman » Mon Jul 12, 2010 9:39 am

Hi Walid,

What version of Turbo Pascal are you using?

Was this really as simple as just a few ins, outs, and ors? If so, I'm wondering if it can be done with a small COM file is assembler. 12KB isn't bad, but I'll bet it can be under 200 bytes. :-)
Brutman
Site Admin
 
Posts: 951
Joined: Sat Jun 21, 2008 5:03 pm

Re: Sound bits

Postby Vorticon » Mon Jul 12, 2010 7:41 pm

I used Turbo Pascal 3. I did notice the large size for such a small program which really all it does is set the port bits, and it should not take that much space.
You are welcome to try it in assembly. I have attached the listing (zipped because this is the only allowed extension).

Walid
Attachments
tsound.zip
(362 Bytes) Downloaded 1216 times
Vorticon
 
Posts: 276
Joined: Fri Nov 27, 2009 7:25 am

Re: Sound bits

Postby Brutman » Wed Jul 14, 2010 8:39 pm

Thanks!

It's a good candidate for a small assembly program. I don't have enough skill to just whip it out right here off the top of my head, but given a Saturday afternoon I could probably get it done start to finish.

I loved Turbo Pascal 3.0 back when the only machine I had was the Jr. It was fast and had good features, even on the Jr. When Turbo Pascal got too big (around version 5) I gave up on it.

I hardly do anything directly on the Jr anymore. I'm on a big Open Watcom kick lately - it's replaced Turbo C++ 3.0 for all of my TCP/IP programming. It'll run on my 386-40, but it's not happy about it. Luckily it can also run natively under Windows XP, where it is blindingly fast. (I can recompile 7 of my apps in about 10 seconds, while on the 386-40 with Turbo C++ it would be a 20 minute deal.)


Mike
Brutman
Site Admin
 
Posts: 951
Joined: Sat Jun 21, 2008 5:03 pm

Re: Sound bits

Postby Vorticon » Thu Jul 15, 2010 12:34 am

Actually TP 5 runs fine on the Jr, but some form of hard drive is needed. I have it installed on my parallel zip drive, but for some odd reason I still like the simplicity of TP 3 for small projects. For larger projects though, TP 5 is much better.
As for C, while I have done several projects with it, I just don't like it... Nowadays, I either program in Pascal or straight assembly (9900 CPU only) with the occasional BASIC (yes, you heard me right!) project mixed in, and all my programming is on vintage machines although I am now looking at Free Pascal under Linux. So when tsound ended up being nearly 12k, I was horrified given that I am used to writing complex programs in assembly in under 24K on the TI 99/4A! I guess this is the origin of the current bloat in software...
Vorticon
 
Posts: 276
Joined: Fri Nov 27, 2009 7:25 am

Re: Sound bits

Postby Brutman » Thu Jul 15, 2010 6:50 am

I didn't have mass storage of any sort, Zip or otherwise, probably until 2003. So TP5 was long gone for me by then ...

Of course most of that 12K is not being used. The simpler language runtimes included all of the runtime routines, whether you needed them or not. So that 12K is only be amortized over a few real bytes of code, but for a very complex application it would still be the same 12K. Not worth losing sleep over.

I'm having a little debate with the Watcom developers/community about the need to allocate 64KB of near heap in the large memory models when nothing should be using it. It's making my larger TCP/IP programs look 30 to 40% more memory hungry than they are, which is a big deal on a small machine.
Brutman
Site Admin
 
Posts: 951
Joined: Sat Jun 21, 2008 5:03 pm

Next

Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron