
; -----------------------------------
; PROG100k.4th = 77 x RC5toLCD.4th
; -----------------------------------


RST_STATE

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 

[DEFINED] {RC5TOLCD} [IF] {RC5TOLCD} [THEN]

MARKER {RC5TOLCD}

CODE 20_US
BEGIN
    BEGIN
        BIT #1,&$3C0
    0<> UNTIL
    BIC #1,&$3C0
    SUB #1,R14
U< UNTIL
MOV @R15+,R14
MOV @R13+,R0
ENDCODE

CODE TOP_LCD
    BIS.B #4,&$243
    BIT.B #1,&$241
0= IF
    AND.B #$0F,R14
    MOV.B R14,&$222
    BIC.B #4,&$243
    MOV @R15+,R14
    MOV @R13+,R0
THEN
    SUB #2,R15
    MOV R14,0(R15)
    BIC.B #4,&$243
    MOV.B &$220,R14
    AND.B #$0F,R14
    MOV @R13+,R0
ENDCODE

CODE LCD_WRC
    BIS.B #2,&$243
BW1 SUB #2,R15
    MOV R14,0(R15)
    RRUM #4,R14
    BIC.B #1,&$243
    BIS.B #$0F,&$224
COLON
    TOP_LCD 2 20_US
    TOP_LCD 2 20_US 
;

CODE LCD_WRF
    BIC.B #2,&$243
    GOTO BW1
ENDCODE

: LCD_CLEAR $01 LCD_WRF 100 20_us ;
: LCD_HOME $02 LCD_WRF 100 20_us ;



ASM WDT_INT
ADD #2,R1
BIT.B #$20,&$240
0= IF
    CMP #19,&$3D6
    U< IF
        ADD #1,&$3D6
    THEN
ELSE
    BIT.B #$40,&$240
    0= IF
        CMP #3,&$3D6
        U>= IF
           SUB #1,&$3D6
        THEN
    THEN
THEN
BW1
MOV @R1+,R0
ENDASM

ASM RC5_INT
ADD #2,R1
$1806 @ 16000 = [IF]
    MOV #1,&$3A0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3A0
[THEN]
MOV #1778,R9
MOV #14,R10
BEGIN
MOV #%1011100100,&$380
    RRUM    #1,R9
    MOV     R9,R8
    RRUM    #1,R8
    ADD     R9,R8
    BEGIN   CMP R8,&$390
    U>= UNTIL
    BIT.B   #4,&$200
    ADDC    R11,R11
    MOV.B   &$200,&$208
    BIC.B   #4,&$20C
    SUB     #1,R10
0<> WHILE
    ADD R9,R8
    BEGIN
        MOV &$390,R9
        CMP R8,R9
        U>= IF
        BIC #$30,&$380
        GOTO BW1
        THEN
        BIT.B #4,&$20C
    0<> UNTIL
REPEAT
BIC #$30,&$380
RLAM    #1,R11
MOV.B   R11,R9
RRUM    #2,R9
BIT     #$4000,R11
0= IF   BIS #$40,R9
THEN
RRUM    #3,R11
XOR     @R1,R11
BIT     #$400,R11
0= ?GOTO BW1
XOR #$400,0(R1)
SUB #8,R15
MOV R14,6(R15)
MOV &$1DDC,4(R15)
MOV #$10,&$1DDC
MOV R9,0(R15)
MOV #0,R14
LO2HI
    LCD_CLEAR
    <# # #S #36 HOLD #>
    ['] LCD_WRC IS EMIT
    TYPE
    ['] EMIT >BODY IS EMIT
HI2LO
MOV @R15+,&$1DDC
MOV @R15+,R14
MOV @R1+,R0
ENDASM

ASM BACKGROUND
BEGIN
    CALL &$1814
    BIS &$180A,R2
AGAIN
ENDASM

CODE STOP
BW1 MOV #SLEEP,R9
    ADD #4,R9
    MOV R9,-2(R9)
COLON
['] WARM >BODY IS WARM
ECHO
." RC5toLCD is removed. type START to restart"
COLD
;

CODE APP_INIT
MOV #%1011010100,&$3C0
$1806 @ 16000 = [IF]
    MOV #1,&$3E0
[THEN]
$1806 @ 24000 = [IF]
    MOV #2,&$3E0
[THEN]
    MOV #19,&$3D2
    MOV #%01100000,&$3C6
    MOV #10,&$3D6
    BIS.B #$20,&$204
    BIS.B #$20,&$20A
    BIS.B #7,&$245
    BIC.B #7,&$247
    BIS.B #$0F,&$224
    BIC.B #$0F,&$226
    BIS.B #4,&$20A
    BIC.B #4,&$20C
    MOV #RC5_INT,&$FFDE
    MOV #%0100010100,&$340
    MOV ##3276,&$352
    MOV #%10000,&$342
    MOV #WDT_INT,&$FFEA
BIC #1,&$130
BIS.B #3,&$20D
MOV &$1808,R8
CMP #4,R8
0= ?GOTO BW1
COLON
    #1000 20_US
    %011 TOP_LCD
    #205 20_US
    %011 TOP_LCD
    #5 20_US
    %011 TOP_LCD
    #2 20_US
    %010 TOP_LCD
    #2 20_US
    %00101000 LCD_WRF
    %1000 LCD_WRF
    LCD_CLEAR
    %0110 LCD_WRF
    %1100 LCD_WRF
    LCD_CLEAR
    ['] LCD_HOME IS CR
    ['] LCD_WRC  IS EMIT
    CR ." I love you"
    ['] CR >BODY IS CR
    ['] EMIT >BODY IS EMIT
    ." RC5toLCD is running. Type STOP to quit"
    ABORT
;

CODE START
MOV #SLEEP,R9
MOV #BACKGROUND,2(R9)
MOV #WARM,R9
MOV #APP_INIT,2(R9)
MOV R9,R0
ENDCODE 



ECHO
            ; downloading RC5toLCD.4th is done
RST_HERE    ; this app is protected against <reset>

