DREAMWEB: frameoutv becomes a native function
This commit is contained in:
parent
33ce6e60fd
commit
cf12e04997
3 changed files with 24 additions and 48 deletions
|
@ -22,6 +22,7 @@ generator = cpp(context, "DreamGen", blacklist = [
|
|||
'width160',
|
||||
'convertkey',
|
||||
'readabyte',
|
||||
'readoneblock'
|
||||
'readoneblock',
|
||||
'frameoutv'
|
||||
])
|
||||
generator.generate('dreamweb') #start routine
|
||||
|
|
|
@ -4329,52 +4329,6 @@ noeffects:
|
|||
cx = pop();
|
||||
}
|
||||
|
||||
void DreamGenContext::frameoutv() {
|
||||
STACK_CHECK;
|
||||
push(dx);
|
||||
ax = bx;
|
||||
bx = dx;
|
||||
_mul(bx);
|
||||
_add(di, ax);
|
||||
dx = pop();
|
||||
push(cx);
|
||||
ch = 0;
|
||||
_sub(dx, cx);
|
||||
cx = pop();
|
||||
frameloop1:
|
||||
push(cx);
|
||||
ch = 0;
|
||||
frameloop2:
|
||||
_lodsb();
|
||||
_cmp(al, 0);
|
||||
if (!flags.z())
|
||||
goto backtosolid;
|
||||
backtoother:
|
||||
_inc(di);
|
||||
if (--cx)
|
||||
goto frameloop2;
|
||||
cx = pop();
|
||||
_add(di, dx);
|
||||
_dec(ch);
|
||||
if (!flags.z())
|
||||
goto frameloop1;
|
||||
return;
|
||||
frameloop3:
|
||||
_lodsb();
|
||||
_cmp(al, 0);
|
||||
if (flags.z())
|
||||
goto backtoother;
|
||||
backtosolid:
|
||||
_stosb();
|
||||
if (--cx)
|
||||
goto frameloop3;
|
||||
cx = pop();
|
||||
_add(di, dx);
|
||||
_dec(ch);
|
||||
if (!flags.z())
|
||||
goto frameloop1;
|
||||
}
|
||||
|
||||
void DreamGenContext::frameoutbh() {
|
||||
STACK_CHECK;
|
||||
push(dx);
|
||||
|
@ -22126,7 +22080,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
|
|||
case 0xc214: delthisone(); break;
|
||||
case 0xc228: doblocks(); break;
|
||||
case 0xc22c: showframe(); break;
|
||||
case 0xc230: frameoutv(); break;
|
||||
case 0xc238: frameoutbh(); break;
|
||||
case 0xc23c: frameoutfx(); break;
|
||||
case 0xc240: transferinv(); break;
|
||||
|
|
|
@ -503,4 +503,26 @@ void DreamGenContext::showpcx() {
|
|||
pcxFile.close();
|
||||
}
|
||||
|
||||
void DreamGenContext::frameoutv() {
|
||||
uint16 pitch = dx;
|
||||
uint16 width = cx & 0xff;
|
||||
uint16 height = cx >> 8;
|
||||
uint16 stride = pitch - width;
|
||||
|
||||
const uint8* src = ds.ptr(si, width * height);
|
||||
uint8* base = es.ptr(di, stride * height);
|
||||
uint8* dst = base + pitch * bx;
|
||||
|
||||
// NB: Original code assumes non-zero width and height, "for" are unneeded, do-while would suffice but would be less readable
|
||||
for (uint16 y = 0; y < height; ++y) {
|
||||
for (uint16 x = 0; x < width; ++x) {
|
||||
uint8 pixel = *src++;
|
||||
if (pixel)
|
||||
*dst = pixel;
|
||||
++dst;
|
||||
}
|
||||
dst += stride;
|
||||
}
|
||||
}
|
||||
|
||||
} /*namespace dreamgen */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue