Check if number is in range on 8051
问题 I have received a character over UART, and need to validate if it's a number character. Normally I'd do if (char >= '0' && char <= '9') { /* VALID */ } However, I have to do it in assembly . I haven't found any compare instruction (so I assume there is none). How can I do this? mov A, SBUF ; load the number ; -- pseudocode -- cmp A, #'0' ; In AVR, I'd do it this way brlt fail ; but I'm new to 8051 cmp A, #'9' brge fail ; -- pseudocode -- ; number is good fail: edit: ok here's what I have now