code:
//-------------------------------------------------------------------------
/*
Copyright (C) 1996, 2003 - 3D Realms Entertainment
Copyright (C) 2017-2019 Nuke.YKT

This file is part of Duke Nukem 3D version 1.5 - Atomic Edition

Duke Nukem 3D is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

Original Source: 1996 - Todd Replogle
Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------

#define SECTOREFFECTOR 1
#define ACTIVATOR 2
#define TOUCHPLATE 3
#define ACTIVATORLOCKED 4
#define MUSICANDSFX 5
#define LOCATORS 6
#define CYCLER 7
#define MASTERSWITCH 8
#define RESPAWN 9
#define GPSPEED 10
#define RRTILE11 11
#define PLEASEWAIT 12
#define FOF 13
//#define WEATHERWARN 14
#define RPG2SPRITE 14
#define DUKETAG 15
#define SIGN1 16
#define SIGN2 17
#define RRTILE18 18
#define RRTILE19 19
#define ARROW 20
#define FIRSTGUNSPRITE 21
#define CHAINGUNSPRITE 22
#define RPGSPRITE 23
#define FREEZESPRITE 24
#define SHRINKERSPRITE 25
#define HEAVYHBOMB 26
#define TRIPBOMBSPRITE 27
#define SHOTGUNSPRITE 28
#define DEVISTATORSPRITE 29
#define HEALTHBOX 30
#define AMMOBOX 31
#define GROWSPRITEICON 32
#define INVENTORYBOX 33
#define RRTILE34 34
#define RRTILE35 35
#define DESTRUCTO 36
#define FREEZEAMMO 37
#define RRTILE38 38
#define AMMO 40
#define BATTERYAMMO 41
#define DEVISTATORAMMO 42
#define RRTILE43 43
#define RPGAMMO 44
#define GROWAMMO 45
#define CRYSTALAMMO 46
#define HBOMBAMMO 47
#define AMMOLOTS 48
#define SHOTGUNAMMO 49
#define COLA 51
#define SIXPAK 52
#define FIRSTAID 53
#define SHIELD 54
#define STEROIDS 55
#define AIRTANK 56
#define JETPACK 57
#define HEATSENSOR 59
#define ACCESSCARD 60
#define BOOTS 61
#define GUTMETER 62
#define RRTILE63 63
#define RRTILE64 64
#define RRTILE65 65
#define RRTILE66 66
#define RRTILE67 67
#define RRTILE68 68
#define MIRRORBROKE 70
#define SOUNDFX 71
#define TECHLIGHT2 72
#define TECHLIGHTBUST2 73
#define TECHLIGHT4 74
#define TECHLIGHTBUST4 75
#define WALLLIGHT4 76
#define WALLLIGHTBUST4 77
#define MOTOAMMO 78
#define BUTTON1 80
#define ACCESSSWITCH 82
#define SLOTDOOR 84
#define LIGHTSWITCH 86
#define SPACEDOORSWITCH 88
#define SPACELIGHTSWITCH 90
#define FRANKENSTINESWITCH 92
#define NUKEBUTTON 94
#define MULTISWITCH 98
#define DOORTILE1 102
#define DOORTILE2 103
#define DOORTILE3 104
#define DOORTILE4 105
#define DOORTILE5 106
#define DOORTILE6 107
#define DOORTILE7 108
#define DOORTILE8 109
#define DOORTILE9 110
#define DOORTILE10 111
#define DOORTILE14 115
#define DOORTILE15 116
#define DOORTILE16 117
#define DOORTILE18 119
#define DOORSHOCK 120
#define DIPSWITCH 121
#define DIPSWITCH2 123
#define TECHSWITCH 125
#define DIPSWITCH3 127
#define ACCESSSWITCH2 129
#define REFLECTWATERTILE 131
#define FLOORSLIME 132
#define BIGFORCE 135
#define EPISODE 137
#define MASKWALL1 138
#define MASKWALL2 140
#define MASKWALL3 141
#define MASKWALL4 142
#define MASKWALL5 143
#define MASKWALL6 144
#define MASKWALL8 146
#define MASKWALL9 147
#define MASKWALL10 148
#define MASKWALL11 149
#define MASKWALL12 150
#define MASKWALL13 151
#define MASKWALL14 152
#define MASKWALL15 153
#define FIREEXT 155
#define W_LIGHT 156
#define SCREENBREAK1 159
#define SCREENBREAK2 160
#define SCREENBREAK3 161
#define SCREENBREAK4 162
#define SCREENBREAK5 163
#define SCREENBREAK6 164
#define SCREENBREAK7 165
#define SCREENBREAK8 166
#define SCREENBREAK9 167
#define SCREENBREAK10 168
#define SCREENBREAK11 169
#define SCREENBREAK12 170
#define SCREENBREAK13 171
#define W_TECHWALL1 185
#define W_TECHWALL2 186
#define W_TECHWALL3 187
#define W_TECHWALL4 188
#define W_TECHWALL10 189
#define W_TECHWALL15 191
#define W_TECHWALL16 192
#define STATIC 195
#define W_SCREENBREAK 199
#define W_HITTECHWALL3 205
#define W_HITTECHWALL4 206
#define W_HITTECHWALL2 207
#define W_HITTECHWALL1 208
#define FANSPRITE 210
#define FANSPRITEBROKE 215
#define FANSHADOW 216
#define FANSHADOWBROKE 219
#define DOORTILE19 229
#define DOORTILE20 230
#define DOORTILE22 232
#define GRATE1 234
#define BGRATE1 235
#define SPLINTERWOOD 237
#define WATERDRIP 239
#define WATERBUBBLE 240
#define WATERBUBBLEMAKER 241
#define W_FORCEFIELD 242
#define WALLLIGHT3 244
#define WALLLIGHTBUST3 245
#define WALLLIGHT1 246
#define WALLLIGHTBUST1 247
#define WALLLIGHT2 248
#define WALLLIGHTBUST2 249
#define LIGHTSWITCH2 250
#define UFOBEAM 252
#define RRTILE280 280
#define RRTILE281 281
#define RRTILE282 282
#define RRTILE283 283
#define RRTILE285 285
#define RRTILE286 286
#define RRTILE287 287
#define RRTILE288 288
#define RRTILE289 289
#define RRTILE290 290
#define RRTILE291 291
#define RRTILE292 292
#define RRTILE293 293
#define RRTILE295 295
#define RRTILE296 296
#define RRTILE297 297
#define CDPLAYER 370
#define RRTILE380 380
#define RRTILE403 403
#define RRTILE409 409
#define BIGFNTCURSOR 512
#define SMALLFNTCURSOR 513
#define STARTALPHANUM 514
#define ENDALPHANUM 607
#define BIGALPHANUM 632
#define BIGPERIOD 694
#define BIGCOMMA 695
#define BIGX 696
#define BIGQ 697
#define BIGSEMI 698
#define BIGCOLIN 699
#define THREEBYFIVE 702
#define BIGAPPOS 714
#define MINIFONT 718
#define W_NUMBERS 810
#define BLANK 820
#define RESPAWNMARKERRED 866
#define RESPAWNMARKERYELLOW 876
#define RESPAWNMARKERGREEN 886
#define SPINNINGNUKEICON 896
#define GUTMETER_LIGHT1 920
#define GUTMETER_LIGHT2 921
#define GUTMETER_LIGHT3 922
#define GUTMETER_LIGHT4 923
#define AMMO_ICON 930
#define CLOUDYSKIES 1021
#define MOONSKY1 1022
#define MOONSKY2 1023
#define MOONSKY3 1024
#define MOONSKY4 1025
#define BIGORBIT1 1026
#define BIGORBIT2 1027
#define BIGORBIT3 1028
#define BIGORBIT4 1029
#define BIGORBIT5 1030
#define LA 1031
#define REDSKY1 1040
#define REDSKY2 1041
#define WATERTILE 1044
#define WATERTILE2 1045
#define SATELLITE 1049
#define VIEWSCREEN2 1052
#define VIEWSCREENBROKE 1054
#define VIEWSCREEN 1055
#define GLASS 1056
#define GLASS2 1057
#define STAINGLASS1 1063
#define SATELITE 1066
#define FUELPOD 1067
#define SLIMEPIPE 1070
#define CRACK1 1075
#define CRACK2 1076
#define CRACK3 1077
#define CRACK4 1078
#define FOOTPRINTS 1079
#define DOMELITE 1080
#define CAMERAPOLE 1083
#define CHAIR1 1085
#define CHAIR2 1086
#define BROKENCHAIR 1088
#define MIRROR 1089
#define WATERFOUNTAIN 1092
#define WATERFOUNTAINBROKE 1096
#define FEMMAG1 1097
#define TOILET 1098
#define STALL 1100
#define STALLBROKE 1102
#define FEMMAG2 1106
#define REACTOR2 1107
#define REACTOR2BURNT 1108
#define REACTOR2SPARK 1109
#define SOLARPANNEL 1114
#define NAKED1 1115
#define ANTENNA 1117
#define TOILETBROKE 1120
#define PIPE2 1121
#define PIPE1B 1122
#define PIPE3 1123
#define PIPE1 1124
#define PIPE2B 1126
#define BOLT1 1127
#define PIPE3B 1132
#define CAMERA1 1134
#define BRICK 1139
#define VACUUM 1141
#define JURYGUY 1142
#define FOOTPRINTS2 1144
#define FOOTPRINTS3 1145
#define FOOTPRINTS4 1146
#define EGG 1147
#define SCALE 1150
#define CHAIR3 1152
#define CAMERALIGHT 1157
#define MOVIECAMERA 1158
#define FOOTPRINT 1160
#define IVUNIT 1163
#define POT1 1164
#define POT2 1165
#define POT3 1166
#define STATUE 1168
#define MIKE 1170
#define VASE 1172
#define SUSHIPLATE1 1174
#define SUSHIPLATE2 1175
#define SUSHIPLATE3 1176
#define SUSHIPLATE4 1178
#define SUSHIPLATE5 1180
#define BIGHOLE2 1182
#define STRIPEBALL 1184
#define QUEBALL 1185
#define POCKET 1186
#define WOODENHORSE 1187
#define TREE1 1191
#define TREE2 1193
#define CACTUS 1194
#define TOILETWATER 1196
#define NEON1 1200
#define NEON2 1201
#define CACTUSBROKE 1203
#define BOUNCEMINE 1204
#define BROKEFIREHYDRENT 1210
#define BOX 1211
#define BULLETHOLE 1212
#define BOTTLE1 1215
#define BOTTLE2 1216
#define BOTTLE3 1217
#define BOTTLE4 1218
#define BOTTLE5 1219
#define BOTTLE6 1220
#define BOTTLE7 1221
#define BOTTLE8 1222
#define SNAKEP 1224
#define DOLPHIN1 1225
#define DOLPHIN2 1226
#define HYDRENT 1228
#define TIRE 1230
#define PIPE5 1232
#define PIPE6 1233
#define PIPE4 1234
#define PIPE4B 1235
#define BROKEHYDROPLANT 1237
#define PIPE5B 1239
#define NEON3 1241
#define NEON4 1242
#define NEON5 1243
#define SPOTLITE 1247
#define HANGOOZ 1249
#define HORSEONSIDE 1251
#define GLASSPIECES 1256
#define HORSELITE 1259
#define DONUTS 1263
#define NEON6 1264
#define CLOCK 1266
#define RUBBERCAN 1268
#define BROKENCLOCK 1270
#define PLUG 1272
#define OOZFILTER 1273
#define FLOORPLASMA 1276
#define HANDPRINTSWITCH 1278
#define BOTTLE10 1280
#define BOTTLE11 1281
#define BOTTLE12 1282
#define BOTTLE13 1283
#define BOTTLE14 1284
#define BOTTLE15 1285
#define BOTTLE16 1286
#define BOTTLE17 1287
#define BOTTLE18 1288
#define BOTTLE19 1289
#define VENDMACHINE 1291
#define VENDMACHINEBROKE 1293
#define COLAMACHINE 1294
#define COLAMACHINEBROKE 1296
#define CRANEPOLE 1298
#define CRANE 1299
#define BARBROKE 1302
#define BLOODPOOL 1303
#define NUKEBARREL 1304
#define NUKEBARRELDENTED 1305
#define NUKEBARRELLEAKED 1306
#define CANWITHSOMETHING 1309
#define MONEY 1310
#define BANNER 1313
#define EXPLODINGBARREL 1315
#define EXPLODINGBARREL2 1316
#define FIREBARREL 1317
#define SEENINE 1324
#define SEENINEDEAD 1325
#define STEAM 1327
#define CEILINGSTEAM 1332
#define PIPE6B 1337
#define TRANSPORTERBEAM 1338
#define RAT 1344
#define TRASH 1346
#define HELECOPT 1348
#define FETUSJIB 1349
#define HOLODUKE 1350
#define MONK 1354
#define SPACEMARINE 1355
#define LUKE 1356
#define INDY 1357
#define FETUS 1360
#define FETUSBROKE 1361
#define WATERSPLASH2 1383
#define FIREVASE 1388
#define SCRATCH 1389
#define BLOOD 1391
#define TRANSPORTERSTAR 1398
#define LOOGIE 1405
#define FIST 1408
#define FREEZEBLAST 1409
#define DEVISTATORBLAST 1410
#define TONGUE 1414
#define MORTER 1416
#define MUD 1420
#define SHRINKEREXPLOSION 1421
#define RADIUSEXPLOSION 1426
#define FORCERIPPLE 1427
#define CANNONBALL 1437
#define INNERJAW 1439
#define EXPLOSION2 1441
#define EXPLOSION3 1442
#define JIBS1 1463
#define JIBS2 1468
#define JIBS3 1473
#define JIBS4 1478
#define JIBS5 1483
#define CRACKKNUCKLES 1489
#define HEADERBAR 1493
#define BURNING 1494
#define FIRE 1495
#define USERWEAPON 1510
#define JIBS6 1515
#define BLOODSPLAT1 1525
#define BLOODSPLAT3 1526
#define BLOODSPLAT2 1527
#define BLOODSPLAT4 1528
#define OOZ 1529
#define WALLBLOOD1 1530
#define WALLBLOOD2 1531
#define WALLBLOOD3 1532
#define WALLBLOOD4 1533
#define WALLBLOOD5 1534
#define WALLBLOOD6 1535
#define WALLBLOOD7 1536
#define WALLBLOOD8 1537
#define OOZ2 1538
#define BURNING2 1539
#define FIRE2 1540
#define SMALLSMOKE 1554
#define SMALLSMOKEMAKER 1555
#define FLOORFLAME 1558
#define GREENSLIME 1575
#define WATERDRIPSPLASH 1585
#define SCRAP6 1595
#define SCRAP1 1605
#define SCRAP2 1609
#define SCRAP3 1613
#define SCRAP4 1617
#define SCRAP5 1621
#define ROTATEGUN 1624
#define BETAVERSION 1629
#define PLAYERISHERE 1630
#define PLAYERWASHERE 1631
#define SELECTDIR 1632
#define F1HELP 1633
#define NOTCHON 1634
#define NOTCHOFF 1635
#define RRTILE1636 1636
#define DUKEICON 1637
#define BADGUYICON 1638
#define FOODICON 1639
#define GETICON 1640
#define MENUSCREEN 1641
#define MENUBAR 1642
#define KILLSICON 1643
#define FIRSTAID_ICON 1645
#define HEAT_ICON 1646
#define BOTTOMSTATUSBAR 1647
#define BOOT_ICON 1648
#define WEAPONBAR 1649
#define FRAGBAR 1650
#define JETPACK_ICON 1652
#define AIRTANK_ICON 1653
#define STEROIDS_ICON 1654
#define HOLODUKE_ICON 1655
#define ACCESS_ICON 1656
#define DIGITALNUM 1657
#define CAMCORNER 1667
#define CAMLIGHT 1669
#define LOGO 1670
#define TITLE 1671
#define NUKEWARNINGICON 1672
#define MOUSECURSOR 1673
#define SLIDEBAR 1674
#define DUKECAR 1676
#define DREALMS 1677
#define BETASCREEN 1678
#define WINDOWBORDER1 1679
#define TEXTBOX 1680
#define WINDOWBORDER2 1681
#define DUKENUKEM 1682
#define THREEDEE 1683
#define INGAMEDUKETHREEDEE 1684
#define TENSCREEN 1685
#define PLUTOPAKSPRITE 1686
#define CROSSHAIR 1689
#define FALLINGCLIP 1699
#define CLIPINHAND 1700
#define HAND 1701
#define SHELL 1702
#define SHOTGUNSHELL 1704
#define RPGMUZZLEFLASH 1714
#define CATLITE 1721
#define HANDHOLDINGLASER 1732
#define TRIPBOMB 1735
#define LASERLINE 1736
#define HANDHOLDINGACCESS 1737
#define HANDREMOTE 1739
#define TIP 1745
#define GLAIR 1747
#define SPACEMASK 1753
#define RRTILE1752 1752
#define FORCESPHERE 1759
#define SHOTSPARK1 1764
#define RPG 1774
#define RPG2 1781
// #define LASERSITE 1781
#define RRTILE1790 1790
#define RRTILE1792 1792
#define RRTILE1801 1801
#define RRTILE1805 1805
#define RRTILE1807 1807
#define RRTILE1808 1808
#define RRTILE1812 1812
#define RRTILE1814 1814
#define RRTILE1817 1817
#define RRTILE1821 1821
#define RRTILE1824 1824
#define RRTILE1826 1826
#define RRTILE1850 1850
#define RRTILE1851 1851
#define RRTILE1856 1856
#define RRTILE1877 1877
#define RRTILE1878 1878
#define RRTILE1938 1938
#define RRTILE1939 1939
#define RRTILE1942 1942
#define RRTILE1944 1944
#define RRTILE1945 1945
#define RRTILE1947 1947
#define RRTILE1951 1951
#define RRTILE1952 1952
#define RRTILE1953 1953
#define RRTILE1961 1961
#define RRTILE1964 1964
#define RRTILE1973 1973
#define RRTILE1985 1985
#define RRTILE1986 1986
#define RRTILE1987 1987
#define RRTILE1988 1988
#define RRTILE1990 1990
#define RRTILE1995 1995
#define RRTILE1996 1996
#define RRTILE2004 2004
#define RRTILE2005 2005
#define POPCORN 2021
#define RRTILE2022 2022
#define LANEPICS 2023
#define RRTILE2025 2025
#define RRTILE2026 2026
#define RRTILE2027 2027
#define RRTILE2028 2028
#define RRTILE2034 2034
#define RRTILE2050 2050
#define RRTILE2052 2052
#define RRTILE2053 2053
#define RRTILE2056 2056
#define RRTILE2060 2060
#define RRTILE2072 2072
#define RRTILE2074 2074
#define RRTILE2075 2075
#define RRTILE2083 2083
#define COOLEXPLOSION1 2095
#define RRTILE2097 2097
#define RRTILE2121 2121
#define RRTILE2122 2122
#define RRTILE2123 2123
#define RRTILE2124 2124
#define RRTILE2125 2125
#define RRTILE2126 2126
#define RRTILE2137 2137
#define RRTILE2132 2132
#define RRTILE2136 2136
#define RRTILE2139 2139
#define RRTILE2150 2150
#define RRTILE2151 2151
#define RRTILE2152 2152
#define RRTILE2156 2156
#define RRTILE2157 2157
#define RRTILE2158 2158
#define RRTILE2159 2159
#define RRTILE2160 2160
#define RRTILE2161 2161
#define RRTILE2175 2175
#define RRTILE2176 2176
#define RRTILE2178 2178
#define RRTILE2186 2186
#define RRTILE2214 2214
#define WAITTOBESEATED 2215
#define OJ 2217
#define HURTRAIL 2221
#define POWERSWITCH1 2222
#define LOCKSWITCH1 2224
#define POWERSWITCH2 2226
#define ATM 2229
#define STATUEFLASH 2231
#define ATMBROKE 2233
#define FEMPIC5 2235
#define FEMPIC6 2236
#define FEMPIC7 2237
#define REACTOR 2239
#define REACTORSPARK 2243
#define REACTORBURNT 2247
#define HANDSWITCH 2249
#define CIRCLEPANNEL 2251
#define CIRCLEPANNELBROKE 2252
#define PULLSWITCH 2254
#define ALIENSWITCH 2259
#define DOORTILE21 2261
#define DOORTILE17 2263
#define MASKWALL7 2264
#define JAILBARBREAK 2265
#define DOORTILE11 2267
#define DOORTILE12 2268
#define EXPLOSION2BOT 2272
#define RRTILE2319 2319
#define RRTILE2321 2321
#define RRTILE2326 2326
#define RRTILE2329 2329
#define RRTILE2357 2357
#define RRTILE2382 2382
#define RRTILE2430 2430
#define RRTILE2431 2431
#define RRTILE2432 2432
#define RRTILE2437 2437
#define RRTILE2443 2443
#define RRTILE2445 2445
#define RRTILE2446 2446
#define RRTILE2450 2450
#define RRTILE2451 2451
#define RRTILE2455 2455
#define RRTILE2460 2460
#define RRTILE2465 2465
#define BONUSSCREEN 2510
#define VIEWBORDER 2520
#define VICTORY1 2530
#define ORDERING 2531
#define TEXTSTORY 2541
#define LOADSCREEN 2542
#define RRTILE2560 2560
#define RRTILE2562 2562
#define RRTILE2564 2564
#define RRTILE2573 2573
#define RRTILE2574 2574
#define RRTILE2577 2577
#define RRTILE2578 2578
#define RRTILE2581 2581
#define RRTILE2583 2583
#define RRTILE2604 2604
#define RRTILE2610 2610
#define RRTILE2613 2613
#define RRTILE2621 2621
#define RRTILE2622 2622
#define RRTILE2636 2636
#define RRTILE2637 2637
#define RRTILE2654 2654
#define RRTILE2656 2656
#define RRTILE2676 2676
#define RRTILE2689 2689
#define RRTILE2697 2697
#define RRTILE2702 2702
#define RRTILE2707 2707
#define RRTILE2732 2732
#define HATRACK 2717
#define DESKLAMP 2719
#define COFFEEMACHINE 2721
#define CUPS 2722
#define GAVALS 2723
#define GAVALS2 2724
#define POLICELIGHTPOLE 2726
#define FLOORBASKET 2728
#define PUKE 2729
#define DOORTILE23 2731
#define TOPSECRET 2733
#define SPEAKER 2734
#define TEDDYBEAR 2735
#define ROBOTDOG 2737
#define ROBOTPIRATE 2739
#define ROBOTMOUSE 2740
#define MAIL 2741
#define MAILBAG 2742
#define HOTMEAT 2744
#define COFFEEMUG 2745
#define DONUTS2 2746
#define TRIPODCAMERA 2747
#define METER 2748
#define DESKPHONE 2749
#define GUMBALLMACHINE 2750
#define GUMBALLMACHINEBROKE 2751
#define PAPER 2752
#define MACE 2753
#define GENERICPOLE2 2754
#define XXXSTACY 2755
#define WETFLOOR 2756
#define BROOM 2757
#define MOP 2758
#define PIRATE1A 2759
#define PIRATE4A 2760
#define PIRATE2A 2761
#define PIRATE5A 2762
#define PIRATE3A 2763
#define PIRATE6A 2764
#define PIRATEHALF 2765
#define CHESTOFGOLD 2767
#define SIDEBOLT1 2768
#define FOODOBJECT1 2773
#define FOODOBJECT2 2774
#define FOODOBJECT3 2775
#define FOODOBJECT4 2776
#define FOODOBJECT5 2777
#define FOODOBJECT6 2778
#define FOODOBJECT7 2779
#define FOODOBJECT8 2780
#define FOODOBJECT9 2781
#define FOODOBJECT10 2782
#define FOODOBJECT11 2783
#define FOODOBJECT12 2784
#define FOODOBJECT13 2785
#define FOODOBJECT14 2786
#define FOODOBJECT15 2787
#define FOODOBJECT16 2788
#define FOODOBJECT17 2789
#define FOODOBJECT18 2790
#define FOODOBJECT19 2791
#define FOODOBJECT20 2792
#define HEADLAMP 2793
#define SKINNEDCHICKEN 2794
#define FEATHEREDCHICKEN 2795
#define TAMPON 2796
#define ROBOTDOG2 2797
#define JOLLYMEAL 2800
#define DUKEBURGER 2801
#define SHOPPINGCART 2806
#define CANWITHSOMETHING2 2807
#define CANWITHSOMETHING3 2808
#define CANWITHSOMETHING4 2809
#define RRTILE2030 2030
#define RRTILE2831 2831
#define RRTILE2832 2832
#define RRTILE2842 2842
#define RRTILE2859 2859
#define RRTILE2876 2876
#define RRTILE2878 2878
#define RRTILE2879 2879
#define RRTILE2893 2893
#define RRTILE2894 2894
#define RRTILE2898 2898
#define RRTILE2899 2899
#define RRTILE2915 2915
#define RRTILE2940 2940
#define RRTILE2944 2944
#define RRTILE2945 2945
#define RRTILE2946 2946
#define RRTILE2947 2947
#define RRTILE2948 2948
#define RRTILE2949 2949
#define RRTILE2961 2961
#define RRTILE2970 2970
#define RRTILE2977 2977
#define RRTILE2978 2978
#define GLASS3 2983
#define BORNTOBEWILDSCREEN 2985
#define BLIMP 2989
#define RRTILE2990 2990
#define FEM9 2991
#define POOP 2998
#define FRAMEEFFECT1 2999
#define PANNEL1 3003
#define PANNEL2 3004
#define PANNEL3 3005
#define BPANNEL1 3006
#define BPANNEL3 3007
#define SCREENBREAK14 3008
#define SCREENBREAK15 3009
#define SCREENBREAK19 3011
#define SCREENBREAK16 3013
#define SCREENBREAK17 3014
#define SCREENBREAK18 3015
#define W_TECHWALL11 3016
#define W_TECHWALL12 3017
#define W_TECHWALL13 3018
#define W_TECHWALL14 3019
#define W_TECHWALL5 3020
#define W_TECHWALL6 3022
#define W_TECHWALL7 3024
#define W_TECHWALL8 3026
#define W_TECHWALL9 3028
#define W_HITTECHWALL16 3030
#define W_HITTECHWALL10 3031
#define W_HITTECHWALL15 3033
#define W_MILKSHELF 3035
#define W_MILKSHELFBROKE 3036
#define PURPLELAVA 3038
#define LAVABUBBLE 3040
#define DUKECUTOUT 3047
#define TARGET 3049
#define GUNPOWDERBARREL 3050
#define DUCK 3051
#define HYDROPLANT 3053
#define OCEANSPRITE1 3055
#define OCEANSPRITE2 3056
#define OCEANSPRITE3 3057
#define OCEANSPRITE4 3058
#define OCEANSPRITE5 3059
#define GENERICPOLE 3061
#define CONE 3062
#define HANGLIGHT 3063
#define RRTILE3073 3073
#define RRTILE3083 3083
#define RRTILE3100 3100
#define RRTILE3114 3114
#define RRTILE3115 3115
#define RRTILE3116 3116
#define RRTILE3117 3117
#define RRTILE3120 3120
#define RRTILE3121 3121
#define RRTILE3122 3122
#define RRTILE3123 3123
#define RRTILE3124 3124
#define RRTILE3132 3132
#define RRTILE3139 3139
#define RRTILE3144 3144
#define RRTILE3152 3152
#define RRTILE3153 3153
#define RRTILE3155 3155
#define RRTILE3171 3171
#define RRTILE3172 3172
#define RRTILE3190 3190
#define RRTILE3191 3191
#define RRTILE3192 3192
#define RRTILE3195 3195
#define RRTILE3200 3200
#define RRTILE3201 3201
#define RRTILE3202 3202
#define RRTILE3203 3203
#define RRTILE3204 3204
#define RRTILE3205 3205
#define RRTILE3206 3206
#define RRTILE3207 3207
#define RRTILE3208 3208
#define RRTILE3209 3209
#define RRTILE3216 3216
#define RRTILE3218 3218
#define RRTILE3219 3219
#define RRTILE3232 3232
#define FEMPIC1 3239
#define FEMPIC2 3248
#define BLANKSCREEN 3252
#define PODFEM1 3253
#define FEMPIC3 3257
#define FEMPIC4 3265
#define FEM1 3271
#define FEM2 3276
#define FEM3 3280
#define FEM5 3282
#define BLOODYPOLE 3283
#define FEM4 3284
#define FEM6 3293
#define FEM6PAD 3294
#define FEM8 3295
#define FEM7 3298
#define ORGANTIC 3308
#define FIRSTGUN 3328
#define FIRSTGUNRELOAD 3336
#define KNEE 3340
#define SHOTGUN 3350
#define HANDTHROW 3360
#define SHOTGUNSHELLS 3372
#define SCUBAMASK 3374
#define CHAINGUN 3380
#define SHRINKER 3384
#define CIRCLESTUCK 3388
#define SPIT 3390
#define GROWSPARK 3395
#define SHRINKSPARK 3400
#define RRTILE3410 3410
#define LUMBERBLADE 3411
#define FREEZE 3415
#define FIRELASER 3420
#define BOWLINGBALLH 3428
#define BOWLINGBALL 3430
#define BOWLINGBALLSPRITE 3437
#define POWDERH 3438
#define RRTILE3440 3440
#define DEVISTATOR 3445
#define RPGGUN 3452
#define RRTILE3462 3462
#define OWHIP 3471
#define UWHIP 3475
#define RPGGUN2 3482
#define RRTILE3497 3497
#define RRTILE3498 3498
#define RRTILE3499 3499
#define RRTILE3500 3500
#define SLINGBLADE 3510
#define RRTILE3584 3584
#define RRTILE3586 3586
#define RRTILE3587 3587
#define RRTILE3600 3600
#define RRTILE3631 3631
#define RRTILE3635 3635
#define RRTILE3637 3637
#define RRTILE3643 3643
#define RRTILE3647 3647
#define RRTILE3652 3652
#define RRTILE3653 3653
#define RRTILE3668 3668
#define RRTILE3671 3671
#define RRTILE3673 3673
#define RRTILE3684 3684
#define RRTILE3708 3708
#define RRTILE3714 3714
#define RRTILE3716 3716
#define RRTILE3720 3720
#define RRTILE3723 3723
#define RRTILE3725 3725
#define RRTILE3737 3737
#define RRTILE3754 3754
#define RRTILE3762 3762
#define RRTILE3763 3763
#define RRTILE3764 3764
#define RRTILE3765 3765
#define RRTILE3767 3767
#define RRTILE3773 3773
#define RRTILE3774 3774
#define RRTILE3793 3793
#define RRTILE3795 3795
#define RRTILE3804 3804
#define RRTILE3814 3814
#define RRTILE3815 3815
#define RRTILE3819 3819
#define BIGHOLE 3822
#define RRTILE3827 3827
#define RRTILE3837 3837
#define APLAYERTOP 3840
#define APLAYER 3845
#define PLAYERONWATER 3860
#define DUKELYINGDEAD 3998
#define DUKEGUN 4041
#define DUKETORSO 4046
#define DUKELEG 4055
#define FECES 4802
#define DRONE 4916
//#define RRTILE4956 4956
#define RECON 4989
#define RRTILE5014 5014
#define RRTILE5016 5016
#define RRTILE5017 5017
#define RRTILE5018 5018
#define RRTILE5019 5019
#define RRTILE5020 5020
#define RRTILE5021 5021
#define RRTILE5022 5022
#define RRTILE5023 5023
#define RRTILE5024 5024
#define RRTILE5025 5025
#define RRTILE5026 5026
#define RRTILE5027 5027
#define RRTILE5029 5029
#define RRTILE5030 5030
#define RRTILE5031 5031
#define RRTILE5032 5032
#define RRTILE5033 5033
#define RRTILE5034 5034
#define RRTILE5035 5035
#define RRTILE5036 5036
#define RRTILE5037 5037
#define RRTILE5038 5038
#define RRTILE5039 5039
#define RRTILE5040 5040
#define RRTILE5041 5041
#define RRTILE5043 5043
#define RRTILE5044 5044
#define RRTILE5045 5045
#define RRTILE5046 5046
#define RRTILE5047 5047
#define RRTILE5048 5048
#define RRTILE5049 5049
#define RRTILE5050 5050
#define RRTILE5051 5051
#define RRTILE5052 5052
#define RRTILE5053 5053
#define RRTILE5054 5054
#define RRTILE5055 5055
#define RRTILE5056 5056
#define RRTILE5057 5057
#define RRTILE5058 5058
#define RRTILE5059 5059
#define RRTILE5061 5061
#define RRTILE5062 5062
#define RRTILE5063 5063
#define RRTILE5064 5064
#define RRTILE5065 5065
#define RRTILE5066 5066
#define RRTILE5067 5067
#define RRTILE5068 5068
#define RRTILE5069 5069
#define RRTILE5070 5070
#define RRTILE5071 5071
#define RRTILE5072 5072
#define RRTILE5073 5073
#define RRTILE5074 5074
#define RRTILE5075 5075
#define RRTILE5076 5076
#define RRTILE5077 5077
#define RRTILE5078 5078
#define RRTILE5079 5079
#define RRTILE5080 5080
#define RRTILE5081 5081
#define RRTILE5082 5082
#define RRTILE5083 5083
#define RRTILE5084 5084
#define RRTILE5085 5085
#define RRTILE5086 5086
#define RRTILE5087 5087
#define RRTILE5088 5088
#define RRTILE5090 5090
#define SHARK 5501
#define FEM10 5581
#define TOUGHGAL 5583
#define MAN 5588
#define MAN2 5589
#define WOMAN 5591
#define ATOMICHEALTH 5595
#define RRTILE6144 6144
#define MOTOGUN 7168
#define RRTILE7169 7169
#define MOTOHIT 7170
#define BOATHIT 7175
#define RRTILE7184 7184
#define RRTILE7190 7190
#define RRTILE7191 7191
#define RRTILE7213 7213
#define RRTILE7219 7219
#define EMPTYBIKE 7220
#define EMPTYBOAT 7233
#define RRTILE7424 7424
#define RRTILE7430 7430
#define RRTILE7433 7433
#define RRTILE7441 7441
#define RRTILE7547 7547
#define RRTILE7467 7467
#define RRTILE7469 7469
#define RRTILE7470 7470
#define RRTILE7475 7475
#define RRTILE7478 7478
#define RRTILE7505 7505
#define RRTILE7506 7506
#define RRTILE7534 7534
#define RRTILE7540 7540
#define RRTILE7533 7533
#define RRTILE7545 7545
#define RRTILE7552 7552
#define RRTILE7553 7553
#define RRTILE7554 7554
#define RRTILE7555 7555
#define RRTILE7557 7557
#define RRTILE7558 7558
#define RRTILE7559 7559
#define RRTILE7561 7561
#define RRTILE7566 7566
#define RRTILE7568 7568
#define RRTILE7574 7574
#define RRTILE7575 7575
#define RRTILE7576 7576
#define RRTILE7578 7578
#define RRTILE7579 7579
#define RRTILE7580 7580
#define RRTILE7595 7595
#define RRTILE7629 7629
#define RRTILE7636 7636
#define RRTILE7638 7638
#define RRTILE7640 7640
#define RRTILE7644 7644
#define RRTILE7646 7646
#define RRTILE7648 7648
#define RRTILE7650 7650
#define RRTILE7653 7653
#define RRTILE7655 7655
#define RRTILE7657 7657
#define RRTILE7659 7659
#define RRTILE7691 7691
#define RRTILE7694 7694
#define RRTILE7696 7696
#define RRTILE7697 7697
#define RRTILE7700 7700
#define RRTILE7702 7702
#define RRTILE7704 7704
#define RRTILE7705 7705
#define RRTILE7711 7711
#define RRTILE7716 7716
#define RRTILE7756 7756
#define RRTILE7768 7768
#define RRTILE7806 7806
#define RRTILE7820 7820
#define RRTILE7859 7859
#define RRTILE7870 7870
#define RRTILE7873 7873
#define RRTILE7875 7875
#define RRTILE7876 7876
#define RRTILE7879 7879
#define RRTILE7881 7881
#define RRTILE7883 7883
#define RRTILE7885 7885
#define RRTILE7886 7886
#define RRTILE7887 7887
#define RRTILE7888 7888
#define RRTILE7889 7889
#define RRTILE7890 7890
#define RRTILE7900 7900
#define RRTILE7901 7901
#define RRTILE7906 7906
#define RRTILE7912 7912
#define RRTILE7913 7913
#define RRTILE7936 7936
#define RRTILE8047 8047
#define MULTISWITCH2 8048
#define RRTILE8059 8059
#define RRTILE8060 8060
#define RRTILE8063 8063
#define RRTILE8067 8067
#define RRTILE8076 8076
#define RRTILE8094 8094
#define RRTILE8096 8096
#define RRTILE8099 8099
#define RRTILE8106 8106
#define RRTILE8162 8162
#define RRTILE8163 8163
#define RRTILE8164 8164
#define RRTILE8165 8165
#define RRTILE8166 8166
#define RRTILE8167 8167
#define RRTILE8168 8168
#define RRTILE8192 8192
#define RRTILE8193 8193
#define RRTILE8215 8215
#define RRTILE8216 8216
#define RRTILE8217 8217
#define RRTILE8218 8218
#define RRTILE8220 8220
#define RRTILE8221 8221
#define RRTILE8222 8222
#define RRTILE8223 8223
#define RRTILE8224 8224
#define RRTILE8227 8227
#define RRTILE8312 8312
#define RRTILE8370 8370
#define RRTILE8371 8371
#define RRTILE8372 8372
#define RRTILE8373 8373
#define RRTILE8379 8379
#define RRTILE8380 8380
#define RRTILE8385 8385
#define RRTILE8386 8386
#define RRTILE8387 8387
#define RRTILE8388 8388
#define RRTILE8389 8389
#define RRTILE8390 8390
#define RRTILE8391 8391
#define RRTILE8392 8392
#define RRTILE8394 8394
#define RRTILE8395 8395
#define RRTILE8396 8396
#define RRTILE8397 8397
#define RRTILE8398 8398
#define RRTILE8399 8399
#define RRTILE8423 8423
#define RRTILE8448 8448
#define RRTILE8450 8450
#define BOATAMMO 8460
#define RRTILE8461 8461
#define RRTILE8462 8462
#define RRTILE8464 8464
#define RRTILE8475 8475
#define RRTILE8487 8487
#define RRTILE8488 8488
#define RRTILE8489 8489
#define RRTILE8490 8490
#define RRTILE8496 8496
#define RRTILE8497 8497
#define RRTILE8498 8498
#define RRTILE8499 8499
#define RRTILE8503 8503
#define RRTILE8525 8525
#define RRTILE8537 8537
#define RRTILE8565 8565
#define RRTILE8567 8567
#define RRTILE8568 8568
#define RRTILE8569 8569
#define RRTILE8570 8570
#define RRTILE8571 8571
#define RRTILE8579 8579
#define RRTILE8588 8588
#define RRTILE8589 8589
#define RRTILE8590 8590
#define RRTILE8591 8591
#define RRTILE8592 8592
#define RRTILE8593 8593
#define RRTILE8594 8594
#define RRTILE8595 8595
#define RRTILE8596 8596
#define RRTILE8598 8598
#define RRTILE8605 8605
#define RRTILE8608 8608
#define RRTILE8609 8609
#define RRTILE8611 8611
#define RRTILE8617 8617
#define RRTILE8618 8618
#define RRTILE8620 8620
#define RRTILE8621 8621
#define RRTILE8622 8622
#define RRTILE8623 8623
#define RRTILE8640 8640
#define RRTILE8651 8651
#define RRTILE8660 8660
#define RRTILE8677 8677
#define RRTILE8679 8679
#define RRTILE8680 8680
#define RRTILE8681 8681
#define RRTILE8682 8682
#define RRTILE8683 8683
#define RRTILE8704 8704

// RR bad guys
#define BOSS1 4477
#define BOSS2 4557
#define BOSS3 4607
#define BOSS4 4221

#define BOULDER 256
#define BOULDER1 264
#define TORNADO 1930
#define CHEERBOMB 3464
#define CHEERBLADE 3460
#define DOGATTACK 4060
#define BILLYWALK 4096
#define BILLYDIE 4137
#define BILLYCOCK 4147
#define BILLYRAY 4162
#define BILLYRAYSTAYPUT 4163
#define BILLYBUT 4188
#define BILLYSCRATCH 4191
#define BILLYSNIFF 4195
#define BILLYWOUND 4202
#define BILLYGORE 4228
#define BILLYJIBA 4235
#define BILLYJIBB 4244
#define BRAYSNIPER 4249
#define DOGRUN 4260
#define DOGDIE 4295
#define DOGDEAD 4303
#define DOGBARK 4305
#define LTH 4352
#define LTHSTRAFE 4395
#define HULKHANG 4409
#define HULKHANGDEAD 4410
#define HULKJUMP 4429
#define LTHLOAD 4430
#define LTHDIE 4456
#define BUBBASCRATCH 4464
#define BUBBANOSE 4476
#define BUBBAPISS 4487
#define BUBBASTAND 4504
#define BUBBAOUCH 4506
#define BUBBADIE 4513
#define BUBBADEAD 4523
#define HULK 4649
#define HULKSTAYPUT 4650
#define HULKA 4651
#define HULKB 4652
#define HULKC 4653
#define HULKJIBA 4748
#define HULKJIBB 4753
#define HULKJIBC 4758
#define SBSWIPE 4770
#define SBPAIN 4810
#define SBDIE 4820
#define HEN 4861
#define HENSTAYPUT 4862
#define HENSTAND 4897
#define PIG 4945
#define PIGSTAYPUT 4946
#define PIGEAT 4983
#define SBMOVE 5015
#define SBSPIT 5050
#define SBDIP 5085
#define MINION 5120
#define MINIONSTAYPUT 5121

#ifdef RRRA
# define UFO1 5260
#else
# define UFO1 5270
#endif

#define UFO2 5274
#define UFO3 5278
#define UFO4 5282
#define UFO5 5286
#define MINJIBA 5290
#define MINJIBB 5295
#define MINJIBC 5300
#define COW 5317
#define COOT 5376
#define COOTSTAYPUT 5377
#define COOTSHOOT 5411
#define COOTDIE 5437
#define COOTDUCK 5481
#define COOTPAIN 5548
#define COOTTRANS 5568
#define COOTGETUP 5579
#define COOTJIBA 5602
#define COOTJIBB 5607
#define COOTJIBC 5616
#define VIXEN 5635
#define VIXENPAIN 5675
#define VIXENDIE 5710
#define VIXENSHOOT 5720
#define VIXENWDN 5740
#define VIXENWUP 5775
#define VIXENKICK 5805
#define VIXENTELE 5845
#define VIXENTEAT 5851
#define BIKEJIBA 5872
#define BIKEJIBB 5877
#define BIKEJIBC 5882
#define BIKERB 5890
#define BIKERBV2 5891
#define BIKER 5995
#define BIKERJIBA 6112
#define BIKERJIBB 6117
#define BIKERJIBC 6121
#define BIKERJIBD 6127
#define MAKEOUT 6225
#define CHEERB 6401
#define CHEER 6658
#define CHEERSTAYPUT 6659
#define CHEERJIBA 7000
#define CHEERJIBB 7005
#define CHEERJIBC 7010
#define CHEERJIBD 7015
#define FBOATJIBA 7020
#define FBOATJIBB 7025
#define COOTPLAY 7030
#define BILLYPLAY 7035
#define MINIONBOAT 7192
#define HULKBOAT 7199
#define CHEERBOAT 7206
#define RRTILE7274 7274
#define RABBIT 7280
#define RABBITJIBA 7387
#define RABBITJIBB 7392
#define RABBITJIBC 7397
#define ROCK 8035
#define ROCK2 8036
#define MAMACLOUD 8663
#define MAMA 8705
#define MAMAJIBA 8890
#define MAMAJIBB 8895


code:
//-------------------------------------------------------------------------
/*
Copyright (C) 1996, 2003 - 3D Realms Entertainment
Copyright (C) 2017-2019 Nuke.YKT

This file is part of Duke Nukem 3D version 1.5 - Atomic Edition

Duke Nukem 3D is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

Original Source: 1996 - Todd Replogle, Ken Silverman
Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------

static long dmval;

#pragma aux sqr =\
	"imul eax, eax",\
   parm nomemory [eax]\
	modify exact [eax]\
   value [eax]

#pragma aux scale =\
	"imul edx",\
	"idiv ecx",\
	parm nomemory [eax][edx][ecx]\
	modify exact [eax edx]\

#pragma aux mulscale =\
	"imul edx",\
	"shrd eax, edx, cl",\
	parm nomemory [eax][edx][ecx]\
	modify exact [eax edx]\

#pragma aux mulscale1 =\
	"imul edx",\
	"shrd eax, edx, 1",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale2 =\
	"imul edx",\
	"shrd eax, edx, 2",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale3 =\
	"imul edx",\
	"shrd eax, edx, 3",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale4 =\
	"imul edx",\
	"shrd eax, edx, 4",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale5 =\
	"imul edx",\
	"shrd eax, edx, 5",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale6 =\
	"imul edx",\
	"shrd eax, edx, 6",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale7 =\
	"imul edx",\
	"shrd eax, edx, 7",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale8 =\
	"imul edx",\
	"shrd eax, edx, 8",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale9 =\
	"imul edx",\
	"shrd eax, edx, 9",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale10 =\
	"imul edx",\
	"shrd eax, edx, 10",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale11 =\
	"imul edx",\
	"shrd eax, edx, 11",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale12 =\
	"imul edx",\
	"shrd eax, edx, 12",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale13 =\
	"imul edx",\
	"shrd eax, edx, 13",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale14 =\
	"imul edx",\
	"shrd eax, edx, 14",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale15 =\
	"imul edx",\
	"shrd eax, edx, 15",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale16 =\
	"imul edx",\
	"shrd eax, edx, 16",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale17 =\
	"imul edx",\
	"shrd eax, edx, 17",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale18 =\
	"imul edx",\
	"shrd eax, edx, 18",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale19 =\
	"imul edx",\
	"shrd eax, edx, 19",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale20 =\
	"imul edx",\
	"shrd eax, edx, 20",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale21 =\
	"imul edx",\
	"shrd eax, edx, 21",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale22 =\
	"imul edx",\
	"shrd eax, edx, 22",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale23 =\
	"imul edx",\
	"shrd eax, edx, 23",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale24 =\
	"imul edx",\
	"shrd eax, edx, 24",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale25 =\
	"imul edx",\
	"shrd eax, edx, 25",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale26 =\
	"imul edx",\
	"shrd eax, edx, 26",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale27 =\
	"imul edx",\
	"shrd eax, edx, 27",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale28 =\
	"imul edx",\
	"shrd eax, edx, 28",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale29 =\
	"imul edx",\
	"shrd eax, edx, 29",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale30 =\
	"imul edx",\
	"shrd eax, edx, 30",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale31 =\
	"imul edx",\
	"shrd eax, edx, 31",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\

#pragma aux mulscale32 =\
	"imul edx",\
	parm nomemory [eax][edx]\
	modify exact [eax edx]\
	value [edx]\

#pragma aux dmulscale =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, cl",\
	parm nomemory [eax][edx][esi][edi][ecx]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale1 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 1",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale2 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 2",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale3 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 3",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale4 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 4",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale5 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 5",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale6 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 6",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale7 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 7",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale8 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 8",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale9 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 9",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale10 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 10",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale11 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 11",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale12 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 12",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale13 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 13",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale14 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 14",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale15 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 15",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale16 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 16",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale17 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 17",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale18 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 18",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale19 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 19",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale20 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 20",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale21 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 21",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale22 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 22",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale23 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 23",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale24 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 24",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale25 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 25",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale26 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 26",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale27 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 27",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale28 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 28",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale29 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 29",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale30 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 30",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale31 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	"shrd eax, edx, 31",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\

#pragma aux dmulscale32 =\
	"imul edx",\
	"mov ebx, eax",\
	"mov eax, esi",\
	"mov esi, edx",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, esi",\
	parm nomemory [eax][edx][esi][edi]\
	modify exact [eax ebx edx esi]\
	value [edx]\

#pragma aux tmulscale1 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 1",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale2 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 2",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale3 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 3",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale4 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 4",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale5 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 5",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale6 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 6",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale7 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 7",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale8 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 8",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale9 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 9",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale10 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 10",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale11 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 11",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale12 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 12",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale13 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 13",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale14 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 14",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale15 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 15",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale16 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 16",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale17 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 17",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale18 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 18",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale19 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 19",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale20 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 20",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale21 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 21",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale22 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 22",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale23 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 23",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale24 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 24",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale25 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 25",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale26 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 26",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale27 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 27",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale28 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 28",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale29 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 29",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale30 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 30",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale31 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	"shrd eax, edx, 31",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux tmulscale32 =\
	"imul edx",\
	"xchg eax, ebx",\
	"xchg edx, ecx",\
	"imul edx",\
	"add ebx, eax",\
	"adc ecx, edx",\
	"mov eax, esi",\
	"imul edi",\
	"add eax, ebx",\
	"adc edx, ecx",\
	parm nomemory [eax][edx][ebx][ecx][esi][edi]\
	modify exact [eax ebx ecx edx]\
	value [edx]\

#pragma aux boundmulscale =\
	"imul ebx",\
	"mov ebx, edx",\
	"shrd eax, edx, cl",\
	"sar edx, cl",\
	"xor edx, eax",\
	"js checkit",\
	"xor edx, eax",\
	"jz skipboundit",\
	"cmp edx, 0xffffffff",\
	"je skipboundit",\
	"checkit:",\
	"mov eax, ebx",\
	"sar eax, 31",\
	"xor eax, 0x7fffffff",\
	"skipboundit:",\
	parm nomemory [eax][ebx][ecx]\
	modify exact [eax ebx edx]\

#pragma aux divscale =\
	"mov edx, eax",\
	"shl eax, cl",\
	"neg cl",\
	"sar edx, cl",\
	"idiv ebx",\
	parm nomemory [eax][ebx][ecx]\
	modify exact [eax ecx edx]\

#pragma aux divscale1 =\
	"add eax, eax",\
	"sbb edx, edx",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale2 =\
	"mov edx, eax",\
	"sar edx, 30",\
	"lea eax, [eax*4]",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale3 =\
	"mov edx, eax",\
	"sar edx, 29",\
	"lea eax, [eax*8]",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale4 =\
	"mov edx, eax",\
	"sar edx, 28",\
	"shl eax, 4",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale5 =\
	"mov edx, eax",\
	"sar edx, 27",\
	"shl eax, 5",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale6 =\
	"mov edx, eax",\
	"sar edx, 26",\
	"shl eax, 6",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale7 =\
	"mov edx, eax",\
	"sar edx, 25",\
	"shl eax, 7",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale8 =\
	"mov edx, eax",\
	"sar edx, 24",\
	"shl eax, 8",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale9 =\
	"mov edx, eax",\
	"sar edx, 23",\
	"shl eax, 9",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale10 =\
	"mov edx, eax",\
	"sar edx, 22",\
	"shl eax, 10",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale11 =\
	"mov edx, eax",\
	"sar edx, 21",\
	"shl eax, 11",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale12 =\
	"mov edx, eax",\
	"sar edx, 20",\
	"shl eax, 12",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale13 =\
	"mov edx, eax",\
	"sar edx, 19",\
	"shl eax, 13",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale14 =\
	"mov edx, eax",\
	"sar edx, 18",\
	"shl eax, 14",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale15 =\
	"mov edx, eax",\
	"sar edx, 17",\
	"shl eax, 15",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale16 =\
	"mov edx, eax",\
	"sar edx, 16",\
	"shl eax, 16",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale17 =\
	"mov edx, eax",\
	"sar edx, 15",\
	"shl eax, 17",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale18 =\
	"mov edx, eax",\
	"sar edx, 14",\
	"shl eax, 18",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale19 =\
	"mov edx, eax",\
	"sar edx, 13",\
	"shl eax, 19",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale20 =\
	"mov edx, eax",\
	"sar edx, 12",\
	"shl eax, 20",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale21 =\
	"mov edx, eax",\
	"sar edx, 11",\
	"shl eax, 21",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale22 =\
	"mov edx, eax",\
	"sar edx, 10",\
	"shl eax, 22",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale23 =\
	"mov edx, eax",\
	"sar edx, 9",\
	"shl eax, 23",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale24 =\
	"mov edx, eax",\
	"sar edx, 8",\
	"shl eax, 24",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale25 =\
	"mov edx, eax",\
	"sar edx, 7",\
	"shl eax, 25",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale26 =\
	"mov edx, eax",\
	"sar edx, 6",\
	"shl eax, 26",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale27 =\
	"mov edx, eax",\
	"sar edx, 5",\
	"shl eax, 27",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale28 =\
	"mov edx, eax",\
	"sar edx, 4",\
	"shl eax, 28",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale29 =\
	"mov edx, eax",\
	"sar edx, 3",\
	"shl eax, 29",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale30 =\
	"mov edx, eax",\
	"sar edx, 2",\
	"shl eax, 30",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale31 =\
	"mov edx, eax",\
	"sar edx, 1",\
	"shl eax, 31",\
	"idiv ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax edx]\

#pragma aux divscale32 =\
	"xor eax, eax",\
	"idiv ebx",\
	parm nomemory [edx][ebx]\
	modify exact [eax edx]\

#pragma aux int5 =\
	"int 0x5",\

#pragma aux setvmode =\
	"int 0x10",\
	parm [eax]\

#pragma aux setupmouse =\
	"mov ax, 0",\
	"int 33h",\
	"and eax, 0x0000ffff",\
	modify exact [eax]\

#pragma aux readmousexy =\
	"mov ax, 11d",\
	"int 33h",\
	"mov [esi], cx",\
	"mov [edi], dx",\
	parm [esi][edi]\
	modify exact [eax ebx ecx edx]\

#pragma aux readmousebstatus =\
	"mov ax, 5d",\
	"int 33h",\
	"mov [esi], ax",\
	parm [esi]\
	modify exact [eax ebx ecx edx]\

#pragma aux readpixel =\
	"mov al, byte ptr [edi]",\
	parm nomemory [edi]\
	modify exact [eax]\

#pragma aux drawpixel =\
	"mov byte ptr [edi], al",\
	parm [edi][eax]\
	modify exact \

#pragma aux drawpixels =\
	"mov word ptr [edi], ax",\
	parm [edi][eax]\
	modify exact \

#pragma aux drawpixelses =\
	"mov dword ptr [edi], eax",\
	parm [edi][eax]\
	modify exact \

#pragma aux clearbuf =\
	"rep stosd",\
	parm [edi][ecx][eax]\
	modify exact [edi ecx]\

#pragma aux clearbufbyte =\
	"cmp ecx, 4",\
	"jae longcopy",\
	"test cl, 1",\
	"jz preskip",\
	"stosb",\
	"preskip: shr ecx, 1",\
	"rep stosw",\
	"jmp endit",\
	"longcopy: test edi, 1",\
	"jz skip1",\
	"stosb",\
	"dec ecx",\
	"skip1: test edi, 2",\
	"jz skip2",\
	"stosw",\
	"sub ecx, 2",\
	"skip2: mov ebx, ecx",\
	"shr ecx, 2",\
	"rep stosd",\
	"test bl, 2",\
	"jz skip3",\
	"stosw",\
	"skip3: test bl, 1",\
	"jz endit",\
	"stosb",\
	"endit:",\
	parm [edi][ecx][eax]\
	modify [ebx]\

#pragma aux copybuf =\
	"rep movsd",\
	parm [esi][edi][ecx]\
	modify exact [ecx esi edi]\

#pragma aux copybufbyte =\
	"cmp ecx, 4",\
	"jae longcopy",\
	"test cl, 1",\
	"jz preskip",\
	"movsb",\
	"preskip: shr ecx, 1",\
	"rep movsw",\
	"jmp endit",\
	"longcopy: test edi, 1",\
	"jz skip1",\
	"movsb",\
	"dec ecx",\
	"skip1: test edi, 2",\
	"jz skip2",\
	"movsw",\
	"sub ecx, 2",\
	"skip2: mov ebx, ecx",\
	"shr ecx, 2",\
	"rep movsd",\
	"test bl, 2",\
	"jz skip3",\
	"movsw",\
	"skip3: test bl, 1",\
	"jz endit",\
	"movsb",\
	"endit:",\
	parm [esi][edi][ecx]\
	modify [ebx]\

#pragma aux copybufreverse =\
	"shr ecx, 1",\
	"jnc skipit1",\
	"mov al, byte ptr [esi]",\
	"dec esi",\
	"mov byte ptr [edi], al",\
	"inc edi",\
	"skipit1: shr ecx, 1",\
	"jnc skipit2",\
	"mov ax, word ptr [esi-1]",\
	"sub esi, 2",\
	"ror ax, 8",\
	"mov word ptr [edi], ax",\
	"add edi, 2",\
	"skipit2: test ecx, ecx",\
	"jz endloop",\
	"begloop: mov eax, dword ptr [esi-3]",\
	"sub esi, 4",\
	"bswap eax",\
	"mov dword ptr [edi], eax",\
	"add edi, 4",\
	"dec ecx",\
	"jnz begloop",\
	"endloop:",\
	parm [esi][edi][ecx]\

#pragma aux qinterpolatedown16 =\
	"mov ebx, ecx",\
	"shr ecx, 1",\
	"jz skipbegcalc",\
	"begqcalc: lea edi, [edx+esi]",\
	"sar edx, 16",\
	"mov dword ptr [eax], edx",\
	"lea edx, [edi+esi]",\
	"sar edi, 16",\
	"mov dword ptr [eax+4], edi",\
	"add eax, 8",\
	"dec ecx",\
	"jnz begqcalc",\
	"test ebx, 1",\
	"jz skipbegqcalc2",\
	"skipbegcalc: sar edx, 16",\
	"mov dword ptr [eax], edx",\
	"skipbegqcalc2:",\
	parm [eax][ecx][edx][esi]\
	modify exact [eax ebx ecx edx edi]\

#pragma aux qinterpolatedown16short =\
	"test ecx, ecx",\
	"jz endit",\
	"test al, 2",\
	"jz skipalignit",\
	"mov ebx, edx",\
	"sar ebx, 16",\
	"mov word ptr [eax], bx",\
	"add edx, esi",\
	"add eax, 2",\
	"dec ecx",\
	"jz endit",\
	"skipalignit: sub ecx, 2",\
	"jc finishit",\
	"begqcalc: mov ebx, edx",\
	"add edx, esi",\
	"sar ebx, 16",\
	"mov edi, edx",\
	"and edi, 0ffff0000h",\
	"add edx, esi",\
	"add ebx, edi",\
	"mov dword ptr [eax], ebx",\
	"add eax, 4",\
	"sub ecx, 2",\
	"jnc begqcalc",\
	"test cl, 1",\
	"jz endit",\
	"finishit: mov ebx, edx",\
	"sar ebx, 16",\
	"mov word ptr [eax], bx",\
	"endit:",\
	parm [eax][ecx][edx][esi]\
	modify exact [eax ebx ecx edx edi]\

#pragma aux setcolor16 =\
	"mov dx, 0x3ce",\
	"shl ax, 8",\
	"out dx, ax",\
	parm [eax]\
	modify exact [eax edx]\

#pragma aux vlin16first =\
	"mov al, byte ptr [edi]",\
	"mov eax, ecx",\
	"shr ecx, 2",\
	"begvlin16firsta: mov byte ptr [edi], al",\
	"mov byte ptr [edi+80], al",\
	"mov byte ptr [edi+160], al",\
	"mov byte ptr [edi+240], al",\
	"add edi, 320",\
	"dec ecx",\
	"jnz begvlin16firsta",\
	"mov ecx, eax",\
	"and ecx, 3",\
	"jz skipfirst",\
	"begvlin16firstb: mov byte ptr [edi], al",\
	"add edi, 80",\
	"dec ecx",\
	"jnz begvlin16firstb",\
	"skipfirst:",\
	parm [edi][ecx]\
	modify exact [eax ecx edi]\

#pragma aux vlin16 =\
	"mov esi, edi",\
	"begvlin16: movsb",\
	"add edi, 79",\
	"add esi, 79",\
	"dec ecx",\
	"jnz begvlin16",\
	parm [edi][ecx]\
	modify exact [ecx esi edi]\

#pragma aux drawpixel16 =\
	"mov ecx, edi",\
	"mov eax, 0x00008008",\
	"mov dx, 0x3ce",\
	"ror ah, cl",\
	"shr edi, 3",\
	"out dx, ax",\
	"mov cl, byte ptr [edi+0xa0000]",\
	"mov byte ptr [edi+0xa0000], al",\
	parm [edi]\
	modify exact [eax ecx edx edi]\

#pragma aux fillscreen16 =\
	"mov dx, 0x3ce",\
	"shl ax, 8",\
	"out dx, ax",\
	"mov ax, 0xff08",\
	"out dx, ax",\
	"shr ecx, 5",\
	"add edi, 0xa0000",\
	"rep stosd",\
	parm [edi][eax][ecx]\
	modify exact [eax ecx edx edi]\

#pragma aux koutp =\
	"out dx, al",\
	parm [edx][eax]\
	modify exact \

#pragma aux koutpw =\
	"out dx, ax",\
	parm [edx][eax]\
	modify exact \

#pragma aux kinp =\
	"in al, dx",\
	parm nomemory [edx]\
	modify exact [eax]\

#pragma aux mul3 =\
	"lea eax, [eax+eax*2]",\
	parm nomemory [eax]\

#pragma aux mul5 =\
	"lea eax, [eax+eax*4]",\
	parm nomemory [eax]\

#pragma aux mul9 =\
	"lea eax, [eax+eax*8]",\
	parm nomemory [eax]\

	//returns eax/ebx, dmval = eax%edx;
#pragma aux divmod =\
	"xor edx, edx",\
	"div ebx",\
	"mov dmval, edx",\
	parm [eax][ebx]\
	modify exact [eax edx]\
	value [eax]

	//returns eax%ebx, dmval = eax/edx;
#pragma aux moddiv =\
	"xor edx, edx",\
	"div ebx",\
	"mov dmval, eax",\
	parm [eax][ebx]\
	modify exact [eax edx]\
	value [edx]

#pragma aux klabs =\
	"test eax, eax",\
	"jns skipnegate",\
	"neg eax",\
	"skipnegate:",\
	parm nomemory [eax]\

#pragma aux ksgn =\
	"add ebx, ebx",\
	"sbb eax, eax",\
	"cmp eax, ebx",\
	"adc al, 0",\
	parm nomemory [ebx]\
	modify exact [eax ebx]\

	//eax = (unsigned min)umin(eax,ebx)
#pragma aux umin =\
	"sub eax, ebx",\
	"sbb ecx, ecx",\
	"and eax, ecx",\
	"add eax, ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax ecx]\

	//eax = (unsigned max)umax(eax,ebx)
#pragma aux umax =\
	"sub eax, ebx",\
	"sbb ecx, ecx",\
	"xor ecx, 0xffffffff",\
	"and eax, ecx",\
	"add eax, ebx",\
	parm nomemory [eax][ebx]\
	modify exact [eax ecx]\

#pragma aux kmin =\
	"cmp eax, ebx",\
	"jl skipit",\
	"mov eax, ebx",\
	"skipit:",\
	parm nomemory [eax][ebx]\
	modify exact [eax]\

#pragma aux kmax =\
	"cmp eax, ebx",\
	"jg skipit",\
	"mov eax, ebx",\
	"skipit:",\
	parm nomemory [eax][ebx]\
	modify exact [eax]\

#pragma aux limitrate =\
	"mov dx, 0x3da",\
	"wait1: in al, dx",\
	"test al, 8",\
	"jnz wait1",\
	"wait2: in al, dx",\
	"test al, 8",\
	"jz wait2",\
	modify exact [eax edx]\

#pragma aux readtimer =\
	"mov al, 0xd2",\
	"out 0x43, al",\
	"in al, 0x40",\
	"shl eax, 24",\
	"in al, 0x40",\
	"rol eax, 8",\
	modify [eax]\

#pragma aux redblueblit = \
	"xor ecx, ecx",\
	"begblit: mov eax, dword ptr [edx+ecx]",\
	"shl eax, 4",\
	"add eax, dword ptr [ebx+ecx]",\
	"mov dword ptr [ecx+0xa0000], eax",\
	"add ecx, 4",\
	"cmp ecx, esi",\
	"jb begblit",\
	parm [ebx][edx][esi]\
	modify exact [eax ecx]\

#pragma aux chainblit =\
	"shr ecx, 1",\
	"jnc prebeg",\
	"mov al, byte ptr [esi+8]",\
	"mov ah, byte ptr [esi+12]",\
	"shl eax, 16",\
	"mov al, byte ptr [esi]",\
	"mov ah, byte ptr [esi+4]",\
	"mov dword ptr [edi], eax",\
	"add esi, 16",\
	"add edi, 4",\
	"test ecx, ecx",\
	"prebeg: jz endit",\
	"beg: mov al, byte ptr [esi+8]",\
	"mov bl, byte ptr [esi+24]",\
	"mov ah, byte ptr [esi+12]",\
	"mov bh, byte ptr [esi+28]",\
	"shl eax, 16",\
	"add edi, 8",\
	"shl ebx, 16",\
	"mov al, byte ptr [esi]",\
	"mov bl, byte ptr [esi+16]",\
	"mov ah, byte ptr [esi+4]",\
	"mov bh, byte ptr [esi+20]",\
	"add esi, 32",\
	"mov dword ptr [edi-8], eax",\
	"dec ecx",\
	"mov dword ptr [edi-4], ebx",\
	"jnz beg",\
	"endit:",\
	parm [esi][edi][ecx]\
	modify exact [eax ebx ecx esi edi]\

#pragma aux swapchar =\
	"mov cl, [eax]",\
	"mov ch, [ebx]",\
	"mov [ebx], cl",\
	"mov [eax], ch",\
	parm [eax][ebx]\
	modify exact [ecx]\

#pragma aux swapshort =\
	"mov cx, [eax]",\
	"mov dx, [ebx]",\
	"mov [ebx], cx",\
	"mov [eax], dx",\
	parm [eax][ebx]\
	modify exact [ecx edx]\

#pragma aux swaplong =\
	"mov ecx, [eax]",\
	"mov edx, [ebx]",\
	"mov [ebx], ecx",\
	"mov [eax], edx",\
	parm [eax][ebx]\
	modify exact [ecx edx]\

#pragma aux swapbuf4 =\
	"begswap:",\
	"mov esi, [eax]",\
	"mov edi, [ebx]",\
	"mov [ebx], esi",\
	"mov [eax], edi",\
	"add eax, 4",\
	"add ebx, 4",\
	"dec ecx",\
	"jnz short begswap",\
	parm [eax][ebx][ecx]\
	modify exact [eax ebx ecx esi edi]\

#pragma aux swap64bit =\
	"mov ecx, [eax]",\
	"mov edx, [ebx]",\
	"mov [ebx], ecx",\
	"mov ecx, [eax+4]",\
	"mov [eax], edx",\
	"mov edx, [ebx+4]",\
	"mov [ebx+4], ecx",\
	"mov [eax+4], edx",\
	parm [eax][ebx]\
	modify exact [ecx edx]\

	//swapchar2(ptr1,ptr2,xsiz); is the same as:
	//swapchar(ptr1,ptr2); swapchar(ptr1+1,ptr2+xsiz);
#pragma aux swapchar2 =\
	"add esi, ebx",\
	"mov cx, [eax]",\
	"mov dl, [ebx]",\
	"mov [ebx], cl",\
	"mov dh, [esi]",\
	"mov [esi], ch",\
	"mov [eax], dx",\
	parm [eax][ebx][esi]\
	modify exact [ecx edx esi]\

static long timeroffs1mhz;
	//accutimeroffs = -8-(t1-t0);
#pragma aux inittimer1mhz =\
	"xor ebx, ebx",\
	"xor ecx, ecx",\
	"in al, 0x61",\
	"or al, 1",\
	"out 0x61, al",\
	"mov al, 0x34",\
	"out 0x43, al",\
	"xor al, al",\
	"out 0x40, al",\
	"mov al, 0xb4",\
	"out 0x43, al",\
	"mov al, 240",\
	"out 0x42, al",\
	"xor al, al",\
	"cli",\
	"out 0x40, al",\
	"dec al",\
	"out 0x42, al",\
	"mov al, 0x04",\
	"out 0x43, al",\
	"in al, 0x40",\
	"mov bl, al",\
	"in al, 0x40",\
	"mov bh, al",\
	"mov al, 0x84",\
	"out 0x43, al",\
	"in al, 0x42",\
	"mov cl, al",\
	"in al, 0x42",\
	"sti",\
	"mov ch, al",\
	"sub ebx, ecx",\
	"sub ebx, 8",\
	"mov timeroffs1mhz, ebx",\
	modify exact [eax ebx ecx]\

#pragma aux uninittimer1mhz =\
	"in al, 0x61",\
	"and al, 252",\
	"out 0x61, al",\
	modify exact [eax]\

	//t = ((ecx-ebx+timeroffs1mhz)&0xfff0)*4095 + ecx;
#pragma aux gettime1mhz =\
	"mov ebx, timeroffs1mhz",\
	"xor ecx, ecx",\
	"mov al, 0x04",\
	"cli",\
	"out 0x43, al",\
	"in al, 0x40",\
	"sub bl, al",\
	"in al, 0x40",\
	"sbb bh, al",\
	"mov al, 0x84",\
	"out 0x43, al",\
	"in al, 0x42",\
	"mov cl, al",\
	"in al, 0x42",\
	"sti",\
	"mov ch, al",\
	"add ebx, ecx",\
	"and ebx, 0x0000fff0",\
	"sub ecx, ebx",\
	"shl ebx, 12",\
	"add ebx, ecx",\
	modify exact [eax ebx ecx]\
	value [ebx]\

	//eax = eax-ebx; if (eax < 0) eax += (1<<28) - (1<<16);
#pragma aux deltatime1mhz =\
	"sub eax, ebx",\
	"jnc skipit",\
	"add eax, 0x0fff0000",\
	"skipit:",\
	parm [ebx][eax]\

#pragma aux printchrasm =\
        "rep stosw",\
        parm [edi][ecx][eax]\

repo_name: orochi/nblood

license: mit


code:
//-------------------------------------------------------------------------
/*
Copyright (C) 1996, 2003 - 3D Realms Entertainment
Copyright (C) 2017-2019 Nuke.YKT

This file is part of Duke Nukem 3D version 1.5 - Atomic Edition

Duke Nukem 3D is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

Original Source: 1996 - Todd Replogle
Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------

#include "duke3d.h"

//=============
// STATICS
//=============

int32 numlumps;
static void  **lumpcache;
static lumpinfo_t *lumpinfo;              // location of each lump on disk
static boolean RTS_Started = false;

char lumplockbyte[11];

/*
============================================================================

                                                LUMP BASED ROUTINES

============================================================================
*/

/*
====================
=
= RTS_AddFile
=
= All files are optional, but at least one file must be found
= Files with a .rts extension are wadlink files with multiple lumps
= Other files are single lumps with the base filename for the lump name
=
====================
*/

void RTS_AddFile (char *filename)
   {
   wadinfo_t  header;
   lumpinfo_t *lump_p;
   uint32     i;
   int32      handle, length;
   int32      startlump;
   filelump_t *fileinfo;

//
// read the entire file in
//      FIXME: shared opens

   handle = SafeOpenRead( filename, filetype_binary );

   startlump = numlumps;

   // WAD file
   printf("    Adding %s.\n",filename);
   SafeRead( handle, &header, sizeof( header ) );
   if (strncmp(header.identification,"IWAD",4))
      Error ("RTS file %s doesn't have IWAD id\n",filename);
   header.numlumps = IntelLong(header.numlumps);
   header.infotableofs = IntelLong(header.infotableofs);
   length = header.numlumps*sizeof(filelump_t);
   fileinfo = alloca (length);
   if (!fileinfo)
      Error ("RTS file could not allocate header info on stack");
   lseek (handle, header.infotableofs, SEEK_SET);
   SafeRead (handle, fileinfo, length);
   numlumps += header.numlumps;

//
// Fill in lumpinfo
//
   SafeRealloc(&lumpinfo,numlumps*sizeof(lumpinfo_t));
   lump_p = &lumpinfo[startlump];

   for (i=startlump ; i<numlumps ; i++,lump_p++, fileinfo++)
      {
      lump_p->handle = handle;
      lump_p->position = IntelLong(fileinfo->filepos);
      lump_p->size = IntelLong(fileinfo->size);
      strncpy (lump_p->name, fileinfo->name, 8);
      }
   }

