include "doorsos.h" include "compat.h" include "graphlib.h" include "userlib.h" include "hexlib.h" include "irlib.h" xdef _ti89 xdef _ti92plus xdef _main xdef _comment ;********************************************************************* SetFont macro move.w \1,-(a7) jsr tios::FontSetSys lea 2(a7),a7 endm WriteStr macro move.w \3,-(a7) pea \4(pc) move.w \2,-(a7) move.w \1,-(a7) jsr tios::DrawStrXY lea 10(a7),a7 endm Affhex macro move.l \4,d0 move.l \3,d4 move.l \2,d2 move.l \1,d1 jsr hexlib::put_hex endm AffBin macro move.l \4,d0 move.l \3,d4 move.l \2,d2 move.l \1,d1 jsr hexlib::put_bin endm ;********************************************************************* _main: clr d5 clr d6 jsr flib::zap_screen SetFont #1 WriteStr #0,#0,#1,Text1 WriteStr #0,#10,#1,Text2 WriteStr #0,#20,#1,Text3 WriteStr #0,#30,#1,Text4 WriteStr #0,#40,#1,Text5 Loop: Affhex #4,#10,#1,d5 ;ligne,colonne,nbr de chiffres,nombre Affhex #5,#10,#1,d6 jsr flib::idle_loop cmp #KEY_DOWN,d0 ; down beq dec_app cmp #KEY_UP,d0 ; up beq inc_app cmp #KEY_LEFT,d0 ; left beq dec_code cmp #KEY_RIGHT,d0 ; right beq inc_code cmp #257,d0 ; del beq send_code cmp #264,d0 ; exit beq Exit bra Loop dec_app: cmp.b #0,d5 beq Loop sub.b #1,d5 bra Loop inc_app: cmp.b #31,d5 beq Loop add.b #1,d5 bra Loop dec_code: cmp.b #0,d6 beq Loop sub.b #1,d6 bra Loop inc_code: cmp.b #63,d6 beq Loop add.b #1,d6 bra Loop Exit: jsr tios::reset_link rts ;********************************************************************* ;************* Routine pour convertir la commande en RC5 ************* ;********************************************************************* ; d0 : sortie ; d5 : appareil ; d6 : commande ; d7 : intermédiaire send_code: clr.w d7 rol.b #6,d6 ; decalage a gauche de 7 de la commande or.b d6,d7 rol.b #2,d6 ; on retrouve la commande lsl.w #8,d7 ; decale pour laisser place a l'appareil rol.b #4,d5 ; decalage a gauche de 4 de l'appareil or.b d5,d7 ror.b #4,d5 ; on retrouve l'appareil or #14,d7 clr.l d0 move.b #16,d2 Conv: lsl.l #2,d0 btst.w #15,d7 bne Un eori #2,d0 bra suite Un: eori #1,d0 suite: lsl.w #1,d7 sub.w #1,d2 cmp.w #0,d2 bne Conv eor.l #167772160,d0 move.l Philips,d3 move.w #31,d4 jsr irlib::PutLink move.l d0,d3 move.w #31,d4 jsr irlib::PutLink bra Loop ;********************************************************************* Text1: dc.b "Appareil : Up/Down",0 Text2: dc.b "Commande : Left/Right",0 Text3: dc.b "Send : Del",0 Text4: dc.b "Appareil : $",0 Text5: dc.b "Commande : $",0 Philips: dc.l %00010010000011100010000000000100 _comment dc.b "v2.0 by A.MERCIER",0 end