6502 Assembly: Passing Parameteres to sub routines

Passing Parameteres to sub routines
bauen1(Game Moderator)
July 1, 2016, 3:49 p.m.

How would you go about such thing?


Passing Parameteres to sub routines
kveroneau(Game Creator)
July 1, 2016, 6:59 p.m.

It's assembly, and there is no memory protection. Any variables you store in main memory are accessible by any sub routine. Look at the memory mapped I/O to see how parameters are passed through the underlying devices.

Here's a simple example:

LDA #$80
STA $20
JSR routine
......
rountine:
... Routine can access A,X,Y, and $20
RET

Normally on the 6502, the zero-page, $0000-$00ff is used to for variable storage. Although you can access any memory address.