English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   Coders. C/C++ (https://eab.abime.net/forumdisplay.php?f=118)
-   -   very basic C/ASM/Visual Studio hand holding (https://eab.abime.net/showthread.php?t=81904)

Sephnroth 08 March 2016 19:24

very basic C/ASM/Visual Studio hand holding
 
Hi guys. Had a really rough day today and some bad news. I wanted to distract myself for a while so I decided i'd step towards a life goal and try and write some code for classic amiga.

I have a strong coding background with c/c++/c# and some asm background (arm9 - but many many years ago). I wanted to write my main code in C and then inline some ASM where the speed is critical (such as blitting etc).

I found a pre-configured tool chain (http://www.pouet.net/prod.php?which=65625) which is exactly what i wanted - visual studio support, builds and runs from ide, launches in winuae - perfect. I found what looks like a really neat set of videos on youtube teaching amiga asm too ( https://www.youtube.com/watch?v=p83Q...hTKJnjdTHz0_bW ) which will be just the job.

BUT the videos assume im doing pure asm and working in same IDE as he is and the toolchain assumes I already know what im doing - there is no explination on how to setup my own new project for amiga in visual studio, where the entry point in the program is or how to begin with even a simple hello world. Looking at the demos it APPEARS that ASM is the starting point and the C functions are inline and called from the asm which is the opposite of what i was intending :(

Are there any tutorials anywhere of how to begin a C program, inline the asm and just do basic step by step things starting with a hello world and working up to loading and blitting a graphic? Because that would be awesome.

Thanks x

nogginthenog 08 March 2016 19:38

I don't recommend inlining as it will get messy fast. Create separate .c & .s files and link them together.
It's easy to call assembler from c.

Code:

        XDEF    _myfunc
_myfunc:
        ; do stuff
        RTS

Code:

extern void myfunc();
int main()
{
  myfunc();
}

C normally passes parameters on the stack which is not optimal.
However, all Amiga C compilers support passing via registers (syntax is different for each compiler).

Sephnroth 08 March 2016 20:15

hey, thanks for taking the time to reply :)

Okay that seems simple enough and very sensible. The compiler this toolchain is using is GCC ftr :)


All times are GMT +2. The time now is 21:44.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.

Page generated in 0.08904 seconds with 11 queries