Jump to content

Open Club  ·  76 members

StellaRT
IGNORED

Community-Built Unnamed 1970's Video Game Console-Compatible System (WIP)


Al_Nafuur

Recommended Posts

The first two lines of the CSV file contain a short description of what is to be found in the rest of the file.
"SamplePeriod" is the time distance between two measurements. For the case of 100MHz its "0.00000001" which is 10 Nanoseconds. So every sample in the file represents 10ns of time.
"TriggerSample" is the Sample that the logic analyzer started its measurement on. For example "158" that would mean sample 158 is the one where the trigger condition was true and the logic analyzer started to record the bus.

Then in the following part of the file from Line 3 of the CSV the recorded data is found:

Column 1 is the sample number: You can calculate from the "sample period" and the "SampleNumber" at what time the measurement has been made.
So if you see 0 that means it is the first measurement at T= 0ns and if you see a different value, like 31 then its the 31st measurement that the logic analyzer made after 31* 10ns = 310 ns.
In the end this means that the first column is the time column. It is just not the time but the sample number.

If samples are missing, that means that there was no change for the samples in between. For example if you see 87 and next sample is 115 then it means that the content of sample 87-114 were identical and that the bus changed at sample 115.

Column 2 is the Address on the VCS Address bus at the time of the sample
Column 3 is the Data on the VCS Databus at the time of the sample

Lets check the samples around the reset vector:


"118","1FFCh","00h"
"121","1FFCh","79h"
"122","1FFCh","FFh"
"126","1FBCh","4Eh"
"127","1FFCh","4Eh"
"203","1FFDh","4Eh"
"207","1FFDh","FFh"
"211","1FFDh","CCh"
"284","1FCCh","CCh"
"285","0F0Ch","CCh"
"286","080Ch","CCh"
"287","000Ch","CCh"

 

Here you can watch how we needed a few nanoseconds to get the address and databus stable:

T=118*10ns = 1,180us we first see 1FFC on the Address Bus
during samples 121-122 the Databus tries to stabilize but unfortunately at sample 126 the address bus falls back to address "1FBC" ..

one sample later at T=127*10ns = 1.27us we finally see a stable 1FFC on the address bus and "4E" on the databus.
the bus is stable till sample 203, where the address lines change to 1FFD. Thats at 2,03 us . So we had stable address and data for  760 ns.
it takes until sample 211 before the data stabilzes at "CC" 2,11 us


I hope you are now not more confused than before 😁

Link to comment
Share on other sites

One thing that I need to work on is my breadboard setup. The logs are only as reliable as by breadboard setup. While I made sure that the game is running fine on the console while I did the measurement, there are also wires to the logic analyzer and this is a weak point.
If I have a sporadically loose connection or something of one of the lines, then the logs may be unreliable. So I will try to solder the connections to avoid such issues ...

  • Like 1
Link to comment
Share on other sites

