Skip to content

Commit

Permalink
DREAMWEB: 'input' ported to C++
Browse files Browse the repository at this point in the history
  • Loading branch information
tramboi committed Nov 18, 2011
1 parent 2631da9 commit 26dd3f5
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 100 deletions.
1 change: 1 addition & 0 deletions devtools/tasmrecover/tasm-recover
Expand Up @@ -246,6 +246,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'loadroomssample',
'printlogo',
'usemon',
'input',
], skip_output = [
# These functions are processed but not output
'dreamweb',
Expand Down
97 changes: 0 additions & 97 deletions engines/dreamweb/dreamgen.cpp
Expand Up @@ -6306,102 +6306,6 @@ void DreamGenContext::locklightoff() {
multidump();
}

void DreamGenContext::input() {
STACK_CHECK;
es = cs;
di = 8045;
cx = 64;
al = 0;
_stosb(cx, true);
data.word(kCurpos) = 0;
al = '>';
di = data.word(kMonadx);
bx = data.word(kMonady);
ds = data.word(kTempcharset);
ah = 0;
printchar();
di = data.word(kMonadx);
bx = data.word(kMonady);
cl = 6;
ch = 8;
multidump();
_add(data.word(kMonadx), 6);
ax = data.word(kMonadx);
data.word(kCurslocx) = ax;
ax = data.word(kMonady);
data.word(kCurslocy) = ax;
waitkey:
printcurs();
vsync();
delcurs();
readkey();
al = data.byte(kCurrentkey);
_cmp(al, 0);
if (flags.z())
goto waitkey;
_cmp(al, 13);
if (flags.z())
return /* (endofinput) */;
_cmp(al, 8);
if (!flags.z())
goto notdel;
_cmp(data.word(kCurpos), 0);
if (flags.z())
goto waitkey;
delchar();
goto waitkey;
notdel:
_cmp(data.word(kCurpos), 28);
if (flags.z())
goto waitkey;
_cmp(data.byte(kCurrentkey), 32);
if (!flags.z())
goto notleadingspace;
_cmp(data.word(kCurpos), 0);
if (flags.z())
goto waitkey;
notleadingspace:
makecaps();
es = cs;
si = data.word(kCurpos);
_add(si, si);
_add(si, 8045);
es.byte(si) = al;
_cmp(al, 'Z'+1);
if (!flags.c())
goto waitkey;
push(ax);
push(es);
push(si);
di = data.word(kMonadx);
bx = data.word(kMonady);
ds = data.word(kMapstore);
ax = data.word(kCurpos);
_xchg(al, ah);
si = ax;
cl = 8;
ch = 8;
multiget();
si = pop();
es = pop();
ax = pop();
push(es);
push(si);
di = data.word(kMonadx);
bx = data.word(kMonady);
ds = data.word(kTempcharset);
ah = 0;
printchar();
si = pop();
es = pop();
es.byte(si+1) = cl;
ch = 0;
_add(data.word(kMonadx), cx);
_inc(data.word(kCurpos));
_add(data.word(kCurslocx), cx);
goto waitkey;
}

void DreamGenContext::makecaps() {
STACK_CHECK;
_cmp(al, 'a');
Expand Down Expand Up @@ -15468,7 +15372,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_accesslightoff: accesslightoff(); break;
case addr_locklighton: locklighton(); break;
case addr_locklightoff: locklightoff(); break;
case addr_input: input(); break;
case addr_makecaps: makecaps(); break;
case addr_delchar: delchar(); break;
case addr_execcommand: execcommand(); break;
Expand Down
3 changes: 1 addition & 2 deletions engines/dreamweb/dreamgen.h
Expand Up @@ -360,7 +360,6 @@ class DreamGenContext : public Context {
static const uint16 addr_execcommand = 0xc52c;
static const uint16 addr_delchar = 0xc528;
static const uint16 addr_makecaps = 0xc524;
static const uint16 addr_input = 0xc520;
static const uint16 addr_locklightoff = 0xc51c;
static const uint16 addr_locklighton = 0xc518;
static const uint16 addr_accesslightoff = 0xc514;
Expand Down Expand Up @@ -1770,7 +1769,7 @@ class DreamGenContext : public Context {
void getridoftemptext();
void setuptimeduse();
void grafittidoor();
void input();
//void input();
void nextdest();
//void getdimension();
void makecaps();
Expand Down
53 changes: 53 additions & 0 deletions engines/dreamweb/monitor.cpp
Expand Up @@ -105,5 +105,58 @@ void DreamGenContext::printlogo() {
showcurrentfile();
}

void DreamGenContext::input() {
char *inputLine = (char *)cs.ptr(kInputline, 64);
memset(inputLine, 0, 64);
data.word(kCurpos) = 0;
ds = data.word(kTempcharset);
{
uint16 x = data.word(kMonadx);
uint8 width, height;
printchar((Frame *)segRef(data.word(kTempcharset)).ptr(0, 0), &x, data.word(kMonady), '>', 0, &width, &height);
}
multidump(data.word(kMonadx), data.word(kMonady), 6, 8);
data.word(kMonadx) += 6;
data.word(kCurslocx) = data.word(kMonadx);
data.word(kCurslocy) = data.word(kMonady);
while (true) {
printcurs();
vsync();
delcurs();
readkey();
uint8 currentKey = data.byte(kCurrentkey);
if (currentKey == 0)
continue;
if (currentKey == 13)
return;
if (currentKey == 8) {
if (data.word(kCurpos) > 0)
delchar();
continue;
}
if (data.word(kCurpos) == 28)
continue;
if ((currentKey == 32) && (data.word(kCurpos) == 0))
continue;
al = currentKey;
makecaps();
currentKey = al;
inputLine[data.word(kCurpos) * 2 + 0] = currentKey;
if (currentKey > 'Z')
continue;
multiget(segRef(data.word(kMapstore)).ptr(data.word(kCurpos) * 256, 0), data.word(kMonadx), data.word(kMonady), 8, 8);
uint8 charWidth;
{
uint16 x = data.word(kMonadx);
uint8 height;
printchar((Frame *)segRef(data.word(kTempcharset)).ptr(0, 0), &x, data.word(kMonady), currentKey, 0, &charWidth, &height);
}
inputLine[data.word(kCurpos) * 2 + 1] = charWidth;
data.word(kMonadx) += charWidth;
++data.word(kCurpos);
data.word(kCurslocx) += charWidth;
}
}

} /*namespace dreamgen */

2 changes: 1 addition & 1 deletion engines/dreamweb/stubs.h
Expand Up @@ -297,5 +297,5 @@
void fadeupmonfirst();
void printlogo();
void usemon();

void input();

0 comments on commit 26dd3f5

Please sign in to comment.