cc65: How to get assembly _main called by BASIC starter?

You need an actual VIC.

Moderator: Moderators

Post Reply
User avatar
pixel
Vic 20 Scientist
Posts: 1359
Joined: Fri Feb 28, 2014 3:56 am
Website: http://hugbox.org/
Location: Berlin, Germany
Occupation: Pan–galactic shaman

cc65: How to get assembly _main called by BASIC starter?

Post by pixel »

Have defined "_main" and exported it but instead __MAIN_START__ is getting called. Anyone an idea what's wrong? Thanks a lot in advance.
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
groepaz
Vic 20 Scientist
Posts: 1188
Joined: Wed Aug 25, 2010 5:30 pm

Re: cc65: How to get assembly _main called by BASIC starter?

Post by groepaz »

What you need to do is creating a linker config for assembly, look at the C64 config: https://github.com/cc65/cc65/blob/maste ... 64-asm.cfg ... copy this to vic20-asm.cfg and adjust the memory addresses. now you link the program like described (for C64) here: https://cc65.github.io/doc/c64.html#ss4.2 (and once you made it work, please submit the linker config and updated docs to cc65 repo)
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
pixel
Vic 20 Scientist
Posts: 1359
Joined: Fri Feb 28, 2014 3:56 am
Website: http://hugbox.org/
Location: Berlin, Germany
Occupation: Pan–galactic shaman

Re: cc65: How to get assembly _main called by BASIC starter?

Post by pixel »

groepaz wrote: Fri May 29, 2020 3:53 am What you need to do is creating a linker config for assembly, look at the C64 config: https://github.com/cc65/cc65/blob/maste ... 64-asm.cfg ... copy this to vic20-asm.cfg and adjust the memory addresses. now you link the program like described (for C64) here: https://cc65.github.io/doc/c64.html#ss4.2 (and once you made it work, please submit the linker config and updated docs to cc65 repo)
Thanks man, but I really need to know the trick to getting _main called.
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
groepaz
Vic 20 Scientist
Posts: 1188
Joined: Wed Aug 25, 2010 5:30 pm

Re: cc65: How to get assembly _main called by BASIC starter?

Post by groepaz »

there is no trick :) you'll have to post all of your non working code (including the exact commands used to build it) in order to find out whats wrong.

mind you, if you are not using C, then using the default linker config and _main as entry point is probably not what you want - since a lot of unnecessary things will happen, and you'll have to link library stuff that you probably dont need.

("__MAIN_START__" shouldnt ever get "called" btw, its not a code entry point at all - when that really happens its an indication of something else being wrong in your setup)
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
pixel
Vic 20 Scientist
Posts: 1359
Joined: Fri Feb 28, 2014 3:56 am
Website: http://hugbox.org/
Location: Berlin, Germany
Occupation: Pan–galactic shaman

Re: cc65: How to get assembly _main called by BASIC starter?

Post by pixel »

Here it is. https://github.com/SvenMichaelKlose/ing ... tifs-wedge

Went into Terminator mode trying to contribute once too often.
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
groepaz
Vic 20 Scientist
Posts: 1188
Joined: Wed Aug 25, 2010 5:30 pm

Re: cc65: How to get assembly _main called by BASIC starter?

Post by groepaz »

the problem is that you are only linking to vic20.lib... you either must link to the crt0.o explicitly, or use .forceimport __STARTUP__ (which will pull in the crt0.o) in the asm file (or really...anywhere).
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
groepaz
Vic 20 Scientist
Posts: 1188
Joined: Wed Aug 25, 2010 5:30 pm

Re: cc65: How to get assembly _main called by BASIC starter?

Post by groepaz »

Did it work? :)
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
pixel
Vic 20 Scientist
Posts: 1359
Joined: Fri Feb 28, 2014 3:56 am
Website: http://hugbox.org/
Location: Berlin, Germany
Occupation: Pan–galactic shaman

Re: cc65: How to get assembly _main called by BASIC starter?

Post by pixel »

groepaz wrote: Mon Jun 22, 2020 7:29 am Did it work? :)
Yep! Just tried with "forceimport". Thanks! :)
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
Post Reply