Here is a simple FE Test ROM (following @Al_Nafuur's suggestion). Green means everything is fine. When the screen turns red and white, an error has happened. The error is displayed using the playfield. 

 

If PF1 is shows red, then a JSR error happened, if PF2 is set, a RTS error happened. The set bits indicate for which routine, "....X." means Sub1, "...X.." means Sub2, "...XX." means Sub3. The attached screenshot shows that "JSR Sub3" failed to switch bank (note that the bits are reversed for PF1).

 

Press FIRE to continue testing.

test_48.png

I could make it nicer, but I think it does the job.

FE_Test_V1.bin

Edited by Thomas Jentzsch
  • Like 3
Link to comment
Share on other sites

8 minutes ago, Kroko said:

To test this on the PlusCart, can i just upload it or do i need to tell the cart that this is FE ?

I added one string from Decathlon used by Stella to detect FE. Maybe the PlusCart uses the same too.

8 minutes ago, Kroko said:

When I just upload it, it looks like this on my TV:

 

20231111_161507.jpg

My code doesn't do any VBLANK, only VSYNC. Could that cause the trouble?

Link to comment
Share on other sites

3 minutes ago, Thomas Jentzsch said:

My code doesn't do any VBLANK, only VSYNC. Could that cause the trouble?

What you see in my image is what happens on TV when I upload the ROM to a plus cart and run it on a real 2600 Junior.
In case FE is detected corretly, my PAL TV does not seem to be happy with it.

"Why" ... you are the expert here I would say 🤣

Edited by Kroko
Link to comment
Share on other sites

Meanwhile I made a new log of a real Decathlon Cartridge running on a Atari 2600 Junior. I noticed that Decathlon does not seem to have a valid reset vector in both banks, so I changed the trigger to $1000 which is, where the good reset vector should point to.
Even if the Cartridge starts up in the wrong bank, it somehow recovers from that.

I am not so much interested in this part, so here are the first 295 microseconds after the "real" start at $1000.

Next step is to search for JSR and RTS and analyze how exactly the bus looks like on the real thing. Then compare it to what the emulated one does ...

 

DecathlonPALCartridge_2600Junior_100MHz.CSV

  • Like 1
Link to comment
Share on other sites

3 minutes ago, Kroko said:

I noticed that Decathlon does not seem to have a valid reset vector in both banks, so I changed the trigger to $1000 which is, where the good reset vector should point to.
Even if the Cartridge starts up in the wrong bank, it somehow recovers from that.

I wondered about that too: It seems like pure luck. The code in the 2nd bank has no vector pointing to ROM. In my tests it always lands in RAM and there randomly modifies the stack. Eventually it hits $fe and (for whatever reason :? ) jumps to $f000 in the 1st bank.

Link to comment
Share on other sites

13 minutes ago, Thomas Jentzsch said:

I wondered about that too: It seems like pure luck. The code in the 2nd bank has no vector pointing to ROM. In my tests it always lands in RAM and there randomly modifies the stack. Eventually it hits $fe and (for whatever reason :? ) jumps to $f000 in the 1st bank.

Yea, a miracle :) ...but thats not interesting to us I guess. So lets concentrate on the part after $1000

Link to comment
Share on other sites

42 minutes ago, Thomas Jentzsch said:

If wonder why it takes a few seconds.

Maybe only one second. But it looks like that a few bank switchings (including RTS?) worked.

 

That's why I wanted a counter. We don't need to show the counter (and the error Nr.) at the error screen, if we store them in RAM we can see them in the debugger if the ROM continues to run. The problem for me is that if the ROM in RTstella "crashes" then Stella crashes too and I can't use the debugger anymore (I have to use "kill -9" to end Stella manually then).

 

@Thomas Jentzsch can you post the asm source code too?

 

Link to comment
Share on other sites

46 minutes ago, Al_Nafuur said:

Maybe only one second. But it looks like that a few bank switchings (including RTS?) worked.

 

That's why I wanted a counter. We don't need to show the counter (and the error Nr.) at the error screen, if we store them in RAM we can see them in the debugger if the ROM continues to run. The problem for me is that if the ROM in RTstella "crashes" then Stella crashes too and I can't use the debugger anymore (I have to use "kill -9" to end Stella manually then).

The V1 ROM should not crash.

46 minutes ago, Al_Nafuur said:

@Thomas Jentzsch can you post the asm source code too?

Sure. V2 seems to have a bug. So I post both versions.FE_Test_01.asmFE_Test_02.asm

  • Like 1
Link to comment
Share on other sites

Here is V3. I did not find the bug in V3, maybe someone can provide some info what exactly happens?

 

Anyway, V3 stores the first 120 bugs in RAM. The first nibble describes the opcode (1= JSR, 2 = RTS), the second nibble the subroutine (1..3). @Al_Nafuuris that what you are looking for? 

FE_Test_V3.bin

  • Like 1
Link to comment
Share on other sites

17 minutes ago, Thomas Jentzsch said:

Here is V3. I did not find the bug in V3, maybe someone can provide some info what exactly happens?

 

Anyway, V3 stores the first 120 bugs in RAM. The first nibble describes the opcode (1= JSR, 2 = RTS), the second nibble the subroutine (1..3). @Al_Nafuuris that what you are looking for? 

FE_Test_V3.bin 8 kB · 2 downloads

Yes, except for the counter that counts the good loops/successfull bank switchings.

 

After about 2mins there were ~40 error entries in RAM, but then the ROM crashed:

2023-11-11-193523_1920x1080_scrot.thumb.png.6b9992d5588ece230913263932524121.png

 

 

Link to comment
Share on other sites

4 minutes ago, Thomas Jentzsch said:

Can you post the RAM before the crash?

No screenshot. I am about to make a new one, but the crash is always faster than me..

 

5 minutes ago, Thomas Jentzsch said:

 This is nothing I can catch.

Since JSR seems to switch banks more reliable you could use a JSR  MainLoop and "clear" the stack pointer at the beginning of the main loop.

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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