90

Bon, ça marche toujours pas sad

[...]
lea.l (a7),a5

pea.w NoCallBack(pc)
pea.l (138)*$10000+(42)
movea.l DialogNew*4(a6),a0
jsr (a0)

move.w d0,d4 ;Sauvegarde l'adresse de la structure de la boîte dans d4.

pea.l (1)*$10000+(4)
pea Reader_version(pc)
pea.l (0)*$10000+(8)
clr.l -(a7)
move.w d4,-(a7)
movea.l DialogAdd*4(a6),a2
jsr (a2)

clr.l -(a7)
move.l #-1,d0
move.l d0,-(a7)
move.w d4,-(a7)
move.l DialogDo*4(a6),a0
jsr (a0)

lea.l (a5),a7
[...]

Si je n'appelle pas DialogAdd (;jsr(a2)), l'execution de tout le reste du programme ne plante pas la calculatrice.
Si je n'appelle pas DialogDo (;jsr(a0) mais j'appelle DialogAdd), l'execution de tout le reste du programme ne plante pas la calculatrice.


Le problème viens de DialogAdd ou DialogDo.
Doc Tigcc:

***DialogAdd***

HANDLE DialogAdd (HANDLE Handle, short unknown, short x, short y, short ItemType, ...);

This function is open for anybody which knows more about dialogs than I know. What I also know is that legal ItemType values are: 2, 3, 7, 8, 10, 12 and 14. 2 is for adding request boxes, 7 for adding texts, 8 for adding titles, and 14 for adding pulldown menus.

***DialogDo***

short DialogDo (HANDLE Handle, short x, short y, char* RequestBuffer, short *PulldownBuffer);

Avec x = y = -1 pour centrer la fenêtre.

Quelqu'un peut il m'aider ??
Watcha @ka JBJ @ka @ngelfire

ICQ: 109631918

91

#define DialogAddTitle(h,t,l,r)    DialogAdd(h,0,0,0,8,(char*)(t),(short)(l),(short)(r))

pea.l (1)*$10000+(4)
pea Reader_version(pc)
pea.l $80000
clr.l -(a7)
move.w d4,-(a7)
movea.l DialogAdd*4(a6),a2
jsr (a2)
Cours et tutos Asm: http://membres.lycos.fr/sirryl

92

Ok, merci Paxal, je n'ai plus d"address error" mais d0 renvoit 0 et ma fenêtre est vide (un rectangle aux bords arrondis).
Watcha @ka JBJ @ka @ngelfire

ICQ: 109631918

93

Voilà un code qui (je pense) devrait marcher, mais qui ne fais rien que d'afficher une fenêtre totalement vide.
             include "Os.h"              xdef _nostub              xdef _ti92plus              movem.l d3-d7/a2-a6,-(a7)              movea.l ($c8).w,a6                 lea.l (a7),a5                                  pea.w NoCallBack(pc)                        pea.l (138)*$10000+(57)                     movea.l DialogNew*4(a6),a0                   jsr (a0)                                    move.w d0,d4               ;              beq                                       pea blablabla(pc)       pea.l (8)*$10000+(0)       clr.l -(a7)       move.w d4,-(a7)       movea.l DialogAdd*4(a6),a2       jsr (a2)  ;      tst.w d0 ;     beq                   pea.l (1)*$10000+(4)       pea.l (11)*$10000+(0)       clr.l -(a7)       move.w d4,-(a7)       jsr (a2) ;      tst.w d0 ;     beq                         clr.l -(a7)                      move.l #-1,d0                    move.l d0,-(a7)                  move.w d4,-(a7)                  move.l DialogDo*4(a6),a0         jsr (a0)                            lea (a5),a7                                 movem.l (a7)+,d3-d7/a2-a6                 rts blablabla: dc.b "Hello you !!",0

Doc de Tigcc sur la fonction :

DialogAdd Function (ROM Call 0x33)

--------------------------------------------------------------------------------
dialogs.h

