maptool1200.s 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805
  1. **** Man this code is ROUGH!!!!!
  2. section maptool,code_c
  3. opt NODEBUG
  4. opt p=68000
  5. opt c-
  6. incdir "tools:devpac/include"
  7. include "exec/exec_lib.i"
  8. include "exec/exec.i"
  9. include "libraries/dosextens.i"
  10. incdir "code:maptool/"
  11. include "glens_code/equates.s"
  12. STARTOFMAINCODE
  13. movem.l d0/a0,-(sp)
  14. sub.l a1,a1
  15. move.l 4.w,a6
  16. jsr _LVOFindTask(a6)
  17. move.l d0,a4
  18. tst.l pr_CLI(a4) ; was it called from CLI?
  19. bne.s fromCLI ; if so, skip out this bit...
  20. lea pr_MsgPort(a4),a0
  21. move.l 4.w,a6
  22. jsr _LVOWaitPort(A6)
  23. lea pr_MsgPort(a4),a0
  24. jsr _LVOGetMsg(A6)
  25. move.l d0,returnMsg
  26. fromCLI
  27. movem.l (sp)+,d0/a0
  28. bsr setup
  29. cmp.w #0,error_flag
  30. bne quit_prog
  31. move.l $6c,oldint
  32. move.l #interrupt,$6c
  33. crap
  34. move.l #$dff000,a6
  35. jsr setup_button_list ;required for buttons to work
  36. move.l #top_level_list,a0
  37. jsr display_button_list
  38. bsr Calculate_Blocks_In_One_Page
  39. bsr display_info_window
  40. bsr mainroutine
  41. bsr winddown
  42. quit_prog
  43. tst.l returnMsg ; Is there a message?
  44. beq.s exitToDOS ; if not, skip...
  45. move.l 4.w,a6
  46. jsr _LVOForbid(a6) ; note! No Permit needed!
  47. move.l returnMsg(pc),a1
  48. jsr _LVOReplyMsg(a6)
  49. exitToDOS
  50. rts
  51. returnMsg dc.l 0
  52. **********************************
  53. *** INTERRUPT ****
  54. **********************************
  55. interrupt
  56. movem.l d0-d7/a0-a6,-(sp)
  57. jsr position_cursor
  58. bsr readmouse
  59. bsr position_box_sprite
  60. bsr display_helpful_cursor
  61. tst.w pressed
  62. bne.s wait_for_frelease
  63. btst.b #7,$bfe001
  64. bne.s dont_switch
  65. move.w #1,pressed
  66. bsr switch_screens
  67. bra.s dont_switch
  68. wait_for_frelease
  69. btst.b #7,$bfe001
  70. beq.s dont_switch
  71. clr.w pressed
  72. dont_switch
  73. movem.l (sp)+,d0-d7/a0-a6
  74. dc.w $4ef9
  75. oldint dc.l 0
  76. pressed dc.w 0
  77. ***********************************************
  78. ***** MAINROUTINE *****
  79. ***********************************************
  80. mainroutine
  81. tst.w WorkBench_Mode
  82. bne.s Skip_Extras
  83. bsr sync
  84. bsr button_handler
  85. tst.w window_count
  86. bne.s skip_extras
  87. bsr get_stick_readings
  88. bsr Display_X_Y
  89. jsr Display_Alien_Name
  90. bsr Read_keys
  91. Skip_Extras
  92. tst.b quit_system
  93. beq.s mainroutine
  94. rts
  95. ***********************************************
  96. ***** SYNC *****
  97. **********************************************
  98. sync
  99. move.w #$0010,intreq(a6)
  100. sc_sync
  101. btst #4,intreqr+1(a6)
  102. beq.s sc_sync
  103. rts
  104. ***********************************************
  105. ***** BUTTON HANDLER *****
  106. ***********************************************
  107. button_handler
  108. jsr check_for_call_routine
  109. jsr check_to_see_hit
  110. jsr frig_for_editor
  111. jsr delete_buttons
  112. jsr draw_buttons
  113. rts
  114. ***********************************************
  115. ***** FRIG FOR EDITOR *****
  116. ***********************************************
  117. frig_for_editor
  118. ***routine that breaks rules but is neccessary for
  119. ***editor system
  120. btst #10,$dff016 ;mouse button
  121. bne.s right_not_hit
  122. cmp.w #1,edit_data_flag
  123. bne.s check_other_flag
  124. jsr remove_alien_data
  125. bra right_not_hit_by_user
  126. check_other_flag
  127. cmp.w #1,edit_mode
  128. bne.s check_graphic
  129. bsr delete_map_block
  130. rts
  131. check_graphic
  132. cmp.w #2,edit_mode
  133. bne.s right_not_hit_by_user
  134. bsr cancel_block_ops
  135. rts
  136. right_not_hit
  137. move.w #0,right_first
  138. right_not_hit_by_user
  139. rts
  140. *****************************************************************
  141. *Module Name :setup *
  142. *Function :sets up screen,allocates mem *
  143. *****************************************************************
  144. setup
  145. bsr open_dos
  146. bsr open_graphics_library
  147. tst.l d0
  148. beq error_with_allocation
  149. move.l #main_screen_struct,a0
  150. jsr setup_screen_memory
  151. move.l screen_mem(a0),d0
  152. tst.l d0
  153. bne allocated_screen_mem
  154. bra error_with_allocation
  155. ; otherwise quit
  156. allocated_screen_mem
  157. bsr allocate_picstruct_mem
  158. tst.l d0
  159. beq error_with_allocation
  160. bsr allocate_map_mem
  161. tst.l d0
  162. beq error_with_allocation
  163. bsr allocate_block_data_mem
  164. tst.l d0
  165. beq error_with_allocation
  166. move.l #button_window_struct,a0
  167. jsr setup_screen_memory
  168. move.l screen_mem(a0),d0
  169. tst.l d0
  170. bne allocated_window_mem
  171. move.l #main_screen_struct,a0 ;give back screen mem
  172. jsr deallocate_screen_memory
  173. bra error_with_allocation
  174. allocated_window_mem
  175. bsr put_planes_in_copper
  176. bsr Wait_For_Decent_Pos
  177. LEA CUSTOM,A0
  178. move.l #Copperl,d0
  179. move.w d0,coplo
  180. swap d0
  181. move.w d0,cophi
  182. swap d0
  183. MOVE.L d0,COP1LCH(A0)
  184. MOVE.W COPJMP1(A0),D0
  185. move.l #button_window_struct,a0
  186. move.l screen_mem(a0),d0
  187. moveq #0,d1
  188. move.w screen_x_size(a0),d1
  189. asr.w #3,d1
  190. mulu screen_y_size(a0),d1
  191. MOVE.W D0,BUTTONPLANELOW
  192. SWAP D0
  193. MOVE.W D0,BUTTONPLANEHIGH
  194. swap d0
  195. add.l d1,d0
  196. MOVE.W D0,BUTTONPLANE2LOW
  197. SWAP D0
  198. MOVE.W D0,BUTTONPLANE2HIGH
  199. swap d0
  200. add.l d1,d0
  201. MOVE.W D0,BUTTONPLANE3LOW
  202. SWAP D0
  203. MOVE.W D0,BUTTONPLANE3HIGH
  204. swap d0
  205. add.l d1,d0
  206. MOVE.W D0,BUTTONPLANE4LOW
  207. SWAP D0
  208. MOVE.W D0,BUTTONPLANE4HIGH
  209. bsr blank_sprites
  210. bsr setup_colours
  211. bsr low_pas_filter_off
  212. ifd hard_only
  213. move.l exec,a6
  214. jsr forbid(a6)
  215. endc
  216. rts
  217. error_with_allocation
  218. move.w #1,error_flag
  219. rts
  220. **********************************
  221. **** OPEN GRAPHICS LIBRARY ****
  222. **********************************
  223. open_graphics_library
  224. move.l exec,a6
  225. MOVE.L #graf_name,A1
  226. jsr -408(A6) ; OPEN GRAPHICS LIBRARY
  227. MOVE.L D0,graphics_lib_ptr
  228. rts
  229. **********************************
  230. *** LOW PAS FILTER OFF ****
  231. **********************************
  232. low_pas_filter_off
  233. bset #1,$bfe001
  234. rts
  235. **********************************
  236. *** ALLOCATE MAP MEM ****
  237. **********************************
  238. allocate_map_mem
  239. move.l #map_details,a0
  240. bsr Get_Map_Resources
  241. move.l #map_details2,a0 ;buffer map
  242. bsr Get_Map_Resources
  243. rts
  244. MAX_DATA_BLOCKS EQU 320*4
  245. MAX_BLOCKS_MEM EQU MAX_DATA_BLOCKS*2
  246. **********************************
  247. *** ALLOCATE BLOCK DATA MEM ****
  248. **********************************
  249. allocate_block_data_mem
  250. move.l #MEM_FAST+MEM_CLEAR,d1
  251. move.l exec,a6
  252. move.l #MAX_BLOCKS_MEM,d0
  253. jsr allocmem(a6) ;get mem
  254. tst.l d0
  255. bne.s got_block_data_mem
  256. move.l #0,d0
  257. rts
  258. got_block_data_mem
  259. move.l d0,block_data_ptr
  260. rts
  261. **********************************
  262. *** DEALLOCATE BLOCK DATA MEM****
  263. **********************************
  264. deallocate_block_data_mem
  265. move.l exec,a6
  266. move.l block_data_ptr,a1
  267. move.l #MAX_BLOCKS_MEM,d0
  268. jsr freemem(a6) ;free mem
  269. rts
  270. block_data_ptr
  271. dc.l 0
  272. **********************************
  273. *** GET MAP RESOURCES ****
  274. **********************************
  275. Get_Map_Resources
  276. move.w map_xsize(a0),d0
  277. mulu map_ysize(a0),d0
  278. tst map_datasize(a0)
  279. beq.s albyte_map
  280. asl.l d0 ;mulu again by 2 for word map
  281. albyte_map
  282. move.l #MEM_FAST+MEM_CLEAR,d1
  283. movem.l d7/a6/a0,-(sp)
  284. move.l 4,a6
  285. jsr -198(a6) ;get mem
  286. movem.l (sp)+,d7/a6/a0
  287. tst.l d0
  288. bne.s al_new_map_mem
  289. *raise error
  290. move.l #0,d0
  291. bra end_map_al
  292. al_new_map_mem
  293. move.l d0,map_mem(a0)
  294. *alocate alien map mem
  295. move.w map_xsize(a0),d0
  296. mulu map_ysize(a0),d0
  297. move.l #MEM_FAST+MEM_CLEAR,d1
  298. movem.l d7/a6/a0,-(sp)
  299. move.l 4,a6
  300. jsr -198(a6) ;get mem
  301. movem.l (sp)+,d7/a6/a0
  302. tst.l d0
  303. bne.s al_new_al_map_mem
  304. *raise error
  305. move.l #0,d0
  306. bra end_map_al
  307. al_new_al_map_mem
  308. move.l d0,map_alien_mem(a0)
  309. move.w map_datasize(a0),map_allocdatasize(a0)
  310. move.w map_xsize(a0),map_allocx(a0)
  311. move.w map_ysize(a0),map_allocy(a0)
  312. end_map_al
  313. rts
  314. **********************************
  315. *** DEALLOCATE MAP MEM ****
  316. **********************************
  317. Deallocate_Map_Mem
  318. move.l #Map_Details,a0
  319. bsr Free_Mem_Resources
  320. move.l #Map_Details2,a0
  321. bsr Free_Mem_Resources
  322. rts
  323. **********************************
  324. *** FREE MEM RESOURCES ****
  325. **********************************
  326. Free_Mem_Resources
  327. move.l exec,a6
  328. move.l map_mem(a0),a1
  329. move.w map_xsize(a0),d0
  330. mulu map_ysize(a0),d0
  331. move.w map_datasize(a0),d1
  332. lsl.l d1,d0 ;mulu by data size (0=byte)
  333. move.l a0,-(sp)
  334. jsr freemem(a6)
  335. move.l (sp)+,a0
  336. move.l exec,a6
  337. move.l map_alien_mem(a0),a1
  338. move.w map_xsize(a0),d0
  339. mulu map_ysize(a0),d0
  340. jsr freemem(a6)
  341. rts
  342. **********************************
  343. *** ALLOCATE PICSTRUCT MEM ****
  344. **********************************
  345. allocate_picstruct_mem
  346. movem.l a6,-(sp)
  347. move.l #main_screen_struct,a1
  348. move.w screen_x_size(a1),d3
  349. asr.w #3,d3
  350. mulu screen_y_size(a1),d3
  351. mulu number_of_planes(a1),d3
  352. move.l #picture_pages,a0
  353. moveq #3,d2
  354. allocate_piccy_mem
  355. move.l #MEM_FAST+MEM_CLEAR,d1
  356. move.l 4,a6
  357. move.l d3,d0
  358. movem.l d2-d3/a0-a1,-(sp)
  359. jsr -198(a6)
  360. movem.l (sp)+,d2-d3/a0-a1
  361. tst.l d0
  362. beq.s pa_exit_with_error
  363. move.l (a0),a1
  364. move.l #main_screen_struct,a2
  365. move.l d0,screen_mem(a1)
  366. move.w number_of_planes(a2),number_of_planes(a1)
  367. move.w screen_x_size(a2),screen_x_size(a1)
  368. move.w screen_y_size(a2),screen_y_size(a1)
  369. addq.l #4,a0 ;next struct
  370. dbra d2,allocate_piccy_mem
  371. moveq #1,d0
  372. pa_exit_with_error
  373. movem.l (sp)+,a6
  374. rts
  375. **********************************
  376. *** DEALLOCATE PICSTRUCT MEM ****
  377. **********************************
  378. deallocate_picstruct_mem
  379. movem.l a6,-(sp)
  380. move.l #picture_pages,a0
  381. moveq #3,d2
  382. deallocate_piccy_mem
  383. move.l (a0),a1
  384. move.l screen_mem(a1),a1
  385. move.l #main_screen_struct,a2
  386. move.w screen_x_size(a2),d0
  387. asr.w #3,d0
  388. mulu screen_y_size(a2),d0
  389. mulu number_of_planes(a2),d0
  390. move.l 4,a6
  391. movem.l d2/a0,-(sp)
  392. jsr -210(a6)
  393. movem.l (sp)+,d2/a0
  394. addq.l #4,a0 ;next struct
  395. dbra d2,deallocate_piccy_mem
  396. movem.l (sp)+,a6
  397. rts
  398. **********************************
  399. *** PUT PLANES IN COPPER ****
  400. **********************************
  401. put_planes_in_copper
  402. move.l #main_screen_struct,a0
  403. move.w screen_x_size(a0),d1
  404. asr.w #3,d1
  405. mulu screen_y_size(a0),d1
  406. move.l screen_mem(a0),d0
  407. MOVE.W D0,PLANELOW
  408. SWAP D0
  409. MOVE.W D0,PLANEHIGH
  410. swap d0
  411. add.l d1,d0
  412. MOVE.W D0,PLANE2LOW
  413. SWAP D0
  414. MOVE.W D0,PLANE2HIGH
  415. swap d0
  416. add.l d1,d0
  417. MOVE.W D0,PLANE3LOW
  418. SWAP D0
  419. MOVE.W D0,PLANE3HIGH
  420. swap d0
  421. add.l d1,d0
  422. MOVE.W D0,PLANE4LOW
  423. SWAP D0
  424. MOVE.W D0,PLANE4HIGH
  425. swap d0
  426. add.l d1,d0
  427. MOVE.W D0,PLANE5LOW
  428. SWAP D0
  429. MOVE.W D0,PLANE5HIGH
  430. swap d0
  431. add.l d1,d0
  432. MOVE.W D0,PLANE6LOW
  433. SWAP D0
  434. MOVE.W D0,PLANE6HIGH
  435. swap d0
  436. add.l d1,d0
  437. MOVE.W D0,PLANE7LOW
  438. SWAP D0
  439. MOVE.W D0,PLANE7HIGH
  440. swap d0
  441. add.l d1,d0
  442. MOVE.W D0,PLANE8LOW
  443. SWAP D0
  444. MOVE.W D0,PLANE8HIGH
  445. rts
  446. **********************************
  447. *** SETUP COLOURS ****
  448. **********************************
  449. setup_colours
  450. move.l #main_screen_colour_map,a1
  451. bsr setup_screen_colours
  452. bsr setup_button_colours
  453. rts
  454. **********************************
  455. *** SETUP_SCREEN_COLOURS ****
  456. **********************************
  457. setup_screen_colours
  458. ***send colour map in a1
  459. move.l #main_screen_colours+2,a3
  460. move.w #2-1,d2
  461. set_hi_lo
  462. move.w #8-1,d1
  463. load_banks
  464. move.w #32-1,d0
  465. fill_scr_colours
  466. move.w (a1)+,(a3)
  467. add.l #4,a3
  468. dbra d0,fill_scr_colours
  469. add.l #4,a3 ;skip bank
  470. dbra d1,load_banks
  471. dbra d2,set_hi_lo
  472. rts
  473. **********************************
  474. *** SETUP_GREY_COLOURS ****
  475. **********************************
  476. setup_grey_colours
  477. move.l #main_screen_colours+2,a3
  478. move.l #grey_colour_map,a1
  479. move.w #16-1,d0
  480. fill_gscr_colours
  481. move.w (a1)+,(a3)
  482. add.l #4,a3
  483. dbra d0,fill_gscr_colours
  484. rts
  485. **********************************
  486. *** SETUP BUTTON COLOURS ****
  487. **********************************
  488. setup_button_colours
  489. move.l #button_colours+2,a3
  490. move.l #button_colour_map,a1
  491. move.w #16-1,d0
  492. fill_butt_colours
  493. move.w (a1)+,(a3)
  494. add.l #4,a3
  495. dbra d0,fill_butt_colours
  496. rts
  497. *****************************************************************
  498. *Module Name :winddown *
  499. *Function :deallocates mem, exits to system *
  500. *****************************************************************
  501. winddown
  502. move.l oldint,$6c
  503. bsr deallocate_map_mem
  504. bsr deallocate_block_data_mem
  505. bsr deallocate_picstruct_mem
  506. move.l #main_screen_struct,a0
  507. jsr deallocate_screen_memory
  508. move.l #button_window_struct,a0
  509. jsr deallocate_screen_memory
  510. bsr return_workbench_screen
  511. MOVE.W #$8030,$DFF096 ; ENABLE SPRITES
  512. move.w #$f,$dff096 ; turn off audio
  513. ifd hard_only
  514. move.l 4,a6
  515. jsr permit(a6)
  516. endc
  517. RTS
  518. **********************************
  519. *** RETURN WORKBENCH SCREEN ****
  520. **********************************
  521. Return_Workbench_Screen
  522. move.l 4,a6
  523. jsr permit(a6)
  524. move.l graphics_lib_ptr,a4
  525. MOVE.L #$DFF000,A6
  526. MOVE.L 38(A4),COP1LCH(A6) ; GET SYSTEM COPPER
  527. CLR.W COPJMP1(A6)
  528. rts
  529. **********************************
  530. *** SWITCH SCREENS ***
  531. **********************************
  532. Switch_Screens
  533. tst.w Workbench_Mode
  534. beq.s switch_workbench
  535. bsr Wait_For_Decent_Pos
  536. bsr Switch_Back_To_Main
  537. rts
  538. **********************************
  539. *** WAIT FOR DECENT POS ****
  540. **********************************
  541. Wait_For_Decent_Pos
  542. move.w vhposr+$dff000,d0
  543. andi.w #$ff00,d0
  544. cmp.w #$4000,d0
  545. bne.s Wait_For_Decent_Pos
  546. rts
  547. **********************************
  548. *** SWITCH WORKBENCH ****
  549. **********************************
  550. Switch_Workbench
  551. move.w #1,WorkBench_Mode
  552. bsr return_workbench_screen
  553. rts
  554. **********************************
  555. *** SWITCH BACK TO MAIN ****
  556. **********************************
  557. Switch_Back_To_Main
  558. move.l 4,a6
  559. jsr forbid(a6)
  560. move.l #$dff000,a6
  561. MOVE.L #COPPERL,COP1LCH(A6)
  562. clr.w COPJMP1(A6)
  563. clr.w WorkBench_Mode
  564. rts
  565. **********************************
  566. *** KILL SYSTEM ****
  567. **********************************
  568. kill_system
  569. move.l #top_level_list,a0
  570. jsr remove_button_list
  571. move.b #1,quit_system
  572. rts
  573. change_colour
  574. move.w #$fff,$dff180
  575. rts
  576. include "glens_code/input_routines.s"
  577. include "glens_code/info_routines.s"
  578. include "glens_code/key_handler.s"
  579. include "glens_code/text_routines.s"
  580. include "glens_code/darkline.s"
  581. include "glens_code/hex_screen_routines.s"
  582. include "stus_code/FileIO.s"
  583. include "glens_code/window_routines.s"
  584. include "glens_code/screen_routines.s"
  585. include "glens_code/button_routines.s"
  586. include "glens_code/iffroutinebk.s"
  587. include "glens_code/cursor_routines.s"
  588. include "glens_code/hex_data.s"
  589. include "glens_code/button_data.s"
  590. include "glens_code/graphic_routines.s"
  591. include "glens_code/mapsetup.s"
  592. include "glens_code/map_routines_buttons.s"
  593. include "glens_code/map_routines.s"
  594. include "glens_code/palette_setup.s"
  595. include "glens_code/fill_routines.s"
  596. include "glens_code/check_routines.s"
  597. include "glens_code/savepic_setup.s"
  598. include "glens_code/save_routines.s"
  599. include "glens_code/buffer_routines.s"
  600. include "glens_code/alien_data.s"
  601. include "stus_code/FileIO_DATA.s"
  602. include "glens_code/buffer_setup.s"
  603. include "glens_code/show_whole_map.s"
  604. include "glens_code/project_code.s"
  605. include "glens_code/keyboard_reader.s"
  606. include "glens_code/block_data_manip.s"
  607. blank dc.w 0
  608. include "data/copper_list.s"
  609. include "data/custom_buttons.s"
  610. include "data/buttongraphics.s"
  611. include "data/cursor_graphics.s"
  612. small_numbers
  613. incbin "data/nums.bin"
  614. EVEN
  615. section maptool,data
  616. include "data/picinfo.s"
  617. *******SCREEN SETUPS
  618. main_screen_struct
  619. dc.w 320
  620. dc.w 256
  621. dc.w 0,0
  622. dc.l 0
  623. main_screen_planes
  624. dc.w 8
  625. button_window_struct
  626. dc.w 640
  627. dc.w 4*BUTTON_HEIGHT
  628. dc.w 0,0
  629. dc.l 0
  630. button_window_planes
  631. dc.w 4
  632. quit_system
  633. dc.b 0
  634. EVEN
  635. Workbench_Mode
  636. dc.w 0
  637. graf_name dc.b "graphics.library",0
  638. EVEN
  639. graphics_lib_ptr
  640. dc.l 0
  641. error_flag dc.w 0
  642. screen_pointer dc.l 0
  643. backscr1 Dc.l 0
  644. backscr2 Dc.l 0
  645. backscr3 Dc.l 0
  646. backscr4 Dc.l 0
  647. fill_stack
  648. ds.w (40*40)*2