1

I would like to use idle in a grayscale game
there is a loop in my code which waits for the AI1 to trigger in order to synchronize every frame (i think this loop takes 50% of each frame's time)
I tried this :

while(AI1_Counter < 5)
idle();
AI1_counter = 0;


But as it's writtem in tigcc help, it interfers with the grayscales until I press a key
After that, it works fine

Is there a way to prevent idle from interfering with graycales ?
or do you have any idea to reduce the power consumption in this loop ?
avatar

2

you should use the pokeIO function. I think Kevin has already gave the solution in the forum.

In some of my source files, I have that : you should verify it is correct :
pokeIO(0x600005,0b10111)

3

yes it is that:

//set the calc in low-power-mode (wakes cpu only up for grayscale, keypress, amstimer, clock)
pokeIO(0x600005, 0b10111);

4

Here are some precisions (taken from j89hw.txt) :
$600005 -W Turn off OSC1 (and the CPU), wake on int level 6 (ON key) and ...
:7-5 -
:4 ... int level 5 (programmable timer)
:3 ... int level 4 (link)
:2 ... int level 3 (OSC2/2^19)
:1 ... int level 2 (keyboard)
:0 ... int level 1 (OSC2/2^11)
Note: Make SURE int level 6 is acknowledged before writing $00 to this port...
Grayscales use the AI1, and AMS >= 2.07 uses the AI3 for the clock, and your program uses the AI5, so you should write 0b00010101. The code posted below waked up on AI2 too. I don't know if it's important or not...
avatar« Quand le dernier arbre sera abattu, la dernière rivière empoisonnée, le dernier poisson capturé, alors vous découvrirez que l'argent ne se mange pas. »

5

Allright, I'll try that

but does the calculator fall asleep just after this instruction, or is there a small delay (as in _rowread) ?
avatar

6

I don't know, try to put some code just after the move.b #%10101,$60005 (something like move.w #$FFFF,$4C00).
avatar« Quand le dernier arbre sera abattu, la dernière rivière empoisonnée, le dernier poisson capturé, alors vous découvrirez que l'argent ne se mange pas. »

7

but it will be executed when the AI1 triggers
I will try something else
avatar

8

Yes try #%10 (it should wait until a keypress).

could post the result of the test please, I'm curious to know the anwser smile
avatar« Quand le dernier arbre sera abattu, la dernière rivière empoisonnée, le dernier poisson capturé, alors vous découvrirez que l'argent ne se mange pas. »

9

according to my tests, move.b #%0, $600005 stops instantly the calculator
avatar

10

Yes, only pressing "ON" will wake it up then. This is exactly as reported in hw89.txt, the bane of 68k programming. ./4 pretty much explains everything you need to know about this low-level "idling".

~d

11

If you are under Kernel Mode, kernel_idle(); does the job too.