NESDev and Strangulation Records messageboards
Forum Index | FAQ | New User | Login | Search

Previous ThreadView All ThreadsNext ThreadShow in Flat Mode*


SubjectOffsetting from a label  
Posted bypulper
Posted on9/24/04 9:44 PM
From IP132.241.65.97  



Question: If you wanted to offset 0-255 bytes from a label, could you add the offset without worrying about overflowing or rolling over? Example pseudocode:

samplebyte = mylabel location + myoffset

mylabel:
.byte "9 3 8 7 2 8 1 9"

If your offset was 5, would variable samplebyte be guaranteed to contain the value "2"
after you ran the code?
If so, could someone convert the 1st line into assembly for me? I had too many whiskey cokes
last night...

I'm hoping its something like:

lda #low(mylabel)
sta $20
lda #high(mylabel)
sta $21

ldy myoffset
lda [$20],y
sta samplebyte

Seems to make sense to me... any good?

-Pulper

-
Entire Thread
Subject  Posted byPosted On
.Offsetting from a label  pulper9/24/04 9:44 PM
.*Re: Offsetting from a label  Memblers9/25/04 00:20 AM
Jump to

Memblers' homepage             Contact Me

Forums powered by WWWThreads Demo