Jump to content
Sign in to follow this  
atari2600land

Odyssey 2 programming - using numbers in a table

Recommended Posts

So I have this:

randomtrack1:
    db  0a0h, 0f0h, 0f0h
    
randomtrack2:
    db  0f0h, 0a0h, 0f0h
    
randomtrack3:
    db  0f0h, 0f0h, 0a0h

tracknum:
    db    randomtrack1 & 0ffh
    db    randomtrack2 & 0ffh
    db    randomtrack3 & 0ffh   

 Each randomtrack data represents a sprite being on screen. If the value is f0h, then it's not on screen, but if it's a0h then it is. I have this variable called "randomness" that I'd like to put into a code that pulls the number of tracknum that is the value of "randomness" (0, 1, or 2.) So I started to do that. I have this:

    mov r0,#randomness
    mov a,@r0
    mov r6,a        ; randomness now in r6
   
    add a,#tracknum & 0ffh    
    movp a, @a ;get byte

    mov r1,a
    
    mov r0,#000h
    mov r7,#1
    call copyspriteloop3   

...

 The problem is, I don't know what to do with r6 after I moved randomness into it. All I get if I put this in there is a pattern that keeps repeating over and over again, which isn't what I want to do at all. Help me, please.

 

Share this post


Link to post
Share on other sites

I had a look, but I don't know the instruction set nor the system well enough to follow your clever coding.

Share this post


Link to post
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.

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...