DREAMWEB: Less register interaction in 'multiput' and 'multiget'

This commit is contained in:
Bertrand Augereau 2011-08-03 16:44:29 +02:00
parent 2b03076149
commit 135efa50a1
3 changed files with 18 additions and 21 deletions

View File

@ -291,7 +291,7 @@ void DreamGenContext::getundertimed() {
y -= 3;
ds = data.word(kBuffers);
si = kUndertimedtext;
multiget(data.byte(kTimedx), y, 240, kUndertimedysize);
multiget(ds.ptr(si, 0), data.byte(kTimedx), y, 240, kUndertimedysize);
}
void DreamGenContext::putundertimed() {
@ -300,7 +300,7 @@ void DreamGenContext::putundertimed() {
y -= 3;
ds = data.word(kBuffers);
si = kUndertimedtext;
multiput(data.byte(kTimedx), y, 240, kUndertimedysize);
multiput(ds.ptr(si, 0), data.byte(kTimedx), y, 240, kUndertimedysize);
}
void DreamGenContext::usetimedtext() {
@ -889,7 +889,7 @@ void DreamGenContext::deltextline() {
y -= 3;
ds = data.word(kBuffers);
si = kTextunder;
multiput(x, y, kUndertextsizex, kUndertextsizey);
multiput(ds.ptr(si, 0), x, y, kUndertextsizex, kUndertextsizey);
}
} /*namespace dreamgen */

View File

@ -31,7 +31,7 @@
void frameoutfx(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y);
void worktoscreen();
void multiget();
void multiget(uint16 x, uint16 y, uint8 width, uint8 height);
void multiget(uint8 *dst, uint16 x, uint16 y, uint8 width, uint8 height);
void convertkey();
void cls();
void printsprites();
@ -70,7 +70,7 @@
void showframe(const void *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height);
void printasprite(const Sprite *sprite);
void width160();
void multiput(uint16 x, uint16 y, uint8 width, uint8 height);
void multiput(const uint8 *src, uint16 x, uint16 y, uint8 width, uint8 height);
void multiput();
void eraseoldobs();
void clearsprites();

View File

@ -39,13 +39,14 @@ void DreamGenContext::allocatework() {
}
void DreamGenContext::multiget() {
multiget(di, bx, cl, ch);
multiget(ds.ptr(si, 0), di, bx, cl, ch);
si += cl * ch;
di += bx * kScreenwidth + kScreenwidth * ch;
cx = 0;
}
void DreamGenContext::multiget(uint16 x, uint16 y, uint8 w, uint8 h) {
void DreamGenContext::multiget(uint8 *dst, uint16 x, uint16 y, uint8 w, uint8 h) {
unsigned src = x + y * kScreenwidth;
unsigned dst = (uint16)si;
es = ds;
ds = data.word(kWorkspace);
if (y + h > 200)
h = 200 - y;
@ -53,21 +54,20 @@ void DreamGenContext::multiget(uint16 x, uint16 y, uint8 w, uint8 h) {
w = 320 - x;
//debug(1, "multiget %u,%u %ux%u -> segment: %04x->%04x", x, y, w, h, (uint16)ds, (uint16)es);
for(unsigned l = 0; l < h; ++l) {
uint8 *src_p = ds.ptr(src + kScreenwidth * l, w);
uint8 *dst_p = es.ptr(dst + w * l, w);
const uint8 *src_p = ds.ptr(src + kScreenwidth * l, w);
uint8 *dst_p = dst + w * l;
memcpy(dst_p, src_p, w);
}
si += w * h;
di = src + kScreenwidth * h;
cx = 0;
}
void DreamGenContext::multiput() {
multiput(di, bx, cl, ch);
multiput(ds.ptr(si, 0), di, bx, cl, ch);
si += cl * ch;
di += bx * kScreenwidth + kScreenwidth * ch;
cx = 0;
}
void DreamGenContext::multiput(uint16 x, uint16 y, uint8 w, uint8 h) {
unsigned src = (uint16)si;
void DreamGenContext::multiput(const uint8 *src, uint16 x, uint16 y, uint8 w, uint8 h) {
unsigned dst = x + y * kScreenwidth;
es = data.word(kWorkspace);
if (y + h > 200)
@ -76,13 +76,10 @@ void DreamGenContext::multiput(uint16 x, uint16 y, uint8 w, uint8 h) {
w = 320 - x;
//debug(1, "multiput %ux%u -> segment: %04x->%04x", w, h, (uint16)ds, (uint16)es);
for(unsigned l = 0; l < h; ++l) {
uint8 *src_p = ds.ptr(src + w * l, w);
const uint8 *src_p = src + w * l;
uint8 *dst_p = es.ptr(dst + kScreenwidth * l, w);
memcpy(dst_p, src_p, w);
}
si += w * h;
di = dst + kScreenwidth * h;
cx = 0;
}
void DreamGenContext::multidump(uint16 x, uint16 y, uint8 width, uint8 height) {