BACK.SRC 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554
  1. ************************************************************************
  2. * *
  3. * 044 [ART OF FIGHT] *
  4. * BACK (SCROLL) PROGRAM *
  5. * by S.OKADA from 91/09/20 Fri 13:32 *
  6. * *
  7. ************************************************************************
  8. XDEF BACK2_INIT
  9. XDEF BACK2_SCROLL_SET
  10. XDEF BACK2_SCROLL_WRITE
  11. XDEF BEFOR_SCROLL
  12. XDEF BACK2_CENTOR
  13. XREF ?A5
  14. SECT GAME,,C
  15. INCLUDE SYS.INC
  16. INCLUDE NEO_GEO.INC
  17. INCLUDE LABEL.INC
  18. INCLUDE HFLAG.INC
  19. INCLUDE SMACRO.INC
  20. INCLUDE SCODE.INC
  21. ;
  22. ;
  23. ; *** scroll value calculate ***
  24. ;
  25. ;
  26. ;*** constant table ***
  27. XDEF GL
  28. Hx EQU 320/2 display width x / 2
  29. Hy EQU 256/2 display width y / 2
  30. DR_BIG EQU 0C0H display max hero distance
  31. DR_SMALL EQU 0B8H display max hero distance
  32. ;DR_SMALL EQU 0B0H display max hero distance
  33. DE_Lim EQU 40H display edge limit
  34. BLim EQU 190 reduction minimum (>128)
  35. GL EQU 50H map ground line
  36. FE EQU -20H normal display bottom to GL
  37. ;FE EQU 10H normal display bottom to GL
  38. FU EQU 60H 1/2 size GL to display bottom
  39. BIG_MOVE EQU 5
  40. BIG_MOVE_N EQU 3
  41. YLim EQU BLim+((256-BLim)*1)/4
  42. Y_SCROLL_MAX EQU 128
  43. Y_SCROLL_MIN EQU -18H ;-30H
  44. Y_SCROLL_SP EQU 5
  45. BACK2_CENTOR:
  46. LEA.L BACK2(A5),A6
  47. CLR.W Z_POSITION(A6)
  48. MOVE.W #100H,D4
  49. MOVE.W D4,BIG_X(A6)
  50. BSR GET_Lxy
  51. MOVE.W #180H,REG_D0(A5)
  52. BSR GET_WINDOW_POSITION
  53. BSR GET_WINDOW_WIDTH
  54. BSR GET_WINDOW_EDGE
  55. BSR GET_SCROLL_LSPC
  56. BSR BACK2_BUFFER_IN
  57. RTS
  58. BACK2_SCROLL_SET:
  59. LEA.L BACK2(A5),A6
  60. BSR Y_SCROLL
  61. BSR GET_SCROLL_BIG
  62. BSR GET_Lxy
  63. BSR GET_Tx
  64. BSR GET_WINDOW_POSITION
  65. BSR GET_WINDOW_WIDTH
  66. BSR GET_WINDOW_EDGE
  67. BSR GET_SCROLL_LSPC
  68. BACK2_SCROLL_SET_1:
  69. BSR WINDOW_X_PAR_SET
  70. BSR BACK2_BUFFER_IN
  71. LEA.L HERO1(A5),A6
  72. BSR AREA_POS_SET
  73. LEA.L HERO2(A5),A6
  74. BSR AREA_POS_SET
  75. RTS
  76. Z_DOWN:
  77. SUB.W #72,D0
  78. BGE.S Z_DOWN_1
  79. MOVEQ.L #0,D0
  80. Z_DOWN_1:
  81. RTS
  82. Y_SCROLL:
  83. MOVEQ.L #0,D3
  84. MOVEQ.L #0,D4
  85. BSR DOWN_SCROLL
  86. BNE Y_SCROLL_2
  87. MOVE.W HERO1+Z_POSITION(A5),D0
  88. BSR Z_DOWN
  89. CMP.W D0,D4
  90. BGT.S Y_SCROLL_1
  91. MOVE.W D0,D4
  92. MOVE.W HERO1+VZ(A5),D3
  93. Y_SCROLL_1:
  94. MOVE.W HERO2+Z_POSITION(A5),D0
  95. BSR Z_DOWN
  96. CMP.W D0,D4
  97. BGT.S Y_SCROLL_2
  98. MOVE.W D0,D4
  99. MOVE.W HERO2+VZ(A5),D3
  100. Y_SCROLL_2:
  101. CMP.W #Y_SCROLL_MAX,D4
  102. BLE.S Y_SCROLL_3
  103. MOVE.W #Y_SCROLL_MAX,D4
  104. Y_SCROLL_3:
  105. MOVE.W Z_POSITION(A6),D0
  106. CMP.W D0,D4
  107. BEQ.S Y_SCROLL_6
  108. BGT.S Y_SCROLL_7
  109. MOVE.W D4,D3
  110. SUB.W D0,D3
  111. ASR.W #3,D3
  112. CMP.W #-Y_SCROLL_SP,D3
  113. BLT.S Y_SCROLL_4
  114. MOVEQ.L #-Y_SCROLL_SP,D3
  115. Y_SCROLL_4:
  116. ADD.W D3,D0
  117. CMP.W D0,D4
  118. BLT.S Y_SCROLL_5
  119. MOVE.W D4,D0
  120. Y_SCROLL_5:
  121. MOVE.W D0,Z_POSITION(A6)
  122. Y_SCROLL_6:
  123. RTS
  124. Y_SCROLL_7:
  125. MOVE.W D4,D3
  126. SUB.W D0,D3
  127. ASR.W #4,D3
  128. CMP.W #Y_SCROLL_SP,D3
  129. BGT.S Y_SCROLL_8
  130. MOVEQ.L #Y_SCROLL_SP,D3
  131. Y_SCROLL_8:
  132. ADD.W D3,D0
  133. CMP.W D0,D4
  134. BGT.S Y_SCROLL_9
  135. MOVE.W D4,D0
  136. Y_SCROLL_9:
  137. MOVE.W D0,Z_POSITION(A6)
  138. RTS
  139. DOWN_SCROLL:
  140. LEA.L HERO1(A5),A4
  141. BSR DOWN_SCROLL_1
  142. BNE.S DOWN_SCROLL_3
  143. LEA.L HERO2(A5),A4
  144. DOWN_SCROLL_1:
  145. MOVE.W PLAYER_No+PLAYER_OFFSET(A4),D0
  146. BTST.B D0,MOVE_DIR(A6)
  147. BEQ.S DOWN_SCROLL_2
  148. TST.W Z_POSITION(A4)
  149. BGT.S DOWN_SCROLL_2
  150. MOVEQ.L #0,D4
  151. DOWN_SCROLL_11:
  152. MOVEQ.L #1,D0
  153. RTS
  154. DOWN_SCROLL_2:
  155. MOVEQ.L #0,D0
  156. DOWN_SCROLL_3:
  157. RTS
  158. GET_SCROLL_BIG:
  159. ; STEP1 0:normal
  160. ; 1:to small
  161. ; 2:small
  162. ; 3:to normal
  163. MOVEQ.L #0,D0
  164. MOVE.B STEP1(A6),D0
  165. ADD.W D0,D0
  166. ADD.W D0,D0
  167. JMP GET_BIG_VECTOR(PC,D0.W)
  168. GET_BIG_VECTOR:
  169. JMP GSB_NORMAL(PC)
  170. JMP GSB_TO_SMALL(PC)
  171. JMP GSB_SMALL(PC)
  172. JMP GSB_TO_NORMAL(PC)
  173. GSB_NORMAL:
  174. MOVE.W #100H,D4
  175. MOVE.W D4,BIG_X(A6)
  176. RTS
  177. GSB_TO_SMALL:
  178. MOVE.W BIG_X(A6),D4
  179. SUBQ.W #BIG_MOVE,D4
  180. CMP.W #BLim,D4
  181. BHI.S GSB_TO_SMALL_1
  182. MOVE.B #2,STEP1(A6)
  183. MOVE.W #BLim,D4
  184. GSB_TO_SMALL_1:
  185. MOVE.W D4,BIG_X(A6)
  186. RTS
  187. GSB_SMALL:
  188. MOVE.W #BLim,D4
  189. TST.B MASTER_REQUEST(A6)
  190. BNE.S GSB_SMALL_2
  191. MOVE.W HERO1+X_POSITION(A5),D0
  192. SUB.W HERO2+X_POSITION(A5),D0
  193. BPL.S GSB_SMALL_1
  194. NEG.W D0
  195. GSB_SMALL_1:
  196. CMP.W #DR_SMALL,D0
  197. BCC GSB_SMALL_3
  198. GSB_SMALL_2:
  199. MOVE.B #3,STEP1(A6)
  200. GSB_SMALL_3:
  201. MOVE.W D4,BIG_X(A6)
  202. RTS
  203. GSB_TO_NORMAL:
  204. TST.B MASTER_REQUEST(A6)
  205. BNE.S GSB_TO_NORMAL_2
  206. MOVE.W HERO1+X_POSITION(A5),D0
  207. ADD.W HERO2+X_POSITION(A5),D0
  208. LSR.W #1,D0
  209. MOVE.W D0,Tx(A6)
  210. GSB_TO_NORMAL_2:
  211. MOVE.W BIG_X(A6),D4
  212. ADDQ.W #BIG_MOVE_N,D4
  213. CMP.W #100H,D4
  214. BLO.S GSB_TO_NORMAL_1
  215. MOVE.W #100H,D4
  216. MOVE.B #0,STEP1(A6)
  217. GSB_TO_NORMAL_1:
  218. MOVE.W D4,BIG_X(A6)
  219. RTS
  220. GET_Lxy:
  221. MOVE.W D4,D0
  222. SUB.W #128,D0
  223. MULS.W #(FE+FU-Hy),D0
  224. ASR.L #7,D0
  225. ADD.W #GL-FU+Hy*2,D0
  226. MOVE.W D0,Ly(A6)
  227. RTS
  228. SPx_MAX EQU 6
  229. GET_Tx:
  230. TST.B STEP1(A6)
  231. BNE.S GET_Tx_000
  232. TST.B MASTER_REQUEST(A6)
  233. BEQ.S GET_Tx_000
  234. MOVE.L WIN_PLAYER(A5),A0
  235. LEA.L HERO_OFFSET(A0),A0
  236. TST.B MASTER_REQUEST(A6)
  237. BPL.S GET_Tx_001
  238. MOVE.L ANOTHER_PLAYER(A0),A0
  239. GET_Tx_001:
  240. MOVE.W X_POSITION(A0),Tx(A6)
  241. GET_Tx_000:
  242. MOVE.W Tx(A6),D0
  243. MOVE.W D0,REG_D0(A5)
  244. MOVE.W Lx(A6),D1
  245. SUB.W D1,D0
  246. BEQ GET_Tx_9
  247. BMI GET_Tx_10
  248. CMP.W #SPx_MAX,D0
  249. BCS.S GET_Tx_1
  250. MOVEQ.L #SPx_MAX,D0
  251. GET_Tx_1:
  252. ADD.W D0,D1
  253. MOVE.W D1,REG_D0(A5)
  254. GET_Tx_9:
  255. RTS
  256. GET_Tx_10:
  257. CMP.W #-SPx_MAX,D0
  258. BGT.S GET_Tx_11
  259. MOVEQ.L #-SPx_MAX,D0
  260. GET_Tx_11:
  261. ADD.W D0,D1
  262. MOVE.W D1,REG_D0(A5)
  263. RTS
  264. GET_WINDOW_POSITION:
  265. MOVE.W REG_D0(A5),D0
  266. MOVE.L #Hx*256,D1
  267. BSR GWP_SUB
  268. MOVE.W D0,REG_D1(A5)
  269. MOVE.W Ly(A6),D0
  270. MOVE.L #Hy*256,D1
  271. BSR GWP_SUB
  272. MOVE.W D0,Wy(A6)
  273. RTS
  274. GWP_SUB:
  275. DIVU D4,D1
  276. SUB.W D1,D0
  277. RTS
  278. GET_SCROLL_LSPC:
  279. MOVE.W Wx(A6),D1
  280. AND.W #0FFF0H,D1
  281. MOVE.W Lx(A6),D0
  282. SUB.W D1,D0
  283. MULS D4,D0
  284. ASR.L #8,D0
  285. NEG.L D0
  286. ADD.W #Hx,D0
  287. MOVE.W D0,REL_X(A6)
  288. MOVE.W Z_POSITION(A6),D0
  289. MOVE.W D4,D1
  290. SUB.W #YLim,D1
  291. BPL.S GET_SCROLL_LSPC_1
  292. MOVEQ.L #0,D1
  293. GET_SCROLL_LSPC_1:
  294. MULS D1,D0
  295. DIVS #256-YLim,D0
  296. MOVE.W D0,Z_POSITION+2(A6)
  297. NEG.W D0
  298. ADD.W #100H,D0
  299. SUB.W Wy(A6),D0
  300. MULS D4,D0
  301. ASR.L #8,D0
  302. ADD.W #100H,D0
  303. MOVE.W D0,REL_Y(A6)
  304. RTS
  305. GSL_SUB:
  306. SUB.W D1,D0
  307. MULS D4,D0
  308. ASR.L #8,D0
  309. NEG.L D0
  310. RTS
  311. GET_WINDOW_WIDTH:
  312. TST.B D4
  313. BEQ.S GWW_NORMAL
  314. MOVE.L #Hx*2*256,D0
  315. DIVU D4,D0
  316. MOVE.W D0,WIDTH_X(A6)
  317. MOVE.L #Hy*2*256,D0
  318. DIVU D4,D0
  319. MOVE.W D0,WIDTH_Y(A6)
  320. RTS
  321. GWW_NORMAL:
  322. MOVE.W #Hx*2,WIDTH_X(A6)
  323. MOVE.W #Hy*2,WIDTH_Y(A6)
  324. RTS
  325. GET_WINDOW_EDGE:
  326. MOVE.W WIDTH_Y(A6),D0
  327. ; ADD.W REG_D2(A5),D0
  328. ADD.W Wy(A6),D0
  329. MOVE.W D0,WyUP(A6)
  330. MOVE.W REG_D1(A5),D0
  331. BMI.S NON_SCROLL_MI
  332. ADD.W WIDTH_X(A6),D0
  333. CMP.W #300H,D0
  334. BHI.S NON_SCROLL_PL
  335. MOVE.W REG_D0(A5),Lx(A6)
  336. MOVE.W D0,WxRIGHT(A6)
  337. MOVE.W REG_D1(A5),Wx(A6)
  338. TST.B MASTER_REQUEST(A6)
  339. BEQ TARGET_ON_2
  340. TST.B STEP1(A6)
  341. BNE TARGET_ON_2
  342. MOVE.L WIN_PLAYER(A5),A0
  343. LEA.L HERO_OFFSET(A0),A0
  344. TST.B MASTER_REQUEST(A6)
  345. BPL.S TARGET_ON_1
  346. MOVE.L ANOTHER_PLAYER(A0),A0
  347. TARGET_ON_1:
  348. MOVE.W X_POSITION(A0),D0
  349. CMP.W Lx(A6),D0
  350. BNE.S TARGET_ON_2
  351. BCLR.B #0,MASTER_REQUEST(A6)
  352. TARGET_ON_2:
  353. RTS
  354. NON_SCROLL_MI:
  355. MOVE.W D4,D0
  356. JSR GET_Hx_LIMIT(PC)
  357. MOVE.W D1,Lx(A6)
  358. ADD.W D1,D1
  359. MOVE.W D1,WxRIGHT(A6)
  360. MOVE.W #0,Wx(A6)
  361. BSR TARGET_LIMIT
  362. RTS
  363. NON_SCROLL_PL:
  364. MOVE.W #300H,D2
  365. MOVE.W D2,WxRIGHT(A6)
  366. MOVE.W D4,D0
  367. JSR GET_Hx_LIMIT(PC)
  368. SUB.W D1,D2
  369. MOVE.W D2,Lx(A6)
  370. SUB.W D1,D2
  371. MOVE.W D2,Wx(A6)
  372. TARGET_LIMIT:
  373. TST.B STEP1(A6)
  374. BNE TARGET_LIMIT_1
  375. BCLR.B #0,MASTER_REQUEST(A6)
  376. TARGET_LIMIT_1:
  377. RTS
  378. GET_Hx_LIMIT:
  379. SUB.W #BLim,D0
  380. ADD.W D0,D0
  381. MOVE.W Hx_LIMIT(PC,D0.W),D1
  382. RTS
  383. Hx_LIMIT:
  384. DDR SET BLim
  385. REPT 257-BLim
  386. DC.W (Hx*256)/DDR
  387. DDR SET DDR+1
  388. ENDR
  389. WINDOW_X_PAR_SET:
  390. MOVE.W BIG_X+BACK2(A5),D0
  391. JSR GET_Hx_LIMIT(PC)
  392. MOVE.W Lx+BACK2(A5),D0
  393. SUB.W D1,D0
  394. MOVE.W D0,WINDOW_LEFT+BACK2(A5)
  395. ADD.W #64,D0
  396. MOVE.W D0,DISP_LEFT+BACK2(A5)
  397. ADD.W #32,D0
  398. MOVE.W D0,TRI_LEFT+BACK2(A5)
  399. ADD.W Lx+BACK2(A5),D1
  400. MOVE.W D1,WINDOW_RIGHT+BACK2(A5)
  401. SUB.W #64,D1
  402. MOVE.W D1,DISP_RIGHT+BACK2(A5)
  403. SUB.W #32,D1
  404. MOVE.W D1,TRI_RIGHT+BACK2(A5)
  405. RTS
  406. AREA_POS_SET:
  407. MOVEP.W WORK_N0(A6),D0
  408. CLR.B D0
  409. MOVE.L VX(A5,D0.W),D0
  410. ADD.L X_POSITION(A6),D0
  411. SWAP D0
  412. MOVEQ.L #4,D3
  413. CMP.W DISP_LEFT+BACK2(A5),D0
  414. BCS.S AREA_POS_SET_1
  415. MOVEQ.L #2,D3
  416. CMP.W TRI_LEFT+BACK2(A5),D0
  417. BCS.S AREA_POS_SET_1
  418. MOVEQ.L #0,D3
  419. CMP.W TRI_RIGHT+BACK2(A5),D0
  420. BCS.S AREA_POS_SET_1
  421. MOVEQ.L #3,D3
  422. CMP.W DISP_RIGHT+BACK2(A5),D0
  423. BCS.S AREA_POS_SET_1
  424. MOVEQ.L #5,D3
  425. AREA_POS_SET_1:
  426. MOVE.B D3,AREA_POSITION(A6)
  427. RTS
  428. BEFOR_SCROLL:
  429. TST.B MASTER_REQUEST+BACK2(A5)
  430. BNE.S BEFOR_SCROLL_1
  431. BSR NAGE_MOVE
  432. BSR GET_HERO_LR
  433. BSR BODY_HIT
  434. BSR GET_SCROLL_LIMIT
  435. BSR PLAYER_SCROLL
  436. BSR GET_SCROLL_TARGET
  437. BEFOR_SCROLL_1:
  438. RTS
  439. NAGE_MOVE:
  440. LEA.L HERO1(A5),A6
  441. BSR NAGE_MOVE_1
  442. LEA.L HERO2(A5),A6
  443. NAGE_MOVE_1:
  444. BTST.B #BHSS_NAGERARE,STATE(A6)
  445. BEQ NAGE_MOVE_100
  446. BTST.B #BHS_JUMP,HERO_STATE(A6)
  447. BNE NAGE_MOVE_100
  448. MOVEP.W WORK_N0(A6),D0
  449. CLR.B D0
  450. LEA.L 0(A5,D0.W),A4
  451. MOVE.L VX(A4),D0
  452. ADD.L X_POSITION(A4),D0
  453. CMP.L #DE_Lim*10000H,D0
  454. BCC.S NAGE_MOVE_2
  455. SUB.L #DE_Lim*10000H,D0
  456. BRA NAGE_MOVE_3
  457. NAGE_MOVE_2:
  458. SUB.L #3000000H-DE_Lim*10000H,D0
  459. BLE.S NAGE_MOVE_100
  460. NAGE_MOVE_3:
  461. MOVE.L ANOTHER_PLAYER(A6),A0
  462. MOVEP.W WORK_N0(A0),D1
  463. CLR.B D1
  464. NEG.L D0
  465. MOVE.L D0,VX(A5,D1.W)
  466. NAGE_MOVE_100:
  467. RTS
  468. GET_SCROLL_TARGET:
  469. TST.W REG_D1(A5)
  470. BEQ.S GST_1
  471. ; TST.B ST_BACK_FLAG(A5)
  472. ; BNE.S GST_001
  473. MOVE.B #1,STEP1+BACK2(A5)
  474. GST_001:
  475. MOVE.W Lx+BACK2(A5),Tx+BACK2(A5)
  476. RTS
  477. GST_1:
  478. MOVE.W Lx+BACK2(A5),D0
  479. ADD.W REG_D0(A5),D0
  480. MOVE.W D0,Tx+BACK2(A5)
  481. RTS
  482. PLAYER_SCROLL:
  483. CLR.W REG_D0(A5)
  484. CLR.W REG_D1(A5)
  485. CLR.B LIMIT_STOP+PLAYER1(A5)
  486. CLR.B LIMIT_STOP+PLAYER2(A5)
  487. MOVEQ.L #0,D0
  488. MOVE.B PHASE(A5),D0
  489. ADD.W D0,D0
  490. ADD.W D0,D0
  491. MOVE.L PS_VECTOR(PC,D0.W),A0
  492. JMP (A0)
  493. PS_VECTOR:
  494. DC.L PS_1P2P
  495. DC.L PS_1P2P
  496. DC.L PS_1P2P
  497. DC.L PS_1P2P
  498. ; DC.L PS_1P2P
  499. ; DC.L PS_1P2C
  500. ; DC.L PS_1C2P
  501. ; DC.L PS_1P2P
  502. PS_1P2C:
  503. LEA.L HERO1(A5),A3
  504. LEA.L HERO2(A5),A4
  505. JMP PS_PC(PC)
  506. PS_1C2P:
  507. LEA.L HERO1(A5),A4
  508. LEA.L HERO2(A5),A3
  509. PS_PC:
  510. LEA.L (A4),A6
  511. BSR MAP_CHECK
  512. LEA.L (A3),A6
  513. BSR MAP_CHECK
  514. BSR SCR_DELTA_FREE
  515. LEA.L (A4),A6
  516. BSR SCR_DELTA_LIMIT
  517. RTS
  518. PS_1P2P:
  519. LEA.L HERO1(A5),A6
  520. BSR MAP_CHECK
  521. LEA.L HERO2(A5),A6
  522. BSR MAP_CHECK
  523. BSR SCR_DELTA_LIMIT
  524. LEA.L HERO1(A5),A6
  525. BSR SCR_DELTA_LIMIT
  526. RTS
  527. MAP_CHECK:
  528. MOVEP.W WORK_N0(A6),D0
  529. CLR.B D0
  530. LEA.L 0(A5,D0.W),A0
  531. MOVE.L X_POSITION(A6),D2
  532. MOVE.L D2,D1
  533. ADD.L VX(A0),D1
  534. CMP.L #DE_Lim*10000H,D1
  535. BGE.S MAP_CHECK_0
  536. MOVE.B #4,LIMIT_STOP+PLAYER_OFFSET(A6)
  537. MOVE.L #DE_Lim*10000H,D2
  538. MOVE.L X_POSITION(A6),D0
  539. BRA MAP_FLIP
  540. RTS
  541. MAP_CHECK_0:
  542. CMP.L #3000000H-DE_Lim*10000H,D1
  543. BLT.S MAP_CHECK_1
  544. MOVE.B #8,LIMIT_STOP+PLAYER_OFFSET(A6)
  545. MOVE.L #3000000H-DE_Lim*10000H,D2
  546. MOVE.L X_POSITION(A6),D0
  547. MAP_FLIP:
  548. SUB.L D2,D0
  549. NEG.L D0
  550. MOVE.L VX(A0),D3
  551. MOVE.L D0,VX(A0)
  552. BTST.B #BHS_DAMAGE,HERO_STATE(A6)
  553. BEQ.S MAP_FLIP_1
  554. BTST.B #BHS_JUMP,HERO_STATE(A6)
  555. BNE.S MAP_FLIP_1
  556. NEG.L D3
  557. ; ADD.L D3,D3
  558. MOVE.L ANOTHER_PLAYER(A6),A1
  559. MOVEP.W WORK_N0(A1),D0
  560. CLR.B D0
  561. ADD.L D3,VX(A5,D0.W)
  562. MAP_FLIP_1:
  563. MAP_CHECK_1:
  564. RTS
  565. SCR_DELTA_LIMIT:
  566. MOVEP.W WORK_N0(A6),D0
  567. CLR.B D0
  568. LEA.L 0(A5,D0.W),A0
  569. MOVE.L X_POSITION(A6),D2
  570. MOVE.L VX(A0),D4
  571. ADD.L D4,D2
  572. SWAP D2
  573. CMP.W DISP_LEFT+BACK2(A5),D2
  574. BLT.S SDL_LEFT
  575. CMP.W DISP_RIGHT+BACK2(A5),D2
  576. BLE.S SDL_R_5
  577. SUB.W DISP_RIGHT+BACK2(A5),D2
  578. CMP.W SL_RIGHT+BACK2(A5),D2
  579. BLE SDL_R_3
  580. TST.B STEP1+BACK2(A5)
  581. BEQ SDL_R_6
  582. TST.L D4
  583. BLE SDL_R_2
  584. MOVE.W DISP_RIGHT+BACK2(A5),D0
  585. SUB.W X_POSITION(A6),D0
  586. BGE SDL_R_1
  587. MOVE.B #8,LIMIT_STOP+PLAYER_OFFSET(A6)
  588. MOVEQ.L #0,D0
  589. SDL_R_1:
  590. SWAP D0
  591. CLR.W D0
  592. CMP.L D0,D4
  593. BLT.S SDL_R_2
  594. MOVE.L D0,VX(A0)
  595. SDL_R_2:
  596. MOVE.W SL_RIGHT+BACK2(A5),D2
  597. SDL_R_3:
  598. TST.W REG_D0(A5)
  599. BLT SDL_R_7
  600. SDL_R_4:
  601. ADD.W D2,REG_D0(A5)
  602. SUB.W D2,SL_LEFT+BACK2(A5)
  603. SUB.W D2,SL_RIGHT+BACK2(A5)
  604. SDL_R_5:
  605. RTS
  606. SDL_R_6:
  607. MOVE.W #1,REG_D1(A5)
  608. RTS
  609. SDL_R_7:
  610. TST.W VX(A0)
  611. BLE.S SDL_R_8
  612. CLR.L VX(A0)
  613. SDL_R_8:
  614. RTS
  615. SDL_LEFT:
  616. SUB.W DISP_LEFT+BACK2(A5),D2
  617. CMP.W SL_LEFT+BACK2(A5),D2
  618. BGE SDL_L_3
  619. TST.B STEP1+BACK2(A5)
  620. BEQ SDL_L_6
  621. TST.L D4
  622. BGE SDL_L_2
  623. MOVE.W DISP_LEFT+BACK2(A5),D0
  624. SUB.W X_POSITION(A6),D0
  625. BLE SDL_L_1
  626. MOVE.B #4,LIMIT_STOP+PLAYER_OFFSET(A6)
  627. MOVEQ.L #0,D0
  628. SDL_L_1:
  629. SWAP D0
  630. CLR.W D0
  631. CMP.L D0,D4
  632. BGT.S SDL_L_2
  633. MOVE.L D0,VX(A0)
  634. SDL_L_2:
  635. MOVE.W SL_LEFT+BACK2(A5),D2
  636. SDL_L_3:
  637. TST.W REG_D0(A5)
  638. BGT SDL_L_7
  639. SDL_L_4:
  640. ADD.W D2,REG_D0(A5)
  641. SUB.W D2,SL_LEFT+BACK2(A5)
  642. SUB.W D2,SL_RIGHT+BACK2(A5)
  643. SDL_L_5:
  644. RTS
  645. SDL_L_6:
  646. MOVE.W #1,REG_D1(A5)
  647. RTS
  648. SDL_L_7:
  649. TST.W VX(A0)
  650. BLE.S SDL_L_8
  651. CLR.L VX(A0)
  652. SDL_L_8:
  653. RTS
  654. SCR_DELTA_FREE:
  655. MOVEP.W WORK_N0(A6),D0
  656. CLR.B D0
  657. LEA.L 0(A5,D0.W),A0
  658. MOVE.L X_POSITION(A6),D2
  659. MOVE.L VX(A0),D4
  660. ADD.L D4,D2
  661. SWAP D2
  662. CMP.W DISP_LEFT+BACK2(A5),D2
  663. BLT.S SDF_LEFT
  664. CMP.W DISP_RIGHT+BACK2(A5),D2
  665. BLE.S SDF_R_3
  666. SUB.W DISP_RIGHT+BACK2(A5),D2
  667. CMP.W SL_RIGHT+BACK2(A5),D2
  668. BLE SDF_R_1
  669. TST.B STEP1+BACK2(A5)
  670. BEQ SDF_R_4
  671. SDF_R_1:
  672. MOVE.W D2,REG_D0(A5)
  673. SUB.W D2,SL_LEFT+BACK2(A5)
  674. SUB.W D2,SL_RIGHT+BACK2(A5)
  675. SDF_R_3:
  676. RTS
  677. SDF_R_4:
  678. MOVE.W #1,REG_D1(A5)
  679. RTS
  680. SDF_LEFT:
  681. SUB.W DISP_LEFT+BACK2(A5),D2
  682. CMP.W SL_LEFT+BACK2(A5),D2
  683. BGE SDF_L_1
  684. TST.B STEP1+BACK2(A5)
  685. BEQ SDF_L_4
  686. SDF_L_1:
  687. MOVE.W D2,REG_D0(A5)
  688. SUB.W D2,SL_LEFT+BACK2(A5)
  689. SUB.W D2,SL_RIGHT+BACK2(A5)
  690. SDF_L_3:
  691. RTS
  692. SDF_L_4:
  693. MOVE.W #1,REG_D1(A5)
  694. RTS
  695. GET_SCROLL_LIMIT:
  696. MOVE.W X_POSITION(A1),D0
  697. SUB.W DISP_RIGHT+BACK2(A5),D0
  698. BLE.S GSL_1
  699. MOVEQ.L #0,D0
  700. GSL_1:
  701. MOVE.W D0,SL_LEFT+BACK2(A5)
  702. MOVE.W X_POSITION(A0),D0
  703. SUB.W DISP_LEFT+BACK2(A5),D0
  704. BGE.S GSL_2
  705. MOVEQ.L #0,D0
  706. GSL_2:
  707. MOVE.W D0,SL_RIGHT+BACK2(A5)
  708. RTS
  709. BODY_HIT:
  710. IFNE 0
  711. A0 A2 A4 left hero lwork body body_hit
  712. A1 A3 A6 right hero lwork body body_hit
  713. VX result
  714. left right left right
  715. 0 0 * 0 0
  716. 0 + 0 RVX
  717. 0 - * RVX/2 RVX/2
  718. + 0 * LVX/2 LVX/2
  719. + + LVX RVX (LVX<RVX)
  720. RVX RVX (LVX=>RVX)
  721. + - LVX/2 (LVX<-RVX)
  722. RVX/2 (LVX=>-RVX)
  723. - 0 LVX 0
  724. - + LVX RVX
  725. - - LVX RVX (LVX<RVX)
  726. LVX LVX (LVX=>RVX)
  727. ENDC
  728. BTST.B #BHSS_NAGERARE,STATE(A0)
  729. BNE BODY_HIT_NON
  730. BTST.B #BHSS_NAGERARE,STATE(A1)
  731. BNE BODY_HIT_NON
  732. MOVEP.W WORK_N0(A0),D0
  733. CLR.B D0
  734. LEA.L 0(A5,D0.W),A2
  735. TST.L VZ(A2)
  736. BGT BODY_HIT_NON
  737. MOVEP.W WORK_N0(A2),D0
  738. CLR.B D0
  739. MOVE.B WORK_N1(A5,D0.W),(A5)
  740. MOVE.W (A5),D0
  741. LEA.L 0(A5,D0.W),A4
  742. MOVEP.W WORK_N0(A1),D0
  743. CLR.B D0
  744. LEA.L 0(A5,D0.W),A3
  745. TST.L VZ(A3)
  746. BGT BODY_HIT_NON
  747. MOVEP.W WORK_N0(A3),D0
  748. CLR.B D0
  749. MOVE.B WORK_N1(A5,D0.W),(A5)
  750. MOVE.W (A5),D0
  751. LEA.L 0(A5,D0.W),A6
  752. MOVE.W VX(A2),D2
  753. MOVE.W VX(A3),D3
  754. MOVE.W HIT_LEFT(A4),D0
  755. ADD.W D2,D0
  756. MOVE.W HIT_RIGHT(A6),D1
  757. ADD.W D3,D1
  758. CMP.W D1,D0
  759. BGT BODY_HIT_NON
  760. MOVEQ.L #0,D6
  761. MOVE.W HIT_RIGHT(A4),D6
  762. ADD.W D2,D6
  763. MOVE.W HIT_LEFT(A6),D1
  764. ADD.W D3,D1
  765. SUB.W D1,D6 D6 over size
  766. BLT BODY_HIT_NON
  767. MOVE.W VZ(A2),D4
  768. MOVE.W VZ(A3),D5
  769. MOVE.W HIT_UPPER(A4),D0
  770. ADD.W D4,D0
  771. MOVE.W HIT_LOWER(A6),D1
  772. ADD.W D5,D1
  773. CMP.W D1,D0
  774. BLT BODY_HIT_NON
  775. MOVE.W HIT_LOWER(A4),D0
  776. ADD.W D4,D0
  777. MOVE.W HIT_UPPER(A6),D1
  778. ADD.W D5,D1
  779. CMP.W D1,D0
  780. BGT BODY_HIT_NON
  781. BSR GET_BODY_MOVE
  782. BSR DAM_STOP
  783. MOVE.L X_POSITION(A1),D0
  784. ADD.L D3,D0
  785. SUB.L #3000000H-DE_Lim*10000H,D0
  786. BLE.S BODY_HIT_1
  787. SUB.L D0,D3
  788. SUB.L D0,D2
  789. BODY_HIT_1:
  790. MOVE.L X_POSITION(A0),D0
  791. ADD.L D2,D0
  792. SUB.L #DE_Lim*10000H,D0
  793. BGE.S BODY_HIT_2
  794. SUB.L D0,D3
  795. SUB.L D0,D2
  796. BODY_HIT_2:
  797. MOVE.L D2,VX(A2)
  798. MOVE.L D3,VX(A3)
  799. BODY_HIT_NON:
  800. RTS
  801. DAM_STOP:
  802. BTST.B #BHS_DAMAGE,HERO_STATE(A0)
  803. BEQ.S DAM_STOP_1
  804. TST.L VX(A2)
  805. BNE.S DAM_STOP_1
  806. SUB.L D2,D3
  807. MOVEQ.L #0,D2
  808. DAM_STOP_1:
  809. BTST.B #BHS_DAMAGE,HERO_STATE(A1)
  810. BEQ.S DAM_STOP_2
  811. TST.L VX(A3)
  812. BNE.S DAM_STOP_2
  813. SUB.L D3,D2
  814. MOVEQ.L #0,D3
  815. DAM_STOP_2:
  816. RTS
  817. GET_BODY_MOVE:
  818. MOVEQ.L #0,D0
  819. MOVE.L VX(A2),D2
  820. BEQ.S GBM_2
  821. BMI.S GBM_1
  822. MOVEQ.L #3*4,D0
  823. BRA.S GBM_2
  824. GBM_1:
  825. MOVEQ.L #6*4,D0
  826. GBM_2:
  827. MOVE.L VX(A3),D3
  828. BEQ.S GBM_4
  829. BMI.S GBM_3
  830. ADDQ.W #4,D0
  831. BRA.S GBM_4
  832. GBM_3:
  833. ADDQ.W #8,D0
  834. GBM_4:
  835. JMP GBM_TBL(PC,D0.W)
  836. GBM_TBL:
  837. JMP GBM_ZZ(PC)
  838. JMP GBM_ZP(PC)
  839. JMP GBM_ZM(PC)
  840. JMP GBM_PZ(PC)
  841. JMP GBM_PP(PC)
  842. JMP GBM_PM(PC)
  843. JMP GBM_MZ(PC)
  844. JMP GBM_MP(PC)
  845. JMP GBM_MM(PC)
  846. GBM_ZZ:
  847. OVER_MOVE:
  848. LSR.W #1,D6
  849. SWAP D6
  850. MOVE.L D6,D0
  851. ADD.L D6,D3
  852. SUB.L D6,D2
  853. RTS
  854. GBM_ZP:
  855. RTS
  856. GBM_ZM:
  857. ASR.L #2,D3
  858. MOVE.L D3,D2
  859. JMP OVER_MOVE(PC)
  860. GBM_PZ:
  861. ASR.L #2,D2
  862. MOVE.L D2,D3
  863. JMP OVER_MOVE(PC)
  864. GBM_PP:
  865. CMP.L D3,D2
  866. BGE.S GBM_PP_1
  867. RTS
  868. GBM_PP_1:
  869. MOVE.L D3,D2
  870. RTS
  871. GBM_PM:
  872. MOVE.L D2,D0
  873. ADD.L D3,D0
  874. BEQ.S GBM_PM_ZZ
  875. BGE.S GBM_PM_1
  876. ASR.L #1,D2
  877. MOVE.L D2,D3
  878. RTS
  879. GBM_PM_1:
  880. ASR.L #1,D3
  881. MOVE.L D3,D2
  882. RTS
  883. GBM_PM_ZZ:
  884. MOVEQ.L #0,D2
  885. MOVEQ.L #0,D3
  886. RTS
  887. GBM_MZ:
  888. RTS
  889. GBM_MP:
  890. RTS
  891. GBM_MM:
  892. CMP.L D3,D2
  893. BGE.S GBM_MM_1
  894. RTS
  895. GBM_MM_1:
  896. MOVE.L D2,D3
  897. RTS
  898. GET_HERO_LR:
  899. ; left and right hero work set
  900. ; out) A0:left hero
  901. ; A1:right hero
  902. LEA.L HERO1(A5),A0
  903. LEA.L HERO2(A5),A1
  904. MOVE.L X_POSITION(A0),D0
  905. CMP.L X_POSITION(A1),D0
  906. BCS.S GET_HERO_LR_1
  907. EXG.L A0,A1
  908. GET_HERO_LR_1:
  909. RTS
  910. BACK2_BUFFER_IN:
  911. CLR.B FLAG(A6)
  912. LEA.L BACK_VRAM(A5),A2
  913. JSR GET_S_BIG_VALUE(PC)
  914. MOVE.W REL_X(A6),D1
  915. LSL.W #7,D1
  916. MOVEQ.L #48-1,D7
  917. B2BI_1:
  918. MOVE.W D3,D0
  919. ROL.W #1,D4
  920. BCC.S B2BI_2
  921. SUB.W #100H,D0
  922. B2BI_2:
  923. MOVE.W D1,48*2(A2)
  924. MOVE.W D0,(A2)+
  925. DBRA D7,B2BI_1
  926. LEA.L VPOS_BUFFER(A5),A2
  927. MOVE.W SPRITE_POS(A6),D0
  928. ADD.W D0,D0
  929. LEA.L 0(A2,D0.W),A2
  930. MOVEQ.L #48,D5
  931. MOVE.W Wx(A6),D7
  932. LSR.W #4,D7
  933. MOVE.W D7,D6
  934. BEQ.S B2BI_4
  935. B2BI_3:
  936. CLR.W (A2)+
  937. SUBQ.W #1,D5
  938. SUBQ.W #1,D6
  939. BNE.S B2BI_3
  940. B2BI_4:
  941. MOVE.W REL_Y(A6),D1
  942. LSL.W #7,D1
  943. ADD.W #32,D1
  944. MOVE.W D1,(A2)+
  945. MOVE.W Wx(A6),D6
  946. ADD.W WIDTH_X(A6),D6
  947. LSR.W #4,D6
  948. SUB.W D7,D6
  949. B2BI_5:
  950. MOVE.W #40H,(A2)+
  951. SUBQ.W #1,D5
  952. BEQ.S B2BI_10
  953. DBRA D6,B2BI_5
  954. TST.W D5
  955. BLE.S B2BI_10
  956. B2BI_6:
  957. CLR.W (A2)+
  958. SUBQ.W #1,D5
  959. BNE.S B2BI_6
  960. B2BI_10:
  961. MOVE.B #1,FLAG(A6)
  962. RTS
  963. BACK2_SCROLL_WRITE:
  964. LEA.L BACK2(A5),A6
  965. CMP.W #SYS_BACK2,TYPE(A6)
  966. BNE B2SW_7
  967. TST.B FLAG(A6)
  968. BEQ B2SW_7
  969. LEA.L BACK_VRAM(A5),A0
  970. LEA.L LSPC_DATA,A2
  971. MOVE.W #1,2(A2)
  972. MOVE.W SPRITE_POS(A6),D2
  973. MOVE.W #SP_BIG,D0
  974. ADD.W D2,D0
  975. MOVE.W D0,-2(A2)
  976. REPT 48
  977. MOVE.W (A0)+,(A2)
  978. ENDR
  979. MOVE.W #SP_H,D0
  980. ADD.W D2,D0
  981. MOVE.W D0,-2(A2)
  982. REPT 48
  983. MOVE.W (A0)+,(A2)
  984. ENDR
  985. LEA.L VPOS_BUFFER(A5),A0
  986. MOVE.W SPRITE_POS(A6),D0
  987. ADD.W D0,D0
  988. LEA.L 0(A0,D0.W),A0
  989. MOVE.W #SP_V,D0
  990. ADD.W D2,D0
  991. MOVE.W D0,-2(A2)
  992. REPT 48
  993. MOVE.W (A0)+,(A2)
  994. ENDR
  995. CLR.B FLAG(A6)
  996. B2SW_7:
  997. RTS
  998. GET_S_BIG_VALUE:
  999. MOVE.W BIG_X(A6),D0
  1000. SUBQ.B #1,D0
  1001. MOVE.B D0,D1
  1002. LSR.B #4,D1
  1003. MOVE.B D1,(A5)
  1004. MOVE.W (A5),D3
  1005. MOVE.B D0,D3
  1006. AND.W #0FH,D0
  1007. ADD.W D0,D0
  1008. MOVE.W S_BIG_BIT(PC,D0.W),D4
  1009. RTS
  1010. S_BIG_BIT:
  1011. DC.W 1111111101111111B
  1012. DC.W 0111111101111111B
  1013. DC.W 0111111101110111B
  1014. DC.W 0111011101110111B
  1015. DC.W 0111011101010111B
  1016. DC.W 0101011101010111B
  1017. DC.W 0101011101010101B
  1018. DC.W 0101010101010101B
  1019. DC.W 0001010101010101B
  1020. DC.W 0001010100010101B
  1021. DC.W 0001010100010001B
  1022. DC.W 0001000100010001B
  1023. DC.W 0001000100000001B
  1024. DC.W 0000000100000001B
  1025. DC.W 0000000100000000B
  1026. DC.W 0000000000000000B
  1027. BACK2_INIT:
  1028. LEA.L BACK2(A5),A6
  1029. MOVE.W #1,SPRITE_POS(A6)
  1030. MOVE.B #0,FLAG(A6)
  1031. MOVE.W #SYS_BACK2,TYPE(A6)
  1032. CLR.L Z_POSITION(A6)
  1033. CLR.B MOVE_DIR(A6)
  1034. CLR.B MASTER_REQUEST(A6)
  1035. MOVE.W REG_D0(A5),Lx(A6)
  1036. MOVE.W REG_D0(A5),Tx(A6)
  1037. MOVE.W REG_D1(A5),BIG_X(A6)
  1038. ; MOVE.W #180H,Lx(A6)
  1039. ; MOVE.W #180H,Tx(A6)
  1040. ; MOVE.W #100H,BIG_X(A6)
  1041. JSR B2_BUFFER_WRITE(PC)
  1042. JSR LSPC_WRITE2(PC)
  1043. MOVE.B #0,STEP1(A6)
  1044. MOVE.B #0,STEP2(A6)
  1045. CMP.W #100H,BIG_X(A6)
  1046. BEQ.S B2I_1
  1047. MOVE.B #2,STEP1(A6)
  1048. B2I_1:
  1049. JSR BACK1_CLR(PC)
  1050. BSR WINDOW_X_PAR_SET
  1051. RTS
  1052. BACK1_CLR:
  1053. LEA.L BACK1_BUFFER(A5),A0
  1054. MOVEQ.L #0,D0
  1055. MOVE.W #(32*16*3)/(4*8)-1,D7
  1056. BACK1_CLR_1:
  1057. MOVE.L D0,(A0)+
  1058. MOVE.L D0,(A0)+
  1059. MOVE.L D0,(A0)+
  1060. MOVE.L D0,(A0)+
  1061. MOVE.L D0,(A0)+
  1062. MOVE.L D0,(A0)+
  1063. MOVE.L D0,(A0)+
  1064. MOVE.L D0,(A0)+
  1065. DBRA D7,BACK1_CLR_1
  1066. RTS
  1067. B2_BUFFER_WRITE:
  1068. ;back pattern format
  1069. ;
  1070. ; type d13 d14 d15
  1071. ;---------------------------------------
  1072. ; 0 ch13 A4 A8
  1073. ; 1 ch13 H A?
  1074. ; 2 ch13 ch14 A?
  1075. ; 3 H A4 A8
  1076. ; 4 H V A?
  1077. ; A? = A4 (d0=1)
  1078. ; A8 (d0=0)
  1079. BACK_TYPE SET 1
  1080. MOVE.L PAL_IND_INFO(A5),A4
  1081. MOVE.W AREA_No(A5),D0
  1082. LEA.L GENERAL_TABLE(PC),A0
  1083. ADD.W D0,D0
  1084. ADD.W D0,D0
  1085. MOVE.L -4(A0,D0.W),A2
  1086. LEA.L BACK2_BUFFER+40H(A5),A1
  1087. BSR B2BW_1
  1088. LEA.L BACK2_BUFFER(A5),A1
  1089. B2BW_1:
  1090. MOVEQ.L #3-1,D7
  1091. B2BW_2:
  1092. MOVE.B (A2)+,(A5)
  1093. MOVE.W (A5),D0
  1094. ADD.W D0,D0
  1095. MOVE.L BACK_INFO(A5),A3
  1096. LEA.L 0(A3,D0.W),A3
  1097. MOVEQ.L #16-1,D6
  1098. B2BW_3:
  1099. MOVEQ.L #16-1,D5
  1100. B2BW_4:
  1101. IFEQ BACK_TYPE-0
  1102. MOVE.W (A3)+,D0
  1103. MOVE.W D0,D1
  1104. AND.W #3FFFH,D0
  1105. ROL.W #4,D1
  1106. AND.W #00001100B,D1
  1107. MOVE.W D0,(A1)+
  1108. MOVE.B 0(A4,D0.W),(A1)+
  1109. MOVE.B D1,(A1)+
  1110. ENDC
  1111. IFEQ BACK_TYPE-1
  1112. MOVEQ.L #0,D2
  1113. MOVE.W (A3)+,D0
  1114. MOVE.W D0,D1
  1115. AND.W #3FFFH,D0
  1116. ADD.W D1,D1
  1117. ADDX.W D2,D2
  1118. ADD.W D2,D2
  1119. BTST.L #0,D0
  1120. BNE.S B2BW_5
  1121. ADD.W D2,D2
  1122. B2BW_5:
  1123. ADD.W D1,D1
  1124. ADDX.W D2,D2
  1125. MOVE.W D0,(A1)+
  1126. MOVE.B 0(A4,D0.W),(A1)+
  1127. MOVE.B D2,(A1)+
  1128. ENDC
  1129. IFEQ BACK_TYPE-2
  1130. MOVEQ.L #0,D2
  1131. MOVE.W (A3)+,D0
  1132. MOVE.W D0,D1
  1133. AND.W #7FFFH,D0
  1134. ADD.W D1,D1
  1135. ADDX.W D2,D2
  1136. ADD.W D2,D2
  1137. BTST.L #0,D0
  1138. BNE.S B2BW_5
  1139. ADD.W D2,D2
  1140. B2BW_5:
  1141. ADD.W D2,D2
  1142. MOVE.W D0,(A1)+
  1143. MOVE.B 0(A4,D0.W),(A1)+
  1144. MOVE.B D2,(A1)+
  1145. ENDC
  1146. IFEQ BACK_TYPE-3
  1147. MOVEQ.L #0,D2
  1148. MOVE.W (A3)+,D0
  1149. MOVE.W D0,D1
  1150. AND.W #1FFFH,D0
  1151. ADD.W D1,D1
  1152. ADDX.W D2,D2
  1153. ADD.W D1,D1
  1154. ADDX.W D2,D2
  1155. ADD.W D2,D2
  1156. ADD.W D1,D1
  1157. ADDX.W D2,D2
  1158. MOVE.W D0,(A1)+
  1159. MOVE.B 0(A4,D0.W),(A1)+
  1160. MOVE.B D2,(A1)+
  1161. ENDC
  1162. IFEQ BACK_TYPE-4
  1163. MOVEQ.L #0,D2
  1164. MOVE.W (A3)+,D0
  1165. MOVE.W D0,D1
  1166. AND.W #1FFFH,D0
  1167. ADD.W D1,D1
  1168. ADDX.W D2,D2
  1169. BTST.L #0,D0
  1170. BNE.S B2BW_5
  1171. ADD.W D2,D2
  1172. B2BW_5:
  1173. ADD.W D1,D1
  1174. ADDX.W D2,D2
  1175. ADD.W D1,D1
  1176. ADDX.W D2,D2
  1177. MOVE.W D0,(A1)+
  1178. MOVE.B 0(A4,D0.W),(A1)+
  1179. MOVE.B D0,(A1)+
  1180. ENDC
  1181. DBRA D5,B2BW_4
  1182. LEA.L 40H(A1),A1
  1183. DBRA D6,B2BW_3
  1184. DBRA D7,B2BW_2
  1185. RTS
  1186. LSPC_WRITE2:
  1187. ADDQ.B #1,LSPC_BUSY(A5)
  1188. ADDQ.B #1,MESS_BUSY(A5)
  1189. LEA.L LSPC_DATA,A2
  1190. MOVE.W #1,2(A2)
  1191. MOVE.W SPRITE_POS(A6),D0
  1192. LSL.W #6,D0
  1193. MOVE.W D0,-2(A2)
  1194. LEA.L BACK2_BUFFER(A5),A0
  1195. MOVE.W #(32*16*3*2)/8-1,D7
  1196. LSPC_WRITE2_1:
  1197. MOVE.W (A0)+,(A2)
  1198. MOVE.W (A0)+,(A2)
  1199. MOVE.W (A0)+,(A2)
  1200. MOVE.W (A0)+,(A2)
  1201. MOVE.W (A0)+,(A2)
  1202. MOVE.W (A0)+,(A2)
  1203. MOVE.W (A0)+,(A2)
  1204. MOVE.W (A0)+,(A2)
  1205. DBRA D7,LSPC_WRITE2_1
  1206. SUBQ.B #1,MESS_BUSY(A5)
  1207. SUBQ.B #1,LSPC_BUSY(A5)
  1208. RTS
  1209. GENERAL_TABLE:
  1210. DC.L GEN_AREA_1
  1211. DC.L GEN_AREA_2
  1212. DC.L GEN_AREA_2
  1213. DC.L GEN_AREA_3
  1214. DC.L GEN_AREA_4
  1215. DC.L GEN_AREA_4
  1216. DC.L GEN_AREA_5
  1217. DC.L GEN_AREA_6
  1218. DC.L GEN_AREA_6
  1219. DC.L GEN_AREA_7
  1220. DC.L GEN_AREA_8
  1221. DC.L GEN_AREA_8
  1222. GEN_AREA_1:
  1223. DC.B 0000H,0001H,0002H
  1224. DC.B 0003H,0004H,0005H,000H,000H
  1225. GEN_AREA_2:
  1226. DC.B 0006H,0007H,0008H
  1227. DC.B 0009H,000AH,000BH,000H,000H
  1228. GEN_AREA_3:
  1229. DC.B 000CH,000DH,000EH
  1230. DC.B 000FH,0010H,0011H,000H,000H
  1231. GEN_AREA_4:
  1232. DC.B 0012H,0013H,0014H
  1233. DC.B 0015H,0016H,0017H,000H,000H
  1234. GEN_AREA_5:
  1235. DC.B 0018H,0019H,001AH
  1236. DC.B 001BH,001CH,001DH,000H,000H
  1237. GEN_AREA_6:
  1238. DC.B 001EH,001FH,0020H
  1239. DC.B 0021H,0022H,0023H,000H,000H
  1240. GEN_AREA_7:
  1241. DC.B 0024H,0025H,0026H
  1242. DC.B 0027H,0028H,0029H,000H,000H
  1243. GEN_AREA_8:
  1244. DC.B 002AH,002BH,002CH
  1245. DC.B 002DH,002EH,002FH,000H,000H
  1246. INCLUDE WORK.INC
  1247.