bebbo / libnix

libnix (v4): a C link library for AmigaOS/m68k
15 stars 9 forks source link

TimeDelay incorrectly exits after AllocSignal() (libnix/sources/amiga/misc) #21

Closed DvdBoon closed 5 years ago

DvdBoon commented 5 years ago

When AllocSignal can alloc a signal and thus the return value is something between $1F and $10 on classic Amigas, the function exits. When used in a loop after a while all signals are used up and then the result of AlloSignal is -1 which will execute the rest of the function (findtask, opendevice, doio, etc)

Snippet from libamiga.a using objdump:

38: 4eae feb6 jsr AllocSignal(a6) 3c: 1540 0037 move.b d0,55(a2) 40: 6c6e bge.s b0 <_TimeDelay+0xa2> //<-This skips the rest of the function when =>0 and continues the function when -1 42: 93c9 suba.l a1,a1 44: 4eae feda jsr FindTask(a6)

DvdBoon commented 5 years ago

The C code itself seems correct as when compiled on PPC it works correctly. Maybe a compiler problem?

I hacked it on a byte level from bge to bmi and now the function works as it should.

bebbo commented 5 years ago

which version are you using?

        move.b d0,(55,a2)
        jlt .L6

(plus that code is not used with amiga-gcc - the old provided libamiga.a is used)

DvdBoon commented 5 years ago

Oh, I use the old libamiga.a then with version 6.5.0b 190303231118.

Then this lib needs replacement/recompilation

bebbo commented 5 years ago

the provided libamiga.a contains a fix now.