English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 03 February 2010, 16:08   #1
DBAlex
 
Posts: n/a
How to start Amiga Programming? (ASM/C)

Hey,

I'm sure this has been asked many times, however...

Can anyone point me to some guides for starting to program for the Amiga in ASM and/or C?

Specifically, I'm interested in graphics (well, game dev) so anything about how to access OCS/ECS, Blitter... Copper etc

I've been looking at ASM-One recently, is that a good assembler to use for e.g. A500 coding?

Is it better to program the older Amiga's in ASM, or will C just be as fast (I guess that depends on the compiler?)?

Finally, Is it better to learn 68K ASM from a "general" tutorial (since the 68K was used in many computers there must be many guides) or a tutorial/guide that's more Amiga specific?

Thanks for any help, Alex.
 
Old 03 February 2010, 17:06   #2
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Quote:
Originally Posted by DBAlex View Post
Specifically, I'm interested in graphics (well, game dev) so anything about how to access OCS/ECS, Blitter... Copper etc
Check the Hardware Reference Manual.


Quote:
Originally Posted by DBAlex View Post
I've been looking at ASM-One recently, is that a good assembler to use for e.g. A500 coding?
It sure is, very easy to use yet very powerful.

Quote:
Originally Posted by DBAlex View Post
Is it better to program the older Amiga's in ASM, or will C just be as fast (I guess that depends on the compiler?)?
Asm is the only choice if you want the fastest code (you can write parts of the code that are non speed critical in C of course), good optimized 68000 ASM code will always be faster than any compiled code, at least so far I beat any C Compiler on Amiga easily.
StingRay is offline  
Old 03 February 2010, 18:01   #3
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
I don't know of any good guides or tutorials. The HWRM is something you need though as it says it's a reference and not much of a tutorial or guide on programming. Starting on the Amiga is not like taking up programming in Python or C# but it sinks in eventually so don't become discouraged if it seems too much at first.

ASM-One is neat and has lots of utility built in, though there are a few bugs. V1.20 works fine on the A500 with Kickstart 1.3, but the built in debugger requires 68020. You can download it from http://www.theflamearrows.info/.

If you're used to Windows, OS X or Linux you might find that the ASM-One editor is a downgrade even from a standard edit box in more modern systems, and I usually recommend people to find a comfortable editor of choice and then check out vasm, vbcc and vlink. These are a macro assembler, a C compiler and a linker, and they make an excellent development suite. They're fully portable and easy to install and use via command line. I only keep ASM-One as a complement and for very quick testing myself. You can download the complete v-suite from Frank Wille's webpage at http://sun.hasenbraten.de/~frank/

When you've decided on a development environment you should get the 68000 programmers reference manual from www.freescale.com, and on http://cyberpingui.free.fr/sourcesMenu.htm you can find lots of intro source codes to have a look at.

There are lots of people in this forum who know the hardware and graphics programming, and people are happy to help so if you get stuck then here's where you want to ask.
Leffmann is offline  
Old 03 February 2010, 22:26   #4
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Quote:
Originally Posted by Leffmann View Post
If you're used to Windows, OS X or Linux you might find that the ASM-One editor is a downgrade even from a standard edit box in more modern systems, and I usually recommend people to find a comfortable editor of choice and then check out vasm, vbcc and vlink.
IMHO when you are starting to code (read: just playing around a bit, testing things etc) you don't really want to deal with linkers, compilers etc. Thus I think ASM-One is perfect [if you intend to code asm that is ], all you need in one package, perfect for beginners. I see where you are coming from but for a beginner this is "too much" I think. Just my opinion of course. =)
StingRay is offline  
Old 03 February 2010, 22:59   #5
AmigaBoy
Registered User
 
Join Date: Aug 2004
Location: 19 Jump Street
Posts: 238
Quote:
Originally Posted by StingRay
IMHO when you are starting to code (read: just playing around a bit, testing things etc) you don't really want to deal with linkers, compilers etc. Thus I think ASM-One is perfect [if you intend to code asm that is ], all you need in one package, perfect for beginners. I see where you are coming from but for a beginner this is "too much" I think. Just my opinion of course. =)
When doing 68k assembly, I've moved almost exclusively to assembling using vasm under Windows, with NotePad++ as my editor. No need to deal with linkers or compilers

Code:
vasm68k -m68000 -nosym -Fhunkexe demo.s -o out.exe
When it comes to C, I still haven't moved to vbcc on Windows. I use SAS/C, which with the right command line, will handle everything (including linking) in one line. It's been a while, but it would be something like:

Code:
sc demo.c -o out.exe
I can't remember if there's a parameter for linking, or if it's automatic. I want to say that there is one.