HANDLE DialogAdd (HANDLE Handle, short unknown, short x, short y, short ItemType, ...);


Adds an item into a dialog box.

DialogAdd is an universal item-adding function. It is a very complicated function which accepts from 7 to 12 parameters depending of the type of the item which will be added (the type is determined by parameter ItemType). In fact, functions like DialogAddText, DialogAddTitle, DialogAddRequest and DialogAddPulldown are implemented as macros which calls DialogAdd function with appropriate parameters (for easier usage), so you can mainly avoid this function (you can read dialogs.h file to see how exactly these macros are implemented). However, this function has so many parameters that I didn't discover all the variants, so existence of this function would allow possibilities not covered with functions like DialogAddText. At the moment, I still don't know how to create a dialog with function keys (like "MODE" and "VAR-LINK" dialogs), nor a dialog with scrolling items (like "UNITS" dialogs). DialogAdd returns H_NULL if ItemType is wrong.

This function is open for anybody which knows more about dialogs than I know. What I also know is that legal ItemType values are: 2, 3, 7, 8, 10, 12 and 14. 2 is for adding request boxes, 7 for adding texts, 8 for adding titles, and 14 for adding pulldown menus. 10 and 12 are also related with request boxes and pulldown menus, but required extra parameters are somewhat different. It seems that 11 was planed for adding function keys, but not implemented, so it is very questionable whether function key menus can be added to dialogs using DialogAdd. DialogAdd with ItemType equal to 3 is the general dialog setup command, but it needs 12 parameters and I still haven't had any success in discovering them exactly. This command (with ItemType set to 3) is the key for creating dialogs with scrolling items. Any info is welcomed.


---------------------------------------------------------------------------------------
Bon, je crois que je vais faire une fenêtre moi même car ça m'énerve
triso
Watcha @ka JBJ @ka @ngelfire

ICQ: 109631918

94

Ty n'as meme pas un titre?
Cours et tutos Asm: http://membres.lycos.fr/sirryl

95

Comment ça ??
Si tu parle de ce qu'il y a au dessus, c'est juste un exemple que j'aimerais bien voir fonctionner normalement.
Watcha @ka JBJ @ka @ngelfire

ICQ: 109631918

96

Voilà un exemple tiré de mes sources
     ;Création du Dialogue      pea          NoCallBack0(PC)      clr.l          -(a7)      ROM_CALL     DialogNew      addq.l          #8,a7      move.w          d0,d7      beq          AbortMemory      ;Titre      move.w          #4,-(a7)      move.w          #1,-(a7)      pea          DialogTitleStr(PC)      move.w          #8,-(a7)      clr.w          -(a7)      clr.w          -(a7)      clr.w          -(a7)      move.w          d7,-(a7)      ROM_CALL     DialogAdd      lea          18(a7),a7      ;Request      move.w          #20,-(a7)      move.w          #254,-(a7)      clr.w          -(a7)      pea          RequestStr(PC)      move.w          #2,-(a7)      move.w          #38,-(a7)      move.w          #8,-(a7)      clr.w          -(a7)      move.w          d7,-(a7)      ROM_CALL     DialogAdd      lea          20(a7),a7 ExecDialog:     ;Execution      pea          OptionBuffer(PC)      pea          Buffer(PC)      move.w          #-1,-(a7)      move.w          #-1,-(a7)      move.w          d7,-(a7)      ROM_CALL     DialogDo      lea          14(a7),a7      cmp.w          #$108,d0      beq          QuitNouveauHandle      tst.b          Buffer      beq          ExecDialog
Cours et tutos Asm: http://membres.lycos.fr/sirryl

97

Paxal >> pourait tu s'il te plait, me mailer (jb.j@voila.fr) une source complète qui marche car j'obtient toujours un magnifique adresse error.
Watcha @ka JBJ @ka @ngelfire

ICQ: 109631918

98

C'est fait
Cours et tutos Asm: http://membres.lycos.fr/sirryl

