Jump to content
Jagware
Sign in to follow this  
SebRmv

Q&A about the Removers library

Recommended Posts

SebRmv    2

I intended to open a special thread on Jagware to answer possible questions about the Removers library.

As SCPCD suggested the same thing yesterday, let's do it!

 

In this thread, please post your questions/bug reports/...

 

I guess installation issues should be kept apart from this thread.

 

 

Share this post


Link to post
Share on other sites
SCPCD    0

I have two first questions about the Jag C library :

 

- is it possible to add specific initialisation/code before entering the "main" function ?

- can we "deinit" the library ?

=> desactivate GPU/DSP through a specific function ?

=> else how can we do make it properly ?

 

:)

 

Share this post


Link to post
Share on other sites
SebRmv    2

Two tricky questions from SCPCD to begin with.

 

- is it possible to add specific initialisation/code before entering the "main" function ?

 

Not really.

 

The first code to be executed is located in crt0.s (of jlibc).

As you can see, it perform basic initialisation and then jump to main function.

If I remember correctly, gcc insert some code in the main function to call

__main function before entering into main user code (this __main function is

located in start.c of jlibc... basically, it initialises the memory allocator)

 

If you need to perform some other steps of low-level initialisations,

the simpler is probably to write them in assembly and then call these functions

at the very beginning of the C main function.

I guess it is sufficient in most of the cases but maybe you were something

to a tricky scenario?

 

- can we "deinit" the library ?

=> desactivate GPU/DSP through a specific function ?

=> else how can we do make it properly ?

 

Why would one do that :P ?

No, you are right, this is something missing, clearly ;)

 

To stop GPU or DSP, the cleanest way is to write a small GPU/DSP routine

that stops the GPU (or DSP) and call this piece of code as a normal

GPU/DSP routine (ie copy it in GPU/DSP RAM and call it thanks to the

jump_gpu_subroutine / jump_dsp_subroutine functions)

I may consider add this functionnality in future versions of the library.

Share this post


Link to post
Share on other sites
SebRmv    2
Is any infos about installing Removers Lib C on a computer ? ( video , tutorial ? )

 

I wrote once a small article on the Removers'spip (in french)

It is far from being complete, but it may help ;)

 

More here:

http://removers.free.fr/spip/?92-je-veux-d...opper-sur-atari

Share this post


Link to post
Share on other sites
SCPCD    0
I guess it is sufficient in most of the cases but maybe you were something

to a tricky scenario?

In fact, it was because I would like to have a jump table before the main code to have the table at the same adresse for each compilation instead to make a copy at another location.

Why would one do that ?

:P

It's to launch another bjl type application with a cleared environement. :)

Ok I will do a code to stop the GPU/DSP.

 

I have another question :

do the GPU code started with the init_display_driver or is it running by default ?

(same question with the DSP).

 

 

 

Share this post


Link to post
Share on other sites
SebRmv    2
I have another question :

do the GPU code started with the init_display_driver or is it running by default ?

(same question with the DSP).

 

The GPU code start when init_display_driver is called.

Same applies for the DSP and init_sound_driver.

 

 

Share this post


Link to post
Share on other sites
SCPCD    0

another question about the sprite manager :

is it double buffered ?

or :

at wich time the OP list is updated ?

 

for example :

if we attach a new object, then wait vsync, is it present on the screen or is it at the next vsync that it will be display ?

 

Share this post


Link to post
Share on other sites
SebRmv    2
another question about the sprite manager :

is it double buffered ?

or :

at wich time the OP list is updated ?

 

for example :

if we attach a new object, then wait vsync, is it present on the screen or is it at the next vsync that it will be display ?

 

the OP list is double buffered

 

this means that it is at the second vsync that you can be sure this will be displayed

 

sometimes, I regret this choice of having double buffered the OP list

this is clearly not well suited for framebuffered games (eg Another World does not use this display manager)

but I fear this is the price to pay to draw lots of sprites

Share this post


Link to post
Share on other sites
SCPCD    0
the OP list is double buffered

 

this means that it is at the second vsync that you can be sure this will be displayed

ok :)

 

 

Another question :

if we use the scale of sprite, can the sprite manager compute the new position in X and Y of the sprite to be always centered on a point ?

or do we have to compute manually the position ? :)

 

Share this post


Link to post
Share on other sites
SebRmv    2
ok :)

 

 

Another question :

if we use the scale of sprite, can the sprite manager compute the new position in X and Y of the sprite to be always centered on a point ?

or do we have to compute manually the position ? :)

 

