lda with 16 bits indirect address ?

Here you can ask questions or provide insights about how to use efficiently 6502 assembly code on the Oric.
User avatar
goyo
Officer Cadet
Posts: 52
Joined: Sat Jan 12, 2019 10:16 am

lda with 16 bits indirect address ?

Post by goyo »

Hello,

With OSDK I would like to know how to read and write in a indirect address with 16 bits

my sprite address (graphics) is a 16bits address ...

I would like to modify the graphics of the sprite like this :

Code: Select all

lda (ptr_sprite ),y    ; I like to read the graphics through ptr_sprite 

adc 1                ; modify A

sta (ptr_sprite ),y


.dsb ptr_sprite 2


sprite 
0x76,.......
:o
User avatar
Dbug
Site Admin
Posts: 4444
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: lda with 16 bits indirect address ?

Post by Dbug »

This ".dsb ptr_sprite 2" will only work if it's declared in .zero page.
Basically any of the 6502 addressing mode involving parenthesis, require the pointer to be in the first 256 bytes of memory.

So that would be something like that:

Code: Select all

  .zero

ptr_sprite .dsb  2

  .text

  lda (ptr_sprite),y    ; I like to read the graphics through ptr_sprite   
  adc #1                     ; modify A
  sta (ptr_sprite),y
User avatar
goyo
Officer Cadet
Posts: 52
Joined: Sat Jan 12, 2019 10:16 am

Re: lda with 16 bits indirect address ?

Post by goyo »

Ok I understand !

So I will use the zero page for my ptr variables.

thank you Debug :)
Post Reply