DREAMWEB: 'printslow' ported to C++

This commit is contained in:
Bertrand Augereau 2011-07-19 12:37:32 +02:00
parent 96221b5742
commit d0f917d857
5 changed files with 91 additions and 104 deletions

View File

@ -46,6 +46,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'getnumber',
'printchar',
'printdirect',
'printslow',
'worktoscreen',
'width160',
'convertkey',

View File

@ -4937,107 +4937,6 @@ realcreditsearly:
data.byte(kLasthardkey) = 0;
}
void DreamGenContext::printslow() {
STACK_CHECK;
data.byte(kPointerframe) = 1;
data.byte(kPointermode) = 3;
ds = data.word(kCharset1);
printloopslow6:
push(bx);
push(di);
push(dx);
getnumber();
ch = 0;
printloopslow5:
push(cx);
push(si);
push(es);
ax = es.word(si);
push(bx);
push(cx);
push(es);
push(si);
push(ds);
modifychar();
printboth();
ds = pop();
si = pop();
es = pop();
cx = pop();
bx = pop();
ax = es.word(si+1);
_inc(si);
_cmp(al, 0);
if (flags.z())
goto finishslow;
_cmp(al, ':');
if (flags.z())
goto finishslow;
_cmp(cl, 1);
if (flags.z())
goto afterslow;
push(di);
push(ds);
push(bx);
push(cx);
push(es);
push(si);
modifychar();
data.word(kCharshift) = 91;
printboth();
data.word(kCharshift) = 0;
si = pop();
es = pop();
cx = pop();
bx = pop();
ds = pop();
di = pop();
waitframes();
_cmp(ax, 0);
if (flags.z())
goto keepgoing;
_cmp(ax, data.word(kOldbutton));
if (!flags.z())
goto finishslow2;
keepgoing:
waitframes();
_cmp(ax, 0);
if (flags.z())
goto afterslow;
_cmp(ax, data.word(kOldbutton));
if (!flags.z())
goto finishslow2;
afterslow:
es = pop();
si = pop();
cx = pop();
_inc(si);
if (--cx)
goto printloopslow5;
dx = pop();
di = pop();
bx = pop();
_add(bx, 10);
goto printloopslow6;
finishslow:
es = pop();
si = pop();
cx = pop();
dx = pop();
di = pop();
bx = pop();
al = 0;
return;
finishslow2:
es = pop();
si = pop();
cx = pop();
dx = pop();
di = pop();
bx = pop();
al = 1;
}
void DreamGenContext::waitframes() {
STACK_CHECK;
push(di);
@ -21368,7 +21267,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_mode640x480: mode640x480(); break;
case addr_set16colpalette: set16colpalette(); break;
case addr_realcredits: realcredits(); break;
case addr_printslow: printslow(); break;
case addr_waitframes: waitframes(); break;
case addr_printboth: printboth(); break;
case addr_monprint: monprint(); break;

View File

@ -587,7 +587,6 @@ public:
static const uint16 addr_monprint = 0xc314;
static const uint16 addr_printboth = 0xc30c;
static const uint16 addr_waitframes = 0xc308;
static const uint16 addr_printslow = 0xc304;
static const uint16 addr_realcredits = 0xc2f8;
static const uint16 addr_set16colpalette = 0xc2f4;
static const uint16 addr_mode640x480 = 0xc2f0;
@ -1485,7 +1484,7 @@ public:
void turnonpower();
void manasleep2();
void moretalk();
void printslow();
//void printslow();
void loadroom();
void starttalk();
void delchar();

View File

@ -294,6 +294,94 @@ void DreamGenContext::printchar(uint16 dst, uint16 src, uint16* x, uint16 y, uin
(*x) += cl;
}
void DreamGenContext::printslow() {
data.byte(kPointerframe) = 1;
data.byte(kPointermode) = 3;
ds = data.word(kCharset1);
do {
push(bx);
push(di);
push(dx);
uint16 offset = di;
cx = getnumber(dl, (bool)(dl & 1), &offset);
di = offset;
do {
push(cx);
push(si);
push(es);
ax = es.word(si);
push(bx);
push(cx);
push(es);
push(si);
push(ds);
al = engine->modifyChar(al);
printboth();
ds = pop();
si = pop();
es = pop();
cx = pop();
bx = pop();
ax = es.word(si+1);
_inc(si);
if ((al == 0) || (al == ':')) {
es = pop();
si = pop();
cx = pop();
dx = pop();
di = pop();
bx = pop();
al = 0;
return;
}
_cmp(cl, 1);
if (flags.z())
goto afterslow;
push(di);
push(ds);
push(bx);
push(cx);
push(es);
push(si);
al = engine->modifyChar(al);
data.word(kCharshift) = 91;
printboth();
data.word(kCharshift) = 0;
si = pop();
es = pop();
cx = pop();
bx = pop();
ds = pop();
di = pop();
for (int i=0; i<2; ++i) {
waitframes();
if (ax == 0)
continue;
if (ax != data.word(kOldbutton)) {
es = pop();
si = pop();
cx = pop();
dx = pop();
di = pop();
bx = pop();
al = 1;
return;
}
}
afterslow:
es = pop();
si = pop();
cx = pop();
_inc(si);
--cx;
} while (cx);
dx = pop();
di = pop();
bx = pop();
_add(bx, 10);
} while (true);
}
void DreamGenContext::printdirect() {
data.word(kLastxpos) = di;
ds = data.word(kCurrentset);

View File

@ -41,6 +41,7 @@
void printchar();
void printchar(uint16 dst, uint16 src, uint16* x, uint16 y, uint8 c);
void printdirect();
void printslow();
void getnumber();
uint8 getnumber(uint16 maxWidth, bool centered, uint16* offset);
void kernchars();