99

Merci Paxal top
Watcha @ka JBJ @ka @ngelfire

ICQ: 109631918

100

Comment placer un 'NULL' sur la pile ?? (car pea 0 ne marche pas)
Watcha @ka JBJ @ka @ngelfire

ICQ: 109631918

101

Watcha
a écrit : Comment placer un 'NULL' sur la pile ??

clr.l -(a7)
(car pea 0 ne marche pas)

?!
C'est censé marcher!
Quel assembleur utilises-tu? A68k (source .asm) ou GNU as (source .s)?
Et quelle version de TIGCC?
avatar
Mes news pour calculatrices TI: Ti-Gen
Mes projets PC pour calculatrices TI: TIGCC, CalcForge (CalcForgeLP, Emu-TIGCC)
Mes chans IRC: #tigcc et #inspired sur irc.freequest.net (UTF-8)

Liberté, Égalité, Fraternité

102

Voici mon code :

[...]
pea NULL(pc)
pea NULL(pc)
move.l #-1,-(a7)
move.w d4,-(a7)
move.l DialogDo*4(a6),a0
jsr (a0)
lea 14(a7),a7
[...]
NULL: dc.b 0
[...]

Si je remplace les deux pea NULL(pc) par clr.l -(a7), j'obtient un magnifique ERROR_Throw. Et c'est de là que viens le problème que j'ai depuis que je parle de fenêtre dans ce topic.

J'utilise TIGCC 0.94b18 pour windows et je teste sous Vti rom89 2.05.
Watcha @ka JBJ @ka @ngelfire

ICQ: 109631918

103

Comment détecter une v200?
Les codes des touches du clavier sont ils identiques?
Comment déclarer une variable (équivalent de "short var1") interne au programme?
Qui veut bien m'acheter une v200?
Watcha @ka JBJ @ka @ngelfire

ICQ: 109631918

104

Watcha a écrit :
Voici mon code :

[...]
pea NULL(pc)
pea NULL(pc)
move.l #-1,-(a7)
move.w d4,-(a7)
move.l DialogDo*4(a6),a0
jsr (a0)
lea 14(a7),a7
[...]
NULL: dc.b 0 [...]

C'est faux. Là tu passes un pointeur vers un octet nul, pas un pointeur nul.
Si je remplace les deux pea NULL(pc) par clr.l -(a7), j'obtient un magnifique ERROR_Throw.

As-tu bien mis deux clr.l -(a7)?

 clr.l -(a7)
 clr.l -(a7)
 pea.l -1 ;plus court que move.l #-1,-(a7) parce que -1 tient en un word
 move.w d4,-(a7)
 move.l DialogDo*4(a6),a0
 jsr (a0)
 lea 14(a7),a7

Watcha
a écrit : Comment détecter une v200?

| Get the address of the jump table (needed a few times).
	move.l 0xC8,%a0
	/* Calculator Detection */
| At first, assume TI-92 Plus.
| It takes less space to write the values into %d0 first and then check whether they are correct.
	moveq #1,%d0
| Move the address of the jump table to %d1.
	move.l %a0,%d1
	and.l #0x400000,%d1
| Now %d1 is 0 on a TI-89 or V200, or 0x400000 on a TI-92+.
	jbne __calc_in_d0__
| Otherwise, assume TI-89.
	clr.w %d0
| Get the address of the ScrRect variable into a1.
	move.l (%a0,0x2F*4),%a1 /* ScrRect */
| If ScrRect+2 (x2) is less than 200, it is a TI-89.
	cmp.b #200,2(%a1)
	jblt __calc_in_d0__
| Otherwise, it is a V200.
	moveq #3,%d0
__calc_in_d0__:

(C'est de l'assembleur GNU, à toi de le convertir en assembleur A68k.)
Si d0 vaut 3 après ça, c'est une V200.
Les codes des touches du clavier sont ils identiques?

