RosettaCodeData/Task/Pointers-and-references/6502-Assembly/pointers-and-references-5.6502
2023-07-01 13:44:08 -04:00

18 lines
342 B
Text

LDA #arg_C ;load whatever this value is into accumulator
PHA
LDA #arg_B
PHA
LDA #arg_A
PHA
foo:
PHX
TSX
;stack looks like this: __, X,LOW(PC),HIGH(PC),arg_A,arg_B,arg_C
;stack pointer points to __, as does $100,X after a TSX
LDA $0106,X ;LDA #arg_C
CLC
ADC $0105,X
CLC
ADC $0104,X ;ADC #arg_A
;we have the desired value in A, now return.
PLX