MiSTer-devel / ao486_MiSTer

ao486 port for MiSTer
Other
266 stars 69 forks source link

VGA Hardware scrolling issues #10

Closed mills32 closed 2 years ago

mills32 commented 4 years ago

Thanks a lot for this amazing core, I tested a lot of programs and games, and it works really well:

Some games that (I think) use the VGA horizontal hardware panning/scrolling, are very jerky.

You can check the jerky scrolling in these: -Supaplex (when going to config menu and back). -Prehistorik II (loading screen and world map). -Double Dragon 3 (menu intro).

Thanks.

alfishe commented 4 years ago

There was no special work done after porting ao486 to MiSTer, but attaching relevant documentation for those who wants to make VGA controller replica.

There also expected shortage in Cyclone V FPGA blocks. Probably there will be compromise - either to have full VGA controller supported OR soundblaster, not both.

VGA ports information here: https://wiki.osdev.org/VGA_Hardware

sorgelig commented 4 years ago

Why shortage? VGA memory is fully implemented. So fixing some problems or add feature should not increase BRAM usage. We are not talking about SVGA implementation, right?

mills32 commented 4 years ago

Hi.

I was talking about VGA (not SVGA). VGA has hardware scrolling that moves 4 pixels at a time, (or entire scanlines, so it is used for page flipping), and also has "per pixel panning".

I don't think we have to add more features, or use more blocks, because per pixel panning is kind of working. The problem is, it moves the wrong amount of pixels and makes the screen shake.

There is also a menu option in Dyna Blaster, which tests the VGA scrolling, and it works smoothly, (but the palette is wrong). So maybe it is just a little "bug".

I'd love to help, but I have no idea about fpga programming (maybe I should learn).

Thanks anyway :).

sorgelig commented 4 years ago

no one is born with fpga programming ability :)

alfishe commented 4 years ago

Seems it's combined BIOS + VGA controller "Mode X" feature. VGA bios sources can be found here https://github.com/qemu/vgabios, VGA controller logic and specifically 4-bit latches described here http://ohlandl.ipv7.net/books/ps2_50-60_techref_ch4b_system_board_io_controllers_video.pdf but brief reading through ao486 didn't get me to the point where such 4 bit operations / latches might be located

alfishe commented 4 years ago

Could be non-implemented parts in https://github.com/alfikpl/ao486/blob/master/rtl/soc/vga/vga.v

// not implemented sequencer regs: reg seq_not_impl_shift_load_2; reg seq_not_impl_shift_load_4;

Sequencer -> Clocking mode register, bits 2 and 4 Screen Shot 2019-11-26 at 6 46 43 PM

alfishe commented 4 years ago

More details about what's sent to registers during switching to "Mode X" and operations with video planes https://www.singlix.com/trdos/archive/vga_bios/vga_mode_x.pdf. Good news - seems BIOS is not involved. Bad news - seems it's not implemented in Verilog code in ao486 VGA controller

More archeology digging info about VGA - https://www.singlix.com/trdos/archive/vga_bios/

jsmolina commented 4 years ago

it's already happening. Commander keen shows it.

mills32 commented 4 years ago

Disabling cache (1 and 2, so set CPU speed to 90 because it is very slow), seems to solve the smooth panning issue. There is still some shaking at the borders of the display area.

Foxandxss commented 3 years ago

I tried "secret agent" with 15hz and disabled caches and I have the issue as well.

@mills32 tried as well and same issue.

I tried both with a VGA and HDMI and different screens (none of them CRT)

jsmolina commented 3 years ago

yes, it is already happening.

jmej commented 3 years ago

I can confirm this problem is happening on both VGA and HDMI for me. I haven’t found any settings that help. All of the following games are unplayable: Secret Agent Monster Bash Bio Menace

I’ll add more as I find them.

decod81 commented 2 years ago

This bug (missing pixels in vga hardware scroll in supaplex and keen4 etc.) can be fixed by removing from "vga.v" the last part of

assign dot_memory_load = 
    (   (seq_8dot_char    && ~(seq_dotclock_divided) && dot_cnt_enable    && dot_cnt == 4'd3) ||
        (seq_8dot_char    && seq_dotclock_divided    && ~(dot_cnt_enable) && dot_cnt == 4'd6) ||
        (~(seq_8dot_char) && ~(seq_dotclock_divided) && dot_cnt_enable    && dot_cnt == 4'd4) ||
        (~(seq_8dot_char) && seq_dotclock_divided    && ~(dot_cnt_enable) && dot_cnt == 4'd7)
    ) &&
    (   (vert_cnt == crtc_vertical_total + 1'd1 && horiz_cnt >= crtc_horizontal_total + 8'd3) ||
        (vert_cnt < crtc_vertical_display_size && (horiz_cnt <= crtc_horizontal_display_size - 8'd2 || horiz_cnt >= crtc_horizontal_total + 8'd3)) ||
        (vert_cnt == crtc_vertical_display_size && horiz_cnt <= crtc_horizontal_display_size - 8'd2)
    );

i.e. the following will fix the missing pixels hardware scroll issue (at least with keen 4 and supaplex which I justed tested):

assign dot_memory_load = 
    (   (seq_8dot_char    && ~(seq_dotclock_divided) && dot_cnt_enable    && dot_cnt == 4'd3) ||
        (seq_8dot_char    && seq_dotclock_divided    && ~(dot_cnt_enable) && dot_cnt == 4'd6) ||
        (~(seq_8dot_char) && ~(seq_dotclock_divided) && dot_cnt_enable    && dot_cnt == 4'd4) ||
        (~(seq_8dot_char) && seq_dotclock_divided    && ~(dot_cnt_enable) && dot_cnt == 4'd7)
    );
sorgelig commented 2 years ago

Do you want to make a pull request with this fix? Otherwise i can add it myself.

decod81 commented 2 years ago

Ok, did a pull request now. Hopefully it is ok, I haven't done pull requests before.

manast commented 2 years ago

So this issue could be closed since it has been resolved here https://github.com/MiSTer-devel/ao486_MiSTer/pull/104

LuckyNES commented 1 year ago

This is actually not fixed. Try Secret Agent on latest. I also tried on this previous version of the build: https://github.com/MiSTer-devel/ao486_MiSTer/raw/master/releases/ao486_20220301.rbf

This is RIGHT after the fix was made. The problem happens there as well. The odd thing is the update to the code does not match exactly the suggested fix above. Any reason for that?