AnsweredAssumed Answered

HSC08 assembly code

Question asked by hityou123 on Dec 5, 2012
Latest reply on Jan 10, 2013 by Derrick Klotz

I am doing assembly after a long time. Need some guidance -

 

To load HX register from RAM,

 

I do LDHX ram. This should load (ram) to X and (ram+1) to H

correct?

 

I am trying to write code for a clock. I increment "RTCSEC" . When the value is 30d, that's equal to 30seconds.

At every 30secs, I increment RTCMIN. When RTCMIN is 120, I increment RTCHR. If the RTCMIN is not equal to 120, the code branches to incRTCMIN.

Is this correct?

 

inc RTCSEC

lda RTCSEC

cmp #$1E ; 30 seconds

beq incRTCMIN

What to put here???

 

  incRTCMIN: clr RTCSEC

                     inc RTCMIN

                     lda RTCMIN

                     cmp #$78 ; 120 mins make an hour (since 30 secs make a min)

                     beq incRTCHR

                     bra incRTCMIN

Outcomes