Identiques à la TI-92+. Les codes sur TI-89 sont différents.
Comment déclarer une variable (équivalent de "short var1") interne au programme?

Il y a plusieurs solutions:
1. variable globale ou statique:
var1: dc.w 0
2. variable locale sur la pile:
clr.w -(a7)
3. variable gardée dans un registre
clr.w d7
avatar
Mes news pour calculatrices TI: Ti-Gen
Mes projets PC pour calculatrices TI: TIGCC, CalcForge (CalcForgeLP, Emu-TIGCC)
Mes chans IRC: #tigcc et #inspired sur irc.freequest.net (UTF-8)

Liberté, Égalité, Fraternité

105

Merci Kevin

(J'ai du formatter mon PC et je n'ai plus mon ancien login donc JBJ <=> Watcha)
JBJ @ka Watcha @ka @ngelfire

Mon e-mail : jb.j@voila.fr

106

As-tu bien mis deux clr.l -(a7)?


En effet , clr.l -(a7) deux fois marche très bien. Dans ma petite tête qui est en train de découvrir l'assembleur, je voyait "pea bla(pc)" comme un word sur la pile, ce qui n'est pas le cas.
C'est faux. Là tu passes un pointeur vers un octet nul, pas un pointeur nul.


Qu'est ce qui est faux, ma phrase ou mon code ? Car il marche très bien.
JBJ @ka Watcha @ka @ngelfire

Mon e-mail : jb.j@voila.fr

107

JBJ
a écrit : Qu'est ce qui est faux, ma phrase ou mon code ? Car il marche très bien.

Le pea NULL(pc) était faux.
avatar
Mes news pour calculatrices TI: Ti-Gen
Mes projets PC pour calculatrices TI: TIGCC, CalcForge (CalcForgeLP, Emu-TIGCC)
Mes chans IRC: #tigcc et #inspired sur irc.freequest.net (UTF-8)

Liberté, Égalité, Fraternité

108

J'ai un problème bizarre :

J'ai 00000000 dans D0
J'ai 00500000 dans D1

Je fais "bne blabla", et mon programme continu comme si je n'avais pas fais de test. Pourquoi ne va t-il pas au label blabla ???
Watcha @ka JBJ @ka @ngelfire

ICQ: 109631918

109

As-tu bien mis un cmp.l d0,d1 devant?
Et bien un cmp.l, pas .w ou .b? Parce que les parties .w ou .b sont les mêmes!
avatar
Mes news pour calculatrices TI: Ti-Gen
Mes projets PC pour calculatrices TI: TIGCC, CalcForge (CalcForgeLP, Emu-TIGCC)
Mes chans IRC: #tigcc et #inspired sur irc.freequest.net (UTF-8)

Liberté, Égalité, Fraternité

110

Merci kevin, j'ai compris mon erreur, en fait je croyais (gol) que les Bcc comparait directement D0 et D1. Je viens de faire un grand pas en avant avec cette question et je comprend pourquoi certain de mes algos ne fonctionnent pas. Merci

