RosettaCodeData/Task/Periodic-table/6502-Assembly/periodic-table.6502
2023-07-01 13:44:08 -04:00

11 lines
517 B
Text

Lookup: ;INPUT: X = atomic number of the element of interest.
LDA PeriodicTable_Column,x
STA $20 ;store column number in memory (I chose $20 arbitrarily, you can store it anywhere)
LDA PeriodicTable_Row,x
STA $21 ;store row number in memory
RTS
PeriodicTable_Column:
db $ff,$01,$18,$01,$02,$13,$14,$15,$16,$17,$18,... ;I don't need to write them all out, the concept is self-explanatory enough.
PeriodicTable_Row:
db $ff,$01,$01,$02,$02,$02,$02,$02,$02,$02,$02,...