hi everyone,
while learning to code for cave/neogeo/nes/megadrive I had problems to adjust
the following video modes for megadrive:
256x240
256x480i
320x240
320x480i
Well, 320x224 is ok:
![](https://i.ibb.co/4YkQ6c6/320x224.png)
Ok, looked in the fbn-code and made some additions:
![](https://i.ibb.co/7RXP3LS/320x240.png)
Accoding to this, the M2-bit is responsible for the y-resolution
// VDP[$01] - Mode Register 2
// When V30 is used on NTSC hardware, the picture is unstable and will roll upwards.
//
// Register 01 - Mode Register 02
// BIT-No 7 6 5 4 3 2 1 0
// BIT-VAL 128 64 32 16 8 4 2 1
// NAME VRAM DE IE0 M1 M2 M5 0 0
//
// - VRAM allows use of an additional 64 KB of external VRAM. [2]
// DE decides if the display is enabled (1) or disabled (0).
// This is useful to perform quick art loading.
// - IE0 enables the vertical blank interrupt, or VBI. This is a Level 6 interrupt to the M68k.
// - M1 allows DMA to be performed when set, while it disables any sort of DMA when it is not set.
// This bit also masks CD5 in the VDP control word if cleared.
// - M2 sets the vertical display mode/resolution. When set to 1, 30 cell (240 pixel) mode is enabled,
// which is exclusive to PAL. When set to 0, 28 cell (224 pixel) mode is enabled, which is always
// the case on NTSC. Enabling 30 cell mode on an NTSC Mega Drive will cause the image to roll upwards
// and be unstable, as well as causing vertical interrupts to happen at 30 Hz, and no vertical sync
// pulse to be output on the video connector.
// - M5 selects between Master System (Mode 4) and Mega Drive (Mode 5) video modes.
// Should always be set to 1 when programming Mega Drive software.
In megadrive.cpp INT32 res_check() I added:
UINT16 max_y = 240;
wchar_t szTEMP[100];
if (~RamVReg->reg[0x01] & 0b00001000) max_y = 224;
if (screen_width != 320 || screen_height != max_y) {
screen_width = 320;
screen_height = max_y;
swprintf(szTEMP, L"switching to 320 x %d mode: v30=%d\n", max_y, RamVReg->reg[0x01]);
bprintf(0, szTEMP);
BurnDrvSetVisibleSize(320, max_y);
Reinitialise();
return 1;
}
In the debug-log:
...
SRAM detected in header: start 200000 - end 20ffff
Emulating Europe PAL Machine
*** Using BUFFERED SN76496-mode.
*** Initialising DirectX9 Experimental blitter.
* Allocated a 320 x 240 (32-bit xRGB 8888) surface.
* Allocated a 512 x 256 (32-bit xRGB 8888) image texture.
* Initialisation complete: 4087,00MB texture memory free (total).
Displaying and rendering in 32-bit mode, emulation running in 32-bit mode.
Running in windowed mode, using D3DSWAPEFFECT_COPY to present the image.
[Win7+] Sync to DWM is enabled (if available).
SuperWaitVBlankInit() on \\.\DISPLAY1
switching to 320 x 224 mode: v30=4
*** Initialising DirectX9 Experimental blitter.
* Allocated a 320 x 224 (32-bit xRGB 8888) surface.
* Allocated a 512 x 256 (32-bit xRGB 8888) image texture.
* Initialisation complete: 4087,00MB texture memory free (total).
Displaying and rendering in 32-bit mode, emulation running in 32-bit mode.
Running in windowed mode, using D3DSWAPEFFECT_COPY to present the image.
[Win7+] Sync to DWM is enabled (if available).
SuperWaitVBlankInit() on \\.\DISPLAY1
SRam Status: Disabled Read/Write
switching to 320 x 240 mode: v30=124
*** Initialising DirectX9 Experimental blitter.
* Allocated a 320 x 240 (32-bit xRGB 8888) surface.
* Allocated a 512 x 256 (32-bit xRGB 8888) image texture.
* Initialisation complete: 4087,00MB texture memory free (total).
Displaying and rendering in 32-bit mode, emulation running in 32-bit mode.
Running in windowed mode, using D3DSWAPEFFECT_COPY to present the image.
[Win7+] Sync to DWM is enabled (if available).
SuperWaitVBlankInit() on \\.\DISPLAY1
...Now my questions:
- is it possiblbe to add the missing video modes to fbn?
- how to suppress the 2. res-switch (224) which causes the 3. res-switch back to 240
This said, the 240p Test Suite for megadrive has the same problems with fbn
(blastem, fusion, regen, gens etc.) work fine:
https://junkerhq.net/xrgb/index.php?title=240p_test_suite