/*
====================
=
= RTS_Init
=
= Files with a .rts extension are idlink files with multiple lumps
=
====================
*/

void RTS_Init (char *filename)
   {
   int32 length;
   //
   // open all the files, load headers, and count lumps
   //
   numlumps = 0;
   lumpinfo = SafeMalloc(5);   // will be realloced as lumps are added

   printf("RTS Manager Started\n");
   if (SafeFileExists(filename))
      RTS_AddFile (filename);

   if (!numlumps) return;

   //
   // set up caching
   //
   length = (numlumps) * sizeof( *lumpcache );
   lumpcache = SafeMalloc(length);
   memset(lumpcache,0,length);
   RTS_Started = true;
   }

/*
====================
=
= RTS_NumSounds
=
====================
*/

int32 RTS_NumSounds (void)
   {
   return numlumps-1;
   }

/*
====================
=
= RTS_SoundLength
=
= Returns the buffer size needed to load the given lump
=
====================
*/

int32 RTS_SoundLength (int32 lump)
   {
   lump++;
   if (lump >= numlumps)
      Error ("RTS_SoundLength: %i >= numlumps",lump);
   return lumpinfo[lump].size;
   }

/*
====================
=
= RTS_GetSoundName
=
====================
*/

char * RTS_GetSoundName (int32 i)
   {
   i++;
   if (i>=numlumps)
      Error ("RTS_GetSoundName: %i >= numlumps",i);
   return &(lumpinfo[i].name[0]);
   }

/*
====================
=
= RTS_ReadLump
=
= Loads the lump into the given buffer, which must be >= RTS_SoundLength()
=
====================
*/
void RTS_ReadLump (int32 lump, void *dest)
   {
   lumpinfo_t *l;

   if (lump >= numlumps)
      Error ("RTS_ReadLump: %i >= numlumps",lump);
   if (lump < 0)
      Error ("RTS_ReadLump: %i < 0",lump);
   l = lumpinfo+lump;
   lseek (l->handle, l->position, SEEK_SET);
   SafeRead(l->handle,dest,l->size);
   }

/*
====================
=
= RTS_GetSound
=
====================
*/
void *RTS_GetSound (int32 lump)
{
   lump++;
   if ((uint32)lump >= numlumps)
      Error ("RTS_GetSound: %i >= %i\n",lump,numlumps);

   if (lumpcache[lump] == NULL)
   {
      lumplockbyte[lump] = 200;
      allocache((char *)&lumpcache[lump],(long)RTS_SoundLength(lump-1),&lumplockbyte[lump]);
      RTS_ReadLump(lump, lumpcache[lump]);
   }
   else
   {
      if (lumplockbyte[lump] < 200)
         lumplockbyte[lump] = 200;
      else
         lumplockbyte[lump]++;
   }
   return lumpcache[lump];
}


code:
//-------------------------------------------------------------------------
/*
Copyright (C) 1996, 2003 - 3D Realms Entertainment
Copyright (C) 2017-2019 Nuke.YKT

This file is part of Duke Nukem 3D version 1.5 - Atomic Edition

Duke Nukem 3D is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

Original Source: 1996 - Todd Replogle
Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------

//***************************************************************************
//
//    RTS.H
//
//***************************************************************************

#ifndef __rts_public__
#define __rts_public__

/*
====================
=
= RTS_Init
=
= Files with a .rts extension are idlink files with multiple lumps
=
====================
*/

void RTS_Init (char *filename);
/*
====================
=
= RTS_NumSounds
=
====================
*/

int32 RTS_NumSounds (void);
/*
====================
=
= RTS_SoundLength
=
= Returns the buffer size needed to load the given lump
=
====================
*/

int32 RTS_SoundLength (int32 lump);
/*
====================
=
= RTS_GetSoundName
=
====================
*/

char * RTS_GetSoundName (int32 i);
/*
====================
=
= RTS_GetSound
=
====================
*/
void *RTS_GetSound (int32 lump);
#endif


code:
//-------------------------------------------------------------------------
/*
Copyright (C) 1996, 2003 - 3D Realms Entertainment
Copyright (C) 2017-2019 Nuke.YKT

This file is part of Duke Nukem 3D version 1.5 - Atomic Edition

Duke Nukem 3D is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

Original Source: 1996 - Todd Replogle
Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------

// scriplib.h

#ifndef _scriplib_public
#define _scriplib_public
#ifdef __cplusplus
extern "C" {
#endif

/*
==============
=
= SCRIPT_Init
=
==============
*/
int32 SCRIPT_Init( char * name );

/*
==============
=
= SCRIPT_Free
=
==============
*/
void SCRIPT_Free( int32 scripthandle );

/*
==============
=
= SCRIPT_Parse
=
==============
*/

int32 SCRIPT_Parse ( char *data, int32 length, char * name );

/*
==============
=
= SCRIPT_Load
=
==============
*/

int32 SCRIPT_Load ( char * filename );

/*
==============
=
= SCRIPT_Save
=
==============
*/
void SCRIPT_Save (int32 scripthandle, char * filename);

/*
==============
=
= SCRIPT_NumberSections
=
==============
*/

int32 SCRIPT_NumberSections( int32 scripthandle );

/*
==============
=
= SCRIPT_Section
=
==============
*/

char * SCRIPT_Section( int32 scripthandle, int32 which );

/*
==============
=
= SCRIPT_NumberEntries
=
==============
*/

int32 SCRIPT_NumberEntries( int32 scripthandle, char * sectionname );

/*
==============
=
= SCRIPT_Entry
=
==============
*/

char * SCRIPT_Entry( int32 scripthandle, char * sectionname, int32 which );

/*
==============
=
= SCRIPT_GetRaw
=
==============
*/
char * SCRIPT_GetRaw(int32 scripthandle, char * sectionname, char * entryname);

/*
==============
=
= SCRIPT_GetString
=
==============
*/
void SCRIPT_GetString
   (
   int32 scripthandle,
   char * sectionname,
   char * entryname,
   char * dest
   );

