Level_Select_Routines.s 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983
  1. Clear_scroll_Planes
  2. move.l Plane1,a0
  3. move.l buffered_Plane1,a1
  4. move.w #((BYTES_PER_ROW*SCROLL_HEIGHT*BACKPLANES)/4)-1,d0
  5. clear_memory_loop
  6. clr.l (a0)+
  7. clr.l (a1)+
  8. dbra d0,clear_memory_loop
  9. rts
  10. Selection_setup
  11. *bsr clear_scroll_planes
  12. *move.l Buffered_Plane1,d0
  13. *move.w d0,SELECTPLANE1LOW
  14. *swap d0
  15. *move.w d0,SELECTPLANE1HIGH
  16. *move.l Buffered_Plane2,d0
  17. *move.w d0,SELECTPLANE2LOW
  18. *swap d0
  19. *move.w d0,SELECTPLANE2HIGH
  20. move.l #Level_Select_Graphics,d0
  21. move.w d0,SELECTPLANE1LOW
  22. swap.w d0
  23. move.w d0,SELECTPLANE1HIGH
  24. move.l #Level_Select_Graphics+40*256,d0
  25. move.w d0,SELECTPLANE2LOW
  26. swap.w d0
  27. move.w d0,SELECTPLANE2HIGH
  28. move.l #Level_Select_Graphics+40*256*2,d0
  29. move.w d0,SELECTPLANE3LOW
  30. swap.w d0
  31. move.w d0,SELECTPLANE3HIGH
  32. move.l #Level_Select_Graphics+40*256*3,d0
  33. move.w d0,SELECTPLANE4LOW
  34. swap.w d0
  35. move.w d0,SELECTPLANE4HIGH
  36. move.l #blank_sprite,d0
  37. swap d0
  38. move.w d0,blank_sprites+2
  39. move.w d0,blank_sprites+10
  40. move.w d0,blank_sprites+18
  41. move.w d0,blank_sprites+26
  42. move.w d0,blank_sprites+34
  43. move.w d0,blank_sprites+42
  44. move.w d0,blank_sprites+50
  45. swap d0
  46. move.w d0,blank_sprites+6
  47. move.w d0,blank_sprites+14
  48. move.w d0,blank_sprites+22
  49. move.w d0,blank_sprites+30
  50. move.w d0,blank_sprites+38
  51. move.w d0,blank_sprites+46
  52. move.w d0,blank_sprites+54
  53. move.l #level_dpaint_cols,a2
  54. move.l #level_select_colours_high,a0
  55. move.l #level_select_colours_low,a1
  56. bsr set_colour_map
  57. move.l #level_select_copper_list,cop1lc(a6)
  58. clr.w copjmp1(a6)
  59. move.l #Player1_Selection_Boxes,a0
  60. move.l #Player1_Select_Struct,a1
  61. *bsr draw_player_box
  62. move.w #0,current_pass_count
  63. move.l buffered_plane1,a0
  64. add.l #70*BYTES_PER_ROW+2,a0
  65. move.l #password_entry_text,a5
  66. *jsr write_string
  67. move.l buffered_plane1,a0
  68. add.l #86*BYTES_PER_ROW+2,a0
  69. move.l #password_entry_text+psel,a5
  70. *jsr write_string
  71. move.l buffered_plane1,a0
  72. add.l #102*BYTES_PER_ROW+2,a0
  73. move.l #password_entry_text+psel*2,a5
  74. *jsr write_string
  75. move.l buffered_plane1,a0
  76. add.l #118*BYTES_PER_ROW+2,a0
  77. move.l #password_entry_text+psel*3,a5
  78. *jsr write_string
  79. rts
  80. Create_Password
  81. move.l #Password_Data,a1
  82. move.l #Password_Text,a5
  83. move.w #PASSWORD_BYTES-1,d7
  84. calc_password
  85. move.w #2-1,d6
  86. move.b (a1)+,d0
  87. dig_loop
  88. move.b d0,d1
  89. andi.b #$f,d1
  90. cmp.b #10,d1
  91. bge.s not_digit
  92. add.b #'0',d1
  93. bra.s digit_alright
  94. not_digit
  95. add.b #'A'-10,d1
  96. digit_alright
  97. move.b d1,(a5)+
  98. asr.w #4,d0
  99. dbra d6,dig_loop
  100. dbra d7,calc_password
  101. rts
  102. move_stage_player
  103. bsr rawreadjoy
  104. btst #P1_Fire,d0 ; ignore fire button
  105. beq.s no_enter_level
  106. move.w #-1,d0
  107. bra no_exit_selected
  108. no_enter_level
  109. btst #P1_Up,d0
  110. beq.s tryotherexits1
  111. move.w #north,d7
  112. bra.s check_path_of_exit
  113. tryotherexits1
  114. btst #P1_Right,d0
  115. beq.s tryotherexits2
  116. move.w #east,d7
  117. bra.s check_path_of_exit
  118. tryotherexits2
  119. btst #P1_down,d0
  120. beq.s tryotherexits3
  121. move.w #south,d7
  122. bra.s check_path_of_exit
  123. tryotherexits3
  124. btst #P1_Left,d0
  125. beq.s tryotherexits4
  126. move.w #west,d7
  127. bra.s check_path_of_exit
  128. tryotherexits4
  129. bra no_exit_selected
  130. check_path_of_exit
  131. move.w player_at_stage,d6
  132. subq.w #1,d6
  133. lsl.w #3,d6 ; *8 (4 possible exits per stage)
  134. add.w d6,d7 ; actual exit to test
  135. move.l #Stage_Exits,a1
  136. move.w (a1,d7.w),d0 ; get path to travel on
  137. tst.w d0
  138. beq.s no_exit_this_way
  139. ; now check path_flag
  140. move.l #Path_Flags,a1
  141. move.w d0,d6
  142. subq.w #1,d6 ; 1 less for bits
  143. move.w d6,d7
  144. asr.w #5,d6 ; divide by 32 (bits per longword)
  145. andi.w #%11111,d7 ; lower 5 bits 0-31 level
  146. move.w #31,d5 ; for the old swap round
  147. sub.w d7,d5 ; get right representation
  148. move.l (a1,d6.w*8),d7
  149. btst.l d5,d7 ; check path flag
  150. beq.s path_not_drawn_yet
  151. ; select stage to move to via path
  152. move.w player_at_stage,d5 ; 'from' stage
  153. move.l #Stage_Paths,a1
  154. move.w d0,d7
  155. sub.w #1,d7 ; less one for memory
  156. move.w (a1,d7.w*4),d6 ; get path from
  157. cmp.w player_at_stage,d6 ; are we at this number already
  158. bne.s ok_we_want_this_stage ; no ok moving back to it
  159. move.w 2(a1,d7.w*4),d6 ; else must be other stage
  160. ok_we_want_this_stage
  161. move.w d6,player_at_stage ; set new stage
  162. ; get walk from/to positions
  163. move.l #Stage_Paths,a2
  164. move.l #Stage_positions,a3
  165. subq.w #1,d5 ; they start at one you know
  166. subq.w #1,d6
  167. move.w (a3,d5.w*4),d0 ; get from x co-ord
  168. move.w 2(a3,d5.w*4),d1 ; get from y co-ord
  169. move.w (a3,d6.w*4),d2 ; get to x co-ord
  170. move.w 2(a3,d6.w*4),d3 ; get to y co-ord
  171. bsr calc_walk_parameters
  172. path_not_drawn_yet
  173. no_exit_this_way
  174. no_exit_selected
  175. rts
  176. Position_Stage_Player
  177. move.w Player_at_Stage,d7
  178. subq.w #1,d7
  179. move.l #Stage_Positions,a1
  180. move.w (a1,d7.w*4),d0 ; get x
  181. move.w 2(a1,d7.w*4),d1 ; get y
  182. *sub.w #7,d0 ; centre
  183. *sub.w #7,d1 ; centre
  184. move.w d0,sprite_x
  185. move.w d1,sprite_y
  186. rts
  187. draw_paths
  188. move.l #path_flags,a1 ; whether a path has been allowed
  189. move.l #stage_paths,a2 ; which two stages the path connects
  190. move.l #stage_positions,a3 ; position of the stages
  191. move.w #NUM_PATHS-1,d7
  192. path_loop
  193. move.w d7,d6
  194. move.w d7,d4
  195. asr.w #5,d6 ; divide by 32 (bits per longword)
  196. andi.w #%11111,d4 ; lower 5 bits 0-31 level
  197. move.w #31,d5 ; for the old swap round
  198. sub.w d4,d5 ; get right representation
  199. move.l (a1,d6.w*8),d4
  200. btst.l d5,d4 ; check path flag
  201. beq.s no_link_for_this_path
  202. move.w (a2,d7.w*4),d5 ; get 'from' stage number
  203. move.w 2(a2,d7.w*4),d6 ; get 'to' stage number
  204. subq.w #1,d5 ; they start at one you know
  205. subq.w #1,d6
  206. move.w (a3,d5.w*4),d0 ; get from x co-ord
  207. move.w 2(a3,d5.w*4),d1 ; get from y co-ord
  208. move.w (a3,d6.w*4),d2 ; get to x co-ord
  209. move.w 2(a3,d6.w*4),d3 ; get to y co-ord
  210. move.l buffered_plane1,a0
  211. bsr draw_line
  212. bra.s path_done
  213. no_link_for_this_path
  214. move.w (a2,d7.w*4),d5 ; get 'from' stage number
  215. move.w 2(a2,d7.w*4),d6 ; get 'to' stage number
  216. subq.w #1,d5 ; they start at one you know
  217. subq.w #1,d6
  218. move.w (a3,d5.w*4),d0 ; get from x co-ord
  219. move.w 2(a3,d5.w*4),d1 ; get from y co-ord
  220. move.w (a3,d6.w*4),d2 ; get to x co-ord
  221. move.w 2(a3,d6.w*4),d3 ; get to y co-ord
  222. move.l buffered_plane2,a0
  223. bsr draw_line
  224. path_done
  225. dbra d7,path_loop
  226. rts
  227. NUM_STAGES EQU 4
  228. NUM_PATHS EQU 4
  229. PassWord_Data
  230. ; Password data includes the following
  231. ;
  232. ; 1. Stage Player is at
  233. ; 2. All the links which have been made
  234. Player_at_Stage
  235. dc.w 1
  236. path_flags dc.l %11111111111111000011100101100111 ; first 32 pathways
  237. PASSWORD_BYTES EQU *-PassWord_Data
  238. dc.l 0
  239. dc.l 0
  240. dc.l 0
  241. text_test
  242. dc.b "PASSWORD : <"
  243. Password_Text
  244. dcb.b PASSWORD_BYTES*2,"0"
  245. dc.b ">",0
  246. even
  247. stage_positions
  248. dc.w 281,256-174 ; stage 1
  249. dc.w 256,256-149 ; stage 2
  250. dc.w 162,256-149 ; stage 3
  251. dc.w 78,256-149 ; stage 4
  252. dc.w 35,256-88 ; stage 5
  253. dc.w 103,256-88 ; stage 6
  254. dc.w 205,256-88 ; stage 7
  255. dc.w 154,256-36 ; stage 8
  256. stage_paths
  257. dc.w 1,2
  258. dc.w 2,3
  259. dc.w 3,4
  260. dc.w 3,6
  261. dc.w 5,6
  262. dc.w 6,7
  263. dc.w 7,8
  264. north equ 0
  265. east equ 2
  266. south equ 4
  267. west equ 6
  268. ; Stage exit of zero is null, otherwise path number
  269. Stage_Exits
  270. dc.w 0,0,1,0 ; stage 1
  271. dc.w 1,0,0,2 ; stage 2
  272. dc.w 0,2,4,3 ; stage 3
  273. dc.w 0,3,0,0 ; stage 4
  274. dc.w 0,5,0,0
  275. dc.w 4,6,0,5
  276. dc.w 0,0,7,6
  277. dc.w 7,0,0,0
  278. transit_flag
  279. dc.w 0
  280. * a0 pointer to bitmap, d0-d3 coords to draw to/from ok.
  281. calc_walk_parameters
  282. ; from d0,d1 to d2,d3
  283. move.w #1,transit_flag
  284. clr.w neg_x_walk_flag
  285. clr.w neg_y_walk_flag
  286. move.w d0,d4
  287. move.w d1,d5
  288. asl.w #7,d4
  289. asl.w #7,d5
  290. move.w d4,X_Fixed ; initial scaled x
  291. move.w d5,Y_Fixed ; initial scaled y
  292. sub.w d2,d0
  293. bpl.s no_neg_x_walk
  294. neg.w d0
  295. move.w #1,neg_x_walk_flag
  296. no_neg_x_walk
  297. sub.w d3,d1
  298. bpl.s no_neg_y_walk
  299. neg.w d1
  300. move.w #1,neg_y_walk_flag
  301. no_neg_y_walk
  302. cmp.w d0,d1
  303. bgt.s y_greater_walk
  304. x_greater_walk
  305. ext.l d0 ; for division
  306. ext.l d1 ; likewise
  307. move.w #1<<7,X_Increment ; Fixed (16,7)
  308. tst.l d1 ; check for nasty zero
  309. beq.s zero_y
  310. asl.w #7,d1 ; scale y to (16,7)
  311. divu.w d0,d1 ; calc y increment
  312. move.w d1,Y_Increment
  313. bra.s done_y_walk
  314. zero_y
  315. clr.w y_increment
  316. done_y_walk
  317. move.w d0,walk_countdown
  318. bra.s done_walk_calc
  319. y_greater_walk
  320. ext.l d0 ; for division
  321. ext.l d1 ; likewise
  322. move.w #1<<7,Y_Increment ; Fixed (16,7)
  323. tst.l d0 ; check for nasty zero
  324. beq.s zero_x
  325. asl.w #7,d0 ; scale y to (16,7)
  326. divu.w d1,d0 ; calc y increment
  327. move.w d0,X_Increment
  328. bra.s done_x_walk
  329. zero_x
  330. clr.w X_increment
  331. done_x_walk
  332. move.w d1,walk_countdown
  333. bra.s done_walk_calc
  334. done_walk_calc
  335. tst.w neg_x_walk_flag
  336. bne.s dont_negate_x_walk
  337. neg.w X_Increment
  338. dont_negate_x_walk
  339. tst.w neg_y_walk_flag
  340. bne.s dont_negate_y_walk
  341. neg.w Y_Increment
  342. dont_negate_y_walk
  343. rts
  344. X_Fixed dc.w 0
  345. Y_Fixed dc.w 0
  346. walk_countdown dc.w 0
  347. x_increment dc.w 0
  348. y_increment dc.w 0
  349. neg_x_walk_flag dc.w 0
  350. neg_y_walk_flag dc.w 0
  351. walk_the_line
  352. move.w X_Fixed,d0
  353. move.w Y_Fixed,d1
  354. add.w X_Increment,d0
  355. add.w Y_Increment,d1
  356. move.w d0,X_Fixed
  357. move.w d1,Y_Fixed
  358. asr.w #7,d0
  359. asr.w #7,d1
  360. move.w d0,sprite_x
  361. move.w d1,sprite_y
  362. subq.w #1,walk_countdown
  363. bne.s not_walked_yet
  364. move.w #0,transit_flag
  365. not_walked_yet
  366. rts
  367. draw_line
  368. movem.l d0-d7/a0-a6,-(sp)
  369. MOVEQ #0,D6
  370. MOVEQ #0,D7
  371. move.w D0,-(SP)
  372. MOVE.W D0,D6 ;STORE FOR USE IN CALCING START POS
  373. MOVE.W D1,D7
  374. CALC_OCTANT
  375. MOVEQ #0,D5 ;USE TO LOCATE OC
  376. sub.w d1,d3 ;sub y1 from y2
  377. bpl y2bigger
  378. neg.w d3
  379. bset #2,d5
  380. y2bigger
  381. sub.w d0,d2 ;x1 from x2
  382. bpl x2bigger
  383. neg.w d2
  384. bset #1,d5
  385. x2bigger
  386. cmp.w d2,d3 ;is deltax smaller than deltay
  387. BGe.s DELTAXSMALLER
  388. BSET #0,D5 ;D5 CONTAINS OCTANT POS
  389. move.w d3,sdelta
  390. move.w d2,ldelta
  391. bra.s calc_start
  392. DELTAXSMALLER
  393. move.w d3,ldelta
  394. move.w d2,sdelta
  395. CALC_START
  396. moveq #0,d2
  397. mulu #bytes_per_row,d7
  398. ADD.L D7,A0
  399. andi.w #$fff0,d6
  400. asr #3,d6
  401. ADD.L D6,A0 ;START POINT HELD IN A0
  402. MOVEQ #0,D6
  403. move.w sdelta,d6
  404. asl #1,d6
  405. move.w d6,sdelta
  406. MOVE.W LDELTA,D2
  407. MOVE.W d2,length
  408. SUB.W D2,D6
  409. asl #1,D2 ;CON LDELTA
  410. MOVE.W SDELTA,D1
  411. SUB.W D2,D1 ;contains xpres2
  412. MOVE.W (SP)+,D0 ;INIT BLTCON0
  413. andi.w #$000f,d0
  414. ROR.W #4,D0
  415. OR.W #$0b58,D0
  416. MOVE.W SDELTA,D7
  417. CMP.W LENGTH,D7
  418. BGT NO_SET
  419. MOVE.W #$40,D7
  420. BRA OR_IN_VAL
  421. NO_SET
  422. MOVE.W #0,D7
  423. OR_IN_VAL
  424. LEA TABLE,A6 ;OCTANT
  425. OR.B (A6,D5),D7
  426. BLITTER_IT
  427. BLITQ BTST #14,$dff002
  428. BNE BLITQ
  429. MOVE.W #$ffff,$dff072
  430. MOVE.W #$8000,$dff074 ;MUST BE THIS
  431. MOVE.L A0,$dff048 ;START ADDRESS
  432. MOVE.L A0,$dff054
  433. MOVE.l d6,$dff050 ;CONTAINS 2*SDELTA-LDELTA
  434. MOVE.W SDELTA,$dff062 ;2*SDELTA IN HERE
  435. MOVE.W d1,$dff064 ;CONTAINS 2*SDELTA-2*LDELTA (xpres2)
  436. MOVE.W D0,$dff040
  437. MOVE.W #bytes_per_row,$dff066 ;SCREEN WIDTH IN BYTES
  438. MOVE.W #bytes_per_row,$dff060
  439. MOVE.W D7,$dff042
  440. MOVE.W #$ffff,$dff044 ;MASK
  441. MOVE.W length,D0
  442. CMPi.W #0,D0
  443. BHI KLM
  444. MOVE.W #1,D0
  445. KLM
  446. asl #6,D0
  447. ADDi.W #2,D0
  448. MOVE.W D0,$dff058
  449. movem.l (sp)+,d0-d7/a0-a6
  450. RTS
  451. table
  452. DC.B 0*4+1
  453. DC.B 4*4+1
  454. DC.B 2*4+1
  455. DC.B 5*4+1
  456. DC.B 1*4+1
  457. DC.B 6*4+1
  458. DC.B 3*4+1
  459. DC.B 7*4+1
  460. EVEN
  461. sdelta dc.w 0
  462. length dc.w 0
  463. ldelta dc.w 0
  464. PassWord_Entry_Routine
  465. move.l #Player1_Selection_Boxes,a0
  466. move.l #Player1_Select_Struct,a1
  467. bsr draw_player_box
  468. moveq #0,d0
  469. bsr rawreadjoy
  470. move.l #Player1_Selection_Boxes,a0
  471. move.l #Player1_Select_Struct,a1
  472. bsr Move_Player_Box
  473. tst.l d0
  474. beq.s nothing_chosen
  475. ; button pressed
  476. move.w current_pass_count,d0
  477. move.w Fiddle_Number_Y(a1),d1
  478. mulu.w Num_Boxes_X(a0),d1
  479. add.w Fiddle_Number_X(a1),d1
  480. move.l #Password_Lookup,a1
  481. move.l #Password_Text,a2
  482. move.b (a1,d1),d3
  483. cmp.b #'.',d3 ; rub character ?
  484. bne.s dont_rub
  485. move.b #32,d3 ; space character
  486. tst.w d0
  487. beq.s no_char_to_rub
  488. move.b d3,-1(a2,d0)
  489. sub.w #1,current_pass_count
  490. bra.s no_char_to_rub
  491. dont_rub
  492. cmp.w #PASSWORD_BYTES*2,d0
  493. bge.s full_up_password
  494. move.b d3,(a2,d0)
  495. add.w #1,current_pass_count
  496. no_char_to_rub
  497. full_up_password
  498. nothing_chosen
  499. move.l #Player1_Selection_Boxes,a0
  500. move.l #Player1_Select_Struct,a1
  501. bsr draw_player_box
  502. rts
  503. current_pass_count dc.w 0
  504. Password_Lookup dc.b "0123456789"
  505. dc.b "ABCDEFGHIJ"
  506. dc.b "KLMNOPQRST"
  507. dc.b "UVWXYZ. <"
  508. even
  509. Move_Player_Box
  510. ; joystuff in d0
  511. ; boxes struct in a0
  512. ; player struct in a1
  513. move.w d0,d1
  514. andi.b #$f,d1
  515. bne.s dont_reset_joy_val
  516. clr.w player_frame_count(a1)
  517. dont_reset_joy_val
  518. tst.w player_frame_count(a1)
  519. beq.s do_the_norm
  520. subq.w #1,player_frame_count(a1)
  521. bra.s sodit
  522. do_the_norm
  523. btst #P1_Left,d0
  524. beq.s check_move_right
  525. tst.w Fiddle_Number_X(a1)
  526. beq.s check_box_y
  527. subq.w #1,Fiddle_Number_X(a1)
  528. move.w #BOX_FRAME_DELAY,player_frame_count(a1)
  529. check_move_right
  530. btst #P1_Right,d0
  531. beq.s check_box_y
  532. move.w Num_Boxes_X(a0),d1
  533. subq.w #1,d1
  534. cmp.w Fiddle_Number_X(a1),d1
  535. beq.s check_box_y
  536. addq.w #1,Fiddle_Number_X(a1)
  537. move.w #BOX_FRAME_DELAY,player_frame_count(a1)
  538. check_box_y
  539. btst #P1_Up,d0
  540. beq.s check_move_down
  541. tst.w Fiddle_Number_Y(a1)
  542. beq.s sodit
  543. subq.w #1,Fiddle_Number_Y(a1)
  544. move.w #BOX_FRAME_DELAY,player_frame_count(a1)
  545. check_move_down
  546. btst #P1_Down,d0
  547. beq.s sodit
  548. move.w Num_Boxes_Y(a0),d1
  549. subq.w #1,d1
  550. cmp.w Fiddle_Number_Y(a1),d1
  551. beq.s sodit
  552. addq.w #1,Fiddle_Number_Y(a1)
  553. move.w #BOX_FRAME_DELAY,player_frame_count(a1)
  554. sodit
  555. btst #P1_Fire,d0
  556. beq.s no_fire_press
  557. tst.w Fire_Button_Toggle(a1)
  558. bne.s nothing_doing
  559. move.w #-1,Fire_Button_Toggle(a1)
  560. moveq #-1,d0
  561. bra.s end_fire
  562. no_fire_press
  563. clr.w Fire_Button_Toggle(a1)
  564. nothing_doing
  565. moveq #0,d0
  566. end_fire
  567. rts
  568. BOX_FRAME_DELAY EQU 8
  569. rsreset
  570. Box_Start_X rs.w 1
  571. Box_Start_Y rs.w 1
  572. Box_Width rs.w 1
  573. Box_Height rs.w 1
  574. Num_Boxes_X rs.w 1
  575. Num_Boxes_Y rs.w 1
  576. Box_Gap_X rs.w 1
  577. Box_Gap_Y rs.w 1
  578. Player1_Selection_Boxes
  579. dc.w 12,66
  580. dc.w 15,15
  581. dc.w 10,4
  582. dc.w 1,1
  583. Player2_Selection_Boxes
  584. dc.w 160-3+17,255-163
  585. dc.w 19,22
  586. dc.w 6,5
  587. dc.w 3,3
  588. dc.w 8,70
  589. dc.w 71,79
  590. dc.w 2,2
  591. dc.w 3,3
  592. Draw_Player_Box
  593. ; selection boxes in a0
  594. ; player struct in a1
  595. move.w Fiddle_Number_X(a1),d0
  596. move.w Fiddle_Number_Y(a1),d1
  597. move.w Box_Width(a0),d2
  598. move.w Box_Height(a0),d3
  599. add.w Box_Gap_X(a0),d2
  600. add.w Box_Gap_Y(a0),d3
  601. mulu.w d2,d0
  602. mulu.w d3,d1
  603. add.w Box_Start_X(a0),d0
  604. add.w Box_Start_Y(a0),d1
  605. move.w Box_Width(a0),d2
  606. move.w Box_Height(a0),d3
  607. move.l buffered_Plane1,a0
  608. add.l Plane_Offset(a1),a0
  609. bsr draw_eor_thick_box
  610. rts
  611. draw_eor_thick_box
  612. move.w d0,d6
  613. move.w d1,d7
  614. move.w d2,d4
  615. move.w d3,d5
  616. move.w d0,d2
  617. add.w d4,d2
  618. move.w d1,d3
  619. bsr draw_line
  620. addq.w #1,d1
  621. addq.w #1,d3
  622. bsr draw_line
  623. add.w d5,d1
  624. add.w d5,d3
  625. subq.w #3,d1
  626. subq.w #3,d3
  627. bsr draw_line
  628. addq.w #1,d1
  629. addq.w #1,d3
  630. bsr draw_line
  631. move.w d6,d0
  632. move.w d7,d1
  633. move.w d0,d2
  634. move.w d1,d3
  635. addq.w #2,d1
  636. add.w d5,d3
  637. subq.w #2,d3
  638. bsr draw_line
  639. addq.w #1,d0
  640. addq.w #1,d2
  641. bsr draw_line
  642. add.w d4,d0
  643. add.w d4,d2
  644. subq.w #3,d0
  645. subq.w #3,d2
  646. bsr draw_line
  647. addq.w #1,d0
  648. addq.w #1,d2
  649. bsr draw_line
  650. rts
  651. Player1_Select_Struct
  652. dc.w 0,0,0,0
  653. dc.l 0
  654. Player2_Select_Struct
  655. dc.w 0,0,0,0
  656. dc.l 40 ; plane 2
  657. rsreset
  658. Fiddle_Number_X rs.w 1
  659. Fiddle_Number_Y rs.w 1
  660. Fire_Button_Toggle rs.w 1
  661. player_frame_count rs.w 1
  662. plane_offset rs.l 0
  663. P1_Left EQU 0
  664. P1_Right EQU 1
  665. P1_Up EQU 2
  666. P1_Down EQU 3
  667. P1_Fire EQU 4
  668. P2_Left EQU 0
  669. P2_Right EQU 1
  670. P2_Up EQU 2
  671. P2_Down EQU 3
  672. P2_Fire EQU 4
  673. rawreadjoy
  674. move.w $dff00c,d5
  675. move.w #0,d0
  676. btst #9,d5
  677. beq try_right_p1
  678. bset #P1_Left,d0
  679. bra.s upanddown_p1
  680. try_right_p1
  681. btst #1,d5
  682. beq.s upanddown_p1
  683. bset #P1_Right,d0
  684. upanddown_p1
  685. move.w d5,d6
  686. rol.w #1,d5
  687. eor.w d5,d6
  688. btst #1,d6
  689. beq.s tryup_p1
  690. bset #P1_Down,d0
  691. bra quitjoyread_p1
  692. tryup_p1
  693. btst #9,d6
  694. beq.s quitjoyread_p1
  695. bset #P1_Up,d0
  696. quitjoyread_p1
  697. btst #7,$bfe001
  698. bne.s no_fire_p1
  699. bset #P1_Fire,d0
  700. no_fire_p1
  701. rts
  702. rawreadjoy2
  703. move.w $dff00a,d5
  704. btst #9,d5
  705. beq try_left_p2
  706. bset #P2_Right,d0
  707. bra.s upanddown_p2
  708. try_left_p2
  709. btst #1,d5
  710. beq.s upanddown_p2
  711. bset #P2_Left,d0
  712. upanddown_p2
  713. move.w d5,d6
  714. rol.w #1,d5
  715. eor.w d5,d6
  716. btst #1,d6
  717. beq.s tryup_p2
  718. bset #P2_Down,d0
  719. bra quitjoyread_p2
  720. tryup_p2
  721. btst #9,d6
  722. beq.s quitjoyread_p2
  723. bset #P2_Up,d0
  724. quitjoyread_p2
  725. btst #6,$bfe001
  726. bne.s no_fire_p2
  727. bset #P2_Fire,d0
  728. no_fire_p2
  729. rts
  730. sprite_x dc.w 160
  731. sprite_y dc.w 128
  732. sprite_data
  733. dc.w 0,0
  734. dc.w $ffff,$f0f0
  735. dc.w $ffff,$f0f0
  736. dc.w $ffff,$f0f0
  737. dc.w $ffff,$f0f0
  738. dc.w $ffff,$f0f0
  739. dc.w $ffff,$f0f0
  740. dc.w $ffff,$f0f0
  741. dc.w $ffff,$f0f0
  742. dc.w $ffff,$f0f0
  743. dc.w $ffff,$f0f0
  744. dc.w $ffff,$f0f0
  745. dc.w $ffff,$f0f0
  746. dc.w $ffff,$f0f0
  747. dc.w $ffff,$f0f0
  748. dc.w $ffff,$f0f0
  749. dc.w $ffff,$f0f0
  750. dc.w 0,0
  751. display_sprite
  752. move.l #sprite_data,a0
  753. ifd show_demo
  754. move.l #blank_sprite,a0
  755. endc
  756. move.b #0,3(a0)
  757. move.w sprite_y,d0
  758. subq.w #8,d0
  759. add.w #$2c,d0
  760. btst #8,d0
  761. beq.s no_set_bit
  762. bset #2,3(a0)
  763. no_set_bit
  764. move.b d0,(a0) ;vertical
  765. add.w #16,d0
  766. btst #8,d0
  767. beq.s no_set_vstop
  768. bset #1,3(a0)
  769. no_set_vstop
  770. move.b d0,2(a0) ;vstop value
  771. move.w sprite_x,d0
  772. subq.w #8,d0
  773. add.w #$80,d0
  774. lsr #1,d0
  775. bcc no_set_vstart_bit
  776. bset.b #0,3(a0) ;horizontal lsb
  777. no_set_vstart_bit
  778. move.b d0,1(a0) ;horizontal
  779. move.l a0,d0
  780. move.w d0,select_sprite0l
  781. swap d0
  782. move.w d0,select_sprite0h
  783. rts
  784. PassWord_Entry_Text
  785. dc.b "0 1 2 3 4 5 6 7 8 9",0
  786. psel equ *-password_entry_text
  787. dc.b "A B C D E F G H I J",0
  788. dc.b "K L M N O P Q R S T",0
  789. dc.b "U V W X Y Z . >",0
  790. even
  791. blank_sprite
  792. dc.w 0,0,0,0
  793. ds.w 16*2