The code you posted looks like an Arduino sketch with setup() and loop() function, but contains no main() function, so I think it must be written for some version of the Arduino-IDE.
Delta_G:
What exactly do you mean? Does it not compile? Or does it not run the way you want? What doe it actually do and how does that compare to what you want? No success can mean a lot of things.
It could also mean: he failed with doing copy-and-paste, perhaps from the Windows Wordpad editor to the Arduino-IDE?
Maybe. Recently released versions IDE 1.6.6 and 1.6.7 are VERY buggy. Better avoid them.
Perhaps you try to find out the date when the file you try to compile was released, then look up the Arduino release notes which was the current version of the Arduino-IDE at that time, then install and use that version of the IDE.
With a Windows PC you could use XLoader to upload a HEX file easily.
With MAC you could set the Arduino-IDE preferences to verbose output during upload (with any sketch you want) and watch the upload messages in the status window.
Watch out for the call of the "avrdude" upload command which uploads the temporary hex file.
If you are able to create a similar upload command for your existing hex file (with all the cryptic parameters in the command line), then you can use the "avrdude" tool for upload, which is part of the Arduino IDE.
Interesting, I think I know what may be the reason.
The site I got the asteroids program from used a STK600-ATMEGA2560 board to link with he Dutchtronics Scope Clock terminal. Just seen also their baud rate is 250,000 not 115,200 (I don't actually know what that means but is that an issue too?).
I recognized in the code you posted some modifications I made to the original asteroids.c from wherever Jan at Dutchtronixs got it.
I did not implement Asteroids on an Arduino, instead I implemented it on a PC, using the Code::Blocks IDE. I wrote a set of companion routines (e.g. VGClearScreen(), etc.) that send the vectors and commands to the Scope Clock board via the serial port at 115,200 baud. It should not be difficult to modify the VG*() functions to run on the Arduino, all they do is send some characters to the serial port. It is much easier to do that on the Arduino than on the PC (in an efficient way, especially if a USB-TTL serial adapter is involved).
I've attached the code (too big to post in line). See the VectorGen folder for the PC game and vector driver, VectorGenDemo3.c, which #includes the asteroids.c game. It works fine, but not as much fun as the original stand-up console version, partly because the ship never explodes. Have fun.
Edit: In looking through this stuff again, I realized that the original source code for the much simpler VG*() UART routines is still in the code, but commented out. Look in the folder "Asteroids" at asteroids.c
Do you think I should try to copy and paste the Asteroids.c you have posted here into the Arduino IDE to compile, will that work? Which IDE version would be best for that?
This is my first delve into Arduino and programming so I'm at a loss but hoping to learn.
As I think the modifications you are talking about might be because he implemented it on a STK-600 development board.
Either way will using the .hex file uploaded directly to the 2560 on the arduino board work?
Thanks for your help with this. I'm borrowing a windows computer tonight to give it a go using XLoader
The asteroids folder in the zip file I posted contains code that could, with some effort, run under the Arduino IDE. The key will be to get the VG*() and UART functions working. For a first Arduino project, this may be rather challenging.
If you want to run the game using a PC connected to the ScopeClock, download the Code::Blocks IDE, click open the "Asteroids.cbp" file and generate an executable.
The idea is to use a 1930's clear 903 CRT, valve driven to display the clock and have asteroids function, so sooner or later I would like it running on the Mega 2560 board so it can be neatly installed inside a self contained cabinet