; ; A sample program for using the IR Link as a Learning Remote Control. ; by Sami Khawam (sKhawam@bigfoot.com) ; http://unet.univie.ac.at/~a9501901 ; ; The programm is very simple to use. There are only 4 keys fonctions ; each one represented by an arrow key. To make the program record data ; from an remote control, press 2nd and choose the key and then the time ; base and the frequency. If you don't know thoses value you should ; experiment by using differents ones. ; DO NOT specifie frequencies that are less than 30 KHz or more than ; 48 KHz! ; ; This programm needs the STANDART version of the IR Link. ; ; The PutByte was taken (and modified) from a disassembly of the ROM. ; GetByte is from Randy Gluvna (gluvna@home.com). Thanks. ; Thanks for Andreas Ess for his function pack for usgard. ; ; I have ported this program to the 86. ; Antoine. ; ; #include "ti86asm.inc" _mul_hl equ $4547 ;multiply h and l .org _asm_exec_ram nop jp Start .dw $0000 .dw PName PName: .db "IR Remote " PName2: .db "by Sami Khawam",0 ;-------------------------------------- Start: ld a,$C0 ; Set W1 and R1 out (7),a call _clrLCD set 3,(IY+05) ld hl, PName2 ld de,$0300 ld (_curRow),de call _puts res 3,(IY+05) ld hl, Text1 ld de,$0003 ld (_curRow),de call _puts ProgLoop: call _getkey cp kExit jp z,_clrScrn cp kF1 jr z,RecordRemote dec a ; Only less than 3 cp 4 jr nc,ProgLoop call _runindicon ld l,a ; Get Offset ld h,32 call _mul_hl ld de,CK_1 add hl,de ; Now Send data ld a, 30 ; Always 30 bytes. call PutByte ; Send the Byte call SendHeader ld b,30 NextByte: ld a, (hl) call PutByte ; Now we send all bytes. inc hl djnz NextByte call _runindicoff jr Start RecordRemote: call _clrLCD ld hl, Text2 ld de,$0001 ld (_curRow),de call _puts WaitKey: call _getkey cp kExit jr z,Start dec a ; Only less than 3 cp 4 jr nc, WaitKey ld l, a ; Get Offset ld h, 32 call _mul_hl ld de,CK_1 add hl,de push hl ld hl, Text_TimeBase ld de,$0002 ld (_curRow),de call _puts pop hl call InputValue inc hl push hl ld hl, Text_Wait1 ld de,$0003 ld (_curRow),de call _puts pop hl call InputValue ld a, $5E ; $5E = 30d & $40, because we have 30 bytes call PutByte dec hl call SendHeader push hl call _clrLCD ld hl, Text_Wait3 ld de,$0100 ld (_curRow),de call _puts call _newline call _runindicon WaitSig: in a,(7) and 3 cp 3 jr nz, DataComing call 5371h ; GET_KEY cp $37 ; K_EXIT jr z, Quit jr WaitSig DataComing: pop hl ld b, 30 GNextByte: push bc call GetByte ld (hl), a inc hl push hl call Affahex ld a,' ' call _putc pop hl pop bc djnz GNextByte call _runindicoff waitpause: call _getkey cp kEnter jr nz,waitpause jp Start Quit: pop hl jp Start InputValue: IVLoop: ld de, (_curRow) set 3,(IY+05) ld a, (hl) push hl push de ld l,a ld h,0 xor a call $4a33 res 3,(IY+05) pop de ld (_curRow),de call _getkey pop hl cp kEnter ret z cp kUp jr z, Increment cp kDown jr z, Decrement Increment: ld a, (hl) inc a ld (hl), a jr IVLoop Decrement: ld a, (hl) dec a ld (hl), a jr IVLoop SendHeader: ld a, (hl) call PutByte inc hl ld a, (hl) sub 30 rr a inc hl push hl ld l,a ; Get Offset ld h,2 call _mul_hl ld de,DelayTab add hl, de ld a, (hl) call PutByte inc hl ld a, (hl) call PutByte pop hl ret #include "Fonctions.asm" CK_1: .db 10, 32 .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .db 11, 34 .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .db 12, 36 .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .db 13, 38 .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 DelayTab: .db $0B, $0F .db $0C, $10 .db $0D, $11 .db $0E, $12 .db $0F, $12 .db $0F, $13 .db $10, $14 .db $11, $14 .db $11, $15 .db $12, $15 Text1: .db "F1 to record.", 0 Text2: .db "Key to assign:", 0 Text_TimeBase: .db "Time base: ", 0 Text_Wait1: .db "Frequency: ", 0 Text_Wait3: .db "Getting " Text_Data: .db "Data", $CE, 0 .end