Thomas Jentzsch Posted November 6, 2023 Share Posted November 6, 2023 2 minutes ago, Al_Nafuur said: It is the next cycles value on the data bus that determines which bank to switch to.. So we have to log the cycle after the poke to $1FE True. Looking forward to your results. 1 Link to comment Share on other sites More sharing options...
Kroko Posted November 6, 2023 Share Posted November 6, 2023 2 hours ago, Thomas Jentzsch said: Let's compare these: # address R/W description --- ------- --- ------------------------------------------------- 1 PC R fetch opcode, increment PC 2 PC R fetch low address byte, increment PC 3 $0100,S R internal operation (predecrement S?) 4 $0100,S W push PCH on stack, decrement S 5 $0100,S W push PCL on stack, decrement S 6 PC R copy low address byte to PCL, fetch high address byte to PCH // JSR case 0x20: { const uInt8 low = peek(PC++, DISASM_CODE); // #2 peek(0x0100 + SP, DISASM_NONE); // #3 poke(0x0100 + SP--, PC >> 8, DISASM_WRITE); // #4 poke(0x0100 + SP--, PC & 0xff, DISASM_WRITE); // #5, 0x1FE access PC = (low | (static_cast<uInt16>(peek(PC, DISASM_CODE)) << 8)); // #6 } Not sure if it is relevant, but lets talk about step #3, especially the "(predecrement S?)" I thought this means that the stack pointer is decremented before it appears on the address bus, but in stella code it seems the original value of SP would appear on the bus ? I don't think the original value of SP ever appears on the bus on the real console. The way I understood above description of the cycles, in step #3 and 4, the wrong addresses would appear on the adress bus of our emulated console... 1 Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted November 6, 2023 Share Posted November 6, 2023 5 minutes ago, Kroko said: I thought this means that the stack pointer is decremented before it appears on the address bus, but in stella code it seems the original value of SP would appear on the bus ? Yes, it looks so. The 650x emulation code is not ours but taken from a very reliable source. 5 minutes ago, Kroko said: I don't think the original value of SP ever appears on the bus on the real console. It seems that step #3 is not 100% clear. 5 minutes ago, Kroko said: The way I understood above description of the cycles, in step #3 and 4, the wrong addresses would appear on the address bus of our emulated console... If that would be the case, Stella would read the wrong values, no? Then it wouldn't work at all. At least in step #4 it has to be correct one. Link to comment Share on other sites More sharing options...
Kroko Posted November 6, 2023 Share Posted November 6, 2023 2 minutes ago, Thomas Jentzsch said: If that would be the case, Stella would read the wrong values, no? Then it wouldn't work at all. At least in step #4 it has to be correct one. Yes I agree, but it is confusing ... especially the part with (predecrement S?) ... Link to comment Share on other sites More sharing options...
+Al_Nafuur Posted November 6, 2023 Author Share Posted November 6, 2023 Here is the log with the next peek/poke after a $1FE access (first value is PC second the R/W value): Spoiler poke 0x1FE 13 peek lastAccessWasFE 61453 : 208 peek 0x1FE 13 peek lastAccessWasFE 510 : 13 poke 0x1FE 23 peek lastAccessWasFE 61463 : 209 peek 0x1FE 23 peek lastAccessWasFE 510 : 23 poke 0x1FE 26 peek lastAccessWasFE 61466 : 208 peek 0x1FE 26 peek lastAccessWasFE 510 : 26 poke 0x1FE 40 peek lastAccessWasFE 61480 : 208 peek 0x1FE 40 peek lastAccessWasFE 510 : 40 poke 0x1FE 104 peek lastAccessWasFE 61544 : 211 poke 0x1FE 13 peek lastAccessWasFE 61453 : 208 peek 0x1FE 13 peek lastAccessWasFE 510 : 13 poke 0x1FE 23 peek lastAccessWasFE 61463 : 209 peek 0x1FE 23 peek lastAccessWasFE 510 : 23 poke 0x1FE 26 peek lastAccessWasFE 61466 : 208 peek 0x1FE 26 peek lastAccessWasFE 510 : 26 poke 0x1FE 40 peek lastAccessWasFE 61480 : 208 peek 0x1FE 40 peek lastAccessWasFE 510 : 40 poke 0x1FE 104 peek lastAccessWasFE 61544 : 211 peek 0x1FE 104 peek lastAccessWasFE 510 : 104 poke 0x1FE 136 peek lastAccessWasFE 61576 : 210 peek 0x1FE 136 peek lastAccessWasFE 510 : 136 poke 0x1FE 105 peek lastAccessWasFE 62569 : 211 peek 0x1FE 105 peek lastAccessWasFE 510 : 105 poke 0x1FE 220 peek lastAccessWasFE 62684 : 254 peek 0x1FE 220 peek lastAccessWasFE 510 : 220 poke 0x1FE 220 peek lastAccessWasFE 62684 : 254 peek 0x1FE 220 peek lastAccessWasFE 510 : 220 poke 0x1FE 220 peek lastAccessWasFE 62684 : 254 peek 0x1FE 220 peek lastAccessWasFE 510 : 220 poke 0x1FE 220 peek lastAccessWasFE 62684 : 254 peek 0x1FE 220 peek lastAccessWasFE 510 : 220 poke 0x1FE 220 peek lastAccessWasFE 62684 : 254 peek 0x1FE 220 peek lastAccessWasFE 510 : 220 poke 0x1FE 220 peek lastAccessWasFE 62684 : 254 peek 0x1FE 220 peek lastAccessWasFE 510 : 220 poke 0x1FE 244 peek lastAccessWasFE 62708 : 254 peek 0x1FE 244 peek lastAccessWasFE 510 : 244 poke 0x1FE 5 peek lastAccessWasFE 62981 : 211 peek 0x1FE 5 peek lastAccessWasFE 510 : 5 poke 0x1FE 65 peek lastAccessWasFE 63041 : 211 peek 0x1FE 65 peek lastAccessWasFE 510 : 65 poke 0x1FE 68 peek lastAccessWasFE 63044 : 212 peek 0x1FE 68 peek lastAccessWasFE 510 : 68 poke 0x1FE 118 peek lastAccessWasFE 64118 : 212 peek 0x1FE 118 peek lastAccessWasFE 510 : 118 poke 0x1FE 23 peek lastAccessWasFE 61463 : 209 peek 0x1FE 23 peek lastAccessWasFE 510 : 23 poke 0x1FE 26 peek lastAccessWasFE 61466 : 208 peek 0x1FE 26 peek lastAccessWasFE 510 : 26 poke 0x1FE 40 peek lastAccessWasFE 61480 : 208 poke 0x1FE 105 peek lastAccessWasFE 54377 : 211 peek 0x1FE 105 peek lastAccessWasFE 510 : 105 poke 0x1FE 53 peek lastAccessWasFE 65534 : 200 poke 0x1FE 78 poke lastAccessWasFE 509 : 205 poke 0x1FE 205 poke lastAccessWasFE 509 : 53 poke 0x1FE 13 peek lastAccessWasFE 61453 : 208 peek 0x1FE 13 peek lastAccessWasFE 510 : 13 poke 0x1FE 23 peek lastAccessWasFE 61463 : 209 peek 0x1FE 23 peek lastAccessWasFE 510 : 23 poke 0x1FE 26 peek lastAccessWasFE 61466 : 208 peek 0x1FE 26 peek lastAccessWasFE 510 : 26 poke 0x1FE 40 peek lastAccessWasFE 61480 : 208 peek 0x1FE 40 peek lastAccessWasFE 510 : 40 poke 0x1FE 104 peek lastAccessWasFE 61544 : 211 peek 0x1FE 104 peek lastAccessWasFE 510 : 104 Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted November 6, 2023 Share Posted November 6, 2023 4 minutes ago, Kroko said: Yes I agree, but it is confusing ... especially the part with (predecrement S?) ... Agreed. The predecrement S makes no sense, since the value of S is used afterwards. However, the 650x does these dummy peeks while doing internal calculations. So I wonder what is done there. Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted November 6, 2023 Share Posted November 6, 2023 poke 0x1FE 104 peek lastAccessWasFE 61544 : 211 ($f068 : $d3) That's the last byte of the JSR, we need the byte after the JSR. I suppose there are three possible outcomes: value from current bank ($a5) value from new bank ($0a) random value Link to comment Share on other sites More sharing options...
+Al_Nafuur Posted November 6, 2023 Author Share Posted November 6, 2023 12 minutes ago, Thomas Jentzsch said: poke 0x1FE 104 peek lastAccessWasFE 61544 : 211 ($f068 : $d3) That's the last byte of the JSR, we need the byte after the JSR. No. The value is correct the high byte (bit5) of the address determines the bank. Link to comment Share on other sites More sharing options...
JetSetIlly Posted November 6, 2023 Share Posted November 6, 2023 10 minutes ago, Thomas Jentzsch said: Agreed. The predecrement S makes no sense, since the value of S is used afterwards. However, the 650x does these dummy peeks while doing internal calculations. So I wonder what is done there. FWIW, I believe the cycle sequence for JSR is as follows. I don't believe there are any dummy peeks. Address bus Data bus 1 read opcode PC opcode 2 read lo byte of operand PC lo operand byte 3 push hi byte of PC to stack. decrement SP SP (PC >> 8) & 0x00ff 4 push lo byte of PC to stack. decrement SP SP PC & 0x00ff 5 read hi byte of operand PC hi operand byte 6 load pc - - Link to comment Share on other sites More sharing options...
+Al_Nafuur Posted November 6, 2023 Author Share Posted November 6, 2023 what confuses me is the 1FE access with the value 53 shortly before the crash: poke 0x1FE 53 it seems to be done from address 65534 ($FFFD !). After this access there are a few unusual accesses from 509 ($1FD ) Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted November 6, 2023 Share Posted November 6, 2023 8 minutes ago, Al_Nafuur said: No. The value is correct the high byte (bit5) of the address determines the bank. Yes, but I would like to know what happens directly after the switch. Link to comment Share on other sites More sharing options...
+Al_Nafuur Posted November 6, 2023 Author Share Posted November 6, 2023 28 minutes ago, Thomas Jentzsch said: Yes, but I would like to know what happens directly after the switch. 🤔 If the bank switching was successful the PC will continue at the target address in new bank, if not it will continue at the target address in the old bank.. Link to comment Share on other sites More sharing options...
+Al_Nafuur Posted November 6, 2023 Author Share Posted November 6, 2023 34 minutes ago, Al_Nafuur said: what confuses me is the 1FE access with the value 53 shortly before the crash: poke 0x1FE 53 it seems to be done from address 65534 ($FFFD !). After this access there are a few unusual accesses from 509 ($1FD ) 🤔 53 (0x35) doesn't occurs once in the bin file of Decathlon NTSC. Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted November 6, 2023 Share Posted November 6, 2023 6 minutes ago, Al_Nafuur said: 🤔 53 (0x35) doesn't occurs once in the bin file of Decathlon NTSC. Maybe the bank switching is in progress? Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted November 6, 2023 Share Posted November 6, 2023 25 minutes ago, Al_Nafuur said: 🤔 If the bank switching was successful the PC will continue at the target address in new bank, if not it will continue at the target address in the old bank.. And if it is ongoing it will return "random" values. Link to comment Share on other sites More sharing options...
+Al_Nafuur Posted November 6, 2023 Author Share Posted November 6, 2023 9 minutes ago, Thomas Jentzsch said: Maybe the bank switching is in progress? No this is the value written to $1FE one cycle before the bank switching is supposed to happen. Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted November 6, 2023 Share Posted November 6, 2023 6 minutes ago, Al_Nafuur said: No this is the value written to $1FE one cycle before the bank switching is supposed to happen. Yes, and if the bankswitch is in progress (= too early), then the value is undetermined. Link to comment Share on other sites More sharing options...
+Al_Nafuur Posted November 6, 2023 Author Share Posted November 6, 2023 2 minutes ago, Thomas Jentzsch said: Yes, and if the bankswitch is in progress (= too early), then the value is undetermined. If it is from an earlier bankswitching "still in progress" then it can't be this single value. There must be a whole chain of "undetermined" values that lead to a write to exactly $1FE. That's very very unlikely.. Link to comment Share on other sites More sharing options...
JetSetIlly Posted November 6, 2023 Share Posted November 6, 2023 I may have missed you mentioning it but do Tigervision, 3e+, and Superbank cartridges work? 1 Link to comment Share on other sites More sharing options...
+Al_Nafuur Posted November 6, 2023 Author Share Posted November 6, 2023 2 minutes ago, JetSetIlly said: I may have missed you mentioning it but do Tigervision, 3e+, and Superbank cartridges work? good point! 3F is tested on the PlusCart working, but 3E+ is not on the list and untested. Do you have some example ROMs? 3F Tigervision River Patrol OK untested untested untested (no cart) Link to comment Share on other sites More sharing options...
+MarcoJ Posted November 6, 2023 Share Posted November 6, 2023 30 minutes ago, Al_Nafuur said: but 3E+ is not on the list and untested. My 3E+ RPG demo works OK (via PlusCart). Worked OK on the nop delay system too. The scheme's writes to the unused TIA addresses are supported fine with the CartridgePort driver. 16CHAR_NTSC_20210603.bin 1 Link to comment Share on other sites More sharing options...
+MarcoJ Posted November 6, 2023 Share Posted November 6, 2023 The Zelda 3E+ game runs but goes into the menu continuously (via PlusCart). IMG_7132_x264.mp4 1 Link to comment Share on other sites More sharing options...
+Al_Nafuur Posted November 7, 2023 Author Share Posted November 7, 2023 14 minutes ago, MarcoJ said: The Zelda 3E+ game runs but goes into the menu continuously. IMG_7132.mov wasn't that an issue with the PlusCart/UnoCart on real hardware too? Link to comment Share on other sites More sharing options...
+MarcoJ Posted November 7, 2023 Share Posted November 7, 2023 5 minutes ago, Al_Nafuur said: wasn't that an issue with the PlusCart/UnoCart on real hardware too? Wasn't for me. Not sure about others. I can get it working fine on my Atari 7800 and 2600 JR consoles. Link to comment Share on other sites More sharing options...
JetSetIlly Posted November 7, 2023 Share Posted November 7, 2023 7 hours ago, Al_Nafuur said: good point! 3F is tested on the PlusCart working, but 3E+ is not on the list and untested. Do you have some example ROMs? 3F Tigervision River Patrol OK untested untested untested (no cart) I'd like to see Circus Convoy working. There's no reason why it shouldn't because it's no more complicated than Tigervision but it would be a useful test Link to comment Share on other sites More sharing options...
Recommended Posts