;--------------------------------------------------------------------- ; Routine: BCDToNumber ; Arguments: a - a number in BCD (e.g. hex $19 = dec 19) ; Returns: a - converted number ; Alters: af ;--------------------------------------------------------------------- BCDToNumber: push bc push hl ;convert back to normal with: ; a = a[7:4] * 10 + a[3:0] ld b,a ;save A swap a and %00001111 ld hl,.lookupTimes10 add l ld l,a ld a,0 adc h ld h,a ld a,[hl] ;Upper nibble times 10 ld c,a ld a,b and %00001111 add c pop hl pop bc ret .lookupTimes10 DB 0,10,20,30,40,50,60,70,80,90