bore wrote:
If you move the SUB "0" to the test you can get it to stop at any non-decimal character.
Could be useful if the number is in the middle of a longer text but it costs 3 more cycles.
.LOOP LD A,(DE) SUB "0" CP 10 RET NC
I would do it like this:
.LOOP LD A,(DE) OR A RET Z SUB "0" CP 10 CCF RET C
So if the routine returns with CF=0, the ASCII string has been converted successfully,
if it returns with CF=1, the ASCII string contains non-numeric chars.
Login or register to post comments
