home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMOS PD CD
/
amospdcd.iso
/
totallyamos
/
issue3
/
programming
/
1.seq
next >
Wrap
Text File
|
1992-02-28
|
10KB
|
255 lines
252
fff0004aff23fe04a6555b0586a
^6|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|
^2{7H I N T S A N D T I P S .{
^6|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|
^7 We have gathered hints and tips from several readers for this Issue.
^7Read on for tips from Steve Bennett, Jeff Tullin, Ronnie Simpson and
^7Aaron Fothergill.
^6|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|
^5 From Steve Bennett, West Midlands.
^2 Here is a list of commands that are missing from the Amos Manual,
^2Some you may have heard of, some may be new.
^1 MOUSE SCREEN : ^2This gives the screen number that the mouse is in.
^1 REQUEST ON / OFF : ^2This command will turn off the System Request
^2box that pops up from time to time to tell you that your disk is
^2write protected etc. You will probably have found out by now that
^2you cannot always get backto to your program after one of these boxes
^2has appeared. Request On turns the box on again.
^1 DEL SPRITE N : ^2Deletes sprite Image number N from the bank.
^1 DEL SPRITE START TO FINISH : ^2Deletes sprite image numbers start to
^2finish. Do not delete the last image in the bank using Del Sprite as
^2it crashes the computer - use Erase 1 instead.
^1 INS SPRITE N : ^2Inserts a sprite into the bank at number N.
^1 DEL ICON N :
^1 DEL ICON START TO FINISH :
^1 INS ICON N :
^1 STOP : ^2Stops the program.
^1 CHANMA() : ^2I assume this tests for an AMAL channel that is just
^2running an animation. I have not tested it yet
^1 AMOS HERE :
^1 AMOS LOCK : ^2Amos Lock disables the <LEFT AMIGA + A> from being used
^2together to toggle between different programs in memory. This in
^2effect stops the Amiga multi-tasking on more than one program.
^1AMOS UNLOCK : enables these keys.
^7Steve Bennett.
^6|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|
^4 The next tip was picked up from Aaron Fothergill, who being the
^4generous person that he is with his coding tips, has said that we can
^4use it!
^5 This tip will be of interest to programers who frequently use data
^5banks to store ascii text etc.
^4 To explain this tip, we will have to give an example application,
^4giving a listing would probably confuse matters.
^6 The thing I used it for required me to look inside a bank for a
^6sentence, then pull out the sentence and store it as a string. The
^6usual method for doing this would be as folows.
^61. Find the start position in memory of the sentence in question.
^62. Find the end location in memory of the sentence.
^7 Now you'd use a For Next Loop to peek out each character in turn and
^7store as a string. This is fine for a single sentence, but if you
^7are talking of pulling out multiple sentences, it can turn out to be
^7a very lengthy process.
^6 To save an enormous amount of time, use the following method.
^7 Initially you do the same as before, follow 1 & 2 above. This time
^7however, you find out how many characters there are between the start
^7and finish of the sentence.. Now you must check to see if the number
^7of characters is even. If it is odd, add one to the amount of
^7characters and one to the end position in memory. Now set a flag to
^7true to let you know that you originally had an odd number. That's
^7the hard bit over with, the rest is easy!
^6 Let us assume that the length is 50 characters, in the old method
^6we'd use a For Next Lop to read the characters, but now all you have
^6to do is this,
^2 Sentence$=Space$(number of characters)
^2Copy start position, end position, to Varptr(Sentence$)
^7This does it all in one transaction rather than the fifty used by
^7the previous method. The difference in speed is amazing!
^6The main thing to watch out for is the fact that the number of
^6characters MUST be an EVEN number. Using the copy command with odd
^6numbers will only give you a randomly locking machine or a big, red,
^6flashing box!
^7This idea is well worth mastering as it wil make your programs a lot
^7faster and therefore more acceptable to your users.
^2Thanks Aaron!
^7In case you do not know how to check for odd numbers, try this.
^2P=noofcharacters Mod 2
^2If P=1
^2noofcharacters = noofcharacters + (noofcharacters Mod 2)
^7(above line sets the odd numbers)
^2End If
^6Checking on the odd numbers after the copy will tell you to cut off
^6the last character and the Mod line will add one to the number of
^6characters if odd.
^7Len.
^6|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|
^1Jeff Tullin has given us permission to use some tips he has found.
^11. There is another problem with Workbench 2 and AMOS, this time
^1concerning fonts.It occurs if you have created a program an a version
^1of Workbench other than V2, ie 1.2 or 1.3.
^1When you run it on a machine using WB2, you may find that your text
^1has `grown' and your display is out. Jeff has come up with a solution
^1for you, we cann't test it for ourselves, but according to Jeff, this
^1is what you do:-
^1Open a small work screen. Here we will say it is Screen X.
^1Screen Open (X) ,320,10,(no of colours),lowres
^1When you want to output to your display screen, you jump to a
^1procedure called JEFFTEXT(square bracket)a,b,T$(sq.brk)
^2Procedure JEFFTEXT(sq.brk)a,b,T$(sq.brk)
^2Screen (X)
^2Get Palette (Display screen)
^2Cls 0
^2Locate 0,0
^2Print T$; ^1(the ; is essential or it will carriage return and
^1disappear off the top of the screen)
^2Screen Copy(X),0,0, Len(T$)*8,8 to Screen(display screen),a,b-6
^2Screen(display screen)
^2End Proc
^1We hope this will solve the problem.
^7Jeff's next tip concerns the creation of animated buttons. If you
^7have TA1 and/or TA2, you will have seen the indenting buttons on the
^7alert box routine and in the alternative file requester. These were
^7created by drawing lines with selected colours to get the desired
^7effect.
^7Jeff's method is even simpler. All you need to do is draw a bar (a
^7solid rectangle) in any colour OVER the button you want to indent,
^7but first you must put in the command
^2Grwriting 3
^6This indents the button. To get it back to normal, put Grwriting
^6back to normal and just draw your bar again. (wish I'd thought of
^6that! Len)
^310/10 for this tip!
^7Jeff has also found a way of changing the colours of the system
^7request box.
^6First make a backup of your AMOS disk, or at least a copy of the
^6Request.lib file incase you do not like the colours you have created!
^7Key in the following as set out below
^2Reserve as work 10,1440
^2Bload "amos_system/request.lib",Start(10)
^2A=Start(10)+$494
^2Doke A,$0
^2Doke A+2,$444
^2Doke A+4,$888
^2Doke A+6,$FFF
^2Bsave "Amos_system/request.lib,Start (10) To Start(10)+Length(10)
^7Run, then reboot to see the differences!
^7You can alter the RGB colour values to suit yourself, but try these
^7colours.
^4Thank you Jeff for providing so many tips for this issue, it's nice
^4to see new names in the magazine.
^6|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|
^4 Ronnie Simpson sent in a tip for dot matrix printer users, our
^4printer doesn't use ribbons, so we haven't tested this one!
^7 "A little tip that I picked up recently may be of interest to some
^7of your readers who own printers.....Imagine that you have an
^7important letter or listing that you must get printed and your ribbon
^7is worn and producing only the lightest shade of grey, the shops are
^7closed and you have no spare ribbon. What do you do?
^5 Answer....Grab a can of WD40 (damp start for cars) or similar, give
^5the ribbon a quick spray, and Bob's your uncle - nice black sparkling
^5print."
^2Ronnie Simpson.
^6|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|
^5 If you are the protective type and want to hide your data for one
^5reason or another, this is a fairly efficient way of doing so.
^5You do this by reading each character in a string, converting it to
^5an ascii number, rolling it, then storing it back in a string. This
^5will make the data unreadable, and easy to decode.
^5To code the data, lets assume that you want to code the letter `A'
^5by this method.
^2To do this you use the command Rol.b 1,A
^51 is the amount rolled to the left, and A is the ascii value of the
^5letter to be rolled. To decode, all you have to do is Ror.b 1,A
^5The niffty bit in this idea is the number, here it is 1, you decide
^5the number for the roll, so that you can make it harder to decode for
^5anyone else.
^5This method is by no means perfect, but if you wish to protect your
^5data, it will give anyone trying to unscramble it a bit of a
^5headache, as you are the one who knows the key number. It will end
^5in failure for someone who isn't really sure of what they are doing!
^6|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|
\