Bcd Commands

seconds = rtc_read(0x00); // BCD 0x45 = 45 sec // Convert to binary for computation: bin_sec = ((seconds >> 4) * 10) + (seconds & 0x0F);

bcd_add_4digit: mov ax, dx ; low word? and ax, 0x00FF ; low byte of BCD1 mov cx, bx and cx, 0x00FF ; low byte of BCD2 add al, cl daa ; adjust low byte mov cl, al ; save low result mov al, ah adc al, ch daa ; adjust second byte mov ch, al ; save second byte bcd commands