( Programme de veille surfaces. Version 1.00 du 27 Juin 2010. Ecrit par jpb.forth . ) DECIMAL ( Zone obligatoire d'echange: 0 --> adresse du programme de veille sur 4 octets 4 --> adresse des limites de la zone affichable sur 4 octets mise a jour par le systeme 8 --> adresse du programme de configuration des parametres sur 4 octets a 0 si pas de parametres 12 --> adresse du programme d'initialisation sur 4 octets a 0 si pas d'initialisation ) HERE 8 ALLOT CONSTANT INDX_VEILLE ( Zone facultative des parametres: definie selon les necessites du programme de veille ) HERE 14 2/ ALLOT CONSTANT ZONE_SURFACES -1 VARIABLE FIGURE ( Zone du programme de veille: l'adresse du debut du programme principal doit etre mise dans les 4 premiers octets de INDX_VEILLE ce programme est appele toutes les 25 ms en mode veille il ne doit avoir aucun parametre d'entree et de sortie ) : HORIZONTALE ( teinte,x0,y,x1 --> - ) PRIORITE DUP >R @ 32768 R@ ! >R >R >R >R >R INDX_VEILLE 4+ 2@ R> R> R> R> OVER TRACE_REC DROP R> R> ! ; : HORIZONTALE_BORDEE ( teinte,x0,y,x1,dx --> - ) >R 4 PICK 255 XOR 4 PICK R@ - 4 PICK OVER R@ + 4 PICK 6 PICK 4 PICK OVER R> + HORIZONTALE HORIZONTALE HORIZONTALE ; : PRGM_VEILLE ( - --> - ) ( teinte,xcentre,ycentre,xrayon,yrayon,figure,etat ) ZONE_SURFACES DUP >R @ R@ 2+ @ R@ 4+ @ R@ 6+ @ R@ 8+ @ R@ 10+ @ R@ 12+ @ OVER 0= IF DROP DROP DROP DROP DROP DROP DROP NPA ABS DUP -6 LSH >R 63 AND 4* 3+ NPA ABS INDX_VEILLE 4+ 2@ DUP >R 4+ @ 1+ R> @ DUP >R - /MOD SWAP R> + SWAP INDX_VEILLE 4+ 2@ DUP >R 6+ @ 1+ R> 2+ @ - DUP 4/ >R MOD INDX_VEILLE 4+ 2@ 2+ @ + NPA ABS R@ /MOD R@ MOD SWAP R@ 10 / + SWAP R> 10 / + FIGURE @ DUP 0< IF DROP R> 3 MOD 1+ ELSE R> DROP THEN 0 THEN ( teinte,xcentre,ycentre,xrayon,yrayon,figure,etat ) DUP IF DUP 4 PICK 1- > IF DROP 0 7 PICK 7 PICK 7 PICK 7 PICK 7 PICK 7 PICK 2 = IF 9 3 PICK DUP U* 3 PICK DUP U* */ 9+ SQRT 9 3 PICK DUP U* 5 PICK DUP U* */ 9+ SQRT >R ROT + SWAP R@ + DUP DUP R> - ELSE >R 3+ R> 3+ DUP DUP 3- THEN DO 7 PICK 1- ?DUP IF 1- IF OVER DUP U* I 4 PICK U* DUP 4 PICK DUP U* */ - SQRT ELSE OVER I OVER 4 PICK */ - THEN ELSE OVER THEN 6 PICK 255 XOR OVER NEGATE 7 PICK + 6 PICK I - 8 PICK 5 PICK + HORIZONTALE 6 PICK 255 XOR OVER NEGATE 7 PICK + 6 PICK I + 8 PICK 5 PICK + HORIZONTALE DROP LOOP DROP DROP DROP DROP DROP >R DROP 0 R> ELSE >R 6 PICK 6 PICK 6 PICK 6 PICK 6 PICK R> OVER OVER - 3 MIN OVER + DUP >R SWAP DO 6 PICK 1- ?DUP IF 1- IF OVER DUP U* I 4 PICK U* DUP 4 PICK DUP U* */ - SQRT 3 PICK 3+ DUP U* I 5 PICK 3+ U* DUP 5 PICK 3+ DUP U* */ - SQRT OVER - ELSE OVER I OVER 4 PICK */ - 9 4 PICK DUP U* 4 PICK DUP U* */ 9+ SQRT THEN ELSE OVER 3 THEN 7 PICK 3 PICK NEGATE 8 PICK + 7 PICK I - 9 PICK 6 PICK + 5 PICK HORIZONTALE_BORDEE 7 PICK 3 PICK NEGATE 8 PICK + 7 PICK I + 9 PICK 6 PICK + 5 PICK HORIZONTALE_BORDEE DROP DROP LOOP DROP DROP DROP DROP DROP R> THEN ELSE ( teinte,xcentre,ycentre,xrayon,yrayon,figure,etat ) 1+ 7 PICK 7 PICK DUP >R 6 PICK - 7 PICK R> 8 PICK + 6 PICK 2 = IF 9 9 PICK DUP U* 9 PICK DUP U* */ 9+ SQRT ELSE 3 THEN HORIZONTALE_BORDEE THEN R@ 12+ ! R@ 10+ ! R@ 8+ ! R@ 6+ ! R@ 4+ ! R@ 2+ ! R> ! ; FIND PRGM_VEILLE INDX_VEILLE 2! ( Zone facultative du programme d'initialisation: l'adresse du debut du programme principal doit etre mise dans les octets 12 a 15 de INDX_VEILLE ce programme est appele juste au debut d'entree en veille il ne doit avoir aucun parametre d'entree et de sortie ) " ./BINAIRES/surfaces.prm" STRING S_FICHIER : INIT_VEILLE ( - --> - ) S_FICHIER COUNT CHEMIN_CONCATENE ?DUP IF DUP >R -1 FOPEN R> MEMOIRE_LIBERE DROP 0> IF FIGURE 2 3 PICK FREAD DROP THEN FCLOSE DROP THEN ZONE_SURFACES 14 0 FILL ; FIND INIT_VEILLE INDX_VEILLE 12+ 2! ( Zone facultative du programme de configuration des parametres: l'adresse du debut du programme principal doit etre mise dans les octets 8 a 11 de INDX_VEILLE ce programme est appele en cas de demande de modification de parametres il ne doit avoir aucun parametre d'entree et de sortie ) FEN_STRING" S_TITRE_MENU_VEILLE FIGURES:" FIGURES:" FEN_STRING" S_MENU_VEILLE RECTANGLES LOSANGES ELLIPSES TOUTES" RIGHT-ANGLED RHOMBUSES ELLIPSES ALL" FEN: PRGM_CONFIG ( fen --> - ) 5 S_MENU_VEILLE S_TITRE_MENU_VEILLE 4 PICK FEN_DIALOGUE_CHOIX CASE 1 OF 1 ENDOF 2 OF 2 ENDOF 3 OF 3 ENDOF 4 OF -1 ENDOF 0 ENDCASE ?DUP IF FIGURE ! S_FICHIER COUNT CHEMIN_CONCATENE ?DUP IF DUP >R 0 FOPEN R> MEMOIRE_LIBERE DROP 0< NOT IF FIGURE 2 3 PICK FWRITE DROP THEN FCLOSE DROP THEN THEN DROP ; PRGM_CONFIG INDX_VEILLE 8+ 2! ( FIN ) ( Zone accueillant la somme du fichier pour validation. ) ( SOM_VEILLE 0000335705 )