maptool1200_fix.s 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867
  1. ;/* $Revision Header *********************************************************
  2. *
  3. * Main-Programming :
  4. * Copyright © 1989-1992 Glen Cumming. All Rights Are Reserved.
  5. *
  6. * Additional-Programming :
  7. * Copyright © 1996 Trevor L. Mensah. All Rights Are Reserved.
  8. *
  9. * $Creation Language : MC68000 assembly
  10. * $File : scratch:maptool/maptool1200_fix.s
  11. * $Created on : Thursday, 15-Aug-96 20:03:12
  12. * $Created by : Trevor L. Mensah
  13. * $Current revision : V1.14
  14. *
  15. * $Purpose
  16. * --------
  17. * A basic block map editor for creation and design of new game
  18. * level maps. For use on ECS/AGA games.
  19. *
  20. * $Revision V1.00
  21. * ---------------
  22. * created on Thursday 15-Aug-96 20:03:32 by Trevor Mensah. LogMessage :
  23. * --- Initial history ---
  24. *
  25. * $Revision V1.14
  26. * ---------------
  27. * 1. Replaced hardwired interrupts with system friendly calls just so I
  28. * could get it working on my system! Now the editor is multitasking and
  29. * the self-modifying code for the interrupt gone making it work! Hurray!
  30. * 2. Reworked scrolling routines a bit for slightly improved refresh rate
  31. * 3. Most direct references to 320 pixels hardwired screenwidth replaced
  32. * with screen structure access for autosensitivity (screenmode switch)
  33. * 4. Replaced old `inbuilt' file-requesters with a new system friendly and
  34. * standard 'reqtools' requesters. Now finally we are able to load and
  35. * save data to/from hard-disks.
  36. * 5. All blit routines now use blit nasty during blitting for a little
  37. * extra performance.
  38. * 6. Print routines modified to use 7 pixel print width instead of 10
  39. * to enable more descriptive text in gadgets and make them look a bit
  40. * nicer on the eye.
  41. * 7. Screen display copperlist now uses 64-Bit AGA fetchmode`s for some
  42. * additional screen refresh speed.
  43. * 8. Added a check to the mouse x-scaling factor for when running in high
  44. * resolution screen mode so that the the gadget coordinates are correct.
  45. * 9. All window x-start positions are now ignored, instead the windows
  46. * are now centred on the screen dependent on the screen pixel width.
  47. * This feature really should be added as an option to the window flags
  48. * but for now I have simply bypassed the window`s xstart regardless.
  49. * This is a simple fix to make windows appear in the centre of the screen
  50. * for when running in high-resolution mode.
  51. * 10. Preview scaling now works in high-resolution mode.
  52. * 11. Moved workbench startup code into its own file for asm-one direct
  53. * to support `assemble-run' feature.
  54. * 12. Code hunks sectioned into public memory, now only graphics data and
  55. * copperlists in chipmem (along with screen buffers). This speeds up
  56. * the code a fair bit on my system now that the code is in fast-ram
  57. * and also saves 100k of chipram and lots on filesize.
  58. * 13. Removed unneccessary button gadget data`s and changed gadgets imagery
  59. * to look a little more modern.
  60. * 14. Minor changes to copper display code to reflect the newlook gadgets.
  61. *
  62. * $Revision V1.15
  63. * ---------------
  64. * Few minor adjustments to allow hi-res editing
  65. *
  66. * 1. Adjusted code to correctly handle lo/hi res screen modes - note it
  67. * should be possible to make this dynamically changeable whilst
  68. * running the editor - a possible future enhancement
  69. * 2. Moved some equates from main file to equates.s
  70. * 3. Modified change 8 of Revision 1.14, to make a more 'hi-level' change
  71. * 4. Added docs directory to contain instructions file
  72. * 5. Added conditional assemble option to turn off saving of byte map
  73. * overlay data (normally used for aliens). This feature could be implemented
  74. * as a check button when saving the map - possible future enhancement
  75. * 6. Project structure had no rsreset, this has now been added
  76. * Note: Old project files should no longer be used!
  77. *************************************************************************/
  78. ifd TREV
  79. incdir "includes:"
  80. else
  81. opt c-
  82. incdir "tools:devpac/include"
  83. endc
  84. include "exec/exec_lib.i"
  85. include "exec/exec.i"
  86. include "libraries/dosextens.i"
  87. include "hardware/intbits.i"
  88. ifnd TREV
  89. incdir "code:newmaptool/"
  90. endc
  91. include "glens_code/equates.s"
  92. section maptool,code
  93. include "glens_code/workbench_startup.s"
  94. _main: bsr setup * take over and setup
  95. bne quit_prog
  96. jsr setup_button_list * setup buttons
  97. lea top_level_list,a0
  98. jsr display_button_list * render buttons
  99. bsr Calculate_Blocks_In_One_Page
  100. bsr display_info_window
  101. bsr mainroutine * call main function loop
  102. bsr winddown
  103. quit_prog: rts
  104. ;/* System VBlank Interrupt
  105. * -----------------------
  106. */
  107. interrupt movem.l d0-a6,-(sp)
  108. jsr position_cursor
  109. bsr readmouse
  110. bsr position_box_sprite
  111. bsr display_helpful_cursor
  112. tst.w pressed
  113. bne.s wait_for_frelease
  114. btst.b #7,$bfe001
  115. bne.s dont_switch
  116. move.w #1,pressed
  117. bsr switch_screens
  118. bra.s dont_switch
  119. wait_for_frelease
  120. btst.b #7,$bfe001
  121. beq.s dont_switch
  122. clr.w pressed
  123. dont_switch movem.l (sp)+,d0-a6
  124. lea $dff000,a0 * fix bug in os..
  125. moveq #0,d0
  126. rts
  127. ***********************************************
  128. ***** MAINROUTINE *****
  129. ***********************************************
  130. mainroutine tst.w Workbench_Mode
  131. bne.s skip_extras
  132. bsr Wait_For_Decent_Pos
  133. bsr button_handler
  134. tst.w window_count
  135. bne.s skip_extras
  136. bsr get_stick_readings
  137. bsr Display_X_Y
  138. jsr Display_Alien_Name
  139. bsr Read_Keys
  140. skip_extras tst.b quit_system
  141. beq.s mainroutine
  142. rts
  143. sync
  144. bsr Wait_For_Decent_Pos
  145. rts
  146. ***********************************************
  147. ***** BUTTON HANDLER *****
  148. ***********************************************
  149. button_handler
  150. jsr check_for_call_routine
  151. jsr check_to_see_hit
  152. jsr frig_for_editor
  153. jsr delete_buttons
  154. jsr draw_buttons
  155. rts
  156. ***********************************************
  157. ***** FRIG FOR EDITOR *****
  158. ***********************************************
  159. frig_for_editor
  160. ***routine that breaks rules but is neccessary for
  161. ***editor system
  162. btst #10,$dff016 ;mouse button
  163. bne.s right_not_hit
  164. cmp.w #1,edit_data_flag
  165. bne.s check_other_flag
  166. jsr remove_alien_data
  167. bra right_not_hit_by_user
  168. check_other_flag
  169. cmp.w #1,edit_mode
  170. bne.s check_graphic
  171. bsr delete_map_block
  172. rts
  173. check_graphic
  174. cmp.w #2,edit_mode
  175. bne.s right_not_hit_by_user
  176. bsr cancel_block_ops
  177. rts
  178. right_not_hit
  179. move.w #0,right_first
  180. right_not_hit_by_user
  181. rts
  182. *****************************************************************
  183. *Module Name :setup *
  184. *Function :sets up screen,allocates mem *
  185. *****************************************************************
  186. setup pea exitsetup(pc)
  187. bsr open_dos
  188. bsr open_graphics_library
  189. tst.l d0
  190. beq error_with_allocation
  191. move.l #main_screen_struct,a0
  192. jsr setup_screen_memory
  193. move.l screen_mem(a0),d0
  194. tst.l d0
  195. bne allocated_screen_mem
  196. bra error_with_allocation
  197. ; otherwise quit
  198. allocated_screen_mem
  199. bsr allocate_picstruct_mem
  200. tst.l d0
  201. beq error_with_allocation
  202. bsr allocate_map_mem
  203. tst.l d0
  204. beq error_with_allocation
  205. bsr allocate_block_data_mem
  206. tst.l d0
  207. beq error_with_allocation
  208. move.l #button_window_struct,a0
  209. jsr setup_screen_memory
  210. move.l screen_mem(a0),d0
  211. tst.l d0
  212. bne allocated_window_mem
  213. move.l #main_screen_struct,a0 ;give back screen mem
  214. jsr deallocate_screen_memory
  215. bra error_with_allocation
  216. allocated_window_mem
  217. bsr put_planes_in_copper
  218. lea interrupt(pc),a0 * interrupt code (exit RTS, not RTE!)
  219. lea VertB_Server(pc),a1 * ptr to int server for VERTB..
  220. lea VertB_Name(pc),a2 * ptr to int server name
  221. moveq #INTB_VERTB,d0 * intNum
  222. move.l a2,10(a1) * set name of server..
  223. move.l a0,18(a1) * set address of server..
  224. move.l 4.w,a6 * execbase
  225. jsr _LVOAddIntServer(a6) * add interrupt into system chain..
  226. bsr Wait_For_Decent_Pos
  227. move.l #COPPERL,d0
  228. lea CUSTOM,a0
  229. move.l d0,COP1LCH(a0)
  230. move.w d0,COPJMP1(a0)
  231. move.w d0,coplo
  232. swap d0
  233. move.w d0,cophi
  234. move.l #button_window_struct,a0
  235. move.l screen_mem(a0),d0
  236. moveq #0,d1
  237. move.w screen_x_size(a0),d1
  238. asr.w #3,d1
  239. mulu screen_y_size(a0),d1
  240. move.w d0,Buttonplanelow
  241. swap d0
  242. move.w d0,buttonplanehigh
  243. swap d0
  244. add.l d1,d0
  245. move.w d0,buttonplane2low
  246. swap d0
  247. move.w d0,buttonplane2high
  248. swap d0
  249. add.l d1,d0
  250. move.w d0,buttonplane3low
  251. swap d0
  252. move.w d0,buttonplane3high
  253. swap d0
  254. add.l d1,d0
  255. move.w d0,buttonplane4low
  256. swap d0
  257. move.w d0,buttonplane4high
  258. *------ if screen pixel width >320 set "highres" screen_mode
  259. lea main_screen_struct,a0
  260. bclr #INTB_HIRES,screen_mode
  261. cmp.w #320,screen_x_size(a0)
  262. ble.s no_set_hires
  263. bset #INTB_HIRES,screen_mode
  264. bsr SetHiResSprite
  265. bra.s DoneResSetup
  266. no_set_hires
  267. bsr SetLoResSprite
  268. DoneResSetup
  269. bsr blank_sprites
  270. bsr setup_colours
  271. bsr low_pas_filter_off
  272. ifd hard_only
  273. move.l 4.w,a6
  274. jsr forbid(a6)
  275. endc
  276. rts
  277. error_with_allocation
  278. move.w #1,error_flag
  279. rts
  280. exitsetup
  281. tst.w error_flag
  282. lea $dff000,a6
  283. rts
  284. **********************************
  285. **** OPEN GRAPHICS LIBRARY ****
  286. **********************************
  287. open_graphics_library
  288. move.l exec,a6
  289. MOVE.L #graf_name,A1
  290. jsr -408(A6) ; OPEN GRAPHICS LIBRARY
  291. MOVE.L D0,graphics_lib_ptr
  292. rts
  293. **********************************
  294. *** LOW PAS FILTER OFF ****
  295. **********************************
  296. low_pas_filter_off
  297. bset #1,$bfe001
  298. rts
  299. **********************************
  300. *** ALLOCATE MAP MEM ****
  301. **********************************
  302. allocate_map_mem
  303. move.l #map_details,a0
  304. bsr Get_Map_Resources
  305. move.l #map_details2,a0 ;buffer map
  306. bsr Get_Map_Resources
  307. rts
  308. MAX_DATA_BLOCKS EQU 320*4
  309. MAX_BLOCKS_MEM EQU MAX_DATA_BLOCKS*2
  310. **********************************
  311. *** ALLOCATE BLOCK DATA MEM ****
  312. **********************************
  313. allocate_block_data_mem
  314. move.l #MEM_FAST+MEM_CLEAR,d1
  315. move.l 4.w,a6
  316. move.l #MAX_BLOCKS_MEM,d0
  317. jsr allocmem(a6) ;get mem
  318. tst.l d0
  319. bne.s got_block_data_mem
  320. moveq #0,d0
  321. rts
  322. got_block_data_mem
  323. move.l d0,block_data_ptr
  324. rts
  325. **********************************
  326. *** DEALLOCATE BLOCK DATA MEM****
  327. **********************************
  328. deallocate_block_data_mem
  329. move.l 4.w,a6
  330. move.l block_data_ptr(pc),a1
  331. move.l #MAX_BLOCKS_MEM,d0
  332. jmp freemem(a6) ;free mem
  333. block_data_ptr
  334. dc.l 0
  335. **********************************
  336. *** GET MAP RESOURCES ****
  337. **********************************
  338. Get_Map_Resources
  339. move.w map_xsize(a0),d0
  340. mulu map_ysize(a0),d0
  341. tst map_datasize(a0)
  342. beq.s albyte_map
  343. asl.l d0 ;mulu again by 2 for word map
  344. albyte_map
  345. move.l #MEM_FAST+MEM_CLEAR,d1
  346. movem.l d7/a6/a0,-(sp)
  347. move.l 4.w,a6
  348. jsr -198(a6) ;get mem
  349. movem.l (sp)+,d7/a6/a0
  350. tst.l d0
  351. bne.s al_new_map_mem
  352. *raise error
  353. moveq #0,d0
  354. bra end_map_al
  355. al_new_map_mem
  356. move.l d0,map_mem(a0)
  357. *alocate alien map mem
  358. move.w map_xsize(a0),d0
  359. mulu map_ysize(a0),d0
  360. move.l #MEM_FAST+MEM_CLEAR,d1
  361. movem.l d7/a6/a0,-(sp)
  362. move.l 4.w,a6
  363. jsr -198(a6) ;get mem
  364. movem.l (sp)+,d7/a6/a0
  365. tst.l d0
  366. bne.s al_new_al_map_mem
  367. *raise error
  368. moveq #0,d0
  369. bra end_map_al
  370. al_new_al_map_mem
  371. move.l d0,map_alien_mem(a0)
  372. move.w map_datasize(a0),map_allocdatasize(a0)
  373. move.w map_xsize(a0),map_allocx(a0)
  374. move.w map_ysize(a0),map_allocy(a0)
  375. end_map_al
  376. rts
  377. **********************************
  378. *** DEALLOCATE MAP MEM ****
  379. **********************************
  380. Deallocate_Map_Mem
  381. move.l #Map_Details,a0
  382. bsr Free_Mem_Resources
  383. move.l #Map_Details2,a0
  384. bra Free_Mem_Resources
  385. **********************************
  386. *** FREE MEM RESOURCES ****
  387. **********************************
  388. Free_Mem_Resources
  389. move.l 4.w,a6
  390. move.l map_mem(a0),a1
  391. move.w map_xsize(a0),d0
  392. mulu map_ysize(a0),d0
  393. move.w map_datasize(a0),d1
  394. lsl.l d1,d0 ;mulu by data size (0=byte)
  395. move.l a0,-(sp)
  396. jsr freemem(a6)
  397. move.l (sp)+,a0
  398. move.l 4.w,a6
  399. move.l map_alien_mem(a0),a1
  400. move.w map_xsize(a0),d0
  401. mulu map_ysize(a0),d0
  402. jmp freemem(a6)
  403. **********************************
  404. *** ALLOCATE PICSTRUCT MEM ****
  405. **********************************
  406. allocate_picstruct_mem
  407. movem.l a6,-(sp)
  408. move.l #main_screen_struct,a1
  409. move.w screen_x_size(a1),d3
  410. asr.w #3,d3
  411. mulu screen_y_size(a1),d3
  412. mulu number_of_planes(a1),d3
  413. move.l #picture_pages,a0
  414. moveq #3,d2
  415. allocate_piccy_mem
  416. move.l #MEM_FAST+MEM_CLEAR,d1
  417. move.l 4.w,a6
  418. move.l d3,d0
  419. movem.l d2-d3/a0-a1,-(sp)
  420. jsr -198(a6)
  421. movem.l (sp)+,d2-d3/a0-a1
  422. tst.l d0
  423. beq.s pa_exit_with_error
  424. move.l (a0),a1
  425. move.l #main_screen_struct,a2
  426. move.l d0,screen_mem(a1)
  427. move.w number_of_planes(a2),number_of_planes(a1)
  428. move.w screen_x_size(a2),screen_x_size(a1)
  429. move.w screen_y_size(a2),screen_y_size(a1)
  430. addq.l #4,a0 ;next struct
  431. dbra d2,allocate_piccy_mem
  432. moveq #1,d0
  433. pa_exit_with_error
  434. movem.l (sp)+,a6
  435. rts
  436. **********************************
  437. *** DEALLOCATE PICSTRUCT MEM ****
  438. **********************************
  439. deallocate_picstruct_mem
  440. movem.l a6,-(sp)
  441. move.l #picture_pages,a0
  442. moveq #3,d2
  443. deallocate_piccy_mem
  444. move.l (a0),a1
  445. move.l screen_mem(a1),a1
  446. move.l #main_screen_struct,a2
  447. move.w screen_x_size(a2),d0
  448. asr.w #3,d0
  449. mulu screen_y_size(a2),d0
  450. mulu number_of_planes(a2),d0
  451. move.l 4.w,a6
  452. movem.l d2/a0,-(sp)
  453. jsr -210(a6)
  454. movem.l (sp)+,d2/a0
  455. addq.l #4,a0 ;next struct
  456. dbra d2,deallocate_piccy_mem
  457. movem.l (sp)+,a6
  458. rts
  459. **********************************
  460. *** PUT PLANES IN COPPER ****
  461. **********************************
  462. put_planes_in_copper
  463. move.l #main_screen_struct,a0
  464. move.w screen_x_size(a0),d1
  465. asr.w #3,d1
  466. mulu screen_y_size(a0),d1
  467. move.l screen_mem(a0),d0
  468. move.w d0,planelow
  469. swap d0
  470. move.w d0,planehigh
  471. swap d0
  472. add.l d1,d0
  473. move.w d0,plane2low
  474. swap d0
  475. move.w d0,plane2high
  476. swap d0
  477. add.l d1,d0
  478. move.w d0,plane3low
  479. swap d0
  480. move.w d0,plane3high
  481. swap d0
  482. add.l d1,d0
  483. move.w d0,plane4low
  484. swap d0
  485. move.w d0,plane4high
  486. swap d0
  487. add.l d1,d0
  488. move.w d0,plane5low
  489. swap d0
  490. move.w d0,plane5high
  491. swap d0
  492. add.l d1,d0
  493. move.w d0,plane6low
  494. swap d0
  495. move.w d0,plane6high
  496. swap d0
  497. add.l d1,d0
  498. move.w d0,plane7low
  499. swap d0
  500. move.w d0,plane7high
  501. swap d0
  502. add.l d1,d0
  503. move.w d0,plane8low
  504. swap d0
  505. move.w d0,plane8high
  506. rts
  507. **********************************
  508. *** SETUP COLOURS ****
  509. **********************************
  510. setup_colours
  511. move.l #main_screen_colour_map,a1
  512. bsr setup_screen_colours
  513. bsr setup_button_colours
  514. rts
  515. **********************************
  516. *** SETUP_SCREEN_COLOURS ****
  517. **********************************
  518. setup_screen_colours
  519. ***send colour map in a1
  520. move.l #main_screen_colours+2,a3
  521. moveq #2-1,d2
  522. set_hi_lo
  523. moveq #8-1,d1
  524. load_banks
  525. moveq #32-1,d0
  526. fill_scr_colours
  527. move.w (a1)+,(a3)
  528. addq.l #4,a3
  529. dbra d0,fill_scr_colours
  530. addq.l #4,a3 ;skip bank
  531. dbra d1,load_banks
  532. dbra d2,set_hi_lo
  533. rts
  534. **********************************
  535. *** SETUP_GREY_COLOURS ****
  536. **********************************
  537. setup_grey_colours
  538. move.l #main_screen_colours+2,a3
  539. move.l #grey_colour_map,a1
  540. moveq #16-1,d0
  541. fill_gscr_colours
  542. move.w (a1)+,(a3)
  543. addq.l #4,a3
  544. dbra d0,fill_gscr_colours
  545. rts
  546. **********************************
  547. *** SETUP BUTTON COLOURS ****
  548. **********************************
  549. setup_button_colours
  550. move.l #button_colours+2,a3
  551. move.l #button_colour_map,a1
  552. moveq #16-1,d0
  553. fill_butt_colours
  554. move.w (a1)+,(a3)
  555. addq.l #4,a3
  556. dbra d0,fill_butt_colours
  557. rts
  558. *****************************************************************
  559. *Module Name :winddown *
  560. *Function :deallocates mem, exits to system *
  561. *****************************************************************
  562. winddown
  563. lea VertB_Server(pc),a1
  564. moveq #INTB_VERTB,d0
  565. move.l 4.w,a6
  566. jsr _LVORemIntServer(a6)
  567. bsr deallocate_map_mem
  568. bsr deallocate_block_data_mem
  569. bsr deallocate_picstruct_mem
  570. move.l #main_screen_struct,a0
  571. jsr deallocate_screen_memory
  572. move.l #button_window_struct,a0
  573. jsr deallocate_screen_memory
  574. bsr return_workbench_screen
  575. move.w #$8030,$dff096 ; enable sprites
  576. move.w #$f,$dff096 ; turn off audio
  577. ifd hard_only
  578. move.l 4.w,a6
  579. jsr permit(a6)
  580. endc
  581. rts
  582. VertB_Server: dc.l 0,0 * pred,succ
  583. dc.b 2 * interrupt type
  584. dc.b 3 * interrupt priority
  585. dc.l 0 * interrupt name
  586. dc.l 0 *
  587. dc.l 0 * interrupt jump address
  588. VertB_Name: dc.b 'MapTool IRQ',0
  589. even
  590. pressed dc.w 0
  591. **********************************
  592. *** RETURN WORKBENCH SCREEN ****
  593. **********************************
  594. Return_Workbench_Screen
  595. move.l 4.w,a6
  596. jsr permit(a6)
  597. move.l graphics_lib_ptr,a4
  598. lea $dff000,a6
  599. move.l 38(a4),cop1lch(a6) ; get system copper
  600. move.w d0,copjmp1(a6) ; strobe copper. force new copper on..
  601. rts
  602. **********************************
  603. *** SWITCH SCREENS ***
  604. **********************************
  605. switch_screens
  606. tst.w Workbench_Mode
  607. beq.s switch_workbench
  608. bsr Wait_For_Decent_Pos
  609. bsr Switch_Back_To_Main
  610. rts
  611. **********************************
  612. *** WAIT FOR DECENT POS ****
  613. **********************************
  614. Wait_For_Decent_Pos
  615. move.w vhposr+$dff000,d0
  616. andi.w #$ff00,d0
  617. cmp.w #$4000,d0
  618. bne.s Wait_For_Decent_Pos
  619. rts
  620. **********************************
  621. *** SWITCH WORKBENCH ****
  622. **********************************
  623. Switch_Workbench
  624. move.w #1,WorkBench_Mode
  625. bsr return_workbench_screen
  626. rts
  627. **********************************
  628. *** SWITCH BACK TO MAIN ****
  629. **********************************
  630. Switch_Back_To_Main
  631. move.l 4.w,a6
  632. jsr forbid(a6)
  633. move.l #$dff000,a6
  634. move.l #copperl,cop1lch(a6)
  635. move.w d0,copjmp1(a6)
  636. clr.w WorkBench_Mode
  637. rts
  638. **********************************
  639. *** KILL SYSTEM ****
  640. **********************************
  641. kill_system
  642. move.l #top_level_list,a0
  643. jsr remove_button_list
  644. move.b #1,quit_system
  645. rts
  646. change_colour
  647. move.w #$fff,$dff180
  648. rts
  649. ifd TREV
  650. LDF_VOLUMES=$8
  651. dol_Name=$28
  652. endc
  653. include "glens_code/info_routines.s"
  654. include "glens_code/new_FileIO.s"
  655. include "glens_code/input_routines.s"
  656. include "glens_code/key_handler.s"
  657. include "glens_code/text_routines.s"
  658. include "glens_code/darkline.s"
  659. include "glens_code/window_routines.s"
  660. include "glens_code/screen_routines.s"
  661. include "glens_code/button_routines.s"
  662. include "glens_code/iffroutine.s"
  663. include "glens_code/cursor_routines.s"
  664. include "glens_code/button_data.s"
  665. include "glens_code/graphic_routines.s"
  666. include "glens_code/mapsetup.s"
  667. include "glens_code/map_routines_buttons.s"
  668. include "glens_code/map_routines.s"
  669. include "glens_code/palette_setup.s"
  670. include "glens_code/fill_routines.s"
  671. include "glens_code/check_routines.s"
  672. include "glens_code/savepic_setup.s"
  673. include "glens_code/save_routines.s"
  674. include "glens_code/buffer_routines.s"
  675. include "glens_code/alien_data.s"
  676. include "glens_code/buffer_setup.s"
  677. include "glens_code/show_whole_map.s"
  678. include "glens_code/project_code.s"
  679. include "glens_code/keyboard_reader.s"
  680. include "glens_code/block_data_manip.s"
  681. blank dc.w 0
  682. include "data/picinfo.s"
  683. *******SCREEN SETUPS
  684. main_screen_struct
  685. dc.w ScrPixelWidth
  686. dc.w ScrPixelHeight
  687. dc.w 0,0
  688. dc.l 0
  689. main_screen_planes
  690. dc.w ScrDepth
  691. button_window_struct
  692. dc.w 640
  693. dc.w 4*BUTTON_HEIGHT
  694. dc.w 0,0
  695. dc.l 0
  696. button_window_planes
  697. dc.w 4
  698. quit_system
  699. dc.b 0
  700. EVEN
  701. Workbench_Mode
  702. dc.w 0
  703. graf_name dc.b "graphics.library",0
  704. EVEN
  705. section maptoolbss,bss
  706. error_flag ds.w 1
  707. ifd TREV
  708. cnop 0,4
  709. endc
  710. graphics_lib_ptr
  711. ds.l 1
  712. screen_pointer ds.l 1
  713. backscr1 ds.l 1
  714. backscr2 ds.l 1
  715. backscr3 ds.l 1
  716. backscr4 ds.l 1
  717. fill_stack ds.w ((ScrPixelWidth/8)*(ScrPixelWidth/8))*2
  718. buff1 ds.b (ScrPixelWidth/8)*32*2
  719. buff2 ds.b (ScrPixelWidth/8)*32*2
  720. buff3 ds.b (ScrPixelWidth/8)*32*2
  721. buff4 ds.b (ScrPixelWidth/8)*32*2
  722. buff5 ds.b (ScrPixelWidth/8)*32*2
  723. buff6 ds.b (ScrPixelWidth/8)*32*2
  724. buff7 ds.b (ScrPixelWidth/8)*32*2
  725. buff8 ds.b (ScrPixelWidth/8)*32*2
  726. scr1b ds.b (ScrPixelWidth/8)*32*2
  727. scr2b ds.b (ScrPixelWidth/8)*32*2
  728. Current_Project_Information
  729. ds.b Project_Struct_Size
  730. section maptooldata,data_c
  731. include "data/copper_list.s"
  732. include "data/new_custom_buttons.s"
  733. include "data/new_buttongraphics.s"
  734. include "data/cursor_graphics.s"
  735. small_numbers incbin "data/nums.bin"