Changing screen resolution

Note: if you just want to use 256×224 or 320×224 (like nearly every game) then the first section has everything you need to know.

Setting the video mode

You'll need the VDP register constants here.

The Mega Drive has a bunch of different screen resolutions. Changing the screen resolution is pretty easy: we need to write to VDP register $8Cxx (VDPREG_MODE4) with the new video mode. This register also lets you toggle shadow/highlight, so we may as well go over that.

Iwis says

What comes below is a simplification that gets the job done, if you want more details check the VDP register documentation linked above.

The value we need to write is as follows:

So first we need to make a list of every possible combination:

GFXMODE_256x224:      equ %00000000
GFXMODE_320x224:      equ %10000001
GFXMODE_256x448:      equ %00000110
GFXMODE_320x448:      equ %10000111
GFXMODE_256x224_SH:   equ %00001000
GFXMODE_320x224_SH:   equ %10001001
GFXMODE_256x448_SH:   equ %00001110
GFXMODE_320x448_SH:   equ %10001111

Now we can change the video mode by writing to the register:

    move.w  #VDPREG_MODE4|GFXMODE_320x224, (VdpCtrl)

Or better yet, wrap it into a macro:

SetGfxMode macro mode
    move.w  #VDPREG_MODE4|(mode), (VdpCtrl)
    endm
    
    ; Then when we need it:
    SetGfxMode GFXMODE_320x224

Regarding 448px high modes

The 448px high video mode is better known as interlaced mode (because of the way the screen is refreshed). This mode doubles the vertical resolution and hence tiles are 8×16 pixels instead of the usual 8×8.

This is what you should be aware of (especially the first two):

240px/480px high resolution

Actually there's more to it: the Mega Drive has a setting that lets it show 30 tiles vertically. The catches: it's in VDP register $81xx (VDPREG_MODE2) and, more importantly, only works properly on PAL systems, which can heavily limit its usefulness.

Bit 3 toggles whether the screen is 28 or 30 tiles high (note that if the game is running on a NTSC system, you must set this bit to 0 or the console will misbehave):

About H32/H40/V28/V30

Sometimes you may heard video modes being referred to as H40 or the like (and mentioned earlier in this page). This nomeclature refers to the size of the screen in tiles: