aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertrand Augereau2011-11-22 11:56:54 +0100
committerBertrand Augereau2011-11-22 15:36:46 +0100
commitab41e41b0f5aed647cc7b4fc9727711b260e978f (patch)
tree75d84e02b24593b393e8a98efadc353579fd8945
parent0599145ecf92aeabf5bd4221a91761237f970323 (diff)
downloadscummvm-rg350-ab41e41b0f5aed647cc7b4fc9727711b260e978f.tar.gz
scummvm-rg350-ab41e41b0f5aed647cc7b4fc9727711b260e978f.tar.bz2
scummvm-rg350-ab41e41b0f5aed647cc7b4fc9727711b260e978f.zip
DREAMWEB: 'playchannel0' and 'playchannel1' ported to C++
-rwxr-xr-xdevtools/tasmrecover/tasm-recover2
-rw-r--r--engines/dreamweb/dreamgen.cpp94
-rw-r--r--engines/dreamweb/dreamgen.h6
-rw-r--r--engines/dreamweb/stubs.cpp56
-rw-r--r--engines/dreamweb/stubs.h4
5 files changed, 58 insertions, 104 deletions
diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index 647b080813..2b4fbb2678 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -266,6 +266,8 @@ generator = cpp(context, "DreamGen", blacklist = [
'powerlightoff',
'accesslighton',
'accesslightoff',
+ 'playchannel0',
+ 'playchannel1',
'createpanel',
'createpanel2',
], skip_output = [
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index d685617f6d..65f002bb3e 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -11831,98 +11831,6 @@ soundfail:
deallocatemem();
}
-void DreamGenContext::playchannel0() {
- STACK_CHECK;
- _cmp(data.byte(kSoundint), 255);
- if (flags.z())
- return /* (dontbother4) */;
- push(es);
- push(ds);
- push(bx);
- push(cx);
- push(di);
- push(si);
- data.byte(kCh0playing) = al;
- es = data.word(kSounddata);
- _cmp(al, 12);
- if (flags.c())
- goto notsecondbank;
- es = data.word(kSounddata2);
- _sub(al, 12);
-notsecondbank:
- data.byte(kCh0repeat) = ah;
- ah = 0;
- _add(ax, ax);
- bx = ax;
- _add(ax, ax);
- _add(bx, ax);
- al = es.byte(bx);
- ah = 0;
- data.word(kCh0emmpage) = ax;
- ax = es.word(bx+1);
- data.word(kCh0offset) = ax;
- ax = es.word(bx+3);
- data.word(kCh0blockstocopy) = ax;
- _cmp(data.byte(kCh0repeat), 0);
- if (flags.z())
- goto nosetloop;
- ax = data.word(kCh0emmpage);
- data.word(kCh0oldemmpage) = ax;
- ax = data.word(kCh0offset);
- data.word(kCh0oldoffset) = ax;
- ax = data.word(kCh0blockstocopy);
- data.word(kCh0oldblockstocopy) = ax;
-nosetloop:
- si = pop();
- di = pop();
- cx = pop();
- bx = pop();
- ds = pop();
- es = pop();
-}
-
-void DreamGenContext::playchannel1() {
- STACK_CHECK;
- _cmp(data.byte(kSoundint), 255);
- if (flags.z())
- return /* (dontbother5) */;
- _cmp(data.byte(kCh1playing), 7);
- if (flags.z())
- return /* (dontbother5) */;
- push(es);
- push(ds);
- push(bx);
- push(cx);
- push(di);
- push(si);
- data.byte(kCh1playing) = al;
- es = data.word(kSounddata);
- _cmp(al, 12);
- if (flags.c())
- goto notsecondbank1;
- es = data.word(kSounddata2);
- _sub(al, 12);
-notsecondbank1:
- ah = 0;
- _add(ax, ax);
- bx = ax;
- _add(ax, ax);
- _add(bx, ax);
- al = es.byte(bx);
- ah = 0;
- data.word(kCh1emmpage) = ax;
- ax = es.word(bx+1);
- data.word(kCh1offset) = ax;
- ax = es.word(bx+3);
- data.word(kCh1blockstocopy) = ax;
- si = pop();
- di = pop();
- cx = pop();
- bx = pop();
- ds = pop();
- es = pop();
-}
-
void DreamGenContext::volumeadjust() {
STACK_CHECK;
al = data.byte(kVolumedirection);
@@ -15109,8 +15017,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_interupttest: interupttest(); break;
case addr_soundend: soundend(); break;
case addr_out22c: out22c(); break;
- case addr_playchannel0: playchannel0(); break;
- case addr_playchannel1: playchannel1(); break;
case addr_volumeadjust: volumeadjust(); break;
case addr_channel0only: channel0only(); break;
case addr_channel1only: channel1only(); break;
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 468e0a2f6d..63173610a9 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -129,8 +129,6 @@ public:
static const uint16 addr_channel1only = 0xc91c;
static const uint16 addr_channel0only = 0xc918;
static const uint16 addr_volumeadjust = 0xc908;
- static const uint16 addr_playchannel1 = 0xc900;
- static const uint16 addr_playchannel0 = 0xc8fc;
static const uint16 addr_out22c = 0xc8f8;
static const uint16 addr_soundend = 0xc8f4;
static const uint16 addr_interupttest = 0xc8f0;
@@ -1516,8 +1514,8 @@ public:
void rollendcredits();
void intro1text();
void transfertoex();
- void playchannel1();
- void playchannel0();
+ //void playchannel1();
+ //void playchannel0();
//void usemon();
void steady();
//void pixelcheckset();
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 5ee27e1878..668e388453 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -2203,14 +2203,60 @@ Frame * DreamGenContext::tempGraphics3() {
return (Frame *)segRef(data.word(kTempgraphics3)).ptr(0, 0);
}
-void DreamGenContext::playchannel0(uint8 index) {
- al = index;
- playchannel0();
+void DreamGenContext::playchannel0(uint8 index, uint8 repeat) {
+ if (data.byte(kSoundint) == 255)
+ return;
+ push(es);
+ push(bx);
+ data.byte(kCh0playing) = index;
+ if (index >= 12) {
+ es = data.word(kSounddata2);
+ index -= 12;
+ } else
+ es = data.word(kSounddata);
+
+ data.byte(kCh0repeat) = repeat;
+ bx = index * 6;
+ data.word(kCh0emmpage) = es.byte(bx);
+ data.word(kCh0offset) = es.word(bx+1);
+ data.word(kCh0blockstocopy) = es.word(bx+3);
+ if (repeat) {
+ data.word(kCh0oldemmpage) = data.word(kCh0emmpage);
+ data.word(kCh0oldoffset) = data.word(kCh0offset);
+ data.word(kCh0oldblockstocopy) = data.word(kCh0blockstocopy);
+ }
+ bx = pop();
+ es = pop();
+}
+
+void DreamGenContext::playchannel0() {
+ playchannel0(al, ah);
}
void DreamGenContext::playchannel1(uint8 index) {
- al = index;
- playchannel1();
+ if (data.byte(kSoundint) == 255)
+ return;
+ if (data.byte(kCh1playing) == 7)
+ return;
+ push(es);
+ push(bx);
+ data.byte(kCh1playing) = index;
+ if (index >= 12) {
+ es = data.word(kSounddata2);
+ index -= 12;
+ } else
+ es = data.word(kSounddata);
+
+ bx = index * 6;
+ data.word(kCh1emmpage) = es.byte(bx);
+ data.word(kCh1offset) = es.word(bx+1);
+ data.word(kCh1blockstocopy) = es.word(bx+3);
+ bx = pop();
+ es = pop();
+}
+
+void DreamGenContext::playchannel1() {
+ playchannel1(al);
}
} /*namespace dreamgen */
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index ba44970e65..f9bd62d928 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -322,7 +322,9 @@
void turnonpower();
void powerlighton();
void powerlightoff();
- void playchannel0(uint8 index);
+ void playchannel0();
+ void playchannel0(uint8 index, uint8 repeat);
+ void playchannel1();
void playchannel1(uint8 index);
void showmainops();
void createpanel();