Jump to content

Photo

Assembly question


4 replies to this topic

#1 atari2600land OFFLINE  

atari2600land

    Game Gear>Game Boy

  • 8,374 posts
  • Location:Salem, Oregon

Posted Mon Jan 30, 2012 8:17 PM

How does one do "if a>#07eh" in assembly? Right now I've got this:
    movx a,@r0
    add a,#07eh        ; check right boundary
    jnz loop_2b
Which I'm guessing only checks to see if the sprite is at (and only at) #07eh, but I'd like to check for greater numbers than #07eh as the game progresses and the sprites move faster.

#2 Rybags OFFLINE  

Rybags

    Quadrunner

  • 13,065 posts
  • Location:Australia

Posted Mon Jan 30, 2012 8:45 PM

In 6502 you need one of the compared numbers in A.

e.g.

LDA XPOS
CMP #LEFTSIDE
BCS NOT_HIT

CMP does a subtract without affecting the register. Carry is set if A >= the immediate data or content on memory. Carry clear if A < data.

Branches are relative and limited in range. If the range isn't big enough then you can use JMP - but Jump can't have conditions so you typically branch around it on the opposite condition.

e.g.
LDA XPOS
CMP #LEFTSIDE
BCC HIT
JMP NOT_HIT

#3 atari2600land OFFLINE  

atari2600land

    Game Gear>Game Boy

  • Topic Starter
  • 8,374 posts
  • Location:Salem, Oregon

Posted Mon Jan 30, 2012 9:05 PM

What does the Odyssey2 use? 6502?

#4 GroovyBee OFFLINE  

GroovyBee

    Games Developer

  • 7,979 posts
  • Busy bee!
  • Location:North, England

Posted Tue Jan 31, 2012 6:52 PM

:? Erm... How can you code in assembly language for the Videopac if you don't know what the processor is? Anyways... something like this should work (however I'm not a Videopac programmer) :-

    add a,#081h        ; check right boundary
    jc BeyondRightBoundary

Which will jump to the BeyondRightBoundary label when a >= 0x7F (which is like saying a > 0x7E).

You'll need to make reference to chapter 5 in the following document for a list of 8048 opcodes :-

http://home.mnet-onl...s-48/mcs-48.pdf

#5 atari2600land OFFLINE  

atari2600land

    Game Gear>Game Boy

  • Topic Starter
  • 8,374 posts
  • Location:Salem, Oregon

Posted Wed Feb 1, 2012 2:10 AM

Yeah, I know. I am trying really hard to learn assembly, but it's really hard. And what's even more difficult is that if I decide to do assembly for the Atari 2600, I'd need to learn more assembly! There are still some things I just don't get yet, but I hope to some day make a game that's good for the Videopac (the Odyssey2 here in the US.) Maybe Fatso! will be it...




0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users