Re: A86: Seperating strings...?


[Prev][Next][Index][Thread]

Re: A86: Seperating strings...?



DoubleGate wrote:
> 
> To anyone and everyone,
> 
>         First of all..  let me say hello to everyone..  I've been reading this
> newslist for awhile now, but only just got up enough intelligence on the
> subject to feel worthy to post.  **grin**
>         Ok my question is:  Is it possible to seperate the numerals in a larger
> number..  Like say I add 424 and 500..  I get 924.  Is there any way to
> seperate the 9, 2, and 4?  In BASIC or assembly...  I dont want to give
> every numeral a varible..  I just want to be able to seperate the numerals
> after a normal operation..  Possible?

There is a ROM call that does exactly what you want. call $4044
will divide HL with 10 and put the remainder in A.

 ld hl,424
 ld de,500
 add hl,de  ; HL=924
 call $4044
 ; A = 4
 call $4044
 ; A = 2
 call $4044
 ; A = 9

-- 
Jimmy Mårdell                "The nice thing about standards is that 
mailto:mja@algonet.se         there are so many of them to choose from."
http://www.algonet.se/~mja    
IRC: Yarin                   "Sanity? I'm sure I have it on tape
somewhere!"


References: