steve3000 wrote:It's quite an easy fix, but we need to keep track of the screen width in pixels from the difference between the values written to HDSR and HDER. Is there a variable to hold this value? We can reset it at each mode change to the default for that mode, then update this along with HDWR, every time HDSR and HDER are written.
Just tried an old 1Mb VRAM stick for fun - and the display break-up is different to what you saw, so I conclude you have 2Mb VRAM in your RPC.
We're only tracking HDSR/HDER when
VIDC20_debug is enabled. It sounds like we need to track the registers regardless.
Working out DCTL isn't straight forward, as all the parameters change depending on the amount and type of RAM fitted and RAM speed. From looking at the RO source, BUS[1:0] is set to %11 for 2mb VRAM and %01 for less or DRAM. VRAM[1:0] and HDWR change depending on the amount of VRAM and screen width, VRAM[1:0] also changes based on VRAM bandwidth. Hdis is enabled if the calculation of HDWR doesn't drop the lower bit when adjusted for VRAM size and is disabled otherwise.
I've coded some of this over the past few hours, it's not exactly straight forward with so many variables. We now have a visible display in Boogie Buggy, although we're getting double images in all modes, so something is still wrong with it. Source and ADFFS 2.16n are on the dev site, the DCTL code is at the bottom of
adffs.vectors.vidc_abort, its only set when HDER changes.
steve3000 wrote:Will this lead to remapping problems for non-VRAM computers, or is this all taken care of?
We don't go near physical addresses, so should make no difference.
Whilst looking through the RO source, I found the following code, which might explain the cursor being incorrect in Caverns. I've yet to try this to see if it fixes the issue:
Code: Select all
LDR R14, [WsPtr, #CursorFudgeFactor] ; R14 = horiz display start
BIC R14, R14, #&FF000000 ; lbpp = 0, 1, 2, 3
MOV R14, R14, LSR #14 ; R14 = (m-19, m-11, m-7, m-5)/2
MOV R8, R2, LSR #2 ; put bits 2,3 (lbpp) into bits 0,1
AND R8, R8, #3 ; just look at these bits
RSB R8, R8, #3 ; R8 = 3, 2, 1, 0
MOV R9, #1
ADD R14, R14, R9, LSL R8 ; R14 = (m-3, m-3, m-3, m-3)/2
MOV R14, R14, LSL #1 ; R14 = m-3
SUB R14, R14, #3 ; R14 = m-6
STR R14, [WsPtr, #CursorFudgeFactor]