home *** CD-ROM | disk | FTP | other *** search
- include "DoorsOS.h" ; nÈcessaire pour tout programme DoorsOS
- include "graphlib.h" ; on utilisera graphlib
- include "userlib.h" ; et userlib
- xdef _main ; dÈfinition de _main
-
- xdef _ti89 ; compiler pour Ti89
- xdef _ti92plus ; et pour Ti92+
-
- ;**************************************************
- ; _main : le programme commence ici
- ;**************************************************
- _main:
-
- ; Affichage du menu et choix des options :
- ; On efface l'Ècran et on affiche trois chaÓnes de caractËres
- jsr graphlib::clr_scr
-
- WriteStr #0,#20,#4,f1
- WriteStr #0,#30,#4,f2
- WriteStr #0,#40,#4,f3
-
- ; Boucle de test de la touche
- loop:
- jsr userlib::idle_loop ; on rÈcupËre le code de la touche pressÈe
- cmp.w #268,d0 ; si la touche est F1
- beq F1
- cmp.w #269,d0 ; si la touche est F2
- beq F2
- cmp.w #270,d0 ; si la touche est F3
- beq ESC
- cmp.w #264,d0 ; ou si la touche est ESC
- beq ESC
- bra loop ; sinon, rÈ-attend l'appui d'une touche
-
-
- ;**************************************************
- ; [F1] ProtÈger la TI
- ;**************************************************
- F1:
- trap #4 ; eteindre la Ti
-
- bsr check_pass
-
- tst.w d0 ; le password entrÈ est-il correct ?
- bne F1 ; non -> on eteint la Ti
- rts ; sinon on quitte le programme avec un rts
-
- ;**************************************************
- ; [F2] Changer le password
- ;**************************************************
- F2: bsr check_pass
-
- tst.w d0 ; le password entrÈ est-il correct ?
- bne _main ; non -> on retourne au menu
-
- jsr graphlib::clr_scr
- lea enternew(pc),a0
- jsr graphlib::bigbox
-
- WriteStr #5,#20,#4,newpass
- moveq #10,d3 ; max char = 10
- moveq #5,d1 ; x = 5
- moveq #35,d2 ; y = 30
- jsr userlib::InputStr
-
- tst.w d0
- beq _main
-
- lea pass(pc),a1
- subq.w #1,d0
- \copy move.b (a0)+,(a1)+
- dbra d0,\copy
- clr.b (a1)
- bra _main
-
- ;**************************************************
- ; [F3] ou [ESC] : fin du programme
- ;**************************************************
- ESC:
- rts
-
- ;**************************************************
- ; CHECK_PASS
- ;**************************************************
- check_pass:
- movem.l d1-d7/a0-a6,-(a7)
-
- move.l $40078,old_ON
- move.l #ON_desactive,$40078
-
- jsr graphlib::clr_scr
- lea enterpass(pc),a0
- jsr graphlib::bigbox
-
- WriteStr #5,#20,#4,enterpass
- moveq #10,d3 ; max char = 10
- moveq #5,d1 ; x = 5
- moveq #35,d2 ; y = 30
- jsr userlib::InputStr
-
- tst.w d0
- beq \fail
-
- move.l a0,-(a7)
- pea pass(pc)
- jsr doorsos::strcmp
- addq.l #8,a7
- \fin
- move.l old_ON,$40078
-
- movem.l (a7)+,d1-d7/a0-a6
- rts
- \fail
- moveq #1,d0
- bra \fin
-
- ON_desactive:
- rte
-
- ;**************************************************
- ; Variables
- ;**************************************************
-
- old_ON dc.l 0
-
- pass dc.b "palmtops",0,0,0 ; 10 caracteres + le zero de fin
-
- newpass dc.b "Quel nouveau password ?",0
- enterpass dc.b "Entrez le password",0
- enternew dc.b "Entrez le nouveau password",0
-
- f1 dc.b "[F1] ProtÈger la TI",0
- f2 dc.b "[F2] Changer le password",0
- f3 dc.b "[F3] Quitter",0
-
-
- end
-