Sorry to bump this old thread again, but I'm tinkering with some stuff again, and thought I would set up a good generic code to handle this (in C)
Using the stuff from Angry Retired Bastard, I ended up with something like this:
#define WIDTH 320
#define HEIGHT 256
#define XSTRT 129
#define XSTOP XSTRT+WIDTH
#define YSTRT 44
#define YSTOP YSTRT+HEIGHT
#define HSTRT 129
#define RES 8 // 8 = lores, 4 = hires
custom.diwstrt=XSTRT+(YSTRT*256);
custom.diwstop=(XSTOP-256)+(YSTOP-256)*256;
custom.ddfstrt=(HSTRT/2-RES);
custom.ddfstop=(HSTRT/2-RES)+(8*((WIDTH/16)-1));
I worked with the assumption that the 129 on the XSTRT/XSTOP should be the same constant, and 44 on YSTRT/YSTOP the same as well, is that correct?
What about the 129 on HSTRT, should the be the same as well (ie. #define HSTRT XSTRT) or should these values be separate?