[torontocbm] C64 ASM Question

  • From: "wbochar" <admin@xxxxxxxxxxx>
  • To: <torontocbm@xxxxxxxxxxxxx>
  • Date: Fri, 12 Jun 2009 17:03:09 -0400

I was wondering if someone out there can give me some guidance on an
assembler problem I am having.

 

I have three screens of characters stored in memory (40x25x3 character bytes
at $3000 or "BG1"

 

Anyways, I can draw the bg1 to the screen (the first 40*25), it works fine
that way. But I want to smooth scroll it, so I got that working with out
issue.

 

But at the end of the smooth scroll vertically, I want to increment the
display to go up one line.

 

I have the following static subroutine:

 

DrawBG1

LDA BG1 + 0, X

STA 1024, X

LDA BG1 + 200, X

STA 1024 + 200, X

LDA BG1 + 400, X

STA 1024 + 400, X

LDA BG1 + 600, X

STA 1024 + 600, X

LDA BG1 + 800, X

STA 1024 + 800, X

INX

CPX #200

BCC DrawBG1

LDX #0

RTS

 

 

If I manually add "+ 40"

 

LDA BG1 + 0 + 40, X

STA 1024, X

LDA BG1 + 200 + 40, X

STA 1024 + 200, X

 

It will change address reference up one character line

 

If I create a variable

 

CharRow := 40

 

And do this

 

LDA BG1 + 0 + CharRow, X

STA 1024, X

LDA BG1 + 200 + CharRow, X

STA 1024 + 200, X

 

Same thing works. But I can't reassign the value at runtime

 

I put a value of 2 at $C000

 

LDA BG1 + 0 + ($C000 * CharRow), X

STA 1024, X

LDA BG1 + 200 + ($C000 * CharRow), X

STA 1024 + 200, X

 

This doesn't work either, because it's looking at $C000 as a value not the
value at $C000 address.

 

How do I dynamically adjust this address based on a value stored somewhere
else?

 

 

 

 

 

 

 

Other related posts: