DREAMWEB: removed dummy video segment, blacklisted video-related functions.

This commit is contained in:
Vladimir Menshakov 2011-06-11 16:08:30 +04:00 committed by Alyssa Milburn
parent 3f592047bb
commit 9034191796
6 changed files with 53 additions and 108 deletions

View file

@ -7,5 +7,17 @@ p = parser()
p.strip_path = 3 p.strip_path = 3
context = p.parse('dreamweb/dreamweb.asm') context = p.parse('dreamweb/dreamweb.asm')
p.link() p.link()
generator = cpp(context, "dreamgen", blacklist = ['randomnumber', 'quickquit', 'quickquit2', 'seecommandtail', 'multiget', 'multiput', 'multidump', 'frameoutnm']) generator = cpp(context, "dreamgen", blacklist = [
'randomnumber',
'quickquit',
'quickquit2',
'seecommandtail',
'multiget',
'multiput',
'multidump',
'frameoutnm',
'cls',
'printundermon',
'worktoscreen',
])
generator.generate('dreamweb') #start routine generator.generate('dreamweb') #start routine

View file

@ -10,7 +10,6 @@ void readsetdata(Context &context);
void loadpalfromiff(Context &context); void loadpalfromiff(Context &context);
void titles(Context &context); void titles(Context &context);
void credits(Context &context); void credits(Context &context);
void cls(Context &context);
void decide(Context &context); void decide(Context &context);
void clearchanges(Context &context); void clearchanges(Context &context);
void loadroom(Context &context); void loadroom(Context &context);
@ -60,7 +59,6 @@ void animpointer(Context &context);
void showpointer(Context &context); void showpointer(Context &context);
void dumppointer(Context &context); void dumppointer(Context &context);
void commandonly(Context &context); void commandonly(Context &context);
void worktoscreen(Context &context);
void showtime(Context &context); void showtime(Context &context);
void showwatch(Context &context); void showwatch(Context &context);
void printmessage(Context &context); void printmessage(Context &context);
@ -279,7 +277,6 @@ void modifychar(Context &context);
void printchar(Context &context); void printchar(Context &context);
void showcurrentfile(Context &context); void showcurrentfile(Context &context);
void printlogo(Context &context); void printlogo(Context &context);
void printundermon(Context &context);
void randomaccess(Context &context); void randomaccess(Context &context);
void locklighton(Context &context); void locklighton(Context &context);
void locklightoff(Context &context); void locklightoff(Context &context);
@ -430,7 +427,6 @@ void frameoutbh(Context &context);
void frameoutv(Context &context); void frameoutv(Context &context);
void putunderzoom(Context &context); void putunderzoom(Context &context);
void crosshair(Context &context); void crosshair(Context &context);
void width160(Context &context);
void maptopanel(Context &context); void maptopanel(Context &context);
void movemap(Context &context); void movemap(Context &context);
void dealwithspecial(Context &context); void dealwithspecial(Context &context);
@ -4034,71 +4030,6 @@ nought:
return; return;
} }
void cls(Context & context) {
context.ax = 0x0a000;
context.es = context.ax;
context.di = 0;
context.cx = 0x7fff;
context.ax = 0;
while(context.cx--) context._stosw();
return;
}
void printundermon(Context & context) {
context.si = ((320)*43)+76;
context.di = context.si;
context.es = context.data.word(kWorkspace);
context._add(context.si, 8*(320));
context.dx = 0x0a000;
context.ds = context.dx;
context.cx = 104;
scrollmonloop1:
context.push(context.cx);
context.push(context.di);
context.push(context.si);
context.cx = 170;
scrollmonloop2:
context._lodsb();
context._cmp(context.al, 231);
if (!context.flags.c()) goto dontplace;
placeit:
context._stosb();
if (--context.cx) goto scrollmonloop2;
goto finmonscroll;
dontplace:
context._add(context.di, 1);
if (--context.cx) goto scrollmonloop2;
finmonscroll:
context.si = context.pop();
context.di = context.pop();
context.cx = context.pop();
context._add(context.si, (320));
context._add(context.di, (320));
if (--context.cx) goto scrollmonloop1;
return;
}
void worktoscreen(Context & context) {
vsync(context);
context.si = 0;
context.di = 0;
context.cx = 25;
context.ds = context.data.word(kWorkspace);
context.dx = 0x0a000;
context.es = context.dx;
dumpallloop:
width160(context);
width160(context);
width160(context);
width160(context);
width160(context);
width160(context);
width160(context);
width160(context);
if (--context.cx) goto dumpallloop;
return;
}
void paneltomap(Context & context) { void paneltomap(Context & context) {
context.di = context.data.word(kMapxstart); context.di = context.data.word(kMapxstart);
context._add(context.di, context.data.word(kMapadx)); context._add(context.di, context.data.word(kMapadx));
@ -21321,9 +21252,6 @@ void __dispatch_call(Context &context, unsigned addr) {
case 0xc1d4: readoneblock(context); break; case 0xc1d4: readoneblock(context); break;
case 0xc1d8: loadpalfromiff(context); break; case 0xc1d8: loadpalfromiff(context); break;
case 0xc1dc: setmode(context); break; case 0xc1dc: setmode(context); break;
case 0xc1e0: cls(context); break;
case 0xc1e4: printundermon(context); break;
case 0xc1e8: worktoscreen(context); break;
case 0xc1ec: paneltomap(context); break; case 0xc1ec: paneltomap(context); break;
case 0xc1f0: maptopanel(context); break; case 0xc1f0: maptopanel(context); break;
case 0xc1f4: dumpmap(context); break; case 0xc1f4: dumpmap(context); break;

View file

@ -16,6 +16,9 @@ namespace dreamgen {
void multiput(Context &context); void multiput(Context &context);
void multidump(Context &context); void multidump(Context &context);
void frameoutnm(Context &context); void frameoutnm(Context &context);
void cls(Context &context);
void printundermon(Context &context);
void worktoscreen(Context &context);
void keyboardread(Context &context); void keyboardread(Context &context);
void resetkeyboard(Context &context); void resetkeyboard(Context &context);
void setkeyboardint(Context &context); void setkeyboardint(Context &context);

View file

@ -86,16 +86,6 @@ void DreamWebEngine::setVSyncInterrupt(bool flag) {
void DreamWebEngine::waitForVSync() { void DreamWebEngine::waitForVSync() {
processEvents(); processEvents();
Graphics::Surface *s = _system->lockScreen();
if (!s)
error("lockScreen failed");
for(int y = 0; y < 200; ++y) {
uint8 *scanline = (uint8*)s->getBasePtr(0, y);
uint8 *src = _context.video.ptr(y * 320, 320);
memcpy(scanline, src, 320);
}
_system->unlockScreen();
_system->updateScreen();
/* /*
while (!_vSyncInterrupt) { while (!_vSyncInterrupt) {
_system->delayMillis(10); _system->delayMillis(10);
@ -220,6 +210,7 @@ void DreamWebEngine::setGraphicsMode() {
} }
void DreamWebEngine::fadeDos() { void DreamWebEngine::fadeDos() {
waitForVSync();
//processEvents will be called from vsync //processEvents will be called from vsync
PaletteManager *palette = _system->getPaletteManager(); PaletteManager *palette = _system->getPaletteManager();
_context.ds = _context.es = _context.data.word(dreamgen::kBuffers); _context.ds = _context.es = _context.data.word(dreamgen::kBuffers);
@ -231,9 +222,8 @@ void DreamWebEngine::fadeDos() {
--dst[c]; --dst[c];
} }
} }
//Common::hexdump(dst, 64 * 3); palette->setPalette(dst, 0, 64);
//palette->setPalette(dst, 0, 64); waitForVSync();
//waitForVSync();
} }
} }
void DreamWebEngine::setPalette() { void DreamWebEngine::setPalette() {
@ -242,7 +232,7 @@ void DreamWebEngine::setPalette() {
PaletteManager *palette = _system->getPaletteManager(); PaletteManager *palette = _system->getPaletteManager();
unsigned n = (uint16)_context.cx; unsigned n = (uint16)_context.cx;
uint8 *src = _context.ds.ptr(_context.si, n * 3); uint8 *src = _context.ds.ptr(_context.si, n * 3);
for(int i = 0; i < n * 3; ++i) for(unsigned i = 0; i < n * 3; ++i)
colors[i] = src[i] * 3; colors[i] = src[i] * 3;
//Common::hexdump(colors, n * 3); //Common::hexdump(colors, n * 3);
palette->setPalette(colors, _context.al, n); palette->setPalette(colors, _context.al, n);
@ -250,6 +240,15 @@ void DreamWebEngine::setPalette() {
_context.cx = 0; _context.cx = 0;
} }
void DreamWebEngine::blit(uint8 *src, int pitch, int x, int y, int w, int h) {
_system->copyRectToScreen(src, pitch, x, y, w, h);
}
void DreamWebEngine::cls() {
_system->fillScreen(0);
}
} // End of namespace DreamWeb } // End of namespace DreamWeb
@ -289,17 +288,25 @@ void multiput(Context &context) {
} }
void multidump(Context &context) { void multidump(Context &context) {
unsigned w = (uint8)context.cl, h = (uint8)context.ch; int w = (uint8)context.cl, h = (uint8)context.ch;
context.es = 0xa000; int x = (int16)context.di, y = (int16)context.bx;
context.ds = context.data.word(kWorkspace); int pitch = (uint16)context.data.word(kScreenwidth);
unsigned offset = x + y * pitch;
//debug(1, "multidump %ux%u -> segment: %04x->%04x", w, h, (uint16)context.ds, (uint16)context.es); //debug(1, "multidump %ux%u -> segment: %04x->%04x", w, h, (uint16)context.ds, (uint16)context.es);
unsigned pitch = (uint16)context.data.word(kScreenwidth); engine()->blit(context.ds.ptr(offset, w * h), pitch, x, y, w, h);
unsigned offset = (uint16)context.di + (uint16)context.bx * pitch; }
for(unsigned y = 0; y < h; ++y, offset += pitch) {
uint8 *src_p = context.ds.ptr(offset, w); void worktoscreen(Context &context) {
uint8 *dst_p = context.es.ptr(offset, w); context.ds = context.data.word(kWorkspace);
memcpy(dst_p, src_p, w); engine()->blit(context.ds.ptr(0, 320 * 200), 320, 0, 0, 320, 200);
} }
void printundermon(Context &context) {
warning("printundermon: STUB");
}
void cls(Context &context) {
engine()->cls();
} }
void frameoutnm(Context &context) { void frameoutnm(Context &context) {
@ -579,12 +586,11 @@ void showgroup(Context &context) {
} }
void fadedos(Context &context) { void fadedos(Context &context) {
vsync(context);
engine()->fadeDos(); engine()->fadeDos();
} }
void doshake(Context &context) { void doshake(Context &context) {
::error("doshake"); warning("doshake: STUB");
} }
void vsync(Context &context) { void vsync(Context &context) {
@ -683,8 +689,6 @@ normal:
endline: endline:
context.di = context.pop(); context.di = context.pop();
context.push(context.si); context.push(context.si);
context.dx = 0xa000;
context.es = context.dx;
context.si = 0+(228*13)+32+60; context.si = 0+(228*13)+32+60;
context.ds = context.data.word(kBuffers); context.ds = context.data.word(kBuffers);

View file

@ -87,6 +87,8 @@ public:
void setGraphicsMode(); void setGraphicsMode();
void setPalette(); void setPalette();
void fadeDos(); void fadeDos();
void blit(uint8 *src, int pitch, int x, int y, int w, int h);
void cls();
private: private:

View file

@ -199,7 +199,7 @@ class Context {
FreeSegmentList _freeSegments; FreeSegmentList _freeSegments;
public: public:
enum { kDefaultDataSegment = 0x1000, kVideoSegment = 0xa000 }; enum { kDefaultDataSegment = 0x1000 };
Register ax, dx, bx, cx, si, di; Register ax, dx, bx, cx, si, di;
LowPartOfRegister al; LowPartOfRegister al;
@ -211,21 +211,17 @@ public:
LowPartOfRegister dl; LowPartOfRegister dl;
HighPartOfRegister dh; HighPartOfRegister dh;
SegmentRef cs, ds, es, data, video; SegmentRef cs, ds, es, data;
//data == fake segment register always pointing to data segment //data == fake segment register always pointing to data segment
Flags flags; Flags flags;
inline Context(): al(ax), ah(ax), bl(bx), bh(bx), cl(cx), ch(cx), dl(dx), dh(dx), inline Context(): al(ax), ah(ax), bl(bx), bh(bx), cl(cx), ch(cx), dl(dx), dh(dx),
cs(this), ds(this), es(this), data(this), video(this) { cs(this), ds(this), es(this), data(this) {
_segments[kDefaultDataSegment] = SegmentPtr(new Segment()); _segments[kDefaultDataSegment] = SegmentPtr(new Segment());
_segments[kVideoSegment] = SegmentPtr(new Segment());
_segments[kVideoSegment]->data.resize(0x10000);
cs.reset(kDefaultDataSegment); cs.reset(kDefaultDataSegment);
ds.reset(kDefaultDataSegment); ds.reset(kDefaultDataSegment);
es.reset(kDefaultDataSegment); es.reset(kDefaultDataSegment);
data.reset(kDefaultDataSegment); data.reset(kDefaultDataSegment);
video.reset(kVideoSegment);
} }
SegmentRef getSegment(uint16 value) { SegmentRef getSegment(uint16 value) {