
; sort packed bcd result to seperate memory locations

            mov r0,#30h             ;load r0 with adress of BCD
            mov r1,#40h             ;load r1 with result adress
            mov r2,#03h             ;loop count 4x digits  >04h<
bcd_to_ram: mov a,@r0               ;get BCD
            swap a                  ;low Nibble <-> high Nibble
            xchd a,@r1              ;
            inc r1                  ; 
            swap a                  ;  
            xchd a,@r1              ;   
            inc r0                  ;    1000 in   " "  45
            inc r1                  ;     100 in   " "  44
            djnz r2,bcd_to_ram      ;      10 in   " "  43
            ret                     ;       1 in   " "  42
