RosettaCodeData/Task/Enumerations/6502-Assembly/enumerations-3.6502

31 lines
781 B
Plaintext

Days_Of_The_Week:
word Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday
Sunday:
byte "Sunday",0
Monday:
byte "Monday",0
Tuesday:
byte "Tuesday",0
Wednesday:
byte "Wednesday",0
Thursday:
byte "Thursday",0
Friday:
byte "Friday",0
Saturday:
byte "Saturday",0
LDA #$03 ;we want to load Wednesday
ASL A ;these are 16-bit pointers to strings, so double A
TAX ;transfer A to X so that we can use this index as a lookup
LDA Days_Of_The_Week,x ;get low byte
STA $00 ;store in zero page memory
LDA Days_Of_The_Week+1,x ;get high byte
STA $01 ;store in zero page memory directly after low byte
LDY #0 ;clear Y
LDA ($00),Y ;Load the "W" of Wednesday into accumulator