(yAro, ton forum bug sous IE6 (erreur, debogage...), c'est très chiant)
Watcha @ka JBJ @ka @ngelfire

ICQ: 109631918

111

Comment faire pour récuperer l'extension des fichier sans utiliser les romcalls d'ams 2.xx ?? Merci de me donner au moins une indication, je me débrouillerai.
Watcha @ka JBJ @ka @ngelfire

ICQ: 109631918

112

Utilise les ROM_CALLs SymFindPtr pour trouver ton fichier, puis HeapDeref pour déréférencer son handle, puis HToESI pour lire l'extension.

113

Merci beaucoup, je me lance de ce pas dans le codage top
Watcha @ka JBJ @ka @ngelfire

ICQ: 109631918

114

Lis bien la doc de tigcc à propos de ces fonctions, c'est très intéressant.

115

Mais c'est chiant a utiliser smile
Watcha @ka JBJ @ka @ngelfire

ICQ: 109631918

116

jackiechan
a écrit : puis HeapDeref pour déréférencer son handle, puis HToESI pour lire l'extension.

HToESI s'utilise à la place de HeapDeref, pas à la suite.
avatar
Mes news pour calculatrices TI: Ti-Gen
Mes projets PC pour calculatrices TI: TIGCC, CalcForge (CalcForgeLP, Emu-TIGCC)
Mes chans IRC: #tigcc et #inspired sur irc.freequest.net (UTF-8)

Liberté, Égalité, Fraternité

117

Merci Kevin, ça doit être pour ça que je n'arrive a rien. A quoi ça sert, concretement, de déférencer une handle ?
Watcha @ka JBJ @ka @ngelfire

ICQ: 109631918

118

Pour avoir l'adresse à la place du numéro.
avatar
Mes news pour calculatrices TI: Ti-Gen
Mes projets PC pour calculatrices TI: TIGCC, CalcForge (CalcForgeLP, Emu-TIGCC)
Mes chans IRC: #tigcc et #inspired sur irc.freequest.net (UTF-8)

Liberté, Égalité, Fraternité

119

// C Source File // Created 20/02/2002; 14:25:17 // Kbdprgm8 by JBJ // Menu pour les jeux #define NO_EXIT_SUPPORT #define NO_CALC_DETECT #define NO_AMS_CHECK #define USE_TI89 #define OPTIMIZE_ROM_CALLS #define EXECUTE_IN_GHOST_SPACE #define fatal(s) ({ST_showHelp(s);return;}) #define Draw1(arg) {DrawStrXY(58,i+13,"Bomber Man",arg);} #define Draw2(arg) {DrawStrXY(56,i+21,"Bomber Maze",arg);} #define Draw3(arg) {DrawStrXY(69,i+29,"Kalah",arg);} #define Draw4(arg) {DrawStrXY(69,i+37,"Tetris",arg);} #define Draw5(arg) {DrawStrXY(65,i+45,"Ti-Chess",arg);} #include <tigcclib.h>         short x1,x2,y1,y2,i,key,chx,max,prev;   char *fptr, *cptr;   unsigned short plen;   HANDLE h; void _main(void) { //<---------------- Section graphique ------------------->//     x1=50;     y1=18;     max=5;     LCD_BUFFER buffer;     LCD_save (buffer);     GrayOn();     ClrScr();     LCD_restore (buffer);     FontSetSys(F_4x6);     x2=159-x1;     y2=98-y1;     for(i=y1+8;i<y2-7;i++)     {          DrawClipLine(MakeWinRect(x1+1,i,x2-1,i),ScrRect,A_REVERSE);     }        DrawClipRect(MakeWinRect(x1,y1,x2,y2),ScrRect,A_NORMAL|B_ROUNDED);        x1=x1+6;        x2=x2-6;        i=y1;     do     {          y1=y1+1;          if(y1==i+9){y1=y2-8;}          if(y1==i+2){x1=x1-2;x2=x2+2;}              if(y1==i+3||y1==i+4||y1==i+6){x1=x1-1;x2=x2+1;}              if(y1==y2-5||y1==y2-3||y1==y2-2){x1=x1+1;x2=x2-1;}          if(y1==y2-1){x1=x1+2;x2=x2-2;}          DrawClipLine(MakeWinRect(x1,y1,x2,y1),ScrRect,A_NORMAL);        }while(y1!=y2);     DrawStrXY(61,y2-6,"JBJ © 2002",A_REVERSE);     DrawStrXY(71,i+2,"Jeux",A_REVERSE);     Draw1(A_NORMAL);     Draw2(A_NORMAL);     Draw3(A_NORMAL);     Draw4(A_NORMAL);     Draw5(A_NORMAL);     SetPlane(LIGHT_PLANE);     x1=x1-6;     x2=x2+6;     y1=i;     DrawClipRect(MakeWinRect(x1,y1,x2,y2),ScrRect,A_NORMAL|B_ROUNDED);     x1=x1+6;     x2=x2-6;     do     {          y1=y1+1;          if(y1==i+9){y1=y2-8;}          if(y1==i+2){x1=x1-2;x2=x2+2;}          if(y1==i+3||y1==i+4||y1==i+6){x1=x1-1;x2=x2+1;}          if(y1==y2-5||y1==y2-3||y1==y2-2){x1=x1+1;x2=x2-1;}          if(y1==y2-1){x1=x1+2;x2=x2-2;}          DrawClipLine(MakeWinRect(x1,y1,x2,y1),ScrRect,A_NORMAL);        }while(y1!=y2);     DrawStrXY(61,y2-6,"JBJ © 2002",A_REVERSE);     Draw1(A_NORMAL);     DrawStrXY(71,i+2,"Jeux",A_REVERSE);     chx=1;     do     {          key = ngetchx();          prev = chx;          switch(key)          {                case 340:                                    if(chx!=max){chx=chx+1;}                                     else chx=1;                break;                case 337:                                     if(chx!=1){chx=chx-1;}                                     else chx=max;                break;                case 13: //<--------------- Section execution ---------------->//                                     GrayOff();                                 LCD_restore (buffer);                                 if(chx==1)                                 {                                                   SYM_ENTRY *SymPtr=DerefSym(SymFind(SYMSTR("eqw")));                                                   if(!SymPtr) fatal("program not found");                                                   if(HeapGetLock(h))                     {                        cptr=fptr=HeapDeref(h);                                                   h=0;                                             }                                                else                                             {                                                cptr=fptr=HLock(h);                                             }                                                   plen=*(short*)(cptr)+3;                                                if(SymPtr->flags.bits.archived)                                             {                                                if(!(cptr=malloc(plen)))                        {                                                   if(h) HeapUnlock(h);                                                   fatal ("Out of memory");                                                }                                                   memcpy(cptr,fptr,plen);                                             }                                                   EX_patch(cptr+0x40002,cptr+plen+0x3FFFE);                                                ASM_call(cptr+0x40002);                                                if(h) HeapUnlock(h);                                                if(cptr!=fptr) free(cptr);                                 }                                    return; //<-------------- Section graphique et fin de programme ------------->//                break;             }           if(prev==1){Draw1(A_XOR);}       if(prev==2){Draw2(A_XOR);}          if(prev==3){Draw3(A_XOR);}       if(prev==4){Draw4(A_XOR);}       if(prev==5){Draw5(A_XOR);}       if(chx==1){Draw1(A_NORMAL);}       if(chx==2){Draw2(A_NORMAL);}       if(chx==3){Draw3(A_NORMAL);}       if(chx==4){Draw4(A_NORMAL);}       if(chx==5){Draw5(A_NORMAL);}     }while(key!=264);     GrayOff();     LCD_restore (buffer); }
Watcha @ka JBJ @ka @ngelfire

ICQ: 109631918

120

Je vois déjà ça:
if(!(cptr=malloc(plen)))
...
if(cptr!=fptr) free(cptr);

Si tu veux pouvoir lancer des programmes pour kernel, ça ne va pas aller.

Voilà ce qu'il y a dans ttstart.c:
        // NOTE: we don't use malloc, but the low level routines
        //       otherwise compressed kernel-dependent progs will crash
        if (!(uncomp_h=HeapAllocHigh(length))) {
            if (h) HeapUnlock(h);
            fatal("out of memory")
        }

        dest = HeapDeref(uncomp_h);

...
if (src!=dest) HeapFree(uncomp_h);

avatar
Mes news pour calculatrices TI: Ti-Gen
Mes projets PC pour calculatrices TI: TIGCC, CalcForge (CalcForgeLP, Emu-TIGCC)
Mes chans IRC: #tigcc et #inspired sur irc.freequest.net (UTF-8)

Liberté, Égalité, Fraternité