+wavemotion Posted January 4, 2023 Share Posted January 4, 2023 (edited) So I'm at the point in my new DS/DSi emulator for the TI99/4a that I want to load the C/D files as used by Atarisoft and a few other TI carts. My original understanding from reading piles of forum posts here on AA (thanks guys!) is that the 8K C and 8K D are both mapped to >6000 but different banks selected by writes (of any data) to >6000 and >6002. I'm further to understand that it's internally identical to the Classic99 Format '9' (inverted) - though I've tried both ways with no success. The game launches but crashes pretty fast. I've had no problems (so far) with more traditional C/G files. Okay... so my brain is not grokking this and I need a concrete layout example. Let's say I have a hypothetical game with a C and a D (and no G - not important for this scenario). Let's call the two 8K files GameC.bin and GameD.bin For the sake of working this out visually in my head... let's assume the first 4K of GameC.bin is filled with hex C1 bytes and the last 4K of GameC.bin is filled with hex C2 bytes. Similarly, GameD.bin has 4K of D1 bytes followed by 4K of D2 bytes. Here are my assumptions - obviously I've got something wrong: When the system comes up, the 8K CPU Memory at >6000 will contain 4K of C1 followed by 4K of C2 (bank 0 is installed - this is the 'C' rom) If the program writes memory >6002 it will swap in the 'D' rom and we now have 4K of D1 followed by 4K of D2 (bank 1 is installed - this is the 'D' rom). If the program writes memory >6000 it will swap in the 'C' rom and we now have 4K of C1 followed by 4K of C2 (bank 0 is installed - this is the 'C' rom again). I've tried to only swap out only the 4K bank at >7000 and I've tried the inverse (i.e. bank 1 or the 'D' rom installed at startup) and I'm growing more perplexed so I thought I'd try to ask some simple questions: In my example above, what would be the initial C1/C2/D1/D2 layout at >6000 before any banking writes take place? What happens when we write >6000? >6002? Thanks much in advance! Edited January 4, 2023 by llabnip Fix typos... 2 Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted January 4, 2023 Share Posted January 4, 2023 35 minutes ago, llabnip said: In my example above, what would be the initial C1/C2/D1/D2 layout at >6000 before any banking writes take place? The ROM state of ROM-only cartridges is not guaranteed at power-up. This is why most ROM-only cartridges have startup code in all banks that switches to the correct bank. 35 minutes ago, llabnip said: What happens when we write >6000? >6002? With a non-inverting latch, writing to >6000 switches to bank 0 and writing to >6002, to bank 1. With an inverting latch for a 16-KiB ROM*, writing to >6000 switches to bank 1 and writing to >6002, to bank 0. ...lee _________________ *The reason I qualified the inverted ROM is that, for an inverting latch, writing to the bank-changing locations switches banks from the high end, i.e., if you had a 16-KiB ROM on a 32-KiB EPROM, the code would be necessarily duplicated to fill the EPROM and writing to >6000 switches to bank 3 (the highest bank) and writing to >6002, to bank 2. 2 1 Quote Link to comment Share on other sites More sharing options...
+wavemotion Posted January 4, 2023 Author Share Posted January 4, 2023 Thanks @Lee Stewart Let me ask a follow-up clarifying questions so as to leave no doubts in my head: Is the C rom 'bank 0' and the D rom 'bank 1'? Are the older C/D games (e.g. DigDug, Donkey Kong, etc.) considered inverting or non-inverting? According to one post they are type '9' which implies inverting... Is the entire 8K swapped in/out on a bank swap? i.e. the only possibilities would be C1/C2 or D1/D2 in the 8K memory region. Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted January 4, 2023 Share Posted January 4, 2023 1 hour ago, llabnip said: Is the C rom 'bank 0' and the D rom 'bank 1'? Others ( @Tursi, @acadiel, @Ksarul, ... ) will know better than I, but I think that is correct for a non-inverting latch. 1 hour ago, llabnip said: Are the older C/D games (e.g. DigDug, Donkey Kong, etc.) considered inverting or non-inverting? According to one post they are type '9' which implies inverting... I defer to others on this one. 1 hour ago, llabnip said: Is the entire 8K swapped in/out on a bank swap? i.e. the only possibilities would be C1/C2 or D1/D2 in the 8K memory region. When writing to >6000, >6002<, ..., swapping is, indeed, for the entire 8 KiB. I think there are other ROM-write addresses for swapping only the upper 4 KiB, but I have not used them and am unsure. ...lee 1 Quote Link to comment Share on other sites More sharing options...
HOME AUTOMATION Posted January 4, 2023 Share Posted January 4, 2023 DigDug, appears to be non-inverted. Donkey Kong, is just a mess. Paging using >6020, >6022. But also non-inverted. 1 Quote Link to comment Share on other sites More sharing options...
HOME AUTOMATION Posted January 4, 2023 Share Posted January 4, 2023 When in RAM mode, the FinalGROM 99, uses separate upper, and lower bank, switching. The upper banks, being switched by using addresses going upward from >6800. 1 Quote Link to comment Share on other sites More sharing options...
+wavemotion Posted January 4, 2023 Author Share Posted January 4, 2023 41 minutes ago, HOME AUTOMATION said: DigDug, appears to be non-inverted. Donkey Kong, is just a mess. Paging using >6020, >6022. But also non-inverted. Holy crap! That's it... that fixes DK for my emulator! This memory switching is nutbar 2 Quote Link to comment Share on other sites More sharing options...
+acadiel Posted January 4, 2023 Share Posted January 4, 2023 Most DataBiotics 16K games were 9 (inverted) because they were 16K and used 74LS379's. The 379 paged in the D (8K bank) first then the C (8K bank) into >6000->7FFF. This was a rudimentary form of copyright protection by DBT. (And later forms of copyright protection for larger 32K and 64K DBT carts such as Desktop Publisher, Red Baron Flight Simulator and TI Workshop used CRU bank switching with a PAL. These have all been converted to the "standard write to ROM" bank switching method by community members.) Most other 16K ROM games (Atari, etc.) were non inverted; C then D. If you find an inverted Atari game, for example, it was likely made for my first 16K cart board with the 74LS379 (there's about 750 of them out in the wild.) The image can be fixed by putting the 8192 bytes at the beginning of the file at the end of the file with a hex editor (for binary 16K files) or just renaming the .C and .D files (for 8K files). My and @Ksarul's later boards (64K, 512K, 2MB) with the 74LS378 and 74LS377 were not inverted. C then D. We didn't come up with a naming scheme for more than two banks. (You'd eventually run into .G which is a legacy GROM extension.) Hope this helps! 2 Quote Link to comment Share on other sites More sharing options...
+wavemotion Posted January 4, 2023 Author Share Posted January 4, 2023 (edited) Thanks guys! Immensely helpful - and now Donkey Kong and Dig Dug and a few others are working great... Moon Patrol starts up.. music plays and then crashes using both inverted and non-inverted. I'll debug that one more. Is there something easy I can scan for in the actual ROMs themselves to determine if inverted/non? Edited January 4, 2023 by llabnip 2 Quote Link to comment Share on other sites More sharing options...
HOME AUTOMATION Posted January 4, 2023 Share Posted January 4, 2023 ...something silly I did. 2 Quote Link to comment Share on other sites More sharing options...
Tursi Posted January 4, 2023 Share Posted January 4, 2023 If it's using the C/D scheme, then they should all be the same order, but damned if I can ever remember which is which. The cartridges bank using the second-to-least significant address bit, so make sure you are treating /all/ ROM writes as bank switches and just masking out the bit(s) you need. If you don't know whether a particular set of ROMs are inverted or not, there is no way to tell. You have to just try it. That's why the metadata is important. But many modern carts have discarded it - you can usually assume modern files that don't otherwise say are non-inverted. 3 1 Quote Link to comment Share on other sites More sharing options...
+Ksarul Posted January 5, 2023 Share Posted January 5, 2023 6 hours ago, acadiel said: If you find an inverted Atari game, for example, it was likely made for my first 16K cart board with the 74LS379 (there's about 750 of them out in the wild.) My and @Ksarul's later boards (64K, 512K, 2MB) with the 74LS378 and 74LS377 were not inverted. C then D. We didn't come up with a naming scheme for more than two banks. (You'd eventually run into .G which is a legacy GROM extension.) One general note on the 16K Inverted Bank boards--these boards were extended to 64K and later to 128K, and remain as 74LS379 Inverted boards with a lot more banks. The Black Boards are the latest iteration of these, and there are about 800 of the Black boards in the wild now, in addition to the 16K and 64K boards mentioned by @acadiel. The 512K Red Boards use the non-inverted 74LS378 (I've built close to 1,000 of these) and the 2M Yellow Boards use the non-inverted 74LS377 (about 300 of these are in the wild). There is also a nice bank inversion tool from @Asmusr that lets you switch your files between the two formats (the tool works to switch files in either direction, and I've attached it here). bankinvert.zip 3 Quote Link to comment Share on other sites More sharing options...
+wavemotion Posted January 5, 2023 Author Share Posted January 5, 2023 Thanks guys - I've got most of it working now thanks to your insights! Moon Patrol ended up being an illegal opcode which I just vectored off into space rather than handle as a delay. So I next wanted to try some of the bigger bankswitching carts... and found out that many of them require the 32K RAM expansion. That seemed simple enough - so I marked off 8K at >2000 and 24K at >A000 as 8-bit RAM and cleared RAM to start (0x00 values in all RAM locations) and still the games say 'Requires 32K' (or similar... some just crash). So there must be something more than just providing the RAM as writable? Is there some memory location or other setup that I need to perform so that the carts detect the 32K RAM? I had mostly assumed that a cart would just try writing/reading to some expansion address to see if it responds. Quote Link to comment Share on other sites More sharing options...
Asmusr Posted January 5, 2023 Share Posted January 5, 2023 2 hours ago, llabnip said: So there must be something more than just providing the RAM as writable? Is there some memory location or other setup that I need to perform so that the carts detect the 32K RAM? I had mostly assumed that a cart would just try writing/reading to some expansion address to see if it responds. There is nothing more to it than that. 2 Quote Link to comment Share on other sites More sharing options...
+wavemotion Posted January 5, 2023 Author Share Posted January 5, 2023 3 minutes ago, Asmusr said: There is nothing more to it than that. Okay... well, that at least confirms that it's just a silly bug on my side! I'll keep digging. Quote Link to comment Share on other sites More sharing options...
Tursi Posted January 5, 2023 Share Posted January 5, 2023 6 hours ago, llabnip said: Thanks guys - I've got most of it working now thanks to your insights! Moon Patrol ended up being an illegal opcode which I just vectored off into space rather than handle as a delay. Ah, yes, I can confirm that Moon Patrol does indeed have that. Slymoids also uses the "illegal" IDLE instruction in its main loop. Off the top of my head those are the main two commercial ROM weirdies. 4 Quote Link to comment Share on other sites More sharing options...
+wavemotion Posted January 5, 2023 Author Share Posted January 5, 2023 (edited) Holy crap... Slymoids is the OTHER file I'm having trouble with. I was afraid to keep going back to the well asking for help. I'll add you to my credits of thanks I did find my 32K bug... that's all working. Edited January 5, 2023 by llabnip 2 Quote Link to comment Share on other sites More sharing options...
+mizapf Posted January 5, 2023 Share Posted January 5, 2023 GUARDIAN also makes use of IDLE: A500: SETO R8 A502: LIMI >0002 A506: IDLE A508: LIMI >0000 A50C: LI R1,>A562 A510: BL *R11 You notice it by the LED of the PEB which is dimmed down a bit. guardian.dsk 2 Quote Link to comment Share on other sites More sharing options...
Tursi Posted January 6, 2023 Share Posted January 6, 2023 I hadn't even heard of Guardian before. Ah, Rip-off clone. Nice Quote Link to comment Share on other sites More sharing options...
retrodroid Posted January 6, 2023 Share Posted January 6, 2023 (edited) 17 hours ago, Tursi said: I hadn't even heard of Guardian before. Ah, Rip-off clone. Nice You mean, a Rip-off rip-off? or maybe Rip-off2? Couldn't resist... 😀 Edited January 6, 2023 by retrodroid 1 Quote Link to comment Share on other sites More sharing options...
+mizapf Posted January 6, 2023 Share Posted January 6, 2023 18 hours ago, Tursi said: I hadn't even heard of Guardian before. Ah, Rip-off clone. Nice It's quite a while ago, but I proposed it in the High Score competition: Guardian means a lot of fun, especially in higher rounds, where you feel like on a special sale day in your discounter shop. 1 Quote Link to comment Share on other sites More sharing options...
HOME AUTOMATION Posted January 6, 2023 Share Posted January 6, 2023 🚔 1 Quote Link to comment Share on other sites More sharing options...
Tursi Posted January 8, 2023 Share Posted January 8, 2023 On 1/6/2023 at 2:01 PM, mizapf said: It's quite a while ago, but I proposed it in the High Score competition: Guardian means a lot of fun, especially in higher rounds, where you feel like on a special sale day in your discounter shop. Hehe, I can't keep up with that contest, you guys are all way too good. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.