A.D.A. Amiga Demoscene Archive

        Welcome guest!




log in with SceneID


Demos Amiga Demoscene Archive Forum / Coding / fixing my startup code


Author Message
#1 - Posted: 5 Mar 2010 22:19 - Edited
Reply Quote
there was some talk about it before and I was thinking maybe it's time to fix my startup code a little bit.

So I think I should somehow set the priority to maximum / very high right? It probably doesn't make sense to switch off multitasking on 060.

How would I do that?

I don't use any includes and my init is basically this right now: (LOL)

lea vbirutku, a0
bsr SetVBI

move.l 4.w,a6
lea gfxlib,a1 ; "graphics.library"
jsr -408(a6) ;openlibrary
move.l d0,gfxbase
move.l d0,a6
move.l 34(a6), oldview
sub.l a1,a1
jsr -222(a6) ;loadview
jsr -270(a6) ;waittof
jsr -270(a6)

move.l #cop,$dff080 ; copperlist \o/

and another thing... I'm apparently not able to understand how to correctly init kalms' c2p routines.

for example:

when I have

extern __asm void c2p1x1_8_c5_040_init(register __d0 unsigned short chunkyx,
register __d1 unsigned short chunkyy,register __d3 unsigned short scroffsy,
register __d5 unsigned int bplsize);
extern __asm void c2p1x1_8_c5_040(register __a0 unsigned char *c2pscreen,
register __a1 unsigned char *bitplanes);

I call the init like this:

and then to make it work I call the c2p like this:

so I subtract the size of one bitplane from the actual bitplane address... And I did the same exact thing with a 4bpl one too.

or when I have

extern __asm void c2p_2rgb555_3rgb555h8_040_init(register __d0 unsigned short chunkyx
,register __d1 unsigned short chunkyy
,register __d2 unsigned short scroffsx
,register __d3 unsigned short scroffsy
,register __d4 unsigned int rowlen
,register __d5 unsigned int bplsize
,register __d6 unsigned int chunkylen);

extern __asm void c2p_2rgb555_3rgb555h8_040(register __a0 unsigned short *c2pscreen,
register __a1 unsigned char *bitplanes);

the init:
c2p_2rgb555_3rgb555h8_040_init(220,200,640,200,80 ,16000,440);

the c2p:
c2p_2rgb555_3rgb555h8_040(chunkyscreen,dest+32000 -80);

again, instead of just giving the actual bitplane address (dest). it does seem to work fine like that but...
what am i doing wrong? (It's probably something really silly :)

thank you :)
#2 - Posted: 6 Mar 2010 00:23 - Edited
Reply Quote
Setting the current task priority to 127:

move.l   4.w, a6
sub.l a1, a1
jsr -294(a6) ; FindTask(0)
move.l d0, a1
moveq #127, d0
jsr -300(a6) ; SetTaskPri(this, 127)

Did you try turning multitasking off? It should stop all other user processes from getting even a single time slice. I just save the old interrupt and DMA bits and disable everything. It's the usual way of going about it and you get the whole system.

This example by Piru hides away the AmigaOS in a super friendly way:
#3 - Posted: 6 Mar 2010 12:36
Reply Quote
thanks! I guess i'll be using that piece of code then. i didn't try turning off multitasking, but was thinking it's not really necessary. and maybe even not that nice? :) i dunno.
but I'm way past caring about the amiga os enough to want to be super friendly to it. :D (+ i'm still lazy and don't have any includes anyway)
#4 - Posted: 6 Mar 2010 13:08
Reply Quote
I adapted a "system killer" for my little framework that's essentially coded by StingRay and turned out
to be very decent and clean on every machine... be it a 500 or a high end 4000.

move.l $4.w,a6
jsr -132(a6) ; kill 'em all - forbid interupts
moveq #0,d0

lea libname(pc),a1 ;name for gfx.lib
jsr -$228(a6) ;LVO_OpenLibrary()
beq.w error
move.l d0,a6
move.l a6,gfxbase
move.l 34(a6),Actiview ; Get active viewport
sub.l a1,a1 ; Find current task
jsr -222(a6) ; LoadView()
jsr -270(a6) ; WaitTOF()
jsr -270(a6)

For the issue of task priority I thought always it would be nice to have _all_ the miggy's time available for
the demo. Since it's a non interactive thing that's running on the machine, one might as well forbid all the
#5 - Posted: 6 Mar 2010 16:07
Reply Quote
so killing the interrupts that way will restore everything back to normal automatically when the program closes or?

but then... anyone has a clue on that c2p init issue?

and one thing about the ham init. the +32000 is there on purpose to skip the control bitplanes. Although since It's a 5 (not 6) bitplane c2p it's maybe still off. or maybe not. But yeah mainly I have no clue why the -80 needs to be there. (length of one bitplane line in bytes)
#6 - Posted: 6 Mar 2010 16:50 - Edited
Reply Quote
so killing the interrupts that way will restore everything back to normal automatically when the program closes or?

Well, you've got to permit the other tasks again and restore the system copper list which was
put away for the duration.

I uploaded a startup/restore source to my site. Tested it with ASMone on the EMU.
It should work properly without any include requirements:

Get it here.
#7 - Posted: 6 Mar 2010 18:11
Reply Quote
i didn't try turning off multitasking, but was thinking it's not really necessary. and maybe even not that nice? :) i dunno.

How do you mean? Maybe I misunderstood you, but I thought that was exactly what you wanted to do - stop all other tasks from executing.

Multitasking on the Amiga is a concept only implemented in the AmigaOS, and calling Forbid doesn't change any hardware or CPU settings, it just tells the AmigaOS that it shouldn't pause your task and transfer control to another (this is how multitasking is achieved). If you start two processes with the same prio then reasonably the exec should give them the same amount of CPU time both, but maybe there's an exception to this when you set max prio.

Calling Enable/Disable will only turn the master interrupt enable bit in INTENA on and off, but it won't restore the other contents of the register or the interrupt vectors.
#8 - Posted: 6 Mar 2010 20:09
Reply Quote
I was thinking maybe there was something that someone would like to be running in the background anyway... No idea.

but now i just forbid ( jsr -132(a6) ) and permit ( jsr -138(a6) ) and that shall do it.
#9 - Posted: 7 Mar 2010 15:42
Reply Quote
Re c2p init:

scroffsx / scroffsy indicate where, within the target buffer, the upper-left corner of the output should be placed.

So if you want to perform a full buffer conversion you would do:



c2p_2rgb555_3rgb555h8_040_init(220,200,0,0,80 ,16000,440);
#10 - Posted: 7 Mar 2010 16:14 - Edited
Reply Quote
oh ok, hmmh, that does make sense. thanks :)

and then...

I last night started doing the vbcc thing instead of sas c + phxass. does someone know how to get floating point to work in it?
I have -fpu=68060 in the compiler parameters (CFLAGS) and m040 in LIBS. also tried the m882 lib and other fpus but no luck.


  Please log in to comment





A.D.A. Amiga Demoscene Archive, Version 3.0