%%HP: T(3)A(D)F(.);

@ read read.me first!!!

@ --------------------------------------------------------------------
@ Kommentare zu den Source-Codes 1.0 auch KOMPLETT auf deutsch erhltlich!

@                                                        (c) VOIT 5'96

@ This Program converts the ir-command (e.a. "CD.PLAY") into the hex-code
@ from the database (IRCODES) and sends it with REMOTE.
@ The directory will be the same after termination.

@ --------------------------------------------------------------------

@ PRESUPPOSITIONS:
@    GETCODE in Directory HOME BATCHES
@    REMOTE-device (the completely installed version) on
@              HOME PROGRAMME REMOTE REMOTES VK
@    this file in HOME
@    database IRCODES in HOME BATCHES

@ SYNTAX:
@         1: <CODE>
@         2: <Commandname> (this file!)
@
@   e.a.  1: "CD.PLAY"
@         2: alpha-ir

@ --------------------------------------------------------------------



@ 1: <IR-Command>   e.a.: "CD.PLAY"
@ now looking for the hex-code to the command

\<<
  PATH \-> p               @ saves the path
  \<<
    HOME BATCHES
    IRCODES SWAP
    GETCODE                @ calls GETCODE from HOME BATCHES

@ 1: <Position of the expected IR-Code in IRCODES>
@    1..n -> Position
@    0    -> not in list

DUP
IF 0 == THEN 440 1 BEEP DROP KILL END

@ If command not found -> beep & exit

@ ... or:
@ extract the code from the database from position <Stack1>


@ CODE:           Example:

IRCODES         @ 1: { { "CD.PLAY" #0h } ... }    2: 1
SWAP            @ 1: 1                            2: { { "CD.PLAY" #0h } ... }
DUP             @ 1: 1        2: 1                3: { { "CD.PLAY" #0h } ... }
SUB             @ 1: { { "CD.PLAY" #0h } }
LIST\-> DROP    @ 1: { "CD.PLAY" #0h }
LIST\-> DROP    @ 1: "CD.PLAY"                    2: #0h


@ Note:
@ 2 times "List\-> DROP" because list
@                         has a double "{{}}": { { "CODE" #000h } }


SWAP DROP

@ 1: <hex-code>
@ Now, REMOTE is being started and the code will be transmitted

  \-> c                  @ Hex-Code -> c
    \<< HOME PROGRAMME
        REMOTE REMOTES VK    @ changes to the Remote-device-directory
        CODE c TRANSMIT      @ Code transmission
        p EVAL               @ changes to the directory from the beginning
    \>>
  \>>
\>>
