English Amiga Board Amiga Lore


Go Back   English Amiga Board > Support > New to Emulation or Amiga scene

 
 
Thread Tools
Old 26 July 2012, 21:04   #1
BulletMagnet83
 
Posts: n/a
Best stuff to learn C programming for Amiga (plus project idea/questions)

Hi All,

As the title says, I'm after advice on what the best (easiest, most user-friendly) options are for programming my own applications. I know a bit about C etc from various microcontroller projects so I wouldn't be starting completely from scratch, and while I haven't touched one in a good few years I have some Amiga use experience under my belt.

Here's what I want to accomplish:

I like 80s style electronic drum kits. Sort of an unhealthy fetish... :P But to buy a real one in good condition costs an arm and a leg. So I thought "hey, why not build one". After much plotting and scheming I wondered about actually using a Paula chip as the sound generation methods and quality pretty much captures the mood I was going for. A bit more research and I wasn't exactly convinced I could make it work outside of it's natural environment.

So then, I thought, "well... the A600 has a pretty small mainboard, why not just use the whole thing?" And that's what brought me here, as I was well and truly getting into unfamiliar territory.

On the hardware side of things, I would (hopefully) have an A600 board in a nice rack case, floppy drive broken out to the front panel with scavenged mounting hardware. Also on the front panel would be some LED display gubbins, various switches etc for the UI, and some trigger pad sampling circuitry, with ALL of this "front end" stuff being managed by it's own microcontroller. The idea being to have this heap of stuff communicate with the A600 guts via the serial or parallel port.

The A600's job is to receive messages sent to it and play back the appropriate samples from it's memory at the right time and volume, and also write back to the panel controller so it's display can be updated according to what's going on. At least... that's the theory! Instead of having to design my own custom audio hardware, I now only have to learn some programming for hardware known to work (I already know how to build the front panel crap, having tinkered with each block of the circuit in one way or another many times before).

Does this sound in any way feasible? Any tricks and traps for n00bs I should be aware of? And finally, let's say I succeeded in writing the program and got everything to play nicely, can I actually use it straight from the boot screen without having to load up WB etc first? It'd be nice to just shove a "system disk" in and off we go, as I'm not planning on using any video output except for debugging.

Many thanks for any advice!
 
AdSense AdSense  
Old 27 July 2012, 03:58   #2
jimbob
Registered User

 
Join Date: May 2006
Location: Kilmacolm
Age: 39
Posts: 616
Nice plan, I'm considering something similar myself but frankly I don't think I'm up to doing it. I think the A600 motherboard could be a fantastic platform for a custom electronic instrument. Here's a few thoughts to consider.

About the system floppy workbench thing you mention. A600 mainboard has onboard IDE. Stick a 44pin IDE flash module on it and it will boot in seconds, either to workbench with your startupsequence loading up your program/s or straight into your own program if you want. Using the OS you get a lot of stuff for free like file handling plus the possibilities of using existing software such as samplers and sequencers.

I'd consider using the video output for the control panel screen. Get one of those 4.3" car headrest LCDs or similar and work into the rack panel.Since you'll be writing the software you can make it visually appropriate for the small screen. For controls you can get an adaptor to use a PS2 controller as mouse/joystick and/or wire switches into the keyboard controller.

I reckon the A600 keyboard interface could be adapted for use as drum pad triggers. You have something like a 12*6 column row grid plus some special lines. You can then write your program to respond to ordinary keypresses. Lots of possibilities for control layout with this, even more if you added a MC between your controls and the keyboard controller.

The amiga serial port is a couple of transistors and an optoisolator chip away from being a midi interface, (midi software also required of course).

Depending on how much money you want to spend, I'd look at getting at least a trapdoor chip RAM expansion, (more sample memory), and possibly some fast ram or even one of the new ACA620s. I' be a bit a bit concerned having one of the PLCC socket clip type expansions in a luggable instrument though.


Enough of my blabbering for now, I hope you are able to make progress with this, I'd really like to see how you get on.

Here's a few links for C stuff related to amiga. You'll get a compiler from the link in this thread -

http://eab.abime.net/showthread.php?...ht=sasc658.lha

If you want a cross compiler so you can develop on a PC take a look at VBCC -

http://www.compilers.de/vbcc.html

Amiga operating system and hardware manuals for developers are available here -

http://amigadev.elowar.com/

That page mentions the developer CD which contains the system include files, they are available elsewhere but I'm not sure exactly where.

Bunch of amiga C books available here -

http://amiga-manuals.xiik.net/ebooks/index.php

And A600 schematics here -

http://amiga-manuals.xiik.net/schematics/index.php
jimbob is offline  
Old 27 July 2012, 11:52   #3
deg
 
