Computer engineering student. You probably have a Motorola chip in something you own, may it be a microwave oven, a fuel-injection sub-assembly, or even some toys. Here's a code sample from a program for the Motorola 68HC12 microcontroller:
ORG $0600 ;declare subroutine origin
ASCII TSX ;copy SP to IX
LDY #$0700 ;load index register Y
LDAA 2,X ;get packed BCD from stack and store in ACCA
ANDA #%00001111 ;mask off LSN (A = units)
LDAB 2,X ;get packed BCD from stack and store in ACCB
ANDB #%11110000 ;mask off MSN (B = tens)
ASC1 CMPA 2,Y+ ;compare every second element in table
BNE ASC1 ;repeat comparison until found the match
DEY ;decrement of index Y
LDAA 0,Y ;load matching ASCII code to ACCA
STAA 3,X ;overwrite with ASCII code for units
ORG $0600 ;declare subroutine origin
ASCII TSX ;copy SP to IX
LDY #$0700 ;load index register Y
LDAA 2,X ;get packed BCD from stack and store in ACCA
ANDA #%00001111 ;mask off LSN (A = units)
LDAB 2,X ;get packed BCD from stack and store in ACCB
ANDB #%11110000 ;mask off MSN (B = tens)
ASC1 CMPA 2,Y+ ;compare every second element in table
BNE ASC1 ;repeat comparison until found the match
DEY ;decrement of index Y
LDAA 0,Y ;load matching ASCII code to ACCA
STAA 3,X ;overwrite with ASCII code for units
* This post has been modified
: 20 years ago
