************************************* ** CO-ORDINATES MAKER VERSION 1.00 ** ************************************* by Raistlin '91 Preamble -------- This program has no official execuatable release. Instead I am releasing it in source code format. The reason for doing this is because:- 1. It is only useful to MC coders & so you should all have an assembler. 2. Having the source code means you can make fine adjstments to the code (if you have the 'know-how') which will allow this program to be far more usefull. There are 2 conditions for using this program:- 1. You leave this doc file alone. You may add to it if you make an upgrade to the code. 2. You leave the 'Raistlin 91' foot print alone in the source code. Great, now the bullshits over we can have some fun!! This doc is in two sections. Section one contains the docs for actually using this program & sections two explains the source code for those of using wishing to alter it in some way. Section 1 -The saga begins! ------------------------------- Cords maker is used to work out co-ordinates for use in your machine code programs, it saves all that lame typing!! I wrote version 1 because I was writing a demo, to release at the ACC party, which contained alot of bob movement. When I got donw to typing in the cords for the bobs I thought, 'FUCK THIS FOR A GAME OF SOLDIERS!!!!' & wrote this little util. This means that this utility was a side effect of my demo & therefor was slightly rushed. I should have spend quite a bit of time ironing out bugs & implementing faster & better routines. But I just wanted it finished so I could get on with writing my demo. so why did I put all that crap? Just so you know it might be worth your while checking over the code & improving it, if you want & really decent product. OK so you know whats its for, how do you use it? Well in its most basic form you just assemble the file & run it. However it was designed to be a little special, instead of presenting you with a blank screen & a tiny sprite, you are presented with a background (the background you want to move the bob over) and you move the bob you actually want moved by these cords! So you should realise than unless you don't mind using my background & bob you'll have to alter the code so it loads you background & your bob, if you want to find out how to do that see section 2. The screen format is like this:- Top left hand corner -Bob to move & plot path Bottom left hand corner -4 numbers representing the X cords in hex Bottom, middle, left -4 numbers representing the Y cords in hex The Keys are:- F1 - Mode 1 F2 - Mode 2 Joystick - Move bob quickly Cursor keys - Move bob slowly (fine adjustment) Right Mouse But - Insert a control code reminder 1-9 - Speed to move bob Explinations of keys -------------------- So what the fuck does that mean? Well here goes Mode 1 ------ While in mode 1 the bobs co-ordinates are only plotted when you press & then release the fire button. This mode is usefully for careful plotting. The Screen is black to represent Mode 1 Mode 2 ------ While in mode 2 the bobs co-ordinates are plotted whenever you move the bob. This is usefull when moveing the bob in a straight line so you don't have to keep moveing it & then pressing fire. The screen is dark green while in mode 2 Joystick -------- you can use the joystick to move the bob quickly around the screen. When using the joystick the bob is moved at the speed value set using keys 1-9 Cursors ------- Using the cursor keys you move the bob 1 pixel at a time. The program detects for a key release to make this mode usefull for fine movement. RMB --- If you are using control codes in your cords tables press the RMB when you want to enter a control code, a reminder (CONTROL CODE) will be entered into the source file. You then look for these reminders in the source file & enter the control code you wish to use. Speed ----- Pressing keys 1-9 on the keyboard at any time alters the speed at which the joystick moves the bob. ie pressing key 3 means the bob is moved 3 pixels at a time. PRESS THE LEFT MOUSE BUTTON TO SAVE THE SOURCE FILE & EXIT THE PROGRAM! Section 2 - The source code (arghhhhhhh!) ----------- If you decide to read this section I assume:- 1. You understand the 68000 instruction set. 2. You understand the libs (at the least AllocMem FreeMem Open Close Write) 3. You have a good understanding of the hardware. 4. You are good with the blitter (ie theres fuck all you can't do with it except draw lines). This is important as I use the cookie-cut routine which is fairly complex. 5. You know how the X Y cords will be converted from pixels to shift & words to actually move the bob. If you look at my source code you will see each section has a heading surounded in asterixs. When detailing the code I will use that heading so you know what section I am describing. ***** START ***** In the start-up routine I do the usuall stuff for setting up the hardware. I also reserve a memory space 200k long in fast memory. It is important you don't make your cords tabls bigger than 200k or you'll crash the machine. Instead make seperate files & join them in e.g. Genam ************************** Load The Bitplane Pointers ************************** Simply set-up the bitplane pointers to point to my screen, which by the way is 60 bytes wide (480 pixels) ********** RaistPrint ********** The variable BUFFER holds the address of the reserved memory. This address is put into A0. I then insert the word Raistlin '91 into this memory area & save the end address in BUFFERP (BufferP is used to hold the next address to enter ASCII into the reserved memory area). Al this has the effect of leaving the comment:- ; Raistlin '91 in the source code. *************************** Blit Sme Bobs To Move Later *************************** This section sets-up the bob to move on the screen. First D0 is loaded with the X cord & D1 with the Y cord. D1 is multiplied by the width of the screen (in my case 60). D0 is divided by 16 (because there are 16 pixels in 1 word), the low word then cotains the X offset & the high word contains the barrel shift. The low word (Xoffset) is then multiplied by 2 to turn the words into bytes & then added to d1 (Y offset+Xoffset). D0 is then swaped so that the low word now holds the barrel shift. We then shift the low word to the left 12 times which has the effect of placing the barrel shift in the 4 MSB where it is needed in bltcon0. The XY offset is then placed into LASTXY. The next part is a blitter routine that saves the background data. The next routine is another blitter routine that blits the bob to the screen using the cookie cut fuction. ********** Set-Up DMA ********** Simply set-up the DMA the way I like it. ********************** Main Branching Routine ********************** Wait for the vertical blank & then branch to all the sub-routines. ******** Clean_UP ******** Brings back the operating system. A file is opened to save the cords table to & then the cords table is written to that file. The memory is freed & the program exits. ********************** Test State Of Joystick ********************** Tests for a joystick movemet. If one is found the X/Y cord values are altered accordingly, if mode is 2 then the co-ordinate is plotted, else the routine then exits. **** Fire **** If fire is pressed the fire flag is set & the routine exits. If fire is not pressed then 1 is anded to the fire flag. If the fire flag is 1 then a 1 remains & so the current XY cords are plotted, else the routine exits. This has the effect of checking for a fire button release instead of a fire button press & so stops multiple plots. ******************* Check For Key Press ******************* First of all a check is made for F1/F2 & if found the mode & background colour are altered accordingly. If F1/F2 is not pressed a check is made for the cursor keys. If a cursor key press is detected the XY cord values are altered accordingly & if mode 2 is set the current XY cords are plotted. If no key is pressed the routine exits. ******************************** Routine To Work Out ASCII Values ******************************** A0 is loaded with the next address to load an ASCII value. A 'dc.w' is then entered along with the correct tabulation code & a $ sign to tell Devpac we are using hex. The current Xcord is then entered in d0. d1 is also loaded with the X cord. D1 is shift right 12 times this has the effect of moveing the 4 MSB into the LSB & erasing all the rest i.e. before D0=$1234 after D0=$0001 or before D0=$2340 after D0=$0002 we then see if the number is 0-9 or a A-F and branch accordingly. The correct value to turn the number into its ASCII value is added & the ascii value is entered into the reserved memory. D0 is then shifted left 4 times which has the following effect:- before D0=$1234 after D0=$2340 or before D0=$2340 after D0=$3400 so we bascially erase last number & get the next number to convert. The same is then done for all 4 numbers to convert. ****************** Convert The Y Cord ****************** Same as X ********* Check RMB ********* This section tests for a RMB release. This test for a release works the same was as the test for a fire button release (see above). If a release is detected a reminder is entered into the source code (CONTROL CODE). *********************************** Display Cords In Bottom Left Corner *********************************** The number to blit is worked out similarly to the routine to work out the X/Y Ascii values. Except this is perhaps slightly simpler. Once the value to blit is worked out it is blitted similarly to the plop routine in a scroller. ******************************* The Actual Bob Movement Routine ******************************* Probably the same as the one you'll use in your main program. ****************** Blitter Operations ****************** Just an A-D & ABCD blitter routine which you should know! There is then just a copper list & the variables! If you didn't understand this doc file see the source file which is fully commented! Raistlin '91 (The name of fame!)