Posts: n/a
I know I'm going to get flamed for this, but I think this is exactly the sort of thing you should be using a raspberry pi for, take a look at http://www.raspberrypi.org/ (some of the older posts at the bottom and beyond) for what people are making with a pi, 30 quid, compact flash and no moving parts, loads of ports, tiny size, low power requirements, has the "gcc" c compiler on it and required libraries right out of the box, probably lots of example projects to use for both audio and port/midi development, 16-bit quality samples rather than the 8 bit on the amiga, more than 4 samples can be played at a time etc etc. one of the most important things when making a project is to get other people involved, or join a project with other people, the social aspect will cause you to finish the project and get more enjoyment out of it, there may already be drumkit projects out there on sourceforge, github, googlecode etc that are just waiting for you to join them...

But i understand completely why you would want to use an amiga, I have some friends who also do projects involving amigas, even though they are not practical, just because it is more fun to develop on amigas :-D

for c programming advice on the amiga, playing the actual samples is trivial and will take a few lines of code and there is alot of example source code on the amiga documentation supplied by commodore. but with c programming, it is important to "stand on the shoulders of giants" and use code that other people have already written. just like the metaphor of using a television, what is inside the television is very complex, but the interface is very simple (on/off, volume up/down, channel up/down). in the c programming equivalent, instead of hitting the commodore hardware or "dos/exec" etc library documentation/manuals, you should use already written code to load and play samples, for example there is some iff example source code that was released by electronic arts and commodore on the early fred fish discs (#16, #64, #0232?), which loads an iff sample and plays it. using a library like this allows you to think about the project at a higher level and get results faster:

int main()
{
IffSample *pSnare = load_sample("snare.iff");
IffSample *pBase = load_sample("bass.iff");
IffSample *pTom = load_sample("tom.iff");
IffSample *pCymbal = load_sample("cymbal.iff");

while(get_key())
{
if (key == escape)
break;
else if (key == '1')
play_sample(pSnare);
else if (key == '2')
play_sample(pBase);
else if (key == '3')
play_sample(pTom);
else if (key == '4')
play_sample(pCymbal);
}

return 0;
}

the hard part will be the serial/parallel port communication, but just like the above, we want to get something working quickly so the project will be fun and rewarding, so instead of hitting the serial port manuals/documentation, we'll look for c/c++ libraries or programs that have already been written that we can use, so hit aminet, google/bing search for "amiga serial port source code" that sort of thing.

can you imagine changing the above code to something as follows?:

int main()
{
if (!init_serial_port_or_midi_library())
printf("error, cannot init serial port or midi library\n");

IffSample *pSnare = load_sample("snare.iff");
IffSample *pBase = load_sample("bass.iff");
IffSample *pTom = load_sample("tom.iff");
IffSample *pCymbal = load_sample("cymbal.iff");

while(get_key_from_serial_port_or_midi_library()) // this line changed!
{
if (key == escape)
break;
else if (key == '1')
play_sample(pSnare);
else if (key == '2')
play_sample(pBase);
else if (key == '3')
play_sample(pTom);
else if (key == '4')
play_sample(pCymbal);
}

return 0;
}

So the first step in your project will simply be to get a c compiler installed, find and download some example source code, compile it and see if you can find something that will allow you to get a project up and running in some days rather than months.
 
Old 28 July 2012, 15:02   #4
BulletMagnet83
 
Posts: n/a
Thanks for the replies, guys! Loads of interesting links for me to check out Also, that example code/suggestion will probably be a big help! The more I can simplify by using freeware/open source libraries, the bigger chance I have of making it work. I'll be learning a lot of these concepts on the fly, so to speak... so I'm prepared for the learning curve and hard work! Thankfully I do have a rather bland social life so time is not an issue

By the looks of things I'm still going to have to build some custom interface hardware, as I'm going for a sort of "drum brain" module like the Simmons SDS7, rather than, say, a "groovebox" kind of thing to be played with one's fingers. So I'll still need some hardware to sample each pad strike, and tell the amiga which one was hit and how hard. I have some microcontrollers in the parts box that have enough A/D capabilities to handle the task.

Because it's intended to be played "live" rather than playing back complex patterns, I think 4 audio channels is enough - after all, I only have 4 limbs!

Is there anything I need to worry about re: the A600's kickstart ROMs? I am probably mistaken but I seem to recall reading somewhere that early versions didn't have scsi.device (or whatever it's called) on them so a hard drive couldn't be used? Booting from a CF card would be fantastic, and a good inexpensive storage solution. My plan will probably involve acquiring two A600s, as they seem to be rather cheap and unwanted by most fans. One nice one to develop on, and one cosmetic trainwreck to pillage the mainboard out of!

Well, I'd better get reading! Thanks again for the input Should be able to get some parts ordered around the end of the month so I guess we'll see how it goes...

Last edited by BulletMagnet83; 28 July 2012 at 16:09.
 
Old 29 July 2012, 00:31   #5
robinsonb5
Registered User
 
Join Date: Mar 2012
Location: Norfolk, UK
Posts: 509
Just to throw another idea out there, if you're fairly savvy hardware-wise you could use an FPGA board of some kind (Altera DE1 would be ideal if you can find one) - running the Minimig core. That way you'd start with a very familiar Amiga environment but would have scope to add extra sound channels and other custom hardware as the project progresses.
robinsonb5 is offline  
Old 29 July 2012, 10:07   #6
jimbob
Registered User

 
Join Date: May 2006
Location: Kilmacolm
Age: 39
Posts: 616
Quote:
Originally Posted by BulletMagnet83 View Post
So I'll still need some hardware to sample each pad strike, and tell the amiga which one was hit and how hard.
I'm not sure my idea of using the keyboard controller would be easily enhanced to do velocity sensing. I'd be especially interested to see how you achieve this. It was one thing, (of many) which has put off starting my own effort of this sort.

As for kickstart version, most A600s will come with at least 37.300 which should be fine. 37.299 I think has a problem with hard drives bigger than 40Mb. Don't take my word on this though, I've never heard the definitive story of A600 ROMs versus hard drives.

BTW, a stock A600 won't be a great development machine. If you want to use amiga compilers and stuff though, have you tried winUAE? It is pretty phenomenal.

Having two is still a good idea though, one for hardware hacking and one for software testing and spare if you kill the hacking one
jimbob is offline  
Old 29 July 2012, 16:15   #7
BulletMagnet83
 
Posts: n/a
Ahh actually, WinUAE is a very good idea, I'll definitely look into it. I've not personally used it but I have a passing familiarity with the concept... and if I can sort out some way to dump the contents I have a set of 3.0 ROMs from an A1200 I bought a while back which sadly was "significantly not as described". I guess mint condition/never modified means different things to different people...

The velocity sensing hardware should work by using an op-amp circuit with the trigger pad as the input signal source, set to provide an output between 0 and 5V. This output is then fed into one of the A/D channels on a suitable microcontroller. There could be perhaps 6 or 8 channels depending on the MCU used. Each of these channels is repeatedly polled, and on each channel's "turn" several samples are taken for the duration of the trigger pulse length, with the highest value being used.

Once each polling cycle is complete, the MCU should have collected a complete set of data for what was happening to each pad during that window of time. This can then be sent out over a serial port.

The trick will be doing this fast enough for a semi-realistic playing response. The hardware SHOULD work, but until I actually have the free time to build it and test some code I have NO idea how well it will react to being played. But code can always be tweaked and modified once the basic hardware's layed down A suitable test would be to rig the pad-sensing gubbins up to a PC/serial monitor and see if what I hit bears any resemblance to what appears on screen! If it doesn't work at all, I have some other options to explore.

Based on what I've managed to get my head around so far, I think it's going to be the hardest part of the project.


EDIT FOR UPDATE:

I've actually just found a project very similar to what I intend to undertake, so (woo yay!) a lot of the electronic design process has been done for me. http://www.edrum.info/schematics.html. Of course, I'm tooled up for a different family of microcontroller and I want to do the UI a bit differently so I can't copy it ALL, but hey... it can be done/has been done before. So there's hope for this endeavour yet

Last edited by BulletMagnet83; 29 July 2012 at 18:51.
 
Old 29 July 2012, 23:46   #8
Akiko
Registered User
Akiko's Avatar
 
Join Date: Feb 2009
Location: UK
Age: 36
Posts: 132
Akiko is offline  
Old 30 July 2012, 00:55   #9
Mequa
Registered User
 
Join Date: Nov 2009
Location: UK
Posts: 497
The classic guide to the C Programming Language.
Mequa is offline  
Old 30 July 2012, 02:36   #10
Retrofan
Ruler of the Universe

Retrofan's Avatar
 
Join Date: Mar 2010
Location: Lanzarote/Spain
Posts: 5,595
Send a message via Skype™ to Retrofan
Quote:
Originally Posted by Mequa View Post
This? http://net.pku.edu.cn/~course/cs101/...g_Language.pdf
Retrofan is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
My project idea - Is it worthwhile? Gordon Hardware mods 14 29 January 2009 13:09
project idea Gordon Nostalgia & memories 4 24 March 2007 12:07
Amiga Coverdisk nostalia / Project Idea mcbpete Nostalgia & memories 20 01 September 2006 08:45
An Amiga site with almost every Amiga game (adfs and cds). Good idea/project? Ironclaw Retrogaming General Discussion 19 11 April 2006 20:58
Some Questions Amiga 1200T! (CDRom, HD n stuff) BarrySWE support.Hardware 6 21 September 2005 21:32

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 +2. The time now is 20:57.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.17711 seconds with 11 queries