aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb
diff options
context:
space:
mode:
authorVladimir Menshakov2011-06-16 16:44:58 +0400
committerVladimir Menshakov2011-06-16 16:44:58 +0400
commitd8d16e0231272e73f72630c5a1966db6f1e29809 (patch)
tree3d04f5b8d2d0cc92b86cd63bf9fb469147047739 /engines/dreamweb
parent4fd3cdf984567221035537e4bcab6ff8499d2c4a (diff)
downloadscummvm-rg350-d8d16e0231272e73f72630c5a1966db6f1e29809.tar.gz
scummvm-rg350-d8d16e0231272e73f72630c5a1966db6f1e29809.tar.bz2
scummvm-rg350-d8d16e0231272e73f72630c5a1966db6f1e29809.zip
DREAMWEB: removed while loops from rep+stos/movs instructions
Diffstat (limited to 'engines/dreamweb')
-rw-r--r--engines/dreamweb/dreamgen.cpp171
1 files changed, 57 insertions, 114 deletions
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index e6b6d738fd..ba1e5ba159 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -2711,8 +2711,7 @@ void clearsprites(Context &context) {
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768);
context.al = 255;
context.cx = (32)*16;
- while(context.cx--)
- context._stosb();
+ context._stosb(context.cx);
}
void makesprite(Context &context) {
@@ -2740,8 +2739,7 @@ void delsprite(Context &context) {
context.di = context.bx;
context.cx = (32);
context.al = 255;
- while(context.cx--)
- context._stosb();
+ context._stosb(context.cx);
}
void spriteupdate(Context &context) {
@@ -4082,8 +4080,7 @@ void updatepeople(Context &context) {
context.data.word(kListpos) = context.di;
context.cx = 12*5;
context.al = 255;
- while(context.cx--)
- context._stosb();
+ context._stosb(context.cx);
context._inc(context.data.word(kMaintimer));
context.es = context.cs;
context.bx = 534;
@@ -4726,8 +4723,7 @@ void delthisone(Context &context) {
deloneloop:
context.push(context.cx);
context.ch = 0;
- while(context.cx--)
- context._movsb();
+ context._movsb(context.cx);
context.cx = context.pop();
context._add(context.di, context.ax);
context._add(context.si, context.dx);
@@ -5093,8 +5089,7 @@ void transferinv(Context &context) {
context._mul(context.cx);
context.cx = context.ax;
context.push(context.cx);
- while(context.cx--)
- context._movsb();
+ context._movsb(context.cx);
context.cx = context.pop();
context.ax = context.pop();
context.es.word(context.bx+2) = context.ax;
@@ -5141,8 +5136,7 @@ void transfermap(Context &context) {
context._mul(context.cx);
context.cx = context.ax;
context.push(context.cx);
- while(context.cx--)
- context._movsb();
+ context._movsb(context.cx);
context.cx = context.pop();
context.ax = context.pop();
context.es.word(context.bx+2) = context.ax;
@@ -5181,8 +5175,7 @@ void clearendpal(Context &context) {
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768);
context.cx = 768;
context.al = 0;
- while(context.cx--)
- context._stosb();
+ context._stosb(context.cx);
}
void clearpalette(Context &context) {
@@ -5208,8 +5201,7 @@ void fadetowhite(Context &context) {
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768);
context.cx = 768;
context.al = 63;
- while(context.cx--)
- context._stosb();
+ context._stosb(context.cx);
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768);
context.al = 0;
context._stosb(3);
@@ -5226,8 +5218,7 @@ void fadefromwhite(Context &context) {
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3));
context.cx = 768;
context.al = 63;
- while(context.cx--)
- context._stosb();
+ context._stosb(context.cx);
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3));
context.al = 0;
context._stosb(3);
@@ -5267,13 +5258,11 @@ halfend:
context.si = (0+(180*10)+32+60+(32*32)+(11*10*3))+(56*3);
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768)+(56*3);
context.cx = 3*5;
- while(context.cx--)
- context._movsb();
+ context._movsb(context.cx);
context.si = (0+(180*10)+32+60+(32*32)+(11*10*3))+(77*3);
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768)+(77*3);
context.cx = 3*2;
- while(context.cx--)
- context._movsb();
+ context._movsb(context.cx);
context.data.byte(kFadedirection) = 1;
context.data.byte(kFadecount) = 31;
context.data.byte(kColourpos) = 0;
@@ -5583,8 +5572,7 @@ void paltostartpal(Context &context) {
context.si = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768);
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3));
context.cx = 768/2;
- while(context.cx--)
- context._movsw();
+ context._movsw(context.cx);
}
void endpaltostart(Context &context) {
@@ -5594,8 +5582,7 @@ void endpaltostart(Context &context) {
context.si = (0+(180*10)+32+60+(32*32)+(11*10*3)+768);
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3));
context.cx = 768/2;
- while(context.cx--)
- context._movsw();
+ context._movsw(context.cx);
}
void startpaltoend(Context &context) {
@@ -5605,8 +5592,7 @@ void startpaltoend(Context &context) {
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768);
context.si = (0+(180*10)+32+60+(32*32)+(11*10*3));
context.cx = 768/2;
- while(context.cx--)
- context._movsw();
+ context._movsw(context.cx);
}
void paltoendpal(Context &context) {
@@ -5616,8 +5602,7 @@ void paltoendpal(Context &context) {
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768);
context.si = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768);
context.cx = 768/2;
- while(context.cx--)
- context._movsw();
+ context._movsw(context.cx);
}
void allpalette(Context &context) {
@@ -5627,8 +5612,7 @@ void allpalette(Context &context) {
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3));
context.si = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768);
context.cx = 768/2;
- while(context.cx--)
- context._movsw();
+ context._movsw(context.cx);
dumpcurrent(context);
}
@@ -5654,8 +5638,7 @@ void fadedownmon(Context &context) {
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768)+(231*3);
context.cx = 3*8;
context.ax = 0;
- while(context.cx--)
- context._stosb();
+ context._stosb(context.cx);
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768)+(246*3);
context._stosb();
context._stosw();
@@ -5675,8 +5658,7 @@ void fadeupmon(Context &context) {
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3))+(231*3);
context.cx = 3*8;
context.ax = 0;
- while(context.cx--)
- context._stosb();
+ context._stosb(context.cx);
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3))+(246*3);
context._stosb();
context._stosw();
@@ -5696,8 +5678,7 @@ void fadeupmonfirst(Context &context) {
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3))+(231*3);
context.cx = 3*8;
context.ax = 0;
- while(context.cx--)
- context._stosb();
+ context._stosb(context.cx);
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3))+(246*3);
context._stosb();
context._stosw();
@@ -5720,8 +5701,7 @@ void fadeupyellows(Context &context) {
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768)+(231*3);
context.cx = 3*8;
context.ax = 0;
- while(context.cx--)
- context._stosb();
+ context._stosb(context.cx);
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768)+(246*3);
context._stosb();
context._stosw();
@@ -5740,8 +5720,7 @@ void initialmoncols(Context &context) {
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3))+(230*3);
context.cx = 3*9;
context.ax = 0;
- while(context.cx--)
- context._stosb();
+ context._stosb(context.cx);
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3))+(246*3);
context._stosb();
context._stosw();
@@ -6718,8 +6697,7 @@ void findallryan(Context &context) {
context.push(context.di);
context.cx = 30;
context.ax = 0x0ffff;
- while(context.cx--)
- context._stosw();
+ context._stosw(context.cx);
context.di = context.pop();
context.cl = 4;
context.ds = context.data.word(kExtras);
@@ -6754,8 +6732,7 @@ void findallopen(Context &context) {
context.push(context.di);
context.cx = 16;
context.ax = 0x0ffff;
- while(context.cx--)
- context._stosw();
+ context._stosw(context.cx);
context.di = context.pop();
context.cl = context.data.byte(kOpenedob);
context.dl = context.data.byte(kOpenedtype);
@@ -8572,8 +8549,7 @@ void transfertoex(Context &context) {
context.ds = context.data.word(kFreedat);
context.si = context.ax;
context.cx = 8;
- while(context.cx--)
- context._movsw();
+ context._movsw(context.cx);
context.di = context.pop();
context.al = context.data.byte(kReallocation);
context.es.byte(context.di) = context.al;
@@ -8653,8 +8629,7 @@ void transfercontoex(Context &context) {
context.ds = context.pop();
context.push(context.di);
context.cx = 8;
- while(context.cx--)
- context._movsw();
+ context._movsw(context.cx);
context.di = context.pop();
context.dx = context.pop();
context.al = context.data.byte(kReallocation);
@@ -8830,8 +8805,7 @@ void deleteexobject(Context &context) {
context.push(context.cx);
context.al = 255;
context.cx = 16;
- while(context.cx--)
- context._stosb();
+ context._stosb(context.cx);
context.ax = context.pop();
context.cl = context.al;
context._add(context.al, context.al);
@@ -8891,8 +8865,7 @@ void deleteexframe(Context &context) {
context._add(context.si, context.ax);
context.push(context.ax);
context.ds = context.es;
- while(context.cx--)
- context._movsb();
+ context._movsb(context.cx);
context.bx = context.pop();
context._sub(context.data.word(kExframepos), context.bx);
context.si = context.pop();
@@ -8936,8 +8909,7 @@ findlenextext:
context.push(context.bx);
context.push(context.ax);
context._sub(context.cx, context.bx);
- while(context.cx--)
- context._movsb();
+ context._movsb(context.cx);
context.bx = context.pop();
context._sub(context.data.word(kExtextpos), context.bx);
context.si = context.pop();
@@ -9185,8 +9157,7 @@ oberase:
context.di = context.bx;
context.al = 255;
context.cx = (32);
- while(context.cx--)
- context._stosb();
+ context._stosb(context.cx);
notthisob:
context.bx = context.pop();
context.cx = context.pop();
@@ -9205,8 +9176,7 @@ void showallobs(Context &context) {
context.di = context.bx;
context.cx = 128*5;
context.al = 255;
- while(context.cx--)
- context._stosb();
+ context._stosb(context.cx);
context.es = context.data.word(kSetframes);
context.data.word(kFrsegment) = context.es;
context.ax = (0);
@@ -9331,8 +9301,7 @@ void showallfree(Context &context) {
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5));
context.cx = 80*5;
context.al = 255;
- while(context.cx--)
- context._stosb();
+ context._stosb(context.cx);
context.es = context.data.word(kFreeframes);
context.data.word(kFrsegment) = context.es;
context.ax = (0);
@@ -9415,8 +9384,7 @@ void showallex(Context &context) {
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5));
context.cx = 100*5;
context.al = 255;
- while(context.cx--)
- context._stosb();
+ context._stosb(context.cx);
context.es = context.data.word(kExtras);
context.data.word(kFrsegment) = context.es;
context.ax = (0);
@@ -10623,14 +10591,12 @@ void usemon(Context &context) {
context.di = 2970+1;
context.cx = 12;
context.al = 32;
- while(context.cx--)
- context._stosb();
+ context._stosb(context.cx);
context.es = context.cs;
context.di = 2942+1;
context.cx = 12;
context.al = 32;
- while(context.cx--)
- context._stosb();
+ context._stosb(context.cx);
context.es = context.cs;
context.di = 2836;
context.es.byte(context.di) = 1;
@@ -11001,8 +10967,7 @@ void input(Context &context) {
context.di = 8045;
context.cx = 64;
context.al = 0;
- while(context.cx--)
- context._stosb();
+ context._stosb(context.cx);
context.data.word(kCurpos) = 0;
context.al = '>';
context.di = context.data.word(kMonadx);
@@ -11240,8 +11205,7 @@ dirroot:
context.di = 2970;
context._inc(context.di);
context.cx = 12;
- while(context.cx--)
- context._movsb();
+ context._movsb(context.cx);
monitorlogo(context);
scrollmonitor(context);
context.al = 9;
@@ -11545,8 +11509,7 @@ keyok2:
context.es = context.cs;
context.di = 2970+1;
context.cx = 12;
- while(context.cx--)
- context._movsb();
+ context._movsb(context.cx);
monitorlogo(context);
scrollmonitor(context);
context.al = 10;
@@ -11666,8 +11629,7 @@ void parser(Context &context) {
context.di = 2942;
context.cx = 13;
context.al = 0;
- while(context.cx--)
- context._stosb();
+ context._stosb(context.cx);
context.di = 2942;
context.al = '=';
context._stosb();
@@ -17017,8 +16979,7 @@ alreadyactsave:
context.bx = context.di;
context.es = context.cs;
context.cx = 16;
- while(context.cx--)
- context._movsw();
+ context._movsw(context.cx);
context.al = context.data.byte(kRoomssample);
context.es.byte(context.bx+13) = context.al;
context.al = context.data.byte(kMapx);
@@ -17376,8 +17337,7 @@ void namestoold(Context &context) {
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5));
context.es = context.data.word(kBuffers);
context.cx = 17*4;
- while(context.cx--)
- context._movsb();
+ context._movsb(context.cx);
}
void oldtonames(Context &context) {
@@ -17387,8 +17347,7 @@ void oldtonames(Context &context) {
context.si = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5));
context.ds = context.data.word(kBuffers);
context.cx = 17*4;
- while(context.cx--)
- context._movsb();
+ context._movsb(context.cx);
}
void saveposition(Context &context) {
@@ -17797,8 +17756,7 @@ void trysoundalloc(Context &context) {
context.di = 0;
context.cx = 16384/2;
context.ax = 0x7f7f;
- while(context.cx--)
- context._stosw();
+ context._stosw(context.cx);
context.data.byte(kNeedsoundbuff) = 1;
return;
soundfail:
@@ -17940,8 +17898,7 @@ notch0only:
context.di = context.data.word(kSoundbufferwrite);
context.cx = 1024;
context.ax = 0x7f7f;
- while(context.cx--)
- context._stosw();
+ context._stosw(context.cx);
context._and(context.di, 16384-1);
context.data.word(kSoundbufferwrite) = context.di;
}
@@ -18013,8 +17970,7 @@ void channel0tran(Context &context) {
if (!context.flags.z())
goto lowvolumetran;
context.cx = 1024;
- while(context.cx--)
- context._movsw();
+ context._movsw(context.cx);
return;
lowvolumetran:
context.cx = 1024;
@@ -18465,28 +18421,24 @@ void clearbuffers(Context &context) {
context.cx = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*24)+(6*64)+991-534+68-0)/2;
context.ax = 0;
context.di = 0;
- while(context.cx--)
- context._stosw();
+ context._stosw(context.cx);
context.es = context.data.word(kExtras);
context.cx = (0+2080+30000+(16*114)+((114+2)*2)+18000)/2;
context.ax = 0x0ffff;
context.di = 0;
- while(context.cx--)
- context._stosw();
+ context._stosw(context.cx);
context.es = context.data.word(kBuffers);
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*24)+(6*64));
context.ds = context.cs;
context.si = 534;
context.cx = (991-534);
- while(context.cx--)
- context._movsb();
+ context._movsb(context.cx);
context.es = context.data.word(kBuffers);
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*24)+(6*64)+991-534);
context.ds = context.cs;
context.si = 0;
context.cx = (68-0);
- while(context.cx--)
- context._movsb();
+ context._movsb(context.cx);
clearchanges(context);
}
@@ -18496,22 +18448,19 @@ void clearchanges(Context &context) {
context.cx = (250)*2;
context.ax = 0x0ffff;
context.di = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80));
- while(context.cx--)
- context._stosw();
+ context._stosw(context.cx);
context.ds = context.data.word(kBuffers);
context.si = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*24)+(6*64));
context.es = context.cs;
context.di = 534;
context.cx = (991-534);
- while(context.cx--)
- context._movsb();
+ context._movsb(context.cx);
context.ds = context.data.word(kBuffers);
context.si = (0+(180*10)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*24)+(6*64)+991-534);
context.es = context.cs;
context.di = 0;
context.cx = (68-0);
- while(context.cx--)
- context._movsb();
+ context._movsb(context.cx);
context.data.byte(kExpos) = 0;
context.data.word(kExframepos) = 0;
context.data.word(kExtextpos) = 0;
@@ -18519,8 +18468,7 @@ void clearchanges(Context &context) {
context.cx = (0+2080+30000+(16*114)+((114+2)*2)+18000)/2;
context.ax = 0x0ffff;
context.di = 0;
- while(context.cx--)
- context._stosw();
+ context._stosw(context.cx);
context.es = context.cs;
context.di = 8011;
context.al = 1;
@@ -18531,8 +18479,7 @@ void clearchanges(Context &context) {
context._stosb();
context.ax = 0;
context.cx = 6;
- while(context.cx--)
- context._stosw();
+ context._stosw(context.cx);
}
void clearbeforeload(Context &context) {
@@ -18563,8 +18510,7 @@ void clearrest(Context &context) {
context.cx = (66*60)/2;
context.ax = 0;
context.di = (0);
- while(context.cx--)
- context._stosw();
+ context._stosw(context.cx);
context.es = context.data.word(kBackdrop);
deallocatemem(context);
context.es = context.data.word(kSetframes);
@@ -20607,8 +20553,7 @@ finishmakename:
context._stosb();
return;
context.al = 255;
- while(context.cx--)
- context._stosb();
+ context._stosb(context.cx);
}
void findobname(Context &context) {
@@ -21827,8 +21772,7 @@ blimey:
context.push(context.cx);
context.push(context.si);
context.cx = (66);
- while(context.cx--)
- context._movsb();
+ context._movsb(context.cx);
context.si = context.pop();
context.cx = context.pop();
context._add(context.si, 132);
@@ -22083,8 +22027,7 @@ void fillspace(Context &context) {
context.push(context.bx);
context.di = context.dx;
context.es = context.ds;
- while(context.cx--)
- context._stosb();
+ context._stosb(context.cx);
context.bx = context.pop();
context.di = context.pop();
context.dx = context.pop();