Yes, you can, if you use the "hotspot" mechanism.

Simply set the coordinates you want to consider as being the "centre" of the sprite with hotspot_x and hotspot_y (or is it hx, hy)

and enable the hotspot by setting the corresponding bit.

 

Otherwise, you'll have to compute that manually.

Share this post


Link to post
Share on other sites
SCPCD    0

Question about linking of C files :

 

global variable declaration in a C file are they added in the DATA section or in the BSS section ?

is malloc and memalign allocate memory into the BSS section ?

 

Share this post


Link to post
Share on other sites
SebRmv    2
Question about linking of C files :

 

global variable declaration in a C file are they added in the DATA section or in the BSS section ?

is malloc and memalign allocate memory into the BSS section ?

 

global variables are allocated in BSS

 

the heap (for malloc) is beginning at the end of the bss section

 

 

Share this post


Link to post
Share on other sites
SCPCD    0

If I would like to run some C code from the cartridge memory, what sort of things should I pay attention ?

 

Share this post


Link to post
Share on other sites
SebRmv    2
If I would like to run some C code from the cartridge memory, what sort of things should I pay attention ?

 

I would say nothing really special.

 

Of course, do not make write access to the DATA section (nor the TEXT section).

 

Regarding your previous question, actually this is not completely clear where global variables are allocated.

For sure, if they are not initialized in the C code, then they will go in BSS section (but remember that crt0 will erase the BSS section at the very beginning of the program)

Otherwise, I guess it's rather in the DATA section, so be careful with these!

Share this post


Link to post
Share on other sites
SCPCD    0

I have seen the "irq_handler vblQueue[VBL_QUEUE_SIZE]" and "set_timer" function, but how can we add some interrupts handler that is called when an interrupt occured from other possible interrupts source on INT1 ? (from Tom or Jerry for exemple)

 

Share this post


Link to post
Share on other sites
SebRmv    2
I have seen the "irq_handler vblQueue[VBL_QUEUE_SIZE]" and "set_timer" function, but how can we add some interrupts handler that is called when an interrupt occured from other possible interrupts source on INT1 ? (from Tom or Jerry for exemple)

 

Not yet possible, if I remember correctly :P

Share this post


Link to post
Share on other sites
ChrisTOS    0

A guide how to install the library would have been great!

 

Anyway, first of all I'd like to post a public thank you to Seb because he is very helpful.

 

Unfortunately Seb, my pc died shortly after our communication and anything I had done with it as well.

 

So now I am on my CT63.. Is it possible to use your library with it (gcc 4.4.2) or even better would it be possible to use it with another compiler (pure_c, ahcc)? If so how to setup a dev environment?

 

Also, how about c++? Will it work with that as well (this I guess is a more general question about C and C++).

 

Thanks

 

Share this post


Link to post
Share on other sites
SebRmv    2
A guide how to install the library would have been great!

 

:whistling:

 

Anyway, first of all I'd like to post a public thank you to Seb because he is very helpful.

 

Unfortunately Seb, my pc died shortly after our communication and anything I had done with it as well.

 

So now I am on my CT63.. Is it possible to use your library with it (gcc 4.4.2) or even better would it be possible to use it with another compiler (pure_c, ahcc)? If so how to setup a dev environment?

 

Also, how about c++? Will it work with that as well (this I guess is a more general question about C and C++).

 

Thanks

 

Thanks for your kind support.

 

Just recall that my library is just a piece of code, so it can be interfaced with other piece of code, thanks to ALN.

The header files (.h files) just describes the interface of all the functions provided by my library in a C style.

Up to you programmers to understand them to use them through your favorite language (eg assembly, C, ot whatever).

(all that you need to know is the argument passing convention:

- everything is passed on stack

-integers are assumed to be 32 bits long

-and result is given back in d0

-d2-d7/a2-a7 are preserved but nothing is guaranteed for d0-d1/a0-a1 )

 

The keypoint is to use ALN to glue everything together in order to produce a Jaguar executable.

As long as you produce object files that can be understood by ALN, then "this is a bingo" ;)

 

So to answer your question, yes, I think it must be possible to use an Atari computer to program the Jaguar with my library.

(even if I don't know the exact setup :P)

 

About C++, I should investigate this one day. This could be convenient to have support also for this language (even if it might be too heavy for the poor 68k)

In particular, for C++, some runtime support (memory management and classes) has to be added. For sake of simplicity, I disabled C++ support in the cross gcc I distribute.

 

 

Share this post


Link to post
Share on other sites
Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoticons maximum are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×