/*
==============
=
= SCRIPT_GetDoubleString
=
==============
*/
void SCRIPT_GetDoubleString
   (
   int32 scripthandle,
   char * sectionname,
   char * entryname,
   char * dest1,
   char * dest2
   );

/*
==============
=
= SCRIPT_GetNumber
=
==============
*/
boolean SCRIPT_GetNumber
   (
   int32 scripthandle,
   char * sectionname,
   char * entryname,
   int32 * number
   );

/*
==============
=
= SCRIPT_GetBoolean
=
==============
*/
void SCRIPT_GetBoolean
   (
   int32 scripthandle,
   char * sectionname,
   char * entryname,
   boolean * bool
   );

/*
==============
=
= SCRIPT_GetDouble
=
==============
*/

void SCRIPT_GetDouble
   (
   int32 scripthandle,
   char * sectionname,
   char * entryname,
   double * number
   );

/*
==============
=
= SCRIPT_PutComment
=
==============
*/
void SCRIPT_PutComment( int32 scripthandle, char * sectionname, char * comment );

/*
==============
=
= SCRIPT_PutEOL
=
==============
*/
void SCRIPT_PutEOL( int32 scripthandle, char * sectionname );

/*
==============
=
= SCRIPT_PutMultiComment
=
==============
*/
void SCRIPT_PutMultiComment
   (
   int32 scripthandle,
   char * sectionname,
   char * comment,
   ...
   );

