DREAMWEB: 'twodigitnum' ported to C++

This commit is contained in:
Bertrand Augereau 2011-11-16 23:03:44 +01:00
parent 67301fec53
commit 0ee6043d10
5 changed files with 21 additions and 17 deletions

View File

@ -227,6 +227,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'showoutermenu',
'textforend',
'textformonk',
'twodigitnum',
], skip_output = [
# These functions are processed but not output
'dreamweb',

View File

@ -13405,19 +13405,6 @@ morethan10:
_add(dl, 'A');
}
void DreamGenContext::twodigitnum() {
STACK_CHECK;
ah = cl;
_dec(ah);
numloop1:
_inc(ah);
_sub(al, 10);
if (!flags.c())
goto numloop1;
_add(al, 10);
_add(al, cl);
}
void DreamGenContext::showword() {
STACK_CHECK;
ch = 0;
@ -16226,7 +16213,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_dumpwatch: dumpwatch(); break;
case addr_showbyte: showbyte(); break;
case addr_onedigit: onedigit(); break;
case addr_twodigitnum: twodigitnum(); break;
case addr_showword: showword(); break;
case addr_convnum: convnum(); break;
case addr_mainscreen: mainscreen(); break;

View File

@ -107,7 +107,6 @@ public:
static const uint16 addr_mainscreen = 0xc9c8;
static const uint16 addr_convnum = 0xc9c4;
static const uint16 addr_showword = 0xc9c0;
static const uint16 addr_twodigitnum = 0xc9bc;
static const uint16 addr_onedigit = 0xc9b8;
static const uint16 addr_showbyte = 0xc9b4;
static const uint16 addr_dumpwatch = 0xc9b0;
@ -1731,7 +1730,7 @@ public:
//void walkandexamine();
void dmaend();
//void quickquit2();
void twodigitnum();
//void twodigitnum();
//void madmantext();
void dumpcurrent();
//void textforend();

View File

@ -2016,5 +2016,22 @@ void DreamGenContext::loadroom() {
getdimension();
}
void DreamGenContext::twodigitnum(uint8 in1, uint8 in2, uint8 *out1, uint8 *out2) {
*out1 = in1;
*out2 = in2;
while (*out1 >= 10) {
++(*out2);
*out1 -= 10;
}
*out1 += in2;
}
void DreamGenContext::twodigitnum() {
uint8 out1, out2;
twodigitnum(al, cl, &out1, &out2);
al = out1;
ah = out2;
}
} /*namespace dreamgen */

View File

@ -272,5 +272,6 @@
void putundermenu();
void textformonk();
void textforend();
void twodigitnum(uint8 in1, uint8 in2, uint8 *out1, uint8 *out2);
void twodigitnum();