don't click here

Source Code accidently compiled into games

Discussion in 'Technical Discussion' started by evilhamwizard, Feb 11, 2010.

  1. evilhamwizard

    evilhamwizard

    Researcher
    1,392
    455
    63
    I love when games are accidentally compiled with files that shouldn't have been compiled. My favorite being source code. Do you know of any games that do this by accident (except for Sonic 2NA)? Here's a nice one:

    This comes from ESPN Baseball Tonight:

    Code (ASM):
    1. entry point: 00000200
    2. no relocation info
    3. executable
    4.  
    5.  START      END     LENGTH    FILE            SECTION   TYPE
    6.  
    7. 00000000  00000007  000008  X.OUT            >(ORG)     T
    8. 00000000  00000007  000008  MAIN.O            (ORG)     T ORG
    9.  
    10. 00000060  0000008f  000030  X.OUT            >(ORG)     T
    11. 00000060  0000008f  000030  MAIN.O            (ORG)     T ORG
    12.  
    13. 00000100  00000100  000000  X.OUT            >(ORG)     T
    14. 00000100  00000100  000000  MAIN.O            (ORG)     T ORG
    15.  
    16. 00000100  000001ff  000100  X.OUT            >(ORG)     T
    17. 00000100  000001ff  000100  MAIN.O            (ORG)     T ORG
    18.  
    19. 00000200  00000ac3  0008c4  X.OUT            >(ORG)     T
    20. 00000200  00000ac3  0008c4  MAIN.O            (ORG)     T ORG
    21.  
    22. 00000ac4  0001272b  011c68  X.OUT            >.text     T
    23. 00000ac4  00000baf  0000ec  MAIN.O            .text     T
    24. 00000bb0  000069a7  005df8  WCS.O             .text     T
    25. 000069a8  0000fe73  0094cc  AI.O              .text     T
    26. 0000fe74  00010f2f  0010bc  LOGOS.O           .text     T
    27. 00010f30  0001101f  0000f0  LZWDECOM.O        .text     T
    28. 00011020  0001157f  000560  PPGE_PM.O         .text     T
    29. 00011580  0001159f  000020  PPGE_PMC.O        .text     T
    30. 000115a0  00012437  000e98  PPGE_GD.O         .text     T
    31. 00012438  00012507  0000d0  PPGE_GDC.O        .text     T
    32. 00012508  00012508  000000  GRAPHICS.O        .text     T
    33. 00012508  00012508  000000  FIELD.O           .text     T
    34. 00012508  00012508  000000  STRIPS.O          .text     T
    35. 00012508  00012508  000000  BATTART.O         .text     T
    36. 00012508  00012508  000000  LBATTART.O        .text     T
    37. 00012508  00012508  000000  FIELDART.O        .text     T
    38. 00012508  00012508  000000  FIELDRUN.O        .text     T
    39. 00012508  00012508  000000  FIELDTHR.O        .text     T
    40. 00012508  00012508  000000  FIELDCAT.O        .text     T
    41. 00012508  00012508  000000  RUNNER.O          .text     T
    42. 00012508  0001258b  000084  SOUND.O           .text     T
    43. 0001258c  0001272b  0001a0  STATS.O           .text     T
    44.  
    45. 00020000  0005ac4b  03ac4c  X.OUT            >sounds    D
    46. 00020000  0005ac4b  03ac4c  GEMS.O            .text     T
    47. 0005ac4c  0005ac4c  000000  GEMS.O            .data     D
    48. 0005ac4c  0005ac4c  000000  GEMS.O            .bss      B (00)
    49.  
    50. 0005ac4c  0006b3f7  0107ac  X.OUT            >field     D
    51. 0005ac4c  0006b3f7  0107ac  FIELD.O           field     D
    52.  
    53. 0006b3f8  001dad87  16f990  X.OUT            >graphics  D
    54. 0006b3f8  0006b477  000080  LOGOS.O           graphics  D
    55. 0006b478  00088963  01d4ec  GRAPHICS.O        graphics  D
    56. 00088964  0008fe1b  0074b8  FIELD.O           graphics  D
    57. 0008fe1c  000951bf  0053a4  STRIPS.O          graphics  D
    58. 000951c0  000bb8df  026720  BATTART.O         graphics  D
    59. 000bb8e0  000c4fbf  0096e0  LBATTART.O        graphics  D
    60. 000c4fc0  000e67a7  0217e8  FIELDART.O        graphics  D
    61. 000e67a8  00101297  01aaf0  FIELDRUN.O        graphics  D
    62. 00101298  0012ac7f  0299e8  FIELDTHR.O        graphics  D
    63. 0012ac80  001a1b67  076ee8  FIELDCAT.O        graphics  D
    64. 001a1b68  001dad87  039220  RUNNER.O          graphics  D
    65.  
    66. 001dad88  001df02b  0042a4  X.OUT            >tables    D
    67. 001dad88  001dad88  000000  MAIN.O            tables    D
    68. 001dad88  001dbabb  000d34  WCS.O             tables    D
    69. 001dbabc  001dc83b  000d80  AI.O              tables    D
    70. 001dc83c  001dcc4b  000410  LOGOS.O           tables    D
    71. 001dcc4c  001dcf4b  000300  PPGE_PM.O         tables    D
    72. 001dcf4c  001dcf4c  000000  PPGE_PMC.O        tables    D
    73. 001dcf4c  001dcf6b  000020  PPGE_GD.O         tables    D
    74. 001dcf6c  001dcf6c  000000  PPGE_GDC.O        tables    D
    75. 001dcf6c  001dcf6c  000000  GRAPHICS.O        tables    D
    76. 001dcf6c  001dcf8b  000020  FIELD.O           tables    D
    77. 001dcf8c  001df02b  0020a0  STATS.O           tables    D
    78.  
    79. 001df02c  001df02c  000000  X.OUT            >.batt    
    80.  
    81. 001df02c  001f6323  0172f8  X.OUT            >.graphic  D
    82. 001df02c  001f6323  0172f8  LOGOS.O           .graphic  D
    83.  
    84. 00ff0000  00fff197  00f198  X.OUT            >.data     D
    85. 00ff0000  00ff0000  000000  MAIN.O            .data     D
    86. 00ff0000  00ffce23  00ce24  WCS.O             .data     D
    87. 00ffce24  00ffce24  000000  AI.O              .data     D
    88. 00ffce24  00ffce24  000000  LOGOS.O           .data     D
    89. 00ffce24  00ffce24  000000  LZWDECOM.O        .data     D
    90. 00ffce24  00ffce33  000010  PPGE_PM.O         .data     D
    91. 00ffce34  00ffce34  000000  PPGE_PMC.O        .data     D
    92. 00ffce34  00fff013  0021e0  PPGE_GD.O         .data     D
    93. 00fff014  00fff014  000000  PPGE_GDC.O        .data     D
    94. 00fff014  00fff014  000000  GRAPHICS.O        .data     D
    95. 00fff014  00fff014  000000  FIELD.O           .data     D
    96. 00fff014  00fff014  000000  STRIPS.O          .data     D
    97. 00fff014  00fff014  000000  BATTART.O         .data     D
    98. 00fff014  00fff014  000000  LBATTART.O        .data     D
    99. 00fff014  00fff014  000000  FIELDART.O        .data     D
    100. 00fff014  00fff014  000000  FIELDRUN.O        .data     D
    101. 00fff014  00fff014  000000  FIELDTHR.O        .data     D
    102. 00fff014  00fff014  000000  FIELDCAT.O        .data     D
    103. 00fff014  00fff014  000000  RUNNER.O          .data     D
    104. 00fff014  00fff014  000000  SOUND.O           .data     D
    105. 00fff014  00fff197  000184  STATS.O           .data     D
    106.  
    107. 00fff198  00fff1b3  00001c  X.OUT            >.bss      B (00)
    108. 00fff198  00fff198  000000  MAIN.O            .bss      B (00)
    109. 00fff198  00fff1b3  00001c  WCS.O             .bss      B (00)
    110. 00fff1b4  00fff1b4  000000  AI.O              .bss      B (00)
    111. 00fff1b4  00fff1b4  000000  LOGOS.O           .bss      B (00)
    112. 00fff1b4  00fff1b4  000000  LZWDECOM.O        .bss      B (00)
    113. 00fff1b4  00fff1b4  000000  PPGE_PM.O         .bss      B (00)
    114. 00fff1b4  00fff1b4  000000  PPGE_PMC.O        .bss      B (00)
    115. 00fff1b4  00fff1b4  000000  PPGE_GD.O         .bss      B (00)
    116. 00fff1b4  00fff1b4  000000  PPGE_GDC.O        .bss      B (00)
    117. 00fff1b4  00fff1b4  000000  GRAPHICS.O        .bss      B (00)
    118. 00fff1b4  00fff1b4  000000  FIELD.O           .bss      B (00)
    119. 00fff1b4  00fff1b4  000000  STRIPS.O          .bss      B (00)
    120. 00fff1b4  00fff1b4  000000  BATTART.O         .bss      B (00)
    121. 00fff1b4  00fff1b4  000000  LBATTART.O        .bss      B (00)
    122. 00fff1b4  00fff1b4  000000  FIELDART.O        .bss      B (00)
    123. 00fff1b4  00fff1b4  000000  FIELDRUN.O        .bss      B (00)
    124. 00fff1b4  00fff1b4  000000  FIELDTHR.O        .bss      B (00)
    125. 00fff1b4  00fff1b4  000000  FIELDCAT.O        .bss      B (00)
    126. 00fff1b4  00fff1b4  000000  RUNNER.O          .bss      B (00)
    127. 00fff1b4  00fff1b4  000000  SOUND.O           .bss      B (00)
    128. 00fff1b4  00fff1b4  000000  STATS.O           .bss      B (00)
    129.  
    130. RESERVED SYMBOLS
    131.  
    132. 00fff1b4      heap_org
    133. 00000e4c      heap_len
    134. ff1b4  000000  FIELDART.O        .bss      B (00)
    135. 00fff1b4  00fff1b4  000000  FIELDRUN.O        .bss      B (00)
    136. 00fff1b4  00fff1b4  000000  FIELDTHR.O        .bss      B (00)
    137. 00fff1b4  00fff1b4</div>
    138.  
    139. Here's some more from the same game:
    140.  
    141. [CODE=ASM]*                                                                           *
    142. *              Project: Sony ESPN Baseball                                  *
    143. *                                                                           *
    144. *               Module: AI.S                                                *
    145. *                                                                           *
    146. * Module Creation Date: March 1993                                          *
    147. *                                                                           *
    148. *               Author: Russell Shanks                                      *
    149. *                                                                           *
    150. *   Development System: Sierra Systems                                      *
    151. *                                                                           *
    152. *****************************************************************************
    153.  
    154.  
    155.     include MACROS.I
    156.     Include EQUATES.I
    157.     include sound.inc
    158.  
    159. *----------------------------------------------------------------------------
    160.  
    161.  
    162. *****************************************************************************
    163. * PPGE
    164. *****************************************************************************
    165.     include ppge_var.inc
    166.  
    167. *----------------------------------------------------------------------------
    168. *
    169.     section tables
    170.  
    171.     xdef    radar_ytable
    172.     xdef    radar_xtable
    173.  
    174. InitialLogicTable         ;entity descending order
    175.     dc.l    HaloLogic
    176.     dc.l    FieldXLogic,LookEntityLogic,LookEntityLogic
    177.     dc.l    LookEntityLogic,LookEntityLogic,InitialThirdLogic
    178.     dc.l    InitialSecondLogic,InitialFirstRunLogic
    179.     dc.l    InitialBatterLogic,InitialFielderLogic
    180.     dc.l    InitialFielderLogic,InitialFielderLogic
    181.     dc.l    InitialFielderLogic,InitialFielderLogic
    182.     dc.l    InitialFielderLogic,InitialFielderLogic
    183.     dc.l    InitialCatcherLogic,InitialPitcherLogic
    184.  
    185. FielderSelectTable
    186.     dc.w    FBaseman_ptr,Fbaseman_ptr,Sbaseman_ptr,Pitcher_ptr
    187.     dc.w    ShortStop_ptr,Tbaseman_ptr,Tbaseman_ptr
    188.     dc.w    Fbaseman_ptr,Sbaseman_ptr,Sbaseman_ptr,ShortStop_ptr
    189.     dc.w    ShortStop_ptr,Tbaseman_ptr,Tbaseman_ptr
    190.     dc.w    RFielder_ptr,RFielder_ptr,RFielder_ptr,CFielder_ptr
    191.     dc.w    LFielder_ptr,LFielder_ptr,LFielder_ptr
    192.  
    193.  
    194. FielderRF_tbl
    195.     dc.w    8,6,7,7,8,8,7,7
    196.  
    197. FielderThrowIS_tbl
    198.     dc.w    3,3,4,4,3,3,4,4     ;only 3 and 4's good here
    199.  
    200.     dc.b  13,13,13,13,13,13,13,13
    201.     dc.b  13,13,13,13,13,13,13,13
    202.     dc.b  13,13,13,13,13,13,13,13
    203.     dc.b  13,13,13,13,13,13,13,13
    204.     dc.b  13,13,13,13,13,13,13,13
    205.     dc.b  13,13,13,13,13,13,13,13
    206.     dc.b  13,13,13,13,13,13,13,13
    207. *       dc.b  14,15,16,17,18,19,20,21
    208.     dc.b  13,13,13,13,13,13,13,13
    209. ballvscale_table
    210. *       dc.b  22,23,24,26,27,28,29,31
    211.   dc.b  13,13,14,14,15,16,17,18
    212. *       dc.b  32,33,34,36,37,38,39,41
    213.   dc.b  20,21,22,23,25,26,27,29
    214. *       dc.b  42,43,44,45,47,48,49,50
    215.   dc.b  30,31,32,33,35,36,37,38
    216. *       dc.b  52,53,54,55,57,58,59,60
    217.   dc.b  40,41,42,43,45,46,47,48
    218. *       dc.b  62,63,64,65,67,68,69,70
    219.   dc.b  50,51,52,53,54,55,56,57
    220. *       dc.b  71,73,74,75,76,78,79,80
    221.   dc.b  61,63,65,68,71,74,76,78
    222.     dc.b  81,83,84,85,86,88,89,90
    223.     dc.b  91,93,94,95,96,97,99,100
    224.     dc.b  101,102,104,105,106,107,109,110
    225.     dc.b  111,112,114,115,116,117,119,120
    226.     dc.b  121,122,123,125,126,127,128,130
    227.     dc.b  131,132,133,135,136,137,138,140
    228.     dc.b  141,142,143,145,146,147,148,150
    229.     dc.b  151,152,153,154,156,157,158,159
    230.     dc.b  161,162,163,164,166,167,168,169
    231.     dc.b  171,172,173,174,176,177,178,179
    232.     dc.b  180,182,183,184,185,187,188,189
    233.     dc.b  190,192,193,194,195,197,198,199
    234.     dc.b  200,202,203,204,205,206,208,209
    235.     dc.b  210,211,213,214,215,216,218,219
    236.     dc.b  220,221,223,224,225,226,228,229
    237.     dc.b  230,231,232,234,235,236,237,239
    238.     dc.b  240,241,242,244,245,246,247,249
    239.     dc.b  250,251,252,254,255,255
    240.  
    241.  
    242. *       dc.b  67,68,69,70,71,72,73,74
    243.    dc.b  31,33,35,37,39,41,43,47
    244. runnervscale_table
    245. *       dc.b  75,76,77,78,79,80,81,82
    246.    dc.b  49,51,53,57,59,61,63,65
    247. *       dc.b  83,84,85,86,87,88,89,90
    248.    dc.b  67,69,71,73,75,77,79,81
    249. *       dc.b  91,92,93,94,95,96,97,98
    250.    dc.b  83,85,87,89,91,93,95,96
    251. *       dc.b   99,100,100,100,100,100,100,100
    252.    dc.b   97,97,98,98,99,99,100,100
    253.     dc.b  100,100,100,100,100,100,100,100
    254.     dc.b  100,100,100,100,100,100,100,100
    255.     dc.b  100,100,100,100,100,100,100,100
    256.     dc.b  100,100,100,100,100,100,100,100
    257.     dc.b  101,102,104,105,106,107,109,110
    258.     dc.b  111,112,114,115,116,117,119,120
    259.     dc.b  121,122,123,125,126,127,128,130
    260.     dc.b  131,132,133,135,136,137,138,140
    261.     dc.b  141,142,143,145,146,147,148,150
    262.     dc.b  151,152,153,154,156,157,158,159
    263.     dc.b  161,162,163,164,166,167,168,169
    264.     dc.b  171,172,173,174,176,177,178,179
    265.     dc.b  180,182,183,184,185,187,188,189
    266.     dc.b  190,192,193,194,195,197,198,199
    267.     dc.b  200,202,203,204,205,206,208,209
    268.     dc.b  210,211,213,214,215,216,218,219
    269.     dc.b  220,221,223,224,225,226,228,229
    270.     dc.b  230,231,232,234,235,236,237,239
    271.     dc.b  240,241,242,244,245,246,247,249
    272.     dc.b  250,251,252,254,255,255
    273.  
    274.  
    275.  
    276. *       dc.b  100,100,100,100,100,100,100,100
    277. *runnervscale_table
    278. *       dc.b  100,100,100,100,100,100,100,100
    279. *       dc.b  100,100,100,100,100,100,100,100
    280. *       dc.b  100,100,100,100,100,100,100,100
    281. *       dc.b  100,100,100,100,100,100,100,100
    282. *       dc.b  100,100,100,100,100,100,100,100
    283. *       dc.b  100,100,100,100,100,100,100,100
    284. *       dc.b  100,100,100,100,100,100,100,100
    285. *       dc.b  100,100,100,100,100,100,100,100
    286. *       dc.b  101,102,104,105,106,107,109,110
    287. *       dc.b  111,112,114,115,116,117,119,120
    288. *       dc.b  121,122,123,125,126,127,128,130
    289. *       dc.b  131,132,133,135,136,137,138,140
    290. *       dc.b  141,142,143,145,146,147,148,150
    291. *       dc.b  151,152,153,154,156,157,158,159
    292. *       dc.b  161,162,163,164,166,167,168,169
    293. *       dc.b  171,172,173,174,176,177,178,179
    294. *       dc.b  180,182,183,184,185,187,188,189
    295. *       dc.b  190,192,193,194,195,197,198,199
    296. *       dc.b  200,202,203,204,205,206,208,209
    297. *       dc.b  210,211,213,214,215,216,218,219
    298. *       dc.b  220,221,223,224,225,226,228,229
    299. *       dc.b  230,231,232,234,235,236,237,239
    300. *       dc.b  240,241,242,244,245,246,247,249
    301. *       dc.b  250,251,252,254,255,255
    302.  
    303.  
    304.  
    305. *       dc.w    #0,#430,#518,#573,#615,#647
    306.     dc.w    #430,#430,#430,#430,#518,#573,#615,#647
    307. walltable
    308.     dc.w    #686,#717,#742,#766,#792,#816,#838,#862  ;16
    309.     dc.w    #878,#893,#913,#924,#925,#925,#925,#925  ;24
    310.     dc.w    #925,#925,#925,#925,#925,#925,#925,#925  ;32
    311.     dc.w    #926,#927,#928,#929,#930,#930,#930,#926  ;40
    312.     dc.w    #922,#918,#914,#910,#906,#902,#898,#894  ;48
    313.     dc.w    #890,#886,#882,#878,#874,#870,#866,#862  ;56
    314.     dc.w    #858,#854,#850,#846,#842,#838,#834,#830  ;64
    315.     dc.w    #826,#822,#818,#814,#810,#806,#802,#798  ;72
    316.     dc.w    #794,#790,#786,#782,#768,#764,#760,#756  ;80
    317.     dc.w    #752,#748,#744,#738,#734,#730,#726,#722  ;88
    318.     dc.w    #718,#714,#710,#706,#704,#700,#696,#692  ;96
    319.     dc.w    #688,#684,#680,#676,#672,#668,#664,#660  ;104
    320.     dc.w    #656,#652,#648,#644,#640,#634,#630,#626  ;112
    321. *       dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;40
    322. *       dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;48
    323. *       dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;56
    324. *       dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;64
    325. *       dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;72
    326. *       dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;80
    327. *       dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;88
    328. *       dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;96
    329. *       dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;104
    330. *       dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;112
    331.  
    332.     dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;120
    333.     dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;128
    334.     dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;136
    335.     dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;144
    336.     dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;152
    337.     dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;160
    338.     dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;168
    339.     dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;176
    340.     dc.w    #961,#961,#961,#961,#961,#961,#961,#961  ;184
    341.  
    342.     dc.b  8,8,8,8,8,8,8,8
    343. To1AndHome
    344. *       dc.b  8,8,8,8,8,8,8,8       ;0-7
    345.     dc.b  9,9,9,9,9,9,9,8       ;15
    346.     dc.b  8,8,8,8,8,7,7,7       ;23
    347.     dc.b  7,7,7,6,6,6,6,6       ;31
    348.     dc.b  6,5,5,5,5,5,5,4       ;39
    349.     dc.b  4,4,4,4,4,3,3,3       ;47
    350.     dc.b  3,3,3,3,2,2,2,2       ;55
    351.     dc.b  2,2,1,1,1,1,1,1       ;63
    352.     dc.b  1,1,1,1,1,1,1,1       ;71
    353.     dc.b  1,1,1,1,1,1,1,1
    354.     dc.b  1,1,1,1,1,1,1,1
    355.     dc.b  1,1,1,1,1,1,1,1
    356.     dc.b  1,1
    357.  
    358.     dc.b  1,1,1,1,1,1,1,1
    359.     dc.b  1,1,1,1,1,1,1,1
    360.     dc.b  1,1,1,1,1,1,1,1
    361.  
    362.     dc.b  4,4,4,4,4,4,4,4,4,4
    363. To2And3
    364.     dc.b  4,4,4,4,4,4,4,4,4,4
    365.     dc.b  3,3,3,3,3,3,3,3,3,3
    366.     dc.b  2,2,2,2,2,2,2,2,2,2
    367.     dc.b  1,1,1,1,1,1,1,1,1,1
    368.     dc.b  0,0,0,0,0,0,0,0,0,0
    369.  
    370. *       dc.b  0,0,0,0,0,0,0,0
    371. *       dc.b  0,0,0,0,0,0,0,0,0
    372. *       dc.b  0,0,0,0,0,0,0,0,0
    373.  
    374. FielderScaleTable
    375.     dc.b  0,0,0,0,0,0,0,1         ;8
    376.     dc.b  1,1,1,1,1,1,2,2         ;16
    377.     dc.b  2,2,2,2,2,3,3,3         ;32
    378. *       dc.b  3,3,3,3,4,4,4,4         ;40
    379. *       dc.b  4,4,4,5,5,5,5,5         ;48
    380.     dc.b  3,4,4,4,4,5,5,5         ;40
    381.     dc.b  5,5,5,5,5,5,5,5         ;48
    382.     dc.b  5,6,6,6,6,6,6,6         ;56
    383.     dc.b  6,6,6,6,6,6,6,6         ;64
    384.     dc.b  6,6,6,6,6,6,6,6         ;72
    385.     dc.b  6,6,6,6,6,6,6,6         ;
    386.     dc.b  6,6,6,6,6,6,6,6         ;
    387.     dc.b  6,6,6,6,6,6,6,6         ;
    388.     dc.b  6,6,6,6,6,6,6,6         ;
    389.     dc.b  6,6,6,6,6,6,6,6         ;
    390.     dc.b  6,6,6,6,6,6,6,6         ;
    391.     dc.b  6,6,6,6,6,6,6,6         ;
    392.     dc.b  6,6,6,6,6,6,6,6         ;
    393.     dc.b  6,6,6,6,6,6,6,6         ;
    394.     dc.b  6,6,6,6,6,6,6,6         ;
    395.     dc.b  6,6,6,6,6,6,6,6         ;
    396.     dc.b  6,6,6,6,6,6,6,6         ;
    397.     dc.b  6,6,6,6,6,6,6,6         ;
    398.     dc.b  6,6,6,6,6,6,6,6         ;184
    399.  
    400.  
    401. Pdirectiontable
    402.     dc.b    #0,#128,#0,#128,#192,#160,#224,#224
    403.     dc.b    #64,#96,#32,#64,#64,#64,#64,#64
    404.  
    405.     dc.b  0,0,0,0,0,0,0,0
    406.     dc.b  0,0,0,0,0,0,0,0
    407.     dc.b  0,0,0,0,0,0,0,0
    408.     dc.b  0,0,0,0,0,0,0,0
    409.     dc.b  0,0,0,0,0,0,0,0
    410.     dc.b  0,0,0,0,0,0,0,0
    411.     dc.b  0,0,0,0,0,0,0,0
    412.     dc.b  1,2,3,4,5,6,7,8               ; -8 - -1
    413. radar_ytable
    414.     dc.b  9,10,11,12,13,14,15,16             ; 0-7
    415.     dc.b  17,18,19,20,21,21,22,23             ; 8-15
    416.     dc.b  23,24,25,25,26,27,27,28             ; 16-23
    417.     dc.b  29,29,30,30,31,31,32,32             ; 24-31
    418.     dc.b  33,33,34,34,34,35,35,35             ; 32-39
    419.     dc.b  36,36,36,37,37,37,38,38             ; 40-47
    420.  
    421.     dc.b  38,39,39,40,40,41,41,42             ; 48-55
    422.     dc.b  42,43,43,44,44,45,45,46             ; 56-63   Pitcher's mound y=61
    423.  
    424.     dc.b  46,46,47,47,47,47,48,48             ; 64-71
    425.     dc.b  48,48,48,49,49,49,49,49
    426.     dc.b  49,50,50,50,50,50,50,51
    427.     dc.b  51,51,51,51,51,52,52,52
    428.     dc.b  52,52,52,53,53,53,53,53
    429.     dc.b  53,54,54,54,54,54,54,55
    430.     dc.b  55,55,55,55,55,56,56,56
    431.     dc.b  56,56,56,57,57,57,57,57
    432.     dc.b  57,58,58,58,58,58,58,59
    433.     dc.b  59,59,59,59,60,60,60,60
    434.  
    435.     dc.b  60,60,61,61,61,61,61,61
    436.     dc.b  62,62,62,62,62,62,63,63
    437.     dc.b  63,63,63,63,64,64,64,64
    438.     dc.b  64,64,65,65,65,65,65,65
    439.     dc.b  66,66,66,66,66,66,67,67
    440.     dc.b  67,67,67,67,68,68,68,68
    441.  
    442. Radar_xtable
    443.     dc.b    #0,#0,#0,#0,#0,#0,#0,#0
    444.     dc.b    #0,#0,#0,#0,#0,#0,#0,#0
    445.     dc.b    #0,#0,#0,#0,#0,#0,#0,#0
    446.     dc.b    #0,#0,#0,#0,#0,#0,#0,#0
    447.     dc.b    #0,#0,#0,#0,#0,#0,#0,#0
    448.     dc.b    #1,#1,#1,#1,#1,#1,#1,#1
    449.     dc.b    #1,#1,#1,#1,#1,#1,#1,#1
    450.     dc.b    #1,#1,#1,#1,#1,#1,#1,#1
    451.     dc.b    #1,#1,#1,#1,#1,#1,#1,#1
    452.     dc.b    #1,#1,#1,#1,#1,#1,#1,#1
    453.     dc.b    #2,#2,#2,#2,#2,#2,#2,#2
    454.     dc.b    #2,#2,#2,#2,#2,#2,#2,#2
    455.     dc.b    #2,#2,#2,#2,#2,#2,#2,#2
    456.     dc.b    #2,#2,#2,#2,#2,#2,#2,#2
    457.     dc.b    #2,#2,#2,#2,#2,#2,#2,#2
    458.     dc.b    #3,#3,#3,#3,#3,#3,#3,#3
    459.     dc.b    #3,#3,#3,#3,#3,#3,#3,#3
    460.     dc.b    #3,#3,#3,#3,#3,#3,#3,#3
    461.     dc.b    #3,#3,#3,#3,#3,#3,#3,#3
    462.     dc.b    #3,#3,#3,#3,#3,#3,#3,#3
    463.     dc.b    #4,#4,#4,#4,#4,#4,#4,#4
    464.     dc.b    #4,#4,#4,#4,#4,#4,#4,#4
    465.     dc.b    #4,#4,#4,#4,#4,#4,#4,#4
    466.     dc.b    #4,#4,#4,#4,#4,#4,#4,#4
    467.     dc.b    #4,#4,#4,#4,#4,#4,#4,#4
    468.     dc.b    #5,#5,#5,#5,#5,#5,#5,#5
    469.     dc.b    #5,#5,#5,#5,#5,#5,#5,#5
    470.     dc.b    #5,#5,#5,#5,#5,#5,#5,#5
    471.     dc.b    #5,#5,#5,#5,#5,#5,#5,#5
    472.     dc.b    #5,#5,#5,#5,#5,#5,#5,#5
    473.     dc.b    #6,#6,#6,#6,#6,#6,#6,#6
    474.     dc.b    #6,#6,#6,#6,#6,#6,#6,#6
    475.     dc.b    #6,#6,#6,#6,#6,#6,#6,#6
    476.     dc.b    #6,#6,#6,#6,#6,#6,#6,#6
    477.     dc.b    #6,#6,#6,#6,#6,#6,#6,#6
    478.     dc.b    #7,#7,#7,#7,#7,#7,#7,#7
    479.     dc.b    #7,#7,#7,#7,#7,#7,#7,#7
    480.     dc.b    #7,#7,#7,#7,#7,#7,#7,#7
    481.     dc.b    #7,#7,#7,#7,#7,#7,#7,#7
    482.     dc.b    #7,#7,#7,#7,#7,#7,#7,#7
    483.     dc.b    #8,#8,#8,#8,#8,#8,#8,#8
    484.     dc.b    #8,#8,#8,#8,#8,#8,#8,#8
    485.     dc.b    #8,#8,#8,#8,#8,#8,#8,#8
    486.     dc.b    #8,#8,#8,#8,#8,#8,#8,#8
    487.     dc.b    #8,#8,#8,#8,#8,#8,#8,#8
    488.     dc.b    #9,#9,#9,#9,#9,#9,#9,#9
    489.     dc.b    #9,#9,#9,#9,#9,#9,#9,#9
    490.     dc.b    #9,#9,#9,#9,#9,#9,#9,#9
    491.     dc.b    #9,#9,#9,#9,#9,#9,#9,#9
    492.     dc.b    #9,#9,#9,#9,#9,#9,#9,#9
    493.     dc.b    #10,#10,#10,#10,#10,#10,#10,#10
    494.     dc.b    #10,#10,#10,#10,#10,#10,#10,#10
    495.     dc.b    #10,#10,#10,#10,#10,#10,#10,#10
    496.     dc.b    #10,#10,#10,#10,#10,#10,#10,#10
    497.     dc.b    #10,#10,#10,#10,#10,#10,#10,#10
    498.     dc.b    #11,#11,#11,#11,#11,#11,#11,#11
    499.     dc.b    #11,#11,#11,#11,#11,#11,#11,#11
    500.     dc.b    #11,#11,#11,#11,#11,#11,#11,#11
    501.     dc.b    #11,#11,#11,#11,#11,#11,#11,#11
    502.     dc.b    #11,#11,#11,#11,#11,#11,#11,#11
    503.     dc.b    #12,#12,#12,#12,#12,#12,#12,#12
    504.     dc.b    #12,#12,#12,#12,#12,#12,#12,#12
    505.     dc.b    #12,#12,#12,#12,#12,#12,#12,#12
    506.     dc.b    #12,#12,#12,#12,#12,#12,#12,#12
    507.     dc.b    #12,#12,#12,#12,#12,#12,#12,#12
    508.     dc.b    #13,#13,#13,#13,#13,#13,#13,#13
    509.     dc.b    #13,#13,#13,#13,#13,#13,#13,#13
    510.     dc.b    #13,#13,#13,#13,#13,#13,#13,#13
    511.     dc.b    #13,#13,#13,#13,#13,#13,#13,#13
    512.     dc.b    #13,#13,#13,#13,#13,#13,#13,#13
    513.     dc.b    #14,#14,#14,#14,#14,#14,#14,#14
    514.     dc.b    #14,#14,#14,#14,#14,#14,#14,#14
    515.     dc.b    #14,#14,#14,#14,#14,#14,#14,#14
    516.     dc.b    #14,#14,#14,#14,#14,#14,#14,#14
    517.     dc.b    #14,#14,#14,#14,#14,#14,#14,#14
    518.     dc.b    #15,#15,#15,#15,#15,#15,#15,#15
    519.     dc.b    #15,#15,#15,#15,#15,#15,#15,#15
    520.     dc.b    #15,#15,#15,#15,#15,#15,#15,#15
    521.     dc.b    #15,#15,#15,#15,#15,#15,#15,#15
    522.     dc.b    #15,#15,#15,#15,#15,#15,#15,#15
    523.     dc.b    #16,#16,#16,#16,#16,#16,#16,#16
    524.     dc.b    #16,#16,#16,#16,#16,#16,#16,#17
    525.     dc.b    #17,#17,#17,#17,#17,#17,#17,#17
    526.     dc.b    #17,#17,#17,#17,#17,#18,#18,#18
    527.     dc.b    #18,#18,#18,#18,#18,#18,#18,#18
    528.     dc.b    #18,#18,#18,#19,#19,#19,#19,#19
    529.     dc.b    #19,#19,#19,#19,#19,#19,#19,#19
    530.     dc.b    #19,#20,#20,#20,#20,#20,#20,#20
    531.     dc.b    #20,#20,#20,#20,#20,#20,#20,#20
    532.     dc.b    #21,#21,#21,#21,#21,#21,#21,#21
    533.     dc.b    #21,#21,#21,#21,#21,#21,#22,#22
    534.     dc.b    #22,#22,#22,#22,#22,#22,#22,#22
    535.     dc.b    #22,#22,#22,#22,#23,#23,#23,#23
    536.     dc.b    #23,#23,#23,#23,#23,#23,#23,#23
    537.     dc.b    #23,#23,#24,#24,#24,#24,#24,#24
    538.     dc.b    #24,#24,#24,#24,#24,#24,#24,#24
    539.     dc.b    #24,#25,#25,#25,#25,#25,#25,#25
    540.     dc.b    #25,#25,#25,#25,#25,#25,#25,#26
    541.     dc.b    #26,#26,#26,#26,#26,#26,#26,#26
    542.     dc.b    #26,#26,#26,#26,#26,#27,#27,#27
    543.     dc.b    #27,#27,#27,#27,#27,#27,#27,#27
    544.     dc.b    #27,#27,#27,#28,#28,#28,#28,#28
    545.     dc.b    #28,#28,#28,#28,#28,#28,#28,#28
    546.     dc.b    #28,#29,#29,#29,#29,#29,#29,#29
    547.     dc.b    #29,#29,#29,#29,#29,#29,#29,#29
    548.     dc.b    #30,#30,#30,#30,#30,#30,#30,#30
    549.     dc.b    #30,#30,#30,#30,#30,#30,#31,#31
    550.     dc.b    #31,#31,#31,#31,#31,#31,#31,#31
    551.     dc.b    #31,#31,#31,#31,#32,#32,#32,#32
    552.     dc.b    #32,#32,#32,#32,#32,#32,#32,#32
    553.     dc.b    #32,#32,#33,#33,#33,#33,#33,#33
    554.     dc.b    #33,#33,#33,#33,#33,#33,#33,#33
    555.     dc.b    #33,#34,#34,#34,#34,#34,#34,#34
    556.     dc.b    #34,#34,#34,#34,#34,#34,#34,#35
    557.     dc.b    #35,#35,#35,#35,#35,#35,#35,#35
    558.     dc.b    #35,#35,#35,#35,#35,#36,#36,#36
    559.     dc.b    #36,#36,#36,#36,#36,#36,#36,#36
    560.     dc.b    #36,#36,#36,#37,#37,#37,#37,#37
    561.     dc.b    #37,#37,#37,#37,#37,#37,#37,#37
    562.     dc.b    #37,#38,#38,#38,#38,#38,#38,#38
    563.     dc.b    #38,#38,#38,#38,#38,#38,#38,#38
    564.     dc.b    #39,#39,#39,#39,#39,#39,#39,#39
    565.     dc.b    #39,#39,#39,#39,#39,#39,#40,#40
    566.     dc.b    #40,#40,#40,#40,#40,#40,#40,#40
    567.     dc.b    #40,#40,#40,#40,#41,#41,#41,#41
    568.     dc.b    #41,#41,#41,#41,#41,#41,#41,#41
    569.     dc.b    #41,#41,#42,#42,#42,#42,#42,#42
    570.     dc.b    #42,#42,#42,#42,#42,#42,#42,#42
    571.  
    572.  
    573. CPitchType_tbl
    574.     dc.w    0,0,0
    575.     dc.w    #Joy_U,#Joy_U,#Joy_U
    576.     dc.w    #Joy_D,#Joy_D,#Joy_D
    577.     dc.w    #Joy_L,#Joy_L,#Joy_L
    578.     dc.w    #Joy_R,#Joy_R,#Joy_R
    579.  
    580. ; 0 down middle, 1 high, 2 low, 3 left, 4 right
    581.  
    582.     xdef PlayerPos_EntityNum_tbl
    583.  
    584. PlayerPos_EntityNum_tbl
    585.     dc.w    #Pitcher_ptr,#Pitcher_ptr   ; s/r pitcher
    586.     dc.w    #FBaseman_ptr
    587.     dc.w    #SBaseman_ptr
    588.     dc.w    #TBaseman_ptr
    589.     dc.w    #ShortStop_ptr
    590.     dc.w    #LFielder_ptr
    591.     dc.w    #RFielder_ptr
    592.     dc.w    #CFielder_ptr
    593.     dc.w    #Catcher_ptr
    594.     dc.w    #Batter_ptr
    595.  
    596.  
    597. AFFlipTable
    598.     dc.w    FBaseman_ptr,TBaseman_ptr
    599.     dc.w    SBaseman_ptr,ShortStop_ptr
    600.     dc.w    RFielder_ptr,LFielder_ptr
    601.  
    602.     section .text
    603.  
    604. BatRangeTable
    605.     dc.w    BatLowHitRange,BatMidHitRange
    606.     dc.w    BatHighHitRange,BatMidHitRange
    607.  
    608.  
    609.     xdef    AI
    610.     xdef    NullLogic
    611.     xdef    BatSwing_000
    612.     xdef    Pitch_000
    613.     xdef    Bounds_RL
    614.     xdef    HaloLogic
    615.     xdef    FieldXLogic
    616.     xdef    LookEntityLogic
    617.     xdef    InitialBallLogic
    618.     xdef    BallShadowLogic
    619.     xdef    InitialCatcherLogic
    620.     xdef    InitialPitcherLogic
    621.     xdef    InitialBatterLogic
    622.     xdef    InitialCameraLogic
    623.     xdef    FractionalMultiply
    624.     xdef    InitialFielderLogic
    625.     xdef    InitialRunnerLogic
    626.     xdef    InitialFirstRunLogic
    627.     xdef    InitialSecondLogic
    628.     xdef    InitialThirdLogic
    629.  
    630. ***********************************************************************
    631. Cosine          MACRO
    632.  
    633.         movem.l \1/A0,-(sp)
    634.         lea.l   Cosine_Table,A0
    635.  
    636.         lsl.w   #1,\1
    637.         move.w  (A0,\1.w),\3
    638.         muls.w  \2,\3
    639.  
    640.         movem.l  (sp)+,\1/A0
    641.  
    642.         ENDM
    643.  
    644. Sine            MACRO
    645.  
    646.         movem.l \1/A0,-(sp)
    647.         lea.l   Sine_Table,A0
    648.  
    649.         lsl.w   #1,\1
    650.         move.w  (A0,\1.w),\3
    651.         muls.w  \2,\3
    652.  
    653.         movem.l  (sp)+,\1/A0
    654.  
    655.         ENDM
    656.  
    657. Atan            MACRO
    658.  
    659.         movem.l \1/\2/A0,-(sp)
    660.         lea.l   ArcTAN_Table,A0
    661.         lsr.l   #8,\1
    662.     IFEQ    ArcTan_Bytes-1
    663.         lsr.l   #1,\1
    664.     ELSEC
    665.         lsr.l   #1,\1
    666.     ENDC
    667.         add.l   #$8000,\2
    668.         clr.w   \2
    669.         swap    \2
    670.  
    671.         tst.l   \2
    672.         bne     .do_div\@
    673.  
    674.         move.w  #0,\3
    675.         bra     .atx\@
    676. .do_div\@
    677.         divu.w  \2,\1
    678.  
    679.         cmp.w   #$80,\1
    680.         blt     .adj\@
    681.  
    682.         move.w  #$20,\3
    683.         jmp     .atx\@
    684. .adj\@
    685.         sub.w   #1,\1
    686.         bpl     .do_shift\@
    687.         clr.w   \1
    688. .do_shift\@
    689.     IFEQ    ArcTan_Bytes-1
    690.         move.w  \1,\2
    691.         and.w   #$7E,\1
    692.  
    693.         move.w  (A0,\1.w),\3
    694.         btst    #0,\2
    695.         bne     .got_atan\@
    696.  
    697.         lsr.w   #8,\3
    698. .got_atan\@
    699.         and.w   #$00FF,\3
    700.     ELSEC
    701.         lsl.w   #1,\1
    702.         move.w  (A0,\1.w),\3
    703.     ENDC
    704. .atx\@
    705.         movem.l  (sp)+,\1/\2/A0
    706.  
    707.         ENDM
    708.  
    709. AI
    710.         movem.l D0-D7/A0-A6,-(sp)
    711.     move.l  sp,StackDebugPtr
    712.         move.w  Num_Entities,D7
    713. NORL
    714.     cmp.l   StackDebugPtr,sp
    715.     bne     NORL
    716.         lea.l   VTentity,A0
    717.         sub.l   #1,D7
    718.         bmi     _AI_done
    719.         move.l  D7,D0
    720.         asl.l   #Index_Shift,D0
    721.  
    722. *               cmp.w   #0,VTFon(A0,D0.w)       ;is this entity to be processed?
    723. *                beq     NORL                    ;if not then get the next one
    724.  
    725.         cmp.w   #2,RunnerExists
    726.         ble     .c1
    727.         cmp.w   #Batter_ptr,d0
    728.         ble     .c1
    729.         tst.w   VTFrend(a0,d0.w)
    730.         bne     .c1
    731.         move.w  d7,d6
    732.         and.w   #1,d6
    733.         move.w  VBlank_cnt,d5
    734.         and.w   #1,d5
    735.         eor.w   d5,d6
    736.         bne     NORL
    737. .c1
    738.         move.l  VTseq_step(A0,D0.w),D1  ;does this entity have AI?
    739.         beq     NORL                    ;if not then get the next one
    740.         move.l  D1,A1
    741.         jmp     (A1)                    ;otherwise do AI
    742. _AI_done
    743.         movem.l (sp)+,D0-D7/A0-A6
    744.         rts
    745.  
    746. *****************************************************************************
    747.  
    748. NullLogic       jmp     NORL
    749.  
    750. InfOutfline     equ     SBase_Y-$50000
    751. BILine1y       equ     #$34    ;20
    752. BILine2y       equ     #$c
    753.  
    754. Grab_Radius     equ     $20000
    755.  
    756.  
    757. BallSpeed       equ     $-200000
    758. Pball_x         equ     406
    759. Pball_y         equ     -21
    760.  
    761. BatHitFrame     equ     15           ;18
    762. CheckSwingFrame equ     15           ;18
    763.  
    764. RBatBoxMin     equ     $ffcc
    765. RBatBoxMax     equ     $ffe0  ;$ffe5
    766. LBatBoxMin     equ     $20    ;$1b
    767. LBatBoxMax     equ     $34
    768.  
    769. PitcherMaxL     equ     $fffc
    770. PitcherMaxR     equ     $4
    771.  
    772. BatHitToRunStrip equ    $0
    773.  
    774. SlowPitchSpeed equ     $08
    775. SlowPitchSpeedz equ     $2
    776. MediumPitchSpeed equ    $09
    777. MediumPitchSpeedz equ   $2
    778. FastPitchSpeed equ     $0b  ;a
    779. FastPitchSpeedz equ     $1
    780.  
    781. StraightPitch   equ     $0
    782. RightCurvePitch equ     $1
    783. LeftCurvePitch equ     $2
    784. UpCurvePitch   equ     $4
    785. DownCurvePitch equ     $8
    786. GroundFriction equ     $00000b00      ;500
    787.  
    788. BatLowHit       equ     $0
    789. BatMidHit       equ     $2
    790. BatHighHit     equ     $4
    791. Bunt           equ     $6
    792.  
    793.  
    794. BatYRangeLow   equ     $95   ;$082
    795. BatYRangeMid   equ     $a0   ;$095
    796. BatYRangeHigh   equ     $0ac
    797.  
    798. *BallRangeHigh equ     $0b2     ;off bottom of screen
    799. BallRangeHigh   equ     $0c0     ;off bottom of screen
    800.  
    801. BallMaxX       equ     $0400    ;off right of screen
    802. BallMinX       equ     $fc00    ;off left of screen
    803.  
    804. HitBoxY         equ     $095
    805. HitBoxTop       equ     $0b0     ;90
    806. HitBoxBottom   equ     $030
    807. HitBoxLeft     equ     $fff3
    808. HitBoxRight     equ     $b
    809.  
    810. Fielder_Reach   equ     $d0
    811. FielderRunSpeed equ     $5800  ;10000
    812.  
    813. Strike         equ     $0001
    814. Ball           equ     $ffff
    815. HT_Home_Run     equ     #1
    816. HT_Outf         equ     #2
    817. HT_Ord         equ     #0
    818. HT_Foul         equ     #3
    819. HT_Bunt         equ     #4
    820. HT_IFPop       equ     #5
    821.  
    822. BatLowHitRange equ     124  ;#$48
    823. BatMidHitRange equ     153  ;#$90
    824. BatHighHitRange equ     156  ;#$cb  
    825.  
    826. MaxZHeight     equ     #$400000
    827.  
    828.  
    829.  
    830. ballvscale_lo   equ     -7
    831. ballvscale_high equ     BallRangeHigh
    832.  
    833. *****************************************************************************
    834. WaitOnAnimation
    835.     tst.w   VTFrdir(a0,d0.w)    ;if animation not running don't wait
    836.     beq     setnextseq
    837.     tst.w   VTFrend(a0,d0.w)
    838.     beq     .done
    839. setnextseq
    840.     move.l  VTNextSeq(a0,d0.w),VTSeq_step(a0,d0.w)
    841.     clr.w   VTFrdir(a0,d0.w)
    842. .done   jmp     NORL
    843.  
    844. *****************************************************************************
    845. WaitOnCatchAnimation
    846.     jsr     checktags
    847.     tst.w   VTFrdir(a0,d0.w)    ;if animation not running don't wait
    848.     beq     .setnextseq
    849.     tst.w   VTFrend(a0,d0.w)
    850.     beq     .done
    851. .setnextseq
    852.     move.l  VTNextSeq(a0,d0.w),VTSeq_step(a0,d0.w)
    853.     clr.w   VTFrdir(a0,d0.w)
    854. .done   jmp     NORL
    855.  
    856.  
    857. **************************************************************
    858.     xdef HRDerbyLogic
    859.  
    860. HRDerbyLogic
    861.     tst.w   DerbyDone
    862.     bne     .waitstart
    863.  
    864.     move.w  Fcontrollers,d1     ;allow S to exit hrderby
    865.     or.w    BControllers,d1
    866.     btst    #Joy_S,d1
    867.     beq     .r1
    868.     lsr.w   #8,d1
    869.     btst    #Joy_S,d1
    870.     beq .waitstart
    871. .r1
    872.     lea.l   DerbyBatterNum,a1
    873.     add.l   BteamAdj,a1
    874.     move.w  (a1),PlayerAtBat
    875.   tst.w PlayerAtBat   ;QUICK PATCH : FIND BUG IN DOSUBS!
    876.   bge   .bp1
    877.   clr.w PlayerAtBat
    878. .bp1
    879.     tst.w   DerbyEvent
    880.     beq     .done
    881.     jsr     DisplayDerbyInfo
    882.  
    883.     cmp.w   #15,DerbyPitchNum
    884.     blt     .done
    885.  
    886.     tst.w   NumGamers
    887.     beq .dr
    888.     tst.w   DerbyPlayer
    889.     bne .dr
    890.     jsr Clear_ScrollA
    891. .dr
    892.     jsr DisplayDerbyRanking
    893.  
    894.     cmp.w   #1,NumGamers    ;derby over if 1 player mode
    895.     blt     .derbydone
    896.     tst.w   DerbyPlayer     ;or if player 2 is done
    897.     beq     .c1
    898. .derbydone
    899.     move.w  #1,DerbyDone
    900.     clr.w   VTFrdir(a0,d0.w)
    901.     clr.w   FComputer
    902.     bra     .done
    903. .c1
    904.     move.w  #1,NeedNewBatter
    905.     eor.l   #2,FTeamAdj
    906.     eor.l   #2,BTeamAdj
    907.     move.w  BTeamNum,d1
    908.     move.w  FTeamNum,BTeamNum
    909.     move.w  d1,FTeamNum
    910.     clr.w   DerbyPitchNum
    911.     clr.w   DerbyScore
    912.     eor.w   #1,DerbyPlayer
    913.     jsr     SwitchPlayerPal
    914. .done
    915.     jmp     NORL
    916. .waitstart
    917.     clr.w   VTfrdir(a0,d0.w)
    918.     move.w  Fcontrollers,d1
    919.     or.w    BControllers,d1
    920.     btst    #Joy_S,d1
    921.     beq     .checkc
    922.     lsr.w   #8,d1
    923.     btst    #Joy_S,d1
    924.     bne     .checkc
    925.     clr.w   FComputer       ;Reset Controllers
    926.     clr.l   FTeamAdj
    927.     move.l  #2,BTeamAdj
    928.     clr.w   killradarentities
    929.     clr.w   runsht
    930.     clr.w   runsvt
    931.     move    #0,FadeDirection        ;Fade Down Field
    932.     move    #2,FadeSpeed
    933.     clr.w   PracticeMode
    934.     StopSound       #S_DIGITALCROWD
    935.    jsr _Initgems
    936.     JSR     StartFadeDown
    937.     jsr     WaitForFadeUp
    938.     move.l  #VCTRL,A4               *; Macros use these registers
    939.     move.w  #$9000+000000,(A4)   ;R16= | 0 | 0 |VS1|VS0| 0 | 0 |HS1|HS0| Scroll Size (00=32,01=64,10=XX,11=128)
    940.     jmp     WarmEntry   ;DoGame
    941. .checkc
    942.     btst    #Joy_C,d1
    943.     beq     .done
    944.     lsr.w   #8,d1
    945.     btst    #Joy_C,d1
    946.     bne     .done
    947. *   jsr Clear_ScrollA
    948.     clr.w   DerbyDone
    949.     clr.w   DerbyPitchNum
    950.   move.w #14,derbypitchnum
    951.     clr.w   DerbyScore
    952.     move.w  #1,DerbyEvent
    953.     move.w  #1,NeedNewBatter
    954.     move.w  #1,FComputer
    955.     tst.w   NumGamers
    956.     bne .c1
    957.     clr.w   DerbyPlayer
    958.     jmp NORL
    959.  
    960. **************************************************************
    961.     xdef PracticeModeLogic
    962.  
    963. PracticeModeLogic
    964.     move.w  Fcontrollers,d1
    965.     or.w    BControllers,d1
    966.     btst    #Joy_S,d1
    967.     beq     .c1
    968.     lsr.w   #8,d1
    969.     btst    #Joy_S,d1
    970.     bne     .c1
    971.     bset    #Joy_S,d1
    972.     move.w  d1,BControllers
    973.     move.w  d1,FControllers
    974.     jsr     DisplayPractMsg
    975.     add.w   #1,temp4
    976.     cmp.w   #2,temp4
    977.     blt     .c1
    978.     jmp     DoGame
    979. .c1
    980.     move.w  Fcontrollers,d1
    981.     or.w    BControllers,d1
    982.     btst    #Joy_C,d1
    983.     beq     .done
    984.     lsr.w   #8,d1
    985.     btst    #Joy_C,d1
    986.     bne     .done
    987.  
    988.     move.w  #1,temp4
    989.     clr.w   d1                ;set debounce next round
    990.     bset    #Joy_C,d1
    991.     move.w  d1,BControllers
    992.     move.w  d1,FControllers
    993.  
    994.     eor.l   #2,FTeamAdj
    995.     eor.l   #2,BTeamAdj
    996.     move.w  Fcomputer,d1
    997.     move.w  Bcomputer,Fcomputer
    998.     move.w  d1,Bcomputer
    999.     jsr     DisplayPractMsg
    1000. .done
    1001.     jmp     NORL
    1002.  
    1003. HeavyCameraLogic
    1004.     movem.l a2,-(sp)
    1005.  
    1006.     lea.l   Vtentity+FieldX_ptr,a1
    1007.     tst.w   VTfon(a1)
    1008.     bne     _YNotReset
    1009.  
    1010. *  lea.l        Vtentity+ball_ent_ptr,a2
    1011. *  move.l       VTsped(a2),d2
    1012. *  asl.l        #4,d2
    1013. *  move.w       VTdir(a2),d1
    1014. *  jsr  GetEndPoint
    1015. *  add.l        VTy(a2),d2
    1016. *  move.l       d2,d1           ;leading y coordinate
    1017.  
    1018.     move.l  VTy(a0,d0.w),d1
    1019.     cmp.w   #BallHit_ps,Playstage
    1020.     beq .r0
    1021.     move.w  Active_Fielder,d3    ;if ball thrown
    1022.     move.l  VTy(a0,d3.w),d1      ;follow active fielder
    1023.  
    1024. *   move.l  VTy(a0,d0.w),d1
    1025. .r0 sub.l   Oldy,d1
    1026.     bge     _DY_Positive
    1027.     asr.l   #3,d1
    1028.     cmp.l   #-8*$10000,d1
    1029.     bge     _NDyok
    1030.     move.l  #-8*$10000,d1
    1031. _NDyok
    1032.     move.l  d1,PCamDy
    1033.     bra     _CamDyDone
    1034.  
    1035. _DY_Positive
    1036.     asr.l   #3,d1
    1037.     cmp.l   #8*$10000,d1
    1038.     ble     _PDyok
    1039.     move.l  #8*$10000,d1
    1040. _PDyok
    1041.     move.l  d1,PCamDy
    1042.  
    1043. _CamDyDone
    1044.     move.l  Oldy,d1
    1045.     add.l   PCamDy,d1
    1046.     move.l  d1,VTy(a0,d0.w)
    1047.     bra     _nowx
    1048.  
    1049. _YNotReset
    1050.     move.l  VTy(a0,d0.w),d1
    1051.     cmp.w   #BallHit_ps,Playstage
    1052.     beq .r1
    1053.     move.w  Active_Fielder,d3
    1054.     move.l  VTy(a0,d3.w),d1
    1055. .r1
    1056.     move.l  d1,d2
    1057.     and.l   #$ffff0000,d2
    1058.     move.l  Oldy,d3
    1059.     and.l   #$ffff0000,d3
    1060.     cmp.l   d2,d3
    1061.     beq     _nowx
    1062.     sub.l   Oldy,d1
    1063.     asr.l   #4,d1
    1064.     bpl     _YDY_Positive
    1065.     cmp.l   NCamDY,d1
    1066.     bge     _NsetNCamDy
    1067.  
    1068.     move.l  NCamDy,d1
    1069.     cmp.l   #-8*$10000,d1
    1070.     ble     _YNDyok
    1071.     sub.l   #$4000,d1
    1072. _NSetNCamDY
    1073.     move.l  d1,NCamDy
    1074. _YNDyok
    1075.     move.l  d1,PCamDy
    1076.     bra     _YCamDyDone
    1077.  
    1078. _YDY_Positive
    1079.     cmp.l   NCamDY,d1
    1080.     ble     _PSetNCamDY
    1081.  
    1082.     move.l  NCamDy,d1
    1083.     cmp.l   #8*$10000,d1
    1084.     bge     _YPDyok
    1085.     add.l   #$4000,d1
    1086.  
    1087. _PSetNCamDY
    1088.     move.l  d1,NCamDY
    1089.  
    1090. _YPDyok
    1091.     move.l  d1,PCamDy
    1092.  
    1093. _YCamDyDone
    1094.     move.l  Oldy,d1
    1095.     add.l   PCamDy,d1
    1096.     move.l  d1,VTy(a0,d0.w)
    1097. _nowx
    1098.     tst.w   VTFon(a1)
    1099.     bne     _XNotReset
    1100.  
    1101. *  lea.l        Vtentity+ball_ent_ptr,a2
    1102. *   move.l      VTsped(a2),d2
    1103. *   asl.l       #4,d2
    1104. *   move.w      VTdir(a2),d1
    1105. *   jsr GetEndPoint
    1106. *   add.l       VTx(a2),d1 ;leading x Coordinate
    1107.  
    1108.     move.l  Vtx(a0,d0.w),d1
    1109.     cmp.w   #BallHit_ps,Playstage
    1110.     beq .r2
    1111.     move.w  Active_Fielder,d3
    1112.     move.l  VTx(a0,d3.w),d1
    1113. .r2
    1114. *   move.l  Vtx(a0,d0.w),d1
    1115.     sub.l   Oldx,d1
    1116.     bge     _DX_Positive
    1117.     asr.l   #3,d1
    1118.     cmp.l   #-16*$10000,d1    ;16
    1119.     bge     _NDxok
    1120.     move.l  #-16*$10000,d1    ;16
    1121. _NDxok
    1122.     move.l  d1,PCamDx
    1123.     bra     _CamDxDone
    1124.  
    1125. _DX_Positive
    1126.     asr.l   #3,d1
    1127.     cmp.l   #16*$10000,d1    ;16
    1128.     ble     _PDxok
    1129.     move.l  #16*$10000,d1    ;16
    1130. _PDxok
    1131.     move.l  d1,PCamDx
    1132.  
    1133. _CamDxDone
    1134.     move.l  Oldx,d1
    1135.     add.l   PCamDx,d1
    1136.     move.l  d1,VTx(a0,d0.w)
    1137.     bra     .done
    1138.  
    1139. _XNotReset
    1140.  
    1141.     move.l  VTx(a0,d0.w),d1
    1142.  
    1143.     cmp.w   #BallHit_ps,Playstage
    1144.     beq .r3
    1145.     move.w  Active_Fielder,d3
    1146.     move.l  VTx(a0,d3.w),d1
    1147. .r3
    1148.     move.l  d1,d2
    1149.     and.l   #$ffff0000,d2
    1150.     move.l  Oldx,d3
    1151.     and.l   #$ffff0000,d3
    1152.     cmp.l   d2,d3
    1153.     beq     .done
    1154.     sub.l   Oldx,d1
    1155.     asr.l   #4,d1
    1156.     bge     _XDX_Positive
    1157.     cmp.l   NCamDX,d1
    1158.     bge     _NsetNCamDx
    1159.  
    1160.     move.l  NCamDx,d1
    1161.     cmp.l   #-16*$10000,d1      ;16
    1162.     ble     _XNDxok
    1163.     sub.l   #$4000,d1
    1164. _NSetNCamDX
    1165.     move.l  d1,NCamDx
    1166. _XNDxok
    1167.     move.l  d1,PCamDx
    1168.     bra     _XCamDxDone
    1169.  
    1170. _XDX_Positive
    1171.     cmp.l   NCamDX,d1
    1172.     ble     _PSetNCamDX
    1173.  
    1174.     move.l  NCamDx,d1
    1175.     cmp.l   #16*$10000,d1   ;16
    1176.     bge     _XPDxok
    1177.     add.l   #$4000,d1
    1178.  
    1179. _PSetNCamDX
    1180.     move.l  d1,NCamDX
    1181.  
    1182. _XPDxok
    1183.     move.l  d1,PCamDx
    1184.  
    1185. _XCamDxDone
    1186.     move.l  Oldx,d1
    1187.     add.l   PCamDx,d1
    1188.     move.l  d1,VTx(a0,d0.w)
    1189.  
    1190. .done
    1191.     movem.l (sp)+,a2
    1192.     rts
    1193.  
    1194.  
    1195. InitialCameraLogic
    1196.     tst.w   PanBack
    1197.     bne     _ResetCamera
    1198.  
    1199.     tst.w   InPitcherIF
    1200.     bne     .done
    1201.     tst.w   Catcherreturn
    1202.     bne     .done
    1203.  
    1204.     bra _movewithball
    1205. .done
    1206.     jmp     NORL
    1207.  
    1208. _movewithball
    1209.     tst.w   BallLocation
    1210.     beq     .chbs
    1211.     lea.l   VTentity,a1
    1212.     moveq.l #0,d1
    1213.     move.w  Balllocation,d1
    1214.     asl.w   #8,d1
    1215.     add.l   d1,a1
    1216.     bra     .smove
    1217. .chbs
    1218.     lea.l   VTEntity+BallShadow_Ent_ptr,a1
    1219.     cmp.w   #HT_Home_Run,Hittype
    1220.     bne     .smove
    1221.  
    1222.     lea.l   VTentity+Ball_ent_ptr,a1    ;follow ball
    1223.     bra     .smove
    1224.  
    1225. .smove
    1226. *  lea.l VTentity+Batter_ptr,a1
    1227.     move.w  #0,d0
    1228.     lea.l   VTentity,a0
    1229.  
    1230.     move.w  #1,d4
    1231.     move.w  VTx(a1),VTx(a0)
    1232.     move.w  VTy(a1),VTy(a0)
    1233.  
    1234.     lea.l   VTentity+FieldX_ptr,a1
    1235.     tst.w   VTfon(a1)
    1236.     beq     .hcl
    1237.     move.w  VTx(a1),VTx(a0)
    1238.     move.w  VTy(A1),VTy(a0)
    1239.  
    1240. .hcl    jsr     HeavyCameraLogic
    1241.     jsr     ScrollXY
    1242. .done
    1243.     lea.l   Vtentity,a0
    1244.     move.w  #0,d0
    1245.     move.l  VTy(a0,d0.w),Oldy
    1246.     move.l  VTx(a0,d0.w),Oldx
    1247.     jmp     NORL
    1248.  
    1249.  
    1250. _ResetCamera
    1251.     lea.l   VTentity+ballshadow_ent_ptr,a1
    1252.     move.w  #3,VTx(a1)
    1253.     move.w  #110,VTy(a1)
    1254.     move.w  #CamULC_X,d0
    1255.     move.w  #CamULC_Y,d1
    1256.     jsr     StepPanCamera1
    1257.     cmp.w   #CamULC_X,Map_ULC_X
    1258.     bne     .done
    1259.     cmp.w   #CamULC_Y,Map_ULC_Y
    1260.     bne     .done
    1261.     clr.w   PanBack
    1262.     lea.l   Vtentity,a0
    1263.     move.w  #CamCenterX,Vtx(a0)
    1264.     move.w  #CamCentery,Vty(a0)
    1265.     move.w  #CamCenterX,oldx
    1266.     move.w  #CamCenterY,oldy
    1267. .done   jmp NORL
    1268.  
    1269. setcamxy
    1270.     movem.l d1/a0-a1,-(sp)
    1271.     lea.l   Vtentity,a0
    1272.     lea.l   VTentity+Ball_ent_ptr,a1
    1273.     move.w  VTx(a1),d1
    1274.     add.w   Map_Center_X,D1
    1275.     sub.w   #128,d1
    1276.     move.w  d1,VTx(a0)
    1277.     move.l  VTy(a1),d1
    1278.     sub.w   #16,d1
    1279.     add.w   Map_Center_Y,D1
    1280.     sub.w   #110,d1
    1281.     move.w  d1,VTy(a0)
    1282.     movem.l (sp)+,d1/a0-a1
    1283.     rts
    1284. *_ResetCamera
    1285. *       clr.w   PanBack
    1286. *       lea.l   Field_Map,A0
    1287.  
    1288. *       move.w  #CamULC_X,D0
    1289. *       move.w  #CamULC_Y,D1
    1290. *       jsr     load_field
    1291. *       jmp     NORL
    1292.  
    1293.  
    1294.  
    1295. StepPanCamera1
    1296. *       D0 = target x position
    1297. *       D1 = target y position
    1298. *
    1299. *       Note: No bounds checking, scroll routines will not
    1300. *       scroll off screen, but camx,camy will get screwed up
    1301.  
    1302.     move.w  d1,d6
    1303.     sub.w   Map_ULC_Y,d6    ; Targy - MapULCY = distanceY
    1304.     beq     .panx
    1305.     bgt     .pand           ; if positive pan down
    1306.     neg.w   d6              ; distanceY = abs(distanceY)
    1307.     move.w      PanSpeed,d5
    1308.     sub.w       #8,d5
    1309.     cmp.w       d5,d6
    1310. *       cmp.w   PanSpeed,d6           ; move max 8 pixels this step
    1311.     ble     .sfu1
    1312.     move.w  PanSpeed,d6
    1313.     sub.w       #8,d6
    1314. .sfu1
    1315.     jsr     scroll_field_up
    1316.     bra     .panx
    1317. .pand
    1318.     move.w      PanSpeed,d5
    1319.     sub.w       #8,d5
    1320.     cmp.w       d5,d6
    1321. *       cmp.w   PanSpeed,d6
    1322.     ble     .sfd1
    1323.     move.w  PanSpeed,d6
    1324.     sub.w       #8,d6
    1325. .sfd1   jsr     scroll_field_down
    1326.  
    1327. .panx
    1328.     move.w  d0,d6        ;get ball x
    1329.     sub.w   Map_ULC_X,d6
    1330.     beq     .done
    1331.     bge     .panr
    1332.     neg.w   d6
    1333.     cmp.w   PanSpeed,d6
    1334.     ble     .sfl1
    1335.     move.w  PanSpeed,d6
    1336. .sfl1
    1337.     jsr     scroll_field_left
    1338.     bra     .done
    1339. .panr
    1340.     cmp.w   PanSpeed,d6
    1341.     ble     .sfr1
    1342.     move.w  PanSpeed,d6
    1343. .sfr1
    1344.     jsr     scroll_field_right
    1345.  
    1346. .done   rts
    1347.  
    1348.  
    1349.  
    1350. ScrollXY
    1351.     movem.l d6/a1,-(sp)
    1352.     lea.l   vtentity,a1
    1353.     move.w  VTy(a1),d6
    1354.     sub.w   #16,d6
    1355.     add.w   Map_Center_Y,D6
    1356.     sub.w   #110,d6
    1357.     sub.w   Map_ULC_Y,d6    ; Targy - MapULCY = distanceY
    1358.     beq     .panx
    1359.     bgt     .pand           ; if positive pan down
    1360.     neg.w   d6              ; distanceY = abs(distanceY)
    1361.     move.w  PanSpeed,d5
    1362.     sub.w   #8,d5
    1363.     cmp.w   d5,d6
    1364.     ble     .sfu1
    1365.     move.w  PanSpeed,d6
    1366.     sub.w   #8,d6
    1367. .sfu1
    1368.     jsr     scroll_field_up
    1369.     bra     .panx
    1370. .pand
    1371.     move.w  PanSpeed,d5
    1372.     sub.w   #8,d5
    1373.     cmp.w   d5,d6
    1374.     ble     .sfd1
    1375.     move.w  PanSpeed,d6
    1376.     sub.w   #8,d6
    1377. .sfd1   jsr     scroll_field_down
    1378.  
    1379. .panx
    1380.     tst.w   HScrol</div>
    1381.  
    1382. Of course, it's incomplete (cuts off). But it's a lot, heh.
    1383.  
    1384. Got anymore? :P
     
  2. evilhamwizard

    evilhamwizard

    Researcher
    1,392
    455
    63
    Yay here's some more, this is from Wayne Gretzsky NHLPA All-Stars (GEN):

    Code (ASM):
    1. CODEPLACE      ; PLOTTING SHADOWS!;
    2.                                
    3.  MOVE.L #DUDVAR,A5      ; GET POINTER TO SECTION
    4.  MOVE.W #DUDCHUNKIND,D5         ; INDEX!;
    5.                                                        
    6. .PS1
    7.  TST.W (A5,D5)                  ; CHECK IF PLAYER ON
    8.  BEQ.S .NOSHAD
    9.  TST.W DUDSHADFR(A5,D5)
    10.  BEQ.S .NOSHAD                  ; SKIP IF NO SHADOW TO PLOT!;
    11.  
    12.  MOVE DUDX(A5,D5),D0
    13.  MOVE DUDYS(A5,D5),D1
    14.  BEQ.S .NOSHAD          ; IF Y = 0- SKIP HIM
    15.        
    16.  LSR.W  #PSHIFT,D0             ; SAVE Y VALUE OF PUCK!;
    17.         SUB D2,D1               ; GET POSITION OF PUCK LESS ALTITUDE
    18.         MOVE.W D1,SPY                          
    19.         SUB WINDOWX,D0        ; GET WINDOWY
    20.         MOVE.W D0,SPX
    21.                                                                                                                                
    22. ;;        MOVE PUCKFR,D0              ; AND PLOT THE PUCKER!;
    23. ;;         JSR SAFEVIDEO_PLOT                 ; GENERAL PLOT TO VIDEO TAPE!;
    24. ;        JSR SAFEGENERAL_PLOT
    25.  
    26.         POP D1                  
    27.         TST.W PERIODOVER        ; IF REGULAR PERIOD OVER!;
    28.         BNE.S .SKIPSHAD
    29.                                        
    30.         MOVE.W D1,SPY
    31.         MOVE #&#036;5,D0              ; AND PLOT THE SHADOW!;
    32.         BSR SAFEVIDEO_PLOT                 ; GENERAL PLOT TO VIDEO TAPE!;
    33.  
    34. .SKIPSHAD              
    35.         RTS  
    36.  
    37.  
    38.  XDEF INITDUDELIST
    39. INITDUDELIST
    40.  CLR.W PTEMP
    41.                                                
    42.  MOVE #(NUMDUDS+2)*2,D2         ; MAKE BIGGER  FOR PUCK AND GOALS....
    43.                            
    44.  MOVE.L #PLOTDUDELIST,A1        ; GET PLOT LIST!;
    45. .ID2
    46.  MOVE.W PTEMP,D0
    47.  ADD #&#036;80,PTEMP
    48.  MOVE D0,(A1)+                  ; SAVE WHICH GUY TO PLOT!;
    49.  SUBQ #2,D2                     ; ONE LESS GUY!;
    50.  BPL.S .ID2                      ; NOT DONE YET!;
    51.  
    52.  MOVE.W #&#036;FFFF,(A1)+            ; FLAG FOR END!;
    53.  RTS
    54.  
    55.  
    56. SORTDUDES
    57. ; OK- THIS ONE GOES THROUGH DUDES AND JUST REA-ARRANGES THEM ONE AT A TIME...
    58.  MOVE.L #DUDVAR,A5      ; GET POINTER TO SECTION
    59.  
    60.  tst.w gamenum
    61.  beq.s .MAINGAME
    62.  
    63. ; UHH- HERE CLEAR ALL PUCKX AND THAT SHIT...
    64.  MOVE.W #LGOALDUD,D5            ; POINT TO LEFT GOAL...
    65.  CLR.W DUDYS(A5,D5)
    66.  CLR.W DUDFR(A5,D5)
    67.  MOVE.W #RGOALDUD,D5            ; POINT TO LEFT GOAL...
    68.  CLR.W DUDYS(A5,D5)
    69.  CLR.W DUDFR(A5,D5)
    70.  MOVE.W #PUCKDUD,D5            ; POINT TO LEFT GOAL...
    71.  CLR.W DUDYS(A5,D5)
    72.  CLR.W DUDFR(A5,D5)
    73.  BRA .SORTEM
    74.  
    75. .MAINGAME
    76.  MOVE.W #LGOALDUD,D5            ; POINT TO LEFT GOAL...
    77.  MOVE.W GOALX,D0
    78.  ASL #PSHIFT,D0
    79.  MOVE.W D0,DUDX(A5,D5)
    80.  MOVE.W GOALY,D0
    81.  ASL #PSHIFT,D0
    82.  MOVE D0,DUDYS(A5,D5)
    83.  ADD D0,D0
    84.  MOVE D0,DUDY(A5,D5)
    85.  MOVE.W #4,DUDFR(A5,D5)
    86.                      
    87.  MOVE.W #RGOALDUD,D5            ; POINT TO LEFT GOAL...
    88.  MOVE.W GOALX+2,D0
    89.  ASL #PSHIFT,D0
    90.  MOVE.W D0,DUDX(A5,D5)
    91.  MOVE.W GOALY+2,D0
    92.  ASL #PSHIFT,D0
    93.  MOVE D0,DUDYS(A5,D5)
    94.  ADD D0,D0
    95.  MOVE D0,DUDY(A5,D5)
    96.  MOVE.W #4+FLIP,DUDFR(A5,D5)
    97.  
    98.  MOVE.W #PUCKDUD,D5            ; POINT TO LEFT GOAL...
    99. ; MOVE.W #RGOALDUD,D5            ; POINT TO LEFT GOAL...
    100.  MOVE.W PUCKX,DUDX(A5,D5)
    101.  MOVE.W PUCKY,D0
    102.  MOVE.W D0,DUDY(A5,D5)
    103.  
    104.  SUB.W PUCKA,D0                 ; TAKE OFF ALTITUDE!;
    105.  LSR #1,D0
    106.  MOVE.W D0,DUDYS(A5,D5)
    107.  MOVE.W PUCKFR,DUDFR(A5,D5)
    108.                
    109.  
    110. .SORTEM        
    111. ; ANYWAYS SORT THE DAMN THING...
    112.  MOVE.L #PLOTDUDELIST,A1        ; GET PLOT LIST!;
    113. .SDL
    114.  MOVE.W (A1),D5                 ; GET GUY....
    115.  MOVE.W 2(A1),D4                ; GET OTHER GUY!;
    116.  BMI.S .SWAPDONE                     ; OK- DONE...
    117.        
    118.  MOVE DUDY(A5,D5),D0
    119.  CMP DUDY(A5,D4),D0
    120.  BHS .NOSWAP            ; equal no swap!;
    121.                        
    122. ; WOW!; SWAP THEM!;
    123.  MOVE D4,(A1)
    124.  MOVE D5,2(A1)
    125.  
    126. .NOSWAP
    127.  ADDQ.L #2,A1                     ; GO TO NEXT...
    128.  BRA .SDL
    129.  
    130. .SWAPDONE
    131.  RTS
    132.  
    133.  
    134. ; END OF FILE
    135. ; COACH.A       -
    136. ;
    137. ;
    138. ;       HANDLES PAUSED OPTIONS AND COACHING OPTIONS DURING GAMEPLAY!;
    139.  
    140.     OPT NOABSPCADD,E,NOCASE
    141.     NAME    FLUFF
    142.  
    143. ; SO LINE CHANGE CAN BE CALLED FROM COACHING SCREEN!;
    144.  
    145.  
    146.  
    147.  INCLUDE S:ASM.INC
    148.  INCLUDE S:DMA.INC
    149.  INCLUDE S:SOUNDS.INC
    150.                                
    151.     SECTION CODE,,C
    152.  
    153.        
    154.      XREF _gemspauseall
    155.      XREF _gemsresumeall
    156.  
    157.  XREF SAVELINES                  ; OK- SAVE THE LINES      
    158.  XREF CLEARRVSCREEN
    159.  XREF CLEARLVSCREEN
    160.                                        
    161.  XREF FROMCOACHLINE0
    162.  XREF FROMCOACHLINE1
    163.  
    164.         XREF SETSTATS
    165.         XREF CLEARMOSTVSCREEN                        
    166.         XREF CLEARVSCREEN                        
    167.         XREF CLEARSCREENA
    168.         XREF CLEARSCREENB
    169.         XREF SETALLPAL
    Here's some more from the same game:

    Code (ASM):
    1. MYIFL MACRO P1,P2,P3
    2.          CMP.W P2,P1
    3.          BLO.S P3        
    4.      ENDM              
    5.  
    6.        
    7. ;/* LONG JUMP IF LESS */
    8. MYIFLL MACRO P1,P2,P3
    9.          CMP.W P2,P1
    10.          BLO P3        
    11.      ENDM              
    12.                                
    13. ; IF LESS THAN!; */
    14. MYIFLE MACRO P1,P2,P3
    15.          CMP.W P2,P1
    16.          BLS.S P3        
    17.      ENDM              
    18.  
    19. ; DOES A QUICKY COMPARISON!; */
    20. MYIFG MACRO P1,P2,P3
    21.          CMP.W P2,P1
    22.          BHI.S P3        
    23.      ENDM              
    24.          
    25. MYIFGL MACRO P1,P2,P3
    26.          CMP.W P2,P1
    27.          BHI P3        
    28.      ENDM              
    29.  
    30. MYIFGE MACRO P1,P2,P3
    31.          CMP.W P2,P1
    32.          BHS.S P3
    33.      ENDM              
    34.                  
    35. MYIFNE MACRO P1,P2,P3
    36.          CMP.W P2,P1
    37.          BNE.S P3        
    38.      ENDM              
    39.  
    40.  
    41. BOXCHECK MACRO X,Y,LEFT,RIGHT,TOP,BOTTOM
    42.  LOCAL .NOTHIT,.BCDONE
    43.  MYIFL X,LEFT,.NOTHIT
    44.  MYIFG X,RIGHT,.NOTHIT
    45.  MYIFL Y,TOP,.NOTHIT
    46.  MYIFG Y,BOTTOM,.NOTHIT
    47.  SETEQ
    48.  BRA.S .BCDONE
    49. .NOTHIT
    50.  SETNE
    51. .BCDONE
    52.  ENDM
    53.  
    54.  
    55.  
    56.  
    57.  
    58.                                  
    59. RANGERLH MACRO REG,LOW,HIGH
    60.  LOCAL L1,L2
    61.  
    62. ; CHECKS IF SOMETHING IN RANGE!;
    63.  IFL LOW,REG,L1          ; IF WAY PAST THEN WRAPPED UNDER- NOT NEGATIVE!;
    64.  MOVE.W LOW,REG           ; IF SO, STOP!;
    65.  BRA.S L2                  ; WHY NEEDED?
    66.                                            
    67. L1:                    
    68.  IFG HIGH,REG,L2       ; IS IT LOWER THAN BOTTOM  THEN KOSHER!;?
    69.  MOVE.W HIGH,REG
     
  3. Overlord

    Overlord

    Now playable in Smash Bros Ultimate Moderator
    19,271
    987
    93
    Long-term happiness
    Code (Text):
    1. ; UHH- HERE CLEAR ALL PUCKX AND THAT SHIT...
    Man, these guys are just as professional with their commenting as I am =P
     
  4. evilhamwizard

    evilhamwizard

    Researcher
    1,392
    455
    63
    Huge amount of source code for Dragon's Lair (EU) NES (aka the terrible game that AVGN reviewed a few years back):

    Code (ASM):
    1. ;--------------------------------------
    2.  
    3. B3B_END
    4.     IF    B3B_END>$BFFF
    5.         PRINTF "**** BANK $3B too long !! ****"
    6.     ENDIF
    7.  
    8.  
    9. ; End of bank $3A/$3B
    10. ; --- -- ---- -------
    11.  
    12. ;======================================
    13.  
    14. ; Start of bank $39
    15. ; ----- -- ---- ---
    16.  
    17.     ORG    $139,$A000
    18.  
    19. ;--------------------------------------
    20. ; Sprite attribute tables
    21. ; ------ --------- ------
    22.  
    23. SPR3_ATAB_L
    24.     DL    A_B0
    25.     DL    A_B1
    26.     DL    A_B2
    27.     DL    A_B3
    28.     DL    A_B4
    29.     DL    A_B5
    30.     DL    A_B6
    31.     DL    A_B7
    32.     DL    A_B8
    33.     DL    A_B9
    34.     DL    A_B10
    35.     DL    A_B11
    36.     DL    A_B12
    37.     DL    A_B13
    38.     DL    A_B14
    39.     DL    A_B15
    40.     DL    A_B16
    41.     DL    A_B17
    42.     DL    A_B18
    43.     DL    A_B19
    44.     DL    A_B20
    45.     DL    A_B21
    46.     DL    A_B22
    47.     DL    A_B23
    48.     DL    A_B24
    49.     DL    A_B25
    50.     DL    A_B26
    51.     DL    A_B27
    52.     DL    A_B28
    53.     DL    A_B29
    54.     DL    A_B30
    55.     DL    A_B31
    56.     DL    A_B32
    57.     DL    A_B33
    58.  
    59. SPR3_ATAB_H
    60.     DH    A_B0
    61.     DH    A_B1
    62.     DH    A_B2
    63.     DH    A_B3
    64.     DH    A_B4
    65.     DH    A_B5
    66.     DH    A_B6
    67.     DH    A_B7
    68.     DH    A_B8
    69.     DH    A_B9
    70.     DH    A_B10
    71.     DH    A_B11
    72.     DH    A_B12
    73.     DH    A_B13
    74.     DH    A_B14
    75.     DH    A_B15
    76.     DH    A_B16
    77.     DH    A_B17
    78.     DH    A_B18
    79.     DH    A_B19
    80.     DH    A_B20
    81.     DH    A_B21
    82.     DH    A_B22
    83.     DH    A_B23
    84.     DH    A_B24
    85.     DH    A_B25
    86.     DH    A_B26
    87.     DH    A_B27
    88.     DH    A_B28
    89.     DH    A_B29
    90.     DH    A_B30
    91.     DH    A_B31
    92.     DH    A_B32
    93.     DH    A_B33
    94.  
    95. A_B0    DS    34,2
    96.     DS    22,1
    97.     DS    8,0
    98. A_B1    DS    31,2
    99.     DS    24,1
    100.     DS    9,0
    101. A_B2    DS    34,2
    102.     DS    25,1
    103.     DS    5,0
    104. A_B3    DS    21,2
    105.     DS    16,1
    106.     DS    7,2
    107.     DS    8,1
    108.     DS    12,0
    109. A_B4    DS    9,2
    110.     DS    12,1
    111.     DS    1,0
    112.     DS    18,2
    113.     DS    24,1
    114. A_B5    DS    28,2
    115.     DS    31,1
    116.     DS    5,0
    117. A_B6    DS    31,2
    118.     DS    21,1
    119.     DS    12,0
    120. A_B7    DS    28,2
    121.     DS    23,1
    122.     DS    13,0
    123. A_B8    DS    9,2
    124.     DS    15,1
    125.     DS    1,0
    126.     DS    24,2
    127.     DS    15,1
    128. A_B9    DS    37,2
    129.     DS    20,1
    130.     DS    7,0
    131. A_B10    DS    14,2
    132.     DS    10,1
    133.     DS    40,0
    134. A_B11    DS    25,0
    135.     DS    11,2
    136.     DS    25,1
    137.     DS    3,0
    138. A_B12    DS    15,2
    139.     DS    36,1
    140.     DS    13,0
    141. A_B13    DS    9,2
    142.     DS    17,1
    143.     DS    1,0
    144.     DS    16,2
    145.     DS    21,1
    146. A_B14    DS    31,2
    147.     DS    31,1
    148.     DS    2,0
    149. A_B15    DS    9,2
    150.     DS    13,1
    151.     DS    1,0
    152.     DS    18,2
    153.     DS    23,1
    154. A_B16    DS    29,2
    155.     DS    32,1
    156.     DS    3,0
    157. A_B17    DS    12,2
    158.     DS    17,1
    159.     DS    1,0
    160.     DS    8,2
    161.     DS    22,1
    162.     DS    4,0
    163. A_B18    DS    13,0
    164.     DS    6,1
    165.     DS    45,0
    166. A_B19    DS    18,0
    167.     DS    2,1
    168.     DS    34,3
    169.     DS    10,1
    170. A_B20    DS    52,3
    171.     DS    12,1
    172. A_B21    DS    64,0
    173. A_B22    DS    46,1
    174.     DS    18,0
    175. A_B23    DS    11,0
    176.     DS    20,1
    177.     DS    10,2
    178.     DS    23,3
    179. A_B24    DS    25,0
    180.     DS    23,3
    181.     DS    16,0
    182. A_B26    DS    58,0
    183.     DS    6,1
    184. A_B33
    185. A_B27            DS    64,1
    186. A_B28    DS    15,3
    187.     DS    17,0
    188.     DS    32,1
    189. A_B29    DS    11,0
    190.     DS    20,2
    191.     DS    33,3
    192. A_B30    DS    18,3
    193.     DS    46,0
    194. A_B31
    195. A_B25    DS    64,3
    196. A_B32             DS    32,2
    197.     DS    23,1
    198.     DS    9,0
    199.  
    200. ;--------------------------------------
    201.  
    202. ; Gold bonus screen
    203. ; ---- ----- ------
    204.  
    205. ; IN
    206. ; --
    207. ; A = 0-No bonus , 1-Normal bonus , 2-Big bonus
    208.  
    209. G_BONUS1
    210.     TAX
    211.     BNE    !1    ;No bonus
    212.     RTS
    213. !1
    214.     LDA    #3    ;Preload with start adding to
    215.     DEX        ;10's digit.
    216.     BEQ    !2
    217.     LDA    #2    ;Change to adding to 100's
    218. !2            ;digit.
    219.     STA    ZPAGE_BYTE9    ;Store which digit to start
    220.             ;adding to.
    221.  
    222.     LDA    PL_GOLD
    223.     ORA    PL_GOLD+1    ;Don't do gold bonus if no
    224.     ORA    PL_GOLD+2    ;gold.
    225.     CMP    #246
    226.     BNE    !3
    227.     RTS
    228. !3
    229.  
    230.     LDA    #0
    231.     STA    N_COLAP_CHR
    232.     STA    N_BONUS_FLAG
    233.  
    234.     JSR    SET_S0
    235.  
    236.     LDA    #128    ;Stop music
    237.     JSR    START_TUNE
    238.  
    239.     JSR    DISABLE_NC
    240.  
    241.     LDA    #GR_1ST+24          ;Background bank for chrs
    242.     STA    N_BG_BANK1
    243.     LDA    #GR_1ST+24+2
    244.     STA    N_BG_BANK2
    245.  
    246.     LDA    #PAL_1
    247.     JSR    CLS
    248.  
    249.     LDA    #21    ;'GOLD BONUS'
    250.     JSR    DRAW_SCR39
    251.  
    252.     JSR    D_GB    ;Draw gold bars
    253.  
    254.     JSR    ENABLE_CN
    255.  
    256.     LDA    #$FF
    257.     STA    CDF_A1+1
    258.  
    259.     JSR    SPR_CLEAR        ;All sprite off screen
    260.     LDA    #39                       ;Put on split CHR
    261.     STA    $200    ;Y
    262.      LDA    #64  
    263.     STA    $201    ;Character
    264.     LDA    #BIT5
    265.     STA    $202    ;Ctr
    266.     LDA    #16
    267.     STA    $203    ;X
    268.     LDA    #1
    269.     STA    N_DMA_FLAG
    270.     WAIT_FRAME
    271.  
    272.     JSR    ENABLE_SPR
    273.  
    274.     LDX    #0
    275.     JSR    FADE_IN
    276.  
    277.     LDX    #20    ;Wait before starting
    278.     JSR    M_WAIT_FRAME
    279.  
    280.     LDY    #>SCR_START+(32*16)+10-2
    281.     LDX    #<SCR_START+(32*16)+10-2
    282.     LDA    PL_GOLD+2    ;1's of gold
    283.     JSR    GB_R
    284.     LDY    #>SCR_START+(32*20)+10-2
    285.     LDX    #<SCR_START+(32*20)+10-2
    286.     LDA    PL_GOLD+1    ;10's of gold
    287.     JSR    GB_R
    288.     LDY    #>SCR_START+(32*24)+10-2
    289.     LDX    #<SCR_START+(32*24)+10-2
    290.     LDA    PL_GOLD    ;100's of gold
    291.     JSR    GB_R
    292.  
    293.  
    294.     LDX    #80    ;Wait before exiting
    295.     JSR    M_WAIT_FRAME
    296.  
    297.     LDX    #0
    298.     JSR    FADE_OUT
    299.  
    300.     RTS
    301.  
    302. ;------------------
    303.  
    304. ; Draw gold bonus bars
    305.  
    306. D_GB
    307.     LDA    #13    ;X1,X10,X100
    308.     JSR    PR_STR_TAB
    309.     LDA    #14
    310.     JSR    PR_STR_TAB
    311.     LDA    #15
    312.     JSR    PR_STR_TAB
    313.  
    314.     LDY    #>SCR_START+(32*16)+10
    315.     LDX    #<SCR_START+(32*16)+10
    316.     LDA    PL_GOLD+2    ;1's of gold
    317.     JSR    GB_D
    318.     LDY    #>SCR_START+(32*20)+10
    319.     LDX    #<SCR_START+(32*20)+10
    320.     LDA    PL_GOLD+1    ;10's of gold
    321.     JSR    GB_D
    322.     LDY    #>SCR_START+(32*24)+10
    323.     LDX    #<SCR_START+(32*24)+10
    324.     LDA    PL_GOLD    ;100's of gold
    325.     JSR    GB_D
    326.  
    327.     RTS
    328.  
    329. ;------------------
    330.  
    331. ; Draw a highlighted bar
    332.  
    333. ; IN
    334. ; --
    335. ; X - LSB Screen address of bar left
    336. ; Y - MSB Screen address of bar left
    337. ; A = Number in bar
    338.  
    339. GB_D
    340.     PHA
    341.     LDA    #0
    342.     STA    ZPAGE_BYTE11
    343.     PLA
    344.  
    345.     SEC
    346.     SBC    #246
    347.     STA    ZPAGE_BYTE10        ;Number highlighted
    348.     BEQ    !1
    349.  
    350.     LDA    #PAL_1
    351.     STA    PR_ATTR
    352.  
    353. ; Draw highlighted ones
    354.  
    355. !2    JSR    D_G2X2
    356.     INC    ZPAGE_BYTE11    ;Number drawn
    357.     DEC    ZPAGE_BYTE10
    358.     BNE    !2
    359.  
    360.    
    361. ; Draw unhighlighted ones
    362.  
    363. !1
    364.     LDA    #PAL_3
    365.     STA    PR_ATTR
    366.  
    367. !4    LDA    ZPAGE_BYTE11
    368.     CMP    #10
    369.     BNE    !3
    370.     RTS
    371. !3    JSR    D_G2X2
    372.     INC    ZPAGE_BYTE11
    373.     JMP    !4
    374.  
    375.  
    376. ; Draw a gold 2x2
    377. ; ---- - ---- ---
    378.  
    379. D_G2X2
    380.     STX    ZPAGE_WORD1
    381.       STY    ZPAGE_WORD1+1
    382.  
    383. ; Set attribute
    384.     LDA    PR_ATTR
    385.     JSR    SET_SCR_ATTR    ;Set attribute for quad
    386.  
    387.     LDX    ZPAGE_WORD1
    388.     LDY    ZPAGE_WORD1+1
    389. ; Draw top line
    390.     STY    VDP_VRAM_PTR
    391.     STX    VDP_VRAM_PTR
    392.  
    393.     LDA    #$69
    394.     STA    VDP_VRAM_DATA
    395.     LDA    #$6A
    396.     STA    VDP_VRAM_DATA
    397.  
    398. ; Downline and draw second line
    399.     TXA
    400.     CLC
    401.     ADC    #32
    402.     TAX
    403.     BCC    !1
    404.     INY      
    405. !1    STY    VDP_VRAM_PTR
    406.     STX    VDP_VRAM_PTR
    407.  
    408.     LDA    #$6B
    409.     STA    VDP_VRAM_DATA
    410.     LDA    #$6C
    411.     STA    VDP_VRAM_DATA
    412.  
    413.     LDX    ZPAGE_WORD1
    414.       LDY    ZPAGE_WORD1+1
    415.     INX
    416.     INX
    417.    
    418.     RTS
    419.  
    420. ;------------------
    421. ; Clear a bar
    422.  
    423. ; IN
    424. ; --
    425. ; X - LSB Screen address of bar left
    426. ; Y - MSB Screen address of bar left
    427. ; A - Number in bar to start with
    428.  
    429. GB_R
    430.  
    431.     SEC
    432.     SBC    #246
    433.     STA    ZPAGE_BYTE10
    434.     STY    ZPAGE_WORD11+1
    435.     STX    ZPAGE_WORD11
    436.  
    437.  
    438. !3    LDA    ZPAGE_BYTE10
    439.     BEQ    !5
    440.     ASL    A    ;Icons 2 chrs wide
    441. !1    LDY    ZPAGE_WORD11+1    ;Add offset to screen address
    442.     ADC    ZPAGE_WORD11
    443.     TAX
    444.  
    445.     JSR    CON_SCR_ATTR    ;Calc attribute address
    446.     STX    N_BONUS_AADR    ;Set up NMI to draw attribute
    447.     STY    N_BONUS_AADR+1
    448.  
    449.     STA    N_BONUS_ATTR    ;PAL_3 in rlevant bits
    450.     EOR    #$FF
    451.     STA    N_BONUS_AMASK    ;Hole for attribute
    452.     LDA    #1
    453.     STA    N_BONUS_FLAG
    454.     STA    N_BG_FLAG
    455.  
    456.     LDA    #24
    457.     STA    ZPAGE_BYTE11
    458.  
    459.     LDA    #1    ;Add to score
    460.     LDY    ZPAGE_BYTE9
    461.     JSR    SC_ADD
    462.  
    463.     LDY    #18            ;Make sound FX
    464.     JSR    FX_TRIGGER
    465.  
    466. !4    JSR    PANEL_SCAN
    467.     LDA    #1                  
    468.     STA    N_BG_FLAG            
    469.     WAIT_FRAME
    470.     DEC    ZPAGE_BYTE11
    471.     BNE    !4
    472.  
    473.     DEC    ZPAGE_BYTE10
    474.     BNE    !3
    475.  
    476. !5
    477.     DEC    ZPAGE_BYTE9
    478.  
    479.     RTS
    480.  
    481. ;--------------------------------------
    482. ; Setup NMI vars to change score digits
    483. ; ----- --- ---- -- ------ ----- ------
    484.  
    485. ; Scan the scores,lives and gold and if any need changing then
    486. ; setup one digit to be changed.
    487.  
    488. PANEL_SCAN
    489.     LDA    N_P_FLAG
    490.     BEQ    !1    ;Still waiting for update
    491.     RTS
    492. !1
    493.  
    494. ;   Scan current player score,gold or lives
    495.  
    496.     LDX    #PL_VARS_LEN-1
    497. PS_LP    LDA    PL_SC,X
    498.     CMP    PL_DATA_SO,X    ;Search for any differences
    499.     BNE    PS_FND
    500.     DEX
    501.     BPL    PS_LP
    502.  
    503. ;   Scan dormat players score
    504.  
    505.     LDX    #5-1    ;Just do score
    506. PS_LP2    LDA    PL_SC+P_VARS_LEN,X
    507.     CMP    PL2_DATA_SO,X    ;Search for any differences
    508.     BNE    PS_FND1
    509.     DEX
    510.     BPL    PS_LP2
    511.  
    512.     RTS
    513.  
    514. PS_FND1    STA    PL2_DATA_SO,X    ;Set onscreen for pl 2 score
    515.     SEC
    516.     SBC    #246-$0A
    517.     STA    N_P_CHR    ;Set character to draw
    518.  
    519.     LDA    PL_NUM
    520.     BNE    PS_SNMI    ;This is player 1's score(Lft)
    521.     JMP    PS_RGT    ;This is player 2's score(Rgt)
    522.  
    523.  
    524. PS_FND
    525.     STA    PL_DATA_SO,X    ;Set onscreen var
    526.     SEC
    527.     SBC    #246-$0A
    528.     STA    N_P_CHR    ;Set character to draw
    529.  
    530.     LDA    PL_NUM
    531.     BEQ    PS_SNMI    ;This is player 1's score(Lft)
    532.             ;This is player 2's score(Rgt)
    533. PS_RGT    TXA
    534.     CMP    #5    ;If Gold or lives alternate
    535.     BCS    !1    ;with whoose go it is
    536.     CLC
    537.     ADC    #PL_VARS_LEN    ;If score swap their sides
    538.     TAX
    539. !1
    540.  
    541. ; Setup vars to get NMI to draw a score digit.
    542.  
    543. PS_SNMI
    544.     LDA    P_ATAB,X
    545.     STA    N_P_SADR
    546.     LDA    #>SCR_START
    547.     STA    N_P_SADR+1
    548.  
    549.     LDA    #1
    550.     STA    N_P_FLAG
    551.  
    552.     RTS
    553.  
    554.  
    555. ; Screen address offset table
    556.  
    557. P_ATAB    DB    96+96+9    ;Player 1 score
    558.     DB    96+96+10
    559.     DB    96+96+11
    560.     DB    96+96+12
    561.     DB    96+96+13
    562.     DB    96+64+24    ;         Gold
    563.     DB    96+64+25
    564.     DB    96+64+26
    565.     DB    96+64+5    ;         Lives
    566.     DB    96+64+6
    567.     DB    96+96+18    ;Player 2 score
    568.     DB    96+96+19
    569.     DB    96+96+20
    570.     DB    96+96+21
    571.     DB    96+96+22
    572.  
    Here's the largest chunk:

    Code (ASM):
    1. XSPEED
    2.     STA    D_VARS+D_XSP_OFF+1,X
    3.  
    4.     LDA    ZPAGE_BYTE2
    5.     AND    #SDC_DOWN  
    6.     BNE    DI_CRAWLING_R
    7.  
    8. ;    Throw while standing up facing right
    9.  
    10.     LDA    DIRK_X_ONSCR
    11.     CLC        ;Setup dagger starting X
    12.     ADC    #24
    13.     BCS    !1
    14.     CMP    #230
    15.     BCC    !2
    16. !1    RTS        ; Error, Off edge
    17. !2    STA    D_VARS+D_X_OFF,X
    18.     LDA    DIRK_Y
    19.     SEC
    20.     SBC    #52
    21.     STA    D_VARS+D_Y_OFF,X
    22.     JMP    DI_XVXY_END
    23.  
    24. ;    Throw while crawling right
    25.  
    26. DI_CRAWLING_R
    27.     LDA    DIRK_X_ONSCR
    28.     CLC
    29.     ADC    #38
    30.     BCC    !1
    31.     RTS        ; Error, Off edge
    32. !1    STA    D_VARS+D_X_OFF,X
    33.     LDA    DIRK_Y
    34.     SEC
    35.     SBC    #31
    36.     STA    D_VARS+D_Y_OFF,X
    37.  
    38.  
    39. DI_XVXY_END
    40.     LDA    D_E_FRAC    ;Subtract energy from Dirk
    41.     CLC        ;for each weapon thrown
    42.     ADC    #16
    43.     STA    D_E_FRAC
    44.     BCC    !1
    45.     LDA    #-1
    46.     JSR    DIRK_NRG_ADD
    47. !1
    48.  
    49.     LDY    #1    ;Preload with normal dagger FX
    50.     LDX    WEAPON_TYPE
    51.     DEX
    52.     BNE    !2
    53.     LDY    #15    ;Axe throw FX
    54. !2    JMP    FX_TRIGGER    ;and 'RTS'
    55.  
    56. ;------------------
    57. ; Process all currently running daggers
    58.  
    59. D_PROCESS
    60.     LDX    #2*D_VAR_LEN    ;Offset to current dagger vars
    61. DP_LOOP
    62.     LDA    D_VARS+D_X_OFF,X
    63.     BEQ16    DP_END    ;This dagger isn't on
    64.  
    65.     LDA    #D_GRAVITY
    66.     CLC
    67.     ADC    D_VARS+D_YSP_OFF,X
    68.     STA    D_VARS+D_YSP_OFF,X    ;Add gravity to
    69.     BCC    !1      ;speed
    70.     INC    D_VARS+D_YSP_OFF+1,X
    71. !1
    72.  
    73.     CLC
    74.     ADC    D_VARS+D_YF_OFF,X
    75.     STA    D_VARS+D_YF_OFF,X    ;Add Y speed to Yf
    76.     LDA    D_VARS+D_YSP_OFF+1,X    ;and Y
    77.     ADC    D_VARS+D_Y_OFF,X
    78.     STA    D_VARS+D_Y_OFF,X
    79.  
    80.     LDA    D_VARS+D_YSP_OFF+1,X
    81.     BMI    BP_STILL_GOING
    82.     CMP    #7
    83.     BCC    BP_STILL_GOING
    84.  
    85.  
    86. ; Stop this dagger
    87.  
    88. BP_STOP
    89.     LDA    #0     ;the end
    90.     STA    D_VARS+D_X_OFF,X    ;If so,stop dagger
    91.     JMP    DP_END
    92. BP_STILL_GOING
    93.  
    94.     LDA    D_VARS+D_XSP_OFF,X
    95.     CLC           ;Add X speed to
    96.     ADC    D_VARS+D_XF_OFF,X    ;dagger X
    97.     STA    D_VARS+D_XF_OFF,X
    98.     LDA    D_VARS+D_XSP_OFF+1,X
    99.     ADC    D_VARS+D_X_OFF,X
    100.     CMP    #255-(D_XSPEED/256)
    101.     BCS    BP_STOP       ;Gone off edge of
    102.     STA    D_VARS+D_X_OFF,X    ;screen
    103.  
    104.     LDA    D_VARS+D_TYP_OFF,X
    105.     BEQ16    DP_DAG_SP
    106.  
    107.  
    108. ; Draw an axe and fireball
    109.  
    110. DP_AF_SP
    111.     LDA    D_VARS+D_X_OFF,X
    112.     STA    ZPAGE_WORD5
    113.     LDA    D_VARS+D_Y_OFF,X
    114.     STA    ZPAGE_WORD6    ;Setup X and Y's
    115.     LDA    #0
    116.     STA    ZPAGE_WORD5+1
    117.     STA    ZPAGE_WORD6+1
    118.  
    119.     LDA    D_VARS+D_TYP_OFF,X
    120.     CMP    #1
    121.     BEQ    DP_AXE_SP         ;Axe specific draw
    122.  
    123.  
    124. ;  Specific draw for fireball
    125.  
    126.     LDA    D_VARS+D_ANI_OFF,X
    127.     CMP    #3
    128.     BCC    DP_FB_AOK
    129.     LDA    #0
    130. DP_FB_AOK    TAY                      ;Animate the fireball
    131.     CLC
    132.     ADC    #1
    133.     STA    D_VARS+D_ANI_OFF,X
    134.  
    135.     LDA    D_VARS+D_XSP_OFF+1,X
    136.     BMI    DP_FB_LEFT
    137.  
    138.     SET16    ZPAGE_WORD2,DP_FB_LDEF
    139.      LDA    #BIT6
    140.     JMP    DP_FB_DEF_END
    141. DP_FB_LEFT
    142.     SET16    ZPAGE_WORD2,DP_FB_RDEF
    143.     LDA    #0
    144. DP_FB_DEF_END
    145.     STX    ZPAGE_BYTE10    ;Preserve X
    146.     TAX        ;Setup X for SPR_DRAW
    147.  
    148.     TYA
    149.     ASL    A
    150.     STA    ZPAGE_BYTE1
    151.     ASL    A
    152.     CLC        ;6 bytes per animation
    153.     ADC    ZPAGE_BYTE1    ;entry.
    154.     ADD16_A    ZPAGE_WORD2
    155.  
    156.     LDA    #128+1            ;Window number
    157.  
    158.     JSR    SPR3_DRAW_39    ;Draw sprite
    159.  
    160.     LDX    ZPAGE_BYTE10    ;Restore X
    161.  
    162.     JMP    DP_END
    163.  
    164.  
    165. ; Specific draw for axe
    166.  
    167. DP_AXE_SP
    168.     LDA    D_VARS+D_ANI_OFF,X
    169.     CMP    #4
    170.     BCC    DP_AXE_AOK
    171.     LDA    #0
    172. DP_AXE_AOK    TAY        ;Animate the dagger
    173.     CLC
    174.     ADC    #1
    175.     STA    D_VARS+D_ANI_OFF,X
    176.  
    177.     LDA    D_VARS+D_XSP_OFF+1,X
    178.     BMI    DP_AXE_LEFT
    179.  
    180.     SET16    ZPAGE_WORD2,DP_AXE_LDEF
    181.      LDA    #0
    182.     JMP    DP_AXE_DEF_END
    183. DP_AXE_LEFT
    184.     SET16    ZPAGE_WORD2,DP_AXE_RDEF
    185.     LDA    #BIT6
    186. DP_AXE_DEF_END
    187.     STX    ZPAGE_BYTE10    ;Preserve X
    188.     TAX        ;Setup X for SPR_DRAW
    189.  
    190.     TYA
    191.     ASL    A
    192.     STA    ZPAGE_BYTE1
    193.     ASL    A
    194.     CLC        ;6 bytes per animation
    195.     ADC    ZPAGE_BYTE1    ;entry.
    196.     ADD16_A    ZPAGE_WORD2
    197.  
    198.     LDA    #128+1    ;Window number
    199.  
    200.     JSR    SPR3_DRAW_39    ;Draw sprite
    201.  
    202.     LDX    ZPAGE_BYTE10    ;Restore X
    203.  
    204.     JMP    DP_END
    205.  
    206.  
    207. ; Draw a dagger
    208.  
    209. DP_DAG_SP
    210.     LDY    #0
    211.     LDA    D_VARS+D_Y_OFF,X
    212.     STA    (SD_PAGE_PTR),Y    ;Setup Y of dagger sprites
    213.     LDY    #4
    214.     STA    (SD_PAGE_PTR),Y
    215.  
    216.     LDA    D_VARS+D_X_OFF,X
    217.     DEY        ; Y=3
    218.     STA    (SD_PAGE_PTR),Y    ;Setup X of dagger sprites
    219.     CLC
    220.     ADC    #8
    221.     LDY    #7
    222.     STA    (SD_PAGE_PTR),Y
    223.  
    224.     LDA    D_VARS+D_XSP_OFF+1,X
    225.     BMI    DP_CHR_LEFT
    226.  
    227. ;   Setup dagger characters for going right
    228.  
    229.     LDA    #$14+64
    230.     LDY    #1
    231.     STA    (SD_PAGE_PTR),Y    ;Characters
    232.     LDA    #$13+64
    233.     LDY    #5
    234.     STA    (SD_PAGE_PTR),Y
    235.     LDA    #0+SPR_CTR_X_FLIP
    236.     JMP    DP_CHR_SEND
    237.  
    238. ;   Setup dagger characters for going left
    239.  
    240. DP_CHR_LEFT
    241.     LDA    #$13+64
    242.     LDY    #1
    243.     STA    (SD_PAGE_PTR),Y    ;Characters
    244.     LDA    #$14+64
    245.     LDY    #5
    246.     STA    (SD_PAGE_PTR),Y
    247.     LDA    #0
    248. DP_CHR_SEND
    249.  
    250.     LDY    #2
    251.     STA    (SD_PAGE_PTR),Y    ;Attribute
    252.     LDY    #6
    253.     STA    (SD_PAGE_PTR),Y
    254.  
    255.     LDA    SD_PAGE_PTR    ;Move over 2 sprites
    256.     CLC
    257.     ADC    #8
    258.     BNE    !1
    259.     LDA    #4
    260. !1    STA    SD_PAGE_PTR
    261.  
    262. DP_END
    263.     TXA
    264.     SEC        ;Move to next daggers vars
    265.     SBC    #D_VAR_LEN
    266.     TAX
    267.     BCS16    DP_LOOP
    268.  
    269.     JMP    SET_NORM_BANK         ;and 'RTS'
    270.  
    271. ;--------------------------------------
    272. ; Cameo screens
    273. ; ----- -------
    274.  
    275. CAMEO
    276.     LDA    #128    ;Stop tune playing
    277.     JSR    START_TUNE
    278.  
    279.     LDX    SCR_NUM            ;Setup BG bank
    280.     LDA    CAM_B_TAB,X
    281.     BEQ    !1
    282.     STA    N_BG_BANK1
    283.     CLC
    284.     ADC    #2
    285.     STA    N_BG_BANK2
    286.  
    287.     WAIT_FRAME
    288.     LDA    VDP_CTR_VAR0    ;Force screen 1
    289.     AND    #NOT-HORI_SWAP    ;to get rid of the
    290.     STA    VDP_CTR_VAR0    ;dash.
    291.     STA    VDP_CTR_REG0
    292.  
    293.     LDA    #-1
    294.     LDX    SCR_NUM
    295.     DEX
    296.     BEQ    !2            ;Don't scroll entrance cameo
    297.     LDA    #-6      
    298. !2    STA    N_SC_X
    299.     JSR    DISABLE_NC            ;Turn off NMI and CHR's
    300.  
    301.     LDA    #PAL_1
    302.     JSR    CLS          ;Clear screen
    303.  
    304.     LDX    SCR_NUM     ;Draw screen
    305.     LDA    CAM_S_TAB,X
    306.     JSR    S7_DS
    307.  
    308.     LDX    SCR_NUM               ;Draw attributes
    309.     LDA    CAM_A_TABL,X
    310.     STA    ZPAGE_WORD1
    311.     LDA    CAM_A_TABH,X
    312.     STA    ZPAGE_WORD1+1
    313.     SET_VRAM_PTR 27C8
    314.     LDX    #56
    315.     JSR    SI_SET_ATTR2  
    316.  
    317.     LDA    #0            ;Leave dash on other screen
    318.     STA    N_SPLIT
    319.  
    320.     JSR    ENABLE_CN
    321.  
    322.     LDX    SCR_NUM
    323.     LDA    CAM_F_TAB,X
    324.     PHA
    325.     TAX
    326.     JSR    FADE_IN
    327.  
    328.     LDX    #100    ;Wait for 100 frames
    329.     JSR    M_WAIT_FRAME
    330.  
    331.     PLA
    332.     TAX
    333.     JSR    FADE_OUT
    334.  
    335. !1
    336.      RTS
    337.  
    338. CAM_B_TAB    DB    0    ; 0 - Drawbridge
    339.     DB    GR_1ST+38    ; 1 - Entrance hall
    340.     DB    GR_1ST+42                  ; 2 - Mines
    341.     DB    GR_1ST+46                  ; 3 - Reaper
    342.     DB    0                 ; 4 -
    343.     DB    GR_1ST+50                  ; 5 - Singe
    344.     DB    0                    ; 6 - Elevator
    345.     DB    0                         ; 7 - Treasury
    346.     DB    0                         ; 8 - Dungeon
    347.  
    348.  
    349. CAM_S_TAB    DB    0    ; 0 - Drawbridge
    350.     DB    31    ; 1 - Entrance hall
    351.     DB    32                         ; 2 - Mines
    352.     DB    33                        ; 3 - Reaper
    353.     DB    0    ; 4 -
    354.     DB    35                  ; 5 - Singe
    355.     DB    0                    ; 6 - Elevator
    356.     DB    0                         ; 7 - Treasury
    357.     DB    0                         ; 8 - Dungeon
    358.  
    359. CAM_F_TAB    DB    0    ; 0 - Drawbridge
    360.     DB    75    ; 1 - Entrance hall
    361.     DB    80                         ; 2 - Mines
    362.     DB    85                        ; 3 - Reaper
    363.     DB    0    ; 4 -
    364.     DB    90                  ; 5 - Singe
    365.     DB    0                    ; 6 - Elevator
    366.     DB    0                         ; 7 - Treasury
    367.     DB    0                         ; 8 - Dungeon
    368.  
    369. CAM_A_TABH    DH    0    ; 0 - Drawbridge
    370.     DH    AM_C102_0    ; 1 - Entrance hall
    371.     DH    AM_C106_0    ; 2 - Mines
    372.     DH    AM_C110_0    ; 3 - Reaper
    373.     DH    0    ; 4 -
    374.     DH    AM_C114_0        ; 5 - Singe
    375.     DH    0        ; 6 - Elevator
    376.     DH    0        ; 7 - Treasury
    377.     DH    0                         ; 8 - Dungeon
    378.  
    379. CAM_A_TABL    DL    0    ; 0 - Drawbridge
    380.     DL    AM_C102_0    ; 1 - Entrance hall
    381.     DL    AM_C106_0    ; 2 - Mines
    382.     DL    AM_C110_0    ; 3 - Reaper
    383.     DL    0    ; 4 -
    384.     DL    AM_C114_0        ; 5 - Singe
    385.     DL    0        ; 6 - Elevator
    386.     DL    0        ; 7 - Treasury
    387.     DL    0                         ; 8 - Dungeon
    388.  
    389.  
    390.  
    391. ;    C102_0 ATTRIBUTE MAP ( 8 X 6 )
    392.  
    393. AM_C102_0
    394.  
    395.     DB    $65,$95,$65,$15,$45,$95,$65,$95
    396.     DB    $EE,$BB,$EE,$33,$CC,$BB,$EE,$BB
    397.     DB    $AA,$22,$00,$00,$00,$00,$88,$AA
    398.     DB    $AA,$22,$00,$00,$00,$00,$88,$AA
    399.     DB    $AA,$22,$00,$00,$00,$00,$88,$AA
    400.     DB    $AA,$AA,$00,$00,$00,$00,$88,$AA
    401.     DB    $AA,$AA,$00,$00,$00,$00,$88,$AA
    402.  
    403.  
    404.  
    405.  
    406. ;    C106_0 ATTRIBUTE MAP ( 8 X 6 )
    407.  
    408. AM_C106_0
    409.  
    410.     DB    $55,$B5,$A5,$A5,$A5,$A5,$F5,$11
    411.     DB    $9D,$AA,$AA,$AA,$AA,$AA,$AE,$11
    412.     DB    $99,$AA,$55,$55,$55,$99,$AA,$11
    413.     DB    $99,$AA,$55,$95,$55,$99,$AA,$11
    414.     DB    $99,$AA,$05,$09,$05,$89,$AA,$11
    415.     DB    $99,$AA,$00,$00,$00,$88,$AA,$11
    416.     DB    $99,$AA,$00,$00,$00,$88,$AA,$11
    417.  
    418. ;    C110_0 ATTRIBUTE MAP ( 8 X 6 )
    419.  
    420. AM_C110_0
    421.  
    422.     DB    $55,$55,$55,$55,$55,$55,$55,$11
    423.     DB    $55,$55,$05,$05,$05,$05,$45,$01
    424.     DB    $15,$00,$00,$00,$00,$00,$44,$00
    425.     DB    $00,$00,$C0,$FF,$33,$00,$44,$00
    426.     DB    $00,$00,$FC,$FF,$FF,$00,$44,$20
    427.     DB    $00,$C0,$FF,$00,$CC,$30,$A6,$22
    428.     DB    $0F,$0F,$0F,$00,$0C,$0F,$0A,$02
    429.  
    430.  
    431. ;    C114_0 ATTRIBUTE MAP ( 8 X 6 )
    432.  
    433. AM_C114_0
    434.  
    435.     DB    $AA,$EF,$77,$55,$FF,$FF,$FF,$33
    436.     DB    $BA,$EE,$77,$55,$FF,$FF,$FF,$33
    437.     DB    $FF,$FA,$86,$55,$FF,$FF,$FF,$33
    438.     DB    $FF,$BF,$AA,$65,$5F,$5F,$5F,$13
    439.     DB    $FF,$FF,$FF,$76,$55,$55,$55,$11
    440.     DB    $FF,$FF,$FF,$FF,$FF,$FF,$FF,$33
    441.     DB    $FF,$FF,$FF,$FF,$FF,$FF,$FF,$33
    442.  
    443.  
    444. ;--------------------------------------
    445.  
    446. B39_END
    447.     IF    B39_END>$BFFF
    448.         PRINTF "**** BANK $39 too long !! ****"
    449.     ENDIF
    450.  
    451.  
    452. ; End of bank $39
    453. ; --- -- ---- ---
    454. ;======================================
    455. ; Start of bank $38
    456. ; ----- -- ---- ---
    457.  
    458.     ORG    $138,$8000
    459.  
    460. ;--------------------------------------
    461. ; Include all the BG animation data.
    462. ; ------- --- --- -- --------- -----
    463.  
    464.     INCLUDE "BG_ANIM.SRC"    ;ACB's and DCB's
    465.     INCLUDE "BG_MAP1.SRC"    ;Bg anims map data
    466.  
    467. ;--------------------------------------
    468. ; Table of pointers to palettes.
    469. ; ----- -- -------- -- ---------
    470.  
    471. SPAL_PTR_TAB
    472.     DW    PAL_BLACK    ;0 - Mines (Bright)
    473.     DW    MI_P1    ;1
    474.     DW    MI_P2    ;2
    475.     DW    MI_P3    ;3
    476.     DW    S_PAL_S2    ;4
    477.     DW    PAL_BLACK    ;5 - Mines (Dark)
    478.     DW    MI_P1    ;6
    479.     DW    MI_P2    ;7
    480.     DW    MI_P4    ;8
    481.     DW    S_PAL_S2    ;9
    482.     DW    DIRK_FLASH_PAL    ;10
    483.     DW    PAL_BLACK    ;11 - Elevator
    484.     DW    ELEV_PAL0    ;12
    485.     DW    ELEV_PAL1    ;13
    486.     DW    ELEV_PAL2    ;14
    487.     DW    S_PAL_S6     ;15
    488.     DW    MI_P5    ;16 - 2 entry candle lit mines
    489.     DW    MI_P6    ;17 - 2 entry bright mines
    490.     DW    S_PAL_S2A    ;18 - 1 entry for lizard king
    491.     DW    S_PAL_S2B    ;19 - 1 entry for normal
    492.     DW    PAL_BLACK    ;20 - Grim reaper
    493.     DW    R00_PAL    ;21
    494.     DW    R01_PAL    ;22
    495.     DW    R02_PAL    ;23
    496.     DW    S_PAL_S2    ;24
    497.     DW    FLASH_PAL    ;25 - 4 ent Lighting flash
    498.     DW    PAL_BLACK    ;26 - Drawbridge
    499.     DW    DB_PAL1    ;27
    500.     DW    DB_PAL2    ;28
    501.     DW    DB_PAL3    ;29
    502.     DW    S_PAL_S0    ;30
    503.     DW    PAL_BLACK    ;31 - Name entry,
    504.     DW    AT_PAL1    ;32 - high score table
    505.     DW    AT_PAL2    ;33 - and title screen
    506.     DW    AT_PAL3    ;34
    507.     DW    AT_SPR_PAL    ;35
    508.     DW    G1_PAL0    ;36 - 'Start' glow
    509.     DW    G1_PAL1    ;37
    510.     DW    G1_PAL2    ;38
    511.     DW    G1_PAL3    ;39
    512.     DW    G1_PAL4    ;40
    513.     DW    PAL_BLACK    ;41
    514.     DW    SG_PAL1    ;42 - Singe's Lair
    515.     DW    SG_PAL2    ;43
    516.     DW    SG_PAL3    ;44
    517.     DW    S_PAL_S0    ;45
    518.     DW    SG_PAL4    ;46 - Dragon on
    519.     DW    PAL_BLACK    ;47 - Entrance Hall
    520.     DW    PAL_BLACK    ;48
    521.     DW    EH2_PAL    ;49
    522.     DW    EH2_PAL    ;50
    523.     DW    S_PAL_S2    ;51
    524.     DW    PAL_BLACK    ;52 - Treasury
    525.     DW    T_PAL0    ;53
    526.     DW    T_PAL1    ;54
    527.     DW    T_PAL2    ;55
    528.     DW    S_PAL_S7    ;56
    529.     DW    SG_PAL    ;57 - Singe bits palette
    530.     DW    PAL_BLACK    ;58 - No fade set of palettes
    531.     DW    PAL_BLACK    ;59   for use with mines drak
    532.     DW    PAL_BLACK    ;60   section and grim reaper
    533.     DW    PAL_BLACK    ;61   end.
    534.     DW    S_PAL_S2    ;62
    535.     DW    SG_PAL5    ;63 - Singe 1 ent green
    536.             DW    SG_FLASH    ;64 - Flash Reaper/Singe white
    537.     DW    R03_PAL    ;65 - Reaper 1 ent blue
    538.     DW    PAL_BLACK    ;66 - End screen palettes
    539.     DW    ES_PAL1    ;67
    540.     DW    ES_PAL2    ;68
    541.     DW    ES_PAL3    ;69
    542.     DW    S_PAL_S0    ;70
    543.     DW    S0_SNK    ;71 - Green for snake s0
    544.                 DW    EH3_PAL    ;72 - End screen (Entrance hall)
    545.     DW    EH3_F    ;73 - Flash snake
    546.     DW    EH3_R    ;74 - Restore snake
    547.     DW    PAL_BLACK    ;75 - Entrance hall cameo
    548.     DW    PAL_BLACK     ;76
    549.     DW    CAM_PAL3     ;77
    550.     DW    CAM_PAL3     ;78
    551.     DW    S_PAL_S0    ;79
    552.     DW    PAL_BLACK    ;80 - Mines cameo
    553.     DW    PAL_BLACK     ;81
    554.     DW    MIN_PAL3     ;82
    555.     DW    MIN_PAL3     ;83
    556.     DW    S_PAL_S0    ;84
    557.     DW    PAL_BLACK    ;85
    558.     DW    PAL_BLACK     ;86
    559.     DW    REAP_PAL3     ;87
    560.     DW    REAP_PAL3     ;88
    561.     DW    S_PAL_S0    ;89
    562.     DW    PAL_BLACK    ;90
    563.     DW    PAL_BLACK    ;91
    564.     DW    SING_PAL3    ;92
    565.     DW    SING_PAL3    ;93
    566.     DW    S_PAL_S0    ;94
    567.     DW    PAL_BLACK    ;95
    568.     DW    EH3_R    ;96 - Restore snake
    569.     DW    EH3_R    ;97
    570.     DW    EH3_R    ;98
    571.     DW    S_PAL_S0    ;99
    572.     DW    PAL_BLACK    ;100 - Credit screens
    573.     DW    R00_PAL    ;101
    574.     DW    R01_PAL    ;102
    575.     DW    CS_PAL    ;103
    576.     DW    S_PAL_S2    ;104
    577.  
    578.  
    579. ; BG palettes
    580.  
    581. FLASH_PAL    DB    WHITE3,WHITE2,WHITE1,WHITE0
    582.     DB    WHITE3,WHITE2,WHITE1,WHITE0
    583.     DB    WHITE3,WHITE2,WHITE1,WHITE0
    584.     DB    WHITE3,WHITE2,WHITE1,WHITE0
    585.  
    586.  
    587. PAL_BLACK    DB    BLACK,BLACK,BLACK,BLACK
    588.     DB    BLACK,BLACK,BLACK,BLACK
    589.     DB    BLACK,BLACK,BLACK,BLACK
    590.     DB    BLACK,BLACK,BLACK,BLACK
    591.  
    592. ; Sprite palettes
    593.  
    594. ; Screen 0 - Drawbridge
    595.  
    596. S_PAL_S0    DB    BLACK,WHITE2,WHITE1,WHITE0
    597.     DB    BLACK,ORANGE2,ORANGE3,YELLOW1
    598.     DB    BLACK,WHITE2,YELLOW2,WHITE0
    599. S0_SNK    DB    BLACK,GREEN3,GREEN2,MID_GREEN1
    600.  
    601.  
    602. S_PAL_S2    DB    BLACK,WHITE2,WHITE1,WHITE0
    603.     DB    BLACK,ORANGE2,ORANGE3,YELLOW1
    604.     DB    BLACK,WHITE2,YELLOW2,WHITE0
    605. S_PAL_S2B    DB    BLACK,ORANGE3,ORANGE2,ORANGE1
    606.  
    607.  
    608. ; Screen 6 - Elevator
    609.  
    610. S_PAL_S6    DB    BLACK,WHITE2,WHITE1,WHITE0
    611.     DB    BLACK,ORANGE2,ORANGE3,YELLOW1
    612.     DB    BLACK,WHITE2,YELLOW2,WHITE0
    613.     DB    BLACK,ORANGE3,ORANGE2,ORANGE1
    614.  
    615.  
    616. S_PAL_S7    DB    BLACK,WHITE2,WHITE1,WHITE0
    617.     DB    BLACK,ORANGE2,ORANGE3,YELLOW1
    618.     DB    BLACK,WHITE2,YELLOW2,WHITE0
    619. S_PAL_S2A    DB    BLACK,WHITE2,LT_GREEN1,LT_GREEN2 ;Lizard king palette
    620.  
    621.  
    622. DIRK_FLASH_PAL    DB    BLACK,WHITE2,WHITE1,WHITE0
    623.     DB    BLACK,WHITE2,WHITE2,WHITE2
    624.     DB    BLACK,WHITE2,WHITE2,WHITE2
    625. ;    DB    BLACK,WHITE1,MID_GREEN1,MID_GREEN0
    626.  
    627. SG_FLASH    DB    BLACK,WHITE3,WHITE3,WHITE3
    628.  
    629. ; Attract mode sprite palette
    630.  
    631. AT_SPR_PAL    DB    BLACK,BLUE2,BLUE2,BLUE1
    632.     DB    BLACK,ORANGE2,ORANGE1,ORANGE0
    633.     DB    BLACK,GREEN3,GREEN2,GREEN1
    634.     DB    BLACK,ORANGE3,ORANGE2,ORANGE1
    635.  
    636. ; Sprite palette for Singe's bits
    637.  
    638. SG_PAL    DB    BLACK,WHITE3,PURPLE2,PURPLE1
    639.  
    640. MI_F    DB    BLACK
    641.  
    642. ;======================================
    643.  
    644.  
    645. B38_END
    646.     IF    B38_END>$9FFF
    647.         PRINTF "**** BANK $38 too long !! ****"
    648.     ENDIF
    649.  
    650. ; End of bank $38
    651. ; --- -- ---- ---
    652. ;--------------------------------------
    653. ; Start of bank $37
    654. ; ----- -- ---- ---
    655.  
    656.     ORG    $137,$A000
    657.  
    658. ; Include screen maps
    659. ; ------- ------ ----
    660.  
    661.     INCLUDE "GR_SMAP2.SRC"
    662.  
    663. B37_END
    664.     IF    B37_END>$BFFF
    665.         PRINTF "**** BANK $37 too long !! ****"
    666.     ENDIF
    667.  
    668.  
    669. ; End of bank $37
    670. ; --- -- ---- ---
    671. ;--------------------------------------
    672. ; Start of bank $36
    673. ; ----- -- ---- ---
    674.  
    675.     ORG    $136,$8000
    676.  
    677. ; Include the ZZ_ and BM_ data for SPR_DRAW
    678. ; ------- --- --- --- --- ---- --- --------
    679.  
    680.     INCLUDE "GR_MAP.SRC"  
    681.     INCLUDE "GR_MAP2.SRC"
    682.     INCLUDE "GR_MAP3.SRC"
    683.  
    684.  
    685. ; ZZ_ and BM_ maps for test sprite
    686.  
    687. BM_TEST    DB    %11000000
    688.     DB    %11000000
    689.  
    690. ZZ_TEST    DB    30,30,30,30
    691.  
    692.  
    693.  
    694. B36_END
    695.     IF    B36_END>$9FFF
    696.         PRINTF "**** BANK $36 too long !! ****"
    697.     ENDIF
    698.  
    699.  
    700. ; End of bank $36
    701. ; --- -- ---- ---
    702.  
    703. ;--------------------------------------
    704. ; Start of bank $34+35
    705. ; ----- -- ---- ------
    706.  
    707.     ORG    $134,$8000
    708.  
    709.     INCBIN    "SCRBLK.INC"
    710.  
    711. B35_END
    712.     IF    B35_END>$BFFF
    713.         PRINTF "**** BANK $34+$35 too long !! ****"
    714.     ENDIF
    715.  
    716.  
    717. ; End of bank $34+$35
    718. ; --- -- ---- -------
    719. ;--------------------------------------
    720. ; Start of bank $32
    721. ; ----- -- ---- ---
    722.  
    723.     ORG    $132,$8000
    724.  
    725. ;--------------------------------------
    726.  
    727.     INCBIN  "ATTR.INC"
    728.  
    729. ;--------------------------------------
    730. ; Collapsing floor collision tables.(X,Screen address)
    731. ; ---------- ----- --------- ------  ----------------
    732.  
    733. ;  Screen 0 - Drawbridge
    734.  
    735. SCR0_COLAP_TAB
    736.     DW    104,9024+13
    737.     DW    112,9024+14
    738.     DW    120,9024+15
    739.  
    740.     DW    $FFFF
    741.  
    742.  
    743. ;  Screen 3 - Grim reaper
    744.  
    745. SCR3_COLAP_TAB  
    746.    
    747. ; Gr #1
    748.     DW    88,9024+11
    749.     DW    96,9024+12
    750.     DW    104
    more more!

    Code (ASM):
    1. ; Table 0 contains pointers to the top left hand corner screen address.
    2.  
    3. SCR_DRAW_TAB0    DW    DL_SCR_TLFT    ;0 - Panel
    4.     DW    DL_SCR_TLFT+(5*32)    ;1 - Draw Bridge
    5.     DW    SCR1_START+(26*32)    ;2 - Reaper floor
    6.     DW    DL_SCR_TLFT+(5*32)    ;3 - Treasury
    7.     DW    SCR1_START+(15*32)+22    ;4 - Reaper
    8.  
    9.     IF    FCS=1
    10.     DW    SCR_START+(9*32)+10    ;5 - SBIM logo
    11.     DW    SCR_START+(13*32)+13    ;6 - Presents
    12.     DW    SCR_START+(12*32)+24    ;7 - TM
    13.     DW    SCR_START+(19*32)+11    ;8 - Released by
    14.     DW    SCR_START+(21*32)+4    ;9 - EPIC logo
    15.     DW    SCR_START+(24*32)+5    ;10- Licensed by Nintendo
    16.     DW    SCR_START+(7*32)+7    ;11- EPIC release
    17.     DW    SCR_START+(12*32)+10    ;12- Developed by
    18.     DW    SCR_START+(14*32)+12    ;13- MotiveTime logo
    19.     DW    SCR_START+(18*32)+1    ;14- Copyright message
    20.     DW    SCR_START+(15*32)+10    ;15- Dragons Lair logo s1
    21.     ENDIF
    22.  
    23.     IF    GBR=1
    24.     DW    SCR_START+(5*32)+9    ;5 - SBIM logo
    25.     DW    SCR_START+(9*32)+11    ;6 - Presents
    26.     DW    SCR_START+(3*32)+9    ;7 - Don Bluth cs2
    27.     DW    SCR_START+(14*32)+10    ;8 - Released by
    28.     DW    SCR_START+(16*32)+6    ;9 - Elite logo
    29.     DW    SCR_START+(24*32)+5    ;10- Licensed by Nintendo
    30.     DW    SCR_START+(7*32)+5    ;11- Elite release
    31.     DW    SCR_START+(12*32)+10    ;12- Developed by
    32.     DW    SCR_START+(14*32)+11    ;13- MotiveTime logo
    33.     DW    SCR_START+(18*32)+1    ;14- Copyright message
    34.     DW    SCR_START+(11*32)+8    ;15- Dragons Lair logo s1
    35.     ENDIF
    36.  
    37.     DW    SCR_START+(3*32)+9    ;16- Dragons Lair logo s2
    38.     DW    SCR_START+(4*32)+23    ;17- TM credits screen 2
    39.     DW    SCR_START+(32*8)+7    ;18- SCORES
    40.     DW    SCR_START+(32*10)+8    ;19- PLAYERS
    41.     DW    SCR_START+(32*13)+8    ;20- MUSIC
    42.     DW    SCR_START+(32*10)+7    ;21- GOLD
    43.     DW    SCR_START+(32*23)+13    ;22- Mtime logo option screens
    44.     DW    SCR1_START+(32*8)+10    ;23-
    more!!

    Code (ASM):
    1.     DL    S6_TP_TAB    ;6 - Elevator
    2.     DL    S7_TP_TAB    ;7 - Treasury
    3.     DL    S8_TP_TAB    ;8 - Dungeon
    4.  
    5. SCR_TPTR_TABH    DH    S0_TP_TAB    ;0 - Drawbridge
    6.  
    7.     IF    HALL
    8.     DH    S1_TP_TAB    ;1 - Entrance hall
    9.     ELSE
    10.     DH    0
    11.     ENDIF
    12.  
    13.     IF    MINES
    14.     DH    S2_TP_TAB    ;2 - Mines
    15.     ELSE
    16.     DH    0
    17.     ENDIF
    18.  
    19.     IF    REAPER
    20.     DH    S3_TP_TAB    ;3 - Grim reaper
    21.     ELSE
    22.     DH    0
    23.     ENDIF
    24.  
    25.     DH    0    ;4-
    26.  
    27.     IF    SINGE
    28.     DH    S5_TP_TAB    ;5 - Singe
    29.     ELSE
    30.     DH    0
    31.     ENDIF
    32.  
    33.     DH    S6_TP_TAB    ;6 - Elevator
    34.     DH    S7_TP_TAB    ;7 - Treasury
    35.     DH    S8_TP_TAB    ;8 - Dungeon
    36.  
    37.  
    38. ;--------------------------------------
    39. ; Include graphics source files
    40. ; ------- -------- ------ -----
    41.  
    42.     INCLUDE "GR_SMAP1.SRC"
    43.  
    44. ;--------------------------------------
    45. ; Sprite Collision boxes
    46. ; ------ --------- -----
    47.  
    48. ; Table of pointers to collision boxes
    49.  
    50. SDC_COL_PTRS_L    DL    SCOL_0
    51.     DL    SCOL_1
    52.     DL    SCOL_2
    53.     DL    SCOL_3
    54.     DL    SCOL_4
    55.     DL    SCOL_5
    56.     DL    SCOL_6
    57.     DL    SCOL_7
    58.     DL    SCOL_8
    59.     DL    SCOL_9
    60.     DL    SCOL_10
    61.     DL    SCOL_11
    62.     DL    SCOL_12
    63.     DL    SCOL_13
    64.     DL    SCOL_14
    65.     DL    SCOL_15
    66.     DL    SCOL_16
    67.     DL    SCOL_17
    68.     DL    SCOL_18
    69.     DL    SCOL_19
    70.     DL    SCOL_20
    71.     DL    SCOL_21
    72.     DL    SCOL_22
    73.     DL    SCOL_23
    74.     DL    SCOL_24
    75.     DL    SCOL_25
    76.     DL    SCOL_26
    77.     DL    SCOL_27
    78.     DL    SCOL_25 ;28
    79.     DL    SCOL_26 ;29
    80.     DL    SCOL_27 ;30
    81.     DL    SCOL_31
    82.     DL    SCOL_32
    83.     DL    SCOL_33
    84.     DL    SCOL_34
    85.     DL    SCOL_35
    86.     DL    SCOL_36
    87.     DL    SCOL_37
    88.     DL    SCOL_38
    89.     DL    SCOL_39
    90.     DL    SCOL_40
    91.     DL    SCOL_41
    92.     DL    SCOL_42
    93.     DL    SCOL_43
    94.     DL    SCOL_44
    95.     DL    SCOL_45
    96.     DL    SCOL_46
    97.     DL    SCOL_47
    98.  
    99. SDC_COL_PTRS_H    DH    SCOL_0
    100.     DH    SCOL_1
    101.     DH    SCOL_2
    102.     DH    SCOL_3
    103.     DH    SCOL_4
    104.     DH    SCOL_5
    105.     DH    SCOL_6
    106.     DH    SCOL_7
    107.     DH    SCOL_8
    108.     DH    SCOL_9
    109.     DH    SCOL_10
    110.     DH    SCOL_11
    111.     DH    SCOL_12
    112.     DH    SCOL_13
    113.     DH    SCOL_14
    114.     DH    SCOL_15
    115.     DH    SCOL_16
    116.     DH    SCOL_17
    117.     DH    SCOL_18
    118.     DH    SCOL_19
    119.     DH    SCOL_20
    120.     DH    SCOL_21
    121.     DH    SCOL_22
    122.     DH    SCOL_23
    123.     DH    SCOL_24
    124.     DH    SCOL_25
    125.     DH    SCOL_26
    MORE!

    Code (ASM):
    1.     DL    SF_EL7
    2.  
    3.  
    4. SF_ETABH    DH    SF_EL0
    5.     DH    SF_EL1
    6.     DH    SF_EL2
    7.     DH    SF_EL3
    8.     DH    SF_EL4
    9.     DH    SF_EL5
    10.     DH    SF_EL6
    11.     DH    SF_EL7
    12.  
    13.  
    14. SF_EL0            ;Drawbridge
    15.  
    16. SF_EL1    DB    1,2,8,7    ;Entrance hall
    17.          
    18. SF_EL2    DB    8,2,3,7    ;Mines
    19.  
    20. SF_EL3    DB    5,8,3,7    ;Grim reaper
    21.  
    22. SF_EL4            ;Not implemented
    23.  
    24. SF_EL5            ;Singe
    25.  
    26. SF_EL6            ;Elevator
    27.  
    28. SF_EL7            ;Treasury
    29.  
    30.  
    31. SF_NOT_6
    32.  
    33. ; Stop exit off left of screen
    34.  
    35.     LDA    DIRK_X_ONSCR
    36.     CMP    #L_EDGE
    37.     BCS    SF_LOK
    38.  
    39.     LDA    SCR_NUM    ;Dirk exits on the left
    40.     CMP    #7    ;in the treasury
    41.     BNE    !1
    42.     LDA    END_LEVEL_FLAG    ;Exit from treasury
    43.     BNE    SF_LEVEL_END
    44. !1
    45.     LDA    #L_EDGE+4    ;Put Dirk at left
    46.     JSR    SF_CEP
    47.  
    48. SF_LOK
    49.  
    50. SF_SCROLL
    51.     LDA    SCROLL_FLAG      ;Is it a scrolling section
    52.     BEQ    SF_NOT_SCROLL
    53.  
    54.     LDA    SCROLL_XOFFSET+1    ;Test if finished scrolling
    55.     CMP    SCROLL_LENGTH+1    ;(16 bit compare)
    56.     BCC    SF_END
    57.     BNE    !1
    58.     LDA    SCROLL_XOFFSET
    59.     CMP    SCROLL_LENGTH
    60.     BCC    SF_END
    61.  
    62.  
    63. ; Scroll has finished so allow Dirk freedom to walk right.
    64.  
    65. !1
    66.     LDA    #0
    67.     STA    SCROLL_FLAG    ;Clear scroll flag
    68.  
    69. SF_NOT_SCROLL
    70.     LDA    DIRK_X_ON
    The rest isn't source code but some remnants of the OS the game was compiled on:

    Code (Text):
    1. All the memory in your machine has been exhausted.
    2.   Do you want to save your files before exiting to DOS?
    I found source code to two pirate games that take advantage of the light gun. And of course, there's Air Fortress' leftover source code which has been mentioned on X-Cult.
     
  5. evilhamwizard

    evilhamwizard

    Researcher
    1,392
    455
    63
    Yay time to double post again. This time, let's do Dragons Lair (JP) (FYI - the US version doesn't have anything interesting). Please note, it might be similar to EU in some parts but there are new fragments of code not found in the EU version:

    Let's start with this:

    Code (ASM):
    1.     DB    96+96+20
    2.     DB    96+96+21
    3.     DB    96+96+22
    4.  
    5. ;--------------------------------------
    6. ; Throw a dagger control routines
    7. ; ----- - ------ ------- --------
    8.  
    9. ; Initialization, this routine starts a dagger if there is one free
    10.  
    11. ; This routine was modifyed to cope with axes and fireballs
    12.  
    13. ; IN
    14. ; --
    15. ; A=Direction (BIT6=0 - Facing right  1 - Facing left)
    16.  
    17.  
    18. D_INIT
    19.     STA    ZPAGE_BYTE2
    20.  
    21.     LDX    WEAPON_TYPE
    22.     BEQ    DI_3ON    ;3 daggers allowed
    23.     DEX  
    24.     BEQ    DI_2ON    ;2 axes
    25.     JMP    DI_1ON    ;1 fireball
    26.  
    27. DI_3ON    LDX    #2*D_VAR_LEN
    28.     LDA    D_VARS+D_X_OFF+(2*D_VAR_LEN)
    29.     BEQ    DI_FREE
    30. DI_2ON    LDX    #1*D_VAR_LEN
    31.     LDA    D_VARS+D_X_OFF+(1*D_VAR_LEN)
    32.     BEQ    DI_FREE
    33. DI_1ON    LDX    #0*D_VAR_LEN
    34.     LDA    D_VARS+D_X_OFF+(0*D_VAR_LEN)
    35.     BEQ    DI_FREE
    36.  
    37.     RTS
    38.  
    39. ; X holds offset of block to init.
    40.  
    41. DI_FREE
    42.     LDA    WEAPON_TYPE
    43.     STA    D_VARS+D_TYP_OFF,X ;Store type in vars
    44.  
    45.     LDA    #0
    46.     STA    D_VARS+D_ANI_OFF,X ;Start at first anim
    47.  
    48. ; Setup Y velocity
    49.  
    50.     LDA    #<(-800)
    51.     STA    D_VARS+D_YSP_OFF,X
    52.     LDA    #>(-800)
    53.     STA    D_VARS+D_YSP_OFF+1,X
    54.  
    55. ; Setup X velocitys and X,Y's
    56.  
    57.     LDA    ZPAGE_BYTE2
    58.     AND    #SDC_LEFT
    59.     BEQ    DI_GOING_RGT
    60.  
    61. ;  Going left
    62.  
    63.  
    64. ;    Set velocity going left
    65.  
    66.     LDA    #<0+(0-D_XSPEED)
    67.     STA    D_VARS+D_XSP_OFF,X
    68.     LDA    #>0+(0-D_XSPEED)
    69.     STA    D_VARS+D_XSP_OFF+1,X
    70.  
    71.     LDA    ZPAGE_BYTE2
    72.     AND    #SDC_DOWN  
    73.     BNE    DI_CRAWLING_L
    74.  
    75. ;    Throw while standing up facing left
    76.  
    77.     LDA    DIRK_X_ONSCR
    78.     STA    D_VARS+D_X_OFF,X
    79.     LDA    DIRK_Y
    80.     SEC
    81.     SBC    #52
    82.     STA    D_VARS+D_Y_OFF,X
    83.     JMP    DI_XVXY_END
    84.  
    85.  
    86. ;    Throw while crawling left
    87.  
    88. DI_CRAWLING_L
    89.  
    90.     LDA    DIRK_X_ONSCR
    91.     SEC
    92.     SBC    #18
    93.     BCS    !1
    94.     RTS        ; Error, Off edge
    95. !1    STA    D_VARS+D_X_OFF,X
    96.     LDA    DIRK_Y
    97.     SEC
    98.     SBC    #31
    99.     STA    D_VARS+D_Y_OFF,X
    100.     JMP    DI_XVXY_END
    101.  
    102.  
    103. ;  Going right
    104.  
    105. DI_GOING_RGT
    106.  
    107. ;    Setup X velocity for going right
    108.  
    109.     LDA    #<D_XSPEED
    110.     STA    D_VARS+D_XSP_OFF,X
    111.     LDA    #>D_XSPEED
    112.     STA    D_VARS+D_XSP_OFF+1,X
    113.  
    114.     LDA    ZPAGE_BYTE2
    115.     AND    #SDC_DOWN  
    116.     BNE    DI_CRAWLING_R
    117.  
    118. ;    Throw while standing up facing right
    119.  
    120.     LDA    DIRK_X_ONSCR
    121.     CLC        ;Setup dagger starting X
    122.     ADC    #24
    123.     BCS    !1
    124.     CMP    #230
    125.     BCC    !2
    126. !1    RTS        ; Error, Off edge
    127. !2    STA    D_VARS+D_X_OFF,X
    128.     LDA    DIRK_Y
    129.     SEC
    130.     SBC    #52
    131.     STA    D_VARS+D_Y_OFF,X
    132.     JMP    DI_XVXY_END
    133.  
    134. ;    Throw while crawling right
    135.  
    136. DI_CRAWLING_R
    137.     LDA    DIRK_X_ONSCR
    138.     CLC
    139.     ADC    #38
    140.     BCC    !1
    141.     RTS        ; Error, Off edge
    142. !1    STA    D_VARS+D_X_OFF,X
    143.     LDA    DIRK_Y
    144.     SEC
    145.     SBC    #31
    146.     STA    D_VARS+D_Y_OFF,X
    147.  
    148.  
    149. DI_XVXY_END
    150.     LDA    D_E_FRAC    ;Subtract energy from Dirk
    151.     CLC        ;for each weapon thrown
    152.     ADC    #16
    153.     STA    D_E_FRAC
    154.     BCC    !1
    155.     LDA    #-1
    156.     JSR    DIRK_NRG_ADD
    157. !1
    158.  
    159.     LDY    #1    ;Preload with normal dagger FX
    160.     LDX    WEAPON_TYPE
    161.     DEX
    162.     BNE    !2
    163.     LDY    #15    ;Axe throw FX
    164. !2    JMP    FX_TRIGGER    ;and 'RTS'
    165.  
    166. ;------------------
    167. ; Process all currently running daggers
    168.  
    169. D_PROCESS
    170.     LDX    #2*D_VAR_LEN    ;Offset to current dagger vars
    171. DP_LOOP
    172.     LDA    D_VARS+D_X_OFF,X
    173.     BEQ16    DP_END    ;This dagger isn't on
    174.  
    175.     LDA    #D_GRAVITY
    176.     CLC
    177.     ADC    D_VARS+D_YSP_OFF,X
    178.     STA    D_VARS+D_YSP_OFF,X    ;Add gravity to
    179.     BCC    !1      ;speed
    180.     INC    D_VARS+D_YSP_OFF+1,X
    181. !1
    182.  
    183.     CLC
    184.     ADC    D_VARS+D_YF_OFF,X
    185.     STA    D_VARS+D_YF_OFF,X    ;Add Y speed to Yf
    186.     LDA    D_VARS+D_YSP_OFF+1,X    ;and Y
    187.     ADC    D_VARS+D_Y_OFF,X
    188.     STA    D_VARS+D_Y_OFF,X
    189.  
    190.     LDA    D_VARS+D_YSP_OFF+1,X
    191.     BMI    BP_STILL_GOING
    192.     CMP    #7
    193.     BCC    BP_STILL_GOING
    194.  
    195.  
    196. ; Stop this dagger
    197.  
    198. BP_STOP
    199.     LDA    #0     ;the end
    200.     STA    D_VARS+D_X_OFF,X    ;If so,stop dagger
    201.     JMP    DP_END
    202. BP_STILL_GOING
    203.  
    204.     LDA    D_VARS+D_XSP_OFF,X
    205.     CLC           ;Add X speed to
    206.     ADC    D_VARS+D_XF_OFF,X    ;dagger X
    207.     STA    D_VARS+D_XF_OFF,X
    208.     LDA    D_VARS+D_XSP_OFF+1,X
    209.     ADC    D_VARS+D_X_OFF,X
    210.     CMP    #255-(D_XSPEED/256)
    211.     BCS    BP_STOP       ;Gone off edge of
    212.     STA    D_VARS+D_X_OFF,X    ;screen
    213.  
    214.     LDA    D_VARS+D_TYP_OFF,X
    215.     BEQ16    DP_DAG_SP
    216.  
    217.  
    218. ; Draw an axe and fireball
    219.  
    220. DP_AF_SP
    221.     LDA    D_VARS+D_X_OFF,X
    222.     STA    ZPAGE_WORD5
    223.     LDA    D_VARS+D_Y_OFF,X
    224.     STA    ZPAGE_WORD6    ;Setup X and Y's
    225.     LDA    #0
    226.     STA    ZPAGE_WORD5+1
    227.     STA    ZPAGE_WORD6+1
    228.  
    229.     LDA    D_VARS+D_TYP_OFF,X
    230.     CMP    #1
    231.     BEQ    DP_AXE_SP         ;Axe specific draw
    232.  
    233.  
    234. ;  Specific draw for fireball
    235.  
    236.     LDA    D_VARS+D_ANI_OFF,X
    237.     CMP    #3
    238.     BCC    DP_FB_AOK
    239.     LDA    #0
    240. DP_FB_AOK    TAY                      ;Animate the fireball
    241.     CLC
    242.     ADC    #1
    243.     STA    D_VARS+D_ANI_OFF,X
    244.  
    245.     LDA    D_VARS+D_XSP_OFF+1,X
    246.     BMI    DP_FB_LEFT
    247.  
    248.     SET16    ZPAGE_WORD2,DP_FB_LDEF
    249.      LDA    #BIT6
    250.     JMP    DP_FB_DEF_END
    251. DP_FB_LEFT
    252.     SET16    ZPAGE_WORD2,DP_FB_RDEF
    253.     LDA    #0
    254. DP_FB_DEF_END
    255.     STX    ZPAGE_BYTE10    ;Preserve X
    256.     TAX        ;Setup X for SPR_DRAW
    257.  
    258.     TYA
    259.     ASL    A
    260.     STA    ZPAGE_BYTE1
    261.     ASL    A
    262.     CLC        ;6 bytes per animation
    263.     ADC    ZPAGE_BYTE1    ;entry.
    264.     ADD16_A    ZPAGE_WORD2
    265.  
    266.     LDA    #128+1            ;Window number
    267.  
    268.     JSR    SPR3_DRAW_39    ;Draw sprite
    269.  
    270.     LDX    ZPAGE_BYTE10    ;Restore X
    271.  
    272.     JMP    DP_END
    273.  
    274.  
    275. ; Specific draw for axe
    276.  
    277. DP_AXE_SP
    278.     LDA    D_VARS+D_ANI_OFF,X
    279.     CMP    #4
    280.     BCC    DP_AXE_AOK
    281.     LDA    #0
    282. DP_AXE_AOK    TAY        ;Animate the dagger
    283.     CLC
    284.     ADC    #1
    285.     STA    D_VARS+D_ANI_OFF,X
    286.  
    287.     LDA    D_VARS+D_XSP_OFF+1,X
    288.     BMI    DP_AXE_LEFT
    289.  
    290.     SET16    ZPAGE_WORD2,DP_AXE_LDEF
    291.      LDA    #0
    292.     JMP    DP_AXE_DEF_END
    293. DP_AXE_LEFT
    294.     SET16    ZPAGE_WORD2,DP_AXE_RDEF
    295.     LDA    #BIT6
    296. DP_AXE_DEF_END
    297.     STX    ZPAGE_BYTE10    ;Preserve X
    298.     TAX        ;Setup X for SPR_DRAW
    299.  
    300.     TYA
    301.     ASL    A
    302.     STA    ZPAGE_BYTE1
    303.     ASL    A
    304.     CLC        ;6 bytes per animation
    305.     ADC    ZPAGE_BYTE1    ;entry.
    306.     ADD16_A    ZPAGE_WORD2
    307.  
    308.     LDA    #128+1    ;Window number
    309.  
    310.     JSR    SPR3_DRAW_39    ;Draw sprite
    311.  
    312.     LDX    ZPAGE_BYTE10    ;Restore X
    313.  
    314.     JMP    DP_END
    315.  
    316.  
    317. ; Draw a dagger
    318.  
    319. DP_DAG_SP
    320.     LDY    #0
    321.     LDA    D_VARS+D_Y_OFF,X
    322.     STA    (SD_PAGE_PTR),Y    ;Setup Y of dagger sprites
    323.     LDY    #4
    324.     STA    (SD_PAGE_PTR),Y
    325.  
    326.     LDA    D_VARS+D_X_OFF,X
    327.     DEY        ; Y=3
    328.     STA    (SD_PAGE_PTR),Y    ;Setup X of dagger sprites
    329.     CLC
    330.     ADC    #8
    331.     LDY    #7
    332.     STA    (SD_PAGE_PTR),Y
    333.  
    334.     LDA    D_VARS+D_XSP_OFF+1,X
    335.     BMI    DP_CHR_LEFT
    336.  
    337. ;   Setup dagger characters for going right
    338.  
    339.     LDA    #$14+64
    340.     LDY    #1
    341.     STA    (SD_PAGE_PTR),Y    ;Characters
    342.     LDA    #$13+64
    343.     LDY    #5
    344.     STA    (SD_PAGE_PTR),Y
    345.     LDA    #0+SPR_CTR_X_FLIP
    346.     JMP    DP_CHR_SEND
    347.  
    348. ;   Setup dagger characters for going left
    349.  
    350. DP_CHR_LEFT
    351.     LDA    #$13+64
    352.     LDY    #1
    353.     STA    (SD_PAGE_PTR),Y    ;Characters
    354.     LDA    #$14+64
    355.     LDY    #5
    356.     STA    (SD_PAGE_PTR),Y
    357.     LDA    #0
    358. DP_CHR_SEND
    359.  
    360.     LDY    #2
    361.     STA    (SD_PAGE_PTR),Y    ;Attribute
    362.     LDY    #6
    363.     STA    (SD_PAGE_PTR),Y
    364.  
    365.     LDA    SD_PAGE_PTR    ;Move over 2 sprites
    366.     CLC
    367.     ADC    #8
    368.     BNE    !1
    369.     LDA    #4
    370. !1    STA    SD_PAGE_PTR
    371.  
    372. DP_END
    373.     TXA
    374.     SEC        ;Move to next daggers vars
    375.     SBC    #D_VAR_LEN
    376.     TAX
    377.     BCS16    DP_LOOP
    378.  
    379.     JMP    SET_NORM_BANK         ;and 'RTS'
    380.  
    381. ;--------------------------------------
    382. ; Cameo screens
    383. ; ----- -------
    384.  
    385. CAMEO
    386.     LDA    #128    ;Stop tune playing
    387.     JSR    START_TUNE
    388.  
    389.     RTS
    390.  
    391.     LDX    SCR_NUM            ;Setup BG bank
    392.     LDA    CAM_B_TAB,X
    393.     BEQ    !1
    394.     STA    N_BG_BANK1
    395.     CLC
    396.     ADC    #2
    397.     STA    N_BG_BANK2
    398.  
    399.     WAIT_FRAME
    400.     LDA    VDP_CTR_VAR0    ;Force screen 1
    401.     AND    #NOT-HORI_SWAP    ;to get rid of the
    402.     STA    VDP_CTR_VAR0    ;dash.
    403.     STA    VDP_CTR_REG0
    404.  
    405.     LDA    #-1
    406.     LDX    SCR_NUM
    407.     DEX
    408.     BEQ    !2            ;Don't scroll entrance cameo
    409.     LDA    #-6      
    410. !2    STA    N_SC_X
    411.     JSR    DISABLE_NC            ;Turn off NMI and CHR's
    412.  
    413.     LDA    #PAL_1
    414.     JSR    CLS          ;Clear screen
    415.  
    416.     LDX    SCR_NUM     ;Draw screen
    417.     LDA    CAM_S_TAB,X
    418.     JSR    S7_DS
    419.  
    420.     LDX    SCR_NUM               ;Draw attributes
    421.     LDA    CAM_A_TABL,X
    422.     STA    ZPAGE_WORD1
    423.     LDA    CAM_A_TABH,X
    424.     STA    ZPAGE_WORD1+1
    425.     SET_VRAM_PTR 27C8
    426.     LDX    #56
    427.     JSR    SI_SET_ATTR2  
    428.  
    429.     LDA    #0            ;Leave dash on other screen
    430.     STA    N_SPLIT
    431.  
    432.     JSR    ENABLE_CN
    433.  
    434.     LDX    SCR_NUM
    435.     LDA    CAM_F_TAB,X
    436.     PHA
    437.     TAX
    438.     JSR    FADE_IN
    439.  
    440.     LDX    #100    ;Wait for 100 frames
    441.     JSR    M_WAIT_FRAME
    442.  
    443.     PLA
    444.     TAX
    445.     JSR    FADE_OUT
    446.  
    447. !1
    448.      RTS
    449.  
    450. CAM_B_TAB    DB    0    ; 0 - Drawbridge
    451.     DB    GR_1ST+38    ; 1 - Entrance hall
    452.     DB    GR_1ST+42                  ; 2 - Mines
    453.     DB    GR_1ST+46                  ; 3 - Reaper
    454.     DB    0                 ; 4 -
    455.     DB    GR_1ST+50                  ; 5 - Singe
    456.     DB    0                    ; 6 - Elevator
    457.     DB    0                         ; 7 - Treasury
    458.     DB    0                         ; 8 - Dungeon
    459.  
    460.  
    461. CAM_S_TAB    DB    0    ; 0 - Drawbridge
    462.     DB    31    ; 1 - Entrance hall
    463.     DB    32                         ; 2 - Mines
    464.     DB    33                        ; 3 - Reaper
    465.     DB    0    ; 4 -
    466.     DB    35                  ; 5 - Singe
    467.     DB    0                    ; 6 - Elevator
    468.     DB    0                         ; 7 - Treasury
    469.     DB    0                         ; 8 - Dungeon
    470.  
    471. CAM_F_TAB    DB    0    ; 0 - Drawbridge
    472.     DB    75    ; 1 - Entrance hall
    473.     DB    80                         ; 2 - Mines
    474.     DB    85                        ; 3 - Reaper
    475.     DB    0    ; 4 -
    476.     DB    90                  ; 5 - Singe
    477.     DB
    more:

    Code (ASM):
    1. $AA,$65,$5F,$5F,$5F,$13
    2.     DB    $FF,$FF,$FF,$76,$55,$55,$55,$11
    3.     DB    $FF,$FF,$FF,$FF,$FF,$FF,$FF,$33
    4.     DB    $FF,$FF,$FF,$FF,$FF,$FF,$FF,$33
    5.  
    6. ;--------------------------------------
    7. ; Lizard king
    8. ; ------ ----
    9.  
    10. LIZ_ON_TIME   EQU    100
    11.  
    12.  
    13. LIZARD_PROCESS
    14.  
    15.     LDA    LIZARD_FLAG
    16.     BEQ16    LP_NOT_ON    ;Wait before bringing
    17.     DEC    LIZARD_FLAG    ;another on.
    18.     BNE    LP_NOT_END
    19.  
    20.  
    21. ; Lizard has ended
    22.     LDA    FADE_PALETTE
    23.     CLC
    24.     ADC    #4
    25.     LDX    #4
    26.     LDY    #4
    27.     JSR    CHANGE_PAL    ;Set sprite palette
    28.  
    29.     LDA    SPR3_WIN2_R    ;Reset back to normal
    30.     STA    SPR3_WIN2                  ;sprite bank
    31.  
    32.     LDY    #FLAG_OFF+1
    33.     LDA    (LIZ_FCD_VARS),Y
    34.     ORA    #(FCD_SP1_BIT/256)    ;Set death bit
    35.     STA    (LIZ_FCD_VARS),Y
    36.  
    37.     RTS
    38.  
    39. LP_NOT_END
    40.     LDA    LIZARD_FLAG
    41.     CMP    #LIZ_ON_TIME-20
    42.     BEQ    LP_EXPLODE    ;Start lizard on explosions
    43.     RTS
    44.  
    45. ;  Start lizard appear explosions
    46.  
    47. LP_EXPLODE
    48.     LDA    #18
    49.     LDX    #7
    50.     LDY    #1
    51.     JSR    CHANGE_PAL
    52.  
    53. ; Start lizard king.
    54.  
    55.     SET16    ZPAGE_WORD2,FCD_LZ
    56.     LDA    #8
    57.     STA    ZPAGE_BYTE1    ;Hit count
    58.     LDA    #ST_LZ
    59.     STA    ZPAGE_BYTE2    ;Sprite type
    60.     JSR    SI_39    ;Try to start FCD sprite.
    61.     BNE    LP_CANT_START
    62.     LDA    ZPAGE_WORD1
    63.     STA    LIZ_FCD_VARS    ;Store address of FCD vars
    64.     LDA    ZPAGE_WORD1+1
    65.     STA    LIZ_FCD_VARS+1
    66.     LDA    DIRK_Y
    67.     SEC
    68.     SBC    #22
    69.     JSR    SR_39    ;Start Lizard after waiting
    70.  
    71.     JSR    LP_ST_SMOKE
    72.     BNE    LP_CANT_START    ;Can't start smoke
    73.     LDA    DIRK_Y    ;Start bottom smoke
    74.     SEC
    75.     SBC    #44
    76.     JSR    SR_39
    77.  
    78.     JSR    LP_ST_SMOKE
    79.     BNE    LP_CANT_START    ;Can't start smoke
    80.     LDA    DIRK_Y    ;Start top smoke
    81.     SEC
    82.     SBC    #72
    83.     JSR    SR_39
    84.  
    85.  
    86. LP_CANT_START
    87.  
    88. ; Change to correct sprite bank in window 2
    89.     LDA    #23
    90.     STA    SPR3_WIN2
    91.  
    92. ; Start lizard king fanfare
    93.  
    94.     LDY    #31
    95.     JSR    FX_TRIGGER
    96.     LDY    #32
    97.     JSR    FX_TRIGGER
    98.     LDY    #33
    99.     JMP    FX_TRIGGER      ;and 'RTS'
    100.  
    101.  
    102. ; Lizard king is not on so check if he can be brought on
    103.  
    104. LP_NOT_ON
    105.  
    106. ; Don't bring on if no gold
    107.     LDA    PL_GOLD
    108.     ORA    PL_GOLD+1    ;Don't do gold bonus if no
    109.     ORA    PL_GOLD+2    ;gold.
    110.     CMP    #246
    111.     BNE    !1
    112.     RTS
    113. !1
    114.  
    115. ; Check if allowed on at the current scroll position
    116.     LDX    SCR_NUM
    117.     LDA    LIZ_SCR_TABL,X
    118.     STA    ZPAGE_WORD1    ;Setup WORD1 as pointer to
    119.     LDA    LIZ_SCR_TABH,X    ;ON/OFF data.
    120.     STA    ZPAGE_WORD1+1
    121.  
    122. LP_FLOOP
    123.     LDY    #0
    124.     LDA    (ZPAGE_WORD1),Y
    125.     STA    ZPAGE_WORD2
    126.     INY        ;WORD2 is ON x
    127.     LDA    (ZPAGE_WORD1),Y
    128.     STA    ZPAGE_WORD2+1
    129.     ORA    ZPAGE_WORD2
    130.     CMP    #$FF
    131.     BNE    LP_!END
    132.     RTS
    133.  
    134. LP_!END
    135.     CMP16    ZPAGE_WORD2,SCROLL_XOFFSET
    136.     BCS16    LP_FLOOP_NEXT
    137.  
    138.     LDY    #2
    139.     LDA    (ZPAGE_WORD1),Y
    140.     STA    ZPAGE_WORD2
    141.     INY        ;WORD2 is OFF x
    142.     LDA    (ZPAGE_WORD1),Y
    143.     STA    ZPAGE_WORD2+1
    144.  
    145.     CMP16    ZPAGE_WORD2,SCROLL_XOFFSET
    146.     BCC    LP_FLOOP_NEXT
    147.  
    148. ; In range so bring lizard king on.
    149.  
    150.     JSR    RND_A1
    151.     CMP    #251
    152.     BCS    LP_BO_S1
    153.     RTS
    154. LP_BO_S1    JSR    RND_A1
    155.     CMP      #18
    156.     BCC    LP_BO_S2
    157.     RTS
    158. LP_BO_S2
    159.  
    160. ;  Bring lizard king on.
    161.     LDA    #LIZ_ON_TIME
    162.     STA    LIZARD_FLAG
    163.  
    164. ;    Kill all other sprites
    165.  
    166.     LDX    #MAX_FCD_UNITS
    167.     SET16    ZPAGE_WORD1,SPR0
    168.     LDY    #FLAG_OFF+1
    169. LP_LP    LDA    (ZPAGE_WORD1),Y
    170.     ORA    #FCD_DEATH_BIT/256
    171.     STA    (ZPAGE_WORD1),Y
    172.     ADD16_8    ZPAGE_WORD1,FCD_VARS_LEN
    173.     DEX
    174.     BNE    LP_LP
    175.  
    176.     RTS
    177.  
    178.  
    179. LP_FLOOP_NEXT
    180.     ADD16_8 ZPAGE_WORD1,4    ;Move to next
    181.     JMP    LP_FLOOP
    182.  
    183.  
    184. LP_ST_SMOKE
    185.     SET16    ZPAGE_WORD2,FCD_SMOKE
    186.     LDA    #200
    187.     STA    ZPAGE_BYTE1    ;Hit count
    188.     LDA    #ST_NULL
    189.     STA    ZPAGE_BYTE2    ;Sprite type
    190.     JMP    SI_39    ;Start lizard appear smoke
    191.             ;and 'RTS'
    192.  
    193. LIZ_SCR_TABL    DL    LIZ_DUMMY
    194.     DL    LIZ_SCR1
    195.     DL    LIZ_SCR2
    196.     DL    LIZ_DUMMY
    197.     DL    LIZ_DUMMY
    198.     DL    LIZ_SCR5
    199.     DL    LIZ_DUMMY
    200.     DL    LIZ_DUMMY
    201.     DL    LIZ_DUMMY
    202.  
    203. LIZ_SCR_TABH    DH    LIZ_DUMMY
    204.     DH    LIZ_SCR1
    205.     DH    LIZ_SCR2
    206.     DH    LIZ_DUMMY
    207.     DH    LIZ_DUMMY
    208.     DH    LIZ_SCR5
    209.     DH    LIZ_DUMMY
    210.     DH    LIZ_DUMMY
    211.     DH    LIZ_DUMMY
    212.  
    213.  
    214. ; Entrance hall
    215. ; Singe
    216. LIZ_SCR5
    217. LIZ_SCR1    DW    0,980
    218.     DW    $FFFF
    219.  
    220. ; Mines
    221. LIZ_SCR2    DW    0,500
    222.     DW    1400,1500
    223.     DW    $FFFF
    224.  
    225. LIZ_DUMMY    DW    $FFFF
    226.  
    227.  
    228. B39_END
    229.     IF    B39_END>$BFFF
    230.         PRINTF "**** BANK $39 too long !! ****"
    231.     ENDIF
    232.  
    233.  
    234. ; End of bank $39
    235. ; --- -- ---- ---
    236. ;======================================
    237. ; Start of bank $38
    238. ; ----- -- ---- ---
    239.  
    240.     ORG    $138,$8000
    241.  
    242. ;--------------------------------------
    243. ; Include all the BG animation data.
    244. ; ------- --- --- -- --------- -----
    245.  
    246.     INCLUDE "BG_ANIM.SRC"    ;ACB's and DCB's
    247.     INCLUDE "BG_MAP1.SRC"    ;Bg anims map data
    248.  
    249. ;--------------------------------------
    250. ; Table of pointers to palettes.
    251. ; ----- -- -------- -- ---------
    252.  
    253. SPAL_PTR_TAB
    254.     DW    PAL_BLACK    ;0 - Mines (Bright)
    255.     DW    MI_P1    ;1
    256.     DW    MI_P2    ;2
    257.     DW    MI_P3    ;3
    258.     DW    S_PAL_S2    ;4
    259.     DW    PAL_BLACK    ;5 - Mines (Dark)
    260.     DW    MI_P1    ;6
    261.     DW    MI_P2    ;7
    262.     DW    MI_P4    ;8
    263.     DW    S_PAL_S2    ;9
    264.     DW    DIRK_FLASH_PAL    ;10
    265.     DW    PAL_BLACK    ;11 - Elevator
    266.     DW    ELEV_PAL0    ;12
    267.     DW    ELEV_PAL1    ;13
    268.     DW    ELEV_PAL2    ;14
    269.     DW    S_PAL_S6     ;15
    270.     DW    MI_P5    ;16 - 2 entry candle lit mines
    271.     DW    MI_P6    ;17 - 2 entry bright mines
    272.     DW    S_PAL_S2A    ;18 - 1 entry for lizard king
    273.     DW    S_PAL_S2B    ;19 - 1 entry for normal
    274.     DW    PAL_BLACK    ;20 - Grim reaper
    275.     DW    R00_PAL    ;21
    276.     DW    R01_PAL    ;22
    277.     DW    R02_PAL    ;23
    278.     DW    S_PAL_S2    ;24
    279.     DW    FLASH_PAL    ;25 - 4 ent Lighting flash
    280.     DW    PAL_BLACK    ;26 - Drawbridge
    281.     DW    DB_PAL1    ;27
    282.     DW    DB_PAL2    ;28
    283.     DW    DB_PAL3    ;29
    284.     DW    S_PAL_S0    ;30
    285.     DW    PAL_BLACK    ;31 - Name entry,
    286.     DW    AT_PAL1    ;32 - high score table
    287.     DW    AT_PAL2    ;33 - and title screen
    288.     DW    AT_PAL3    ;34
    289.     DW    AT_SPR_PAL    ;35
    290.     DW    G1_PAL0    ;36 - 'Start' glow
    291.     DW    G1_PAL1    ;37
    292.     DW    G1_PAL2    ;38
    293.     DW    G1_PAL3    ;39
    294.     DW    G1_PAL4    ;40
    295.     DW    PAL_BLACK    ;41
    296.     DW    SG_PAL1    ;42 - Singe's Lair
    297.     DW    SG_PAL2    ;43
    298.     DW    SG_PAL3    ;44
    299.     DW    S_PAL_S0    ;45
    300.     DW    SG_PAL4    ;46 - Dragon on
    301.     DW    PAL_BLACK    ;47 - Entrance Hall
    302.     DW    PAL_BLACK    ;48
    303.     DW    EH2_PAL    ;49
    304.     DW    EH2_PAL    ;50
    305.     DW    S_PAL_S2    ;51
    306.     DW    PAL_BLACK    ;52 - Treasury
    307.     DW    T_PAL0    ;53
    308.     DW    T_PAL1    ;54
    309.     DW    T_PAL2    ;55
    310.     DW    S_PAL_S7    ;56
    311.     DW    SG_PAL    ;57 - Singe bits palette
    312.     DW    PAL_BLACK    ;58 - No fade set of palettes
    313.     DW    PAL_BLACK    ;59   for use with mines drak
    314.     DW    PAL_BLACK    ;60   section and grim reaper
    315.     DW    PAL_BLACK    ;61   end.
    316.     DW    S_PAL_S2    ;62
    317.     DW    SG_PAL5    ;63 - Singe 1 ent green
    318.             DW    SG_FLASH    ;64 - Flash Reaper/Singe white
    319.     DW    R03_PAL    ;65 - Reaper 1 ent blue
    320.     DW    PAL_BLACK    ;66 - End screen palettes
    321.     DW    ES_PAL1    ;67
    322.     DW    ES_PAL2    ;68
    323.     DW    ES_PAL3    ;69
    324.     DW    S_PAL_S0    ;70
    325.     DW    S0_SNK    ;71 - Green for snake s0
    326.                 DW    EH3_PAL    ;72 - End screen (Entrance hall)
    327.     DW    EH3_F    ;73 - Flash snake
    328.     DW    EH3_R    ;74 - Restore snake
    329.     DW    PAL_BLACK    ;75 - Entrance hall cameo
    330.     DW    PAL_BLACK     ;76
    331.     DW    CAM_PAL3     ;77
    332.     DW    CAM_PAL3     ;78
    333.     DW    S_PAL_S0    ;79
    334.     DW    PAL_BLACK    ;80 - Mines cameo
    335.     DW    PAL_BLACK     ;81
    336.     DW    MIN_PAL3     ;82
    337.     DW    MIN_PAL3     ;83
    338.     DW    S_PAL_S0    ;84
    339.     DW    PAL_BLACK    ;85
    340.     DW    PAL_BLACK     ;86
    341.     DW    REAP_PAL3     ;87
    342.     DW    REAP_PAL3     ;88
    343.     DW    S_PAL_S0    ;89
    344.     DW    PAL_BLACK    ;90
    345.     DW    PAL_BLACK    ;91
    346.     DW    SING_PAL3    ;92
    347.     DW    SING_PAL3    ;93
    348.     DW    S_PAL_S0    ;94
    349.     DW    PAL_BLACK    ;95
    350.     DW    EH3_R    ;96 - Restore snake
    351.     DW    EH3_R    ;97
    352.     DW    EH3_R    ;98
    353.     DW    S_PAL_S0    ;99
    354.     DW    PAL_BLACK    ;100 - Credit screens
    355.     DW    R00_PAL    ;101
    356.     DW    R01_PAL    ;102
    357.     DW    CS_PAL    ;103
    358.     DW    S_PAL_S2    ;104
    359.  
    360.  
    361. ; BG palettes
    362.  
    363. FLASH_PAL    DB    WHITE3,WHITE2,WHITE1,WHITE0
    364.     DB    WHITE3,WHITE2,WHITE1,WHITE0
    365.     DB    WHITE3,WHITE2,WHITE1,WHITE0
    366.     DB    WHITE3,WHITE2,WHITE1,WHITE0
    367.  
    368.  
    369. PAL_BLACK    DB    BLACK,BLACK,BLACK,BLACK
    370.     DB    BLACK,BLACK,BLACK,BLACK
    371.     DB    BLACK,BLACK,BLACK,BLACK
    372.     DB    BLACK,BLACK,BLACK,BLACK
    373.  
    374. ; Sprite palettes
    375.  
    376. ; Screen 0 - Drawbridge
    377.  
    378. S_PAL_S0    DB    BLACK,WHITE2,WHITE1,WHITE0
    379.     DB    BLACK,ORANGE2,ORANGE3,YELLOW1
    380.     DB    BLACK,WHITE2,YELLOW2,WHITE0
    381. S0_SNK    DB    BLACK,GREEN3,GREEN2,MID_GREEN1
    382.  
    383.  
    384. S_PAL_S2    DB    BLACK,WHITE2,WHITE1,WHITE0
    385.     DB    BLACK,ORANGE2,ORANGE3,YELLOW1
    386.     DB    BLACK,WHITE2,YELLOW2,WHITE0
    387. S_PAL_S2B    DB    BLACK,ORANGE3,ORANGE2,ORANGE1
    388.  
    389.  
    390. ; Screen 6 - Elevator
    391.  
    392. S_PAL_S6    DB    BLACK,WHITE2,WHITE1,WHITE0
    393.     DB    BLACK,ORANGE2,ORANGE3,YELLOW1
    394.     DB    BLACK,WHITE2,YELLOW2,WHITE0
    395.     DB    BLACK,ORANGE3,ORANGE2,ORANGE1
    396.  
    397.  
    398. S_PAL_S7    DB    BLACK,WHITE2,WHITE1,WHITE0
    399.     DB    BLACK,ORANGE2,ORANGE3,YELLOW1
    400.     DB    BLACK,WHITE2,YELLOW2,WHITE0
    401. S_PAL_S2A    DB    BLACK,WHITE2,LT_GREEN1,LT_GREEN2 ;Lizard king palette
    402.  
    403.  
    404. DIRK_FLASH_PAL    DB    BLACK,WHITE2,WHITE1,WHITE0
    405.     DB    BLACK,WHITE2,WHITE2,WHITE2
    406.     DB    BLACK,WHITE2,WHITE2,WHITE2
    407. ;    DB    BLACK,WHITE1,MID_GREEN1,MID_GREEN0
    408.  
    409. SG_FLASH    DB    BLACK,WHITE3,WHITE3,WHITE3
    410.  
    411. ; Attract mode sprite palette
    412.  
    413. AT_SPR_PAL    DB    BLACK,BLUE2,BLUE2,BLUE1
    414.     DB    BLACK,ORANGE2,ORANGE1,ORANGE0
    415.     DB    BLACK,GREEN3,GREEN2,GREEN1
    416.     DB    BLACK,ORANGE3,ORANGE2,ORANGE1
    417.  
    418. ; Sprite palette for Singe's bits
    419.  
    420. SG_PAL    DB    BLACK,WHITE3,PURPLE2,PURPLE1
    421.  
    422. MI_F    DB    BLACK
    423.  
    424. ;======================================
    425.  
    426.  
    427. B38_END
    428.     IF    B38_END>$9FFF
    429.         PRINTF "**** BANK $38 too long !! ****"
    430.     ENDIF
    431.  
    432. ; End of bank $38
    433. ; --- -- ---- ---
    434. ;--------------------------------------
    435. ; Start of bank $37
    436. ; ----- -- ---- ---
    437.  
    438.     ORG    $137,$A000
    439.  
    440. ; Include screen maps
    441. ; ------- ------ ----
    442.  
    443.     INCLUDE "GR_SMAP2.SRC"
    444.  
    445. B37_END
    446.     IF    B37_END>$BFFF
    447.         PRINTF "**** BANK $37 too long !! ****"
    448.     ENDIF
    449.  
    450.  
    451. ; End of bank $37
    452. ; --- -- ---- ---
    453. ;--------------------------------------
    454. ; Start of bank $36
    455. ; ----- -- ---- ---
    456.  
    457.     ORG    $136,$8000
    458.  
    459. ; Include the ZZ_ and BM_ data for SPR_DRAW
    460. ; ------- --- --- --- --- ---- --- --------
    461.  
    462.     INCLUDE "GR_MAP.SRC"  
    463.     INCLUDE "GR_MAP2.SRC"
    464.     INCLUDE "GR_MAP3.SRC"
    465.  
    466.  
    467. ; ZZ_ and BM_ maps for test sprite
    468.  
    469. BM_TEST    DB    %11000000
    470.     DB    %11000000
    471.  
    472. ZZ_TEST    DB    30,30,30,30
    473.  
    474.  
    475.  
    476. B36_END
    477.     IF    B36_END>$9FFF
    478.         PRINTF "**** BANK $36 too long !! ****"
    479.     ENDIF
    480.  
    481.  
    482. ; End of bank $36
    483. ; --- -- ---- ---
    484.  
    485. ;--------------------------------------
    486. ; Start of bank $34+35
    487. ; ----- -- ---- ------
    488.  
    489.     ORG    $134,$8000
    490.  
    491.     INCBIN    "SCRBLK.INC"
    492.  
    493. B35_END
    494.     IF    B35_END>$BFFF
    495.         PRINTF "**** BANK $34+$35 too long !! ****"
    496.     ENDIF
    497.  
    498.  
    499. ; End of bank $34+$35
    500. ; --- -- ---- -------
    501. ;--------------------------------------
    502. ; Start of bank $32
    503. ; ----- -- ---- ---
    504.  
    505.     ORG    $132,$8000
    506.  
    507. ;--------------------------------------
    508.  
    509.     INCBIN  "ATTR.INC"
    510.  
    511. ;--------------------------------------
    512. ; Collapsing floor collision tables.(X,Screen address)
    513. ; ---------- ----- --------- ------  ----------------
    514.  
    515. ;  Screen 0 - Drawbridge
    516.  
    517. SCR0_COLAP_TAB
    518.     DW    104,9024+13
    519.     DW    112,9024+14
    520.     DW    120,9024+15
    521.  
    522.     DW    $FFFF
    523.  
    524.  
    525. ;  Screen 3 - Grim reaper
    526.  
    527. SCR3_COLAP_TAB  
    528.    
    529. ; Gr #1
    530.     DW    88,9024+11
    531.     DW    96,9024+12
    532.     DW    104,9024+13
    533.     DW    136,9024+17
    534.     DW    144,9024+18
    535.     DW    152,9024+19
    536.     DW    184,9024+23
    537.     DW    192,9024+24
    538.     DW    200,9024+25
    539.     DW    232,9024+29
    540.     DW    240,9024+30
    541.     DW    248,9024+31
    542.  
    543. ; Gr #3
    544.     DW    512+152,8896+19
    545.     DW    512+160,8896+20
    546.     DW    512+168,8896+21
    547.  
    548. ; Gr #6
    549.     DW    1280+208,9984+26
    550.     DW    1280+216,9984+27
    551.     DW    1280+224,9984+28
    552.     DW    1280+232,9984+29
    553.  
    554. ; Gr #7
    555.     DW    1536+8,8960+1
    556.     DW    1536+16,8960+2
    557.     DW    1536+24,8960+3
    558.     DW    1536+32,8960+4
    559.     DW    1536+40,8960+5
    560.     DW    1536+72,8960+9
    561.     DW    1536+80,8960+10
    562.     DW    1536+88,8960+11
    563.     DW    1536+120,9024+15
    564.     DW    1536+128,9024+16
    565.  
    566. ; Gr #8
    567.     DW    1792+120,10048+15
    568.     DW    1792+128,10048+16
    569.     DW    1792+136,10048+17
    570.     DW    1792+168,10112+21
    571.     DW    1792+176,10112+22
    572.     DW    1792+184,10112+23
    573.     DW    1792+192,10112+24
    574.     DW    1792+200,10112+25
    575.     DW    1792+232,10112+29
    576.     DW    1792+240,10112+30
    577.  
    578. ; Gr #9
    579.     DW    2048+16,9088+2
    580.     DW    2048+24,9088+3
    581.     DW    2048+32,9088+4
    582.     DW    2048+40,9088+5
    583.     DW    2048+192,9024+24
    584.     DW    2048+200,9024+25
    585.     DW    2048+208,9024+26
    586.     DW    2048+216,9024+27
    587.     DW    2048+248,9024+31
    588.  
    589. ; Gr #10
    590.     DW    2304+0,10048+0
    591.     DW    2304+8,10048+1
    592.     DW    2304+16,10048+2
    593.     DW    2304+48,10048+6
    594.     DW    2304+56,10048+7
    595.     DW    2304+64,10048+8
    596.     DW    2304+72,10048+9
    597.     DW    2304+104,10048+13
    598.     DW    2304+112,10048+14
    599.  
    600. ; Gr #11
    601.     DW    2560+32,9024+4
    602.     DW    2560+40,9024+5
    603.     DW    2560+48,9024+6
    604.     DW    2560+80,9024+10
    605.     DW    2560+88,9024+11
    606.     DW    2560+200,9024+25
    607.     DW    2560+232,9024+29
    608.     DW    2560+240,9024+30
    609.  
    610. ; Gr
    611.  
    612.     DW    $FFFF
    613.  
    614. ;--------------------------------------
    615.  
    616. B32_END
    617.     IF    B32_END>$BFFF
    618.         PRINTF "**** BANK $32 too long !! ****"
    619.     ENDIF
    620.  
    621.  
    622. ; End of bank $32
    623. ; --- -- ---- ---
    624. ;--------------------------------------
    625. ; Start of bank $30/31
    626. ; ----- -- ---- ------
    627.  
    628.     ORG    $130,$8000
    629.  
    630. MUSIC_BASE    INCBIN    "MUSIC.INC"
    631.  
    632. FX_INIT   EQU    MUSIC_BASE+0
    633. FX_TRIGGER1   EQU    MUSIC_BASE+3
    634. FX_PROCESS   EQU    MUSIC_BASE+6
    635. MUSIC_TRIGGER   EQU    MUSIC_BASE+9
    636. MUSIC_PROCESS   EQU    MUSIC_BASE+12
    637.  
    638.  
    639.  
    640. B30_END
    641.     IF    B30_END>$BFFF
    642.         PRINTF "**** BANK $30 too long !! ****"
    643.     ENDIF
    644.  
    645.  
    646. ; End of bank $30/$31
    647. ; --- -- ---- -------
    648. ;======================================
    649.     IF    EPROM=99
    650.     SEND COMPUTER1
    651.     ENDIF
    652.     IF    EPROM=98
    653.     SEND MSDOS,"C:\PDSMAST\DLAIRFCS\EPROM\DL.PDS"
    654.                  ENDIF
    655.  
    656. ; -------------------------------------------------------------
    657. ; Print memory usage messages
    658. ; ----- ------ ----- --------
    659.  
    660.     PRINTF "Bank $3F has %d bytes free",$FFFF-B3F_END
    661.     PRINTF "Bank $3C/D has %d bytes free",$C000-B3D_END
    662.     PRINTF "Bank $3A/B has %d bytes free",$C000-B3B_END
    663.     PRINTF "Bank $39 has %d bytes free",$C000-B39_END
    664.     PRINTF "Bank $38 has %d bytes free",$A000-B38_END
    665.     PRINTF "Bank $37 has %d bytes free",$C000-B37_END
    666.     PRINTF "Bank $36 has %d bytes free",$A000-B36_END
    667.     PRINTF "Bank $34 has %d bytes free",$C000-B35_END
    668.     PRINTF "Bank $32/3 has %d bytes free",$C000-B32_END
    669.     PRINTF "Bank $30/1 has %d bytes free",$C000-B30_END
    670.  
    671.     END
    672.  
    673.  
    674. ; End of file: DLAIR.ASM
    675. ; --- -- ----  ---------
    676.  
    677. ize
    678.     LDA    #2
    679.     STA    ZPAGE_BYTE2        ;Ysize
    680.     JSR    DRAW_CHR_BLOCK    ;Draw disc
    681.  
    682.     SET16    ZPAGE_WORD1,ATTRWALL0
    683.     JSR    SI_SET_ATTR    ;Set screen attributes
    684.     JSR    SET_PA    ;Reset panel attributes
    685.  
    686.     JSR    SET_S0    ;Set to screen 0
    687.  
    688.     LDA    #104
    689.     STA    DIRK_X
    690.     LDA    #167
    691.     STA    DIRK_Y
    692.  
    693.     LDX    #0  
    694.     STX    ELEV_CNT    ;Brick scroll position
    695.  
    696.     LDY    #1
    697.     JMP    INIT_SCR_END
    698.  
    699.  
    700. ;   1a) Normal screen
    701.  
    702. INIT_STATIC
    703.     INY
    704.     LDA    (ZPAGE_WORD10),Y    ;Screen number
    705.     JSR    DRAW_SCREEN    ;Draw normal screen
    706.  
    707.     LDY    #2
    708.     LDA    (ZPAGE_WORD10),Y
    709.     STA    ZPAGE_WORD1    ;Setup WORD1 as pointer
    710.     INY        ;to attribute map
    711.     LDA    (ZPAGE_WORD10),Y
    712.     STA    ZPAGE_WORD1+1
    713.     JSR    SI_SET_ATTR    ;Draw screen attributes
    714.  
    715.     JSR    SET_S0    ;Set to screen 0
    716.  
    717.     LDY    #4
    718.     LDA    (ZPAGE_WORD10),Y
    719.     STA    DIRK_Y
    720.  
    721.     LDA    #12
    722.     STA    DIRK_X
    723.  
    724.     LDY    #5
    725.     JMP    INIT_SCR_END
    726.  
    727. ;   1b) Draw scrolling screen
    728.  
    729. INIT_SCROLLING
    730.  
    731. ; Setup screen height and Y offset to top of strip
    732.  
    733.     LDX    SCR_NUM
    734.     LDA    IS_SCR_YS,X
    735.     STA    SCROLL_YS
    736.     LDA    IS_SCR_YOFF,X
    737.     STA    SCROLL_YOFF
    738.  
    739. ; Find correct reset point and setup parms for Dirk start pos and screen
    740. ; draw.
    741.     INY
    742.     LDA    (ZPAGE_WORD10),Y
    743.     STA    ZPAGE_WORD1
    744.     INY        ;Setup WORD1 pointing
    745.     LDA    (ZPAGE_WORD10),Y    ;at reset point
    746.     STA    ZPAGE_WORD1+1    ;table
    747.  
    748.     LDY    #0
    749. SI_FPOS_LOOP
    750.     LDA    (ZPAGE_WORD1),Y
    751.     STA    ZPAGE_WORD2
    752.     INY        ;WORD2 is reset X
    753.     LDA    (ZPAGE_WORD1),Y
    754.     STA    ZPAGE_WORD2+1
    755.     CMP16    DIRK_X_DIE,ZPAGE_WORD2    ;Compare against how far Dirk
    756.             ;got last go.
    757.     BCC    SI_POS_FOUND    ;Exit if reset X is greater
    758.     TYA
    759.     CLC
    760.     ADC    #9-1    ;Move to next entry
    761.     TAY
    762.     JMP    SI_FPOS_LOOP
    763. SI_POS_FOUND
    764.     TYA
    765.     SEC
    766.     SBC    #9+1    ;Move back to last entry
    767.     TAY
    768.     LDA    (ZPAGE_WORD1),Y
    769.     STA    SCROLL_XOFFSET
    770.     INY        ;Setup Dirk's X position
    771.     LDA    (ZPAGE_WORD1),Y
    772.     STA    SCROLL_XOFFSET+1
    773.     L</div>
    774.  
    775. moremore:
    776.  
    777. [CODE=ASM]    DL    0
    778.     ENDIF
    779.  
    780.     DL    0    ;4-
    781.  
    782.     IF    SINGE
    783.     DL    S5_TP_TAB    ;5 - Singe
    784.     ELSE
    785.     DL    0
    786.     ENDIF
    787.  
    788.     DL    S6_TP_TAB    ;6 - Elevator
    789.     DL    S7_TP_TAB    ;7 - Treasury
    790.  
    791. SCR_TPTR_TABH    DH    S0_TP_TAB    ;0 - Drawbridge
    792.  
    793.     IF    HALL
    794.     DH    S1_TP_TAB    ;1 - Entrance hall
    795.     ELSE
    796.     DH    0
    797.     ENDIF
    798.  
    799.     IF    MINES
    800.     DH    S2_TP_TAB    ;2 - Mines
    801.     ELSE
    802.     DH    0
    803.     ENDIF
    804.  
    805.     IF    REAPER
    806.     DH    S3_TP_TAB    ;3 - Grim reaper
    807.     ELSE
    808.     DH    0
    809.     ENDIF
    810.  
    811.     DH    0    ;4-
    812.  
    813.     IF    SINGE
    814.     DH    S5_TP_TAB    ;5 - Singe
    815.     ELSE
    816.     DH    0
    817.     ENDIF
    818.  
    819.     DH    S6_TP_TAB    ;6 - Elevator
    820.     DH    S7_TP_TAB    ;7 - Treasury
    821.  
    822.  
    823. ;--------------------------------------
    824. ; Include graphics source files
    825. ; ------- -------- ------ -----
    826.  
    827.     INCLUDE "GR_SMAP1.SRC"
    828.  
    829. ;--------------------------------------
    830. ; Sprite Collision boxes
    831. ; ------ --------- -----
    832.  
    833. ; Table of pointers to collision boxes
    834.  
    835. SDC_COL_PTRS_L    DL    SCOL_0
    836.     DL    SCOL_1
    837.     DL    SCOL_2
    838.     DL    SCOL_3
    839.     DL    SCOL_4
    840.     DL    SCOL_5
    841.     DL    SCOL_6
    842.     DL    SCOL_7
    843.     DL    SCOL_8
    844.     DL    SCOL_9
    845.     DL    SCOL_10
    846.     DL    SCOL_11
    847.     DL    SCOL_12
    848.     DL    SCOL_13
    849.     DL    SCOL_14
    850.     DL    SCOL_15
    851.     DL    SCOL_16
    852.     DL    SCOL_17
    853.     DL    SCOL_18
    854.     DL    SCOL_19
    855.     DL    SCOL_20
    856.     DL    SCOL_21
    857.     DL    SCOL_22
    858.     DL    SCOL_23
    859.     DL    SCOL_24
    860.     DL    SCOL_25
    861.     DL    SCOL_26
    862.     DL    SCOL_27
    863.     DL    SCOL_25 ;28
    864.     DL    SCOL_26 ;29
    865.     DL    SCOL_27 ;30
    866.     DL    SCOL_31
    867.     DL    SCOL_32
    868.     DL    SCOL_33
    869.     DL    SCOL_34
    870.     DL    SCOL_35
    871.     DL    SCOL_36
    872.     DL    SCOL_37
    873.     DL    SCOL_38
    874.     DL    SCOL_39
    875.     DL    SCOL_40
    876.     DL    SCOL_41
    877.     DL    SCOL_42
    878.     DL    SCOL_43
    879.     DL    SCOL_44
    880.     DL    SCOL_45
    881.     DL    SCOL_46
    882.     DL    SCOL_47
    883.  
    884. SDC_COL_PTRS_H    DH    SCOL_0
    885.     DH    SCOL_1
    886.     DH    SCOL_2
    887.     DH    SCOL_3
    888.     DH    SCOL_4
    889.     DH    SCOL_5
    890.     DH    SCOL_6
    891.     DH    SCOL_7
    892.     DH    SCOL_8
    893.     DH    SCOL_9
    894.     DH    SCOL_10
    895.     DH    SCOL_11
    896.     DH    SCOL_12
    897.     DH    SCOL_13
    898.     DH    SCOL_14
    899.     DH    SCOL_15
    900.     DH    SCOL
    yeah bro more!!

    Code (ASM):
    1. DA    SCR_NUM
    2.     CMP    #6
    3.     BNE    SF_NOT_6  
    4.  
    5. ; Screen 6 (Elevator)
    6.  
    7.     LDA    DIRK_FLAG
    8.     AND    #FCD_SEC_BIT    ;Only check for exit if on
    9.     BEQ    SF_NOT_6    ;platform, else do normal bump
    10.             ;into sides.
    11.  
    12.     LDA    DIRK_X    ;Test if walked off left
    13.     CMP    #L_EDGE    ;or right edge of elevator
    14.     BCC    SF_OFF_ELEV
    15.     CMP    #R_EDGE
    16.     BCS    SF_OFF_ELEV
    17.  
    18.     RTS
    19.  
    20.  
    21. ; Walked off edge
    22.  
    23. SF_OFF_ELEV
    24.     LDX    SCR_NUM_OLD    ;Start correct screen
    25.     LDA    SF_ETABL,X
    26.     STA    ZPAGE_WORD1
    27.     LDA    SF_ETABH,X    ;Setup W1 as pointer to
    28.     STA    ZPAGE_WORD1+1    ;exit list
    29.  
    30.     LDY    ELEV_ENUM    ;Number of exit from elevator
    31.     LDA    (ZPAGE_WORD1),Y    ;Screen to go to
    32.     CMP    #7    ;If new screen is treasury
    33.     BEQ    !1    ;don't update SCR_NUM_OLD so
    34.     CMP    #8
    35.     BEQ    !1
    36.     STA    SCR_NUM_OLD    ;It's the same elev next time
    37. !1    STA    SCR_NUM
    38.     JMP    SCR_E_END
    39.  
    40.  
    41. SF_ETABL    DL    SF_EL0
    42.     DL    SF_EL1
    43.     DL    SF_EL2
    44.     DL    SF_EL3
    45.     DL    SF_EL4
    46.     DL    SF_EL5
    47.     DL    SF_EL6
    48.     DL    SF_EL7
    49.  
    50.  
    51. SF_ETABH    DH    SF_EL0
    52.     DH    SF_EL1
    53.     DH    SF_EL2
    54.     DH    SF_EL3
    55.     DH    SF_EL4
    56.     DH    SF_EL5
    57.     DH    SF_EL6
    58.     DH    SF_EL7
    59.  
    60.  
    61. SF_EL0            ;Drawbridge
    62.  
    63. SF_EL1    DB    1,2,0,7    ;Entrance hall
    64.          
    65. SF_EL2    DB    1,2,3,7    ;Mines
    66.  
    67. SF_EL3    DB    5,2,3,7    ;Grim reaper
    68.  
    69. SF_EL4            ;Not implemented
    70.  
    71. SF_EL5            ;Singe
    72.  
    73. SF_EL6            ;Elevator
    74.  
    75. SF_EL7            ;Treasury
    76.  
    77.  
    78. SF_NOT_6
    79.  
    80. ; Stop exit off left of screen
    81.  
    82.     LDA    DIRK_X_ONSCR
    83.     CMP    #L_EDGE
    84.     BCS    SF_LOK
    85.  
    86.     LDA    SCR_NUM    ;Dirk exits on the left
    87.     CMP    #7    ;in the treasury
    88.     BNE    !1
    89.     LDA    END_LEVEL_FLAG    ;Exit from treasury
    90.     BNE    SF_LEVEL_END
    91. !1
    92.     LDA    #L_EDGE+4    ;Put Dirk at left
    93.     JSR    SF_CEP
    94.  
    95. SF_LOK
    96.  
    97. SF_SCROLL
    98.     LDA    SCROLL_FLAG      ;Is it a scrolling section
    99.     BEQ    SF_NOT_SCROLL
    100.  
    101.     LDA    SCROLL_XOFFSET+1    ;Test if finished scrolling
    102.     CMP    SCROLL_LENGTH+1    ;(16 bit compare)
    103.     BCC    SF_END
    104.     BNE    !1
    105.     LDA    SCROLL_XOFFSET
    106.     CMP    SCROLL_LENGTH
    107.     BCC    SF_END
    108.  
    109.  
    110. ; Scroll h
    and finally

    Code (ASM):
    1.     DH    BG_COL_S2    ;Scr 2 - Mines
    2.     DH    BG_COL_S3    ;Scr 3 - Grim reaper
    3.     DH    0    ;Scr 4 -
    4.     DH    BG_COL_S5    ;Scr 5 - Singe
    5.     DH    BG_COL_S6    ;Scr 6 - Elevator
    6.     DH    BG_COL_S7    ;Scr 7 - Treasury
    7.     DH    BG_COL_S8    ;Scr 8 - Dungeon
    8.  
    9.  
    10. ; Bonus collision data
    11. ; ----- --------- ----
    12.  
    13. BONUS_TABL    DL    BTAB_S0
    14.     DL    BTAB_S1
    15.     DL    BTAB_S2
    16.     DL    BTAB_S3
    17.     DL    0
    18.     DL    BTAB_S5
    19.     DL    BTAB_S6
    20.     DL    BTAB_S7
    21.     DL    BTAB_S8
    22.  
    23. BONUS_TABH    DH    BTAB_S0
    24.     DH    BTAB_S1
    25.     DH    BTAB_S2
    26.     DH    BTAB_S3
    27.     DH    0
    28.     DH    BTAB_S5
    29.     DH    BTAB_S6
    30.     DH    BTAB_S7
    31.     DH    BTAB_S8
    32.  
    33.     INCLUDE "BG_COL.SRC"    ;Background
    Probably the most interesting part is this:

    Code (ASM):
    1.     IF  EPROM=99
    2.     SEND COMPUTER1
    3.     ENDIF
    4.     IF  EPROM=98
    5.     SEND MSDOS,"C:\PDSMAST\DLAIRFCS\EPROM\DL.PDS"
    6.                 ENDIF
    PDSMAST seems to be a very obscure DOS program that archives/backs up code from a master tape. As you can see, the game (even though it's the Japanese revision) still compiles with DOS. Yet the backup directory is DLAIRFCS meaning it's for the FAMICOM SYSTEM.

    Nifty, I hope Nintendo still has these backups somewhere...
     
  6. SegaLoco

    SegaLoco

    W)(at did you say? Banned
    Oh, god, ahahahaha, there is another upside to official code left in stuff, you get to see how lovely programmers were. How does this stuff find it's way into roms in the first place, do they accidentally incbin instead of include or something stupid like that?
     
  7. Glisp

    Glisp

    That one weird guy that does stuff. Member
    1,278
    1
    16
    Bloomington, IN
    None at the moment I'm afraid.
    In the Dinosaur Hunting Sim series, Carnivores the Carnivores 2 and Ice Age Source code have left overs from the Carnivores 1 source code. Unfortunately, I don't have the source code and even if I did I wouldn't be able to share it due to an agreement with the developers not to redistribute it. However, I do know that they exist because I'm friends with a couple of dudes who are creating a mod with the source code.

    Of course this is because the game engine was based off the Carnivores 1 game engine so its no surprise really.
     
  8. Chilly Willy

    Chilly Willy

    Tech Member
    751
    11
    18
    Doom 32X
    More likely they assembled the program, then dumped a section of memory to disk to make the binary, not realizing (or not caring) that the memory also had bits of code in it as well as the assembled code.
     
  9. evilhamwizard

    evilhamwizard

    Researcher
    1,392
    455
    63
    Besides the usual pirate, here's one more NES game that caught my eye. Nothing substantial but it's one of a Japanese game. No it's not Air Fortress, but it's a game called Puss n Boots. This snippet is only in the US version AFAIK and I can't find a EU version. The Japanese version doesn't have anything.

    The comments are in Japanese too - neato. :)

    Code (ASM):
    1.     JSR    STEKA
    2.     LDA    #0
    3.     STA    NWK
    4.     JSR    RANDOM
    5.     AND    #11B
    6.     BNE    :NOTAI    ; 3/4 not taikyaku
    7.     LDA    #1    ; Taikyaku bit on (icchokusen ni mukau)
    8. :NOTAI:
    9.     ORA    TEKSTS,X
    10.     BNE    :JPCUT
    11.  
    12. STSHIP:
    13. SMOGU:
    14.     JSR    STTEKY
    15.     JSR    X0orFF
    16.     JSR    RN3F20    ; 20H..60H
    17.     STA    TEKTIM,X
    18.     JMP    :CNT3
    19.  
    20. SHCATA:
    21. SHCATC:
    22.     JSR    STTEKY
    23.     LDA    #0FFH
    24.     STA    TEKXH,X
    25.     RTS
    26.  
    27.  
    28. STPLANE:
    29. STBALOON:
    30. STSENSUI:
    31.     JSR    STTEKY
    32.     JSR    X0orFF
    33.     ASL    TEKANG,X
    34.     ASL    TEKANG,X; 0 or 4
    35. :CNT3:
    36.     LDA    #3-1
    37.     STA    TEKHIT,X; 3 patsu de shinu !
    38.     RTS
    39.  
    40. SHAMB:
    41. SUP1:
    42. SBOOTS:
    43. SD1000:
    44. SD2000:
    45. SD3000:
    46.     PROC
    47.     JSR    STTEKY
    48.     LDA    #0FFH
    49.     STA    TEKXH,X
    50.     LDA    TEKKND,X
    51.     SEC
    52.     SBC    #28
    53.     TAY        ; Y=0..5
    54.     LDA    :BOONO,Y
    55.     STA    TEKPNO,X; Pattern number set
    56.     LDA    #0
    57.     STA    TEKCTL,X; Control & color set
    58.     RTS
    59. :BOONO:
    60.     DB    19,11,16,18,18,18
    61.  
    62. RN3F20:
    63.     JSR    RANDOM
    64.     AND    #3FH
    65.     ADC    #20H
    66.     RTS
    67.  
    68. ;@@@@@@@@ KOKOKARAHAJIME 04/27 @@@@@@@@@
    69. ; 89/04/27 Tsuika
    70. STARU:    ;40: Taru
    71. SSHA:    ;41: Sharin
    72. SUMA:    ;43: Uma !
    But alas, it's just a small fragment.
     
  10. Puto

    Puto

    Shin'ichi Kudō, detective. Tech Member
    2,013
    0
    16
    Portugal, Oeiras
    Part of Team Megamix, but haven't done any actual work in ages.
    Comments in rômaji? o_O
     
  11. SegaLoco

    SegaLoco

    W)(at did you say? Banned
    @ChillyWilly: was there no equiv to /dev/zero on DOS nor an align macro in their assembler, or were they just lazy. =P (Sorry for no quote, on PSP)
     
  12. Overlord

    Overlord

    Now playable in Smash Bros Ultimate Moderator
    19,271
    987
    93
    Long-term happiness
    Probably they were working on systems that only had ANSI or something.
     
  13. Chilly Willy

    Chilly Willy

    Tech Member
    751
    11
    18
    Doom 32X
    I'm not aware of anything similar to /dev/zero on DOS, and assemblers vary considerably. Some assemblers had "align", some required you to make a macro for it, and other had other facilities for alignment, like the "even" directive. Even when you had "align", some assemblers use the argument directly while others use the argument as a power of 2.
     
  14. I believe a few Satellaview ROM dumps have examples of these, but I can't read it all that well. Hrm.
     
  15. SegaLoco

    SegaLoco

    W)(at did you say? Banned
    I'm just saying, you said they probably dumped memory to write the ROM to the right size, why not just zero or nop it out =P.
     
  16. Chilly Willy

    Chilly Willy

    Tech Member
    751
    11
    18
    Doom 32X
    If they are so lazy they just dump memory to get the binary, what makes you think they'd bother to clear the parts that aren't part of the actual binary? :specialed:
    :)
     
  17. SegaLoco

    SegaLoco

    W)(at did you say? Banned
    Ah, okay =B
     
  18. evilhamwizard

    evilhamwizard

    Researcher
    1,392
    455
    63
    Yay, if it weren't for SegaSaturno yesterday this topic would've been dead yet.

    Yesterday SegaSaturno released yet another unreleased 32X game ~ the abandoned 32X port of SoulStar X from the Sega CD. There are TONS of code fragments, DOS files (I think the actual editor for the source code is partially in the rom), a bat file for compiling, as well as other unknown stuff (a symbol list maybe?). I need your help with this one, because there's A LOT. I'm only going through the stuff that's formatted. There are tons of other strings in the prototype as well.

    For reference, you can download the prototype here.

    Let's begin!

    Code (ASM):
    1. ;    PWM Sample Program
    2. ;                    SH2 Master Main
    3. ;
    4. ;    Copyright SEGA ENTERPRISES,LTD. 1994
    5. ;---------------------------------------------------------------*
    6. ;****************************************************************
    7.    
    8.     cnop    0,4
    9.  
    10. ******************************************
    11. * Initialize the PWM interupt and driver *
    12. ******************************************
    13.  
    14. initPWM
    15.     move    #$20004030,r2
    16.     move    #1047,r0            ;1047 set cycle register (22Khz)
    17.     move.w    r0,(2,r2)
    18.  
    19.     move    #$0305,r0            ;105 set control register
    20.     move.w    r0,(r2)
    21.  
    22.     move    #$20004030,r2                    ;fill mono fifo
    23.     move    #1,r0
    24.     move.w    r0,(8,r2)
    25.     move.w    r0,(8,r2)
    26.     move.w    r0,(8,r2)
    27.  
    28.     rts
    29.     nop
    30.  
    31.     cnop    0,4
    32.  
    33.     lits
    34.  
    35.     cnop    0,4
    36.  
    37. ************************************************
    38. * Play an 8 bit sample throught the PWM ciruit *
    39. ************************************************
    40. ; input
    41. ;    R1 = Address of sample
    42. ;    R2 = length of sample
    43. ;    R3 = channel number
    44. ;    R4 = step value
    45.  
    46. PlayPWM
    47.     move    #comport1,r0
    48.     move.w    (r0)+,r1        ;get sfx number
    49.     move.w    (r0)+,r4        ;get step rate
    50.     move.w    (r0)+,r2        ;get volume
    51.  
    52.     move    #sample_table,r0
    53.     shll2    r1
    54.     shll    r1
    55.     add    r1,r0
    56.     move    (r0)+,r2        ;get length
    57.     move    (r0)+,r1        ;get address
    58.  
    59.     move    #sfx_chan,r5        ;get channel to play
    60.     move    (r5),r0
    61.     add    #1,r0
    62.     and    #3,r0
    63.     move    r0,(r5)
    64.     move    r0,r3
    65.  
    66.     move    r2,r0
    67.     shll8    r0
    68.     move    #pwmstructs+TH,r2
    69.     shll2    r3
    70.     shll2    r3
    71.     add    r3,r2
    72.     move    r0,(r2)            ;store sample length (bytes)
    73.  
    74.     cmpeq    #0,r0
    75.     bt    .done_pwm
    76.  
    77.     move    r4,(PWMSTEP,r2)        ;store step rate
    78.     shll8    r1
    79.     move    r1,(PWMADDR,r2)        ;store sample address
    80.  
    81. .done_pwm
    82.     rts
    83.     nop
    84.  
    85.     cnop    0,4
    86.  
    87. sfx_chan dc.l    0
    88.  
    89.     lits
    90.  
    91. *************************
    92. * PWM interrupt handler *
    93. *************************
    94.  
    95.     cnop    0,4
    96. spwm_irq
    97.     push    r0
    98.     push    r1
    99.     push    r2
    100.     push    r3
    101.     push    r4
    102.     push    r5
    103.     push    r6
    104.  
    105.     move    #$20004038,r2
    106.     move.b    (r2),r0            ;is pwm fifo full?
    107.     tst    #$80,r0
    108.     bf    .exit
    109.  
    110.     push    pr
    111.     bsr    process_pwm
    112.     nop
    113.     pop    pr
    114. .exit
    115.     move    #_FRT,r1              ;tweak FRT
    116.     move.b    (_TOCR,r1),r0
    117.     xor    #$02,r0
    118.     move.b    r0,(_TOCR,r1)
    119.  
    120.     move    #$2000401C,r2        ;clear irq
    121.     move.w    r0,(r2)
    122.     move.w    (r2),r0
    123.  
    124.     pop    r6
    125.     pop    r5
    126.     pop    r4
    127.     pop    r3
    128.     pop    r2
    129.     pop    r1
    130.     pop    r0
    131.  
    132.     rts
    133.     nop
    134.    
    135.     LITS
    136.  
    137.     cnop    0,4
    138.  
    139. NUMCHANNELS   equ    4
    140. PWMSIZE       equ    4    ; number of elemts in the PWM structure
    141.  
    142. PWMADDR       equ    4
    143. PWMSTEP       equ    8
    144.  
    145. *****************
    146. * Fill PWM FIFO *
    147. *****************
    148.  
    149. process_pwm
    150.     move    #$20004038,r2
    151. .loop
    152.     move    #pwmstructs+TH,r3
    153.     move    #NUMCHANNELS,r4
    154.     move    #0,r5
    155.  
    156. .channelloop
    157.     move    (r3),r0                ;is channel on?
    158.     cmppz    r0
    159.     bf/s    .skip
    160.     move.w    #$80,r1                ;if channel off, use $7f (flat)
    161.  
    162.     move    (PWMSTEP,r3),r6
    163.     sub    r6,r0
    164.     move    r0,(r3)
    165.  
    166.     move    (PWMADDR,r3),r0            ;get the next pcm byte
    167.     move    r0,r1
    168.     add    r6,r0
    169.     move    r0,(PWMADDR,r3)
    170.     shlr8    r1
    171.     move    #samp_base,r0
    172.     move.b    (r0,r1),r1
    173.     extu.b    r1,r1
    174. .skip
    175.     add    #PWMSIZE*4,r3
    176.  
    177.     add    #1,r1               ;make sure it's not 0
    178.     add    r1,r5
    179.  
    180.     dt    r4
    181.     bf    .channelloop
    182.  
    183.     move.w    r5,(r2)                ;store into mono width
    184.  
    185.     move.b    (r2),r0                ;is pwm fifo full?
    186.     tst    #$80,r0
    187.     bt    .loop
    188.  
    189.     rts
    190.     nop
    191.  
    192.     LITS
    193.  
    194. pwmstructrotate_player_sprite
    More!

    Code (ASM):
    1. * rotate sprite routine *
    2. *************************
    3.  
    4.    cnop   0,4
    5.  
    6. rotate_player
    7.    move   #comport1,r0       ;get level
    8.    move.w   (r0)+,r1
    9.    move.w   (r0)+,r2
    10.    move.w   (r0)+,r3
    11.  
    12.    move.w   (r0)+,r4
    13.    shll2   r4
    14.    move   #frame_table,r0
    15.    move   (r0,r4),r4
    16.  
    17. * R1 = xpos
    18. * R2 = ypos
    19. * R3 = angle
    20. * R4 = ptr to source data
    21.  
    22. rot_spr
    23.    move   #divider_unit,r14
    24.  
    25.    push   r1   ;xpos
    26.    push   r2   ;ypos
    27.  
    28.    shll   r3
    29.    move   #sintab,r0
    30.    move.w   (r0,r3),r13       ;sine (Dy)
    31.    move   #costab,r0
    32.    move.w   (r0,r3),r12       ;cosine (Dx)
    33.  
    34.    move.w   (r4)+,r8       ;xsize
    35.    move.w   (r4)+,r9       ;ysize
    36.  
    37.    move   r12,r10       ;xadd
    38.    move   r13,r11       ;yadd
    39.    add   r10,r10
    40.    add   r11,r11
    41.  
    42.    move   #rline_buf,r0       ;offset table
    43.    move   #0,r1           ;dstX
    44.    move   #0,r2           ;dstY
    45.  
    46.    move   #320,r3
    47.  
    48.    move   r8,r7
    49. .loop
    50.    swap.w   r2,r14           ;Yint * 320
    51.    exts.w   r14,r14
    52.    dmuls   r3,r14
    53.    swap.w   r1,r5
    54.    exts.w   r5,r5
    55.    move   macl,r14
    56.    add   r5,r14           ;+ Xint
    57.    move.w   r14,(r0)       ;store xy pos
    58.    add   #2,r0
    59.  
    60.    add   r10,r1
    61.    add   r11,r2
    62.  
    63.    dt   r7
    64.    bf   .loop
    65.  
    66.    pop   r2
    67.    pop   r1
    68.  
    69.    shll16   r1
    70.    shll16   r2
    71.  
    72.    move   r4,r0
    73.    add   #4,r0
    74. .yloop
    75.    move   #overwrite,r3
    76.    move   r1,r5
    77.    shlr16   r5
    78.    exts.w   r5,r5
    79.    add   r5,r3
    80.    move   r2,r5
    81.    shlr16   r5
    82.    exts.w   r5,r5
    83.    move   #320,r4
    84.    dmuls   r4,r5
    85.    move   macl,r5
    86.    add   r5,r3
    87.  
    88.    move   r8,r5
    89.  
    90.    move   #rline_buf,r7
    91. .oloop
    92.    move.w   (r7)+,r6       ;get screen offset
    93.    add   r3,r6           ;add screen base addr
    94.    move.b   (r0)+,r4
    95.    dt   r5           ;R7 = line length
    96.  
    97.    move.b   r4,(r6)           ;store pixel
    98.    add   #1,r6
    99.  
    100.    bf/s   .oloop
    101.    move.b   r4,(r6)           ;store pixel
    102.  
    103.    sub   r11,r1
    104.    add   r10,r2
    105.  
    106.    dt   r9
    107.    bf   .yloop
    108.  
    109.    rts
    110.    nop
    111.  
    112.    lits
    113.  
    114.    cnop   0,4
    115.  
    116. rline_buf   ds.w   128*2
    117.  
    118. ;;rotate_player
    119. ;;   move   #comport1,r0       ;get level
    120. ;;   move.w   (r0)+,r1
    121. ;;   move.w   (r0)+,r2
    122. ;;   move.w   (r0)+,r3
    123. ;;   move.w   (r0)+,r4
    124. ;;
    125. ;;   move   #sp_pl_ship00,r4
    126. ;;
    127. ;;* R1 = xpos
    128. ;;* R2 = ypos
    129. ;;* R3 = angle
    130. ;;* R4 = ptr to source data
    131. ;;
    132. ;;   cnop   0,4
    133. ;;
    134. ;;rot_spr
    135. ;;   move   #divider_unit,r14
    136. ;;
    137. ;;   push   r1   ;xpos
    138. ;;   push   r2   ;ypos
    139. ;;
    140. ;;   shll   r3
    141. ;;   move   #sintab,r0
    142. ;;   move.w   (r0,r3),r13       ;sine (Dy)
    143. ;;   move   #costab,r0
    144. ;;   move.w   (r0,r3),r12       ;cosine (Dx)
    145. ;;
    146. ;;   move.w   (r4)+,r7       ;get line length
    147. ;;   dmuls   r12,r7
    148. ;;   move   r7,r9
    149. ;;   move   macl,r7
    150. ;;   add   r7,r7
    151. ;;   shlr16   r7
    152. ;;   exts.w   r7,r7
    153. ;;
    154. ;;   move   r9,r1       ;get line y height
    155. ;;   dmuls   r13,r1
    156. ;;   move   macl,r1
    157. ;;   add   r1,r1
    158. ;;   shlr16   r1
    159. ;;   exts.w   r1,r1
    160. ;;
    161. ;;   shll16   r9           ;calc line source x add
    162. ;;   divs   r7,r9           ;r9 = x adder,r7 = line length
    163. ;;
    164. ;;   move   r13,r6       ;get x adder for draw loop
    165. ;;   shll2   r6
    166. ;;
    167. ;;   move.w   (r4)+,r8       ;get sprite height
    168. ;;   dmuls   r12,r8
    169. ;;   move   r8,r10
    170. ;;   move   macl,r8
    171. ;;   add   r8,r8
    172. ;;   shlr16   r8
    173. ;;   exts.w   r8,r8
    174. ;;
    175. ;;   shll16   r10
    176. ;;   divs   r0,r10           ;r10 = y adder,r8 = height
    177. ;;
    178. ;;   push   r7   ;
    179. ;;   push   r8   ;
    180. ;;   push   r10   ;
    181. ;;
    182. ;;   move   #320,r10   ;address yadd
    183. ;;   cmppz   r1
    184. ;;   bt   .1
    185. ;;   neg   r10,r10
    186. ;;   neg   r1,r1
    187. ;;.1
    188. ;;   move   r1,r0
    189. ;;   cmpeq   #0,r0
    190. ;;   bt   .2
    191. ;;
    192. ;;   shll16   r1
    193. ;;   divs   r8,r1
    194. ;;   shll16   r1   ;yadder
    195. ;;.2
    196. ;;   move   r1,r2   ;yfraction
    197. ;;   shar   r2   ;yfraction/2
    198. ;;
    199. ;;   move   #rline_buf,r0       ;offset table
    200. ;;   move   #0,r8           ;sourceX********************************
    201. * 32X Initial 68K Header Code. *
    202. ********************************
    203.  
    204.    opt   l.
    205.  
    206. cramw       equ   &#036;C0000000
    207. icramw   macro
    208. .val   =   ((&#092;1)&gt;&gt;14)
    209. .vala   =   ((&#092;1)&lt;&lt;16)&amp;111111111111110000000000000000
    210. .val   =   cramw&#33;.val&#33;.vala
    211.    move.l   #.val,(a6)
    212.    endm
    213.  
    214.    include   debug.inc
    215.  
    216. l_type       equ   1   0=eur,1=jap,2=USA
    217.  
    218. eur   =   0
    219. jap   =   1
    220. usa   =   0
    221.  
    222. marsipl       equ   &#036;880000
    223.  
    224. acomm0       equ   &#036;20       *        * Communcation Reg.
    225. acomm2       equ   &#036;22       *        * Communcation Reg.
    226. acomm4       equ   &#036;24       *        * Communcation Reg.
    227. acomm6       equ   &#036;26       *        * Communcation Reg.
    228. acomm8       equ   &#036;28       *        * Communcation Reg.
    229. acomm9       equ   &#036;29       *        * Communcation Reg.
    230. acomm10       equ   &#036;2a       *        * Communcation Reg.
    231. acomm12       equ   &#036;2c       *        * Communcation Reg.
    232. acomm14       equ   &#036;2e       *        * Communcation Reg.
    233.  
    234. vectors       group
    235. header       group
    236. code68k       group  
    237. ramcode68k   group
    238. ramcodesh2   group
    239.  
    240.    xref   master_start,slave_start,master_vbr,slave_vbr
    241.  
    242. ***************************
    243. * 68000 vector (&#036;000000). *
    244. ***************************
    245.  
    246.    regs   pc=&#036;3f0
    247.    regs   sr=&#036;2700
    248.  
    249. entry_point   equ   &#036;000003f0
    250. stack_top   equ   &#036;00000000
    251.  
    252. vdp_d       equ   &#036;c00000
    253. vdp_c       equ   &#036;c00004
    254.  
    255. cp_0   equ   &#036;a15120
    256. cp_2   equ   &#036;a15122
    257. cp_4   equ   &#036;a15124
    258. cp_6   equ   &#036;a15126
    259. cp_8   equ   &#036;a15128
    260. cp_a   equ   &#036;a1512a
    261. cp_c   equ   &#036;a1512c
    262. cp_e   equ   &#036;a1512e
    263.  
    264. pollhost   equ   &#036;fc0000           ;downloader ROM.
    265. exception   equ   &#036;fc0004           ;entry points.
    266.  
    267.        if   debug=1
    268.  
    269. polhost       macro               ;
    270.        dc.w   &#036;a000           ;poll host machine.
    271.        endm               ;
    272.  
    273. break       macro               ;
    274.        dc.w   &#036;a002           ;software breakpoint.
    275.        endm               ;
    276.  
    277. softentry   macro               ;
    278.        dc.w   &#036;a003           ;link to host machine.
    279.        endm               ;
    280.  
    281.        else
    282.  
    283. polhost       macro               ;
    284.        endm               ;
    285.  
    286. break       macro               ;
    287.        endm               ;
    288.  
    289. softentry   macro               ;
    290.        endm               ;
    291.  
    292.        endc
    293.  
    294. exc_buserror   equ   &#036;02000000+exception
    295. exc_addrerr   equ   &#036;03000000+exception
    296. exc_illinst   equ   &#036;04000000+exception
    297. exc_div0   equ   &#036;05000000+exception
    298. exc_chk       equ   &#036;06000000+exception
    299. exc_trapv   equ   &#036;07000000+exception
    300. exc_priv   equ   &#036;08000000+exception
    301. exc_trace   equ   &#036;09000000+exception
    302. exc_linea   equ   pollhost
    303.  
    304.    section   vecs,vectors
    305.  
    306.    dc.l   stack_top           ;Initial SSP and PC.
    307.    dc.l   entry_point
    308.  
    309.    dc.l   &#036;0220800c   ;EX_BusError
    310.    dc.l   &#036;0320800c   ;EX_AddressError
    311.    dc.l   &#036;0420800c   ;EX_IllegalInstruction
    312.    dc.l   &#036;0520800c   ;EX_DivideBy0
    313.    dc.l   &#036;0620800c   ;EX_CHK
    314.    dc.l   &#036;0720800c   ;EX_TrapV
    315.    dc.l   &#036;0820800c   ;EX_Priviledge
    316.    dc.l   &#036;0920800c   ;EX_Trace
    317.    dc.l   EXC_LineA
    318.    dc.l   EXC_LineF
    319. * Reserved by motorola
    320.    dcb.l   12,0       ; EX_Motorola
    321. * Hardware interrupts
    322.    dc.l   EXC_Spurious
    323.    dc.l   EXC_Level1
    324.    dc.l   EXC_Level2
    325.    dc.l   EXC_Level3
    326.    dc.l   EXC_Level4
    327.    dc.l   EXC_Level5
    328.    dc.l   EXC_Level6
    329.    dc.l   EXC_Level7
    330.    dc.l   &#036;20208008   ;EX_Trap0
    331.    dc.l   EXC_Trap1
    332.    dc.l   EXC_Trap2
    333.    dc.l   EXC_Trap3
    334.    dc.l   EXC_Trap4
    335.    dc.l   EXC_Trap5
    336.    dc.l   EXC_Trap6
    337.    dc.l   EXC_Trap7
    338.    dc.l   EXC_Trap8
    339.    dc.l   EXC_Trap9
    340.    dc.l   EXC_TrapA
    341.    dc.l   EXC_TrapB
    342.    dc.l   EXC_TrapC
    343.    dc.l   EXC_TrapD
    344.    dc.l   EXC_TrapE
    345.    dc.l   EXC_TrapF
    346. * Reserved by motorola
    347.  
    348.    dcb.l   16,_error0
    349.  
    350. *************************
    351. * Genesis ID (&#036;000100). *
    352. *************************
    353.  
    354.    section   hdr,header
    355.  
    356.    dc.b   &#39;SEGA 32X        &#39;
    357.         dc.b    &#39;©T115 1995.APR&#39;
    358.    dc.b   &#39;SOULSTAR X                                      &#39;
    359.    dc.b   &#39;SOULSTAR X                                      &#39;
    360.    dc.b   &#39;T-11505B-50   &#39;       ;stuff
    361.    dc.w   0           ;checksum.
    362.    dc.b   &#39;J               &#39;   ;joystick.
    363.    dc.l   &#036;000000           ;rom start.
    364.    dc.l   &#036;1fffff           ;rom end.
    365.    dc.l   &#036;ff0000           ;ram start.
    366.    dc.l   &#036;ffffff           ;ram end.
    367.    dc.b   &#39;MR&#39;,0,0
    368.    dc.l   0,0
    369.    dc.b   &#39;    &#39;********************
    370. * Game Code Start. *
    371. ********************
    372.  
    373.    include   mequates.68k
    374.    include   obj_equ.s
    375.  
    376. ******************************************************************************
    377.    include   coms_equ.s
    378.  
    379. com   macro
    380.    move   #com_&#092;1,d0
    381.    jsr   send_com
    382.    endm
    383.  
    384. com4   macro
    385.    move   #com_&#092;1,d0
    386.    jsr   send_com4
    387.    endm
    388.  
    389. jcom   macro
    390.    move   #com_&#092;1,d0
    391.    jmp   send_com
    392.    endm
    393.  
    394. jcom4   macro
    395.    move   #com_&#092;1,d0
    396.    jmp   send_com4
    397.    endm
    398.  
    399. ******************************************************************************
    400.  
    401. no_traps   equ   1
    402. briefings   equ   0
    403.  
    404. ******************************************************************************
    405.  
    406. button_a   equ   0
    407. button_b   equ   1
    408. button_c   equ   2
    409. button_pause   equ   3
    410. button_option   equ   4
    411. button_y   equ   5
    412. button_z   equ   6
    413.  
    414. ******************************************************************************
    415.  
    416. ram_duration   equ   31*20
    417. bonus_hits   equ   10
    418. sh_del       equ   4
    419. mt_countdown08   equ   4
    420.  
    421. ******************************************************************************
    422. music   macro
    423.    move   #cdm_&#092;1,d0
    424.    jsr   start_music
    425.    endm
    426.  
    427. cdm_title   equ   &#036;00
    428. cdm_boss   equ   &#036;2d
    429. cdm_l360   equ   &#036;41
    430. cdm_death   equ   &#036;59
    431. cdm_fame   equ   &#036;5a
    432. cdm_credits   equ   &#036;6b
    433. cdm_level123   equ   &#036;7b
    434. cdm_kutra   equ   &#036;93
    435. cdm_gigun   equ   &#036;a9
    436. cdm_bulkan   equ   &#036;c1
    437. cdm_twingha   equ   &#036;d6
    438. cdm_guha   equ   &#036;ea
    439. cdm_metafus   equ   &#036;101
    440. cdm_krast   equ   &#036;11a
    441.  
    442. ******************************************************************************
    443. ******************************************
    444. ntempsp       equ   16
    445. nweaps       equ   16
    446. nenweap       equ   16
    447. nenemy       equ   20
    448. nfxspr       equ   32
    449. wbase       equ   128
    450.  
    451. maxshield   equ   30
    452. maxacc       equ   224
    453.  
    454. ******************************************************************************
    455. ******************************************************************************
    456. hp_mult       equ   4
    457. hp_shift   equ   2
    458.  
    459. cpu_hits   equ   128*hp_mult
    460. guha_hits   equ   512*hp_mult
    461. bulkan_hits   equ   128*hp_mult   ; Mid-Boss
    462. bulkan2_hits   equ   (256/2)*hp_mult   ; BOSS
    463. metafus_hits   equ   256*hp_mult
    464. gigun_hits   equ   256*hp_mult
    465.  
    466. hp_a0   macro
    467.    move   #(&#092;1)*hp_mult,en_hp(a0)
    468.    endm
    469.  
    470. hp_a5   macro
    471.    move   #(&#092;1)*hp_mult,en_hp(a5)
    472.    endm
    473.  
    474. hp_a6   macro
    475.    move   #(&#092;1)*hp_mult,en_hp(a6)
    476.    endm
    477. ******************************************************************************
    478. sclip   equ   200
    479. *************************************************
    480. pickup   macro
    481.    dc   (pu_&#092;1&lt;&lt;12)+&#092;2   ;tttt0mmmssssssss
    482.    endm
    483. pu_shield   equ   0
    484. pu_energy   equ   1
    485. pu_shot       equ   2
    486. pu_hunter   equ   3
    487. pu_ring       equ   4
    488. pu_laser   equ   5
    489. pu_missile   equ   6
    490. pu_bomb       equ   7
    491. pu_rocket   equ   8
    492. pu_charge   equ   9
    493. ******************************************************************************
    494. odb   macro
    495.    dc   &#092;1   ;col-dist
    496.    dc   &#092;2,&#092;3   ;x1,x2
    497.    dc   &#092;4,&#092;5   ;y1,y2
    498.    dc.l   &#092;6   ;hit handler
    499.    dc.l   &#092;7   ;logic handler
    500.    dc.l   &#092;8   ;360 logic handler
    501.    dc.l   &#092;9   ;output handler
    502.    dc.l   &#092;10   ;initialiser
    503.    dc.b   &#092;11   ;targetable
    504.    dc.b   &#092;12   ;radarable
    505.    endm
    506.  
    507. push   macros
    508.    move.   &#092;1,-(sp)
    509. pop   macros
    510.    move.   (sp)+,&#092;1
    511.  
    512. pushm   macros
    513.    movem. &#092;1,-(sp)
    514. popm   macros
    515.    movem. (sp)+,&#092;1
    516.  
    517. pushal   macros
    518.    movem   d3-d5,-(sp)
    519. popal   macros
    520.    movem   (sp)+,d3-d5
    521.  
    522. pusha   macros
    523.    movem.l   d0-d7/a0-a6,-(sp)
    524. popa   macros
    525.    movem.l   (sp)+,d0-d7/a0-a6
    526.  
    527. enemy   macro
    528.    dc   &#092;1,ot_&#092;2
    529.    dc   &#092;3,&#092;4,&#092;5
    530.    endm
    531.  
    532. set_ld   macro
    533.    IF   l_type=0
    534.    move.b   #&#092;1-1,ldel
    535.    ELSE
    536.    move.b   #&#092;1-1,ldel
    537.    ENDIF
    538. *   bsr   modify_fire_rate
    539.    endm
    540.  
    541. set_ld2 macro
    542.    IF   l_type=0
    543.    move.b   #&#092;1-1,ldel2
    544.    ELSE
    545.    move.b   #&#092;1-1,ldel2
    546.    ENDIF
    547.    endm
    548.  
    549. mp_sfx   macro
    550.    pushm.l   d1-d3
    551.    moveq   #sam_&#092;1,d1
    552.    move   #(&#092;2)/2,d2
    553.    move   #&#092;3,d3
    554.    com4   play_sfx
    555.    popm.l   d1-d3
    556.    rts
    557.    endm
    558.  
    559. ******************************************************************************
    560.  
    561. scratch_ram   equ   &#036;ffff0000   ;guess wot?
    562.  
    563. v_spratt   equ   &#036;fc00       ;SAT base.
    564. v_hscrl       equ   &#036;f000       ;H-scroll table base.
    565.  
    566.        include   equates.68k   ;equates + macros.
    567.  
    568. game_code
    569.    SOFTENTRY
    570.  
    571.    lea   &#036;880000+grouporg(ramcode68k),a0
    572.    lea   &#036;ffff8000,a1
    573.    move.l   #groupend(ramcode68k)-grouporg(ramcode68k)-1,d7
    574. .ccl   move.b   (a0)+,(a1)+
    575.    dbf   d7,.ccl
    576.  
    577.    move.l   sp,sp_save
    578.  
    579.    jsr   setup_player
    580.  
    581. ******************
    582. * Game RAM Code. *
    583. ******************
    584.  
    585. game_start
    586.    di           ;disable interrupts.
    587.  
    588.    jsr   init_vdp   ;write initial values to VDP.
    589.    jsr   init_joy   ;read joystick types.
    590.  
    591.    ei
    592.  
    593. main_start
    594.    jsr   screen_on
    595.  
    596.    clr   level
    597. ;   MOVE   #2,LEVEL
    598. ;   MOVE   #3,LEVEL
    599.  
    600.    bsr   restart_life_lost
    601.    move   #3,lives
    602.  
    603.    sf   diff_level
    604.    clr.l   score
    605.  
    606.    bsr   level_setup
    607.  
    608.    moveq   #0,d0
    609.    jsr   add_to_score
    610. *******************************************************************************
    611.    lea   node_head,a0
    612.    lea   node_tail,a1
    613.    move.l   a1,node_next(a0)
    614.    move.l   a0,node_prev(a1)
    615.    clr   game_del
    616.    clr   fade_delay
    617. *******************************************************************************
    618. ;   jsr   scroff
    619.  
    620.    move.b   #2,vbl_count
    621.    clr   startup_count
    622.    st   in_game
    623. mloop
    624.  
    625. .1   jsr   wait_vbl
    626.    tst.b   vbl_count
    627.    bne.s   .1
    628.    IF   l_type=1
    629.    move.b   #3,vbl_count
    630.    ELSE
    631.    move.b   #2,vbl_count
    632.    ENDIF
    633.  
    634.    lea   vdp_c,a6
    635.    ivramw   v_hscrl
    636.    move   back_x,-4(a6)
    637.    move   back_x,-4(a6)
    638.  
    639. ***************************************
    640.    jsr   level_flipper
    641. ***************************************
    642.  
    643.    jsr   level_output
    644.  
    645. ***************************************
    646.    addq   #1,game_del
    647.    and   #&#036;7fff,game_del
    648.    bne.s   .ng_roll
    649.    or   #&#036;1000,game_del
    650. .ng_roll:
    651. ***************************************
    652.    move   scr_spd,d0
    653.    IF   l_type=0
    654.    muls   #&#036;3334,d0
    655.    swap   d0
    656.    add   scr_spd,d0
    657.    ENDIF
    658.    move   d0,scr_spd2
    659. ***************************************
    660.    tst   sh_hit_num
    661.    beq.s   .sh_hit_ok
    662.    tst   dying_cnt
    663.    bne.s   .sh_hit_ok
    664.    subq   #1,sh_hit_del
    665.    bpl.s   .sh_hit_ok
    666.    subq   #1,sh_hit_num
    667.    jsr   do_low_shield_sfx
    668.    move   #sh_del,sh_hit_del
    669. .sh_hit_ok:
    670. ***************************************
    671.    jsr   pickup_system
    672.    cmp   #04,level
    673.    bne.s   .not_gigun
    674.    jsr   gigun_checks
    675. .not_gigun:
    676.    jsr   end_fader
    677. ***************************************
    678.    sf   hit_sfx_already
    679.  
    680. ***************************************
    681.    clr   tmp_slot
    682. ***************************************
    683. * Do all processing here&#33; *
    684. ***************************
    685.    subq   #1,gcnt3
    686.    bpl.s   .gcnt3
    687.    move   #3-1,gcnt3
    688. .gcnt3:
    689.    subq   #1,gcnt5
    690.    bpl.s   .gcnt5
    691.    move   #5-1,gcnt5
    692. .gcnt5:
    693.    subq   #1,gcnt6
    694.    bpl.s   .gcnt6
    695.    move   #6-1,gcnt6
    696. .gcnt6:
    697.    subq   #1,gcnt9
    698.    bpl.s   .gcnt9
    699.    move   #9-1,gcnt9
    700. .gcnt9:
    701.    subq   #1,gcnt10
    702.    bpl.s   .gcnt10
    703.    move   #9-1,gcnt10
    704. .gcnt10:
    705.    subq   #1,gcnt12
    706.    bpl.s   .gcnt12
    707.    move   #12-1,gcnt12
    708. .gcnt12:
    709.    subq   #1,gcnt19
    710.    bpl.s   .gcnt19
    711.    move   #19-1,gcnt19
    712. .gcnt19:
    713.    tst   dying_cnt
    714.    beq.s   .not_dying
    715.    jsr   do_player_dying
    716.    bra.s   .no_ctl
    717. .not_dying:
    718.    tst   startup_count
    719.    bne.s   .no_ctl
    720.    jsr   do_v_control
    721. .no_ctl:
    722.    tst.b   is_360
    723.    beq.s   .no_360
    724.    jsr   set_360_map_pos
    725. .no_360:
    726. ***************************************
    727.    bsr   level_control
    728. ***************************************
    729.    jsr   create_enemies
    730.    jsr   get_all_enemies
    731.    jsr   get_all_weapons
    732.    jsr   do_next_weapon
    733. ******************************************************************************
    734. * Check for 2nd player *
    735. ************************
    736.    tst.b   ply2mode
    737.    beq.s   .1player_only
    738.    jsr   do_next_weapon_2
    739.    jsr   player_2_control
    740.    jsr   player_2_weapons
    741.    bra.s   .2player_done
    742. .1player_only:
    743.    jsr   power_transfer_1p
    744.    cmp   #2,vehicle
    745.    bne.s   .not_walker1
    746.    jsr   do_1p_walker_targetting
    747.  
    748.    tst   poptarg
    749.    beq.s   .no_poptarg
    750.    subq   #1,poptarg
    751.    move.l   mtarget,d0
    752.    beq.s   .no_poptarg
    753.    move.l   d0,a6
    754.    move   mob_x(a6),d0
    755.    move   mob_y(a6),d1
    756.    moveq   #0,d2
    757.    moveq   #0,d6
    758.    lea   node_msight,a6
    759.    movem   d0/d1/d2/d6/d7,node_data(a6)
    760.    move   #ot_msight,mob_type(a6)
    761.    jsr   insert_sprite
    762. .no_poptarg:
    763.  
    764.    bra.s   .2player_done
    765. .not_walker1:
    766.    lea   weapon_tab,a0
    767.    add   weapon,a0
    768.    cmp.b   #pw_bomblet,(a0)
    769.    bne.s   .2player_done
    770.    jsr   handle_missile_sight
    771. .2player_done:
    772. ******************************************************************************
    773.    jsr   plot_rams
    774.    jsr   plot_player
    775.    tst   charge_cnt
    776.    beq.s   .not_charging
    777.    jsr   insert_charge_spr
    778. .not_charging:
    779. ***************************************
    780.  
    781.    bsr   draw_sprites
    782.    jsr   draw_panel
    783.  
    784.    com   flip_screen
    785.    jsr   wait_com
    786.  
    787.    btst   #button_pause,joy1
    788.    bne.s   .no_pause
    789. .paused
    790.    jsr   wait_vbl
    791.    btst   #button_pause,joy1
    792.    beq.s   .paused
    793.  
    794. .paused1
    795.    jsr   wait_vbl
    796.    btst   #button_pause,joy1
    797.    bne.s   .paused1
    798. .paused2
    799.    jsr   wait_vbl
    800.    btst   #button_pause,joy1
    801.    beq.s   .paused2
    802. .no_pause
    803.  
    804.    MOVE.B   #16,shield
    805.    
    806.    bra   mloop
    807.  
    808. ******************************************************************************
    809. * CPIC backgrounds *
    810. ********************
    811.  
    812. back_00a   incbin   backs&#092;space1.cpi
    813.        even
    814. back_00b   incbin   backs&#092;space2.cpi
    815.        even
    816.  
    817. back_03       incbin   backs&#092;warpship.cpi
    818.        even
    819.  
    820. ******************************************************************************
    821. * 360 object data *
    822. *******************
    823.  
    824. zone_03_dat   incbin   stages&#092;zone03.dat
    825.        even
    826. zone_05_dat   incbin   stages&#092;zone05.dat
    827.        even
    828. zone_08_dat   incbin   stages&#092;zone08.dat
    829.        even
    830. zone_11_dat   incbin   stages&#092;zone11.dat
    831.        even
    832. zone_17_dat   incbin   stages&#092;zone17.dat
    833.        even
    834. zone_24_dat   incbin   stages&#092;zone24.dat
    835.        even
    836. zone_26_dat   incbin   stages&#092;zone26.dat
    837.        even
    838.  
    839. ******************************************************************************
    840. * Decompress background (2 playfields) *
    841. ****************************************
    842.  
    843. * A0 = playfield #1
    844. * A1 = playfield #2
    845.  
    846. decomp_68k_backgr
    847.    push.l   a1
    848.  
    849.    lea   scratch_ram,a1
    850.    jsr   unpack
    851.  
    852.    lea   scratch_ram,a0
    853.    move   #&#036;e000,d0
    854.    move   #64*2,d1
    855.    jsr   decomp_cpic
    856.  
    857.    pop.l   a0
    858.    move.l   a0,d0       ;if -I&#39;ve, only decomp 1st screen
    859.    bmi.s   .skip       ;skip unpack
    860.    
    861.    lea   scratch_ram,a1
    862.    jsr   unpack
    863. .skip
    864.    lea   scratch_ram,a0
    865.    move   #&#036;c000,d0
    866.    move   #64*2,d1
    867. ***************
    868. * decomp CPIC *
    869. ***************
    870. * A0 = ptr to CPIC file
    871. * D0 = dest. adr
    872. * D1 = dest CMAP width*2
    873.  
    874. decomp_cpic
    875.    lea   vdp_c,a6
    876.  
    877.    vreg   15,2
    878.    bsr   dc_palette
    879.    movem   d0/d1,-(sp)
    880.    bsr   dc_chars
    881.    movem   (sp)+,d0/d1
    882. dc_cmap
    883.    move   d0,d4
    884.    move   d1,dest_xsize
    885.  
    886.    moveq   #0,d2
    887.    move   cpic_map(a0),d2
    888.    beq.s   .map_done
    889.    lea   (a0,d2.l),a2
    890.    moveq   #0,d5
    891.    move.b   cpic_x(a0),d5
    892.    moveq   #0,d6
    893.    move.b   cpic_y(a0),d6
    894.    subq   #1,d6
    895. .yloop
    896.    move   d4,d2
    897.    move.l   a2,d1
    898.    move   d5,d0
    899.    add   d5,a2
    900.    add   d5,a2
    901.    bsr   dma_trans_wr
    902.    add   dest_xsize,d4
    903.    dbf   d6,.yloop
    904. .map_done
    905.    rts
    906. dc_chars
    907.    move   cpic_dchar(a0),d2
    908.    move   cpic_char(a0),d3
    909.    lea   (a0,d3),a1
    910.    move.l   a1,d1
    911.    move   cpic_nchar(a0),d0
    912.    bra   dma_trans_wr
    913.  
    914. dc_palette
    915.    move.l   a4,-(sp)
    916.    lea   palette_store,a4
    917.  
    918.    move   cpic_opal(a0),d3
    919.    beq.s   .no_palette
    920.    lea   2(a0,d3),a1
    921.    move   cpic_cpal(a0),d2
    922.    add   d2,a4
    923.    or   #&#036;c000,d2           ;CRAM write
    924.    move   d2,(a6)
    925.    move   #0,(a6)
    926.    lea   -4(a6),a5
    927.    move.l   (a1),(a4)+
    928.    move.l   (a1)+,(a5)
    929.    move.l   (a1),(a4)+
    930.    move.l   (a1)+,(a5)
    931.    move.l   (a1),(a4)+
    932.    move.l   (a1)+,(a5)
    933.    move.l   (a1),(a4)+
    934.    move.l   (a1)+,(a5)
    935.    move.l   (a1),(a4)+
    936.    move.l   (a1)+,(a5)
    937.    move.l   (a1),(a4)+
    938.    move.l   (a1)+,(a5)
    939.    move.l   (a1),(a4)+
    940.    move.l   (a1)+,(a5)
    941.    move.l   (a1),(a4)+
    942.    move.l   (a1)+,(a5)
    943. .no_palette
    944.    move.l   (sp)+,a4
    945.    rts
    946.  
    947. dma_trans_wr
    948.    push.l   a0
    949.  
    950.    lea   vdp_c,a6
    951.    vreg   15,2
    952.  
    953.    addq   #1,d0
    954.    lsr   #1,d0
    955.    move.l   d1,a0
    956.  
    957.    move   d2,d1
    958.    and   #&#036;3fff,d2
    959.    or   #&#036;4000,d2
    960.    and   #&#036;c000,d1
    961.    rol   #2,d1
    962.    swap   d2
    963.    move   d1,d2
    964.    move.l   d2,(a6)
    965.    lea   -4(a6),a5
    966. .loop
    967.    move.l   (a0)+,(a5)
    968.    dbf   d0,.loop
    969.  
    970.    pop.l   a0
    971.    rts
    972.  
    973. *******************
    974. * Disable Screen. *
    975. *******************
    976.  
    977. screen_off
    978.    and   #~&#036;0040,reg1_shadow   ;disable screen output.
    979.    move   reg1_shadow,vdp_c   ;write reg1 (screen enable).
    980.    rts
    981.  
    982. ******************
    983. * Enable Screen. *
    984. ******************
    985.  
    986. screen_on
    987.    or   #&#036;0040,reg1_shadow   ;enable screen output.
    988.    move   reg1_shadow,vdp_c   ;write reg1 (screen enable).
    989.    rts
    990.  
    991. ***********************
    992. * Read PAL/NTSC Flag. *
    993. ***********************
    994.  
    995. get_tv
    996.    lea   vdp_c,a6       ;
    997.    moveq   #1,d0           ;read PAL/NTSC flag.
    998.    and   (a6),d0           ;
    999.  
    1000.    lea   cp_a,a6           ;write result to smooth-scroll A.
    1001.    move   d0,(a6)           ;
    1002.  
    1003.    rts
    1004.  
    1005. ***************
    1006. * Clear VRAM. *
    1007. ***************
    1008.  
    1009. clear_vram
    1010.    lea   vdp_c,a6
    1011.    vreg   15,2           ;
    1012.    ivramw   0           ;clear VRAM.
    1013.    move   #(65536/4)-1,d7       ;
    1014. .cvl   move.l   #0,-4(a6)
    1015.    dbf   d7,.cvl
    1016.  
    1017.    rts
    1018.  
    1019. ******************************************************************************
    1020. reset_specials
    1021.    move.l   #&#036;08090aff,weapon_tab+4
    1022.    tst.b   ply2mode
    1023.    beq.s   .1p
    1024.    move.l   #&#036;08090a00,weapon_tab+4
    1025. .1p
    1026.    rts
    1027. ******************************************************************************
    1028. restart_life_lost
    1029.    lea   vars_start,a0
    1030.    move   #((vars_end-vars_start)/2)-1,d7
    1031. .cvars   clr   (a0)+
    1032.    dbf   d7,.cvars
    1033.  
    1034.    lea   STRUCT_START,a0
    1035.    move   #((STRUCT_END-STRUCT_START)/4)-1,d0
    1036. .c2loop clr.l   (a0)+
    1037.    dbf   d0,.c2loop
    1038.  
    1039.    move   #128,msight_x
    1040.    move   #88,msight_y
    1041.  
    1042.    moveq   #4,d1
    1043.    tst.b   ply2mode
    1044.    beq.s   .n_2mw
    1045.    move.l   #&#036;00070003,d1
    1046. .n_2mw   move.l   d1,weapon
    1047.    lea   weapon_tab,a0
    1048.    move.l   #&#036;00ffff04,(a0)+
    1049.    move.l   #&#036;08090aff,(a0)+
    1050.    tst.b   ply2mode
    1051.    beq.s   .1p
    1052.    move.l   #&#036;ffffff04,-8(a0)
    1053.    move.l   #&#036;08090a00,-4(a0)
    1054. .1p
    1055.    st   oweapon
    1056.    st   oweapon2
    1057.    st   opower
    1058.    sf   ram_weapon
    1059.    clr   ram_count
    1060.    clr   torpedo_count
    1061.  
    1062.    move.b   #maxshield/2,shield
    1063.    move   #(maxacc-1)/3,acc
    1064.    clr   bombs_rem
    1065.    clr   rockets_rem
    1066.    move   #40,missiles_rem
    1067.  
    1068.    clr   player_x
    1069.    move   #&#036;48,player_y
    1070.  
    1071.    move   #sclip,yclip
    1072.    rts
    1073. ******************************************************************************
    1074. set_hp_a0
    1075.    move   d0,mob_hp(a0)
    1076.    rts
    1077. ******************************************************************************
    1078. scroff
    1079.    jmp   screen_off
    1080. set_scron_delay
    1081.    move   #3,scron_delay
    1082.    rts
    1083. ******************************************************************************
    1084. getrand
    1085.    move.b   rand_num,d0
    1086.    move.b   rand_num+1,rand_num
    1087.    move.b   d0,rand_num+1
    1088. ;   move   &#036;ff800c,d0
    1089.    add   rand_num,d0
    1090.    ror   rand_num
    1091.    rts
    1092. ******************************************************************************
    1093. play_music
    1094. add_qsound
    1095. remove_qsound_a5
    1096. do_pl_startup
    1097.    rts
    1098.  
    1099. rotate_player_sprite
    1100.    move   node_player+mob_x,d1
    1101.    move   node_player+mob_y,d2
    1102.  
    1103.    move   pbank,d3
    1104.    asr   #3,d3
    1105.    and   #&#036;7ff,d3
    1106.  
    1107.    move   node_player+mob_def,d4
    1108.  
    1109.    jcom4   rotate_player
    1110. ******************************************************************************
    1111.  
    1112.    include   planet.s
    1113.    include   surface.s
    1114.    include   sprite.s
    1115.    include   levels.s
    1116.    include   elogic.s
    1117.  
    1118.    include   mapping.s
    1119.  
    1120.    include   bulkan.s
    1121.    include   guha.s
    1122.    include   twingha.s
    1123.    include   metafus.s
    1124.    include   gigun.s
    1125.    include   krast.s
    1126.  
    1127.    include   map360.s
    1128.    include   weapons.s
    1129.    include   weapons2.s   ;2nd player
    1130.  
    1131.    include   music.s
    1132.  
    1133.    include   control2.s
    1134.  
    1135.    include   title.s
    1136.    include   options.s
    1137.  
    1138.    include   panel.s
    1139.  
    1140.    include   cosin.s
    1141.  
    1142. odb_table
    1143.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_null,h_null,h_null,h_null,0,0
    1144.  
    1145.    rept   127
    1146.    odb   &#036;400,&#036;200,-&#036;200,&#036;200,-&#036;200,hit_enemy,do_path_anim,0,plot_spr,init_path_alien,0,0
    1147.    endr
    1148.  
    1149. * player weapons (20)
    1150.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_null,0,plot_spr,hnull,0,0
    1151.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_null,0,plot_hunter_spr,hnull,0,0
    1152.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_null,0,plot_spr,hnull,0,0
    1153.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_null,0,plot_pl_laser,hnull,0,0
    1154.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_null,0,plot_spr,hnull,0,0
    1155.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_null,0,plot_spr,hnull,0,0
    1156.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_null,0,plot_pl_rocket,hnull,0,0
    1157.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_null,0,plot_chargeable_spr,hnull,0,0
    1158.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_null,0,plot_pl_laser,hnull,0,0
    1159.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_null,0,plot_spr,hnull,0,0
    1160.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_null,0,plot_spr,hnull,0,0
    1161.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_null,0,plot_spr,hnull,0,0
    1162.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_null,0,plot_spr,hnull,0,0
    1163.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_null,0,plot_spr,hnull,0,0
    1164.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_null,0,plot_spr,hnull,0,0
    1165.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_null,0,plot_spr,hnull,0,0
    1166.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_null,0,plot_spr,hnull,0,0
    1167.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_null,0,plot_spr,hnull,0,0
    1168.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_null,0,plot_spr,hnull,0,0
    1169.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_null,0,plot_spr,hnull,0,0
    1170.  
    1171.    rept   107
    1172.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,do_path_anim,0,plot_spr,hnull,0,0
    1173.    endr
    1174.  
    1175.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_null2,0,plot_spr,hnull,0,0
    1176.  
    1177. * explosions
    1178.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_g_exp,h_g_exp_360,plot_spr,hnull,0,0
    1179.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_a_exp,h_a_exp_360,plot_spr,hnull,0,0
    1180.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_g_exp,h_g_exp_360,plot_spr,hnull,0,0
    1181.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_a_exp,h_a_exp_360,plot_spr,hnull,0,0
    1182.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_g_exp,h_g_exp_360,plot_spr,hnull,0,0
    1183.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_a_exp,h_a_exp_360,plot_spr,hnull,0,0
    1184.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_a_exp,h_a_exp_360,plot_spr,hnull,0,0
    1185. * sm exp (or/bl)
    1186.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_sm_exp_or,h_sm_exp_or_360,plot_spr,hnull,0,0
    1187.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_sm_exp_bl,h_sm_exp_bl_360,plot_spr,hnull,0,0
    1188. * small tank smoke
    1189.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_st_smoke,h_st_smoke_360,plot_spr,hnull,0,0
    1190. * small exp (stage #09 BOSS)
    1191.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_smexp09,0,plot_spr,h_null,0,0
    1192. * small smoke (GIGUN)
    1193.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_sm_exp_bl2,0,plot_spr,h_null,0,0
    1194.  
    1195. * player explosions
    1196.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_a_exp,h_a_exp_360,plot_spr,hnull,0,0
    1197.  
    1198. * enemy weaps (32)
    1199.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_eweap00,0,plot_spr,hnull,0,0
    1200.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_eweap01,0,plot_spr,hnull,0,0
    1201.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_eweap02,0,plot_spr,hnull,0,0
    1202.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_grzap_laser,0,plot_spr,hnull,0,0
    1203.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_eweap04,0,plot_tlaser_16,hnull,0,0
    1204.    odb   &#036;400,&#036;200,-&#036;200,&#036;200,-&#036;200,hit_enemy_missile,h_eweap_missile05,0,plot_spr,hnull,0,0
    1205.    odb   &#036;400,&#036;300,-&#036;300,&#036;200,-&#036;200,hit_enemy,h_eweap06,0,plot_spr,init_3hp,0,0
    1206.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_eweap07,0,plot_spr,hnull,0,0
    1207.    odb   &#036;400,&#036;200,-&#036;200,&#036;200,-&#036;200,hit_enemy_missile,h_eweap08,0,plot_spr,hnull,0,0
    1208.    odb   &#036;c00,&#036;080,-&#036;000,&#036;080,-&#036;080,hit_enemy_missile,h_eweap09,h_eweap09_360,plot_spr,hnull,1,&#036;4
    1209.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_eweap0B,h_eweap0A_360,plot_spr,hnull,0,0
    1210.    odb   &#036;c00,&#036;080,-&#036;000,&#036;080,-&#036;080,hit_28_shot,h_eweap0B,h_eweap0B_360,plot_spr,hnull,0,&#036;f
    1211.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_eweap0E,h_eweap0C_360,plot_tlaser_360,hnull,0,0
    1212.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_eweap0E,h_eweap0D_360,plot_spr,hnull,0,0
    1213.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_eweap0E,h_eweap0E_360,plot_spr,hnull,0,0
    1214.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_eweap0F,h_eweap0F_360,plot_tlaser_360,hnull,0,0
    1215.  
    1216.    odb   &#036;400,&#036;200,-&#036;200,&#036;200,-&#036;200,hit_enemy_missile,h_eweap10,0,plot_spr,hnull,0,0
    1217.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_eweap02,0,plot_spr,hnull,0,0
    1218.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_eweap02,0,plot_spr,hnull,0,0
    1219.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_eweap02,0,plot_spr,hnull,0,0
    1220.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_eweap02,0,plot_spr,hnull,0,0
    1221.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_eweap02,0,plot_spr,hnull,0,0
    1222.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_eweap02,0,plot_spr,hnull,0,0
    1223.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_eweap02,0,plot_spr,hnull,0,0
    1224.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_eweap02,0,plot_spr,hnull,0,0
    1225.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_eweap02,0,plot_spr,hnull,0,0
    1226.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_eweap02,0,plot_spr,hnull,0,0
    1227.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_eweap02,0,plot_spr,hnull,0,0
    1228.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_eweap02,0,plot_spr,hnull,0,0
    1229.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_eweap02,0,plot_spr,hnull,0,0
    1230.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_eweap02,0,plot_spr,hnull,0,0
    1231.  
    1232. * player ship
    1233.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_null,0,rotate_player_sprite,h_null,0,0
    1234. * player walker
    1235.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,hnull,0,plot_player_walker,hnull,0,0
    1236. * missile sight
    1237.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,hnull,0,plot_msight,hnull,0,0
    1238. * stage 08 warping orb
    1239.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_worb08,0,plot_spr,h_null,0,0
    1240. * stage 05 laser sight
    1241.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_null,hl_05_lsight,plot_05_lsight,h_null,0,0
    1242. * stage 05 laser beam
    1243.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_null,hl_05_lbeam,plot_05_lbeam,h_null,0,0
    1244.  
    1245. * asteroid
    1246.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_asteroid00,0,plot_star,h_null,0,0
    1247. * building fragments
    1248.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_leira_bf1,h_leira_bf_360,plot_frag_spr,h_null,0,0
    1249.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_leira_bf2,h_leira_bf_360,plot_frag_spr,h_null,0,0
    1250.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_leira_bf3,h_leira_bf_360,plot_frag_spr,h_null,0,0
    1251.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_leira_bf4,h_leira_bf_360,plot_frag_spr,h_null,0,0
    1252. * panel palette fragments
    1253.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_pfrag1,h_leira_bf_360,plot_spr,h_null,0,0
    1254.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_pfrag2,h_leira_bf_360,plot_spr,h_null,0,0
    1255.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_pfrag3,h_leira_bf_360,plot_spr,h_null,0,0
    1256.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_pfrag4,h_leira_bf_360,plot_spr,h_null,0,0
    1257.  
    1258.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_pfrag1s,h_leira_bf_360,plot_spr,h_null,0,0
    1259.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_pfrag2s,h_leira_bf_360,plot_spr,h_null,0,0
    1260.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_pfrag3s,h_leira_bf_360,plot_spr,h_null,0,0
    1261.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_pfrag4s,h_leira_bf_360,plot_spr,h_null,0,0
    1262. * player hit
    1263.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_plyhit,0,plot_spr,hnull,0,0
    1264. * player RAM unit
    1265.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_null,0,plot_spr,hnull,0,0
    1266.  
    1267. * enemy 2 - down
    1268.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_enemy2_down,0,plot_spr,hnull,0,0
    1269. * leira lander down
    1270.    odb   &#036;400,&#036;200,-&#036;200,&#036;200,-&#036;200,0,h_leira_lander_down,0,plot_spr,hnull,0,0
    1271. * falling mine
    1272.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_falling_mine,0,plot_mine_spr,hnull,0,0
    1273. * sand spray
    1274.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_sand_spray,hl_sand_spray_360,plot_spr,hnull,0,0
    1275. * sand spray (small)
    1276.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_sand_spray2,hl_sand_spray2_360,plot_spr,hnull,0,0
    1277. * snakey sand spray
    1278.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_sand_spray_s,0,plot_spr,hnull,0,0
    1279. * guha crater
    1280.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_guha_crater,hl_guha_crater_360,plot_spr,hnull,0,0
    1281. * guha boss shield hit&#33;
    1282.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_guha_bhit,hl_guha_bhit,plot_spr,hnull,0,0
    1283.  
    1284. * twingha water splashes (vlarge/large/small)
    1285.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_vl_splash10,0,plot_spr,hnull,0,0
    1286.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_l_splash10,0,plot_spr,hnull,0,0
    1287.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_s_splash10,0,plot_spr,hnull,0,0
    1288.  
    1289. ;   rept   384-ot_fxlast
    1290. ;   odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,0,0,0,hnull,0,0
    1291. ;   endr
    1292.  
    1293. * bonus 1a-c
    1294. ci_bonus1
    1295.    odb   &#036;400,&#036;300,-&#036;300,&#036;300,-&#036;300,hit_bonus1abc,h_bonus1a,0,plot_bonus,hnull,0,0
    1296.    odb   &#036;400,&#036;300,-&#036;300,&#036;300,-&#036;300,hit_bonus1abc,h_bonus1b,0,plot_bonus,hnull,0,0
    1297.    odb   &#036;400,&#036;300,-&#036;300,&#036;300,-&#036;300,hit_bonus1abc,h_bonus1c,0,plot_bonus,hnull,0,0
    1298. * leira rocks
    1299.    odb   &#036;400,&#036;100,-&#036;100,&#036;100,-&#036;c00,hit_indestructible,h_leira_trock,0,plot_spr,hnull,0,0
    1300.    odb   &#036;400,&#036;100,-&#036;100,&#036;100,-&#036;800,hit_indestructible,h_leira_mrock,0,plot_spr,hnull,0,0
    1301.    odb   &#036;400,&#036;100,-&#036;100,&#036;100,-&#036;400,hit_indestructible,h_leira_srock,0,plot_spr,hnull,0,0
    1302. * warpship boss
    1303.    odb   &#036;c00,&#036;100,-&#036;000,&#036;100,-&#036;000,hit_indestructible_360,h_boss03,0,plot_spr,hnull,0,&#036;a
    1304. * warpship pilon
    1305.    odb   &#036;c00,&#036;0c0,-&#036;000,&#036;180,-&#036;000,hit_indestructible_360,h_wpilon03,0,plot_spr,hnull,0,&#036;a
    1306. * warpship shield
    1307.    odb   &#036;c00,&#036;0c0,-&#036;000,&#036;070,-&#036;070,hit_indestructible_360,h_shields03,0,plot_spr,hnull,0,&#036;a
    1308. * warpship warpgate
    1309.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_warpgate03,0,plot_spr,hnull,0,&#036;f
    1310. * cpu malfunction
    1311.    odb   -000,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_malf03,0,plot_spr,hnull,0,0
    1312. * warpship pylon
    1313.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_wp_pilon,0,plot_spr,hnull,0,&#036;a
    1314. * warpship small pylon
    1315.    odb   &#036;c00,&#036;080,-&#036;000,&#036;100,-&#036;000,0,h_sm_pilon03,0,plot_spr,hnull,0,&#036;a
    1316. * warpship fragment W,A,B
    1317.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_fragment03w,0,h_null,h_null,0,0
    1318.    odb   &#036;c00,&#036;0e0,-&#036;000,&#036;120,-&#036;000,hit_indestructible_360,h_fragment03a,h_fragment_03_360,plot_spr,hnull,0,0
    1319.    odb   &#036;c00,&#036;0e0,-&#036;000,&#036;120,-&#036;000,hit_indestructible_360,h_fragment03b,0,plot_spr,hnull,0,&#036;3
    1320.  
    1321. * guha rocks
    1322.    odb   &#036;c00,&#036;0c0,-&#036;000,&#036;100,-&#036;000,hit_indestructible_360,h_guha_rock1,0,plot_spr,h_null,0,0
    1323.    odb   &#036;c00,&#036;080,-&#036;000,&#036;080,-&#036;000,hit_indestructible_360,h_guha_rock2,0,plot_spr,h_null,0,0
    1324. * guha dome
    1325.    odb   &#036;c00,&#036;100,-&#036;000,&#036;0c0,-&#036;000,hit_guha_dome360,h_guha_dome1,0,plot_spr,init_guha_dome,1,&#036;2
    1326.    odb   &#036;c00,&#036;100,-&#036;000,&#036;0c0,-&#036;000,hit_guha_dome360,h_guha_dome2,0,plot_spr,h_null,1,&#036;2
    1327.    odb   &#036;c00,&#036;100,-&#036;000,&#036;050,-&#036;000,hit_indestructible_360,h_guha_dome3,0,plot_spr,h_null,0,0
    1328. * guha small tower
    1329.    odb   &#036;c00,&#036;080,-&#036;000,&#036;0c0,-&#036;000,hit_guha_smtower360,h_guha_smtower1,0,plot_spr,h_null,1,&#036;3
    1330.    odb   &#036;c00,&#036;080,-&#036;000,&#036;080,-&#036;000,hit_indestructible_360,h_guha_smtower2,0,plot_spr,h_null,0,0
    1331. * guha pilon
    1332.    odb   &#036;c00,&#036;080,-&#036;000,&#036;180,-&#036;000,hit_guha_pilon360,h_guha_pilon,0,plot_guha_pilon,h_null,0,&#036;3
    1333.  
    1334. ********************************************************************
    1335. * twingha rocks *
    1336. *****************
    1337. * flat rock
    1338.    odb   &#036;400,&#036;180,-&#036;180,&#036;100,-&#036;100,hit_indestructible,h_fl_rock10,0,plot_spr,hnull,0,0
    1339. * small rock
    1340.    odb   &#036;400,&#036;180,-&#036;180,&#036;100,-&#036;400,hit_indestructible,h_s_rock10,0,plot_spr,hnull,0,0
    1341. * tall rock
    1342.    odb   &#036;400,&#036;180,-&#036;180,&#036;100,-&#036;d00,hit_indestructible,h_t_rock10,0,plot_spr,hnull,0,0
    1343. * tall umbrella rock
    1344.    odb   &#036;400,&#036;180,-&#036;180,&#036;100,-&#036;d00,hit_indestructible,h_tu_rock10,0,plot_spr,hnull,0,0
    1345.  
    1346. ********************************************************************
    1347.  
    1348. ;   rept   512-ot_htlast
    1349. ;   odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,0,0,0,hnull,0,0
    1350. ;   endr
    1351.  
    1352. * bonus 1
    1353. ci_bonus2
    1354.    odb   &#036;400,&#036;200,-&#036;200,&#036;200,-&#036;200,hit_bonus1,h_bonus1,0,plot_spr,init_bonus1,&#036;1,0
    1355. *************
    1356. * STAGE #00 *
    1357. *************
    1358. * small starbase
    1359.    odb   -001,&#036;000,-&#036;000,&#036;000,-&#036;000,0,h_enemy4,0,plot_spr,init_en4,&#036;0,0
    1360. *************
    1361. * STAGE #01 *
    1362. *************
    1363. * leira buildings
    1364.    odb   &#036;400,&#036;300,-&#036;300,&#036;100,-&#036;800,hit_ground_obj_f,h_leira_od,0,plot_spr,init_1hp,&#036;1,0
    1365.    odb   -001,&#036;300,-&#036;300,&#036;100,-&#036;400,hit_indestructible,h_leira_od_d,0,plot_spr,hnull,0,0
    1366.    odb   &#036;400,&#036;200,-&#036;200,&#036;100,-&#036;b00,hit_ground_obj_f,h_leira_b1,0,plot_spr,init_3hp,&#036;1,0
    1367.    odb   -001,&#036;200,-&#036;200,&#036;100,-&#036;200,hit_indestructible,h_leira_b1_d,0,plot_spr,hnull,0,0
    1368.    odb   &#036;400,&#036;300,-&#036;400,&#036;100,-&#036;1000,hit_ground_obj_f,h_leira_rb2,0,plot_spr,init_6hp,&#036;1,0
    1369.    odb   -001,&#036;300,-&#036;400,&#036;100,-&#036;600,hit_indestructible,h_leira_rb2_d,0,plot_spr,hnull,0,0
    1370.    odb   &#036;400,&#036;300,-&#036;400,&#036;100,-&#036;1000,hit_ground_obj_f,h_leira_lb2,0,plot_spr,init_6hp,&#036;1,0
    1371.    odb   -001,&#036;300,-&#036;400****************
    1372. * Control file *
    1373. ****************
    1374. do_v_control
    1375.    tst   dying_cnt
    1376.    beq.s   .not_dying
    1377.    rts
    1378. .not_dying
    1379.    move.b   joy0,d1
    1380.  
    1381.    tst.b   in_lava
    1382.    beq.s   .not_lava1
    1383.    or.b   #&#036;0c,d1
    1384. .not_lava1
    1385.  
    1386.    move   vehicle,d0
    1387.    subq   #1,d0
    1388.    bmi   striker_ctrl
    1389.    beq   copter_ctrl
    1390. walker_ctl
    1391.    cmp   #2+4,walker_count
    1392.    beq.s   .t2
    1393.    cmp   #2,walker_count
    1394.    bne.s   .t1
    1395. .t2
    1396.    move   walker_count,d3
    1397.    cmp   l_walker_count,d3
    1398.    beq.s   .t2a
    1399.    tst   warp_count
    1400.    bne.s   .t2a
    1401.    jsr   do_walker_foot_sfx
    1402. .t2a
    1403.    clr   scr_spd
    1404.    clr   walker_dir
    1405.    sf   walker_turn
    1406. .t1
    1407.    tst   warp_count
    1408.    bne   .we_are_warping
    1409.  
    1410.    move   pbank,d3
    1411.  
    1412.    btst   #2,d1
    1413.    bne.s   .nl
    1414.  
    1415.    st   walker_turn
    1416.    move   #-1,walker_dir
    1417.  
    1418.    add   #&#036;080,d3
    1419.    cmp   #&#036;200,d3
    1420.    blt.s   .pbd
    1421.    move   #&#036;200,d3
    1422.    bra.s   .pbd
    1423. .nl
    1424.    btst   #3,d1
    1425.    bne.s   .nr
    1426.  
    1427.    st   walker_turn
    1428.    move   #-1,walker_dir
    1429.  
    1430.    sub   #&#036;080,d3
    1431.    cmp   #-&#036;200,d3
    1432.    bgt.s   .pbd
    1433.    move   #-&#036;200,d3
    1434.    bra.s   .pbd
    1435. .nr
    1436.    tst.b   walker_turn
    1437.    bne.s   .pbd
    1438.    
    1439.    tst   d3
    1440.    beq.s   .pbd
    1441.    bmi.s   .pbadd
    1442. .pbsub   sub   #&#036;80,d3
    1443.    bra.s   .pbd
    1444. .pbadd   add   #&#036;80,d3
    1445. .pbd   move   d3,pbank
    1446.  
    1447.    move   walker_count,l_walker_count
    1448.  
    1449.    tst   slide_count
    1450.    beq   .no_slide
    1451.  
    1452.    btst   #0,d1
    1453.    beq.s   .up_ok
    1454.    cmp   #6,slide_count
    1455.    ble.s   .fuel_ok_97
    1456.    move   #6,slide_count
    1457. ;   bra.s   .fuel_ok_97
    1458. .up_ok
    1459. ;   moveq   #7,d0
    1460. ;   and   game_del,d0
    1461. ;   bne.s   .fuel_ok_97
    1462. ;   subq   #1,acc
    1463. .fuel_ok_97
    1464.  
    1465.    sf   walker_turn
    1466.    move   slide_count,d0
    1467.    cmp   #(20*3)-6,d0
    1468.    ble.s   .slide2
    1469.    moveq   #(20*3)-1,d0
    1470.    sub   slide_count,d0
    1471.    lsl   #4,d0
    1472.    bra.s   .slide1
    1473. .slide2
    1474. ;   tst   acc
    1475. ;   bne.s   .fuel_ok_98
    1476. ;   subq   #2,scr_spd
    1477. ;   bpl   .all_done
    1478. ;   clr   scr_spd
    1479. ;   clr   slide_count
    1480. ;.fuel_ok_98
    1481.    subq   #1,d0
    1482.    add   d0,d0
    1483.    add   d0,d0
    1484.    cmp   #&#036;60,d0
    1485.    ble.s   .slide1
    1486.    moveq   #&#036;60,d0
    1487. .slide1
    1488.    move   d0,scr_spd
    1489.    bra   .all_done
    1490.  
    1491. .no_slide
    1492.    tst   jump_mode
    1493.    beq   .no_jump
    1494.  
    1495.    cmp   #1,jump_mode
    1496.    bne.s   .not_jm1
    1497.    subq   #1,jump_count2
    1498.    bpl   .all_done
    1499.    move.b   joy_spc1,d0
    1500.    btst   d0,joy1
    1501.    beq.s   .jmp1_ok
    1502.    clr   jump_mode
    1503.    bsr   find_next_target
    1504.    jsr   do_ntarg_sfx
    1505.    bra   .no_jump
    1506. .jmp1_ok
    1507.    addq   #1,jump_mode
    1508. .not_jm1
    1509.    cmp   #2,jump_mode
    1510.    bne.s   .not_jm2
    1511.    addq   #1,jump_count
    1512.    cmp   #(20+(20/2))/2,jump_count
    1513.    bne   .update_jmp
    1514.    addq   #1,jump_mode
    1515.    move   #20*3,jump_count2
    1516.    bra   .update_jmp
    1517. .not_jm2
    1518.    cmp   #3,jump_mode
    1519.    bne.s   .not_jm3
    1520.    cmp   #&#036;58,jump_thrust
    1521.    beq.s   .jmp_th_ok
    1522.    add   #&#036;0b,jump_thrust
    1523. .jmp_th_ok
    1524.    move.b   joy_spc1,d0
    1525.    btst   d0,joy1
    1526.    bne.s   .jump_x
    1527. ;   tst   acc
    1528. ;   beq.s   .jump_x
    1529. ;   moveq   #7,d0
    1530. ;   and   game_del,d0
    1531. ;   bne.s   .fuel_ok_99
    1532. ;   subq   #1,acc
    1533. ;.fuel_ok_99
    1534.  
    1535.    subq   #1,jump_count2
    1536.    bpl   .update_jmp
    1537. .jump_x
    1538.    addq   #1,jump_mode
    1539.    clr   jump_count2
    1540.    bra.s   .update_jmp
    1541. .not_jm3
    1542.    tst   jump_thrust
    1543.    beq.s   .jmp_th_ok2
    1544.    subq   #4,jump_thrust
    1545.    bpl.s   .jmp_th_ok2
    1546.    clr   jump_thrust
    1547. .jmp_th_ok2
    1548.    addq   #1,jump_count
    1549.    cmp   #20,jump_count
    1550.    bne.s   .update_jmp
    1551.  
    1552.    subq   #1,jump_count
    1553.  
    1554.    move   jump_thrust,d0
    1555.    asr   #1,d0
    1556.    move   d0,scr_spd
    1557.  
    1558.    clr   player_y
    1559.  
    1560.    cmp   #20/2,jump_count2
    1561.    beq.s   .th_ok3
    1562.    addq   #1,jump_count2
    1563. .th_ok3
    1564.    tst   jump_thrust
    1565.    bne   .all_done
    1566.    cmp   #20/2,jump_count2
    1567.    bne   .all_done
    1568.  
    1569.    clr   jump_mode
    1570.    clr   player_y
    1571.    rts
    1572.  
    1573. .update_jmp
    1574.    lea   sintab,a0
    1575.    move   jump_count,d0
    1576.    muls   #1024/20,d0
    1577.    add   d0,d0
    1578.    move.b   (a0,d0),d0
    1579.    ext   d0
    1580.    push   d0
    1581.    asr   #2,d0
    1582.    move   d0,player_y
    1583.    asr   #1,d0
    1584.    add   d0,player_y
    1585.  
    1586.    pop   d0
    1587.    asr   #1,d0
    1588.    add   jump_thrust,d0
    1589.    asr   #1,d0
    1590.    move   d0,scr_spd
    1591.    bra   .all_done
    1592. .no_jump
    1593.    btst   #0,d1
    1594.    bne.s   .no_act_slide
    1595.    cmp   #20/4,bb_down
    1596.    ble.s   .no_act_slide
    1597. ;   tst   acc
    1598. ;   beq.s   .no_act_slide
    1599.    move   #20*3,slide_count
    1600.    move   #2,walker_count
    1601.      clr   walker_dir
    1602.    sf   walker_turn
    1603.    bra   .all_done
    1604. .no_act_slide
    1605.  
    1606.    move.b   joy_spc1,d0
    1607.    btst   d0,joy1
    1608.    bne.s   .no_act_jump
    1609.    move   #1,jump_mode
    1610.    clr   jump_count
    1611.    move   #20/5,jump_count2
    1612.    move   #2,walker_count
    1613.    clr   scr_spd
    1614.    clr   walker_dir
    1615.    sf   walker_turn
    1616.    bra   .all_done
    1617. .no_act_jump
    1618.  
    1619.    tst.b   in_lava
    1620.    bne.s   .not_down
    1621.    btst   #0,d1
    1622.    bne.s   .not_up
    1623.    move   #1,walker_dir
    1624.    move   #&#036;12,scr_spd
    1625. .not_up
    1626.    btst   #1,d1
    1627.    bne.s   .not_down
    1628.    move   #-1,walker_dir
    1629.    move   #-&#036;12,scr_spd
    1630. .not_down
    1631.  
    1632. .we_are_warping
    1633.    move   walker_dir,d3
    1634.    btst   #0,game_del+1
    1635.    beq.s   .walk2
    1636.    moveq   #0,d3
    1637. .walk2   add   d3,walker_count
    1638.    and   #7,walker_count
    1639.  
    1640. .all_done
    1641.    rts
    1642.  
    1643. ******************************************************************************
    1644. copter_ctrl
    1645.    tst.b   ctl_off
    1646.    beq.s   .ctl1
    1647.    move.b   ctl_off2,d1
    1648.    bra.s   .ctl2
    1649. .ctl1
    1650.    move.b   joy_spc1,d0
    1651.    btst   d0,joy1       ;*
    1652.    beq   .okay
    1653. .ctl2
    1654.    btst   #0,d1
    1655.    bne.s   .not_up
    1656.    cmp   #6,pitch_ang       ;6
    1657.    bge.s   .okay
    1658.    addq   #2,pitch_ang
    1659.    bra.s   .okay
    1660. .not_up
    1661.    btst   #1,d1
    1662.    bne.s   .not_down
    1663.    cmp   #-6,pitch_ang       ;-6
    1664.    ble.s   .okay
    1665.    subq   #2,pitch_ang
    1666.    bra.s   .okay
    1667. .not_down
    1668.    tst   pitch_ang
    1669.    beq.s   .okay
    1670.    bmi.s   .add
    1671. .sub
    1672.    subq   #1,pitch_ang
    1673.    bra.s   .okay
    1674. .add
    1675.    addq   #1,pitch_ang
    1676. .okay
    1677.    move   pitch_ang,d2
    1678.    move   d2,d0
    1679.    asr   #1,d0
    1680.    neg   d0
    1681.    move   d0,pitch_ang2
    1682.  
    1683.    tst   warp_count       ;WARPSHIP
    1684.    bne.s   .sp_okay
    1685.  
    1686.    moveq   #8,d3
    1687.    move   d1,ccr
    1688.    bcc.s   .is_8
    1689.    bvc.s   .is_8
    1690.    moveq   #4,d3
    1691. .is_8
    1692.    add   d2,d2
    1693.    add   d2,d2
    1694.    add   d2,d2
    1695.    tst   cpu_rspd
    1696.    bne.s   .boss03act
    1697.    add   d2,d2
    1698. .boss03act
    1699.    move   scr_spd,d0
    1700.    cmp   d2,d0
    1701.    beq.s   .sp_okay
    1702.    bge.s   .sp_sub
    1703. .sp_add
    1704.    add   d3,scr_spd
    1705.    bra.s   .sp_okay
    1706. .sp_sub
    1707.    sub   d3,scr_spd
    1708. .sp_okay
    1709.    tst   xspeed
    1710.    beq.s   .xpbd
    1711.    bmi.s   .xpbadd
    1712. .xpbsub   sub   #&#036;80,xspeed
    1713.    bra.s   .xpbd
    1714. .xpbadd   add   #&#036;80,xspeed
    1715. .xpbd
    1716.    move.b   joy_spc1,d0
    1717.    btst   d0,joy1
    1718.    bne.s   .no_xmove
    1719.  
    1720.    btst   #2,d1
    1721.    bne.s   .xnl
    1722.    cmp   #&#036;400,xspeed
    1723.    bge.s   .xnr
    1724.    add   #&#036;100,xspeed
    1725.    bra.s   .xnr
    1726. .xnl
    1727.    btst   #3,d1
    1728.    bne.s   .xnr
    1729.    cmp   #-&#036;400,xspeed
    1730.    ble.s   .xnr
    1731.    sub   #&#036;100,xspeed
    1732. .xnr
    1733.    bra   .nr
    1734. .no_xmove
    1735.  
    1736.    btst   #2,d1
    1737.    bne.s   .nl
    1738.  
    1739.    cmp   #&#036;400,pbank
    1740.    bge.s   .pbd
    1741.    add   #&#036;100,pbank
    1742.    bra.s   .pbd
    1743. .nl
    1744.    btst   #3,d1
    1745.    bne.s   .nr
    1746.  
    1747.    cmp   #-&#036;400,pbank
    1748.    ble.s   .pbd
    1749.    sub   #&#036;100,pbank
    1750.    bra.s   .pbd
    1751. .nr
    1752.    tst   pbank
    1753.    beq.s   .pbd
    1754.    bmi.s   .pbadd
    1755. .pbsub   sub   #&#036;80,pbank
    1756.    bra.s   .pbd
    1757. .pbadd   add   #&#036;80,pbank
    1758. .pbd
    1759.    tst.b   ctl_off
    1760.    bne.s   .not_cd
    1761.    move.b   joy_spc1,d0
    1762.    btst   d0,joy1
    1763.    bne   .not_cd
    1764.    btst   #0,d1
    1765.    bne   .not_cu
    1766.  
    1767.    cmp   #6,yspd
    1768.    bge.s   .cud_okay
    1769.    addq   #2,yspd
    1770.    bra.s   .cud_okay
    1771. .not_cu  
    1772.    btst   #1,d1
    1773.    bne   .not_cd
    1774.    cmp   #-6,yspd
    1775.    ble.s   .cud_okay
    1776.    subq   #2,yspd
    1777.    bra.s   .cud_okay
    1778. .not_cd
    1779.    tst   yspd
    1780.    beq.s   .cud_okay
    1781.    bmi.s   .cud_add
    1782. .cud_sub
    1783.    subq   #1,yspd
    1784.    bra.s   .cud_okay
    1785. .cud_add
    1786.    addq   #1,yspd
    1787. .cud_okay
    1788.    move   yspd,d0
    1789.    add   player_y,d0
    1790.    cmp   min_player_y,d0
    1791.    bge.s   .cud_1
    1792.    move   min_player_y,d0
    1793. .cud_1   cmp   #112-2,d0
    1794.    ble.s   .cud_2
    1795.    move   #112-2,d0
    1796. .cud_2   move   d0,player_y
    1797.    rts
    1798. ******************************************************************************
    1799. striker_ctrl
    1800.    tst.b   ctl_off
    1801.    beq.s   .ctl1
    1802.    move.b   ctl_off2,d1
    1803. .ctl1
    1804.    move   pbank,d0
    1805.  
    1806.    btst   #2,d1
    1807.    bne.s   .nl
    1808.  
    1809.    add   #&#036;180,d0   ;&#036;100
    1810.    cmp   #&#036;400,d0
    1811.    ble.s   .pbd
    1812.    move   #&#036;400,d0
    1813.    bra.s   .pbd
    1814. .nl
    1815.    btst   #3,d1
    1816.    bne.s   .nr
    1817.  
    1818.    sub   #&#036;180,d0   ;&#036;100
    1819.    cmp   #-&#036;400,d0
    1820.    bge.s   .pbd
    1821.    move   #-&#036;400,d0
    1822.    bra.s   .pbd
    1823. .nr
    1824.    tst   d0
    1825.    beq.s   .pbd
    1826.    bmi.s   .pbadd
    1827. .pbsub   sub   #&#036;c0,d0       ;&#036;80
    1828.    bpl.s   .pbd
    1829.    moveq   #0,d0
    1830.    bra.s   .pbd
    1831. .pbadd   add   #&#036;c0,d0       ;&#036;80
    1832.    bmi.s   .pbd
    1833.    moveq   #0,d0
    1834. .pbd   move   d0,pbank
    1835.  
    1836.    ASR   #4+3+1,D0       ;4+3
    1837.  
    1838.    move   d0,d2   ;
    1839.    asr   #1,d2   ;
    1840.    add   d2,d0   ;
    1841.  
    1842.    NEG   D0
    1843. **********************************************
    1844.    ADD   d0,player_x
    1845. **********************************************
    1846.    cmp   #-&#036;65,player_x
    1847.    bge.s   .xd1
    1848.    move   #-&#036;65,player_x
    1849. .xd1   cmp   #&#036;5b,player_x
    1850.    ble.s   .xd2
    1851.    move   #&#036;5b,player_x
    1852. .xd2
    1853.    moveq   #8,d2
    1854.    moveq   #-8,d3
    1855.  
    1856.    moveq   #0,d5       ;
    1857.  
    1858.    move   yspd,d0
    1859.    move.b   joy_do1,d4
    1860.    btst   d4,d1
    1861.    bne.s   .nd
    1862.    cmp   d3,d0
    1863.    beq.s   .ydone
    1864.    subq   #4,d0       ;4
    1865.    bra.s   .ydone
    1866. .nd
    1867.    move.b   joy_up
    1868.    include   coms_equ.s
    1869.    include   obj_equ.s
    1870.  
    1871. dcmp   macros
    1872.    dc.w   (&#092;1)*4,&#092;2
    1873.  
    1874. dup   macros
    1875.    dc.w   -((&#092;1)*4),&#092;2
    1876.  
    1877. dupf   macros
    1878.    dc.w   -(((&#092;1)*4)+1),&#092;2
    1879.  
    1880. divs   MACRO
    1881. **   move   #divider_unit,r14   ;use R14 as ptr to divide unit
    1882.    move   &#092;1,(_d_jr,r14)
    1883.    move   &#092;2,(_d_hrl32,r14)
    1884.    move   (_d_rsr,r14),&#092;2
    1885.    ENDM
    1886.  
    1887. *************************
    1888. * SLAVE Wait-Task Loop. *
    1889. *************************
    1890.  
    1891. game_slave_start:
    1892.    nop
    1893. .game_slave_loop:
    1894.    move   #comport7,r1       ;
    1895.    move   #0,r0           ;clear SLAVE control comport.
    1896.    move.w   r0,(r1)           ;
    1897.  
    1898. .wait_task_loop:
    1899.    POLHOST
    1900.  
    1901.    move.w   (r1),r0           ;
    1902.    cmpeq   #0,r0           ;wait for task.
    1903.    bt   .wait_task_loop       ;
    1904.  
    1905.    move   #task_address+th,r0
    1906.    move   (15*4,r0),r1
    1907.    move   r1,gbr
    1908.    move   (1*4,r0),r1
    1909.    move   (2*4,r0),r2
    1910.    move   (3*4,r0),r3
    1911.    move   (4*4,r0),r4
    1912.    move   (5*4,r0),r5
    1913.    move   (6*4,r0),r6        ;
    1914.    move   (7*4,r0),r7       ;setup SLAVE r1-r14 &amp; GBR.
    1915.    move   (8*4,r0),r8       ;
    1916.    move   (9*4,r0),r9
    1917.    move   (10*4,r0),r10
    1918.    move   (11*4,r0),r11
    1919.    move   (12*4,r0),r12
    1920.    move   (13*4,r0),r13
    1921.    move   (14*4,r0),r14
    1922.    move   (r0),r0
    1923.  
    1924.    nop               ;
    1925.    jsr   (r0)           ;call task address.
    1926.    nop               ;
    1927.  
    1928.    bra   .game_slave_loop   ;return to task loop.
    1929.    nop
    1930.  
    1931.    cnop   0,4           ;align to longword boundry.
    1932.  
    1933. task_address:
    1934.    dc.l   0           ;slave task address.
    1935. task_registers:
    1936.    dc.l   0,0,0,0,0,0,0       ;r1-r7.
    1937.    dc.l   0,0,0,0,0,0,0       ;r8-r14.
    1938.    dc.l   0           ;GBR.
    1939.  
    1940.    lits
    1941.  
    1942. **************************
    1943. * MASTER Wait-Task Loop. *
    1944. **************************
    1945.  
    1946. game_master_start:
    1947. ;   mcom   &#036;000c
    1948. ;   move   #comport5,r1       ;
    1949. ;   move.w   (r1),r0           ;read Megadrive PAL/NTSC flag.
    1950. ;   move   #pal_ntsc,r1       ;
    1951. ;   move.w   r0,(r1)
    1952.  
    1953.    move   #_sysreg,r1       ;allow SH2 to access VDP +
    1954.    move.w   #&#036;8008+PWMIRQ_ON,r0       ;enable VBL interrupts.
    1955.    move.w   r0,(r1)           ;
    1956.  
    1957.    move.w   r0,(vintclr,r1)       ;clear VINT ACK register.
    1958.    move.w   r0,(vintclr,r1)       ;
    1959.  
    1960.    move   #_frt,r1
    1961.    move   #0,r0
    1962.    move.b   r0,(_tier,r1)
    1963.    move   #&#036;c2,r0
    1964.    move.b   r0,(_tocr,r1)
    1965.    move   #0,r0
    1966.    move.b   r0,(_ocr_h,r1)       ;
    1967.    move   #1,r0           ;set free run timer.
    1968.    move.b   r0,(_ocr_l,r1)       ;
    1969.    move   #0,r0
    1970.    move.b   r0,(_tcr,r1)
    1971.    move   #1,r0
    1972.    move.b   r0,(_tcsr,r1)
    1973.    move   #0,r0
    1974.    move.b   r0,(_frc_l,r1)
    1975.    move.b   r0,(_frc_h,r1)
    1976.  
    1977.    move   #initPWM,r0
    1978.    jsr   (r0)
    1979.    nop
    1980.  
    1981.    move   #&#036;20,r0           ;SH interrupt enable.
    1982.    move   r0,sr           ;
    1983.  
    1984.    bsr   setup_screen       ;clear both screens
    1985.    nop
    1986.  
    1987.    MOVE   #COMPORT6,R0       ;
    1988.    MOVE   #&#036;8000,R1       ;ENABLE FADE.
    1989.    MOVE.W   R1,(R0)           ;
    1990. .loop
    1991.    move   #comport0,r1       ;get command
    1992.    move.w   (r1),r0
    1993.    cmpeq   #0,r0
    1994.    bt   .loop
    1995.  
    1996.    move.w   (r1),r3           ;allow port to settle
    1997.    cmpeq   r3,r0
    1998.    bf   .loop
    1999.  
    2000.    move   #com_last,r3
    2001.    cmphi   r3,r0
    2002.    bt   .loop
    2003.  
    2004.    move   #.jump_tab-4,r2
    2005.    add   r0,r2
    2006.    move   (r2),r0
    2007.  
    2008.    jsr   (r0)           ;...and call it
    2009.    nop
    2010.  
    2011.    move   #comport0,r1       ;get command
    2012.    move   #0,r3           ;clear command port
    2013.    move.w   r3,(r1)
    2014.  
    2015.    bra   .loop
    2016.    nop
    2017.  
    2018.    cnop   0,4
    2019.  
    2020.    dc.l   0
    2021. .jump_tab
    2022.    dc.l   wait_vbl
    2023.    dc.l   flip_screen
    2024.    dc.l   clear_screen
    2025.    dc.l   plot_sc_sprite
    2026.    dc.l   plot_pixel
    2027.    dc.l   plot_sprite
    2028.    dc.l   decompress_level
    2029.    dc.l   decompress_360_level
    2030.    dc.l   draw_360_floor
    2031.    dc.l   alloc_reset
    2032.    dc.l   PlayPWM
    2033.    dc.l   rotate_player
    2034.  
    2035.      lits
    2036.  
    2037. pal_ntsc   dc.w   0           ;PAL/NTSC flag from Megadrive.
    2038.  
    2039. ************************
    2040. * Plot point to screen *
    2041. ************************
    2042.  
    2043.    cnop   0,4
    2044.  
    2045. plot_pixel
    2046.    move   #comport1,r0
    2047.    move.w   (r0)+,r1       ;get x
    2048.    move.w   (r0)+,r2       ;get y
    2049.    move.w   (r0)+,r3       ;get colour
    2050.  
    2051.    move.w   #224,r4
    2052.    cmphs   r4,r2
    2053.    bt   .exit
    2054.  
    2055.    move.w   #320,r4
    2056.    muls   r4,r2
    2057.    cmphs   r4,r1
    2058.    bt   .exit
    2059.  
    2060.    move   #screen,r0
    2061.    move   macl,r2
    2062.    add   r1,r0
    2063.    add   r2,r0
    2064.    move.b   r3,(r0)
    2065. .exit
    2066.    rts
    2067.    nop
    2068.  
    2069.    lits
    2070.  
    2071. *************************
    2072. * Draw sprite to screen *
    2073. *************************
    2074.  
    2075.    cnop   0,4
    2076.  
    2077. plot_sprite
    2078.    move   #comport1,r0
    2079.    move.w   (r0)+,r2       ;get x
    2080.    move.w   (r0)+,r3       ;get y
    2081.    move.w   (r0),r8           ;get def
    2082.  
    2083.    shll2   r8
    2084.    move   #frame_table,r0
    2085.    add   r8,r0
    2086.    move   (r0),r0
    2087.  
    2088.    cmpeq   #0,r0       ;frame unused?
    2089.    bf   .skip
    2090.    move   #sp_ringcannon,r0
    2091. ;.exit
    2092. ;   rts
    2093. ;   nop
    2094. .skip
    2095.    move.w   (r0)+,r4       ;get xsize
    2096.    move.w   (r0)+,r5       ;get ysize
    2097.    add   #4,r0
    2098.  
    2099.    bra   draw_sprite
    2100.    move   r0,r1           ;R1 = source data
    2101.  
    2102. *************************
    2103. * Draw sprite to screen *
    2104. *************************
    2105.  
    2106.    cnop   0,4
    2107.  
    2108. plot_sc_sprite
    2109.    move   #comport1,r0
    2110.    move.w   (r0)+,r2       ;get x
    2111.    move.w   (r0)+,r3       ;get y
    2112.    move.w   (r0)+,r6       ;get scale
    2113.    move.w   (r0),r8           ;get def
    2114.  
    2115.    shll2   r8
    2116.    move   #frame_table,r0
    2117.    add   r8,r0
    2118.    move   (r0),r0
    2119.  
    2120.    cmpeq   #0,r0       ;frame unused?
    2121.    bf   .skip
    2122.    move   #sp_ringcannon,r0
    2123. ;.exit
    2124. ;   rts
    2125. ;   nop
    2126. .skip
    2127.    move   #1,r11   ;flip flag into R11 (0 = unflipped , 1 = flipped)
    2128.    and   r0,r11   ;
    2129.    sub   r11,r0   ;
    2130.    
    2131.    move.w   (r0)+,r4       ;get xsize
    2132.    move.w   (r0)+,r5       ;get ysize
    2133.    move.w   (r0)+,r8       ;get x-off
    2134.    move.w   (r0)+,r9       ;get y-off
    2135.  
    2136.    shll8   r8
    2137.    shll8   r9
    2138.    shll2   r8
    2139.    shll2   r9
    2140.    shll   r8
    2141.    shll   r9
    2142.  
    2143.    move   r0,r1           ;R1 = source data
    2144.    move   r11,r0
    2145.  
    2146.    move   #divider_unit,r10
    2147.  
    2148.    move   r6,(_d_jr,r10)
    2149.    move   r8,(_d_hrl32,r10)
    2150.    move   (_d_rsr,r10),r8
    2151.    cmpeq   #0,r0
    2152.    bt   .2
    2153.    neg   r8,r8
    2154. .2
    2155.    sub   r8,r2
    2156.  
    2157.    move   r6,(_d_jr,r10)       ;is this trashed??
    2158.    move   r9,(_d_hrl32,r10)
    2159.    move   (_d_rsr,r10),r9
    2160.    sub   r9,r3
    2161.    
    2162.    shll2   r6
    2163.    shll2   r6
    2164.    shll   r6
    2165.  
    2166.    cmpeq   #0,r0
    2167.    bf/s   .1
    2168.    move   r6,r7           ;yscale = xscale
    2169.  
    2170.    bra   scale_sprite
    2171.    nop
    2172. .1
    2173.    bra   scale_flip_sprite
    2174.    nop
    2175.  
    2176.    lits
    2177.  
    2178. *********************
    2179. * DMAC clear screen *
    2180. *********************
    2181.  
    2182.    cnop   0,4
    2183.  
    2184. dmac_clear
    2185.    move   #_dmasource1,r8   ;point to DMAC.
    2186.  
    2187.    move   #0,r3
    2188.    move.w   r3,(r1)
    2189.  
    2190.    move   (12,r8),r0   ;read (clear TE flag)
    2191.  
    2192.    move   #0,r0       ;stop DMA.
    2193.    move   r0,(12,r8)   ;
    2194.  
    2195.    move   #01,r0   ;enable DMA.
    2196.    move   r0,(32,r8)   ;
    2197.  
    2198.    move   r1,(r8)       ;store DMA source address.
    2199.        
    2200.    move   r1,(4,r8)   ;store DMA destination address.
    2201.        
    2202.    move   r2,r0       ;store DMA size.
    2203.    move   r0,(8,r8)   ;
    2204.  
    2205.    move   #%0100011000000001,r0   ;start DMA.
    2206.    move   r0,(12,r8)       ;
    2207.  
    2208.    rts
    2209.    nop
    2210.  
    2211.    lits
    2212.  
    2213. ****************************
    2214. * Clear Screen - 360 stage *
    2215. ****************************
    2216.  
    2217. clear_screen_360
    2218.    stack
    2219.  
    2220.    swait
    2221.  
    2222.    move   #task_address+th,r5   ;point to SLAVE task setup.
    2223.  
    2224.    move   #screen+(136*160),r1
    2225.    move   r1,(1*4,r5)
    2226.  
    2227.    move   #.clear,r0
    2228.    move   r0,(r5)
    2229.    move   #comport7,r14
    2230.    move   #1,r0
    2231.    move.w   r0,(r14)
    2232.  
    2233.    bsr   .clear
    2234.    move   #screen,r1
    2235.  
    2236.    unstack
    2237.    rts
    2238.    nop
    2239.  
    2240.    cnop   0,4
    2241.  
    2242. .clear
    2243.    move   #(136*320)/4,r0
    2244.    move   #0,r2
    2245. .clr_loop:
    2246.    move.w   r2,(r1)
    2247.    dt   r0
    2248.    bf/s   .clr_loop
    2249.    add   #2,r1
    2250.  
    2251.    rts
    2252.    nop
    2253.  
    2254.    cnop   0,4
    2255.  
    2256. ****************
    2257. * Clear Screen *
    2258. ****************
    2259.  
    2260. clear_screen
    2261.    stack
    2262.  
    2263.    swait
    2264.  
    2265.    move   #task_address+th,r5   ;point to SLAVE task setup.
    2266.  
    2267.    move   #screen+(224*160),r1
    2268.    move   r1,(1*4,r5)
    2269.  
    2270.    move   #.clear,r0
    2271.    move   r0,(r5)
    2272.    move   #comport7,r14
    2273.    move   #1,r0
    2274.    move.w   r0,(r14)
    2275.  
    2276.    bsr   .clear
    2277.    move   #screen,r1
    2278.  
    2279.    swait
    2280.  
    2281.    unstack
    2282.    rts
    2283.    nop
    2284.  
    2285.    cnop   0,4
    2286.  
    2287. .clear
    2288.    move   #(224*320)/4,r0
    2289.    move   #0,r2
    2290. .clr_loop:
    2291.    move.w   r2,(r1)
    2292.    dt   r0
    2293.    bf/s   .clr_loop
    2294.    add   #2,r1
    2295.  
    2296.    rts
    2297.    nop
    2298.  
    2299.    lits
    2300.  
    2301. wait_slave
    2302.    push   r1
    2303.  
    2304.    move   #comport7,r1   ;point to slave control comport.
    2305. .wait_slave
    2306.    move.w   (r1),r0       ;
    2307.    cmpeq   #0,r0       ;wait slave.
    2308.    bf   .wait_slave   ;
    2309.    rts
    2310.    pop   r1
    2311.  
    2312. start_slave
    2313.    push   r1
    2314.    move   r0,(r5)
    2315.    move   #comport7,r1
    2316.    move   #1,r0
    2317.    move.w   r0,(r1)
    2318.    rts
    2319.    pop   r1
    2320.  
    2321. *************************************
    2322. * Clear Screen + Setup Line-Tables. *
    2323. *************************************
    2324.  
    2325. setup_screen:
    2326.    stack
    2327.  
    2328.    move   #fb_cont_reg,r14
    2329.  
    2330.    move   #bm_mode_reg+1,r0   ;
    2331.    move.w   #%10000001,r1       ;byte per pixel mode.
    2332.    move.b   r1,(r0)           ;
    2333.  
    2334.    move   #&#036;8000,r1
    2335.    move   #palette,r0
    2336.    move.w   r1,(r0)
    2337.  
    2338.    move   #1,r13
    2339.    bsr   .clear_flip       ;
    2340.    nop               ;clear both flipscreens.
    2341.    move   #0,r13           ;
    2342.    bsr   .clear_flip
    2343.    nop
    2344.  
    2345.    unstack
    2346.  
    2347.    rts
    2348.    nop
    2349.  
    2350. .clear_flip
    2351.    stack
    2352.  
    2353.    move.w   r13,(r14)       ;
    2354.    bsr   wait_vbl       ;select frame buffer.
    2355.    nop               ;
    2356.  
    2357.    move   #screen,r0       ;
    2358.    move   #(240*320)/2,r1       ;setup screen clear loop.
    2359.    move   #0,r2           ;
    2360. .clr_loop:
    2361.    move.w   r2,(r0)           ;
    2362.    add   #2,r0           ;clear screen buffer.
    2363.    dt   r1           ;
    2364.    bf   .clr_loop
    2365.  
    2366.    move   #line_table,r0       ;
    2367.    move.w   #&#036;1e0/2,r1       ;setup linestart setup loop.
    2368.    move.w   #160,r2           ;
    2369.    move.w   #240,r3
    2370. .set_line_loop:
    2371.    move.w   r1,(r0)           ;write linestart.
    2372.  
    2373.    add   r2,r1           ;
    2374.    add   #2,r0           ;setup all linestarts.
    2375.    dt   r3           ;
    2376.    bf   .set_line_loop
    2377.  
    2378.    unstack
    2379.  
    2380.    rts
    2381.    nop
    2382.  
    2383.    lits
    2384.  
    2385. ****************
    2386. * Flip Screen. *
    2387. ****************
    2388.  
    2389. flip_screen:
    2390.    move   #flip_enable+th,r1   ;point to flip flag.
    2391. .wait:
    2392.    move.w   (r1),r0           ;
    2393.    cmpeq   #0,r0           ;buffer flips.
    2394.    bf   .wait           ;
    2395.  
    2396.    move   #1,r0           ;flag flip.
    2397.    move.w   r0,(r1)           ;
    2398.  
    2399.    rts
    2400.    nop
    2401.  
    2402.    lits
    2403.  
    2404. *******************
    2405. * Wait for A VBL. *
    2406. *******************
    2407.  
    2408. wait_vbl:
    2409.    move   #vbl_count+th,r1   ;setup VBL wait loop.
    2410.    move.w   (r1),r0           ;
    2411. .loop:
    2412.    move.w   (r1),r2           ;
    2413.    cmpeq   r0,r2           ;wait for VBL_COUNT to change.
    2414.    bt   .loop           ;
    2415.  
    2416.    rts
    2417.    nop
    2418.  
    2419.    lits
    2420.  
    2421. ************************************
    2422. * Enable,Disable &amp; Set Fade Level. *
    2423. ************************************
    2424.  
    2425. set_fade:
    2426.    push   r0
    2427.  
    2428.    move   #comport6,r0       ;write fade value to comport.
    2429.    move.w   r4,(r0)           ;
    2430.  
    2431.    pop   r0
    2432.  
    2433.    rts
    2434.    nop
    2435.  
    2436. *****************************
    2437. * Setup Pointer to Palette. *
    2438. *****************************
    2439.  
    2440. set_palette:
    2441.    move   #pal_ptr,r0       ;setup pointer for VBL.
    2442.    move   r4,(r0)           ;
    2443.  
    2444.    rts
    2445.    nop
    2446.  
    2447. *************************
    2448. * Master VBL Interrupt. *
    2449. *************************
    2450.  
    2451. vblank:
    2452.    move   #vbl_count+th,r1   ;
    2453.    move.w   (r1),r0           ;update VBL count.
    2454.    add   #1,r0           ;
    2455.    move.w   r0,(r1)
    2456.  
    2457.    move   #flip_enable+th,r1   ;
    2458.    move.w   (r1),r0           ;flip screen?
    2459.    cmpeq   #0,r0           ;
    2460.    bt   .no_flip
    2461.  
    2462.    move   #0,r0           ;flag screen flipped.
    2463.    move.w   r0,(r1)           ;
    2464.  
    2465.    move   #fb_cont_reg+1,r1   ;
    2466.    move.b   (r1),r0           ;flip VDP bank.
    2467.    not   r0,r0           ;
    2468.    move.b   r0,(r1)
    2469. .no_flip:
    2470.    move   #comport6,r0       ;
    2471.    move.w   (r0),r0           ;fade screen?
    2472.    cmppz   r0           ;
    2473.    bt   .no_fade
    2474.  
    2475.    push   r2
    2476.    push   r3
    2477.    push   r4
    2478.    push   r5
    2479.    push   r6
    2480.    push   r7
    2481.    push   r8
    2482.    push   r9
    2483.    push   r10
    2484.    push   r11
    2485.  
    2486.    move   r0,r6           ;copy fade value.
    2487.  
    2488.    move   #game_pal+2,r0       ;
    2489.    move   #palette+2,r1       ;setup palette fade loop.
    2490.    move   #256-1,r2       ;
    2491.  
    2492.    move   #0000000011111,r3   ;
    2493.    move   #0001111100000,r4   ;setup palette fade masks.
    2494.    move   #%111110000000000,r5   ;
    2495.  
    2496.    and   r3,r6           ;mask out fade value (0-31).
    2497.  
    2498.    move   r6,r7
    2499.    shll2   r7
    2500.    shll2   r7           ;
    2501.    shll   r7           ;setup palette subtractors.
    2502.    move   r6,r8           ;
    2503.    shll8   r8
    2504.    shll2   r8
    2505. .fade_pal_loop:
    2506.    move.w   (r0)+,r9       ;
    2507.    move   r9,r10           ;read RGB value.
    2508.    move   r9,r11           ;
    2509.  
    2510.    and   r3,r9
    2511.    sub   r6,r9           ;
    2512.    cmppz   r9           ;reduce blue componant.
    2513.    bt   .no_blue       ;
    2514.    move   #0,r9
    2515. .no_blue:
    2516.    and   r4,r10
    2517.    sub   r7,r10           ;
    2518.    cmppz   r10           ;reduce green componant.
    2519.    bt   .no_green       ;
    2520.    move   #0,r10
    2521. .no_green:
    2522.    and   r5,r11
    2523.    sub   r8,r11           ;
    2524.    cmppz   r11           ;reduce red componant.
    2525.    bt   .no_red           ;
    2526.    move   #0,r11
    2527. .no_red:
    2528.    or   r10,r9           ;
    2529.    or   r11,r9           ;write RGB value.
    2530.    move.w   r9,(r1)           ;
    2531.  
    2532.    dt   r2           ;
    2533.    bf/s   .fade_pal_loop       ;fade whole palette.
    2534.    add   #2,r1           ;
    2535.  
    2536.    pop   r11
    2537.    pop   r10
    2538.    pop   r9
    2539.    pop   r8
    2540.    pop   r7
    2541.    pop   r6
    2542.    pop   r5
    2543.    pop   r4
    2544.    pop   r3
    2545.    pop   r2
    2546. .no_fade:
    2547.    push   r2
    2548.    move.w   #(&#036;0F&lt;&lt;10)+(&#036;17&lt;&lt;5),r2
    2549.    move   #vbl_count+th,r1
    2550.    move.w   (r1),r0
    2551.    tst   #1,r0
    2552.    bt   .skip
    2553.    move   #0,r2
    2554. .skip   move   #engine_glow,r0
    2555.    move.w   (r0),r1
    2556.    xor   r2,r1
    2557.    move.w   r1,(r0)
    2558.    move   #palette+(192*2),r0
    2559.    move.w   r1,(r0)
    2560.    pop   r2
    2561.  
    2562.    POLHOST
    2563.  
    2564.    rts
    2565.    nop
    2566.  
    2567.    lits
    2568.  
    2569.    cnop   0,4
    2570.  
    2571. floor_map   dc.l   0
    2572. floor_blocks   dc.l   0
    2573. map_lookup   dc.l   0 ;128*8*2 = 90 blocks,8 rotations,2 longwords each.
    2574. tvb_table   dc.l   0 ;ysize*4
    2575.  
    2576. vcnt       dc.l   &#036;ff00
    2577. scr_ptr       dc.l   screen
    2578. pal_ptr       dc.l   game_pal+2
    2579. alloc_ptr2   dc.l   0
    2580.  
    2581. vbl_count   dc.w   0
    2582. flip_enable   dc.w   0
    2583. engine_glow   dc.w   (&#036;1F&lt;&lt;10)+(&#036;1F&lt;&lt;5)
    2584.  
    2585. ship1_pal   incbin   sprites&#092;ship1&#092;ship.pal
    2586. ship2_pal   incbin   sprites&#092;ship2&#092;ship2.pal
    2587.  
    2588. game_pal
    2589.    incbin   panel.pal
    2590.    incbin   sprites&#092;ship2&#092;ship2.pal
    2591. game2_pal
    2592.    incbin   level02.pal
    2593.    incbin   sprite.pal
    2594.  
    2595. ******************************************************************************
    2596.  
    2597.    include   sprite.sh2
    2598.    include   floor.sh2
    2599.    include   pwm.sh2
    2600.    include   rotspr.sh2
    2601.  
    2602.    cnop   0,4
    2603.  
    2604. frame_table
    2605.    dc.l   sp_pl_ship00
    2606.    dc.l   sp_pl_ship01
    2607.    dc.l   sp_pl_ship02
    2608.    dc.l   sp_pl_ship03
    2609.    dc.l   sp_pl_ship04
    2610.    dc.l   sp_pl_ship05
    2611.    dc.l   sp_pl_ship06
    2612.    dc.l   sp_pl_ship07
    2613.    dc.l   sp_pl_ship08
    2614.    dc.l   sp_pl_ship09
    2615.    dc.l   sp_pl_ship10
    2616.    dc.l   sp_pl_ship11
    2617.    dc.l   sp_pl_ship12
    2618.    dc.l   sp_pl_ship13
    2619.    dc.l   sp_pl_ship14
    2620.    dc.l   sp_pl_ship05+1
    2621.    dc.l   sp_pl_ship06+1
    2622.    dc.l   sp_pl_ship07+1
    2623.    dc.l   sp_pl_ship08+1
    2624.    dc.l   sp_pl_ship09+1
    2625.    dc.l   sp_pl_ship00+1
    2626.    dc.l   sp_pl_ship01+1
    2627.    dc.l   sp_pl_ship02+1
    2628.    dc.l   sp_pl_ship03+1
    2629.    dc.l   sp_pl_ship04+1
    2630.  
    2631.    ds.l   25
    2632.  
    2633.    dc.l   sp_tc_ship09
    2634.    dc.l   sp_tc_ship10
    2635.    dc.l   sp_tc_ship11
    2636.    dc.l   sp_tc_ship12
    2637.    dc.l   sp_tc_ship13
    2638.    dc.l   sp_tc_ship14
    2639.    dc.l   sp_tc_ship15
    2640.    dc.l   sp_tc_ship16
    2641.    dc.l   sp_tc_ship17
    2642.    dc.l   sp_tc_ship00
    2643.    dc.l   sp_tc_ship01
    2644.    dc.l   sp_tc_ship02
    2645.    dc.l   sp_tc_ship03
    2646.    dc.l   sp_tc_ship04
    2647.    dc.l   sp_tc_ship05
    2648.    dc.l   sp_tc_ship06
    2649.    dc.l   sp_tc_ship07
    2650.    dc.l   sp_tc_ship08
    2651.    dc.l   sp_tc_ship09+1
    2652.    dc.l   sp_tc_ship10+1
    2653.    dc.l   sp_tc_ship11+1
    2654.    dc.l   sp_tc_ship12+1
    2655.    dc.l   sp_tc_ship13+1
    2656.    dc.l   sp_tc_ship14+1
    2657.    dc.l   sp_tc_ship15+1
    2658.    dc.l   sp_tc_ship16+1
    2659.    dc.l   sp_tc_ship17+1
    2660.  
    2661.    dc.l   sp_plasma_shot   ;o_weap1
    2662.  
    2663.    ds.l   4   ;o_srocks
    2664.    ds.l   42   ;o_enemy1
    2665.  
    2666.    dc.l   sp_gro_exp00   ;o_gro_exp
    2667.    dc.l   sp_gro_exp01
    2668.    dc.l   sp_gro_exp02
    2669.    dc.l   sp_gro_exp03
    2670.    dc.l   sp_gro_exp04
    2671.    dc.l   sp_gro_exp05
    2672.    dc.l   sp_gro_exp06
    2673.    dc.l   sp_gro_exp07
    2674.    dc.l   sp_gro_exp08
    2675.    dc.l   sp_gro_exp09
    2676.    dc.l   sp_gro_exp10
    2677.    dc.l   sp_gro_exp11
    2678.    dc.l   sp_gro_exp12
    2679.    dc.l   sp_gro_exp13
    2680.    dc.l   sp_gro_exp14
    2681.  
    2682.    dc.l   sp_air_exp00   ;o_air_exp
    2683.    dc.l   sp_air_exp01
    2684.    dc.l   sp_air_exp02
    2685.    dc.l   sp_air_exp03
    2686.    dc.l   sp_air_exp04
    2687.    dc.l   sp_air_exp05
    2688.    dc.l   sp_air_exp06
    2689.    dc.l   sp_air_exp07
    2690.    dc.l   sp_air_exp08
    2691.    dc.l   sp_air_exp09
    2692.  
    2693.    dme_del
    2694.    bne.s   .ng_roll
    2695.    or   #&#036;1000,game_del
    2696. .ng_roll:
    2697. ***************************************
    2698.    move   scr_spd,d0
    2699.    IF   l_type=0
    2700.    muls   #&#036;3334,d0
    2701.    swap   d0
    2702.    add   scr_spd,d0
    2703.    ENDIF
    2704.    move   d0,scr_spd2
    2705. ***************************************
    2706.    tst   sh_hit_num
    2707.    beq.s   .sh_hit_ok
    2708.    tst   dying_cnt
    2709.    bne.s   .sh_hit_ok
    2710.    subq   #1,sh_hit_del
    2711.    bpl.s   .sh_hit_ok
    2712.    subq   #1,sh_hit_num
    2713.    jsr   do_low_shield_sfx
    2714.    move   #sh_del,sh_hit_del
    2715. .sh_hit_ok:
    2716. ***************************************
    2717.    jsr   pickup_system
    2718.    cmp   #04,level
    2719.    bne.s   .not_gigun
    2720.    jsr   gigun_checks
    2721. .not_gigun:
    2722.    jsr   end_fader
    2723. ***************************************
    2724.    sf   hit_sfx_already
    2725.  
    2726.    tst   torpedo_count
    2727.    beq.s   .normal_pals
    2728.    subq   #1,torpedo_count
    2729.    moveq   #1,d0
    2730.    and   torpedo_count,d0
    2731.    beq.s   .normal_pals
    2732.    move   #&#036;777f,torp_fade
    2733.    bra.s   .p4
    2734. .normal_pals:
    2735.    clr   torp_fade
    2736. .p4:
    2737. ***************************************
    2738.    jsr   level_flipper
    2739. ***************************************
    2740.    clr   tmp_slot
    2741. ***************************************
    2742. * Do all processing here&#33; *
    2743. ***************************
    2744.    subq   #1,gcnt3
    2745.    bpl.s   .gcnt3
    2746.    move   #3-1,gcnt3
    2747. .gcnt3:
    2748.    subq   #1,gcnt5
    2749.    bpl.s   .gcnt5
    2750.    move   #5-1,gcnt5
    2751. .gcnt5:
    2752.    subq   #1,gcnt6
    2753.    bpl.s   .gcnt6
    2754.    move   #6-1,gcnt6
    2755. .gcnt6:
    2756.    subq   #1,gcnt9
    2757.    bpl.s   .gcnt9
    2758.    move   #9-1,gcnt9
    2759. .gcnt9:
    2760.    subq   #1,gcnt10
    2761.    bpl.s   .gcnt10
    2762.    move   #9-1,gcnt10
    2763. .gcnt10:
    2764.    subq   #1,gcnt12
    2765.    bpl.s   .gcnt12
    2766.    move   #12-1,gcnt12
    2767. .gcnt12:
    2768.    subq   #1,gcnt19
    2769.    bpl.s   .gcnt19
    2770.    move   #19-1,gcnt19
    2771. .gcnt19:
    2772.    tst   dying_cnt
    2773.    beq.s   .not_dying
    2774.    jsr   do_player_dying
    2775.    bra.s   .no_ctl
    2776. .not_dying:
    2777.    tst   startup_count
    2778.    bne.s   .no_ctl
    2779.    jsr   do_v_control
    2780. .no_ctl:
    2781.    tst.b   is_360
    2782.    beq.s   .no_360
    2783.    jsr   set_360_map_pos
    2784. .no_360:
    2785. ***************************************
    2786.    bsr   level_control
    2787. ***************************************
    2788.    jsr   handle_qsounds
    2789. ***************************************
    2790.    jsr   create_enemies
    2791.    jsr   get_all_enemies
    2792.    jsr   get_all_weapons
    2793.    jsr   do_next_weapon
    2794. ******************************************************************************
    2795. * Check for 2nd player *
    2796. ************************
    2797.    tst.b   ply2mode
    2798.    beq.s   .1player_only
    2799.    jsr   do_next_weapon_2
    2800.    jsr   player_2_control
    2801.    jsr   player_2_weapons
    2802.    bra.s   .2player_done
    2803. .1player_only:
    2804.    jsr   power_transfer_1p
    2805.    cmp   #2,vehicle
    2806.    bne.s   .not_walker1
    2807.    jsr   do_1p_walker_targetting
    2808.  
    2809.    tst   poptarg
    2810.    beq.s   .no_poptarg
    2811.    subq   #1,poptarg
    2812.    move.l   mtarget,d0
    2813.    beq.s   .no_poptarg
    2814.    move.l   d0,a6
    2815.    move   mob_x(a6),d0
    2816.    move   mob_y(a6),d1
    2817.    moveq   #0,d2
    2818.    moveq   #0,d6
    2819.    lea   node_msight,a6
    2820.    movem   d0/d1/d2/d6/d7,node_data(a6)
    2821.    move   #ot_msight,mob_type(a6)
    2822.    jsr   insert_sprite
    2823. .no_poptarg:
    2824.  
    2825.    bra.s   .2player_done
    2826. .not_walker1:
    2827.    lea   weapon_tab,a0
    2828.    add   weapon,a0
    2829.    cmp.b   #pw_bomblet,(a0)
    2830.    bne.s   .2player_done
    2831.    jsr   handle_missile_sight
    2832. .2player_done:
    2833. ******************************************************************************
    2834.    jsr   plot_rams
    2835.    jsr   plot_player
    2836.    tst   charge_cnt
    2837.    beq.s   .not_charging
    2838.    jsr   insert_charge_spr
    2839. .not_charging:
    2840. ***************************************
    2841.    moveq   #1,d0
    2842.    and   torpedo_count,d0
    2843.    bne   .no_pause
    2844.    cmp   #16,game_del
    2845.    ble   .no_pause
    2846.    tst   end_fade
    2847.    bne   .no_pause
    2848.    tst   fade_count
    2849.    bne   .no_pause
    2850.  
    2851.    tst.b   ply2mode
    2852.    beq.s   .not_2ply_99
    2853.    btst   #button_pause,joy1_2
    2854.    beq.s   .pausing
    2855. .not_2ply_99:
    2856.    btst   #button_pause,joy1
    2857.    bne   .no_pause
    2858. .pausing:
    2859.    move.l   cs_reltime,-(sp)
    2860.    jsr   pause_sound
    2861. .pw1:
    2862.    jsr   wait_vbl
    2863.    jsr   readpad
    2864.  
    2865.    tst.b   ply2mode
    2866.    beq.s   .not_2ply_98
    2867.    btst   #button_pause,joy1_2
    2868.    beq   .pw1
    2869. .not_2ply_98:
    2870.    btst   #button_pause,joy1
    2871.    beq   .pw1
    2872. .pw2:
    2873.    jsr   wait_vbl
    2874.    jsr   readpad
    2875.  
    2876.    tst.b   ply2mode
    2877.    beq.s   .not_2ply_97
    2878.    btst   #button_pause,joy1_2
    2879.    beq.s   .pw3
    2880. .not_2ply_97:
    2881.    btst   #button_pause,joy1
    2882.    bne.s   .pw2
    2883. .pw3:
    2884.    jsr   wait_vbl
    2885.    jsr   readpad
    2886.    btst   #button_pause,joy1
    2887.    beq.s   .pw3
    2888.    tst.b   ply2mode
    2889.    beq.s   .not_2ply_96
    2890.    btst   #button_pause,joy1_2
    2891.    beq.s   .pw3
    2892. .not_2ply_96:
    2893.    jsr   unpause_sound
    2894.    move.l   (sp)+,cs_reltime
    2895. .no_pause:
    2896. ******************************************************************************
    2897.    jsr   term_list
    2898.  
    2899.    cmp   #26,level
    2900.    beq.s   .bodge_26
    2901.    cmp   #08,level
    2902.    bne.s   .not_bodge_08
    2903. .bodge_26:
    2904.    jsr   draw_underside
    2905. .not_bodge_08:
    2906.  
    2907.    move.l   floorB,d0
    2908.    move.l   floorF,floorB
    2909.    move.l   d0,floorF
    2910.  
    2911.    move.l   scrB,d0
    2912.    move.l   scrF,scrB
    2913.    move.l   d0,scrF
    2914.  
    2915.    move.l   listB,d0
    2916.    move.l   listF,listB
    2917.    move.l   d0,listF
    2918.  
    2919. ;   MOVE.B   #16,shield
    2920.  
    2921. ******************************************************************************
    2922.    cmp.b   #2,reset_flag
    2923.    beq   main_start
    2924. ******************************************************************************
    2925.  
    2926.    tst   dying_cnt
    2927.    bne.s   .die1
    2928.  
    2929.    cmp.b   #-2,shield
    2930.    bge   mloop
    2931.    tst   timer_val
    2932.    beq.s   .no_stop_music
    2933.    jsr   stop_music
    2934. .no_stop_music:
    2935.    st   deact_weaps
    2936.    jsr   do_exp2_sfx
    2937. .die1:
    2938.    cmp   #20*2,dying_cnt
    2939.    bne.s   .die2
    2940.    clr   last_plyhit
    2941. .die2:
    2942.    jsr   dying_fader
    2943.    addq   #1,dying_cnt
    2944.    cmp   #20*4,dying_cnt
    2945.    bne   mloop
    2946.  
    2947.    sf   in_game
    2948.    jsr   scroff
    2949.    jsr   set_scron_delay
    2950.  
    2951.    lea   stack,sp
    2952.    subq   #1,lives
    2953.    bne   continue_game
    2954.  
    2955. * All lives gone&#33;
    2956.  
    2957. ;   lea   the_end_seq_file,a1
    2958. ;   jsr   play_anim
    2959. ;   jsr   fade_out_anim
    2960.  
    2961.    clr   dying_fade_val
    2962.    moveq   #TITLE_FILE,d0
    2963.    jsr   load_files
    2964.    jsr   hiscore_game_over
    2965.  
    2966.    jmp   main_start2
    2967.  
    2968. continue_game:
    2969.    bsr   restart_life_lost
    2970.    bsr   level_setup
    2971. *************************************************
    2972.    lea   node_head,a0
    2973.    lea   node_tail,a1
    2974.    move.l   a1,node_next(a0)
    2975.    move.l   a0,node_prev(a1)
    2976.    clr   game_del
    2977. *************************************************
    2978.    bra   mloop
    2979. ******************************************************************************
    2980. init_startup:
    2981.    move   #63+20,startup_count
    2982.    jmp   do_thrusting_sfx
    2983.  
    2984. do_pl_startup:
    2985.    moveq   #&#036;00000037,d0
    2986.    move.l   d0,player_x  
    2987.    moveq   #0,d6
    2988.    cmp   #62,d1
    2989.    bge.s   .1
    2990.    add   d1,d1
    2991.    move   pl_st_table-2(pc,d1),d6
    2992.    move   #256/2,d0
    2993.    moveq   #88,d1
    2994. .1:
    2995.    subq   #1,startup_count
    2996.    move   vehicle,d7
    2997.    move.b   .table2(pc,d7),d7
    2998.    cmp   #32,startup_count
    2999.    ble.s   .2
    3000.    move   #510,d7
    3001. .2:
    3002.    rts
    3003. .table2:
    3004.    dc.b   11,13
    3005.    even
    3006. pl_st_table:
    3007.    dc   &#036;801,&#036;802,&#036;804,&#036;808,&#036;810,&#036;820,&#036;830,&#036;840
    3008.    dc   &#036;860,&#036;880,&#036;8a0,&#036;8c0,&#036;8e0,&#036;900,&#036;940,&#036;980
    3009.    dc   &#036;9b0,&#036;9e0,&#036;a10,&#036;a40,&#036;a70,&#036;aa0,&#036;ac0,&#036;ae0
    3010.    dc   &#036;ae8,&#036;af0,&#036;af8,&#036;afc,&#036;afe,&#036;afd,&#036;afc,&#036;afa
    3011.    dc   &#036;af8,&#036;af4,&#036;af0,&#036;ae8,&#036;ae0,&#036;ad8,&#036;ad0,&#036;ac0
    3012.    dc   &#036;ab0,&#036;aa0,&#036;a80,&#036;a60,&#036;a40,&#036;a00,&#036;9c0,&#036;980
    3013.    dc   &#036;940,&#036;900,&#036;880,&#036;800,&#036;780,&#036;700,&#036;680,&#036;600
    3014.    dc   &#036;580,&#036;500,&#036;480,&#036;400,&#036;380
    3015.  
    3016. dump_gpu_floor:
    3017.    lea   lin_gpu,a0
    3018.    lea   overlays,a1
    3019.    move   #lin_gpuL/4,d7
    3020. .loop:   move.l   (a0)+,(a1)+
    3021.    dbf   d7,.loop
    3022.    rts
    3023.  
    3024. dump_gpu_360:
    3025.    lea   l360_gpu,a0
    3026.    lea   overlays,a1
    3027.    move   #l360_gpuL/4,d7
    3028. .loop:   move.l   (a0)+,(a1)+
    3029.    dbf   d7,.loop
    3030.    rts
    3031. ******************************************************************************
    3032. draw_360_gpu:
    3033.    lea   vars,a0
    3034.    move.l   floorF,(a0)+
    3035.    move.l   map,(a0)+
    3036.    move.l   blocks,(a0)+
    3037.    move.l   #sintab,(a0)+
    3038.    move.l   #costab,(a0)+
    3039.    move   oax,d0
    3040.    ext.l   d0
    3041.    move.l   d0,(a0)+
    3042.    move   alt,d0
    3043.    ext.l   d0
    3044.    move.l   d0,(a0)+
    3045.    movem   v360_off_ox,d0
    3046.    movem   v360_off_oy,d1
    3047.    move.l   d0,(a0)+
    3048.    move.l   d1,(a0)+
    3049.    move.l   #&#036;54,(a0)+
    3050.  
    3051.    move.l   #calc_floor_360,semaphore_adr
    3052.    moveq   #1,d0
    3053.    move.l   d0,semaphore
    3054.    rts
    3055.  
    3056. draw_360_08_gpu:
    3057.    lea   vars,a0
    3058.    move.l   floorF,d0
    3059.    add.l   #104*256,d0
    3060.    move.l   d0,(a0)+
    3061.    move.l   map,(a0)+
    3062.    move.l   blocks,(a0)+
    3063.    move.l   #sintab,(a0)+
    3064.    move.l   #costab,(a0)+
    3065.    move   oax,d0
    3066.    ext.l   d0
    3067.    move.l   d0,(a0)+
    3068.    move   alt,d0
    3069.    ext.l   d0
    3070.    move.l   d0,(a0)+
    3071.    movem   v360_off_ox,d0
    3072.    movem   v360_off_oy,d1
    3073.    move.l   d0,(a0)+
    3074.    move.l   d1,(a0)+
    3075.    move.l   #100-4,(a0)+
    3076.  
    3077.    move.l   #calc_floor_360,semaphore_adr
    3078.    moveq   #1,d0
    3079.    move.l   d0,semaphore
    3080.    rts
    3081.  
    3082. draw_linear_10_gpu:
    3083.    sub   #&#036;2000,map_xpos       ;KLUDGE
    3084.    move.l   #draw_linear_floor_10,d1
    3085.    bsr.s   draw_linear_gpu2
    3086.    add   #&#036;2000,map_xpos       ;KLUDGE
    3087.    rts
    3088.  
    3089. draw_linear_city_gpu:
    3090.    move.l   #draw_linear_floor_city,d1
    3091.    bra.s   draw_linear_gpu2
    3092.  
    3093. draw_linear_gpu:
    3094.    move.l   #draw_linear_floor,semaphore_adr
    3095.    moveq   #1,d0
    3096.    move.l   d0,semaphore
    3097.    jmp   waitgpu
    3098.  
    3099. draw_linear_gpu2:
    3100.    moveq   #0,d2
    3101.  
    3102.    lea   vars,a0
    3103.    move.l   floorB,(a0)+
    3104.    move.l   d2,(a0)+
    3105.    move.l   fbuff_ptr,(a0)+
    3106.    move.l   d2,(a0)+
    3107.    move.l   d2,(a0)+
    3108.    move.l   d2,(a0)+
    3109.    move   alt,d0
    3110.    ext.l   d0
    3111.    move.l   d0,(a0)+
    3112.  
    3113.    movem   map_xpos,d0
    3114.    move.l   d0,(a0)+
    3115.    movem   map_zpos,d0
    3116.    move.l   d0,(a0)+
    3117.  
    3118.    move.l   d1,semaphore_adr
    3119.    moveq   #1,d0
    3120.    move.l   d0,semaphore
    3121.  
    3122.    bra   waitgpu
    3123.  
    3124. run_gpu_linear1:
    3125.    bsr   waitgpu
    3126.    move.l   #calc_linear_floor,semaphore_adr
    3127.    moveq   #1,d0
    3128.    move.l   d0,semaphore
    3129.    rts
    3130.  
    3131. waitgpu:
    3132.    lea   semaphore,a0
    3133. .wait:
    3134.    moveq   #1,d0
    3135.    divs   d0,d0
    3136.    divs   d0,d0
    3137.    tst.l   (a0)
    3138.    bne.s   .wait
    3139.    rts
    3140.  
    3141. waitgpu3:
    3142.    push.l   a0
    3143.    push.l   d0
    3144.  
    3145.    lea   G_FLAGS,a0
    3146. .loop:
    3147.    moveq   #1,d0
    3148.    divu   d0,d0
    3149.  
    3150.    move.l   (a0),d0
    3151.    btst   #6,d0
    3152.    bne.s   .loop
    3153.  
    3154.    pop.l   d0
    3155.    pop.l   a0
    3156.    rts
    3157.  
    3158. ******************************************************************************
    3159. rotate_player_sprite:
    3160.    tst   vehicle
    3161.    bne   rotate_player_sprite_copter
    3162.  
    3163. rotate_player_sprite_striker:
    3164. ;   lea   player_ptr,a0
    3165. ;   move   node_player+mob_def,a5
    3166. ;   cmp   #25,a5
    3167. ;   blt.s   .1
    3168. ;   move   #12,a5
    3169. ;.1:
    3170. ;   add   a5,a5
    3171. ;   add   a5,a5
    3172. ;   move.l   (a0,a5),a0
    3173.  
    3174.    move   last_frame,a5
    3175.    add   a5,a5
    3176.    add   a5,a5
    3177.    lea   player_ship,a0
    3178.  
    3179.    tst   startup_count
    3180.    beq.s   .3
    3181.  
    3182.    move.l   a0,a1
    3183.    jmp   blit_sprite
    3184. .3:
    3185.    lea   8(a0),a2
    3186.  
    3187.    sub.l   a3,a3
    3188.    move   node_player+mob_x,d4
    3189.    sub   #(96/2),d4
    3190.    bpl.s   .no_x1_clip
    3191.    neg   d4
    3192.    move   d4,a3
    3193. .no_x1_clip:
    3194.    move   node_player+mob_x,d4
    3195.    add   #(96/2),d4
    3196.    sub   #256,d4
    3197.    bmi.s   .no_x2_clip
    3198.    move   d4,a3
    3199. .no_x2_clip:
    3200.  
    3201.    bsr   waitblit
    3202.  
    3203. ;set source...
    3204.    
    3205.    move.l   a2,A1_BASE
    3206.  
    3207.    move.l   #PITCH1|PIXEL16|WID96|XADDINC,A1_FLAGS       ;a1 = source
    3208.  
    3209.    move.l   (a0),d4
    3210.    swap   d4
    3211.    move.l   d4,A1_CLIP
    3212.  
    3213.    move   6(a0),d3
    3214.    move   d3,pyoff
    3215.  
    3216.    move   2(a0),d3
    3217.  
    3218.    move.l   #(72&lt;&lt;16)+96,d0
    3219.    sub   a3,d0
    3220.    move.l   d0,B_COUNT
    3221.  
    3222. ******************************************
    3223. * outer loop line increment *
    3224. *****************************
    3225.  
    3226.    move   xspeed,d0
    3227.    add   pbank,d0
    3228.  
    3229.    cmp   #&#036;400,d0
    3230.    ble.s   .zb1
    3231.    move   #&#036;400,d0
    3232. .zb1:
    3233.    cmp   #-&#036;400,d0
    3234.    bge.s   .zb2
    3235.    move   #-&#036;400,d0
    3236. .zb2:
    3237.    cmp   #15*4,a5
    3238.    bge.s   .2
    3239.    neg   d0
    3240. .2:
    3241.    asr   #2,d0
    3242.    and   #&#036;ffe,d0
    3243.  
    3244.    lea   costab,a2
    3245.    move   (a2,d0),d5
    3246.    move   d5,sp_cos
    3247.  
    3248.    lea   sintab,a2
    3249.    move   (a2,d0),d5
    3250.    move   d5,sp_sin
    3251.  
    3252.    move   4(a0),d4       ;get Offx
    3253.    neg   d4
    3254.    lsl   #3,d4
    3255.    move   d4,sp_midx
    3256.  
    3257.    move   6(a0),d1       ;get Offy
    3258.    add   #12,d1
    3259.    lsl   #3,d1
    3260.    move   d1,sp_mid
    3261.    neg   d1
    3262.  
    3263.    move   sp_midx,d4
    3264.    move   sp_cos,d0
    3265.    move   d0,d2
    3266.    move   sp_sin,d7
    3267.    move   d7,d6
    3268.    muls   d4,d0
    3269.    muls   d1,d7
    3270.    sub.l   d0,d7
    3271.    add.l   d7,d7
    3272.    swap   d7
    3273.    neg   d7
    3274.    muls   d1,d2
    3275.    muls   d4,d6
    3276.    add.l   d2,d6
    3277.    add.l   d6,d6
    3278.    swap   d6
    3279.  
    3280.    sub   sp_midx,d7
    3281.  
    3282.    add   sp_mid,d6
    3283.    add   #(-12*8),d6
    3284.  
    3285.    ext.l   d6
    3286.    ext.l   d7
    3287.    moveq   #16-3,d2
    3288.    lsl.l   d2,d6
    3289.    lsl.l   d2,d7
    3290.    move   d6,d2
    3291.    swap   d2
    3292.    move   d7,d2
    3293.    move.l   d2,A1_FPIXEL
    3294.    swap   d7
    3295.    move   d7,d6
    3296.    move.l   d6,A1_PIXEL
    3297.  
    3298. ;set inner loop
    3299.  
    3300.    move   sp_cos,d0
    3301.    ext.l   d0
    3302.    add.l   d0,d0
    3303.  
    3304.    move   sp_sin,d1
    3305.    ext.l   d1
    3306.    add.l   d1,d1
    3307.  
    3308.    move   d1,d2
    3309.    swap   d2
    3310.    move   d0,d2
    3311.    move.l   d2,A1_FINC
    3312.    swap   d0
    3313.    move   d0,d1
    3314.    move.l   d1,A1_INC
    3315. ***
    3316.    moveq   #-96,d4
    3317.    add   a3,d4
    3318.    moveq   #1,d1
    3319.  
    3320.    move   sp_cos,d3
    3321.    move   d3,d2
    3322.    move   sp_sin,d7
    3323.    move   d7,d6
    3324.    muls   d4,d3
    3325.    muls   d1,d7
    3326.    sub.l   d3,d7
    3327.    add.l   d7,d7
    3328.  
    3329.    muls   d1,d2
    3330.    muls   d4,d6
    3331.    add.l   d2,d6
    3332.    add.l   d6,d6
    3333. ***
    3334.    neg.l   d7
    3335.  
    3336.    move   d6,d2
    3337.    swap   d2
    3338.    move   d7,d2
    3339.    move.l   d2,A1_FSTEP
    3340.    swap   d7
    3341.    move   d7,d6
    3342.    move.l   d6,A1_STEP
    3343.  
    3344. ******************************************
    3345. * set dest *
    3346. ************
    3347.  
    3348.    move.l   scrB,A2_BASE
    3349.  
    3350.    move   node_player+mob_y,d1
    3351.    sub   pyoff,d1
    3352.    sub   #24,d1
    3353.  
    3354.    swap   d1
    3355.    add   node_player+mob_x,d1
    3356.    sub   #(96/2),d1
    3357.  
    3358.    move.l   #(1&lt;&lt;16)+(-96&amp;&#036;ffff),d2
    3359.    add   a3,d2
    3360.    move.l   #PITCH1|PIXEL16|WID256|XADDPIX,d3   ;a2 = dest (screen)
    3361.  
    3362.    cmp   #15*4,a5
    3363.    bge.s   .99
    3364.    add   #96,d1
    3365.    neg   d2
    3366.    bset   #19,d3
    3367. .99:   move.l   d1,A2_PIXEL
    3368.    move.l   d2,A2_STEP
    3369.    move.l   d3,A2_FLAGS
    3370.  
    3371.    move   striker_fade,d0
    3372.    swap   d0
    3373.    clr   d0
    3374.    move.l   d0,B_IINC
    3375.    move.l   d0,B_PATD
    3376.  
    3377.    move.l   #CLIP_A1|SRCSHADE|GOURZ|SRCEN|LFU_S|UPDA1F|UPDA2|DSTA2|DCOMPEN,B_CMD   ;Start the BLTTER
    3378. .exit:
    3379.    bsr   waitblit
    3380.  
    3381.    rts
    3382.  
    3383. rotate_player_sprite_copter:
    3384.    lea   player_ptr,a0
    3385.    move   node_player+mob_def,a5
    3386.    sub   #50,a5
    3387.    add   a5,a5
    3388.    add   a5,a5
    3389.    move.l   (a0,a5),a0
    3390.  
    3391.    lea   8(a0),a2
    3392.  
    3393.    bsr   waitblit
    3394.  
    3395. ;set source...
    3396.    
    3397.    move.l   a2,A1_BASE
    3398.  
    3399.    move.l   #PITCH1|PIXEL16|WID80|XADDINC,A1_FLAGS       ;a1 = source
    3400.  
    3401.    move.l   (a0),d4
    3402.    swap   d4
    3403.    move.l   d4,A1_CLIP
    3404.  
    3405.    move   6(a0),d3
    3406.    move   d3,pyoff
    3407.  
    3408.    move   2(a0),d3
    3409.  
    3410.    move.l   #(72&lt;&lt;16)+80,B_COUNT
    3411.  
    3412. ******************************************
    3413. * outer loop line increment *
    3414. *****************************
    3415.  
    3416.    move   xspeed,d0
    3417.    add   pbank,d0
    3418.  
    3419.    cmp   #&#036;400,d0
    3420.    ble.s   .zb1
    3421.    move   #&#036;400,d0
    3422. .zb1:
    3423.    cmp   #-&#036;400,d0
    3424.    bge.s   .zb2
    3425.    move   #-&#036;400,d0
    3426. .zb2:
    3427.    cmp   #15*4,a5
    3428.    blt.s   .2
    3429.    neg   d0
    3430. .2:
    3431.    asr   #2,d0
    3432.    and   #&#036;ffe,d0
    3433.  
    3434.    lea   costab,a2
    3435.    move   (a2,d0),d5
    3436.    move   d5,sp_cos
    3437.  
    3438.    lea   sintab,a2
    3439.    move   (a2,d0),d5
    3440.    move   d5,sp_sin
    3441.  
    3442.    move   4(a0),d4       ;get Offx
    3443.    neg   d4
    3444.    lsl   #3,d4
    3445.    move   d4,sp_midx
    3446.  
    3447.    move   6(a0),d1       ;get Offy
    3448.    add   #12,d1
    3449.    lsl   #3,d1
    3450.    move   d1,sp_mid
    3451.    neg   d1
    3452.  
    3453.    move   sp_midx,d4
    3454.    move   sp_cos,d0
    3455.    move   d0,d2
    3456.    move   sp_sin,d7
    3457.    move   d7,d6
    3458.    muls   d4,d0
    3459.    muls   d1,d7
    3460.    sub.l   d0,d7
    3461.    add.l   d7,d7
    3462.    swap   d7
    3463.    neg   d7
    3464.    muls   d1,d2
    3465.    muls   d4,d6
    3466.    add.l   d2,d6
    3467.    add.l   d6,d6
    3468.    swap   d6
    3469.  
    3470.    sub   sp_midx,d7
    3471.    add   sp_mid,d6
    3472.    add   #(-12*8),d6
    3473.  
    3474.    ext.l   d6
    3475.    ext.l   d7
    3476.    moveq   #16-3,d2
    3477.    lsl.l   d2,d6
    3478.    lsl.l   d2,d7
    3479.    move   d6,d2
    3480.    swap   d2
    3481.    move   d7,d2
    3482.    move.l   d2,A1_FPIXEL
    3483.    swap   d7
    3484.    move   d7,d6
    3485.    move.l   d6,A1_PIXEL
    3486.  
    3487. ;set inner loop
    3488.  
    3489.    move   sp_cos,d0
    3490.    ext.l   d0
    3491.    add.l   d0,d0
    3492.  
    3493.    move   sp_sin,d1
    3494.    ext.l   d1
    3495.    add.l   d1,d1
    3496.  
    3497.    move   d1,d2
    3498.    swap   d2
    3499.    move   d0,d2
    3500.    move.l   d2,A1_FINC
    3501.    swap   d0
    3502.    move   d0,d1
    3503.    move.l   d1,A1_INC
    3504. ***
    3505.    moveq   #-80,d4
    3506.    moveq   #1,d1
    3507.  
    3508.    move   sp_cos,d3
    3509.    move   d3,d2
    3510.    move   sp_sin,d7
    3511.    move   d7,d6
    3512.    muls   d4,d3
    3513.    muls   d1,d7
    3514.    sub.l   d3,d7
    3515.    add.l   d7,d7
    3516.  
    3517.    muls   d1,d2
    3518.    muls   d4,d6
    3519.    add.l   d2,d6
    3520.    add.l   d6,d6
    3521. ***
    3522.    neg.l   d7
    3523.  
    3524.    move   d6,d2
    3525.    swap   d2
    3526.    move   d7,d2
    3527.    move.l   d2,A1_FSTEP
    3528.    swap   d7
    3529.    move   d7,d6
    3530.    move.l   d6,A1_STEP
    3531.  
    3532. ******************************************
    3533. * set dest *
    3534. ************
    3535.  
    3536.    move.l   scrB,A2_BASE
    3537.  
    3538.    move   node_player+mob_y,d1
    3539.    sub   pyoff,d1
    3540.    sub   #40,d1
    3541.  
    3542.    swap   d1
    3543.    add   node_player+mob_x,d1
    3544.    sub   #(80/2),d1
    3545.  
    3546.    cmp   #18*4,a5
    3547.    blt.s   .98
    3548.    subq   #8,d1
    3549.    bra.s   .97
    3550. .98:   cmp   #9*4,a5
    3551.    bge.s   .97
    3552.    addq   #8,d1  
    3553. .97:
    3554.    move.l   #(1&lt;&lt;16)+(-80&amp;&#036;ffff),d2
    3555.    move.l   #PITCH1|PIXEL16|WID256|XADDPIX,d3   ;a2 = dest (screen)
    3556.  
    3557.    cmp   #15*4,a5
    3558.    blt.s   .99
    3559.    add   #80,d1
    3560.    neg   d2
    3561.    bset   #19,d3
    3562. .99:   move.l   d1,A2_PIXEL
    3563.    move.l   d2,A2_STEP
    3564.    move.l   d3,A2_FLAGS
    3565.  
    3566.    move   striker_fade,d0
    3567.    bne.s   .96
    3568.  
    3569.    move   copter_flare,d0
    3570.    lsl   #4,d0
    More More!

    Code (Text):
    1.  4.49a
    2. #readram3
    3.  00000000  00003FFF
    4.  02000000  023FFFFF
    5.  04000000  0403FFFF
    6.  06000000  0603FFFF
    7.  20000000  20003FFF
    8.  22000000  223FFFFF
    9.  24000000  2403FFFF
    10.  26000000  2603FFFF
    11. #readram2
    12.  00000000  00003FFF
    13.  02000000  023FFFFF
    14.  04000000  0403FFFF
    15.  06000000  0603FFFF
    16.  20000000  20003FFF
    17.  22000000  223FFFFF
    18.  24000000  2403FFFF
    19.  26000000  2603FFFF
    20. #readram1
    21.  00000000  00003FFF
    22.  02000000  023FFFFF
    23.  04000000  0403FFFF
    24.  06000000  0603FFFF
    25.  20000000  20003FFF
    26.  22000000  223FFFFF
    27.  24000000  2403FFFF
    28.  26000000  2603FFFF
    29. #readram0
    30.  00000000  003FD7FF
    31.  00880000  009FFFFF
    32.  00FF0000  00FFFFFF
    33. #writeram3
    34.  00000000  00003FFF
    35.  02000000  023FFFFF
    36.  04000000  0403FFFF
    37.  06000000  0603FFFF
    38.  20000000  20003FFF
    39.  22000000  223FFFFF
    40.  24000000  2403FFFF
    41.  26000000  2603FFFF
    42. #writeram2
    43.  00000000  00003FFF
    44.  02000000  023FFFFF
    45.  04000000  0403FFFF
    46.  06000000  0603FFFF
    47.  20000000  20003FFF
    48.  22000000  223FFFFF
    49.  24000000  2403FFFF
    50.  26000000  2603FFFF
    51. #writeram1
    52.  00000000  00003FFF
    53.  02000000  023FFFFF
    54.  04000000  0403FFFF
    55.  06000000  0603FFFF
    56.  20000000  20003FFF
    57.  22000000  223FFFFF
    58.  24000000  2403FFFF
    59.  26000000  2603FFFF
    60. #writeram0
    61.  00000000  003FBFFF
    62.  00880000  009FFFFF
    63.  00FF0000  00FFFFFF
    64. #update
    65.  FF 0008
    66. #video
    67.  03 50 32
    68. #label level
    69.  02 00 00
    70. #colour attributes
    71.  17 20 60 40 1F 2F 6F 4F 3E B0 4F 5E 0C 70 C0 87 8E 8E F0 90 4F 87 7C 0E 0A 70
    72. #mono attributes
    73.  07 07 07 07 0F 0F 0F 0F 70 70 07 70 0F 70 01 07 0F 0F 70 0F 07 07 70 07 07 70
    74. #default tabs
    75.  68K 0F 17 28 30 00 00 00 00
    76.  658 0F 17 28 30 00 00 00 00
    77.  Z80 0F 17 28 30 00 00 00 00
    78.  C   04 00 00 00 00 00 00 00
    79. #expression C/ASM flags
    80.  00 00 00 00 00
    81. #window
    82.  01 00 00 00
    83.  00 01 4F 0A 3D 05
    84.  00000000
    85. #window
    86.  82 00 00 00
    87.  00 0A 4F 21 08 0B
    88.  0088675A
    89. #window
    90.  03 01 00 00
    91.  00 21 4F 2D 08 22
    92.  FFFFFFEE
    93. #history
    94.  07 $fffff0
    95.  07 $fffff0
    96.  07 $fffff0
    97.  07 $fffff0
    98.  07 $fffff0
    99.  07 $fffff0
    100.  07 $fffff0
    101.  07 $fffff0
    102.  0A $ffff802e
    103.  0A ffff802e
    104.  0A ff802e
    105.  0A sp
    106.  0A pwmstructs
    107.  0A playpwm
    108.  0A pwm_irq
    109.  0A frame_table+(o_digit*4)
    More! (the same thing as above, only different slightly):

    Code (Text):
    1. #version
    2.  4.49a
    3. #readram3
    4.  00000000  00003FFF
    5.  02000000  023FFFFF
    6.  04000000  0403FFFF
    7.  06000000  0603FFFF
    8.  20000000  20003FFF
    9.  22000000  223FFFFF
    10.  24000000  2403FFFF
    11.  26000000  2603FFFF
    12. #readram2
    13.  00000000  00003FFF
    14.  02000000  023FFFFF
    15.  04000000  0403FFFF
    16.  06000000  0603FFFF
    17.  20000000  20003FFF
    18.  22000000  223FFFFF
    19.  24000000  2403FFFF
    20.  26000000  2603FFFF
    21. #readram1
    22.  00000000  00003FFF
    23.  02000000  023FFFFF
    24.  04000000  0403FFFF
    25.  06000000  0603FFFF
    26.  20000000  20003FFF
    27.  22000000  223FFFFF
    28.  24000000  2403FFFF
    29.  26000000  2603FFFF
    30. #readram0
    31.  00000000  003FD7FF
    32.  00880000  009FFFFF
    33.  00FF0000  00FFFFFF
    34. #writeram3
    35.  00000000  00003FFF
    36.  02000000  023FFFFF
    37.  04000000  0403FFFF
    38.  06000000  0603FFFF
    39.  20000000  20003FFF
    40.  22000000  223FFFFF
    41.  24000000  2403FFFF
    42.  26000000  2603FFFF
    43. #writeram2
    44.  00000000  00003FFF
    45.  02000000  023FFFFF
    46.  04000000  0403FFFF
    47.  06000000  0603FFFF
    48.  20000000  20003FFF
    49.  22000000  223FFFFF
    50.  24000000  2403FFFF
    51.  26000000  2603FFFF
    52. #writeram1
    53.  00000000  00003FFF
    54.  02000000  023FFFFF
    55.  04000000  0403FFFF
    56.  06000000  0603FFFF
    57.  20000000  20003FFF
    58.  22000000  223FFFFF
    59.  24000000  2403FFFF
    60.  26000000  2603FFFF
    61. #writeram0
    62.  00000000  003FBFFF
    63.  00880000  009FFFFF
    64.  00FF0000  00FFFFFF
    65. #update
    66.  FF 0008
    67. #video
    68.  03 50 32
    69. #label level
    70.  02 00 00
    71. #colour attributes
    72.  17 20 60 40 1F 2F 6F 4F 3E B0 4F 5E 0C 70 C0 87 8E 8E F0 90 4F 87 7C 0E 0A 70
    73. #mono attributes
    74.  07 07 07 07 0F 0F 0F 0F 70 70 07 70 0F 70 01 07 0F 0F 70 0F 07 07 70 07 07 70
    75. #default tabs
    76.  68K 0F 17 28 30 00 00 00 00
    77.  658 0F 17 28 30 00 00 00 00
    78.  Z80 0F 17 28 30 00 00 00 00
    79.  C   04 00 00 00 00 00 00 00
    80. #expression C/ASM flags
    81.  00 00 00 00 00
    82. #window
    83.  01 00 00 02
    84.  00 01 4F 0A 0A 02
    85.  00000000
    86. #window
    87.  02 00 00 02
    88.  00 0A 4F 21 08 0B
    89.  060004BC
    90. #window
    91.  83 02 00 02
    92.  00 21 4F 2D 0A 22
    93.  020FF8C2
    94. #history
    95.  07 $fffff0
    96.  07 $fffff0
    97.  07 $fffff0
    98.  07 $fffff0
    99.  07 $fffff0
    100.  07 $fffff0
    101.  07 $fffff0
    102.  07 $fffff0
    103.  0A $ffff802e
    104.  0A ffff802e
    105.  0A ff802e
    106.  0A sp
    107.  0A pwmstructs
    108.  0A playpwm
    109.  0A pwm_irq
    110.  0A frame_table+(o_digit*4)
    Here's a batch file for compiling all that crap:

    Code (Text):
    1. \psylink /m /z /I @soul.lnk,soul,soul.sym,soul.map
    2.  
    3. musdat.obj:    musdat.68k
    4.     \psyq\asm68k /I /l /zd /g /w /z musdat.68k,musdat
    5.  
    6. soul68k.obj:    soul.68k main.68k music.68k joystick.68k
    7.     \psyq\asm68k /I /l /zd /g /w /z main,main68k
    8.  
    9. soulsh2.obj:    main.sh2 soul.sh2 sprite.sh2
    10.     \psyq\asmsh /z /I /l /zd /g /w main.sh2,mainsh2
    11.  
    12. debug:
    13.     \psyq\dbug32x soul /u1 soul /u2 soul /e
    same thing mentioned again:

    Code (Text):
    1. #version
    2.  4.49a
    3. #readram3
    4.  00000000  00003FFF
    5.  02000000  023FFFFF
    6.  04000000  0403FFFF
    7.  06000000  0603FFFF
    8.  20000000  20003FFF
    9.  22000000  223FFFFF
    10.  24000000  2403FFFF
    11.  26000000  2603FFFF
    12. #readram2
    13.  00000000  00003FFF
    14.  02000000  023FFFFF
    15.  04000000  0403FFFF
    16.  06000000  0603FFFF
    17.  20000000  20003FFF
    18.  22000000  223FFFFF
    19.  24000000  2403FFFF
    20.  26000000  2603FFFF
    21. #readram1
    22.  00000000  00003FFF
    23.  02000000  023FFFFF
    24.  04000000  0403FFFF
    25.  06000000  0603FFFF
    26.  20000000  20003FFF
    27.  22000000  223FFFFF
    28.  24000000  2403FFFF
    29.  26000000  2603FFFF
    30. #readram0
    31.  00000000  003FD7FF
    32.  00880000  009FFFFF
    33.  00FF0000  00FFFFFF
    34. #writeram3
    35.  00000000  00003FFF
    36.  02000000  023FFFFF
    37.  04000000  0403FFFF
    38.  06000000  0603FFFF
    39.  20000000  20003FFF
    40.  22000000  223FFFFF
    41.  24000000  2403FFFF
    42.  26000000  2603FFFF
    43. #writeram2
    44.  00000000  00003FFF
    45.  02000000  023FFFFF
    46.  04000000  0403FFFF
    47.  06000000  0603FFFF
    48.  20000000  20003FFF
    49.  22000000  223FFFFF
    50.  24000000  2403FFFF
    51.  26000000  2603FFFF
    52. #writeram1
    53.  00000000  00003FFF
    54.  02000000  023FFFFF
    55.  04000000  0403FFFF
    56.  06000000  0603FFFF
    57.  20000000  20003FFF
    58.  22000000  223FFFFF
    59.  24000000  2403FFFF
    60.  26000000  2603FFFF
    61. #writeram0
    62.  00000000  003FBFFF
    63.  00880000  009FFFFF
    64.  00FF0000  00FFFFFF
    65. #update
    66.  FF 0008
    67. #video
    68.  03 50 32
    69. #label level
    70.  02 00 00
    71. #colour attributes
    72.  17 20 60 40 1F 2F 6F 4F 3E B0 4F 5E 0C 70 C0 87 8E 8E F0 90 4F 87 7C 0E 0A 70
    73. #mono attributes
    74.  07 07 07 07 0F 0F 0F 0F 70 70 07 70 0F 70 01 07 0F 0F 70 0F 07 07 70 07 07 70
    75. #default tabs
    76.  68K 0F 17 28 30 00 00 00 00
    77.  658 0F 17 28 30 00 00 00 00
    78.  Z80 0F 17 28 30 00 00 00 00
    79.  C   04 00 00 00 00 00 00 00
    80. #expression C/ASM flags
    81.  00 00 00 00 00
    82. #window
    83.  01 00 00 00
    84.  00 01 4F 0A 3D 05
    85.  00000000
    86. #window
    87.  82 00 00 00
    88.  00 0A 4F 21 08 0B
    89.  0088675A
    90. #window
    91.  03 01 00 00
    92.  00 21 4F 2D 08 22
    93.  FFFFFFEE
    94. #history
    95.  07 $fffff0
    96.  07 $fffff0
    97.  07 $fffff0
    98.  07 $fffff0
    99.  07 $fffff0
    100.  07 $fffff0
    101.  07 $fffff0
    102.  07 $fffff0
    103.  0A $ffff802e
    104.  0A ffff802e
    105.  0A ff802e
    106.  0A sp
    107.  0A pwmstructs
    108.  0A playpwm
    109.  0A pwm_irq
    110.  0A frame_table+(o_digit*4)
    Again, more of the same. (These must be for different OBJ files)

    Code (Text):
    1. #version
    2.  4.49a
    3. #readram3
    4.  00000000  00003FFF
    5.  02000000  023FFFFF
    6.  04000000  0403FFFF
    7.  06000000  0603FFFF
    8.  20000000  20003FFF
    9.  22000000  223FFFFF
    10.  24000000  2403FFFF
    11.  26000000  2603FFFF
    12. #readram2
    13.  00000000  00003FFF
    14.  02000000  023FFFFF
    15.  04000000  0403FFFF
    16.  06000000  0603FFFF
    17.  20000000  20003FFF
    18.  22000000  223FFFFF
    19.  24000000  2403FFFF
    20.  26000000  2603FFFF
    21. #readram1
    22.  00000000  00003FFF
    23.  02000000  023FFFFF
    24.  04000000  0403FFFF
    25.  06000000  0603FFFF
    26.  20000000  20003FFF
    27.  22000000  223FFFFF
    28.  24000000  2403FFFF
    29.  26000000  2603FFFF
    30. #readram0
    31.  00000000  003FD7FF
    32.  00880000  009FFFFF
    33.  00FF0000  00FFFFFF
    34. #writeram3
    35.  00000000  00003FFF
    36.  02000000  023FFFFF
    37.  04000000  0403FFFF
    38.  06000000  0603FFFF
    39.  20000000  20003FFF
    40.  22000000  223FFFFF
    41.  24000000  2403FFFF
    42.  26000000  2603FFFF
    43. #writeram2
    44.  00000000  00003FFF
    45.  02000000  023FFFFF
    46.  04000000  0403FFFF
    47.  06000000  0603FFFF
    48.  20000000  20003FFF
    49.  22000000  223FFFFF
    50.  24000000  2403FFFF
    51.  26000000  2603FFFF
    52. #writeram1
    53.  00000000  00003FFF
    54.  02000000  023FFFFF
    55.  04000000  0403FFFF
    56.  06000000  0603FFFF
    57.  20000000  20003FFF
    58.  22000000  223FFFFF
    59.  24000000  2403FFFF
    60.  26000000  2603FFFF
    61. #writeram0
    62.  00000000  003FBFFF
    63.  00880000  009FFFFF
    64.  00FF0000  00FFFFFF
    65. #update
    66.  FF 0008
    67. #video
    68.  03 50 32
    69. #label level
    70.  02 00 00
    71. #colour attributes
    72.  17 20 60 40 1F 2F 6F 4F 3E B0 4F 5E 0C 70 C0 87 8E 8E F0 90 4F 87 7C 0E 0A 70
    73. #mono attributes
    74.  07 07 07 07 0F 0F 0F 0F 70 70 07 70 0F 70 01 07 0F 0F 70 0F 07 07 70 07 07 70
    75. #default tabs
    76.  68K 0F 17 28 30 00 00 00 00
    77.  658 0F 17 28 30 00 00 00 00
    78.  Z80 0F 17 28 30 00 00 00 00
    79.  C   04 00 00 00 00 00 00 00
    80. #expression C/ASM flags
    81.  00 00 00 00 00
    82. #window
    83.  01 00 00 01
    84.  00 01 4F 0A 0A 02
    85.  00000000
    86. #window
    87.  85 00 40 01
    88.  00 0A 4F 21 08 12
    89.  00000016
    90. #file
    91. C:\SOULSTAR.32X\ROTSPR.SH2
    92. #tabs
    93.  08 00 00 00 00 00 00 00
    94.  
    95. #window
    96.  03 02 00 01
    97.  00 21 4F 2D 16 22
    98.  06001B48
    99. #history
    100.  02 rotspr.sh2
    101.  07 $fffff0
    102.  07 $fffff0
    103.  07 $fffff0
    104.  07 $fffff0
    105.  07 $fffff0
    106.  07 $fffff0
    107.  07 $fffff0
    108.  07 $fffff0
    109.  0A $ffff802e
    110.  0A ffff802e
    111.  0A ff802e
    112.  0A sp
    113.  0A pwmstructs
    114.  0A playpwm
    115.  0A pwm_irq
    116.  0A frame_table+(o_digit*4)
    This seems to be another copy of the PWM Sample Program source, but changed slightly near the end:

    Code (ASM):
    1. ;    PWM Sample Program
    2. ;                    SH2 Master Main
    3. ;
    4. ;    Copyright SEGA ENTERPRISES,LTD. 1994
    5. ;---------------------------------------------------------------*
    6. ;****************************************************************
    7.    
    8.     cnop    0,4
    9.  
    10. ******************************************
    11. * Initialize the PWM interupt and driver *
    12. ******************************************
    13.  
    14. initPWM
    15.     move    #$20004030,r2
    16.     move    #1047,r0            ;1047 set cycle register (22Khz)
    17.     move.w    r0,(2,r2)
    18.  
    19.     move    #$0305,r0            ;105 set control register
    20.     move.w    r0,(r2)
    21.  
    22.     move    #$20004030,r2                    ;fill mono fifo
    23.     move    #1,r0
    24.     move.w    r0,(8,r2)
    25.     move.w    r0,(8,r2)
    26.     move.w    r0,(8,r2)
    27.  
    28.     rts
    29.     nop
    30.  
    31.     cnop    0,4
    32.  
    33.     lits
    34.  
    35.     cnop    0,4
    36.  
    37. ************************************************
    38. * Play an 8 bit sample throught the PWM ciruit *
    39. ************************************************
    40. ; input
    41. ;    R1 = Address of sample
    42. ;    R2 = length of sample
    43. ;    R3 = channel number
    44. ;    R4 = step value
    45.  
    46. PlayPWM
    47.     move    #comport1,r0
    48.     move.w    (r0)+,r1        ;get sfx number
    49.     move.w    (r0)+,r4        ;get step rate
    50.     move.w    (r0)+,r2        ;get volume
    51.  
    52.     move    #sample_table,r0
    53.     shll2    r1
    54.     shll    r1
    55.     add    r1,r0
    56.     move    (r0)+,r2        ;get length
    57.     move    (r0)+,r1        ;get address
    58.  
    59.     move    #sfx_chan,r5        ;get channel to play
    60.     move    (r5),r0
    61.     add    #1,r0
    62.     and    #3,r0
    63.     move    r0,(r5)
    64.     move    r0,r3
    65.  
    66.     move    r2,r0
    67.     shll8    r0
    68.     move    #pwmstructs+TH,r2
    69.     shll2    r3
    70.     shll2    r3
    71.     add    r3,r2
    72.     move    r0,(r2)            ;store sample length (bytes)
    73.  
    74.     cmpeq    #0,r0
    75.     bt    .done_pwm
    76.  
    77.     move    r4,(PWMSTEP,r2)        ;store step rate
    78.     shll8    r1
    79.     move    r1,(PWMADDR,r2)        ;store sample address
    80.  
    81. .done_pwm
    82.     rts
    83.     nop
    84.  
    85.     cnop    0,4
    86.  
    87. sfx_chan dc.l    0
    88.  
    89.     lits
    90.  
    91. *************************
    92. * PWM interrupt handler *
    93. *************************
    94.  
    95.     cnop    0,4
    96. spwm_irq
    97.     push    r0
    98.     push    r1
    99.     push    r2
    100.     push    r3
    101.     push    r4
    102.     push    r5
    103.     push    r6
    104.  
    105.     move    #$20004038,r2
    106.     move.b    (r2),r0            ;is pwm fifo full?
    107.     tst    #$80,r0
    108.     bf    .exit
    109.  
    110.     push    pr
    111.     bsr    process_pwm
    112.     nop
    113.     pop    pr
    114. .exit
    115.     move    #_FRT,r1              ;tweak FRT
    116.     move.b    (_TOCR,r1),r0
    117.     xor    #$02,r0
    118.     move.b    r0,(_TOCR,r1)
    119.  
    120.     move    #$2000401C,r2        ;clear irq
    121.     move.w    r0,(r2)
    122.     move.w    (r2),r0
    123.  
    124.     pop    r6
    125.     pop    r5
    126.     pop    r4
    127.     pop    r3
    128.     pop    r2
    129.     pop    r1
    130.     pop    r0
    131.  
    132.     rts
    133.     nop
    134.    
    135.     LITS
    136.  
    137.     cnop    0,4
    138.  
    139. NUMCHANNELS   equ    4
    140. PWMSIZE       equ    4    ; number of elemts in the PWM structure
    141.  
    142. PWMADDR       equ    4
    143. PWMSTEP       equ    8
    144.  
    145. *****************
    146. * Fill PWM FIFO *
    147. *****************
    148.  
    149. process_pwm
    150.     move    #$20004038,r2
    151. .loop
    152.     move    #pwmstructs+TH,r3
    153.     move    #NUMCHANNELS,r4
    154.     move    #0,r5
    155.  
    156. .channelloop
    157.     move    (r3),r0                ;is channel on?
    158.     cmppz    r0
    159.     bf/s    .skip
    160.     move.w    #$80,r1                ;if channel off, use $7f (flat)
    161.  
    162.     move    (PWMSTEP,r3),r6
    163.     sub    r6,r0
    164.     move    r0,(r3)
    165.  
    166.     move    (PWMADDR,r3),r0            ;get the next pcm byte
    167.     move    r0,r1
    168.     add    r6,r0
    169.     move    r0,(PWMADDR,r3)
    170.     shlr8    r1
    171.     move    #samp_base,r0
    172.     move.b    (r0,r1),r1
    173.     extu.b    r1,r1
    174. .skip
    175.     add    #PWMSIZE*4,r3
    176.  
    177.     add    #1,r1               ;make sure it's not 0
    178.     add    r1,r5
    179.  
    180.     dt    r4
    181.     bf    .channelloop
    182.  
    183.     move.w    r5,(r2)                ;store into mono width
    184.  
    185.     move.b    (r2),r0                ;is pwm fifo full?
    186.     tst    #$80,r0
    187.     bt    .loop
    188.  
    189. * player ship
    190.  
    Like I said, there are TONS of other stuff in here. Possibly some snippets from the actual computer it was compiled on. Definetly needs checking out.

    More to come, hopefully.
     
  19. I seem to recall Link's Awakening having some uncompiled code in it; interestingly, there was some sort of reference to QBasic inside.
     
  20. evilhamwizard

    evilhamwizard

    Researcher
    1,392
    455
    63

    I remember this.

    It's nothing interesting. This is from a Russian translation (hacked) version of the game, which the translators disassembled the rom to help them add space for characters, etc.