*-------------------------------------------------------* * * * ATOB- converts a 2 char ASCII (decimal) string into a * * 1 byte HEX number. * * Input- The address of the string in the Y register. * * Output- The number, stored in the global var N. * * Registers clobbered- A,B,CCR * * * *-------------------------------------------------------* ATOB LDAB 0,Y ; get the first char in the buffer SUBB #$30 ; ASCII 0 = 0x30 LDAA #10 ; the first digit was "tens" MUL ; D = ACCB * 10 * Note: for this lab, since N cannot be greater than 13, the result in D * falls completely in ACCB (since ACCD = [ACCA|ACCB]) TBA ; ACCA <- ACCB LDAB 1,Y ; Get the second char in the buffer SUBB #$30 ; ASCII 0 = 0x30 ABA ; ACCA <- ( ACCA (tens) + ACCB (ones) ) STAA N ; store this RTS ; *