Search found 4 matches

by pistolhamster
Wed Nov 15, 2023 8:49 pm
Forum: Newbies
Topic: Using x and y registers as an address
Replies: 25
Views: 14241

Re: Using x and y registers as an address

Thanks, you put me on the track again. This is what I managed to write and test, I now have a nice column of petscii circles.
Yes that's the idea. Note Garth's point that with a modern 65C02 you can also do it without using an index register.

Even on older CPUs you can also speed things up a ...
by pistolhamster
Sun Nov 12, 2023 2:43 pm
Forum: Newbies
Topic: Using x and y registers as an address
Replies: 25
Views: 14241

Re: Using x and y registers as an address

Typically you would store the address in two consecutive bytes of page zero, and adjust them there by doing 16-bit adds or subtracts. Then to read or write the target memory location you set X or Y to zero and use indexed indirect addressing, i.e. (zpaddr,x) or (zpaddr),y.

Thanks, you put me on ...
by pistolhamster
Sat Nov 11, 2023 8:35 am
Forum: Newbies
Topic: Using x and y registers as an address
Replies: 25
Views: 14241

Re: Using x and y registers as an address

It works until x ($1100) reaches 255, then the x index flips because it has 8 bits only, and my whole little thing comes crashung down.
Is that a typo or have you coined a neologism, a new word for flawed code, combining "crash" & "hung", much like hangry?

It would be an excellent example of ...
by pistolhamster
Fri Nov 10, 2023 10:10 pm
Forum: Newbies
Topic: Using x and y registers as an address
Replies: 25
Views: 14241

Re: Using x and y registers as an address

This was a good read, thank you to those who gave such well explained advice.

Allow me to ask a question: Like the OP, I dabble a bit with a simple project where I need to dynamically change memory addresses.

I want to print a series of characters on the screen starting with $0400 and ending with ...