To answer the original poster, coding 68k ASM on the Amiga is difficult when you first start off and requires dedication. Your first step would be to learn about the 68000 specifically, then get to the Amiga specifics. I would start with learning about registers, then moving onto basic instructions like moving around memory, loading in addresses, branching, comparing, etc. Once I'm comfortable with that, I would start with some Amiga specifics, like learning how to detect a mouse click and poking at $DFF180 to get pretty colors on screen After that, I would start with something like the copper. It's about this time that you look at the Hardware Reference Manual.
I've found that the book Mapping The Amiga is an invaluable resource for some quick referencing. Look up mapamiga.txt on Google for links.
In my mind, the ASM Course on Aminet ( http://aminet.net/package/dev/asm/Asm_course ) is by far the best tutorial to teach you the basics in a short time. Get it, extract it, and refer to the 1.s, 2.s, 3.s, etc. files in the "assembler course" directory.
Once you have the basics down, start looking at sources to anything that you can find. Look for demos as they hit the hardware in some great ways.

As for game development on the Amiga using C, no idea really. As I've said in another thread, there's never really been a good C game API on the Amiga. GameSmith has been uploaded to the Zone (might still be there) which might be good, but I've never used it to know. That might be worth checking out.
AmigaBoy is offline  
Old 04 February 2010, 09:27   #6
pmc
gone
 
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
Quote:
Originally Posted by DBAlex
I've been looking at ASM-One recently, is that a good assembler to use for e.g. A500 coding?
Yes it's a very good assembler. You could also try Devpac too which is what I use. That's quite a good one too - right Sting?

Quote:
Originally Posted by StingRay
I second that emotion. The bible for Amiga asm coders.

Quote:
Originally Posted by DBAlex
Finally, Is it better to learn 68K ASM from a "general" tutorial
I would say yes. To me the 68000 is the generic thing in the Amiga that you can learn about specifically.

My recommendation for a cheap and very good book on the 68000 is:

http://www.abebooks.co.uk/servlet/Se...n=68000+Primer

Cheapest price on this excellent book (not including shipping) is currently £0.64!

If you like that you can then follow it with this by the same guys:

http://www.abebooks.co.uk/servlet/Se...ing+by+example

Also £0.64 and also excellent.
pmc is offline  
Old 04 February 2010, 18:05   #7
Photon
Moderator
 
Photon's Avatar
 
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,657
Hi and welcome

There are no books as accurate as the HRM, however it has basically no examples of 'how to actually do it' in assembler, so you *will* need an include file with the video etc register names it refers to.

I agree Asm-One is a great all-in-one package and perfect for asm coding. Later versions might leave very little memory if you have an unexpanded machine, but I have put a zip of the Asm-One 1.02 disk folders in the Zone. It's excellent and has a small footprint.

There are include files and examples on the disk, so you can look at them and look stuff up in HRM to understand what they do.

If you don't know 68000 assembly language, go with one of the recommendations above but also download the 68000 programmer's manual from Freescale. It's perfect for looking up exactly what an instruction does.

Learn to use the debugger and monitor, those are the tools of the trade to verify that you've programmed everything correctly

Last edited by Photon; 04 February 2010 at 19:01.
Photon is offline  
Old 04 February 2010, 23:28   #8
korruptor
TDI
 
korruptor's Avatar
 
Join Date: Feb 2007
Location: Blitter Town
Posts: 124
I've struggle a bit with AsmOne's debugger/monitor, especially for anything where I'm banging the hardware, cos I've not properly worked out how to use it. As soon as I've dumped stuff and setup my own copper list it seems to fall over. Best I seem to manage is dumping memory after running, or cutting and pasting specific bits of code into a separate file and stepping through them clean.

Are there any good docs for the latest version of AsmOne? I had a hunt about when I first got my Amiga online and only found a couple of really short AmigaDoc files.

Sorry if that's a bit noob
korruptor is offline  
Old 05 February 2010, 01:41   #9
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
The AmigaOS needs to be running so ASM-One and its debugger in turn can run, so you can't turn multitasking or interrupts off, or poke the hardware other than possibly the audio, and I would guess that triggering interrupts and other exceptions might crash it as well. The debugger works for clean code as you said, verifying algorithms, program flow etc.
Leffmann is offline  
Old 05 February 2010, 08:58   #10
pmc
gone
 
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
@ korruptor - what Leffman said. If the code you're running through the debugger (same thing happens using the Devpac debugger...) kills the OS and takes over the system it takes the debugger with it.

What I do to get around this is take sections of my code that perform a certain operation I want to check works correctly and put these into "wrappers" - other little pieces of code I write that push all the values I need into the correct regs and contain any tables or data structures the code section needs to work correctly.

Then I just step through this section of code using the debugger. That way the OS doesn't get killed and I get to see if the code works as intended.

This method helps massively with me getting my code to work - I can usually instantly see why something doesn't work and why as soon as I see the wrong value appear in a register or an unexpected branch get taken etc.
pmc is offline  
Old 05 February 2010, 12:05   #11
korruptor
TDI
 
korruptor's Avatar
 
Join Date: Feb 2007
Location: Blitter Town
Posts: 124
Yeah, that's what I'm doing already, just wondered if there were any other tricks. Tbh, I can probably get by with WinUAE for low level stuff, except the debug window is too big for the screen on my Netbook

Cheers all
korruptor is offline  
Old 08 April 2010, 14:25   #12
DBAlex
 
Posts: n/a
Woops, just found this thread... sorry I didn't reply sooner.

Thanks for all the responses, since I have some time off finally now I'll try and look at all these resources...

Cheers, Alex.
 
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Wanting to start learning to code amiga in asm fishyfish Coders. Asm / Hardware 5 03 March 2012 06:11
Programming Amiga? Amiga Forever Coders. General 14 03 April 2011 18:33
Amiga Programming JDunlap request.Apps 5 16 January 2008 05:29
Amiga programming magnox Coders. General 6 28 April 2006 00:33
command line to start a confil + start the game Unregistered New to Emulation or Amiga scene 4 17 October 2004 10:31

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 21:54.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.09078 seconds with 13 queries