Bonjour!

Alors voilà, comme vous le savez (ou peut être pas si vous avez pas lu les derniers messages), je travaille actuellement sur un éditeur de textes on-calc, principalement pour Ti 83 (que j'adapterai plus tard pour ti 83+).

Pour l'instant, je n'ai rien fait d'exceptionnel (il y a juste un menu (ce n'est pas moi qui ait codé la routine, je l'ai trouvé ici : http://www.cemetech.net/forum/viewtopic.php?t=1449&postdays=0&postorder=asc&start=80, elle a été postée par arriopolis, j'ai juste modifié 2-3 trucs pour l'adapter).
Sinon, la seule option disponible pour le moment c'est "Nouveau", ce qui vous permet de créer un nouveau fichier vide.
Dans le menu, j'affiche tous les fichiers dispo, triés par ordre alphabétique.

Voici un petit screen:

z9FR

Et le code (j'ai essayé de mettre les commentaires en anglais, je ne sais pas si c'est compréhensible du coup ^^):
#define venus .nolist #include "ti83.inc" .list #ifdef ion ;Si ion est compatible avec l'input sur ti83+ je le garderai #ifdef TI83P ;Pour l'instant, la version 83P n'est pas ok (je verrai à la fin) .org progstart-2 .db $bb,$6d #else .org progstart #endif ret jr nc,start .db "ZFILES",0 #endif #ifdef venus ;Pour pouvoir utiliser la routine d'input de l'OS vRandom equ $FE72 vFastCopy equ $FE75 .org $9329 .db $E7,"9_[V?",0 ; $E7, $39, $5F, $5B, $56, $3F, $00 #endif start: ;On vérifie que le prgm contenant les fichiers existe bien res doneprgm,(iy+doneflags) call _runindicoff ;Turn off run indicator call _clrlcdfull ;On copie son nom dans op1 call _zeroop1 ld hl,Prgm_liste ld de,8039h ;op1 ld bc,8 ldir ;On sauvegarde le Lbl dans la routine ld hl,READ_FILE ld (LBL_TO_GO),hl ;On teste son existance call _chkfindsym jr nc,PGRM_LISTE_EXIST CREATE_PRGM_LISTE: ;On créé le prgm ld hl,1 ;longueur du programme call _createprog ;Et on copie les infos (qu'il y a 0 fichiers en fait) inc de inc de xor a ld (de),a dec de dec de PGRM_LISTE_EXIST: ;Save the adress in ix (at the number of files) inc de inc de ld ixh,d ld ixl,e ld a,(de) ;Copy the first informations ld de,gbuf ld hl,INFO_MENU1 ld bc,INFO_MENU2 - INFO_MENU1 ldir ;Test if there is any file or a ld c,a jr nz,PGRM_LISTE_EXIST2 inc a PGRM_LISTE_EXIST2: ;Load the nb of files ld (de),a inc de inc a ld (de),a inc de ld a,5 ld (de),a inc de ;test again if there is any file and load them ld a,c or a ;Rappel: ;a = c = size ;hl = INFO_MENU2 ;b = 0 ;de = adress of menu's struct ;ix = adress of prgm call z,COPY_NO_FILE call nz,COPY_FILES ;Copy next info (new file) ld a,c ld hl,INFO_MENU3 ld bc,INFO_MENU4 - INFO_MENU3 ldir ;Then copy again the files if there is any or a call z,COPY_NO_FILE call nz,COPY_FILES ;And the lasts informations ld hl,INFO_MENU4 ld bc,FIN_INFO_MENU - INFO_MENU4 ldir push ix ;save it jp gbuf COPY_FILES: ld b,ixh ld h,b ld b,ixl ;load the adresse of prgm which contain the list of files ld l,b inc hl ld b,a ;load number of files COPY_FILES_loop: ;Load the byte ld a,(hl) ld (de),a inc de inc hl ;Test if end string or a jr nz,COPY_FILES_loop ;Copy Lbl at (de) (i think this code is optimizable...) push hl ld (TO_PUT_LBL_TO_GO),de LBL_TO_GO = $+1 ld hl,READ_FILE TO_PUT_LBL_TO_GO = $+1 ld (gbuf),hl inc de inc de pop hl ;copy all files djnz COPY_FILES_loop ;On change le lbl ld hl,EDIT_FILE ld (LBL_TO_GO),hl ret COPY_NO_FILE: ld hl,INFO_MENU2 ld bc,INFO_MENU3 - INFO_MENU2 ldir ret INFO_MENU1: CALL Menu .DB 3 ;Number of menus .DB "LIRE", 0 ;Title of menu1 .DB "EDIT", 0 ;Title of menu2 .DB "AUTRES", 0 ;Title of menu2 ;Nombre de fichiers ;Nombre de fichiers +1 ;.db 5 ;Noms des fichiers ;.dw READ_FILE ;A la fin de chaque noms INFO_MENU2: .db "No File",0 \ .dw gbuf INFO_MENU3: .db "Nouveau",0 \ .dw NEW_FILE ;Noms des fichiers ;.dw EDIT_FILE ;A la fin de chaque noms INFO_MENU4: .db "Envoyer",0 \ .dw CHOIX_ENVOI .db "Recevoir",0 \ .dw RECEIVE .db "Protection",0 \.dw PROTECT .db "Lier fichier",0 \.dw LIER_FICHIER .db "Supprimer",0 \.dw SUPR_FICHIER FIN_INFO_MENU: READ_FILE: push bc call _clrscrnfull call _homeup set appAutoScroll, (IY + appflags) pop hl pop ix ld h,0 jp _disphl prompt: .db "Nom: ",0 NEW_FILE: ;Ask for the name of file call _clrlcdfull call _clrtxtshd call _homeup ld de,821ch ;put the prompt here ld hl,prompt ld bc,6 ldir pop ix ;Input for the file's name xor a ld (asm_ind_call),a call pgmio_exec call _chkfindsym ret c ;Load the file's size ld a,(de) ld c,a inc de ld a,(de) ld b,a inc bc push bc ;amount of RAM ;### Test the size ### ;Some bugs with input: ;### Change the ')' 29h in ' ' 20h ;### Delete 2 bytes tokens (empty choice and bugs else...) inc de ld h,d ld l,e ld de,saferam2 push de ;the bytes to insert ldir ;Find the place of name's file (in the alphabetic order) pop hl push hl ld d,ixh ld e,ixl ld a,(de) ;The number of files ld b,a inc b dec b jr z,Have_Adress_Before_string push de ;Save the adress before string test_string: ;save the begun of string push hl dec hl test_char: ;Compare the chars inc hl inc de ld a,(de) cp (hl) jr z,test_char jp p,before_it ;Tes if the file's name is the begun of other (ex: new = SUITE / 4 = SUITES, so new must to be 4) xor a cp (hl) jr z,before_it ;Now we have to found the next string next_string: ld h,d ld l,e inc de cp (hl) jr nz,next_string ;Take the first byte of strings and test it dec de pop hl pop af push de ;Save the adress before string djnz test_string push hl before_it: ;Take the adress pop hl pop de Have_Adress_Before_string: ld a,b ;Save the nb of file inc de ;Take adress of bytes to insert (hl) and the amout (bc) pop hl pop bc push af ;Insert the bytes call Insert_bytes ret c ;Increment the nb of files inc (ix) ;Insert file's lengh pop bc ld c,b inc b dec b jr z,Insert_file_lengh ;Pass all the file's name Found_end_files_name_loop: inc de ld a,(de) or a jr nz,Found_end_files_name_loop djnz Found_end_files_name_loop ;Found the file's nb ld a,(ix) sub c ;Found the file's adress ld b,a ex de,hl Found_files_adress_loop: ld e,(hl) inc hl ld d,(hl) inc hl add hl,de djnz Found_files_adress_loop ;And insert the file (wich just contain the lenght (0) ) ex de,hl Insert_file_lengh: ld bc,2 call Insert_bytes ;And put the file's lenght xor a dec de ld (de),a dec de ld (de),a jp start ;re-load menu ;### go to edit this new file ### ;### Pb: test if we have the place for file's name AND file lenght BEFORE insert the name ### Insert_bytes: ;input: ; ix = adress of prgm (at the first bytes, not the size) ; bc = amount of RAM to insert into the variable ; de = the memory address where the RAM will be inserted ; hl = bytes to insert ;output: ; bytes are inserted ; hl = new size of prgm ; bc = amount of RAM to insert into the variable ; de = the memory address after where the RAM has been inserted ; ix = adress of prgm (at the first bytes), like in input ; carry set if not enought mem push bc push hl push de ;Ask for RAM ld h,b ld l,c call _enoughmem jp c,_errnotenoughmem ld h,d ld l,e pop de call _insertmem ;Load the bytes pop hl pop bc push bc ldir ;Load the prgm'size and add dec ix ld h,(ix) dec ix ld l,(ix) pop bc add hl,bc ;Load the new size ld (ix),l inc ix ld (ix),h inc ix ret ;### Mmhhh! Lot of routines to do! ^^ ### SUPR_FICHIER: EDIT_FILE: LIER_FICHIER: CHOIX_ENVOI: RECEIVE: PROTECT: jp QUIT Prgm_liste: .db 05h," ZFILES",0 ;######## ;Routines ;######## ;Thanks to arriopolis for this good routine! ;I have only modificate some instruction (quit option, and other) Menu: ;- Objective: Create a scrollable menu, with multiple titles possible. ;- INPUT: Data from codestream. ;- Variables: ; - Current menu selected = IXL ; - Current option selected = B ; - Number of menus = IXH ; - Number of options = C ; - Current option at first row = D RES appAutoScroll, (IY + appflags) POP HL ;Gain the baseaddress of the input data. LD C, 1 LD IXL, C ;IXL = Current menu selected. LD C, (HL) LD IXH, C ;IXH = Number of menus. INC HL LD (MenuTitleAddress), HL LD B, C CALL MenuSkipMenus ;B = Number of menus; becomes 0. LD (MenuNrOptionsAddress), HL ADD HL, BC ;B = 0, C = Number of menus, so BC = number of menus LD (MenuOptionsAddress), HL ;Now, HL is at the beginning of the optionslist. MenuDrawMenu: call _clrlcdfull call _homeup LD HL, (MenuTitleAddress) LD C, IXL ;Now C = Current menu selected. LD B, IXH ;Now B = Number of menus. LD A, 20h ;Now A = A space, to put inbetween the menus. MenuDrawMenuTitle: DEC C CALL NZ, textInverseOff CALL Z, textInverseOn call _puts ;Draw the title CALL textInverseOff call _putc ;Put a space inbetween DJNZ MenuDrawMenuTitle ;Do this "number of menus" times, B is left 0. ;Now to get the number of options etc. LD HL, (MenuOptionsAddress) LD C, IXL DEC C JR Z, MenuNoSkipMenu LD DE, (MenuNrOptionsAddress) MenuSkipMenu: LD A, (DE) LD B, A CALL MenuSkipOptions ;Makes sure B = 0 INC DE DEC C JR NZ, MenuSkipMenu MenuNoSkipMenu: LD (Temp), HL LD C, IXL DEC C LD HL, (MenuNrOptionsAddress) ADD HL, BC ;B = 0, so BC = C = Number of menus. LD C, (HL) ;C = Number of options. LD B, 1 ;D = Current option at first row LD D, B ;B = Current option selected MenuDrawText: LD HL, $0001 LD (currow), HL LD HL, (Temp) PUSH BC LD B, D ;Now B = Option at row 1. DEC B CALL NZ, MenuSkipOptions ;If row 1 is not 1, then skip the options before the one at row1. LD B, 7 LD E, D ;Start off with the option at row1. MenuDrawTextOptions: LD A, E CP C ;If there is no more option to write, abort. JR Z, MenuDrawTextOptionsCont JR NC, MenuDrawTextNoMore MenuDrawTextOptionsCont: LD A, 2 LD (curcol), A call _puts ;Wrtite em. MenuDrawTextOptionsSpaces: LD A, (curcol) OR A JR Z, MenuDrawTextOptionsSpacesEnd LD A, 20h call _putc JR MenuDrawTextOptionsSpaces MenuDrawTextOptionsSpacesEnd: INC E INC HL INC HL DJNZ MenuDrawTextOptions ;7 times. MenuDrawTextNoMore: POP BC MenuDrawOptions: LD HL, $0001 LD (currow), HL PUSH BC ;Save B and C temporarely, but copy B into E, because we want to use B again soon. LD E, B LD A, D ;Begin with the option at row1. LD B, 7 ;7 options to write max. MenuDrawOptionsLoop: PUSH AF ;Save AF for further use (A = current option drawn). PUSH AF CP E CALL Z, textInverseOn CALL NZ, textInverseOff ADD A, $30 ;Add the number of bytes to get to the correct symbols. CP $3A JR Z, MenuDrawOptionsZero JR C, MenuDrawOptionsLoopNumber ADD A, 6 ;6 to get to the lettersymbols. JR MenuDrawOptionsLoopNumber MenuDrawOptionsZero: LD A, l0 MenuDrawOptionsLoopNumber: call _putc POP AF CP D ;If TopOption = CurOption, then top option is being drawn. JR NZ, MenuDrawOptionsCont CP 1 ;If TopOption = CurOption = 1, no uparrow. JR Z, MenuDrawOptionsCont2 LD A, luparrow JR MenuDrawOptionsLoopCont MenuDrawOptionsCont: CP C ;If CurOption = Number of options JR Z, MenuDrawOptionsCont2 LD A, (currow) CP 7 JR NZ, MenuDrawOptionsCont2 LD A, ldownarrow JR MenuDrawOptionsLoopCont MenuDrawOptionsCont2 LD A,3Ah MenuDrawOptionsLoopCont: call _putc call _newline POP AF INC A CP C JR Z, MenuDrawOptionsLoopEnd JR NC, MenuDrawOptionsEnd MenuDrawOptionsLoopEnd: DJNZ MenuDrawOptionsLoop MenuDrawOptionsEnd: POP BC CALL textInverseOff MenuUserInput: LD E, C PUSH DE call _getkey POP DE LD C, E cp kannul jr nz,NOQUIT QUIT: pop ix res 4,(iy+9) ;res error On Break set appAutoScroll, (IY + appflags) call _clrscrnfull jp _homeup NOQUIT: cp kquitter jr z,QUIT CP kbas JR Z, MenuDown CP khaut JR Z, MenuUp CP kgauche JR Z, MenuLeft CP kdroite JP Z, MenuRight CP kenter JR Z, MenuEnter CP kxt0n JR NC, MenuUserInput SUB k0 JR C, MenuUserInput JR NZ, MenuUserInputNotZero LD A, 10 JR MenuUserInputNumber MenuUserInputNotZero: CP 10 JR C, MenuUserInputNumber DEC A MenuUserInputNumber: CP C JR Z, MenuUserInputNumberCont JR NC, MenuUserInput MenuUserInputNumberCont LD B, A MenuEnter: LD HL, (MenuOptionsAddress) PUSH BC LD B, IXL DEC B JR Z, MenuEnterSkipSkipLoop LD DE, (MenuNrOptionsAddress) LD C, 0 MenuEnterSkipLoop: LD A, (DE) ADD A, C LD C, A INC DE DJNZ MenuEnterSkipLoop LD B, C CALL MenuSkipOptions MenuEnterSkipSkipLoop: POP BC ld c,b CALL MenuSkipOptions DEC HL LD A, (HL) LD D, A DEC HL LD A, (HL) LD E, A EX DE, HL JP (HL) ;Exit routine. MenuDown: LD A, B CP C JR Z, MenuDownWrap INC B LD A, B SUB D CP 7 JP NZ, MenuDrawOptions INC D JP MenuDrawText MenuDownWrap: LD B, 1 LD D, B JP MenuDrawText MenuUp: LD A, B DEC A JR Z, MenuUpWrap LD A, B CP D PUSH AF DEC B POP AF JP NZ, MenuDrawOptions DEC D JP MenuDrawText MenuUpWrap: LD B, C LD A, C SUB 6 LD D, A JP NC, MenuDrawText LD D, 1 JP MenuDrawText MenuLeft: LD D, 1 LD B, 0 DEC IXL JR NZ, MenuLeftCont LD IXL, IXH MenuLeftCont: LD C, IXL DEC C LD HL, (MenuNrOptionsAddress) ADD HL, BC LD C, (HL) INC B JP MenuDrawMenu MenuRight: LD D, 1 LD B, 0 LD A, IXL CP IXH JR NZ, MenuRightCont LD IXL, 0 MenuRightCont: INC IXL LD C, IXL DEC C LD HL, (MenuNrOptionsAddress) ADD HL, BC LD C, (HL) INC B JP MenuDrawMenu textInverseOn: SET textInverse, (IY + textflags) RET textInverseOff: RES textInverse, (IY + textflags) RET MenuSkipOptions: LD A, (HL) INC HL OR A JR NZ, MenuSkipOptions INC HL INC HL ;Skip labelbytes. DJNZ MenuSkipOptions RET MenuSkipMenus: LD A, (HL) INC HL OR A JR NZ, MenuSkipMenus DJNZ MenuSkipMenus RET MenuTitleAddress: .DW 0 MenuNrOptionsAddress: .DW 0 MenuOptionsAddress: .DW 0 Temp: .DW 0 end_prgm: .echo "ZFILES: Prgm compiled, size is ",end_prgm - start," bytes" .end

Je vous le met en téléchargement avec le "ti83.inc" que j'utilise:
http://www.mediafire.com/download/22wvykr0p04vv30/ZFILES.zip

Si vous voyez des moyens d'optimiser ou des remarques à faire, n'hésitez pas!
Merci d'avance! smile
Cool, je vais regarder tout ça de suite smile
Une idée, quand tu veux éditer un programme tu peux insérer toute la RAM disponible dans la variable. Quand on ferme le programme, un peut _delMem la mémoire non utilisée.
C'est une bonne idée je crois que je vais faire comme ça! grin
Merci !