home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 1996-09-27 | 45.9 KB | 1,363 lines
If you are curious to what sort of things go on in the Amos List then here is a selection of what I found the most interesting messages from about a year ago. > When you want to copy two arrays use the following: > > Dim a(n),b(n) > Copy Varptr(a(0)),Varptr(a(0))+n*4 to varptr(b(0)) > > Try it.It's ultra fast.Try to compare it with: > For x=1 to n > b(x)=a(x) > Next > > When you want to initialize an array just use: > Fill varptr(a(0)) to varptr(a(0))+n*4,0 ; fill it with 0 > > You will notice the difference! > > Also deek(varptr(a(0))-4) gives N! > Gregory. However, don't do this if your arrays contain more than 65535 elements in total, as then AMOS doesn't always store them in continous memory addresses. Also, you might have trouble doing this with string arrays, as AMOS will lose pointers to its strings, or gain duplicate pointers it doesn't know about. +-------------------------+------------------------------------+ | | _____ | | PAUL HICKMAN | / \ ON A HOT SUMMER NIGHT | | (ph@doc.ic.ac.uk) | / O O \ WOULD YOU OFFER YOUR | | DEPARTMENT OF COMPUTING | | _ | THROAT TO THE WOLF | | IMPERIAL COLLEGE LONDON | \ / \ / WITH THE RED ROSES ? | | | \_____/ | +-------------------------+------------------------------------+ Machines: Amiga 500 WB1.3 - 1mb Memory - External Disk Drive. Amiga 1200 WB3.0 - 6mb Memory - 200Mb Hard Disk. Procedure H_INPUT[L] ' ' INPUT ROUTINE FOR HEXADECIMAL NUMBERS ' ' L : Length of field (Default character "$" exclused). ' ' ' This routine accepts only the numbers from 0 to 9 and characters ' from A to F. ' (Plus RETURN to end and BACKSPACE to delete the last character.) ' Characters "$"(for binary numbers) is for default. ' It is therefore more fool-proof than the normal INPUT command. ' ' ' ' Basic routine written in 1994 by Christian Mumenthaler ' Revisioned for Hexadecimal Numbers by Luca Ferraris - 02/95 ' This routine is Public Domain. Use it wherever you want to. ' ' NA$="$" Z=Len(NA$) L1=L-Z Print NA$+Space$(L1); Cmove -L1,0 Curs On A1=Asc("0") : A2=Asc("F") Repeat A$=Inkey$ A$=Upper$(A$) A=Asc(A$) If((A>=A1 and A<=A2)) and Z<=L Print A$; NA$=NA$+A$ Inc Z End If If A$=Chr$(8) and Z>0 Z=Z-1 Cmove -1,0 : Print " "; : Cmove -1,0 NA$=Left$(NA$,Len(NA$)-1) End If Until A$=Chr$(13) Curs Off A#=Val(NA$) End Proc[A#] Hallo from Luca Ferraris (aldo@di.unito.it) ------------------------------------------- March 95 ni> I need a procedure to unpack PowerPacked datafiles. These are data banks and to use'em I need to unpack'em! My problem is that I need to do that (too long to explain why... note I own AmosPro!) using Amos 1.31 and without extensions! I can't use a lot of memory too. Hmmm... Some time ago I wrote some workarounds for PowerPacker saving using Ppload and Ppsave of the compiler extension. I don't know, if these are already in the amos creator compiler but they are in the professional compiler. Another problem is that the bank needs the double space to load than normally. BTW: For many reasons, I prefer Turbo Imploder to PowerPacker, which only needs once the memory to load /and/ decrunch and is incredibly fast! :-) Try out this one: It only needs the music (Sload!) and the compiler extension. It's a universal routine for AMOS PP banks, normal PP banks, normal AMOS banks and binary data. If you want to load a bank into chip ram, use negative bank numbers. Procedure PACLOAD[F$,BK] BANK=Abs(BK) : If BK<0 Then CP=2 Else CP=0 If F$="" Then Print "Error: No filename!" : Stop If Exist(F$)=0 Then Print "Error: File not found" : Stop Open In 1,F$ A$=Input$(1,4) : B$=Input$(1,4) LF=Lof(1) If A$="PP20" Pof(1)=LF-4 B$=Chr$(0)+Input$(1,3) LE=Leek(Varptr(B$)) Erase BANK : Reserve As Work BANK,LF+16 ST=Start(BANK) Poke$ ST,"PPbk" Doke ST+4,BANK Doke ST+6,CP Loke ST+8,LE+8 Loke ST+12,LF-8 Pof(1)=0 Sload 1 To ST+16,LF Close 1 Bsave "RAM:PACSAVE.xxx",ST To ST+LF+16 Erase BANK Ppload "RAM:PACSAVE.xxx",BANK Kill "RAM:PACSAVE.xxx" ST=Start(BANK) Copy ST-8,ST+LE-8 To ST Poke$ ST-8,"Work " Pop Proc End If If A$="PPbk" Close 1 Erase BANK : Ppload F$,BANK Pop Proc End If If A$="AmBk" or A$="AmSp" or A$="AmIc" or A$="AmBs" Close 1 Load F$,BK Pop Proc End If If CP=0 Reserve As Work BANK,LF Else Reserve As Chip Work BANK,LF End If Pof(1)=0 Sload 1 To Start(BANK),LF Close 1 End Proc Once upon a time I used this procedure to pack ordinary pp20 files rather then the amos pp banks. It uses bank 16 as temporary bank, so do not store anything there ;-) Procedure PACSAVE[F$,BK,EF] LE=Length(BK) Reserve As Work 16,LE-8 ST=Start(16) Copy Start(BK),Start(BK)+LE To ST-8 Ppsave "RAM:PACSAVE.xxx",16,EF Erase 16 Open In 1,"RAM:PACSAVE.xxx" LE=Lof(1) Reserve As Work 16,LE-16 ST=Start(16) Pof(1)=16 Sload 1 To ST,LE-16 Close 1 Kill "RAM:PACSAVE.xxx" Bsave F$,ST To ST+LE-16 Erase 16 End Proc ni> If u know the format of packed files, just write it down, Ill write the procedure I need. The first longword is 'PP20' or 'PX20' (?) for encoded files, then follows the packed data. The stupid thing about PowerPacker is that it saves the length of the original data in the last four bytes or better to say, the upper three bytes of the last longword. Very odd indeed (and a real mess if you want to rip these files :-{ ). Bye, Chris Hodges <chris@surprise.rhein-ruhr.de> __ __ A500/290/CD/'30er; German Extension-Coder __ /// / / _____ GCS d H s-:++ !g p? !au a18 w++ v? C+++ \\\/// / /_/ ___/ LOGOUT E---- N++ K- W------ -po+ t++@ !5 j-- R+ G? \XX/ \__/ __/ FASCISM! tv- b+ D-- B? e+(++)* u++ h! f !r n+ !y+ AMIGA RULEZ! \/ Well, heres a simple way of finding out what your program is running on, and a few other tricks :-) Change it to suit your program needs. --------------cut------------------ '$ver:aminfo 1.0(12,3,95) ' Darryl Lewis 'Internet address : Darryl_lewis@comlink.mpx.com.au 'If you use any of these ideas in a program it would be nice to mention me 'And very nice if you sent me a copy of the program :-) Screen Open 0,640,320,2,Hires A=Deek(Leek(4)+Equ("LIB_VERSION")) Print "Kickstart version number",A Print "KICKSTART :"; If A<33 Then Print "Obsolete! No longer supported" If A=33 Then Print " 1.2" If A=34 Then Print " 1.3 (1.2 with autoboot for Harddisk)" If A=35 Then Print " Obsolete! Early beta-kickstart 1.4" If A=36 Then Print " Obsolete! Early V2.00 - V2.03 supplied with A3000. A3000 owners should update to at least Kickstart 2.04" If A=37 Then Print "2.04. Final release version of kickstart 2" If A=38 Then Print "Opps! Workbench 2.1. (the exec library should not show this version as all true V38 libs are disked based!" If A=39 Then Print "3.0" If A=40 Then Print "3.01 (Developer Kickstart currently under test)" If A>40 Then Print "Unknown!!!" L=Deek(Leek(4)+Equ("AttnFlags")) If Btst(0,L) Then Print "68010 processor fitted (or 68020/30/40)" If Btst(1,L) Then Print "68020 processor fitted (or 68030/40)" If Btst(2,L) Then Print "68030 processor fitted [V37+]" If Btst(3,L) Then Print "68040 processor fitted [V37+]" If Btst(4,L) Then Print "68881 FPU fitted ( or 68882)" If Btst(5,L) Then Print "68882 FPU fitted [V37+]" If Btst(6,L) Then Print "68040 FPU fitted [V37+]" If Not(Btst(0,L) and Btst(1,L) and Btst(2,L)) Then Print "68000 fitted" ' don't assume that if L>0 then a 68000+ processor is fitted as '68881 chips are available on add-on boards without a fast processor! 'I still recomend using a timing loop to determine the speed to run 'your game at. The reason being, that, if there are mulituple tasks 'being run (such as raytracing) and playing your game, the system will 'be slower than you might assume it would be on a 68000+ 'Run the procedure from Amos. Then compile the procedure and see the timing difference 'ie: A3000=0 Timer=0 For L=0 To 20000 Next L If Timer<28 Then A3000=1 If A3000=1 Then Print "Fast machine, put an extra Wait Vbl in main loop" 'ie: 'Main game loop 'Do ' _move_bobs_procedure ' Wait Vbl ' if A3000=1 then Wait Vbl 'Loop If Ntsc=0 Then Print "PAL display at boot up" Else Print "NTSC display at boot up" 'This will only indicate what the system was booted as. If the mode 'is changed after booting, it will not detect it! 'This following little hack will change screen modes, so now you can 'make your programs work for all TV standards Print "Press any key to change to NTSC" Wait Key 'NTSC Poke $DFF1DC,0 Print "Press any key to change to PAL" Wait Key 'PAL Poke $DFF1DC,32 ------------------------------------------------------------------------- HI! This simple procedure relocates a medmodule so that it can be saved with a amos program. At the beginning of your program before you play the module, you have to remember to call RELOC_MED procedure though. Procedure RELOC_MED[BNK] ' BNK - bank # ' ' Open medplayer.library, version 2 or newer Lib Open 1,"medplayer.library",2 ' the address of the med module to a0 Areg(0)=Start(BNK) ' call RelocModule from medplayer.library L=Lib Call(1,-102) ' close library Lib Close 1 End Proc ?????????????????????????????????????????????? ?? Petri Hakkinen | A1200/2M/210M ?? ?? mystic@tlti.tokem.fi | C64/64k ?? ?????????????????????????????????????????????? ---------------------------------------------------------------------------- This is the Change Font Command that was extraced from the AMCAF-Extension. The procedure is unopenable not because of the secrets behind but due to the fact that machine code procedures cannot be opened. Warning: Should only work with AMOS Pro 1.12 or higher. begin 644 ChangeFont.AMOS M04U/4R!"87-I8R!V,3,T( B@6 0GJ #X %P /@ 4 7 ^ ! M !< #X " %P /@ !$!%$8 5 TT %03W ^ !4$]( /@ M $ 5 NN : 0 2_^X,@&-H86YG95]F;VYT "$ "8 !51O<&%Z !< #X M + %P /@ C $P$/2@ ^ 9 !< #X !D %P )@ ,2&5L;&\@ M5V]R;&0A # 0.V E 0-V !; 2T !@ #(!C:&%N9V5?9F]N= MA & $ FYA;64 7 & 8& &AE:6=H= !< 8 # 8 <W1Y;&4 (P ,! M)8S_TB)M!2P@"68&1^L #$YU(FD!2")I #0L#BQMYU).KO^R+$9!^@#R(!L1 M0 &(!LQ0 $$7P @ '0_H C"")(%LV&%-#$MA1R__\#"D +O_[9Q02_ N M$OP 9A+\ &\2_ !N$OP =$(1+ XL> $0_H 1' 3J[]V$'Z *0@@&8"3G4L M0$'Z )!.KO_B+$9*@&<2($ B;04L(FD!2"QMYU).KO^^(GH >"QX 1.KOYB M+$9.=61I<VMF;VYT+FQI8G)A<GD M F # 0.0 !!;4)S end ------------------------------------------------------------------------ June 95 PW> I`ve written a program in AMOS and I want to be able to distribute PW> keyfiles with it, so if you have the keyfile, certain options are enabled! PW> I`ve mssed around with a few systems, but not found one I`m happy with! Keyfiles should always kept in PROGDIR: (S: or ENVARC: is not a preferable drawer anymore). Moreover, the keyfiles should at least contain a serial identification number and (why not?) the full name and perhaps the address of the registered user. Then there should be a checksum in the regdata to verify that nothing has been modified (the checksum could be a simple CRC, but more complicated and algorithmic checksums are prefered ;-) ). The keyfile should be encrypted using some very tricky algorithms (there's no chance cracking an AMOS program, because Francois has written AMOS ;-)) ). Please look up a encrypting book (which you will certainly find at your local library). If you think, you don't need such a book, please take care that even the most wicked looking routine could be really easy to hack (read the PGP docs for more information on flaws of crypting if you want to). Optionally, you could add a second checksum of the encoded data ;-) To do all this encrypting work, the data should be stored in a fixed size memory bank. This keyfile can then be saved using Bsave. To load the file, reserve a bank and call Bload. Then compare the outer checksum. If it's correct, then decrypt the reg data, and again compare the inner checksum. If everything is correct, you've hopefully got a unmodified registered keyfile. Example of a very simple keyfile: KEYSIZE=256 : Rem Set the size you need for your files. Reserve As Work 9,KEYSIZE ST=Start(9) ' To make the hacking process harder, first fill all bytes with ' random data. For A=0 to (KEYSIZE/2)-1 : Rem All data is written Doke ST+A*2,Rnd(32767) Next Loke ST,SERNUMBER Poke$ ST+4,NAME$+Chr$(0) ' You could poke more information if you want. ' Now create the inner checksum (in this case, it's only 16 bit): SUM=0 For A=0 To (KEYSIZE/2)-3 : Rem the inner checksum itself is excluded SUM=(SUM*11+Deek(ST+A*2)) And $FFFF Next Doke ST+KEYSIZE-4,SUM ' Now encode the data. Very simple encoding method. ' Please invent your own. EC=0 For A=0 To (KEYSIZE/2)-2 : Rem the inner crc is included, but not the outer. OD=Deek(ST+A*2) OD=(OD And $FFF0)/16+(OD And $F)*$1000 OD=(OD+EC) and $FFFF Doke ST+A*2,OD Add EC,$DEAD Next ' Now create the outer checksum: SUM=0 For A=0 To (KEYSIZE/2)-2 : Rem the outer checksum is not included SUM=(SUM*17+Deek(ST+A*2)) And $FFFF Next Doke ST+KEYSIZE-2,SUM ' Now save the keyfile: Bsave "PROGDIR:Keyfile",ST To ST+KEYSIZE Ok. Now the appropriate decrypting code: KEYSIZE=256 Reserve As Work 9,KEYSIZE ST=Start(9) Bload "PROGDIR:Keyfile",9 ' Check the outer checksum: SUM=0 For A=0 To (KEYSIZE/2)-2 SUM=(SUM*17+Deek(ST+A*2)) And $FFFF Next If Deek(ST+KEYSIZE-2)<>SUM Then Print "Intruder alert! A lamer tried to hack the keyfile!" : Stop ' Now the data has to be decoded. EC=0 For A=0 To (KEYSIZE/2)-2 OD=Deek(ST+A*2) OD=(OD-EC) and $FFFF OD=(OD And $0FFF)*16+(OD And $F000)/$1000 Doke ST+A*2,OD Add EC,$DEAD Next ' Check the inner crc: SUM=0 For A=0 To (KEYSIZE/2)-3 SUM=(SUM*11+Deek(ST+A*2)) And $FFFF Next If Deek(ST+KEYSIZE-4)<>SUM Then Print "A cute guy hacked the first barrier but could not get past the checksum!" : Stop ' And at last, you have your registered data back again: SERNUMBER=Leek(ST) NAME$=Peek$(ST+4,80,Chr$(0)) Everything was typed in from scratch and from mind only. :-) I hope it works ;-) Bye, Chris Hodges <chris@sixpack.pfalz.org> __ __ July 95 --------->8---------------->8-------------->8------------------------ Amos and Internet Internet can be useful for Amos programmers. The main reason for this is the existance of the Amos Discussion List. The subscribers talk about anything related to this basic variant. Often simple programming problems are mailed to the list, but also announcements of soon to be appearing software, discussions about what should be in new extensions and how Amos should be further developed. The special thing about this group of Amos users is that some of the top-developers are amongst them. Take Dominic Ramsey, programmer of a number of the official Amos Professional demos. Dominic managed to capture the attention of the British press with his program that successfully predicts the outcome of horse races - the program was written in Amos. Paul Hickman is the author of the Easylife extension. It is the life of the professional programmer that is made easier with it. Easylife adds structured variables, pattern matching, console I/O and MUI compatibility. But those readers that did not understand a thing of the last sentence need not dispair. Paul also added some helper programs that anybody can use. Amongst these are a variable checker and an Amiga Guide viewer. For the latter he converted the Amos Professional on-line documentation. Andy Church maintains the Procedure Library. Have you ever had the feeling that you were re-inventing the wheel with a certain procedure you were writing? Then there is a chance that someone else has added that procedure to the Library. Amongst others it offers you routines for the manipulation of screens and palettes, using Bobs with AMAL and circumventing the archaic Input command. Furthermore some projects are inspired by the threating expiring of both Amiga and Amos. Mike Sikorsky is working on MARP, Mike's Amos Replacement Project [NOTE: Now called M-Lib]. MARP is a library that contains all Amos commands as C-procedures. Mike tries to take over as much of the programming as possible, so that the Amos programmer's only task is converting Amos commands into C-procedure calls. He is even thinking of taking away this last task by adding a conversion program. People about to leave the Amiga can still benefit from this project, as there are plans to make versions for both MS-DOS and X-Windos environments. The other big project is called ADT, Amos Development Team. A year ago a rumour on the net said that Europress would make Amos' source public domain. The ADT got founded by the list's subscribers to coordinate the further development of Amos. Nobody would benefit from a proliferation of badly coded 'improved' Amos versions. Europress did not come true, but the ADT still exists. Now the members concentrate on inventing a whole new programming language that contains all the good of Amos and more. The ADT is of course open for all suggestions. Besides all this serious stuff people are of course programming games. People like Ben Marty (TechnoVenture), Christian Mumenthal (Colonial Conquest) and the members of Dark Unicorn Productions (Scorched Tanks) know what they are talking about and so they do. The Amos Discussion List is maintained by Michael Cox. He is not a moderator, but keeps track of the subscriptions and the FAQ. Those that have access to the Internet can subscribe by sending an e-mail to amos-request@access.digex.net, including the word 'subscribe' in the text. The language of choice is English. Not that it is obligatory to post in that language, but there are only a few Dutch subscribers, so... There is also a website, maintained by Andy Church, at http://mmm.mbhs.edu/~achurch/amos/. Branko Collin [NOTE: The article contained a screenshot of the website. Originally provided by Gareth Edwards. As it was a picture of the old website, the editors decided to make a new screenshot of the new site.] Aug 95 To show an ascii-text on screen you could try to make use of the Peek$ command (amospro) So you would load the file into a bank using Bload and then read out the bank with peek$. This will work quite happily like: Open in 1,f$ reserve as work 6,lof(1) close 1 bload f$,1 print peek$(start(6),length(6)) This means you will have to read in all of the file. Smaller patches of file can be used too: Reserve As work 6,buffer <-you choose size p=0 Open in 1,f$ Repeat pof(1)=p Sload 1 to start(6),length(6) add p,length(6) print peek$(start(6),length(6)) until p>=lof(1) close 1 This needs some tinkering still, but shows the general idea. You could still use the 'LineInput'-loop instead of sload and peek$ but you will see that it is MUCH slower --------------------------------------------------------------------------- JW> I'm wanting to write a utility to run under DOpus which means it JW> needs to be a Shell or CLI executable. I need to be able to pass JW> arguments to the program at startup (HELP!). Now heres the problem. JW> I read that 1.36 Compiler will NOT make CLI executables. What can I JW> do, if anything? There's hardly a difference between WB and CLI executables except that the WB ones have an icon created and the CLIs not. (Moreover, there's a bug in the AP Compiler which will always make a cli executable 'run' type, so it will unhook itself no matter what the switch has been set to.). So just create a workbench executable and delete the icon. You can read the command line using the AMOS '=Command Line$' instruction (but do it early in the program because Francois has located this string buffer somewhere in the gfx-buffers). However, there are no automatic argument parsing routines in AMOS for templates like 'FROM/A,TO/A,QUIET/S' etc. ---------------------------------------------------------------------------- > Can anyone explain a way to program platforms for an amos game. > Is it easiest to check for bob collisions or is it better to check bobs > and zones? It may be a simple procedure, but I am stumped. You shouldn't use zones for platforms, nor bobs. They slow the game down and it's "unprofessional". This is the way it should be done, which happens to be the way commerical m/c programmers do it :-) Use a two dimensional array, say LEV() to hold the map details. You have to break the map down into 16 by 16 pixel blocks and draw icons of this size, containing all the graphics needed. Make sure that they fit together nicely. Then you'll have to create a map editor. There are a few on aminet but I always prefer to create my own. This code ought to do the trick: --------------------------------------------------------------------------- Screen Open 0,320,192,32,lowres Flashoff:Cursoff:Cls 0 Load "Icons.abk" Get Icon Palette ' B=Block/Icon to draw with B=1 Repeat XM=Xscreen(Xmouse):YM=Yscreen(Ymouse):MK=Mousekey XB=XM/16:YB=YM/16 ' Place a block If MK=1 Paste Icon XB*16,YB*16,B LEV(XB,YB)=B Endif ' Delete a block If MK=2 Cls 0,XB*16,YB*16 To XB*16+16,YB*16+16 Endif ' You could insert a bit of code in here to alter the block that you ' are currently using, maybe using the left and right arrow keys? Until Keystate(69) : Rem Press escape to save the level ' Save the map Openout 1,"Level" For x=0 to 320/16-1 For y=0 to 192/16-1 Print #1,LEV(x,y) Next y Next x Close 1 --------------------------------------------------------------------------- That will save your map as a sequential file, not the best way to do it, but the easiest ;-) Now, the game: --------------------------------------------------------------------------- Screen Open 0,320,192,32,lowres Flashoff:Cursoff:Cls 0 Load "Icons.abk" Get Icon Palette Load "Sprites.abk" ' Load the map Openin 1,"Level" For x=0 to 320/16-1 For y=0 to 192/16-1 Input #1,LEV(x,y) If LEV(x,y)>0 Then Paste Icon x*16,y*16,LEV(x,y) Next y Next x Close 1 X=x pos of sprite (Sprite is 16 by 16 pixels) Y=y pos of sprite (and the hot spot is in the top left) XSP=0:YSP=0 : Rem Speed of sprite Repeat Add X,XSP:Add Y,YSP XSP=XSP/1.1 ' Look directly under the sprites feet If LEV(X/16,(Y+16)/16)=0 and LEV((X+15)/16,(Y+16)/16)=0 ' Nothing there so drop Inc YSP Else YSP=0 ' Jump if push up, it's on land If Jup(1):YSP=-10:Endif Endif If Jleft(1):Add XSP,-2:Endif If Jright(1):Add XSP,2:Endif ' Place Sprite, not animated, you can do that yourself :-) Sprite 0,XHard(X),Yhard(Y),1 Wait vbl Until KeyState(69) End ------------ This *should* do it, but I've probably missed out something really obvious, as I often do ;-) It will probably be more slippery and slidey than Technoventure, but that can be altered by increasing the 1.1 in XSP=XSP/1.1 I hope this has helped, I hope you can follow my code. I can never follow other people's, but this is pretty simple. To check if the sprite has walked into a wall, it is pretty much the same thing as looking under the sprites feet, except you look left or right. Tell me if you want a better explaination, a more complex explaination or a more confusing explaination if you need to. Bye _________________________________ / \ > Ben Wyatt - bwyatt@paston.co.uk < \_________________________________/ ©1995 Very Interesting Signatures --------------------------------------------------------------------------- This is from my anim2bob interface. You'll first need to load the Default resouce bank that's in the interface tutorial directory. I have another prcedure that searches the harddisk to find it, to keep memory usage low for the converter. Do _Buttons Loop Procedure _BUTTONS 'erase resource bank to savechip ram. This means that the resource bank must be 'loaded each time the program is run. Resource Bank 16 Resource Screen Open 0,640,200,0 'Wait Vbl 'each indented box uses the BAse command. Each ellement in the box is 'offset relative to the BAse. Thus, by changing the co-ordinates of the 'Base, every elliment is moved correctly aswell. A$=A$+"BAse 0,0;" A$=A$+"BOx 0,0,1,640,200;" A$=A$+"BUtton 1,0,0,58,14,0,0,1;[UN 0,0,BP3*43+;PR 12,4,'Quit',16;][BQ;]KY 128 69+,0;" A$=A$+"POutline 258,7,'ANIM2BOB CONVERTER',0,6;" A$=A$+"LIne 132,16,10,538;" A$=A$+"BAse 32,37;" A$=A$+"BOx 0,0,82,260,55;" A$=A$+"POutline XA80+,YA10-,'LOAD OPTIONS',0,6;" A$=A$+"BUtton 2,XA70-,YA12+,32,16,1,0,1;[UN 0,0,BP22+;][BC 3,0;]" A$=A$+"PRint XA34+,YA5+,'Grab Single IFF',7;" A$=A$+"BUtton 3,XA34-,YA12+,32,16,0,0,1;[UN 0,0,BP22+;][BC 2,0;]" A$=A$+"PRint XA34+,YA5+,'Grab Anim',7;" A$=A$+"BUtton 11,XA34-,YA12+,32,16,0,0,0;[UN 0,0,BP22+;][BC 11,0;]" A$=A$+"PRint XA34+,YA5+,'Imagine Raytraced Files',7;" A$=A$+"BAse 32,110;" A$=A$+"BOx 0,0,82,260,71;" A$=A$+"POutline XA80+,YA10-,'GRAB METHOD',0,6;" A$=A$+"BUtton 4,XA70-,YA12+,32,16,1,0,1;[UN 0,0,BP22+;][BC 5,0;BC 6,0;]" A$=A$+"PRint XA34+,YA5+,'Overlay Size',7;" A$=A$+"BUtton 5,XA34-,YA12+,32,16,0,0,1;[UN 0,0,BP22+;][BC 4,0;BC 6,0;]" A$=A$+"PRint XA34+,YA5+,'Fixed centre',7;" A$=A$+"BUtton 6,XA34-,YA12+,32,16,0,0,0;[UN 0,0,BP22+;][BC 4,0;BC 5,0;]" A$=A$+"PRint XA34+,YA5+,'Minimum Size',7;" A$=A$+"BUtton 13,XA34-,YA12+,32,16,0,0,1;[UN 0,0,BP22+;][BC 10,0;]" A$=A$+"PRint XA34+,YA5+,'Option: Equal Sides',7;" A$=A$+"BAse 332,37;" A$=A$+"BOx 0,0,82,260,55;" A$=A$+"POutline XA80+,YA10-,'VIEW',0,6;" A$=A$+"BUtton 7,XA70-,YA12+,32,16,0,0,1;[UN 0,0,BP30+;][BC 7,0;]" A$=A$+"PRint XA34+,YA5+,'IFF/Animation',7;" A$=A$+"BUtton 12,XA34-,YA12+,32,16,0,0,1;[UN 0,0,BP30+;][BC 12,0;]" A$=A$+"PRint XA34+,YA5+,'Bank(.abk)',7;" A$=A$+"BUtton 8,XA34-,YA12+,32,16,0,0,1;[UN 0,0,BP30+;][BC 8,0;]" A$=A$+"PRint XA34+,YA5+,'Instructions',7;" A$=A$+"BUtton 14,XA120+,YA22-,32,16,0,0,1;[UN 0,0,BP22+;][BC 14,0;]" A$=A$+"PRint XA34+,YA5+,'Mirror',7;" A$=A$+"BUtton 15,XA34-,YA22-,32,16,0,0,0;[UN 0,0,BP22+;][BC 15,0;]" A$=A$+"PRint XA34+,YA5+,'Lock',7;" A$=A$+"BAse 332,110;" A$=A$+"BOx 0,0,82,260,71;" A$=A$+"POutline XA80+,YA10-,'START',0,6;" A$=A$+"BUtton 9,XA70-,YA12+,32,16,0,0,1;[UN 0,0,BP30+;][BC 9,0;]" A$=A$+"PRint XA34+,YA5+,'Load and process',7;" A$=A$+"BUtton 10,XA34-,YA12+,32,16,0,0,0;[UN 0,0,BP22+;][BC 10,0;]" A$=A$+"PRint XA34+,YA5+,'AREXX',7;" A$=A$+"BUtton 10,XA34-,YA12+,32,16,0,0,0;[UN 0,0,BP22+;][BC 10,0;]" A$=A$+"PRint XA34+,YA5+,'DXF file',7;" A$=A$+"BUtton 10,XA34-,YA12+,32,16,0,0,0;[UN 0,0,BP22+;][BC 10,0;]" A$=A$+"PRint XA34+,YA5+,'Imagine Object Convert',7;" A$=A$+"EXit;" ' Monitor Dialog Open 1,A$ X=Dialog Run(1) ' make sure that there is some initial settings. These will be 'changed inside the Do Loop as buttons are pressed. _FILE_OPTION=1 _METHOD=1 Do D=Dialog(1) If D<0 Then BYE=1 : Exit : Rem end If D=2 Then _FILE_OPTION=1 : Rem Iff If D=3 Then _FILE_OPTION=2 : Rem Anim If D=4 Then _METHOD=1 : Rem Overlay If D=5 Then _METHOD=2 : Rem Fixed centre If D=6 Then _METHOD=3 : Rem Minimum If D=7 Then _METHOD=4 : _FILE_OPTION=0 : Exit : Rem Test View iff /anim If D=8 Then _METHOD=5 : _FILE_OPTION=0 : Exit : Rem Instructions If D=12 Then _METHOD=6 : _FILE_OPTION=0 : Exit : Rem veiw bank If D=13 Then _EQUALISE=1 : Rem equalise sides If D=14 Then _MIRROR=1 : Rem MIRROR DISPLAY OF Bob BANK If D=9 Then Exit : Rem start button 'if d=10 then nothing, because arrex not written yet. Loop Dialog Close 'Screen Close 0 Erase All If BYE=1 Then End End Proc The only problem I've had is that when using radio buttons, you can deselect all buttons by selecting an already selected button. Any solutions? Darryl -- Via DLG Pro v1.0 --------------------------------------------------------------------------- Do Proc SEGAFIRE[0] Print Bin$(Param,4) Proc SEGAFIRE[1] Print Bin$(Param,4) Loop Procedure SEGAFIRE[BUTTON] ' Amiga 4-button joystick code... ' ' Stick discovery by Ed Bamber ' Code created by Anthony Ball ' Converted to AMOS by Brad Gust ' ' (C)1992 Anthony Ball & Edmund Bamber ' (C)1994 Brad Gust ' ' Requires a SEGA joystick with wires 5 & 7 swapped ' REG=$0 If BUTTON If Fire(1) REG=REG+$4 End If If Not Btst(6,$DFF016) REG=REG+$2 End If Doke $DFF034,$E000 If Fire(1) REG=REG+$8 End If If Not Btst(6,$DFF016) REG=REG+$1 End If Else If Fire(0) REG=REG+$4 End If If Not Btst(2,$DFF016) REG=REG+$2 End If Doke $DFF034,$E00 If Fire(0) REG=REG+$8 End If If Not Btst(2,$DFF016) REG=REG+$1 End If End If End Proc[REG] That was up here a while back. Hope it helps. Well met and godspeed, Giark ---------------------------------------------------------------------------- Just to let ya all know that when using the C: command "BRun" from within the Exec command, you will have a multi-tasking Exec command. When you use BRun (example: Exec "C:BRun DF0:Amoeba_Invaders") it will load and run your program, plus return control back to amos immediately. Without the BRun (example: Exec "DF0:Amoeba_Invaders") control won't return to amos until you quit the program you executed. So if your looking for a much needed type function from within AMOS until someone writes a better command that will do the same thing, then I suggest gettin a hold of BRun which is available on Aminet. Note: That when using the BRun command, you will need to use Amos To Back command if you want to see and use that application. Greg --------------------------------------------------------------------------- > I would like to see the methods mentioned, Ben Wyatt says > he can sort 5000 numbers in one second. Now I would like to > see that. Er... that's *less* than one second ;-) This is my "invented" method, I call it the My Sort ;-) ----------------------------------------------------------------------- Set Buffer a_heck_of_a_lot ;-) (Depends on the max values and repeats) Input "Numbers:";NUMBERS ' LIST() holds each of the values Dim LIST(NUMBERS) ' Give each element a random value For N=0 To NUMBERS LIST(N)=Rnd(MXVALUE) Next N Proc_MYSORT[100,NUMBERS/10] ' Here's the actual sort... short eh? ;) ' MXVALUE=End of range eg.0-100 ' MXREPEATS=Max number of elements with the same value in the list Procedure _MYSORT[MXVALUE,MXREPEATS] ' Reserve some large arrays Dim APOINTER(MXVALUE,MXREPEATS),ACOUNT(MXVALUE),NEWLIST(NUMBERS) ' Err.... can't explain this bit, look below for full explaination For N=0 To NUMBERS APOINTER(LIST(N),ACOUNT(LIST(N)))=N Inc ACOUNT(LIST(N)) Next N ' Pointers stuff (look below) ELEMENT=0 For N=0 To MXVALUE If ACOUNT(N)>0 For PLACE=0 To ACOUNT(N)-1 NEWLIST(ELEMENT)=LIST(APOINTER(N,PLACE)) Inc ELEMENT Next PLACE End If Next N End Proc ----------------------------------------------------------------------- Okay, now the explaination: But first, a diagram to confuse you... ;) Element no. Your list Pointers New list +--------+ +--------+ +--------+ 0 | 4 | | 9 | | 0 | +--------+ +--------+ +--------+ 1 | 10 | | 5 | | 1 | +--------+ +--------+ +--------+ 2 | 3 | | -1 | | 3 | +--------+ +--------+ +--------+ 3 | 15 | | 2 | | 4 | +--------+ +--------+ +--------+ 4 | 8 | | 0 | | 5 | +--------+ +--------+ +--------+ 5 | 1 | | 7 | | 8 | +--------+ +--------+ +--------+ 6 | 12 | | -1 | | 9 | +--------+ +--------+ +--------+ 7 | 5 | | -1 | | 10 | +--------+ +--------+ +--------+ 8 | 9 | | 4 | | 12 | +--------+ +--------+ +--------+ 9 | 0 | | -1 | | 14 | +--------+ +--------+ +--------+ 10 | 14 | | 1 | | 15 | +--------+ +--------+ +--------+ 11 | -1 | +--------+ 12 | 6 | +--------+ 13 | -1 | +--------+ 14 | 10 | +--------+ 15 | 3 | +--------+ Maximum value in Your list, LIST(), is 15, so the number of elements in Pointers, APOINTER(), is 15. It then scans through Your list, looks at each value and puts it's index into Pointers, element "value". Can you make any sense of that? I struggled to! ;-) For example, lets take element 0 of Your list, it holds "4". So, in element 4 of Pointers, a pointer to the element in Your list, ie 0. Follow??? Now, each element in the pointers is gone through and the pointer is read. Then the value of your list, element "Pointer", is put into the next free space in New list. Another confusing paragraph... ;-) For example, the first element in Pointers is 9, pointing to element 9 of Your list. This element holds a 0. So the next free element of New list holds the value 0. Another example, it's up to element 12 in pointers, pointing to element 6 in Your list. which is a 12, so the next free element in New list is a 12. Understand??? If you can't understand all this, I understand, just use the procedure and don't worry about it. ;-) If you do understand it, congratulations, it's easy to program, and it would be quite easy to alter it to cope with text. It could also be made to take *much* less memory with a linked list, or some sort of stack... Does this sort sound familiar to anyone? I do understand. Quite nice indeed. You only go through the list twice to achive full sort. Fast. However, on the 'memory'-thing you mention: this is a far greater pro- blem than you make it appear. Usually one will have to go through the list another time in order to find the 'maxnumbers' Furthermore: I do not see quite what you mean by using a linked list or the stack. Try to explain. I used a method to get fill the 'bucketsort'-buckets in two goes like your program. It also needs the extra memory for a list in which it will contain the start and end of each bucket. Maybe this sort can be combined with the 'fast-bucket' so the first goal is to sort all in buckets and the second goal is to sort the buckets so the memory needed is quite less. > Does this sort sound familiar to anyone? Not to me anyway. I don't know much about sorts of sorts ;-) It's an advantage if you know the maxnumbers in advance. Otherwise it's okay to use the maximum possible value that the numbers could hold. > Furthermore: I do not see quite what you mean by using a linked list or > the stack. Try to explain. With "My Sort" if two or more elements in the array have the same value, they'll have to be put elsewhere. Each element of the Pointers could have a linked list, each using the same bit of memory to hold the data. That way, a lot less memory is used... At the moment, it just uses a two dimensional array, with large "buckets" to hold the overflowing data for each pointer (look at the program). This is a scrappy explaination, sorry... I'll explain it again if it doesn't make sense ;-) > I used a method to get fill the 'bucketsort'-buckets in two goes like > your program. It also needs the extra memory for a list in which it > will contain the start and end of each bucket. > Maybe this sort can be combined with the 'fast-bucket' so the first goal > is to sort all in buckets and the second goal is to sort the buckets > so the memory needed is quite less. Yes, this sounds a bit like my sort, how fast is it? > > Does this sort sound familiar to anyone? > Not to me anyway. I don't know much about sorts of sorts ;-) I've only done a bit at school... _________________________________ / \ > Ben Wyatt - bwyatt@paston.co.uk < \_________________________________/ ©1995 Very Interesting Signatures Why even go to all that trouble?!? If you are going to define an array with as many elements as 0 to maxnumber then why not ditch all that other stuff and simply increment the array element, counting the number of 1's ,2's 3's...and so forth and then create the new list using these values. For I=0 To NUMBERS Inc SORTARRAY(LIST(I)) Next I POS=0 For I=0 To MAXNUMBER If SORTARRAY(I)>0 For J=1 To SORTARRAY(I) NEWLIST(POS)=I Inc POS Next J End If Next I Where NUMBERS contains the number of numbers to be sorted LIST contains the unsorted numbers SORTARRAY is an array that stores the frequency of each number MAXNUMBER is the largest number to be sorted NEWLIST stores the new array(and you could use LIST to store this) This uses far less resources and is just as quick. Robert Currie It's brilliant. Why didn't I think of that? ;-) Now make it work with strings and floating point numbers ;-D > P.S. This type of sort is VERY limited and memory hungry but > useful for small sorts or very tightly packed data. I know :( or I know :-))))) ------------------------------------------------------------------------- I've tried out this Comp Test Off command, and it does appear to speed up programs by about 10% when compiled. In fact, if you've written an "interesting" program like: Comp Test Off For A=1 to 1000000 Next A then the speed difference is about 30% (hurrah!). However, if like me, your program is based around calling the Synchro command every 50th of a second or so, then you'll realise that there is no speed difference whatsoever. It seems that the Synchro command calls the "Comp Test" code - is this true? If, so is there any way around it? If anyone's interested (although I doubt it ;-) ) the Comp Test command is normally automatically called every time there is a loop/goto/wait/print etc in the program, and it takes about 5 micro seconds (on a bog standard A1200). Cheers, Mark PH> > I've heard that the Comp Test [On/Off] commands are only dummies. PH> > They all point to the same routine doing nothing. (?) PH> PH> They are until you compile the program. Then they stop it checking PH> keyboard/mouse input. I had a database program which sorted PH> a huge array 10% faster with comp test off, and copper off. Did you use a screen with more than 16 lowres or 4 hires colours? Thx for this information ;-))) I'll use it in my next productions ;-)) Bye, Chris Hodges <chris@sixpack.pfalz.org> __ __ -------------------------------------------------------------------------- Greetings Mark, you wrote some text on the subject Compiling Problems, and now I'm going to answer it. > Here are a couple of problems I had after I compiled my very large game: > > 1. It seems that when I use Set Font very soon after the Get Disc > Fonts command, I get an error return code 20 (divide by zero?). This > does not happen with the AMOS program. > I use the Set Font command straight away, for all the fonts in my > program, so that I do not get unwanted disk acceses later on. I've never had this problem... but I have another suggestion... Before doing the Get Disc Fonts, do an Assign "Fonts:" To "Fonts/". This will make it so it doesn't load *all* the fonts on disk, only your one in the program directory. When you end the program, do something like: If Exist("Sys:Fonts") Then Assign "Fonts:" To "Sys:Fonts" This *might* fix your problem, as Amos could be clearing the fonts from memory. This method takes far less memory and is faster. Or get Easylife or Amcaf for better font support :) > 2. When I choose the Squash program option and then try to load the > compiled program, it simply refuses to load (no problem with > powerpacker library). I guess this must be a memory problem, > although my A1200 is fitted with an extra 4Mb of Fast RAM (the codes > about 200K long). > > Are these problems known bugs, or am I doing something wrong :-( ? It is a bug. A very obvious one, that Europress *should* have noticed :( Maybe they just didn't bother checking that it worked... _________________________________ / \ > Ben Wyatt - bwyatt@paston.co.uk < \_________________________________/ ©1995 Very Interesting Signatures BW> If Exist("Sys:Fonts") Then Assign "Fonts:" To "Sys:Fonts" Ieeekkk! I've got my fonts in DH1:Fonts due to disk space reasons. ;-) Haven't tried this before but: ODIR$=Dir$ Dir$="FONTS:" OFONTS$=Path$(Dir$) Dir$=ODIR$ at the beginning and: Assign "FONTS:" To OFONTS$ should work no matter where the user has located his fonts normally ;-) -------------------------------------------------------------------------- Btw, in aminet you will find Oberon language archive, it contains v40.xx includes ( not in real Commodore format..) ------------------------------------------------------------------------ This is a program that does 8 way scrolling using generic colored blocks as the map icons. It manages around 1 screen every 4/50ths of a second and I do not notice any flickering. There are other ways to do this but I did not have time to test them all. One other possibility is to use a single screen and the Horizontal and Vertical Scroll commands in conjunction with the Clip command. This may speed things up but I am not sure. 'Example program by Robert Currie '----------------------------8 way scroller--------------------------- ' Set Buffer 50 Dim MAP(100,100) Global MAP() Global POX,POY ' '!!MAP could have a third index which could tell information about speed ' 'of travel over that type of background or impassibility.!!' ' INITIALIZE Repeat Repeat COM$=Inkey$ Until COM$<>"" If COM$="7" NEWSCREEN[-1,-1,True,False,True,False] End If If COM$="8" NEWSCREEN[0,-1,True,False,False,False] End If If COM$="9" NEWSCREEN[1,-1,True,False,False,True] End If If COM$="4" NEWSCREEN[-1,0,False,False,True,False] End If If COM$="6" NEWSCREEN[1,0,False,False,False,True] End If If COM$="1" NEWSCREEN[-1,1,False,True,True,False] End If If COM$="2" NEWSCREEN[0,1,False,True,False,False] End If If COM$="3" NEWSCREEN[1,1,False,True,False,True] End If Until COM$="e" ' ' Procedure INITIALIZE For I=0 To 100 For J=0 To 100 MAP(I,J)=Rnd(5)+5 Next J Next I ' Initializes map with random map pieces that correspond to icon indexes' Screen Open 1,320,200,16,Lowres Screen Hide 1 ' This is the work screen' Screen Open 2,320,200,16,Lowres Screen To Front 2 ' This is the show screen' Screen 1 For I=0 To 15 Ink I,, Bar 0,0 To 15,15 Get Icon 1,I+1,0,0 To 15,15 Next I ' Creates the map peices--icons 1-16' POX=50 POY=50 ' Set the player start location For X=0 To 16 For Y=0 To 8 Paste Icon 24+X*16,28+Y*16,MAP(X+POX-8,Y+POY-4) Next Y Next X ' Initialize the background Get Icon 1,17,24,28 To 295,171 Screen 2 Paste Icon 24,28,17 ' Put the background on the front screen End Proc Procedure NEWSCREEN[XMOV,YMOV,TP,BT,LT,RT] '---------------------- 'Procedure NEWSCREEN 'XMOV--x direction player movement 'YMOV--y direction player movement 'TP--Boolean, true if top should be drawn 'BT--Boolean, true if bottom should be drawn 'LT--Boolean, true if left should be drawn 'RT--Boolean, true if right should be drawn '---------------------- Timer=0 ' Initialize timer to 0' Screen 1 ' Flip to work screen' Paste Icon 24+XMOV*(-16),28+YMOV*(-16),17 ' Paste old screen at new position' ' !!Could check movement here!! POX=POX+XMOV POY=POY+YMOV ' Update player position' If TP ' Draw top icons' For X=0 To 16 Paste Icon 24+X*16,28,MAP(X+POX-8,POY-4) Next X End If If BT ' Draw bottom icons' For X=0 To 16 Paste Icon 24+X*16,156,MAP(X+POX-8,POY+4) Next X End If If LT ' Draw left edge icons' For Y=0 To 8 Paste Icon 24,28+Y*16,MAP(POX-8,Y+POY-4) Next Y End If If RT ' Draw right edge icons' For Y=0 To 8 Paste Icon 280,28+Y*16,MAP(POX+8,Y+POY-4) Next Y End If Get Icon 1,17,24,28 To 295,171 ' Get new background' Screen 2 Paste Icon 24,28,17 ' Put new background on show screen' Locate 0,0 : Print Timer ' Show # of VTLs' ' !!Could place image of player here!! End Proc Robert Currie