Jump to content
IGNORED

Addressing modes help needed


Recommended Posts

I have this piece of code:

 

; Routine to load the next level
level_vec .word $0000
scrn_vec .word GameScreen + $28
outchar  .byte $00
loadlevel inc level   ;Increment the level
  lda #$05   ;If the level is now 5, then set it back to 1
  cmp level
  beq levelok
  lda #$01
  sta level
levelok  ldx level	 ;Load the level and reduce it by 1
  dex level
  txa	 ;Multiply the level by 2 for the offset
  asl
  tax
  lda lvlvectors,x ;Get the address of the level data
  sta level_vec
  lda lvlvectors+1,x
  sta level_vec+1
  ldy #$00
getscrnchr lda (level_vec),y   ; <---- THIS LINE HERE GENERATES THE ERROR
  cmp #$FF
  beq leveldone
  tax
  and #$0f
  clc
  adc #$40
  sta outchar
  txa
  lsr
  lsr
  lsr
  lsr
  tax
  lda outchar
rptscrnchr cpx #$00
  beq getscrnchr
  sta (level_vec),y
  iny
  dex
  jmp rptscrnchr
 
  ;  ++++++ HERE ++++++
leveldone lda #$00   ;Temporary instruction
  rts

 

I know it's probablu quite messy, but this is my first real assembly project.

However, when I try to run the assembler, it tells me that I have an illegal addressing mode on the indicated line. I though that indirect-indexed was allowed for LDA.

 

Any help please

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...