diff options
author | Willem Jan Palenstijn | 2011-12-04 10:11:28 +0100 |
---|---|---|
committer | Willem Jan Palenstijn | 2011-12-04 10:11:28 +0100 |
commit | d9e31be349b38313cc2be8cf68ec801494bac08b (patch) | |
tree | 0dc235f169692006c1ef19affaa46fb1ea2ebf0f | |
parent | d4646c335a06fc91e45c690667ed109d14286af3 (diff) | |
download | scummvm-rg350-d9e31be349b38313cc2be8cf68ec801494bac08b.tar.gz scummvm-rg350-d9e31be349b38313cc2be8cf68ec801494bac08b.tar.bz2 scummvm-rg350-d9e31be349b38313cc2be8cf68ec801494bac08b.zip |
DREAMWEB: Convert 'readKey' and the keyboard buffer
-rwxr-xr-x | devtools/tasmrecover/tasm-recover | 3 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.cpp | 58 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.h | 28 | ||||
-rw-r--r-- | engines/dreamweb/dreamweb.cpp | 3 | ||||
-rw-r--r-- | engines/dreamweb/dreamweb.h | 4 | ||||
-rw-r--r-- | engines/dreamweb/stubs.cpp | 30 | ||||
-rw-r--r-- | engines/dreamweb/stubs.h | 1 |
7 files changed, 64 insertions, 63 deletions
diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover index ded36c254b..3592edb2df 100755 --- a/devtools/tasmrecover/tasm-recover +++ b/devtools/tasmrecover/tasm-recover @@ -41,6 +41,7 @@ p = parser(skip_binary_data = [ 'fileheader', 'filedata', 'extradata', + 'keybuffer', # keypad.asm 'keypadlist', 'symbollist', @@ -363,6 +364,7 @@ generator = cpp(context, "DreamGen", blacklist = [ 'randomnumber', 'readabyte', 'readheader', + 'readkey', 'readmouse', 'readmouse1', 'readmouse2', @@ -476,7 +478,6 @@ generator = cpp(context, "DreamGen", blacklist = [ ], skip_output = [ # These functions are processed but not output 'dreamweb', - 'readkey', ], skip_dispatch_call = True, skip_addr_constants = True, header_omit_blacklisted = True, function_name_remapping = { diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 26080eab41..2ae5cc5107 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -5228,14 +5228,14 @@ void DreamGenContext::getDestInfo() { push(ax); dx = data; es = dx; - si = 2032; + si = 2016; _add(si, ax); cl = es.byte(si); ax = pop(); push(cx); dx = data; es = dx; - si = 2048; + si = 2032; _add(si, ax); ax = pop(); } @@ -5412,7 +5412,7 @@ clearedlocations: bx = ax; dx = data; es = dx; - _add(bx, 2032); + _add(bx, 2016); es.byte(bx) = 0; } @@ -5527,7 +5527,7 @@ void DreamGenContext::delChar() { si = data.word(kCurpos); _add(si, si); es = cs; - _add(si, 2066); + _add(si, 2050); es.byte(si) = 0; al = es.byte(si+1); ah = 0; @@ -5554,7 +5554,7 @@ void DreamGenContext::execCommand() { es = cs; bx = offset_comlist; ds = cs; - si = 2066; + si = 2050; al = ds.byte(si); _cmp(al, 0); if (!flags.z()) @@ -5749,7 +5749,7 @@ notyetassigned: push(bx); _add(bx, 2); ds = cs; - si = 2066; + si = 2050; checkpass: _lodsw(); ah = es.byte(bx); @@ -6077,7 +6077,7 @@ void DreamGenContext::parser() { al = '='; _stosb(); ds = cs; - si = 2066; + si = 2050; notspace1: _lodsw(); _cmp(al, 32); @@ -9701,7 +9701,7 @@ void DreamGenContext::getNamePos() { _mul(cx); dx = data; es = dx; - bx = 2200; + bx = 2184; _add(bx, ax); al = data.byte(kCursorpos); ah = 0; @@ -9855,7 +9855,7 @@ void DreamGenContext::showNames() { STACK_CHECK; dx = data; es = dx; - si = 2200+1; + si = 2184+1; di = (60)+21; bx = (52)+10; cl = 0; @@ -10375,7 +10375,7 @@ void DreamGenContext::clearChanges() { di = 0; _stosw(cx, true); es = cs; - di = 2032; + di = 2016; al = 1; _stosb(2); al = 0; @@ -11387,15 +11387,15 @@ void DreamGenContext::__start() { //0x07a0: . .... .... 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, //0x07b0: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x07c0: .... .... .... .... 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x07d0: D:.. .... .... .... + //0x07c0: D:.. .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x07e0: .... .... .... .... + //0x07d0: .... .... .... .... 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x07f0: .... .... .... .... + //0x07e0: .... .... .... .... 0x05, 0x00, 0x03, 0x02, 0x04, 0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, + //0x07f0: .... .... .... .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0800: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0810: .... .... .... .... @@ -11411,34 +11411,32 @@ void DreamGenContext::__start() { //0x0860: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0870: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0880: .... .... .... .... 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - //0x0890: .... .... .... .... + //0x0880: .... .... .... .... 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, - //0x08a0: .... .... .... .... + //0x0890: .... .... .... .... 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, - //0x08b0: .... .... .... .... + //0x08a0: .... .... .... .... 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, - //0x08c0: .... .... .... .... + //0x08b0: .... .... .... .... 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, - //0x08d0: .... .... .... .... + //0x08c0: .... .... .... .... 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, - //0x08e0: .... .... .... .... + //0x08d0: .... .... .... .... 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, - //0x08f0: .... .... .... .... + //0x08e0: .... .... .... .... 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x44, - //0x0900: .... .... .... ...D + //0x08f0: .... .... .... ...D 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x44, 0x30, 0x30, 0x00, 0x44, 0x52, 0x45, 0x41, - //0x0910: REAM WEB. D00. DREA + //0x0900: REAM WEB. D00. DREA 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x44, 0x30, 0x31, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, - //0x0920: MWEB .D01 .DRE AMWE + //0x0910: MWEB .D01 .DRE AMWE 0x42, 0x2e, 0x44, 0x30, 0x32, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x44, - //0x0930: B.D0 2.DR EAMW EB.D + //0x0920: B.D0 2.DR EAMW EB.D 0x30, 0x33, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x44, 0x30, 0x34, 0x00, - //0x0940: 03.D REAM WEB. D04. + //0x0930: 03.D REAM WEB. D04. 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x44, 0x30, 0x35, 0x00, 0x44, 0x52, 0x45, - //0x0950: DREA MWEB .D05 .DRE + //0x0940: DREA MWEB .D05 .DRE 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x44, 0x30, 0x36, 0x00, 0x00, 0x00, 0x00, }; ds.assign(src, src + sizeof(src)); dreamweb(); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 25f72c999a..8fa0c25b70 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -39,7 +39,7 @@ public: static const uint16 offset_commandline = 0x077f; static const uint16 offset_money2poke = 0x06bc; static const uint16 offset_keys = 0x0623; - static const uint16 offset_keybuffer = 0x07c0; + static const uint16 offset_money1poke = 0x06b7; static const uint16 offset_diarylist = 0x06bf; static const uint16 offset_decidelist = 0x0742; static const uint16 offset_operand1 = 0x068d; @@ -49,7 +49,6 @@ public: static const uint16 offset_comlist = 0x05e7; static const uint16 offset_quitlist = 0x0593; static const uint16 offset_speechfilename = 0x076c; - static const uint16 offset_money1poke = 0x06b7; static const uint16 offset_talklist = 0x0573; static const uint16 offset_openchangesize = 0x0571; static const uint16 offset_destlist = 0x05a9; @@ -464,16 +463,16 @@ public: static const uint16 kTitle7graphics = 1367; static const uint16 kPalettescreen = 1380; static const uint16 kCurrentfile = 1705; - static const uint16 kRoomscango = 2032; - static const uint16 kRoompics = 2048; - static const uint16 kOplist = 2063; - static const uint16 kInputline = 2066; - static const uint16 kPresslist = 2194; - static const uint16 kSavenames = 2200; - static const uint16 kSavefiles = 2319; - static const uint16 kQuitrequested = 2410; - static const uint16 kSubtitles = 2411; - static const uint16 kForeignrelease = 2412; + static const uint16 kRoomscango = 2016; + static const uint16 kRoompics = 2032; + static const uint16 kOplist = 2047; + static const uint16 kInputline = 2050; + static const uint16 kPresslist = 2178; + static const uint16 kSavenames = 2184; + static const uint16 kSavefiles = 2303; + static const uint16 kQuitrequested = 2394; + static const uint16 kSubtitles = 2395; + static const uint16 kForeignrelease = 2396; static const uint16 kBlocktextdat = (0); static const uint16 kPersonframes = (0); static const uint16 kDebuglevel1 = (0); @@ -577,9 +576,8 @@ public: void clearBuffers(); void showSymbol(); void getObTextStart(); - void dumpDiaryKeys(); + void decide(); void getRidOfReels(); - void readKey(); void louis(); void entryTexts(); void checkInput(); @@ -658,7 +656,7 @@ public: void runTap(); void talk(); void useBalcony(); - void decide(); + void dumpDiaryKeys(); void disableSoundInt(); void priestText(); void openPoolBoss(); diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp index 09e6a15458..a9cc1a9653 100644 --- a/engines/dreamweb/dreamweb.cpp +++ b/engines/dreamweb/dreamweb.cpp @@ -290,7 +290,6 @@ uint DreamWebEngine::readFromSaveFile(uint8 *data, uint size) { void DreamWebEngine::keyPressed(uint16 ascii) { debug(2, "key pressed = %04x", ascii); - uint8* keybuf = _context.data.ptr(DreamGen::DreamGenContext::offset_keybuffer, 16); uint16 in = (_context.data.word(DreamGen::DreamGenContext::kBufferin) + 1) & 0x0f; uint16 out = _context.data.word(DreamGen::DreamGenContext::kBufferout); if (in == out) { @@ -298,7 +297,7 @@ void DreamWebEngine::keyPressed(uint16 ascii) { return; } _context.data.word(DreamGen::DreamGenContext::kBufferin) = in; - keybuf[in] = ascii; + DreamGen::g_keyBuffer[in] = ascii; } void DreamWebEngine::mouseCall(uint16 *x, uint16 *y, uint16 *state) { diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h index 2d59a87ea3..e0a55891ee 100644 --- a/engines/dreamweb/dreamweb.h +++ b/engines/dreamweb/dreamweb.h @@ -49,6 +49,10 @@ const uint16 addr_mainman = 0xc138; // Output of Bresenham extern Common::Point g_lineData[200]; +// Keyboard buffer. data.word(kBufferin) and data.word(kBufferout) are indexes +// into this, making it a ring buffer +extern uint8 g_keyBuffer[16]; + } namespace DreamWeb { diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 92053ca5af..dd1f777cda 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -26,6 +26,10 @@ namespace DreamGen { +// Keyboard buffer. data.word(kBufferin) and data.word(kBufferout) are indexes +// into this, making it a ring buffer +uint8 g_keyBuffer[16]; + const Room g_roomData[] = { { "DREAMWEB.R00", // Ryan's apartment 5,255,33,10, @@ -3057,21 +3061,17 @@ void DreamGenContext::atmospheres() { } void DreamGenContext::readKey() { - STACK_CHECK; - bx = data.word(kBufferout); - _cmp(bx, data.word(kBufferin)); - if (flags.z()) - goto nokey; - _inc(bx); - _and(bx, 15); - data.word(kBufferout) = bx; - di = offset_keybuffer; - _add(di, bx); - al = cs.byte(di); - data.byte(kCurrentkey) = al; - return; -nokey: - data.byte(kCurrentkey) = 0; + uint16 bufOut = data.word(kBufferout); + + if (bufOut == data.word(kBufferin)) { + // empty buffer + data.byte(kCurrentkey) = 0; + return; + } + + bufOut = (bufOut + 1) & 15; // The buffer has size 16 + data.byte(kCurrentkey) = g_keyBuffer[bufOut]; + data.word(kBufferout) = bufOut; } diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 70263fae94..6414a4e914 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -430,4 +430,5 @@ void loadNews(); void loadCart(); void soundOnReels(); + void readKey(); |