user0123
Newbie level 4

I'm adjusting RTC with keypad. Show the press key on the LCD.
Example: I compare if the press key is $5 - if it's pressed I write it to variable and show on the LCD. After that I compare if another key is pressed, write its value in second variable and show it on the next position on the LCD.
I don't know how to do the following thing: I have the value $5 in one variable and $9 in other variable. I have to write in the RTC $59. How to do this?
After the call of "keypad_wytec": if a key is down, the carry bit =1 and the accumulator B holds the key number, if no key is down the carry bit =0
adjustment:
jsr lcd_ini_blink
ldx #str3
ldab #40
jsr lcd_line1
adj21: jsr keypad_wytec
stab Oldkey
ldaa Oldkey
cmpa #$05
bne adj21
staa value1
adda #$30
jsr adj1
adj22: jsr keypad_wytec
stab Oldkey
ldaa Oldkey
cmpa #$09
bne adj22
staa value2
adda #$30
jsr adj2
rts
adj1:
staa str4
jsr show_strings1
rts
adj2:
staa str4+1
jsr show_strings1
rts
str4 fcc ' '
show_strings1:
pshx
ldx #str4
ldab #2
jsr lcd_line2
pulx
rts
This code is only for test if everything is working.
P.S. The microcontroller is MC68HC11
Example: I compare if the press key is $5 - if it's pressed I write it to variable and show on the LCD. After that I compare if another key is pressed, write its value in second variable and show it on the next position on the LCD.
I don't know how to do the following thing: I have the value $5 in one variable and $9 in other variable. I have to write in the RTC $59. How to do this?
After the call of "keypad_wytec": if a key is down, the carry bit =1 and the accumulator B holds the key number, if no key is down the carry bit =0
adjustment:
jsr lcd_ini_blink
ldx #str3
ldab #40
jsr lcd_line1
adj21: jsr keypad_wytec
stab Oldkey
ldaa Oldkey
cmpa #$05
bne adj21
staa value1
adda #$30
jsr adj1
adj22: jsr keypad_wytec
stab Oldkey
ldaa Oldkey
cmpa #$09
bne adj22
staa value2
adda #$30
jsr adj2
rts
adj1:
staa str4
jsr show_strings1
rts
adj2:
staa str4+1
jsr show_strings1
rts
str4 fcc ' '
show_strings1:
pshx
ldx #str4
ldab #2
jsr lcd_line2
pulx
rts
This code is only for test if everything is working.
P.S. The microcontroller is MC68HC11