iss wrote: ↑Sat Nov 30, 2024 10:37 pm
- What is the full range of addresses that ULA uses to generate video?
- What addresses reads ULA during the green marked times (i.e. front/back porch and blanking):
For full deep dive on ULA operation, the authoritive reference is MikeB's brilliant work
https://oric.signal11.org.uk/html/ula-dieshot.htm
Quick recap for the public. During each Oric system clock cylces, there are 3 DRAM accesses, 2 used by the ULA and 1 for the CPU. The ULA uses the first access video memory scanline by scanline. The second is used to fetch the actual mono-chrome 6 pixels to output.
In text mode, the first access when identified as an ASCII value is used to generate the address for the second access to fetch one byte from the character set and output it. This is repeated for each scanline, so in text mode the same text line is read for each scanline and the right slice of character set data fetched in the second cycle.
In hires mode, the same address is generated for both accesses to the DRAM. The first access is only used to capture attributes and the second to fetch the same data again and use as pixel data if it wasn't attributes.
Each scanline read is 64 cycles, 40 of which are used to with active video data, the others happen anyway to give the HBLANK and HSYNC timing. You would think that it starts e.g. at 0xA000 for the first hires scanline and runs through 0xA03F before switching to the next, but the actual row shift happens at cycle 50, so it might be better to think of it as a wrapping 64 address window with 14 cycles of pre-scanline accesses, 40 cycles of scanline accesses and then 10 cycles of post-scanline accesses. So the first scanline in hires would do:
Code: Select all
Pre A032-A03F
Scan A000-A027
Post A028-A031
Then the windown advances by 40 so the next scanline would do:
Code: Select all
Pre A05A-A067
Scan A028-A04F
Post A050-A059
Note that these are not tightly connected to front- or back-porch so I don't have a good graphical represenation for you yet.
So hires is pretty straight forward. For text mode, which is also used at the end of hires, it's basically the same but in the text video memory range, until you get to the end of the video memory (VBLANK), and the optimisations they did in the ULA makes all kinds of strange address ranges appear because it was "don't care" to the designers. To get a list of those addresses I refer to my previous post.
https://forum.defence-force.org/viewtop ... 109#p31109
This might need to be expanded in a knowledge article or something. Guidance is welcome.
iss wrote: ↑Sat Nov 30, 2024 10:37 pm
The memory refresh of DRAMs uses rows (i.e. during RAS all low 8-bits $xx00-$xxFF should appear successively on the '257-muxer inputs) but what range is used during CAS?
The ULA always runs RAS as it plows through the addresses for a frame. The addresses are the same, the question is only if CAS is suppressed or no, if data is actually fetched. CAS is suppressed if the ULA address crosses into ROM space, or for the second access if the first is an attribute. There is no special handling for DRAM refresh, it is just a designed in side-effect of running the DRAM accesses beyond the actual required data.
When it is in HBLANK or VBLANK range, it just ignores the data it fetches.
iss wrote: ↑Sat Nov 30, 2024 10:37 pm
To guess the video mode I think we need to snoop on 6502 writes to the video memory and catch the mode attributes.
No, we already have video mode detection working with the current ROM and ULA snooping. When you suspend an application there is debug info in the top right corner of the ROM UI telling you if it found T50, T60, H50 or H60. Now, @ibisum might throw a wrench in that detection with his application, but for others it seems to be working. The thread start was basically asking if we could find an ultimate pattern for that detection that could work for all. We have one better for VSYNC, but not for mode detection yet.
Dbug wrote: ↑Sun Dec 01, 2024 8:30 am
It's true that the vsync does not have to work during the game: What Chema did with Oricium is that he does the vsync at the start, and then sets-up the VIA so it stays in sync (I guess that's assuming one does not incorrectly changes frequency by mistake, then all bets are off).
The only complication is that using LOCI to suspend and resume such applications will unlink and skrew up that timing and I don't know a good way of fixing it. Perhaps there is some protocol we can agree on for the VIA and timers to make it work, but if not I can only pleed for new applications to allow the user to resync at some point.
Dbug wrote: ↑Sun Dec 01, 2024 8:30 am
Bonus question: I assume the ULA does not read past BFDF? (It could have been reading BFE0-C000 and discard the result)
Oh it reads all the way but always discards data it doesn't need. When it generates addresses in the ROM (> 0xC000) range it does however turn off CAS and does not active the DRAM for the read.