However it would seem that something super-fishy is going on when I enable the #define? New video base address it not only not set but when started from 640x480@1bpp it quite severely crashes? (reproducible in Hatari, too) I can even disable the for loop and it still crashes, so it's not like I write somewhere where I shouldn't (not sure how that would be possible but anyway)
Resolutions other than 640x480@1bpp and/or when using NVDI lead to various strange effects, even different on Hatari and real hardware. In Hatari I'd often see the video base address set but the exit resolution corrupted, on real hardware I'd see blank screen with nothing (and corrupted exit resolution). Works perfectly if I comment out the #define.
Code: Select all
#include <mint/falcon.h>
#include <stdint.h>
#include <stdio.h>
//#define ONLY_VSETSCREEN
int main()
{
const uint16_t mode = BPS16 | COL40 | VGA | PAL | VERTFLAG;
const size_t size = VgetSize(mode);
uint16_t* scr = (uint16_t*)Mxalloc(size + 15, MX_STRAM);
if (scr == NULL)
return 1;
uint16_t* scr_aligned = (uint16_t*)(((uintptr_t)scr + 15) & 0xfffffff0);
uint16_t old_mode = VsetMode(VM_INQUIRE);
void* old_scr = Physbase();
#ifdef ONLY_VSETSCREEN
VsetScreen(SCR_NOCHANGE, scr_aligned, 3, mode);
#else
VsetMode(mode);
VsetScreen(SCR_NOCHANGE, scr_aligned, SCR_NOCHANGE, SCR_NOCHANGE);
#endif
for (size_t i = 0; i < size / 2; i++) {
*scr_aligned++ = 0x0fff;
}
getchar();
#ifdef ONLY_VSETSCREEN
VsetScreen(SCR_NOCHANGE, old_scr, 3, old_mode);
#else
VsetMode(old_mode);
VsetScreen(SCR_NOCHANGE, old_scr, SCR_NOCHANGE, SCR_NOCHANGE);
#endif
return 0;
}