/*
==============
=
= SCRIPT_PutSection
=
==============
*/
void SCRIPT_PutSection( int32 scripthandle, char * sectionname );

/*
==============
=
= SCRIPT_PutRaw
=
==============
*/
void SCRIPT_PutRaw
   (
   int32 scripthandle,
   char * sectionname,
   char * entryname,
   char * raw
   );

/*
==============
=
= SCRIPT_PutString
=
==============
*/
void SCRIPT_PutString
   (
   int32 scripthandle,
   char * sectionname,
   char * entryname,
   char * string
   );

/*
==============
=
= SCRIPT_PutDoubleString
=
==============
*/
void SCRIPT_PutDoubleString
   (
   int32 scripthandle,
   char * sectionname,
   char * entryname,
   char * string1,
   char * string2
   );

/*
==============
=
= SCRIPT_PutNumber
=
==============
*/
void SCRIPT_PutNumber
   (
   int32 scripthandle,
   char * sectionname,
   char * entryname,
   int32 number,
   boolean hexadecimal,
   boolean defaultvalue
   );

/*
==============
=
= SCRIPT_PutBoolean
=
==============
*/
void SCRIPT_PutBoolean
   (
   int32 scripthandle,
   char * sectionname,
   char * entryname,
   boolean bool
   );

/*
==============
=
= SCRIPT_PutDouble
=
==============
*/

void SCRIPT_PutDouble
   (
   int32 scripthandle,
   char * sectionname,
   char * entryname,
   double number,
   boolean defaultvalue
   );

#ifdef __cplusplus
};
#endif
#endif


code:
//-------------------------------------------------------------------------
/*
Copyright (C) 1996, 2003 - 3D Realms Entertainment
Copyright (C) 2017-2019 Nuke.YKT

This file is part of Duke Nukem 3D version 1.5 - Atomic Edition

Duke Nukem 3D is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

Original Source: 1994 - Jim Dose
Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------

#ifndef __SNDCARDS_H
#define __SNDCARDS_H

#define ASS_VERSION_STRING "1.1"

typedef enum
   {
//   ASS_NoSound,
   SoundBlaster,
   ProAudioSpectrum,
   SoundMan16,
   Adlib,
   GenMidi,
   SoundCanvas,
   Awe32,
   WaveBlaster,
   SoundScape,
   UltraSound,
   SoundSource,
   TandySoundSource,
   PC,
   NumSoundCards
   } soundcardnames;

#endif