CabaretVoltaire Posted October 13, 2005 Share Posted October 13, 2005 I have some code that I'd like to turn into a subroutine but can't work out how to do something similar to C pointers to make this possible.. My code at the minute alters the contents of some RAM addresses but is repeated several times for different RAM addresses.. I'd like to do something like ldx [address of variable] jsr MySubRoutine Where the subroutine will can do something like: stx temp and then load/read from the original variable with ld? #temp st? #temp right? Thanks! Quote Link to comment Share on other sites More sharing options...
vdub_bobby Posted October 13, 2005 Share Posted October 13, 2005 I have some code that I'd like to turn into a subroutine but can't work out how to do something similar to C pointers to make this possible.. My code at the minute alters the contents of some RAM addresses but is repeated several times for different RAM addresses.. I'd like to do something like ldx [address of variable] jsr MySubRoutine Where the subroutine will can do something like: stx temp and then load/read from the original variable with ld? #temp st? #temp right? Thanks! 947902[/snapback] I think you want to do something like this... ldx [address of variable] jsr Subroutine ;-------------- Subroutine lda $00,X And then the accumulator will hold the contents of RAM. I'm assuming (since this is in the 2600 forum) that your RAM location is a zero page location. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.