sinon tu attends, un poil, en ce moment j'ecris une routine en asm equivalente à getKey
(en bocou + rapide) mais ça foire sur 89, faut que je verifie mon code
tiens voila la 1e ver de cette routine
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;PROG DE DEMO
;;
include "OS.h"
xdef _ti89
xdef _ti92plus
xdef _nostub
CALCULATOR equ 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; main routine ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
movem.l d3-d7/a2-a6,-(a7) ;on sauvegarde tt pour pas se faire chier
move.w #$0700,-(a7)
ROM_CALL OSSetSR
addq.l #2,a7
_loop:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; TEMP ;;
;on affiche le code de la touche pressée
and.b #$FD,$70001D
jsr _kb_getkey
move.w d0,d4
move.w d0,-(a7)
pea.l printstr
jsr printf
addq.l #6,a7
;on quitte si on presse esc (264)
cmp.w #264,d4
bne _loop
or.b #$2,$70001D
;; /TEMP ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
movem.l (a7)+,d3-d7/a2-a6 ;restauration des registres
rts
printstr:
dc.b "arf(:-p): %d, ",10,0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; READKEY ROUTINE BY jan²2
;; renvoie les mêmes codes que ngetchx()
;; 0 si aucune touche
;;
_kb_getkey
eor.l d0,d0 ;on clean d0: dans lequel sera stocké l'index
moveq.l #1,d2 ;valeur 1 (shift right 1) dans d2 pour accelerer
lea _kb_key_masks(PC),a0 ;on fait pointer a0 vers le tableau de masques
;detection de la calto(6 ou 7 rows)
tst.b CALCULATOR
beq _kb_calc92_row
move.l #5,_kb_numrows
add.l #6,a0
_kb_calc92_row
;boucle pour chaque row
; move.l _kb_numrows(PC),d3 ;compteur de row
move.l _kb_numrows,d3
_kb_getkey_loop_row
;recuperation de la row
move.w (a0),$600018 ;masque
lsr.l #6,d1
lsr.l #6,d1
move.b $60001B,d1 ;on recupere la row dans d1
addq.l #2,a0
;boucle pour chaque col
move.l #7,d4 ;compteur de col
_kb_getkey_loop_col
lsr.b d2,d1
bcc _kb_getkey_lastrow ;on quitte si detection d'une touche
add.l d2,d0 ;on incremente d0 (index)
dbra d4,_kb_getkey_loop_col ;fin de boucle
dbra d3,_kb_getkey_loop_row ;fin de boucle
;derniere rangée
_kb_getkey_lastrow
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; rangée 0
move.w #$FFFE,$600018 ;masque du bit 0
lsr.w #6,d1
lsr.w #6,d1
move.b $60001B,d1 ;on recupere la row
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;detection de la calto
eor.l d3,d3
tst.b CALCULATOR
beq _kb_calc92_retval
cmp.w #48,d0
bne _kb_calc89_endarrows
;lecture des flèches
lsr.b d2,d1
bcc _kb_calc89_endarrows ;on quitte si detection d'une touche
add.l d2,d0 ;on incremente d0 (index)
lsr.b d2,d1
bcc _kb_calc89_endarrows ;on quitte si detection d'une touche
add.l d2,d0 ;on incremente d0 (index)
lsr.b d2,d1
bcc _kb_calc89_endarrows ;on quitte si detection d'une touche
add.l d2,d0 ;on incremente d0 (index)
lsr.b d2,d1
bcc _kb_calc89_endarrows ;on quitte si detection d'une touche
;quitte avec 0 si aucune touche n'est pressée
moveq.w #0,d0
rts
_kb_calc89_endarrows
;lecture des stat keys
lsr.b d2,d1
bcc _kb_calc89_2nd
lsr.b d2,d1
bcc _kb_calc89_shift
lsr.b d2,d1
bcc _kb_calc89_diamond
lsr.b d2,d1
bcc _kb_calc89_alpha
lea _kb_key_data_89_normal,a0
bra _kb_return
_kb_calc89_shift
move.l d2,d3
_kb_calc89_alpha
lea _kb_key_data_89_alpha(PC),a0
bra _kb_return
_kb_calc89_2nd
lea _kb_key_data_89_2nd(PC),a0
bra _kb_return
_kb_calc89_diamond
lea _kb_key_data_89_diamond(PC),a0
bra _kb_return
_kb_calc92_retval
;lecture des stat keys
lsr.b d2,d1
bcc _kb_92P_V200_2nd
lsr.b d2,d1
bcc _kb_92P_V200_diamond
lsr.b d2,d1
bcc _kb_92P_V200_shift
lsr.b d2,d1
bcc _kb_92P_V200_lock
bra _kb_92P_V200_normal
_kb_92P_V200_shift
move.l d2,d3
_kb_92P_V200_normal
lea.l _kb_key_data_92P_V200_normal(PC),a0
bra _kb_calc92_endstatus
_kb_92P_V200_2nd
lea.l _kb_key_data_92P_V200_2nd(PC),a0
bra _kb_calc92_endstatus
_kb_92P_V200_diamond
lea.l _kb_key_data_92P_V200_diamond(PC),a0
bra _kb_calc92_endstatus
_kb_92P_V200_lock
lea.l _kb_key_data_92P_V200_lock(PC),a0
_kb_calc92_endstatus
cmp.w #72,d0
bne _kb_return
;lecture des flèches
lsr.b d2,d1
bcc _kb_return ;on quitte si detection d'une touche
add.l d2,d0 ;on incremente d0 (index)
lsr.b d2,d1
bcc _kb_return ;on quitte si detection d'une touche
add.l d2,d0 ;on incremente d0 (index)
lsr.b d2,d1
bcc _kb_return ;on quitte si detection d'une touche
add.l d2,d0 ;on incremente d0 (index)
lsr.b d2,d1
bcc _kb_return ;on quitte si detection d'une touche
;quitte avec 0 si aucune touche n'est pressée
moveq.w #0,d0
rts
_kb_return
add.l d0,a0
add.l d0,a0
move.w (a0),d0
tst.b d3
beq _kb_end
cmp.l #97,d0
blt _kb_end
cmp.l #122,d0
bgt _kb_end
sub.l #32,d0
_kb_end
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; données
_kb_numrows
dc.l 8
;masques précalculés
_kb_key_masks
dc.w $FDFF,$FEFF,$FF7F,$FFBF,$FFDF,$FFEF,$FFF7,$FFFB,$FFFD
;codes de touches
_kb_key_data_92P_V200_normal
dc.w 45,13,97,113,271,48,46,173,257,136,108,111,43,266,264,0,61,109,107,105,272,263,265,42,94,110,106,117,268,262,13,112,47,98,104,121,273,259,260,261,32,118,103
dc.w 116,269,40,41,44,258,99,102,114,274,55,56,57,0,120,100,101,270,52,53,54,0,122,115,119,275,49,50,51,337,338,340,344
_kb_key_data_92P_V200_2nd
dc.w 4141,4109,0,0,271,60,60,4372,4353,58,34,0,4139,266,4360,0,92,59,124,151,272,263,4361,4138,140
dc.w 0,0,0,268,4358,4109,95,93,39,38,18,273,259,260,261,32,118,103,116,269,40,41,44,4354,0,159,64,274,4151,4152,4153,0,169,176,0,269,4148,4149,4150,0,0,223,33,275,149,4146,4147,4440,4436,4434,4433
_kb_key_data_92P_V200_diamond
dc.w 1,8205,8257,8273,8463,8240,8238,8365,8449,8328,8268,8271,2,8458,0,8456,8253,8269,8267,8265,8464,8455,8457,8234,8286,8270,8266,8277,8460,8454,8205,8272,8239,8258,8264,8281,8465,8451,8452,8453,8224,130,8276,8461,8232,8233,8236,0,
dc.w 8280,8260,8261,8462,8244,8245,8246,0,8282,8275,8279,8467,8241,8242,8243,8529,8530,8532,8536
_kb_key_data_92P_V200_lock
dc.w 1,8205,8257,8273,8463,8240,8238,8365,8449,8328,8268,8271,2,8458,0,8456,8253,8269,8267,8265,8464,8455,8457,8234,8286,8270,8266,8277,8460,8454,8205,8272,8239,8258,8264,8281,8465,8451,8452,8453,8224,130,8276,8461,8232,8233,8236,0,
dc.w 8280,8260,8261,8462,8244,8245,8246,0,8282,8275,8279,8467,8241,8242,8243,8529,8530,8532,8536
_kb_key_data_89_normal
dc.w 264,0,0,0,0,0,0,0,265,258,149,124,61,120,277
dc.w 268,48,49,52,55,40,121,266,269,46,50,53,56,41,122,278,270,173,51,54,57,44,116,257,271,13,43,45,42,47,94,263,272,337,338,340,344
_kb_key_data_89_alpha
dc.w 264,0,0,0,0,0,0,0,265,112,107,102,97,120,277,268
dc.w 118,113,108,103,98,121,266,269,119,114,109,104,99,122,278,270,32,115,110,105,100,116,257,271,13,117,111,106,101,94,263,272,337,338,340,344
_kb_key_data_89_2nd
dc.w 4360,0,0,0,0,0,0,0,4363,4354,159,176,39,4184,4373
dc.w 273,60,34,58,4151,123,4185,18,274,62,92,4149,4152,125,4186,151,275,4372,4147,4150,59,91,4180,4353,271,4109,4139,4141,4138,93,140,263,272,4433,4434,4436,4440
_kb_key_data_89_diamond
dc.w 16648,0,0,0,0,0,0,0,16651,16642,16533,16508,16445
dc.w 16472,277,16652,16432,16433,16436,16439,146,16650,16653,16430,16434,16437,16440,16425,16474,16662,16654,16557,16435,16438,16441,16428,16468,16641,16665,16397,16426,16431,16478,16647,16656,16721,16722,16724,16728
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
KEY_CUP equ 1
KEY_CDN equ 2

fabetal_ > Hier, je me suis fait monter par un pote
redangel > et en chevals, ça donne quoi?
Nil> OMG I think I'm gay