#338 Fixed 64k address wrap for 320x200x8 when CGA comp. mode set

0.72
closed
h-a-l-9000
graphics (66)
5
2012-09-07
2009-09-08
reg2s
No

I had problem with video scrolling in Titan game in 320x200x8 mode (ax=000Dh, int 10h). Game works perfect on real machine (GeForce 2 mx400 videocard). But in dosbox if bit 0 of CRTC register is set to 0 (CGA compatible address mode on) video memory address isn't wrap at 64k.
Problem can be fixed with this patch (VGA_SetupDrawing() function -> switch (vga.mode) -> case M_EGA:).

Discussion

  • reg2s
    reg2s
    2009-09-08

     
    Attachments
  • Peter Veenstra
    Peter Veenstra
    2009-10-20

    according to h-a-l-9000 this bug has been fixed

     
  • Peter Veenstra
    Peter Veenstra
    2009-10-20

    sorry mis understood something

     
  • Peter Veenstra
    Peter Veenstra
    2009-10-20

    sorry mis understood something

     
  • reg2s
    reg2s
    2009-10-22

    Screenshots from original dosbox-0.73 and from patched one

     
    Attachments
  • reg2s
    reg2s
    2009-10-22

    Excuse me for my english and for bad explanation of problem.

    Dosbox doesn't react to this code:

    mov dx, 3D4h ; Video: CRT cntrlr addr
    mov al, 17h ; register index 17h
    out dx, al
    inc dx
    mov al, 0E2h ;bit 0 is set to 0
    out dx, al ;(CGA compatible address mode on)

    On real videocard this code leads to video memory address wrap at 64k boundary and game works. I've attached zip-archive with screenshots made in original dosbox-0.73 and in patched one.

     
  • h-a-l-9000
    h-a-l-9000
    2009-10-24

    Attaching a diff of how I'd fix this issue. It's a part of how real hardware does it.

    An occasional black line remains in the game with both solutions. Probably because wrapping in a line isn't supported.

     
  • h-a-l-9000
    h-a-l-9000
    2009-10-24

    No idea how to add files - so I'll add it here:

    Index: src/hardware/vga_draw.cpp

    RCS file: /cvsroot/dosbox/dosbox/src/hardware/vga_draw.cpp,v
    retrieving revision 1.111
    diff -u -r1.111 vga_draw.cpp
    --- src/hardware/vga_draw.cpp 10 Sep 2009 17:44:57 -0000 1.111
    +++ src/hardware/vga_draw.cpp 24 Oct 2009 14:52:11 -0000
    @@ -800,6 +805,8 @@
    #endif
    switch (vga.mode) {
    case M_EGA:
    + if (!(vga.crtc.mode_control&0x1)) vga.draw.linear_mask &= ~0x10000;
    + else vga.draw.linear_mask |= 0x10000;
    case M_LIN4:
    vga.draw.byte_panning_shift = 8;
    vga.draw.address += vga.draw.bytes_skip;

     
  • reg2s
    reg2s
    2009-10-25

    Thank you very much for your reply. Your fix is more accurate. I tried it and game works fine.

    BTW, occasional black line disappear if those new lines would be

    • if (!(vga.crtc.mode_control&0x1)) vga.draw.linear_mask &= 0xffff;
    • else vga.draw.linear_mask |= 0x10000;
     
  • Peter Veenstra
    Peter Veenstra
    2009-11-25

    The bug has been fixed.
    Wait for the upcoming new version to see it.

    Or:

    The updated source is available by cvs.

    See the link on top of the screen for information on how to get
    the new sources.

    The DOSBox Team