Jump to content
IGNORED

Problem with loop writing and reading data from RAM


Recommended Posts

Hello,

I have been trying a small test code moving (initially just a number value) into RAM and then read it from RAM and compare to confirm the move operation worked using the 68000, running as a loop to test several RAM locations. I thought the necessary the code would be...

MOVE.L Address, Address register, i.e MOVE $0000FFFF, A1
MOVE #Data, (Address register) , i.e. MOVE $000000FF, (A1)
but it hangs my loop.
 
But then I read that data movement into and out of RAM can only be performed by the GPU & it looks like 68000 cannot address the full RAM memory space anyway so I have tried porting in to GPU
The attached image shows my code and the error messages generated when I make, the error message from SLN/SMAC and RLN/RMAC. The latter gives a little more of a clue indicating a missing closing bracket but I still cannot see where I am going wrong as I cannot see and opening bracket that is missing the corresponding closing bracket.
 
Am I anywhere near the correct code or ridiculously way off?

RAM test code issues 1.PNG

Link to comment
Share on other sites

From your code, I assume you mean main RAM, not GPU/DSP RAM.

 

It's accessible normally with the 68000 ; there's nothing special to do, and no need to write GPU/DSP code for this.

Since you didn't post the complete source, it's hard to tell why the 68000 hangs, but here are a few guesses:

- you have a typo in your code

- you're overwriting areas that shouldn't be overwritten (exception vectors, display list)

- if your code is running from RAM, it's overwriting itself

Link to comment
Share on other sites

The make output is  informing you - Lines 140 to 143 all need know where the code is going to be run as they are all address in memory. This is not the address the code is stored but where its uploaded and ran from. This the reason for ("Warning: Risc code generated with no origin defined )

Link to comment
Share on other sites

For 68k :

I think by default the assembler convert "move" to "move.w" : so make sure your address read/write location is word aligned, else it will rise an exception.

 

For GPU/DSP :

Internal read/write is only available in longword access (ie 4bytes) : so make sure your address is longword aligned, else it will not doing what you hope it will do.

 

For your sample code :

- Make sure "ENDRAM" is the last longword aligned address of the memory range

- "jump #$xx, (rx)" is not a valid opcode : it should be in the form "jump cc, (rx)" with "cc" a predefined condition code (T, EQ, etc...), or a custom condition code defined with ccdef.

- from the comments, i think that the jump in line 162 should be r12 instead of r13 ;)

- if your gpu code is running in main ram, you will have probably problem with it

- if your gpu code is running in gpu ram, make sure it doesn't run in the range [USERRAM, ENDRAM], else it will erase itself

 

 

  • Like 2
  • Haha 1
Link to comment
Share on other sites

21 hours ago, Zerosquare said:

From your code, I assume you mean main RAM, not GPU/DSP RAM.

 

It's accessible normally with the 68000 ; there's nothing special to do, and no need to write GPU/DSP code for this.

Yes, I am trying to write then read data from Main RAM. Using the 68000 would be easier but when I tried it did not like the ENDRAM value, I though it was becase in the Jaguar.INC file define the user RAM space as...

USERRAM         EQU     $004000 ; Beginning of non-reserved RAM, which then extends to
ENDRAM          EQU     $200000 ; End of DRAM

and with the 68000 was operating on a 16 bit address as when I wrote the code for the 68000 using any address $FFFF would stop my code from running. That is why I tried switching to running the code in GPU RAM, also I though I could not write a 64bit values to RAM using the 68000.

20 hours ago, SCPCD said:

"jump #$xx, (rx)" is not a valid opcode : it should be in the form "jump cc, (rx)" with "cc" a predefined condition code (T, EQ, etc...), or a custom condition code defined with ccdef.

 

Ok, I'll try that, I used a value because the Jump instruciton mentions condition code and in the Conditional Jumps section of SoftRef the "code" given in the table for the condition in the table is a number, not an opcode.

21 hours ago, Seedy1812 said:

The make output is  informing you - Lines 140 to 143 all need know where the code is going to be run as they are all address in memory. This is not the address the code is stored but where its uploaded and ran from. This the reason for ("Warning: Risc code generated with no origin defined )

Sorry, I don't understand that, all I am trying to do there (probably incorrectly) is load RAM addresses for the memory read/write and variables into the GPU registers. Presumably, I need more than the proceeding .GPU statement to inidcate where the code is running. 

Link to comment
Share on other sites

3 hours ago, Stephen Moss said:

Yes, I am trying to write then read data from Main RAM. Using the 68000 would be easier but when I tried it did not like the ENDRAM value, I though it was becase in the Jaguar.INC file define the user RAM space as...

USERRAM         EQU     $004000 ; Beginning of non-reserved RAM, which then extends to
ENDRAM          EQU     $200000 ; End of DRAM

and with the 68000 was operating on a 16 bit address as when I wrote the code for the 68000 using any address $FFFF would stop my code from running. That is why I tried switching to running the code in GPU RAM, also I though I could not write a 64bit values to RAM using the 68000.

What do you mean by 16 bit address  ? The 68000 has a 24bit address bus and a 16 bit data bus and reading bytes can be from any memory address whilst word and long accesses have to be on even memory locations. 

Apart from accessing GPU and DSP memory writing to memory not as 64 bit should not be an issue.

Edited by Seedy1812
Link to comment
Share on other sites

3 hours ago, Stephen Moss said:

Sorry, I don't understand that, all I am trying to do there (probably incorrectly) is load RAM addresses for the memory read/write and variables into the GPU registers. Presumably, I need more than the proceeding .GPU statement to inidcate where the code is running. 

Depending upon if you want to copy the code up into gpu memory to run at max speed then you would give it a gpu org  and then later copy that code up using the blitter before running 

Link to comment
Share on other sites

On 8/22/2022 at 9:07 AM, Stephen Moss said:

Hello,

I have been trying a small test code moving (initially just a number value) into RAM and then read it from RAM and compare to confirm the move operation worked using the 68000, running as a loop to test several RAM locations. I thought the necessary the code would be...

MOVE.L Address, Address register, i.e MOVE $0000FFFF, A1
MOVE #Data, (Address register) , i.e. MOVE $000000FF, (A1)
but it hangs my loop.
 
But then I read that data movement into and out of RAM can only be performed by the GPU & it looks like 68000 cannot address the full RAM memory space anyway so I have tried porting in to GPU
The attached image shows my code and the error messages generated when I make, the error message from SLN/SMAC and RLN/RMAC. The latter gives a little more of a clue indicating a missing closing bracket but I still cannot see where I am going wrong as I cannot see and opening bracket that is missing the corresponding closing bracket.
 
Am I anywhere near the correct code or ridiculously way off?

RAM test code issues 1.PNG

 

Check the alignment, load on 32bit, loadw on 16bit and loadb on 8 bit.

All three CPUs need correct aligned addresses!

Oops, already said many times.

Edited by 42bs
Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...