Jump to content



0

Main code rules as requested by others.


2 replies to this topic

#1 Gorf OFFLINE  

Gorf

    River Patroller

  • 4,633 posts

Posted Fri Jun 25, 2010 1:36 PM

To jump around in main RAM.....

1 ) Within a 256 byte page boundary...ie..The address range of a page starts at $XXXXXX00 and ends at $XXXXXXFF.

a ) JR can jump from anywhere to anywhere within its range and inside the page.
b ) JUMP must be aligned on a long address and jump to a word offset long address...ie...adresses ending in 2,6,A and E

2 ) From one 256 byte page to another

a ) JR (if it can reach the destination) can jump from anywhere but MUST land on a long aligned address to the other page.
b ) JUMP must be aligned on a long address and jump to a long aligned address...ie...adresses ending in 0,4,8 and C.

3 ) To jump from main to local or local to main(from one way to the other is the same).

a ) The JUMP must be long aligned. The desination must be long aligned. However, phrase aligment is reccomended for saftey.
b ) Preceed the JUMP with a MOVEI not related to the JUMP register(although I've had success with, Owl says its not safe.)
c ) Obviously JR can not reach main RAM from the GPU local address so it will not work for this

JR/JUMP must be followed by 2 NOP's OR 1 single register instruction not associated with anything recent and then NOP.
I do not think the single instruction and 1 NOP will work between local to main
or main to local but I'll leave that up to Owl to answer.

#2 Atari_Owl OFFLINE  

Atari_Owl

    Dragonstomper

  • 954 posts

Posted Sat Jun 26, 2010 1:58 AM

Somehow i missed this and replied in the main forum thread.

Atari_Owl said:


View PostGorf, on Fri Jun 25, 2010 1:35 PM, said:

a ) The JUMP must be long aligned. The desination must be long aligned. However, phrase aligment is reccomended for saftey.
b ) Preceed the JUMP with a MOVEI not related to the JUMP register(although I've had success with, Owl says its not safe.)
c ) Obviously JR can not reach main RAM from the GPU local address so it will not work for this

JR/JUMP must be followed by 2 NOP's OR 1 single register instruction not associated with anything recent and then NOP.
I do not think the single instruction and 1 NOP will work between local to main
or main to local but I'll leave that up to Owl to answer.
Its good to see the rules laid out again :)

To comment on specifics...
  • The preceding MOVEI can be the jump register or an independent register - i often use the jump register.
  • I've also used the single register instruction plus 1 NOP for jumps between local & main.
Even following the guidelines there can STILL be unexpected difficulties with Main/Local jumps if the jump to/from occurs many times in quick succession - try to space out the jumps as much as possible. My own code only jumps between main & local <5,000 times a second atm.

Edited by Atari_Owl, Sat Jun 26, 2010 1:59 AM.


#3 Gorf OFFLINE  

Gorf

    River Patroller

  • 4,633 posts

Posted Sun Jun 27, 2010 5:42 AM

View PostAtari_Owl, on Sat Jun 26, 2010 1:58 AM, said:

Somehow i missed this and replied in the main forum thread.

Atari_Owl said:


View PostGorf, on Fri Jun 25, 2010 1:35 PM, said:

a ) The JUMP must be long aligned. The desination must be long aligned. However, phrase aligment is reccomended for saftey.
b ) Preceed the JUMP with a MOVEI not related to the JUMP register(although I've had success with, Owl says its not safe.)
c ) Obviously JR can not reach main RAM from the GPU local address so it will not work for this

JR/JUMP must be followed by 2 NOP's OR 1 single register instruction not associated with anything recent and then NOP.
I do not think the single instruction and 1 NOP will work between local to main
or main to local but I'll leave that up to Owl to answer.
Its good to see the rules laid out again :)

To comment on specifics...
  • The preceding MOVEI can be the jump register or an independent register - i often use the jump register.
  • I've also used the single register instruction plus 1 NOP for jumps between local & main.
Even following the guidelines there can STILL be unexpected difficulties with Main/Local jumps if the jump to/from occurs many times in quick succession - try to space out the jumps as much as possible. My own code only jumps between main & local <5,000 times a second atm.


The only time I jump to local is after I do the grunt work out in main so I never experienced this....yet.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users