8/13/89 11:02:58 AM Opening "TML Pascal" for recording. Subj: TML Pascal 88-01-02 17:10:12 EDT From: SYSOP jim Msgs: 205 (89-07-06) This area is for discussion of TML Pascal for the Apple IIGS from TML Systems. Subj: TML Pascal upgrade to Ver 1.50 88-02-06 17:15:25 EDT From: SYSOP jim TML Systems, Inc. has announced that both the stand-alone (mouse-based, multi-window) and APW versions of TML Pascal are being upgraded to version 1.50 and are available for $10.00 (for each upgrade) to owners of TML Pascal. You must order the upgrades before March 1, 1988 by returning the "Registered Owner's Product Upgrade Form" with your product's registration number. If you haven't received this form from TML Systems, then you should contact TML Systems at 904-636-8592. Registered owners of either version of TML Pascal may purchase the second version of TML Pascal for $50.00 and may purchase TML BASIC version 1.00 for $85.00 with this same form. Following is a list of the 'primary' enhancements available in version 1.50 of TML Pascal (as listed in TML's letter): Complete Toolbox interfaces including SANE, Integer Math, Note Sequencer and MIDI tools have been added to both the stand-alone and APW versions of the TML Pascal compiler. Several code generation and linker improvements have been added to both the stand-alone and APW versions of the TML Pascal compiler resulting in smaller and faster programs. All known (reported) errors in both the stand-alone and APW versions of the TML Pascal compiler have been corrected. The $A+ option in the APW version of TML Pascal is now functional and capable of creating assembly source listings of generated code. Printing capabilities in the stand-alone version of TML Pascal have been enhanced to provide several new options (including a print range selection). The stand-alone version of TML Pascal is fully compatible with the GS Finder. Subj: Re: TML Pascal 88-02-07 02:14:28 EDT From: SYSOP mf The A+ option is a great learning tool for those wanting to see how a compiler works, as well as a good device for allowing you to customize or hand optimize a particular section of code. It was present in the Mac version of the cross-compiler. A good enough reason by itself to upgrade to version 1.5. Subj: - READLN bug 88-02-16 01:08:13 EDT From: FL Jim If you're using the text screen for I/O with version 1.1 of TML Pascal and the READLN procedure doesn't recognize the return key at the end of your input, then you need to send your TML Pascal diskette back for a free update to version 1.1a. A work around for this problem (until you get your update) is to call SetInGlobals in the //GS Text Tool Set and set the AND mask to $7F and the OR mask to $00 to clear the high bit of every character read. Apparently, TML Pascal's READLN procedure looks for a $0D at the end of line and won't accept a $8D. Subj: Re: TML Pascal 88-02-20 01:39:11 EDT From: KatherineL Ah HA, that explains why my CDA is not reading what I type. Now why is the screen not showing what I write???? Subj: l 88-02-20 13:23:38 EDT From: KevinS18 I just bought TML Pascal two days ago and I'm ready to take it back. I'm still in the early stages of learning Pascal but making errors in my "plain vanilla" programs shouldn't be a reason for the compiler to crash. I'm getting closer and closer to the reason and I think it has something to do with the procedure call I'm using. Anytime I specify a value or variable parameter like: procedure test (number: integer); with the corresponding test (number); in the main program it crashes, EVERY STINKING TIME!!! AARRRGGGHHH!!!! {help} Subj: Re: TML Pascal 88-02-20 14:25:38 EDT From: FL Jim Kevin, Could you upload a short program example that crashes on your system? We can probably solve this with a little more info. --Jim Subj: Re: TML Pascal 88-02-20 14:27:21 EDT From: FL Jim Katherine, What and when will it not write? I've sent off my original disks for the version 1.1a update. --Jim Subj: Re: TML Pascal 88-02-20 18:09:18 EDT From: KevinS18 OK Jim, the source code is in the SOURCE CODE LIBRARY. I sure appreciate the help (I just hope my stupidity doesn't show through). Subj: Re: TML Pascal 88-02-20 19:14:35 EDT From: KatherineL OK, it'll be easier to understand the problem if I upload it. I tried the suggestion with SetInGlobals, and assuming I did it correctly it still won't work. NOW it crashes. SIGH. It also says CLC when it crashes. Anyway, I'll call it BROWSECDA.PAS when I upload it. Thanks for your help. Subj: Re: TML Pascal 88-02-21 08:01:01 EDT From: FL Jim Kevin, Your program reads similar to this (I've shortened the code to save some typing): Program Test (Input, Output); Var Number : Real; Procedure Input (Var NumToGet : Real); Begin Write('What number: '); Readln(NumToGet); End; Begin {main} Input(Number); Writeln('Number entered is ',Number); End. {main} The problem with this program is that the standard external file, Input (in the program heading), has been reused as the procedure's name. Try changing the procedure's name to something like GetInput and recompile the program. --Jim Subj: Re: TML Pascal 88-02-21 10:38:19 EDT From: FL Jim Katherine, I'm investigating the problem you're having. Give me a couple of days to try and figure out what isn't working right. If all else fails, I'll get with TML for you. --Jim Subj: Re: TML Pascal 88-02-21 19:46:40 EDT From: KevinS18 Thanks for the help Jim. I changed it and it works like a champ. Subj: cal 88-02-24 02:38:24 EDT From: FL Jim I experimented the evening away tonight and found out some interesting things. First, I mixed up the information I gave earlier on how to set the TextTool Input global masks for TML Pascal 1.10. The input AND mask should be set to $FF and the input OR mask should be set to $80 for version 1.10 (not 1.10a) of TML Pascal. Also, if you are using the TextTools in your application, you should probably use the GetDevice and GetGlobals calls at the entrance to your program and use the SetDevice and SetGlobals calls at your program's exit to "leave things as you found them" and make sure you initialize the devices with InitTextDev. Next, just as TML's documentation states, TML Pascal's Write and Writeln routines check to see which screen, the SHR or Text screen, is active so the TML program can send output to the right place. This causes a problem if you are writing CDA's. If the CDA is activated from a Text application, the CDA writes to the text screen as expected, but if you are running a SHR application, then the CDA's text goes to QuickDraw's text routines and the CDA's text ends up all over your active SHR window. It looks like the //GS TextTools will have to be used in TML CDAs to read and write to the text screen. Subj: Re: TML Pascal 88-02-27 01:55:05 EDT From: KatherineL Hi! Yes, Jim, you are cursed! With ME and my nasty old CDA again. Still won't work! Will put it up in software library. Have a nice weekend (hee hee hee)... Subj: scal 88-02-27 12:55:51 EDT From: FL Jim Kathy, I'll look at the CDA source code today. By the way, if you want to send me files that won't be released into the library, just use "Send A File..." in EMail. It makes a little less work on my end :) --Jim Subj: TML Pascal (Current versions) 88-03-08 02:12:33 EDT From: FL Jim I recently sent all of my TML Pascal disks back to TML to get them updated to the latest versions. Here are the current (as of 3/4/88) version numbers of both TML Pascal compilers for the IIGS and the TML Source Code Library. PRODUCT NAME: TML Pascal (APW version) VERSION: 1.10A DATE: 12/22/87 (use the date of the TMLPASCALLIB file) PRODUCT NAME: TML Pascal (Integrated version) VERSION: 1.00D DATE: 11/17/87 PRODUCT NAME: TML Source Code Library VERSION: 1.20 DATE: 9/3/87 Subj: Re: TML Pascal 88-03-12 20:04:17 EDT From: KevinS18 I'm still learning Pascal and using TML's "Plain Vanilla" environment. I bought Vol. 1 of Apple's Toolbox Reference but I sure didn't understand much. Someday I might actually write a NDA for my GS. Subj: al 88-03-20 23:38:18 EDT From: FA KathyL Is there any way to do file IO in a CDA when in a P-8 environment? ALSO -- is there anything special that needs to be done to write to a printer from a CDA in a P-8 environment as opposed to a P-16 environment? Subj: Re: TML Pascal 88-03-21 00:06:21 EDT From: FL Jim Accessing ProDOS-8 from a CDA would require some tricky (known in some places as "illegal") code. I wouldn't advise it unless you really know all the bad things that could happen. Accessing the printer thru TextTools shouldn't be any problem. Just leave things the way you found them and the ProDOS-8 program shouldn't notice a thing (unless it happens to be printing when you call the CDA). Subj: Re: TML Pascal 88-04-21 18:55:37 EDT From: Brendan Hr I think I have a couple of "Plain Vanilla" programs that cause the TML 1.00D compiler to crash...does anyone want to (egads!) see them? They are simple. I sent them to TML, but they promptly lost them...twice. Don't know what happened (I sent the first one with my registration, which they still have). I'd like a "text Screenshot" command for the PV environment. That way I could do some Comp. Science programming at home, and bring it in...with the results... Subj: Re: TML Pascal 88-04-22 16:52:41 EDT From: AFL Jim Sure! Go ahead and post them and I'll take a look. I think there are a couple of CDAs that will do a SHR screen dunp to a disk file. Then you could print it with your favorite paint program or print utility. Take a look in the Utilities Forum library for those CDAs. Subj: Re: TML Pascal 88-04-22 22:49:22 EDT From: AFL Jim Brendan, The 2 CDA's that will let you save the SHR screen as a disk file are PIC.SAVER.CDA and SHR C1 Saver in the Utilities Forum Library in the IIGS Desk Accessories sublibrary. Subj: Re: TML Pascal 88-04-24 16:50:53 EDT From: Brendan Hr Alas, Printing the screen would be a problem. I have an epson printer, and the only printer that I have EVER gotten an SHR to print to was the IM II...even PaintWorks GOLD, when set for my printer and printercard (EXACTLY) won't work! I don't know why. Subj: cal 88-04-24 16:52:34 EDT From: Brendan Hr Thanks Jim. Now I have to go look for those programs! hahaha... (BTW, a hint for all. If using TML 1.00D, ALWAYS have the source code saver on. I have even had the program crash during a COMPILE! Scary...) Subj: Re: TML Pascal 88-04-26 02:46:04 EDT From: AFL Jim You could always use the text screen instead of the Plain Vanilla mode - just leave the (Input, Output) parameters off of the Program statement. There are CDA's to dump the text screen, too. If you need some of the screen features such as GotoXY or ClrScr in your programs, just write your own procedures to print the correct control characters and include them in your program. The control codes can be found in the Apple IIGS Firmware Reference or in several books like Gary Little's "Exploring the Apple IIGS" (pages 444-445). Example: Procedure ClrScr; { clear the text screen and put the cursor in the home position } Begin Write(Chr(12)); End; Subj: Re: TML Pascal 88-04-26 18:35:26 EDT From: Brendan Hr There is a text screen -> printer dump CDA? I haven't seen one. Could ya' point me in the right direction? Thanks, Brendan Gallagher Hoar Subj: ML Pascal 88-04-27 01:27:12 EDT From: AFL Jim it's called PRINT SCREEN.CDA and can be found in the Utilties forum library under IIGS Desk Accessories. Subj: Re: TML Pascal 88-04-27 19:02:38 EDT From: Brendan Hr Just found out that ctrl-x wipes out the entire message, not just a single line. Anyway I took a look at the source for the screen Dump CDA and it is set up for the ImageWriter II. I have an RX-80 going thru a parallel printer card. Is there a CDA that can do a more GENERAL text screen dump? Subj: Re: TML Pascal 88-04-27 21:29:19 EDT From: AFL Jim Yes, Diversi-Hack which comes with Diversi-Cache and Diversi-Key (from DSR - Bill Basham) will dump with or without the mousetext. See the Diversi-Demo stuff in the utilities forum for more info. Subj: Re: TML Pascal 88-04-28 18:13:59 EDT From: Brendan Hr Ok, Thanks again! Subj: Re: TML Pascal 88-04-29 02:36:31 EDT From: Data Bandi Dont worry about it...you dont really have to understand all that much to use the toolbox refs...it's sole purpose to the tml user is to tell him what input/output parameters are exchanged, description of the function, and of course, the name...hardly perfect, but it can generally tell you about what you need to put in the program to use it. Later, Data Subj: Re: TML Pascal 88-05-01 21:40:59 EDT From: AFL Floyd Brendan, Since PRINT.SCREEN.CDA comes with the assembly source code you could get rid of all the IWII specific functions and just initialize the printer port and start sending characters; masking out the mousetext and anything else that won't work on your printer. Floyd Subj: Re: TML Pascal 88-05-03 02:34:01 EDT From: The Ronz I have been playing with programming colored windows in TML Pascal and was curious is there any way to make the content region black instead of white?! I have tried so many ways, and none work... and I want it to stay black when the screen scrolls with text in it as well. Also, in the Source Code Library theres a FontDemo program... I would like to use one of those fonts for my displays, but when I try to use a READLN and then enter my text (say a 12 pt text) and then go to backspace, it doesn't erase the characters properly... how do I tell the GS that I'm now working with a larger font, or will I have have to use a Line Edit toolbox call in order to get my input... and also, how would I print a CHR$(8) so that it works properly?!! I wrote a mini-terminal program, and when it gets a chr$(8) it does not back up one characters properly, it just sits there...... Please help with all/any of the above questions!! Thanks, Ron Subj: al 88-05-03 19:09:08 EDT From: Brendan Hr If I had an assembler I could change print screen cda, but, alas, I am stuck with only one GS specific language - TML Pascal 1.00D! Maybe I can send the source to someone who DOES have an assembler... (Joey?). Subj: Re: TML Pascal 88-05-03 19:37:21 EDT From: User797 Brendan, I'll see what I can do, and either put it up on the TCS, or send it to you here. Unless I'm mistaken, you can do it yourself with about six $EAs and Block Warden. Later.../;+/ Subj: : TML Pascal 88-05-03 21:53:08 EDT From: AFL Floyd Brendan, If you want I could alter it for you. What are the control codes necessary to turn on BOLD printing on your printer? I'll set inverse characters on the screen to BOLD and not print the mousetext at all. Floyd Subj: Re: TML Pascal 88-05-04 18:29:36 EDT From: Brendan Hr Jon Thompson altered the Bold and Underline codes to work for my RX-80, but, because I use a graphicard and not the port, I don't know how to tell it to append linefeeds every line... Subj: TML Pascal version 1.50 is here 88-06-15 18:40:27 EDT From: AFL Jim I recieved both versions (APW and Stand-alone) of TML Pascal version 1.50 today and although I haven't had time to work with either of the compilers, I thought I'd report on some of the changes mentioned in the release notes. The first changes noted are in the Apple IIGS Toolbox interfaces for TML Pascal. Three new interfaces were added, one for SANE, one for Integer Math and one for the Apple Desktop Bus. Changes were also made to the existing Toolbox interfaces to reflect changes Apple made to the tool sets. Most of these changes are either toolbox name changes or parameter changes. All interface changes are documents in the file "V1.50CHANGES" which is included on both disks. (some of the following changes were implemented in late versions of 1.00 or 1.10) Both versions (APW and Stand-alone) of the complier have a $CDA compiler directive to create Classic Desk Accessories and a $DeskAcc directive to create New Desk Accessories. The APW version has a $APW compiler option to let you create APW utilities. Both versions also support a new directive, PRODOS, to allow a direct interface to ProDOS operating system calls. The sysmbol table for units in the APW version has been expanded from 12K to 32K to prevent overflow problems. Standard Pascal "Input" and "Output" files in both versions now work with both the text and the SHR screen. A keyboard break compiler option has been added to the Stand-alone version to allow you to break out of a program and return to the editor during program execution. Another welcome addition that comes with using the keyboard break option is that it catches BRK instructions, so if your program loses it's mind and starts to execute data instead of instructions, there's a good chance of executing a break instruction which will return you to the editor with an "Unknown Error." The Stand-alone Desktop editor has had several improvements. It now uses a darker, easier to read font and the arrow keys can now be used along with the Open-Apple (command) and Option (closed-apple) keys to let you move thru a file faster. Several new printer options have been added, such as titles and page numbers, etc. Dialog boxes now let you choose buttons, in many cases, with an Apple-key. For instance, Apple-Y for the Yes button, Apple-N for the No button or Apple-C for the Cancel button. I expect I'll find more improvements after working with these compilers some. --Jim Subj: bugs in 1.50 (standalone) 88-07-02 06:26:19 EDT From: Dave Lyons I've reported the following bugs to TML: Parameters to FixRatio in IntMath unit should be INTEGERs, not LongIntegers. Code like MyHandle^^.MyField generates code that can't handle crossing a bank boundary. Big bug: If you have two procedures, each in the IMPLEMENTATION part of a unit, and the two procedures have the same name, any call to either of the procedures generates code to call ONE of them--the one that was mentioned most recently in the USES statements, apparently. This is Really Bad and gets especially confusing if the parameter lists aren't even the same on the 2 units! Subj: Autosave source 88-07-02 06:29:24 EDT From: Dave Lyons Brendan, turning on Autosave isn't going to help much if the compiler crashes during the compile--it doesn't save your source until the compile finishes! (I've never had a crash during a compile...if you have, I suspect things got fried during a previous run of your program.) Subj: Re: TML Pascal 88-07-31 15:20:20 EDT From: Brendan Hr I have as of yet sent in for an upgrade...but I did send them source code of a small plain program that kept crahing the compiler (I wan't using the original, so I made another copy, put the original away again, and it still crashed...). The program was a program that will run on ANY PASCAL compiler...oh well, I really should get the upgrade. Subj: Re: TML Pascal 88-08-01 07:54:51 EDT From: AFL Jim Brendan, How about EMailing the source for your small program to Dave Lyons and me. We might be able to shead some light on your problem. Jim Subj: A mistake not to make (fillchar) 88-08-28 04:08:27 EDT From: Dave Lyons Arggghhh! Don't you hate it when you spend large amounts of time finding a small but fatal problem? I know I do. I hate it most when it's completely my fault (I'd rather at least be able to report a bug as the result of my efforts!). Anyway, the following harmless-looking code was my problem (in TML Pascal 1.50A): fillchar(info^.DataH^,28,0); info is a pointer to a record associated with a particular window, and DataH is a Handle to some data. The intent is to fill the first 28 bytes of the memory associated with that handle with zeroes. But ACTUALLY it was zeroing 28 bytes worth of handle data, screwing things up memory management completely & forcing a reboot. It's because fillchar's first parameter is supposed to be the object AT the first address to be affected, NOT the address itself. It's sort of like the parameter was a VAR parameter, except if it was ACTUALLY a VAR parameter an EXPRESSION like mine wouldn't be acceptable. Very confusing, if you ask me. The solution is to use "fillchar(info^.DataH^^,28,0)" -- two carets instead of one, and it works like a charm. My mistake is a result of a nasty (in my opinion) of Pascal in general: the standard procedures (ones built into the LANGUAGE) have more rights than other procedures. The built-in ones can take varying number and types of parameters (like read, readln, write, and writeln, for example), and they can treat their parameters in ways no user-defined procedures can (like fillchar does). Ugh. Again, this is NOT a bug in TML Pascal--it is documented correctly, but I didn't read the docs carefully until AFTER I traced through the compiled code and found the problem the hard way. Subj: Re: TML Pascal 88-09-24 14:54:21 EDT From: The Ronz Can some help me to read in pictures or "clip-art" into TML Pascal? All I want to do is get some code that will let me load a file (xxxx) into a packed array... simple, eh? I don't have the ProDOS 16 manual so maybe thats a big downfall, but for now I don't think shelling out over $20 for this problem is worth it, I am also a weekend TML Pascal programmer....! -Ron Subj: Re: TML Pascal Graphics 88-09-24 19:02:58 EDT From: SkipS Does anyone have some examples of using TML pascal and loading pictures and shapes from paint programs such as Paintworks Gold or screen dumps? I've read all the books and still don't know how to do it. Some example code would be extremely helpful. I'm using the standalone version. Thanks for any assistance. Skip (weekend programmer) Satterlee Subj: Loading a Picture 88-09-25 01:24:27 EDT From: AFL Jim Both of your questions have answers in the Hodge Podge example program that comes with "The Programmmer's Introduction to the Apple IIGS", one of the official Apple books from Addison-Wesley Publishing Company. If you don't have this book, get it! For now, here's a snippet of code to load a picture into memory. It'll give you the idea, but you'll have to implement it into your program. {this loads a $C1/$0000 unpacked SHR graphics image into memory} Uses QDIntf, GSIntf, ProDOS16; { you'll need this in your program } Var openParams, readParams : P16ParamBlk; pictHndl : Handle; pathname : String[127]; Begin { get memory to load picture } pictHndl := NewHandle($8000, MyMemoryID, 0, Ptr(0)); if isToolError then ; {add your own error handler here, but don't continue} HLock(pictHndl); { don't let the handle get away } pathname := '/mydisk/myfile'; { should use SFGetFile instead } openParams.pathname2 := pathname; openParams.inBuffer := nil; P16Open(openParams); if isToolError then ; {add your own error handler here, but don't continue} readParams.refNum := openParams.refNum; readParams.dataBuffer := pictHndl^; readParams.requestCount := $8000; P16Read(readParams); if isToolError then ; {add your own error handler here, but don't continue} P16Close(readParams); HUnlock(pictHndl); End; If you wanted to use a packed array of characters instead of getting memory from the memory manager as was done above ($8000 is half of the memory that TML gives you for global variables, so you may have to use the $DSeg compiler directive to keep from running out of memory if you use an array), you'll need to make a few changes to the code listed above. I'd use the method above - it's easier and you can keep opening pictures as long as there's memory. But, if you insist on doing it with an array... you'll need to declare a global variable: pict : packed array [1..$8000] of character; and then use the @ operator to get a pointer to the array to put into the readParams parameter block: readParams.dataBuffer := @pict; Hope this makes sense (and works). I've got to quit doing this work late at night :) --Ji Subj: Reading raw files from TML 88-09-25 14:19:18 EDT From: Dave Lyons Oops, Jim beat me to it...my own similar code snippet follows (lifted right out of DIcEd 1.0). ---------- USES QDIntf, GSIntf, ProDOS16; {also uses Die, a procedure that calls SysFailMgr if ToolErrorNum is nonzero...yucky error handling!} ... function ReadTextFile(path: StringPtr): handle; var p, pSIZE: P16ParamBlk; myHand: handle; begin ReadTextFile := nil; WatchCur; p.pathname2 := path; P16Open(p); if ToolErrorNum<>0 then exit; { return NIL if couldn't open } pSIZE.refnum := p.refnum; P16GetEof(pSIZE); Die; myHand := NewHandle(pSIZE.eof, MyID, NoBankCross, nil); Die; HLock(myHand); p.dataBuffer := myHand^; p.requestCount := pSIZE.eof; P16Read(p); Die; HUnlock(myHand); P16Close(p); Die; ReadTextFile := MyHand; end; Subj: Handles accessed as arrays 88-09-25 14:23:22 EDT From: Dave Lyons Note that it's possible to get the best of both worlds: dynamic memory allocation (NewHandle, etc) *and* being able to use Pascal data structures to access the data. type MyArrayType = array[1..$8000] of char; MyArrayPtrType = ^MyArrayType; var MyArrayPtr: MyArrayPtrType; H: Handle; ... HLock(H); MyArrayPtr := MyArrayPtrType(H^); { and once you've done that, you can get at any bytes of the array you want with things like: } MyArrayPtr^[345] := x; z := MyArrayPtr^[123+i]; A cruder approach (but one I use a fair amount) is to cast pointers to longints and longints to pointers. (Pascal won't let you do addition or anything on a pointer.) So I have things like: type intptr = ^integer; ... xyz := intptr(longint(p)+5) Subj: Re: TML Pascal 88-09-25 21:35:35 EDT From: Don87 Is that why I'm getting weird things when I try to read the following data from a text file on disk? 'Theoct 23599 -6535 +4.5 -0.08' When I try to access data like this using for i:=1 to 6 read(datastring[counter]; read (RA); read(dec); read(mag); read(color); readln; What happens is that I get dumped into the monitor at about the 510 record. Every time! Don Mocarsk Subj: read/readln & crash? 88-09-25 23:51:19 EDT From: Dave Lyons Don, it's hard to say what's causing your crash without seeing, for example, your type and var declarations. It seems that the first 'read' in your code will read the whole line...not sure about that, tho (if the variable is a short, fixed-length string it will only read a fixed number of characters, I think--but I don't think read ever stops just because it comes to a blank when reading a string). Also, I assume you have a begin...end around that group of reads, right? Subj: Re: TML Pascal 88-09-26 11:13:31 EDT From: AFL Jim Don, If you're building the data file with a Pascal program, why not use these declarations: type dataRec = record datastring : string[6]; {assuming string length 6} {I'm assuming the data types for RA and dec} RA : integer; dec : integer; mag : real; color : real; end; { of dataRec } var dataFile : file of dataRec; theRec : dataRec; Then you could use (after opening dataFile, of course)... read(dataFile, theRec); or... write(dataFile, theRec); ...instead of all of those separate reads or writes. To access the data within theRec, you could use either theRec.dataString, theRec.RA, theRec.dec, theRec.mag and theRec.color, OR use the "with theRec do" statement to get to the data with dataString, RA, dec, mag, color. Subj: Re: TML Pascal 88-09-26 21:56:36 EDT From: Don87 Dave, The variable declarations look like this ... var DiskFile:text; counter,RA,dec:integer; mag,color:real; Name:array[1..6] of char; Next I read the diskfile like this ... reset(DiskFile,'/pascal.progs/stars.dat'); while not eof(Diskfile) do begin for counter:=1 to 6 do read(Diskfile,name[counter]); read(diskfile,RA); read(diskfile,dec); read(diskfile,mag); read(diskfile,color); end; Actually I solved the problem by loading the whole record as a string of characters and then disecting it into the appropriate fields. That seems a bit convoluted however. I'd just like to know why it bombs when I use the method above. Thanks D Subj: Re: TML Pascal 88-09-26 22:06:27 EDT From: Don87 Jim, Thanks for your suggestion. I have been experimenting with the data in a linked list of records just like that with the addition of a pointer variable at the end of the record. Do you know if I can create a typed file that can be loaded pointers and all? The program I'm fooling with here will have to use the data to plot and update star positions on the screen. Speed is very important so I'll need all the data in memory and a linked list is the only way I "know" how to do it. Also will the type of file that you suggested have to be a typed file? Thanks Don Subj: Re: TML Pascal 88-09-26 22:13:39 EDT From: Don87 Dave, I just noticed that I didn't include the begin in the previous while loop. It's really there. Honest! Don Subj: readln & crash 88-09-26 23:43:57 EDT From: Dave Lyons Well, I'll try your code and see if it crashes for me, too. (The last 'read' should be 'readln', right?) No, you can't accomplish anything useful by saving pointers to disk, because you have no way to get the same memory allocated when you read the file back in! Most likely the pointers will point at things now being used for other purposes. If you're going to read/write *records* from/to your file as Jim suggested, then you'd declare it as: var DiskFile: FILE OF MyRecordType; (Of course, then you need a separate program to create the file, since it's no longer a plain text file...the numbers won't be in readable form any more.) Subj: Re: TML Pascal 88-09-27 00:21:40 EDT From: AFL Jim As Dave just said, you can't save the pointers and then reload them. You'd have to use the NEW statement, read the record and then rebuild the linked list everytime. If you want to keep your data in a text file, then you'll have to use code similar to what you already have. TML Pascal stores records in a file of records just as they are stored in memory. See the appendix, "Inside TML Pascal" in your TML Pascal manual for the data representations of each data type in memory. You might want to reread the "Standard Procedure and Functions for Textfiles" section of the "Input/Output" chapter of TMLs manual for the rules that TML Pascal uses when reading the different data types from a text file. That's on page 151 of the stand-alone version's manual and page 59 of the APW version's manual. Subj: Re: TML Pascal 88-09-27 19:59:42 EDT From: Don87 Dave, Yes it should be a readln. Also ... it works great until the 510th record. That's the part I don't understand. I rearranged the text file so I know it's not a bad piece of data at that location. It seems that TML just doesn't like my data past 510. Thanks I will rewrite the file as a file of records. Here's another one for you (if you don't mind). It seems as if TML takes an awfully long time to create a linked list. When I just load my 1573 records from the file it takes about 40 seconds. When I load them inot a linked list it takes about 5 minutes! Do you have any thoughts about speeding up the process? Thanks again. Don Subj: Re: TML Pascal 88-09-27 20:06:07 EDT From: Don87 Thanks Jim. When in doubt I guess I should read the manual. I really appreciate your replies. After I figure out exactly how I'm going to load and handle the data I'm going to have a ton of questions about the toolbox routines. Actually I've constructed a sort of desktop template with the pulldown menus and the whole shot. It was sort of like filling in the blanks. I'm getting there ... slowly ... but I'm having fun. Thanks again. Don Subj: NEW slowness / read crashing 88-09-27 23:54:51 EDT From: Dave Lyons Well, having over 1500 separate blocks of memory allocated with New is probably going to slow down memory manager operations quite a bit (New *does* always allocate a new handle, doesn't it?). I don't know if most of your 5 minutes is being taken up by the actual memory allocation or if it's just taking long enough that you miss the next block as it spins by & cuts down your disk-read efficiency a lot. Possible strategy: Make a fixed-size array of, say, 100 records, and read 100 records at a time from disk; then add those 100 to the end of your linked list & repeat. Or you could go down to the ProDOS call level and allocate a single memoyr block of the size you need with NewHandle, and then come up with a POINTER to the array type you need and assign it the address of the allocated block (which would be FIXED, of course). This second approach would require a lot of GS-specific stuff & understanding of the memory manager. By the way, I took the code snippet from a few messages back and managed to get something that eventually crashed after filling the stack with a repeating 8-byte pattern! The thing crashed after it filled up all of its stack space and started trashing important things in bank 0. The 8-byte pattern consisted of (apparently) a 3-byte RTL address into a routine that was part of the 'read' in TML's library, a 4-byte pointer to a data buffer, and the value $B5. I don't know what was causing it. I suppose I should have been checking IOResult after those reads, but the thing SHOULD have stopped since it was in a WHILE NOT EOF(DiskFile) loop. My current hypothesis is that read can sometimes leave garbage on the stack, possibly when exiting due to an abnormal condition. Subj: Re: TML Pascal - Loading Picture 88-09-28 00:53:30 EDT From: SkipS Thanks Jim and Dave for your help. It looks like it should work, hopefully I'll have an interesting program to upload to Applelink soon. Thanks :) Subj: Addendum to a previous answer 88-09-28 13:29:46 EDT From: AFL Jim Skip, You'll want to dispose of the handle to the $8000 memory block when you don't need the picture anymore. $8000 is a lot of memory to tie up. Jim Subj: Re: TML Pascal 88-09-28 21:58:58 EDT From: Don87 Dave, I think that I'll have to do a little more studying. I was wondering about the NewHandle and how to allocate a block of memory for my data. I'll have to fool around with that a little. I'm eventually going to get a desktop type program out of all this anyway so I have to learn the GS specific stuff anyway. Thanks for your suggestions. I'll try them out as soon as I can (weekend programming student here). Also I'm glad that you found the read to crash. I though I was going nuts for a while there. Thanks again Don Subj: Re: TML Pascal & Modem Port 88-09-28 23:08:05 EDT From: ESeasholtz Does anyone have any way to access the GS modem port from within TML Pascal? A couple of people have mentioned things about it... I could really use some help if you've been able to do it! Subj: Re: TML Pascal 88-09-29 21:56:15 EDT From: AFL Jim One way to access it is thru the TextTools toolbox routines. But if you're writing telecommunications software, you'll probably need to access the serial port thru its firmware rountines (see the Apple IIGS Firmware Reference for details). Using those routines will take some assembly language routines that must be linked to your Pascal program and that means you'll need the APW version of TML Pascal and either the APW or ORCA programming environments. With GS/OS, I hope we'll see some powerful device drivers written for the IIGS serail ports, but that's the future for now... Subj: Re: TML Pascal.help 88-10-05 06:20:50 EDT From: Data Bandi I could really use some information or simple applications/demos of the use of different fonts, and creation of fonts using the tml pascal environment, as well as sound demos...the demos and samples I have are reasonably complete in most respects(the disk sent out from TML), but it's lacking in these respects and the toolbox ref is a little hard to swallow...its like they TRIED to make it incomprehensible...just so people wouldnt deal with the gs...oh well, give them credit for putting out anything at all...not many people have... LaterOn, Dave I could really use the information...thanks Subj: using different fonts 88-10-06 03:37:16 EDT From: Dave Lyons Using an existing font of your choice is not too hard--make sure your program is loading and starting the Font Manager appropriately (that should be covered in a sample program you have) and then use InstallFont to set up the font of your choice in the current port. The trick is building the Font ID--it contains a font family number and a size and maybe something else I'm forgetting. It's all documented in the toolbox ref once you know exactly what you're looking for! (The books aren't too bad *after* you know something...you can go back and read it again and say, "Oh! They *did* say that, and now that I know it, it makes sense!" Reference books rather than tutorials. You may want to look at the two GS books by Morgan Davis and Dan Gookin from COMPUTE! books and see if they are for you.) Subj: Re: TML Pascal 88-10-08 21:20:26 EDT From: Don87 Dave and Jim, Just so you don't think that all of your suggestions have gone to naught here is a program that loads all my 1573 records into memory in just under 20 seconds! Program ReadBlock; Type NameType = array[1..6] of char; StarRec = Record name:nametype; RA:integer; dec:integer; mag:real; color:real; end; BlockPntr = ^RecordBlock; RecordBlock = Record Recs:array[1..200] of StarRec; NextBlock:BlockPntr; end; var Head:BlockPntr; Star:StarRec; Procedure GetFiles; var index,blkcount,limit:integer; DataFile:File of StarRec; Disk:string[25]; Block:BlockPntr; begin {GetFiles} Disk:='/astro.progs/stardat'; reset(DataFile,Disk); new(head); head^.nextblock:=nil; block:=head; for blkcount:=1 to 8 do begin {load 8 blocks} case blkcount of 1,2,3,4,5,6,7:limit:=200; 8:limit:=173; end; {case} for index:=1 to limit do begin {load a block} read(Datafile,Star); block^.recs[index]:=star; end; {load a block} new(block^.nextblock); block:=block^.nextblock; block^.nextblock:=nil; end; {load 8 blocks} end; {GetFiles} BEGIN GetFiles; END. If you have any suggestions I'd be glad to hear them. I still don't fully understand pointers that well so I may still be able to make the code a little more efficient. At first I thought the assignment 'block:=head' was an accident ... now I think it's descriptive!! HeHe. Thanks Thanks Thanks!!!! Don Mocarski Subj: Re: TML Pascal 88-10-08 23:45:19 EDT From: AFL Jim It looks like you have the hang of it, Don. The only minor improvement I'll suggest would be changing: read(DataFile,Star); block^.recs[index]:=star; to: read(DataFile,block^.recs[index]); That'll save you one line. --Jim Subj: Re: Sound on the GS!!! 88-10-09 03:24:55 EDT From: Paladin13 From: Paladin13 To: Anyone who can help! Problem is: I can load sound data in a specified array and play it once or play it continuously depending on wether or not I use (nil) as a value for NextWave...(This steps through the sound only once (but only if the Wavesize value is correct)) or if I give it a @Soundkeep value which is just a pointer to the array I filled using the P16 file commands to load it in (Soundkeep) array. This will play the sound continueously. BUT>>>>> How can I get it to play over and over and stop when I want user input. Like in a repeat Until loop with the until being user input. And each time it goes through the loop it plays the Waveform and then stops to see if you would like to hear it again. If you type yes or 'Y' then it plays it again. When I do this once it plays it once and then it does nothing (When NextWave is set to nil). Almost like it lost the data or values. I have even called up the entire load routine and everything a second time and still haven't got anything and I certainly don't want to do file I/O every time I play a waveform. And yes I do have a second array set up so I can save the values in one and move them into another and I index them bye value and not by referrence. Now I know an Interrupt is generated every time the DOC stops but what bearing would the Set SoundMIRQV and SetUserSoundIRQV routines have to do with that. I am really swimming in this one and would appreciate response if possible. Subj: Re: Loading Graphics in TML 88-10-09 03:47:28 EDT From: Paladin13 I can use the P16 commands and have no problem getting the file in the problem is getting the correct color corrolation in the picture. I'm trying to load a specified brush defined in Deluxe Paint II and I'm getting a garbage pixel image. The resolution isn't right I know I saved the picture in 320x200 and I'm in the 640x200 mode so that's going to have a serious affect but 1. I changed the ScreenMode to $00 and MaxX to 320; this did nothing???!!! 2. What does the number 160 stand for under screenmode when QDStarUp is activated and does 320 mode have a different value? 3. I'm using parts of the TML Source code in their micropaint example to load the pictures but do their screen mapping calculations apply to a small brush about 1/4 the screen? 4. If a picture could be loaded in the same shape as what I saved and with the same pallete (320x200). If one could just explain how to load a brush from deluxe paint II into a window or anything it would be extremely apreciated. Subj: Re: TML Pascal 88-10-09 20:38:10 EDT From: AFL Jim Paladin, I'll have to look into the sound question (I haven't had time to do much except very simple stuff with the Sound Manager). 1) Apple IIGS Technical note #4 (available for download) gives lots of information about switching graphics modes in mid-application. 2) ScreenMode in the QDStartup call is really the Master SCB (scan line control byte) for the graphics mode you select. See page 16-34 in the IIGS Toolbox reference for the format of the SCB. A value of 160 ($A0) would give you 640 mode with fill mode on. 3 and 4) I don't have Deluxe Paint II, so I'm not sure what format their files are saved in. Apple IIGS Technical #27 gives the IIGS graphics image file formats supported by Apple. Maybe that will help. Jim Subj: Re: TML Pascal 88-10-09 22:05:25 EDT From: Don87 Jim, Will do. Thanks Don Subj: QDStartUp--MaxWidth 88-10-09 22:57:59 EDT From: Dave Lyons Paladin, Jim gave you a good description of the 2nd parameter to QDStartup, the MasterSCB value, but I bet you were asking about the 3rd one, which gives the maximum width in bytes of any object QuickDraw will be asked to deal with. Since the screen is (these days anyway) always 160 bytes wide, 160 is fine for either 320 or 640 mode (640 mode has twice as many pixels per line, but each one takes only half as many bits...4 of them fit into a byte instead of two, so it balances out). You can just use 0 for that parameter, and QuickDraw will interpret that as the screen width. Subj: Re: TML Pascal 88-10-13 23:40:13 EDT From: SkipS I just upgraded to GS/OS and now I can't get TML Pascal to print a listing properly. It prints about 1 1/3 pages and then prints garbage for a few lines and stops. The editor comes back as though it's done. This is ver 1.5 standalone with an ImageWriter II. The printer works normally otherwise. Is this a compatiblity problem with GS/OS and TML? Anyone else have this problem? Also, were is ACU on AppleLink? Thanks, Skip Subj: Re: TML Pascal 88-10-14 00:31:34 EDT From: AFL Jim My wife would KILL me if I started printing this late, so I'll try it tomorrow :) ACU will be here VSN (very soon now). Jim Subj: Re: TML Pascal 88-10-15 19:53:17 EDT From: AFL Grafix Forwarded from the AGR (Apple II Art and Graphics SIF): From: Pndxtr Msgs: 1 (88-10-15) I'm hoping for help saving SHR graphics in non-screen format. The TML sample program shows how to use screen format files, and works quite well. Unfortunately, I haven't been able to find any way to use non-screen formats. I know that PackBytes and UnPackBytes are supposed to crunch picture files, but I can't translate the rather meager documentation of ML code in the Reference manuals to TML Pascal, which is the language that I use. Can anyone help with this kind of problem? Subj: Re: TML Pascal 88-10-16 16:28:04 EDT From: AFL Jim Marian, The same question was asked in the IIGS Toolbox category and I pointed the direction to IIGS Technote #27 which give the file formats for most IIGS graphics files. Jim Subj: Re: TML Pascal 88-10-16 20:00:10 EDT From: Don87 Skip, I had TML do the same thing. I don't think that it's GSOS but rather the printer settings that you use for applelink here. When I reset my printer options in the control panel to my normal settings everything worked fine. Don Mocarski Subj: Re: TML Pascal 88-10-17 01:05:33 EDT From: SkipS Thanks Don (while I slap myself upside the head), I had installed GSOS about the same time I started using Apple- Link. I forgot that I had changed the printer settings. But, while I'm on the subject, I never could get the TML listings to come out properly even though I used their dialog boxes to set up page numbering, titles and I setup for 66 lines on continuous paper. None of that stuff seems to have any effect. This is not a big deal, but I wonder if I'm doing something else dumb. Well at least it prints the whole document now. Thanks :} Subj: Re: Question : DISK???!!! 88-10-17 18:58:47 EDT From: Paladin13 How do you get the disk drive to automatically eject a disk through TML Pascal? Could someone leave a small simple program either here or in my mailbox? Thanks! Paladin13 Subj: Re: TML Pascal 88-10-17 21:03:19 EDT From: Don87 Skip, Believe me ... I know how you feel!!! I've never been able to get really good printouts either. It seems to page where it wants to no matter what you do. I haven't spent a great deal of time with it and it's not too annoying so I leave well enough alone. Don Mocarski Subj: Ejecting disks from TML (GS/OS) 88-10-17 21:21:56 EDT From: Dave Lyons program EjectTest(input, output); { Sloppy demo of how to use the GS/OS DControl call to eject everything in sight in TML Pascal. You need System Disk 4.0 (or later, for the benefit of you future readers) to get this program to do anything useful. --Dave Lyons 10/17/88 } uses QDIntf; { for Ptr type } type DControlRec = record pCount, devNum, controlCode: integer; controlList: ptr; requestCount, transferCount: longint; end; var x: integer; procedure DControl(var p: DControlRec); ProDOS $202E; procedure EjectDevice(dev: integer); var d: DControlRec; begin with d do begin pCount := 5; devNum := dev; controlCode := 2; { eject } requestCount := 0; end; DControl(d); { check ToolErrorNum here if you want } end; begin { main } for x := 1 to 50 do EjectDevice(x); end. Subj: To Dave Lyons & Graphic Buffs 88-10-18 21:16:24 EDT From: Paladin13 Thanks Dave for the code on edjecting the disks I'll try it. You're one of the first people I've talked to that have given me a straight answer and some code to boot!!! again thanks. I got one more question and it's really indepth. Have you ever had a problem with loading Deluxe Paint II brushes? I can't for the life of me get TML to load and display them. I have used the standard file i/o routines but what gets loaded and displayed does not even slightly resemble what has been saved. I talked to the D Paint II representitives and got as far as a Graphics File Format sheet that they promptly sent in the mail but I can't make heads or tails of it and how it relates to the standard file routines in the GS toolbox. Here is the document maybe you or someone else can make heads or tails of it and how this could help in solving the mystery of loading brushes from Deluxe Paint II. PRODOS FILETYPE: $C0 AuxType: $0002 APPLE Prefered standard interface format. (Thsi is what we recommend all developers to use- and be able to support). The file is composed of a series of blocks. Each block has the same format: Length Longint (includes the size of longint too) Kind string with length byte (This string is case Sensitive- upper case is recommended to avoid confusion) Block Specified Data Variable amount of data Below we define some standard blocks that most applications will want to put in the file. Other blocks can be defined by individual applications. Using this scheme, the format is extensible. Applications with differing needs can store everything they need about a document in a file, in a way that will allow other applications to ignore the information it cannot deal with. The predefined blocks are MAIN, PATS, and SCIB. The MAIN block should be in every file of this format and every application which supports this format should be able to read a MAIN info block. The PATS block contains patterns which may be associated with the picture. The SCIB block contains information relating to the current drawing pattern for the "document." These are used by paint programs that want to save the foreground pattern, a background pattern and a frame pattern with the image. The MAIN info block SizeOfBlock Longint IDString str'MAIN' MasterMode ModeWord (This comes from QuickDraw's MasterSCB) PixelsPerScanLine integer (Must not be zero) NumPallets integer (May be zero) PalletArray [0..NumPallets-1] of Palletinteger (Must not be zero) ScanLineDirectory [0..NumScanLines-1] of DirEntry PackedScanlines [0..NumScanLines-1] of PackedData The PATS info block SizeOfBlock Longint IDString Str'PATS' NumPats integer PatternArray [0..NumPats-1] of PatternData The SCIB info block: SizeOfBlock LongInt IDString Str'SCIB' Foreground Pattern PatternData Background Pattern PatternData Frame Pattern PatternData Dated : February 18,1987 Whew! Thats it! I have a feeling that The SCIB info block is the info block concerning the D Paint II brushes but I can't really understand how all this data translates to TML Pascal? I have left a message at the D Paint II forum too but so far to no avail. If you or anyone reading this could help this would be GREATLY appreciated......This one's IMPORTANT! Paladin1 Subj: loading Apple-preferred pictures 88-10-19 00:28:51 EDT From: Dave Lyons Loading an Apple-preferred-format picture file (or parts of it) isn't a very simple thing to do. One of these days, someone should write some nice, easy-to-read and easy-to-use subroutines to deal with them, and put them in the public domain. If anybody has *already* done that, be sure to tell me, because I'll probably do it some day. The Standard File routines will let you get pathnames from the user, but they won't help you with the actual I/O, unfortunately. You'll probably want to use the ProDOS routines in the TML unit ProDOS16, which isn't trivial either if you haven't done a lot of ProDOS calls before. From there you'll want to build a routine to read in a given number of bytes, and then use the file format specs to write a routine that reads the name of the next block in the file; then you could call a routine to skip to the next block or go ahead and process the data in that block. --Dave L Subj: Re: TML & The modem port 88-10-20 23:46:13 EDT From: ESeasholtz I'm still looking for a way to run the modem ports through TML Pascal... Anyone, anywhere, have you been able to interface the modem port through TML? Dave, you and The Ronz were talking about it awhile back. Any success? I could REALLY use the help! Even if you haven't had any success, have you come close? And how??? Any info would be GREATLY appreciated! Ed Subj: Re: TML Pascal 88-11-01 03:12:32 EDT From: The Ronz I have uploaded a program and its source code to the Software Library that demonstrates how to access TextTools and the ModemPort... its a "cheap" terminal program... so I called it CheapTerm... If any of you can make it so that it does not lose characters when it first connects please let me know. Also be sure to call a GBBS-type BBS system to test it out, it sometimes doesn't like mainframe character output...(high bits weird) Thanks to Dave Lyons for his help with this program... My programming adventures will include: (1) Sound Manager.. I want to load and play a digitized sound file... I've sent mail to Paladin for the basics... (load and play)... but I have a more advanced question for YOU TML Pascal hackers (!)... the GetTableAddress call returns a TML Pascal ProcPtr... what can I do with this???? I need to (1) load X with the value of the register I want to change, and (2) load the low byte of the accumulator with the value I want written to it... ALSO.... index registers=16 bit mode, and the accumulator must be in 8 bit mode when the call is made.... SO HOW CAN I DO THIS KIND OF THING WITH TML PASCAL?!? Inline it?? And why do I want to access the low-level routines? Well, I sort of wanted the sound to come out in stereo instead of mono, I have 2 speakers and might as well make good use of them! If someone can help me please don't hesitate! Also I still want to do some loading of Super-hires pictures, and displaying of them, via TML-Pascal... If someone has a semi-completed program they can send me in mail I'd appreciate it very much... I guess thats all for now, I'll be looking forward to your responses!! -Ron Subj: Re: TML Pascal 88-11-01 22:51:23 EDT From: AFL Jim Ron, You might want to get the APW version of TML Pascal if you're going to start using ML subroutines. It makes it much easier to just link the ML routines in and use the assembler to write them. ORCA/M for the IIGS will give you the same capabilities as APW. Jim Subj: Re: TML Pascal 88-11-08 01:36:02 EDT From: The Ronz Thats nice but I'd like to stay within the bounds of TML Pascal if at all possible... so if anyone knows how to make TML Pascal switch channels (true stereo output) through its ProcPtrs be sure to let me know.... Also I have been experimenting with trying to get some fonts into a window, I was successful in getting the FontManager and its related toosets loaded, and going... here's what happened: I got the selected font to load, and display plain, or bold. But I could not get it to go into outline mode, or shadow mode... I could not get it to display this way. It would come out in plain mode, at the requested size. I know Hodge Podge did it, and I used some of its code to allow me to select the font, etc, but I don't understand why it can get the shadow modes to work in its windows, and I can't. The code for Hodge Podge's windows is sort of confusing. If there is some kind of code I need to set for my window to be able to display the font properly, I'd like to know that secret as well.... Thanks, Ron Subj: SetTextFace--fonts 88-11-08 03:47:13 EDT From: Dave Lyons I don't think there's a secret here--are you using SetTextFace with appropriate values to get the effects you want? (Or are you using ChooseFont? If so, any chosen effects should be there automatically, unless you have an unintended SetTextFace(0) or something.) --Dave Lyons Subj: font styles & QuickDraw Aux 88-11-08 03:48:46 EDT From: Dave Lyons Oops! Just thought of something. Things like outlining and shadow aren't available in regular QuickDraw--you need to load and start the QuickDraw Auxiliary toolset before they become available. (No other special handling is needed; QD Aux installs hooks into QuickDraw for you.) Subj: Re: TML Pascal 88-11-08 22:17:25 EDT From: AFL Jim There's something else that might be keeping you from displaying text in some formats - Some fonts don't allow all text styles (the SYSTEM font is one of these). Try another font and see what happens. Jim Subj: font styles 88-11-09 01:47:22 EDT From: Dave Lyons Yes, underlining is one I know of--a font needs to have a "descent" of at least two before it can be underlined, and the ROM font (the default System Font at present) has a smaller descent than that. Are there any other restrictions? Subj: Re: TML Pascal & SFGETFILE 88-11-10 23:25:05 EDT From: Wrist An application that calls SFGETFILE and SFPUTFILE runs ok under system 3.1, as supplied on the TML Pascal 1.50 disk. If TML 1.50 is run under 3.2 (or GS/OS), those calls fail: They NOP. It is curious that TML Pascal itself makes these calls and works ok under 3.2 and GS/OS. Any suggestions? Subj: Re: TML Pascal 88-11-11 01:53:28 EDT From: AFL Jim I just tried the Standard File routines - they work fine for me. Want to give us a code sample that shows how you made the call? Jim Subj: Re: TML Pascal 88-11-11 03:26:54 EDT From: Dave Lyons Wrist, I've written & used programs making standard file calls under GS/OS w/ no problem. Are you checking ToolErrorNum after the call to see if an error was reported? That might shed some light on the problem. --Dave Lyons Subj: Re: TML Pascal 88-11-14 03:03:23 EDT From: The Ronz Ok, I'll try your suggestion about the fonts, I'm sure its probably that darn old QDAux toolset wasn't loaded!! :) I'll let you know how it comes out... -Ron Subj: Re: TML Pascal-general books 88-11-17 22:21:51 EDT From: Howard12 Since it seems there are no specific books concerning pascal on the GS, could someone recommend a general book which is compatiable with tml or orcal pascal. thank you... Subj: General Pascal Books 88-11-18 00:20:37 EDT From: AFL Jim The most recommended books seem to be "Oh! Pascal!" by Doug Cooper and Michael Clancy, and "Standard Pascal User Reference Manual" by Doug Cooper. Both books are published by W.W. Norton & Company, New York, NY Subj: Re: TML Pascal 88-11-18 11:19:59 EDT From: MikeW50 Be careful, though. While both books work fine with ORCA/Pascal, which fully implements standard Pascal, there are many subtle and not-so-subtle differences between Standard Pascal (which the books use) and TML Pascal. And the TML Pascal manual doesn't even come close to listing all of them. Mike Westerfield Subj: SFGetfile-----Possible!??? 88-12-21 01:09:17 EDT From: Paladin13 This one is a little wierd... I want to display all text files BUT>>>I don't want to display any folders. I wouldn't even mind displaying the folders but I don't want the user being able to select them.. My routine works fine and displays only $04 TXT files but it also displays the folders. Is it possible to FILTER out the Folders and if so How? Paladin13 Subj: no FOLDERS in SFGetFile 88-12-21 06:11:51 EDT From: Dave Lyons No, as far as I know Standard File provides no way to leave Folders out of the list. They are always listed and selectable. (Otherwise it wouldn't be "standard"!) What would you want it to do exactly? Not allow Close or Disk to be clicked either? You want to choose a file out of a particular directory, right? Well...looks like it may be time to use the List Manager! Not a simple thing, but it's the right way _if_ forcing a choice out of a particular directory is definitely the right thing for your application. --Dave Subj: Re: TML Pascal 88-12-30 01:07:24 EDT From: ROBIT Jim, I still have a problem with pointer variables. I used the code type Byte= packed array [0..0] of 0..255; var point:^byte; begin pnt:= Pointer(E1C0E9); write(pnt^); This turns on the 5.25 drive motor. However, I don't believe that pnt^ is accessing only one byte location because pnt:=Pointer(E1C0E8); will not turn off the drive. I have to use E1C0E7 so that the drive goes off. I am messing up? Any help is appreciated. Thanks Rob.. Subj: accessing individual bytes 88-12-30 01:40:39 EDT From: Dave Lyons Rob, it does sound like you're getting a 2-byte load there...have you tried just using ^char instead of a pointer to a packed array of 0..255? (Why do you need to turn the 5.25 motor on directly anyway? Sounds pretty scary to me...GS/OS doesn't support direct access to device hardware. If you start reading & writing stuff directly, you'll be bypassing the Cache and risking destroying your volumes!) --Dave Lyons Subj: Peek and Poke from TML Pascal 88-12-30 14:16:36 EDT From: AFL Jim I experimented with TML Pascal this morning and found that it *always* reads with the accumulator in 16 bit mode and then throws away the high byte if your program is only interested in the low byte. Writes can be done either in 16 or 8 bit mode. Here's a Peek function and a Poke procedure with the appropriate warnings in their remarks. --Jim function peek(address : longInt) : integer; { This function returns the value of the byte at ADDRESS. } { } { WARNING: Although this function returns only the value of } { the byte at ADDRESS, this function reads both memory } { locations ADDRESS *and* ADDRESS+1. TML Pascal uses an } { accumulator size of sixteen bits to read memory and then } { ANDs the value with $00FF. This may cause problems when } { this function is used and ADDRESS+1 is a softswitch. } type byteType = packed array [1..1] of 0..255; var bytePntr : ^byteType; begin { peek } bytePntr := pointer(address); peek := bytePntr^[1]; end; { peek } procedure poke(address : longInt; value : integer); { This procedure stores the low byte of VALUE (in the range } { of 0..255) at memory location ADDRESS. TML PASCAL uses an } { accumlator size of eight bits for this operation, so only } { memory location ADDRESS is effected. } type byteType = packed array [1..1] of 0..255; var bytePntr : ^byteType; begin { poke } BytePntr := Pointer(Address); BytePntr^[1] := Value; end; { poke Subj: Re: Peek & Poke 88-12-30 17:22:20 EDT From: AFL Jim BTW: ORCA Pascal supports a predefined subrange of integer, named byte, in the range of 0..255. This removes a couple of lines from the Peek and Poke in the previous message. ORCA Pascal reads the byte data type with the accumulator in 16 bit mode, just about like TML, so you still have to be careful when reading memory in the softswitch areas of memory. --Jim Subj: Re: How do you open a GrafPort? 88-12-30 18:13:36 EDT From: SkySinger Does anyone know where I might find sample code for opening up a GrafPort that isn't a window (TML Pascal or something close)? Subj: Re: TML Pascal 88-12-30 21:32:18 EDT From: ROBIT Thanks for the help. I will try these as soon as I get off of Alink. I'm not really wanting to write directly to the 5.25 drive I was just using it to help me with the single byte problem. I teach assembly language on a college level and this is my first high level language. I'm just trying to get a feel of these var types and what I will be able to do with this system. Sort of checking out all of the accessorys on my new vehicle. Thanks again...Rob Subj: offscreen graphport example 89-01-02 02:35:11 EDT From: Dave Lyons SkySinger, here's an example of how to use an off-screen graphport in TML Pascal. This is a procedure straight out of DIcEd 1.1.1; I hereby place the code in this message in the public domain. Be sure to ask if this example is not completely self-explanatory! _Guessing_ at why things are done the way they are done is a good way to get code that seems to work but turns out to be buggy later. procedure CopyIcon(iconH: handle); var PicH: PicHandle; r: rect; w, ht: integer; pixmap: ptr; oldPort: GrafPtr; tempStr: String[20]; MyLocInfo: LocInfoRec; ppInfo: PaintParamBlk; tempPort: GrafPort; begin ZeroScrap; PutScrap(GetHandleSize(iconH),iconDataScrap,iconH^); { Put a PICT version on the clipboard, too! } icGetIconDims(icGetIconFromData(iconH,currSize),w,ht); SetRect(r,0,0,w*2,ht); oldPort := GetPort; OpenPort(@tempPort); SetPort(@tempPort); with MyLocInfo do begin Width := 88; pixmap := NewHandle(MyID,4400,$C000+NoBankCross,nil)^; PixelImage := pixmap; PortSCB := $80; SetRect(BoundsRect,0,0,88*4,50); end; SetPortLoc(MyLocInfo); SetSolidPenPat(3); PaintRect(BigRect); DrawIcon(icGetIconFromData(iconH,isLarge),0,0,0); PicH := OpenPicture(r); with ppInfo do begin SrcLoc := @MyLocInfo; DstLoc := @MyLocInfo; SrcRect := @r; DstRect := @r; Mode := 0; ClipRgn := GetClipHandle; end; PaintPixels(ppInfo); ClosePicture; PutScrap(GetHandleSize(handle(PicH)),1{pict},ptr(PicH^)); KillPicture(PicH); DisposeHandle(FindHandle(pixmap)); ClosePort(@tempPort); SetPort(oldPort); end; Subj: Using Alerts 89-01-04 03:58:47 EDT From: Chad P1 Can anyone show me how to open a caution alert window using TML Pascal. I thought it would be similar to a modal dialog, but it isn't. I know you have to create a template, but I dont know what the varitable types, or format would be. Any help would be greatly appreated.(I hope spelling doesn't count) Chad Parker Subj: using AlertWindow 89-01-05 21:12:46 EDT From: Dave Lyons Chad, I don't have an example of an alert real handy, but I can dig one up if the following doesn't do what you need. There's a tool called AlertWindow on system disks 3.2 and later that is really easy to use. For example, here's the code for the little dialog you get when quitting DIcEd: QuitStr := '23/Do you really want to quit DIcEd?/^Quit/Resume\0'; if AlertWindow(1,nil,@QuitStr[1])=0 then ... If AlertWindow isn't already in your GSIntf unit, declare it something like this in your program: function AlertWindow(f: integer; sub, str: univ ptr): integer; tool 14,$59; The documentation for AlertWindow is in the Toolbox Reference Update available from APDA. Briefly, you can model after the above; the "^" in front of a button name makes that button the default. The first character of the string specifies the size of the window (use 1-9 for standard sizes), and the second character specifies the icon to use: 0=none, 2=stop, 3=note, 4=caution, 5=disk, 6=disk swap. Anywhere you want one of the following strings, you can abbreviate it: "#0" for "OK" "#1" for "Cancel" "#2" for "Yes" "#3" for "No" (not much of an abbreviation, is it?) "#4" for "Try Again" "#5" for "Quit" "#6" for "Continue" I haven't described all the features of AlertWindow here. --Dave Lyon Subj: The ol' text in window Trick! 89-01-09 19:55:51 EDT From: Paladin13 I am embarrassed to even ask this one but I spent almost 3 hours on this and got no where. I need a 'fast' routine to grab a regular text file and display it in a window that allows you to scroll up and down... Pretty simple huh? I have a routine but it works SLLLLLOOOOOOOOWWWWW! could you help thanks! Paladin13 Subj: scrolling text in a window 89-01-09 21:16:19 EDT From: Dave Lyons It's not a trivial task! You can just use LETextBox to draw the text, but it's _extremely_ slow if you have very much text (LETextBox wasn't designed to handle large amounts of text). In DIcEd (1.1 and later), I do "View Text File" by reading the whole file into memory and then computing an array of offsets into the text, where the Nth offset locates the start of the (10*N)th line of text. To update the window, I think I do a GetContentOrigin on my port, divide by the line height for the font being used, and round down to the previous 10-line chunk. Then it's easy to get the port height and figure out how many lines you need to draw (using MoveTo and DrawText). In DIcEd, I just count carriage returns to find the 10-line offsets; you could do something more complicated to allow the text to wrap. --Dave Lyons Subj: Printing... 89-01-10 19:33:46 EDT From: Paladin13 Thanks Dave I'll give it a shot... Also I meant to follow up on that SFGetfile the one about not being able to look at anything but TXT files... I don't want the user to be able to choose.... the Disk or the Close Options I just want them to see the text and thats it I have Isolated the text files under a particular folder and can get there easily but they can get out of there and I don't want them being able to do that ( At least through the program ) You mentioned the List Manager??? Paladin13 Subj: Re: offscreen GrafPort example 89-01-11 00:34:07 EDT From: SkySinger Dave, Thanks for the example. I modified it for my purposes and it worked fine. Maybe you can clarify one thing though about Handles. You use NewHandle to assign a value to pixmap, which is a ptr. I hear that a handle is a pointer to a pointer. How then can a NewHandle be assigned to a pointer that is just a pointer to a Byte? Subj: handles and pointers 89-01-11 00:56:03 EDT From: Dave Lyons SkySinger, good question re: handles and pointers. Two steps: make sure the block is Locked (or, alternatively, "fixed") and then "follow" the handle once to get the pointer to the block. In Pascal this looks something like this: var h: handle; p: ptr; ... p := h^; H^ refers to whatever H points to. Subj: offscreen bitmap example 89-01-11 01:00:04 EDT From: Dave Lyons Oh, I looked back at my example, and it's a little obscure. I actually put the "^" after the NewHandle call, which is perfectly okay, but pretty easy to miss when reading the code. p := NewHandle(length,id,fixed,nil)^; allocates a new memory block that can never move (since it's fixed) and assigned a pointer to it to p. Subj: Re: Using Alert Window 89-01-12 20:21:23 EDT From: Noelle 16 Thanks Dave. I will give it a try, and see if it works. Chad Parker. Subj: Re: Loading and Saving Files 89-01-12 20:28:08 EDT From: AFC Mark I've been working on a problem for several days now, and it has me stumped. I want to write the elements of an array to disk- not that difficult, I'd think, but every attempt has resulted in various flavors of failure. MyBytes : packed array [0..$FFFF] of byte Count : longint What I want to do is to save Count (as in so many) elements of MyBytes to disk sequentially. Any ideas??? Mar Subj: writing to a file 89-01-12 22:19:23 EDT From: Dave Lyons Mark, the _slow_ way to do it is something like this: var MyFile: file of byte; ... rewrite(MyFile,'my.file.name'); for i := 1 to count do write(MyFile,MyArray[i]; close(MyFile); I suspect that will be pretty slow. If you want to use the ProDOS16 unit and go with direct ProDOS calls, you'll need to CREATE the file if it doesn't already exist, OPEN it, use the reference number returned by OPEN in the WRITE and CLOSE calls (you'll also want to SET_EOF on the file before closing it, to chop off the end if you're re-writing an existing file and the new one could be smaller). Using these calls requires you to set up parameter blocks with stuff like string pointers, buffer pointers, and reference numbers in them. Not too hard, but you'll probably need the ProDOS 16 reference manual (or the GS/OS reference manual) to do it. I generally use these calls directly rather than going through a language's library routines for file I/O. Of course, this is _much_ less portable than stuff like reset/rewrite/read/write in Pascal, but portability isn't an issue in most of my programs anyway (heavy toolbox use already). --Dave Lyon Subj: Re: TML Pascal 89-01-12 23:54:32 EDT From: A2MARKC Dave- I agree as to portability! Not much use for a GS font editor on an IBM anyway!!! B-) In any case, I tried something like you suggested, and ran into two problems... the first was in the loop- the compiler wouldn't let me, since COUNT was a longint. Therefore, I tried a Tally := 0; Repeat Write(MyFile,MyArray[Tally]); Tally := Tally + 1; until Tally = Count; This producted a jibberish file! For what its worth, I did go through the entire program and made sure that all the correct values were in the correct places before the filesave, so I know that the problem is in the array!. Barring that, I tried to set up a NewHandle(, and do a PD16 save. Problem is that I had trouble placing my array into the memory block. Perhaps I don't really understand Pointer math. Here's how I tried that (more or less)- (assumes Count is the number of elements in the array) procedure StoreValues; var FntHndl : handle; FntPtr : ptr; TempPtr : ptr; NewCount: longint; Count : longint; Tally : longint; MyArray : packed array [0..$FFFF] of byte; {this really is a global variable, and in fact already filled, put it here to show how I defined it} begin NewCount := 0; FntHndl := NewHandle($FFFF,myMemoryID,Fixed,nil); FntPtr := FntHndl^; Tally := ord4(FntPtr); repeat TempPtr := pointer(Tally); TempPtr^ := MyArray[Count]; Tally := Tally + 1; NewCount := New Count + 1; until NewCount := Count; end; Can you see anything wrong with this? Mark Subj: Re: TML Pascal 89-01-13 03:33:15 EDT From: Dave Lyons Well, you want MyArray[NewCount] rather than MyArray[Count] in that example, and the ":=" in "until NewCount := Count" should just be an "=", but besides that I don't see anything wrong. Are you sure the problem was with that code? Anyway, you're making it harder than it needs to be! Just use an "@" in front of MyArray in the Write parameter list...like ReadParms.bufferAddr := pointer(@MyArray); "bufferAddr" is probably spelled wrong, but you get the idea--you can read and write the array image directly. When you did the individual write(MyFile,MyArray[...]) things and got gibberish, were all the right characters in there but with garbage every other character? I could understand that, since I think TML always writes at least a whole word (2 bytes) when you write to a file. --Dave Ly Subj: Re: Reading the File 89-01-13 04:35:51 EDT From: AFC Mark Of course you're right about the typo's! B-) As to your suggested way- I had tried what I thought would work- but you provided the missing element as to why it didn't. I had forgotten to use the pointer(), and just tried @MyArray. Well, here goes! Thanks! Mark Subj: Re: Problems with Loading Files 89-01-14 01:44:31 EDT From: AFC Mark The problem continues... below are the appropriate sections to load and save my array, as you suggested. When trying to load, the drive is NOT accessed at all? What's wrong with this picture? B-) (BTW- this is about the last problem that I have to deal with in FontDoctor- my GS font editor- which will be up here as soon as it is done! Right now, I have an alternate way to load the font file, but it does not use the standard ProDOS calls- instead it uses the TML Read procedure- but saving just doesn't work! The rest of the program works great!) Thanks again. Global Arrays- Font : Packed Array [0..$FFFF] of byte; {contains loaded font file} Path : Str255; {contains Full Pathname from StdFile} Count : longint; {number of bytes in the file loaded and saved- can change as the editor works} procedure LoadFile; var openParams : P16ParamBlk; eofParams : P16ParamBlk; readParams : P16ParamBlk; begin openParams.Pathname2 := @Path; openParams.iobuffer := nil; P16Open(openParams); eofParams.refNum := openParams.refNum; P16GetEOF(eofParams); readParams.refNum := openParams.refnum; readParams.databuffer := pointer(@Font); readParams.requestCount := eofParams.eof; P16Read(readParams); P16Close(openParams); Count := readParams.transferCount; end; {LoadFile} procedure LoadFile; var openParams : P16ParamBlk; eofParams : P16ParamBlk; writeParams : P16ParamBlk; begin openParams.Pathname2 := @Path; openParams.iobuffer := nil; P16Open(openParams); writeParams.refNum := openParams.refnum; writeParams.databuffer := pointer(@Font); writeParams.requestCount := Count; P16Write(readParams); eofParams.refNum := openParams.refNum; eofParams.eof := Count; P16SetEOF(eofParams); P16Close(openParams); end; {LoadFile} Subj: Writing by blocks & a linker bug 89-01-14 04:19:19 EDT From: AFL Jim Mark, I'm getting in on this a bit late, but... If you don't need the exact file length set for the file and don't mind writing to the nearest block size, then this is almost as fast as writing the whole thing out at once. You can use something similar to read a file by blocks. Global Vars {$DSeg fontseg} Font : Packed Array [0..$FFFF] of Byte; {$DSeg ~global} Path : Str255; Count : LongInt; Procedure SaveFile; Type Block = Packed Array[0..511] of Byte; ByteArray = Packed Array[0..$ffff] of Byte; Var BlockPtr : ^Block; MyFile : File of Block; NumBlocks : Integer; Loop : Integer; Begin Rewrite(Myfile,Path); { erase & open the file } NumBlocks := Count Div 512; { figure # of blocks needed } If (Count Mod 512) <> 0 then NumBlocks := NumBlocks + 1; BlockPtr := @Font; { Aim BlockPtr at Font } { Write the file by blocks } For Loop := 1 to NumBlocks do Begin Write(MyFile,BlockPtr^); BlockPtr := Pointer(Ord4(BlockPtr)+512); End; Close(Myfile); { close the file } End; I loaded the Font array with some test data and this procedure seems to work fine. If you need the file to be of type and auxtype other than $00 and $0000, then you'll still need to call ProDOS directly. BTW: Are you using the $DSeg compiler directive like I did? If you aren't, you should probably reduce the size of the Font array. It seems that TML's linker on the stand-alone version doesn't catch segments that are too large. The programs compile, but then crash into the monitor when you run them :( Jim <- what am I still doing up at 2:30 am ? Subj: large segments 89-01-14 04:39:55 EDT From: Dave Lyons Hmmm...interesting. I can guarantee that _sometimes_ too-large segments are caught, but apparently they aren't always. Subj: HELP..A NEW PASCAL USER 89-01-17 22:06:58 EDT From: Greg93 Iam brand new to PASCAL programing and have a lot to learn..but currently I have a major problem. I can't seem to figure out how to code boolean variables in a situation where the user can choose to discontinue a section of a program. I hope someone here can help me...and quickly...this one has me stumped. Subj: boolean variables, IF...THEN 89-01-18 01:19:33 EDT From: Dave Lyons Greg, I'm not sure I understand your question. If you already have a boolean variable, IF...THEN is all you need to do or not do a group of statements. procedure BlahBlah; var DoMore: boolean; begin DoThis; DoThat; DoMore := AskYesNo; if DoMore then begin DoMore1; DoMore2; end; DoSomethingElse; end; In that example, AskYesNo would be a boolean function, like the one below. Actually, you can even write stuff like "if AskYesNo then...." function AskYesNo: boolean; var ch: char; begin repeat write('Do you want to BlahBlahBlah? (y/n) '); readln(ch); until (ch in ['y', 'Y', 'n', 'N']); AskYesNo := (ch in ['y', 'Y']); end; Those square brackets build _sets_ out of the things inside them, and "in" asks if an object is included in the set. You could do the same thing in a less pretty way like this: ...until (ch='n') or (ch='N') or (ch='y') or (ch='Y'); ...AskYesNo := (ch='y') or (ch='Y'); --Dave Lyo Subj: Re: TML Pascal: Binary files 89-01-19 23:18:41 EDT From: IraL2 I have to write a program that reads a text file of integers from the disk and writes the file as a binary file to the disk. The following is part of the program. Type FilType = File of integers; Var NumFile: FilType; When I check Syntax the word "integer" is highlighted and the error message "Identifier not declared" appears. We are using Turbo4 in class but I use TML at home. Any help will be greatly appriciated. Thanks in advance. Ira Lunsk(IraL2) Subj: File of integer--syntax 89-01-20 02:57:42 EDT From: Dave Lyons That looks okay, but it should be "file of integer" and not "file of integers". Check the spelling carefully. Subj: Re: TML Pascal:File of integer 89-01-21 09:33:23 EDT From: IraL2 Dave, Thanks for your reply. The computer science teacher at my school helped me figure that one out. We used the scientific method "TRIAL AND ERROR". THANKS AGAIN. Ira LUnsk Subj: Re: TML Pascal-Sound 89-01-25 01:49:53 EDT From: GASMAN3 I'm unable to find any documentation on the use of the note synthesizer or sound tools, other than the bare-bones stuff in the big reference. I have some source code that I borrowed and can generate some elementary sounds, but don't really know what paramaters are acceptable for a wavesize; what a pitchbend and release segment are; what the envelope array does;blah,blah,blah. Is there a source of any kind that really explains this stuff? I'd appreciate some help!! Subj: Print a file to window 89-01-25 17:38:01 EDT From: Chad P1 Dave- I need some help with the following, I am making a program to load a file then print it in a window, but I don't know how to get it from memory. So far it can open a file, allocate memory for it, and load it. If there isn't enough memory to load all of it, it will load it in chunks. My problem is, I don't know how to get any of the file out of the memory so I can print it. Chad Parker Subj: Note Synthesizer documentation 89-01-27 03:40:13 EDT From: Dave Lyons GASMAN3, the Note Synthesizer documentation can be found in the Toolbox Reference Update draft, available from APDA. I recommend joining APDA if you want timely info on stuff like this. Eventually I assume the Toolbox Reference Update will be available through Addison-Wesley, but that could be a long time. BTW, what is "the big reference"? Subj: displaying a text file 89-01-27 03:41:47 EDT From: Dave Lyons Chad, if you can get the file _into_ memory, I don't see why you're having trouble getting it back out. Try posting or e-mailing me the part of your code you do have, and I'll try to show how to fill in the gap. Subj: Re: Reading & Writing arrays 89-01-27 05:53:22 EDT From: AndyBoy1 Some comments on the recently posted code for the - was it a font editor? - I forgot.... oh well.... (1) You need a lot more error checking. I try to error check every single P16 or GS/OS call. In TMLPascal, this means: P16Open(parmBlock); IF toolErrorNum <> 0 THEN HandleError; Some errors are fatal, like io error on write. Some errors are part of natural operation, like 'creating' an existing file. (2) The read file sequence looked like this: P16GetEOF(eofParms); readParms.readCount := eofParms.eof; readParms.readBuff := @myArray; P16Read(readParms); VERY DANGEROUS!!! What if a different file , say a 10MB file was opened? You would overwrite the world. ALWAYS base read request counts on the size of the destination. Thank you for your support. --Andy Subj: Need Graphics Help 89-01-27 21:38:58 EDT From: GPFlint I am trying to learn to use TML Pascal and am having a few problems with a program I am using as a learning exercise. I am using v1.5 and GS/OS. 1. The compiler will not recognize FMStartUp or FMShutDown, I get 'Identifier not declared'. I do not have problems when using v1.00D. Since most of the program I am building is lifted from the MicroPaint example the syntax should be correct. My program doesn't use any fonts so I can get the thing running by deleting these statements. 2. My program generates a picture of a set of numbers called the Mandelbrot Set by iterating a mathematical formula. Depending on the iterations required to reach a certain limit a colored dot is drawn on the screen. The program took me about a month to get running in Apple Pascal but it does work. I am trying to convert the Apple Pascal program over to TML in order to get more colors and the ability to print the picture. I have got it working in the plain vanilla environment but in does nothing more than it did in Apple Pascal. The fun part is trying to get in to regular TML. I have the menu bar built and the program will even draw the picture in the content area of the screen. The problem comes when I try and do anything with the picture. If I use the scroll bars the picture will move but when I move the bar back the part of the picture that has been moved off the screen is lost. When I Print or Save nothing is printed or saved. Obviously, I do not know how to work the pointers. I have "Programmers Introduction to the Apple //gs" and the "Toolbox References I & II". Neither one can explain what I need to know in terms that make sense. I also have the examples disk but there is nothing like what I need on it. It reads like (sounds like?) I need to use a record called LocInfo and something called GrafPort but the text does not explain how or where. If anyone has the time or inclination I sure could use some help. Garth Subj: converting to Desktop appl 89-01-27 22:32:08 EDT From: Dave Lyons Garth, your first problem can be solved with "USES FontMgr". Sounds like the Font Manager routine declarations used to be included in GSIntf and were split up into their own unit. Your picture probably does not scroll back into the window becuase you have no Update routine for your window. In a desktop-based application, you always need to be prepared to redraw the content of a window whenever it becomes necessary. The system does _not_ keep track of everything you've drawn to the window, so you get to redraw it yourself. If the drawing is very time-consuming, as it sounds like yours is, then you'll want to draw it into an off-screen grafport and update the window whenever necessary just by copying part of the pre-drawn picture, using CopyPixels. I thin there are off-screen grafport examples earlier in this folder. The QuickDraw chapter does a decent job of explaining concepts like grafports, I think. A grafport is an environment that QD can draw in--it includes lots of different things (like a location withing a global coordinate system, pen pattern and masks and colors, just to name a few), and the pixelmap for the grafport can be on the screen or not (QD doesn't care whether it is or not). SetPort tells QD what port to work with. See the window mgr chapter for info about update routines--but you'll want to get comfortable with QD first, since that's the foundation for Windows. Subj: Re:Off Screen Drawing 89-01-27 23:20:47 EDT From: Don87 I also am interested in updating a window that is very time consuming to draw. To draw offscreen do I just Define a window like I would normally only set it as invisible? Then when I want to update my visible window after a scroll or something do I use copypixels? Is that the basic idea??? Thanks Don Mocarski Subj: Re: DraftPrinting 89-01-27 23:57:00 EDT From: Wrist I have been unable to force Draft printing by setting bjDocLoop in the Job subrecord of the Print record to 0 per Toolbox reference 15-12. Interogation of bjDocLoop (TML Pascal: PrintHdl^^.prJob.bjDocLoop) after running Job Dialog Box finds -128 regardless of whether Draft or Better-Color mode was selected. Printing uses the selected mode correctly. Help? Subj: Strange test results 89-01-28 13:47:10 EDT From: Bud Gehr I have a rather purplexing problem here and was wondering if anyone could figure out what is happening in the TML Pascal code fragment listed below. The objective of the code is to display the contents of the 320 SHR mode screen memory address pointed to by a global point. The contents are displayed in the system menu bar each time the routine is run. The results are supposed to be of WORD length. So if I click the the mouse on an all white area of the screen the value that should be displayed should be 65535 or in an all black area 0. In any case what ever the color at the point is it should be returned in each nibble of the WORD. The actual results of this test are not as straight forward as that though! If the routine is run with the point located on an area that contains colors 0 to 7, then the high byte of the WORD returned is always set to $00 and only the low byte contains the actual color values of the location in each of its nibbles. If the point is located on an area that contains colors 8 to 15 then the high byte of the WORD returned is always set to $FF and again the low byte contains the actual color values in each of its nibbles. In my opinion this is not logical! The areas I have tested on where one solid color and not a mixture of any. The way I found out that the high bytes were set was to do a bitand of the address contents as follows : HiByteValue:= BitAnd(ptr(WordAddr)^,$FF00); . Low byte values was tested the same way using $00FF as the mask instead. The code below does not include the masking version of the code, but I'm sure you will find the results the same. procedure GetColorWord(Where : Point); {where is a global point from the screen} var TempPort : GrafPtr; WordAddr : longint; r : rect; begin HideCursor; {get rid of cursor so as not to get its color values from screen} Wordaddr:= $E12000 + Where.v * 160 + (Where.h div 2); { convert the point to an address in screen memory } with r do begin { define a rect for erasing the old memory values displayed} top:= 1;left:= 200;bottom:= 12;right:= 318; end; TempPort:= GetPort; { save the current grafport } SetPort(GetMenuMgrPort); { set the current port to the menu bar } SetSolidPenPat(15); { set color to the background color } PaintRect(r); { and erase the old color value displayed } MoveTo(210,10); { position the pen and } Write(ptr(WordAddr)^); { display the current contents of the location pointed to by WordAddr in the menubar } SetPort(TempPort); { reset grafport to the original } ShowCursor; { Okay bring back the cursor } end; Bud Subj: getting pixels from screen 89-01-28 17:34:58 EDT From: Dave Lyons Bud, Im' not sure why your code is doing exactly what it's doing, but the guaranteed-in-the-future way to read a pixel from the screen is to use GetPixel, as documented in the QuickDraw chapter of the toolbox ref. Assuming that the screen starts at $E12000 with 160 bytes per line is certainly _not_ guaranteed to work on future GS-compatible machines. If you don't want to use GetPixel, the other way is to use GetAddress (see QD ref again) to get a table of scanline addresses & other related info. --Dave Subj: offscreen ports 89-01-28 17:37:07 EDT From: Dave Lyons Don, close, but not quite. An invisible window won't help you, because what you really need is a place to store the actual content of your window--when you draw to an invisible window, nothing gets drawn anywhere! (I suspect that an invisible window simply has a empty VisRegion, which would prevent QuickDraw from drawing anything, since drawing is always clipped to both the ClipRegion and the VisRegion.) You need to open a grafport and use SetLocInfo to put its pixel image in an area of memory you've allocated yourself, rather than letting the pixel image stay at the default location, which is memory (currently at $E12000) that the hardware displays on the super-hires screen. There should be an example illustrating this earlier in this folder. --Dave Subj: Showing a text file 89-01-28 19:10:19 EDT From: Chad P1 What I mean is that I don't know how to access it while it is in memory. I'm also not sure of the best way to print it. I think a good way to do it is to put a part of the file that I have in memory into a packed array, then print it from the array. But I don't if that would be fast or slow. Here is the part of my program where I load the file. { Global Variables & Types } var MyID : Integer; { The ID assigned to me by Memory Mgr } TextHandle : Handel; { The handel to get my memory } MyFile : P16ParamBlk; TextBlk : Packed Array [0..$800] of 0..255; { I want to put part of the file in this varitable so I can print it. Unless there is a better way to do it. } Filelength, FilePosition, Blocksize : LongInt; closed, WeGotItAll, WindOpen : Boolean; procedure OpenFile; var disp : Str255; WhatFile : ReplyRecord; MyFileLoc : Ptr; { Pointer to load the file into memory } begin if Not WindOpen then { check to see if the window & a file are already open } begin disp:='Select the file to view :'; SFGetFile(135,50,disp,nil,nil,WhatFile); if WhatFile.good then begin WaitCursor; OpenWindow; { The procedure to open my window } EnableMItem(closeItem); { In my "File" menu } DisableMItem(openItem); MyFile.pathname2 := @WhatFile.fullpathname; MyFile.ioBuffer := nil; P16Open(MyFile); Closed := false; { open the file } P16GetEof(MyFile); { get the file length } FileLength := MyFile.eof; CompactMem; BlockSize := MaxBlock; { largest block avail. } if FileLength < BlockSize then { can we load the whole file? } begin { We have enough memory to load the whole file into memory } TextHandle := NewHandle(FileLength,MyID,Locked,nil); MyFile.requestcount := FileLength; WeGotItAll := true; end else begin { We can only load a MaxBlock PART of the file because we don't have enough memory, and we have to keep the file open for later useage } TextHandle := NewHandle(BlockSize,MyID,Locked,nil); MyFile.requestcount := BlockSize; WeGotItAll := false; end; { if FileLength... } FilePosition := 1; MyFileLoc := TextHandle^; MyFile.databuffer := MyFileLoc; P16Read(MyFile); { here is where I acctually load the file } if WeGotItAll then begin P16Close(MyFile); Closed := true; end; { if WeGotItAll } HUnLock(TextHandle); InitCursor; End; { if WhatFile.good } end; { if Not WindOpen } end; { of OpenFile } I know it could be better, like doing some error checking. I plan to put the finnishing touches on later. Now if only I could get the file printed in a window. Thanks for any help you can give. Chad Parker Subj: NewHandle & MaxBlock; casting 89-01-28 21:39:49 EDT From: Dave Lyons First, note that it is _not_ the case that the largest block of memory you can allocate is MaxBlock. MaxBlock is the largest block you can allocate _without_ causing the memory manager to automatically move movable blocks or purge purgable blocks. (There is an asymmetry in the available memory manager calls: There is a MaxBlock and a FreeMem which don't account for blocks that could be purged, and there is a RealFreeMem that tells you how much memory would be free if everything purgable was purged, but there is no "RealMaxBlock" to tell you the largest area that would be free if all appropriate purging and moving was done. You just have to try NewHandle and see if it succeeds or not.) Anyway, once you have text in a handle [a locked one, unless you want to be very careful about what operations you do while you are using pointers into your block], you can do arithmetic to compute pointers to different places in the text: procedure xyz; var h: handle; procedure myDrawText(txt: univ ptr; len: integer); tool 4,xxx; begin ... { draw string with length L as position P in the block } myDrawText( ptr(longint(h^)+P), L ); end; If DrawText is already declared in the standard interface files _with an appropriate data type_, then you don't need to declare it yourself. Some of the routines are declared as taking "var x:Str255", which you can't cast a regular pointer into, as far as I can tell. Does that help Subj: Re: OffScreen Pictures 89-01-28 23:30:42 EDT From: Don87 Thanks Dave. I assume the message you are referring to was the one to SkySinger. I'll give it a try but I just know I'm going to get lost somewhere along the way. Thanks again. Don Mocarski Subj: Getting pixels from the screen 89-01-29 00:13:45 EDT From: Bud Gehr Dave, I could and have used GetPixel, but it is the slowest piece of trash out of Apples doors! I think you are missing the point behind the code fragment I posted. I know the example I posted will not be upwardly compatible with possible future GS upgrades or versions. I know of other ways to get the location of the start of screen memory via quickdraw instead of just using $E12000. The reason I wrote it like it is, was so as to make a quick and simple example for reference about the problem I am having at reading anything bigger then a byte from a pointer. The need for getting direct access to memory is required for a fast flood fill, something that GetPixel is way too slow to do! Now, if you have any ideas as to why the high byte at a given address, when accessed via a pointer, is always set at $00 for colors 0 to 7 and $FF for colors 8 to 15, I would be glad to hear them. Bud Subj: getting pixels from screen 89-01-29 02:03:14 EDT From: Dave Lyons Bud, I now realize what I didn't before...makes perfect sense even, in retrospect. You don't want to use ptr(...)^ to peek at things bigger than a byte, since ptr is a type that points to byte-sized objects. Integers 0..255, I think. It seems the integers are actually being "sign extended" into two-byte integers from -32768 to 32768: the high byte is $ff if the low byte was "negative" ($80 to $ff), and it's zero otherwise. TML Pascal likes to do that. (C lets you declare your integers as "unsigned" to avoid sign extension when you want to.) Anyway, try something like this: type WordPtr = ^integer; ... x := WordPtr(...)^; and see if you get better results. I urge you to consider using the LocInfo stuff for a port when doing your fill--very much preferable to limiting your routine to the super-hires screen, and to the current hardware's super-hires screen, at that. Subj: Re: TML Pascal 89-01-29 13:47:16 EDT From: Bud Gehr Dave, Thanks for the info, I'll try it out using your method. It seems stupid to have a 16 bit computer and have a language that limits you to 8 bit memory access in any way! My intention is to use the grafport record to find the pixelmap location when I finally do apply the routines I'm working on to complete application. Its funny, but just when you think you have a handle on the way things work,something like this pops up, adding UNdocumented features! Looks like TML is trying to out do Apple in that respect. Bud Subj: Re: Programing problem HELP!! 89-01-29 17:05:42 EDT From: IraL2 I am writing a program that reads a text file of state abreviations and state names from disk and puts them in a table. Next reads a text file like: I was born in FL but now live in MN. and echos with: I was born in Florida but now live in Minnesota. Here is my problem: I have set up an array of records. Each record is a state abreviation and state name. The array is initialized and the file has been read in. I am working on a procedure that reads the sentence with abreviations, but am having problems as to how to get the name to replace the abreviation. Here is the procedure so far. Procedure ReadFile Var Ch, PrevCh : Char; Begin (* ReadFile *) Ch := ' '; PrevCh := ' '; While not EOF(Sentence) do Begin (* While..Do *) Read (Sentence, Ch ); If ( Ch in ['A'..'Z'] and ( PrevCh in ..['A'..'Z'] then ( this is the part where I am stumpped ) Ch := PrevCh; End (* While..Do *) End; (* ReadFile *) I don't understand how find the cell in the array with the abreviation and replace it with the name. Any help will be appreciated. Replies by E-Mail would be easier for me. Thanks. -Ira Lunsk(IraL2) Subj: Re: TML Pascal 89-01-29 17:15:58 EDT From: SkySinger Bud, How'd you make out with Dave's suggestion? I tried your code for accessing a high and low byte and found it didn't work because you used "ptr". If instead you define a variable "IntValue" as an Integer (which is a two byte value) and then use: IntValue:=pointer(memlocation)^ you will be able to mask out the high and low bytes successfully. (Don't forget to divide the high bytes by 256). I think the reason "ptr" doesn't work is that its defined to be a pointer to a signed byte (-128..127), but whatever the reason, that seems to be the problem. You can find that definition of "ptr" on the first page of the QDIntf section in the back of the TML manual. The manual also defines the other data types and their sizes very clearly. See page 104 for a good description of integer and other types (at least that's where it is in my manual). I've been able to access any desired number of bytes with a pointer using TML. Doing that depends on how you define your pointer. For example if you define "PalettePtr" as ^ColorTable which is defined to be an array of 16 integers (ie. 32 bytes), PalettePtr^ will yield and array of 16 integers which you can play with as a chunk of 32 bytes of data if you need to. If you don't want to create a pointer variable you could probably just use: ColorTable:=pointer(MemLocation) and get a 32 byte chunk of data. I'm not sure exactly how you're trying to implement your fill routine or why you need to look at words. The approach I took only had to translate pixel coordinates to a memory location ONCE in the whole fill. Also, I never had to extract bytes from words since I set up the pointers to access bytes. I gather you've got a different approach. Hope it works out. If you have any other questions about the approach I took I'll be glad to answer. (I haven't had a chance to polish it up or make it readable since I've got some other tasks pressing in, so, while it is functional, some aspects of it need to be developed and reworked. If you really need more info let me know.) Subj: Re: Whoops! 89-01-29 18:10:56 EDT From: SkySinger Sorry... I think that assignment statement in my last message-- ColorTable:=pointer(MemLocation) should have been dereferenced... ColorTable:=pointer(MemLocation)^ Subj: Word search 89-01-30 00:34:08 EDT From: Bud Gehr SkySinger, The reason behind starting with words during a fill search is because it should be twice as fast as using a byte at a time. My current fill routine fills the screen in 9.2 seconds without any odd nibble checking at either end of a line nor does it have code in it yet for making sure it stays within the bounds of the screen. As far as reference in the TML Pascal manual, my manual does not have a page 104. It tops out at page 96 and that is followed by 5 pages of index. My manual does have a listing for data types starting on page 85, but it does not include a definition of PTR in them. The frustration I am getting from trying to develope a good fill routine is really beginning to get on my nerves! I sit here day after day tweeking the code, compiling, linking and retweeking and recompiling and relinking until I am blue in the face with out making any headway. If I EVER get this thing perfected I am going to croak from the sudden surprize! I really appreciate all the help both you and Dave Lyons have been giving me on this. Bud Subj: Re: Fill finding 89-01-30 02:17:44 EDT From: Bud Gehr SkySinger, For my fill routine I get the address of the starting point of the fill only ONCE and it is at the very beginning of the procedure. From then on I just add and subtract from the address to look around memory for an area to fill. I believe this is what you meant isn't it? In the last message you left me in the Fill folder you mentioned using the X coordinate to determine whether a color to look for is in the nibble or low nibble of a byte using : If (x mod 2) = 0 then NibblePosition:= left else NibblePosition:= right; My question is, if you are using just a pointer to search memory for a nibble, are you also maintaining (adding and subtracting) from the x coordinate each time you add or subtract from the pointermove in order to determine if a pixel is located in the high or low nibble? This seems logical and is the way I will do it unless you have a better method for determining nibble position in a byte when doing a fill search. Bud Subj: Re: TML Pascal 89-01-30 21:24:23 EDT From: SkySinger Bud, I've also got a 96 page manual that came with the APW version of TML, but I've been using the Stand Alone version of TML and the page numbers I gave were from the Stand Alone manual. As far as keeping track of x coordinate to determine which nibble, I didn't do anything like that. I just moved as far to the left as I could on a line by bytes. When I couldn't go any further I checked the low nibble (ie. the right hand pixel) of the next byte to the left. Then I did the same going to the right only in that case, when I couldn't go any further by bytes, I checked the high nibble of the next byte to the right. Also, when looking above, I looked at a full byte. If it wasn't a full byte of the OldColor, I checked the high nibble and then the low nibble (ie. left to right) in sequence and stacked each nibble if appropriate just as I would with whole bytes. Again, whenever a memory location was stored, I also stacked with it an indicator telling me whether it was a full byte of OldColor or a left nibble or right nibble. I'll be interested to see if working by words ends up faster than working by bytes. You'll probably have to check 3 nibbles extra at each end of the line and check 4 nibbles above when there isn't a word match. If you need to see my code and can wait about a week, I'll try to get the time to make it readable. It still needs a better way of creating a stack. Also it checks to be sure the fill doesn't go out of the screen at the top and bottom but I didn't put in similar checks for the left and right sides as I found it added time. Instead, I'm considering doing the fill in an off-screen GrafPort which has a border drawn around it (two pixels wide of different colors) to stop the fill from going out of bounds. Since I don't need the fill routine right now, I kind of put it on a back burner for a while. Subj: Faster with words! 89-01-30 23:40:09 EDT From: Bud Gehr Sky, I tried out my routine using words instead of bytes(now that I have a ptr system that lets me look at words! Thanks to you and Dave) and saw a significant speed increase. Filling the screen took 5.3 secounds instead of 9.2. This is of course without any byte or nibble check at the ends of the lines and no border testing, but still it is quite an increase in speed. On the negative side, filling single or double pixel columns will be much slower then using a byte at a time, but most of the time it would be looking at words anyway. I guess time will tell after the overhead code gets installed for byte nibble and boundry checking. As code goes, mine is based on the example MikeW posted here and I could really do with another point of view on what is best. His routine works well, but it seems like it could be bettered by something else. I would really like to see how yours works, hopefully I can spend more time on mine and get it to work a bit more predictably! Bud Subj: replacing two-letter names 89-01-31 00:15:23 EDT From: Dave Lyons Ira, e-mail would be easier for _you_, but nobody else would benefit from the answers to your questions that way (and people wouldn't realize how hard I work around here, either :-) Anyway, you didn't give the actual data structures you're using, so I'll make up some that are hopefully similar to yours: const NumStates = 50; var States = array[1..NumStates] of record abbrev: string[2]; name: string[20]; end; Now, I recommend organizing your program to collect whole words (delimited by blanks and punctuation, and the beginning and end of the string) so avoid translating things like "ANYBODY WANT A COKE?" with "ANew YorkBODY WashingtonNT A ColoradoKE?" :) If you don't anticipate any capital letter pairs in your input other than state names, I suppose you could get away with what you've got. To search the table of abbrevs you might use a function like this: function FindState(c1, c2: char): integer; { returns 0 if state not found; index into States otherwise } var i: integer; begin FindState := 0; { this will be the function value if we do not assign another one before returning from the function } i := 1; while(i<=NumStates) do if (States[i].Abbrev[1]=c1) and (States[i].Abbrev[2]=c2) then begin FindState := i; i := NumStates+1; { force the loop to stop } end; end; end; I wouldn't want to solve the whole problem for you or anything, but I hope that gets you Subj: Re: Ptr definition & flood fill 89-01-31 02:43:39 EDT From: AndyBoy1 Bud, I don't have my TML manuals here at home, but I do know that the best way to find data definitions is to look in the interfaces. And many of what we consider 'standard' data types are actually just definitions in the QDIntf.pii file. Specifically: SignedByte = -128..127 { this is one byte from RAM } Byte = 0..255; { this is a byte w/o sgn extension } Ptr = ^SignedByte; { note : "ptr" is a ptr to 1 byte } Handle = ^Ptr; { and handle^^ also gives 1 byte } Also, if you are working on 'fast' fill, why use Pascal? Seems like assembly is the way to go here.... --Andy Subj: Why Pascal for filling 89-01-31 19:21:13 EDT From: Bud Gehr Andy, Fast fills can be realised in pascal. SkySinger has a very fast fill routine he has developed using TML Pascal. The reason I am trying to do it in pascal is that I know alot more about it then I do assembly. The routine is complex enough already without adding in the complexity of learning a new language. I feel that Pascal is much easier to work with and more forgiving then assembly is, but I would like to get proficent at assembly someday also. There is just nothing that can touch it (assenbly) for speed or power over the machine. I should have looked in my QDIntf unit source code for the Ptr definition, but I completely forgot that it was listed there until you pointed it out. Bud Subj: Re: Pascal for filling 89-01-31 19:38:32 EDT From: SkySinger I agree with Bud, it would be great to do it in assembly, but for me that would mean a month or two just to learn it. Maybe someday, but for now Pascal seems to be meeting my needs, especially with so many machine language routines available thru the toolbox. I'm wondering what kind of luck I'll have trying to use Pascal for animation. I think it will be OK for small area animation. We'll see. Subj: Re: Same approach to filling 89-01-31 19:42:52 EDT From: SkySinger Bud, The routine I wrote uses the exact same approach as the one listed by MikeW. (I thought I invented the method a few years ago when I was playing around with some graphics routines.) I just modified the idea to look at memory locations in order to get around using GetPixel, that's all. It works pretty much the same way. Subj: animation techniques (Jamm) 89-01-31 20:49:51 EDT From: Dave Lyons (moved message) Subj: Animation 89-01-31 19:25:53 est From: Jamm Msgs: 2 (89-01-31) What is the best method for animating an object around the super Hires screen using TML Pascal, or any Pascal? Subj: animation techniques 89-01-31 20:51:44 EDT From: Dave Lyons Jamm, how big are the shapes you need to move, and what sort of background will you be moving them over? Color shapes, or black and white only? I think some earlier messages in this folder include some discussion of animation--that may give you a starting point. Subj: Finally a fast flood fill! 89-02-01 01:54:42 EDT From: Bud Gehr TO all those that have been following the flood fill line of messages, I have perfected a flood fill written in TML Pascal that will fill any area completely and fill the whole screen in 11 seconds. I will post the source for this routine here for you folks to optimize and make use of within the next couple of days. My hat is off to AFL Scott, Dave Lyons, MikeW50 and SkySinger for all the help these guys have given me during development of this routine :) Bud Subj: The Flood fill does have a bug. 89-02-02 01:27:55 EDT From: Bud Gehr I have found that my fill routine does have a minor bug in it. In the earlier message I mentioned that it fills ALL areas perfectly, I have found through some added experimentation that there is a limitation in the current version of the fill routine. It will not fill areas that are less the 2 pixels wide vertically between different colors. An example of this is a line vertical line that is only one pixel wide or an area of a shape that narrows down to less than 2 pixels wide. The problem lays in the fact that I am searching vertically for bytes (2 pixels) and need to look for nibbles. In all other circumstances a complete fill is realised and this limitation won't really be noticed MOST of the time by a user. I am currently working on a fix to this and will have it corrected I hope, within a few days. In any case I am going to post the current code as it is and will follow that up with the improved code. Subj: Here is the Flood fill source :) 89-02-03 00:33:09 EDT From: Bud Gehr Well, here is the fill routine I have been developing. It was written in TML Pascal, but should work equally well without modification using Orca/Pascal. As it stands now it is set up to work only in 320 SHR mode, but with some modification it will also work in 640 SHR mode. Everything needed to interface the procedure to your program is contained in the call to the procedure. It will work on any size pixel map you can come up with. As far as performance goes, it will fill a window that takes up almost the full screen in less then 7 sec. (I have made a few improvements in speed since I first got the original to work. The original version took 11 sec. to do the same fill) It will fill all areas completely, except areas that narrow down to less then 2 pixels wide between colors. I hope to have this problem licked soon, but if you come up with a fix for it before I do, PLEASE let me know what you did :) The required input parameters for the routine are as follows: 1) WHERE, this is the start location for a fill.This has to be in GLOBAL coordinates. 2) FILLCOLOR, any integer from 0 to 15, this is the color that will be used in the fill. 3) PIXMAPPTR, this is a pointer to the start of your pixel map in memory. 4) WIDTH, this is the width in BYTES of your pixel map. Bud ------------------------------------------------------------------- procedure Fill(Where: Point; FillColor: integer; PixMapPtr: Ptr; Width: integer); type fillPtr = ^fillRec; fillRec = record next : fillPtr; Addr : LongInt; end; byteptr = ^byte; Wptr = ^integer; var fillList, p1 : fillPtr; fillUp, fillDown : boolean; leftaddr, filladdr : longint; oldcolor, newcolor : byteptr; colorword : Integer; {used for nibble testing at ends lines } begin HideCursor; colorword:= (FillColor * $1000) + (FillColor * $100) + (FillColor * $10) + FillColor; newcolor^:= colorword; filladdr:= longint(PixMapPtr) + Where.v * Width + (Where.h div 2); {calc the start mem addr} oldcolor^:= byteptr(filladdr)^;{get the old color to replace} if oldcolor^ = newcolor^ then begin {if trying to fill an area} ShowCursor; { with same color, quit!} Exit; end; new(fillList); {init the first list item} fillList^.next := nil; fillList^.Addr:= filladdr; while fillList <> nil do begin if keypressed then begin {if user wants to stop,then quit} ShowCursor; Exit; end; fillUp := false; {reset up & down test for next pass in loop} fillDown := false; filladdr:= fillList^.Addr;{get start addr for line} p1 := fillList^.next; {get next record ptr} dispose(fillList); {and dump the old record} fillList := p1; {set new fillList ptr} if byteptr(filladdr)^ = oldcolor^ then begin {end of line?} while byteptr(filladdr -1)^ = oldcolor^ do {find lt end of} filladdr:= filladdr-1; {line} leftaddr:= filladdr; while byteptr(filladdr)^ = oldcolor^ do begin {ck for rt end} if byteptr(filladdr - Width)^ = oldcolor^ then begin if not fillUp then begin { check fill up} new(p1); p1^.next := fillList; p1^.addr:= filladdr - Width; fillList := p1; fillUp := true; end; {if} end {if} else fillUp := false; if byteptr(filladdr + Width)^ = oldcolor^ then begin if not fillDown then begin {check fill down} new(p1); p1^.next := fillList; p1^.addr:= filladdr + Width; fillList := p1; fillDown := true; end; {if} end {if} else fillDown := false; filladdr:= filladdr + 1; end; {while} {ck & fill any nibbles on lt end.There must be a better way!} if bitand(Wptr(leftaddr-1)^,$000F) = bitand(Wptr(oldcolor)^,$000F) then begin leftaddr:= leftaddr - 1; Wptr(leftaddr)^:= bitand(Wptr(leftaddr)^,$FFF0)+ bitand(colorword,$000F); leftaddr:= leftaddr + 1; end; {ck rt end} if bitand(Wptr(filladdr)^,$F000) = bitand(Wptr(oldcolor)^,$F000) then begin Wptr(filladdr)^:= bitand(Wptr(filladdr)^,$0FFF)+ bitand(colorword,$F000); end; filladdr:= filladdr -1; {fill in rest of line} repeat byteptr(leftaddr)^:= newcolor^; leftaddr:= leftaddr + 1; until leftaddr > filladdr; end; {if} end; {while} ShowCursor; end; Subj: Re: 89-02-03 22:04:52 EDT From: SkySinger Bud, Congrats on your fill. Sorry about your frustration with it. As I mentioned a few messages ago, if you could have waited til this weekend, I'd have had the time to make mine post-able and upload it. Right now its got no comments, its got all kinds of extaneous variables that are used for debugging and also has meaningless code interspersed that's left over from earlier attempts. In its present it would create more confusion, waste people's time and maybe make them crazy. In any case, congratulations. I haven't read your code yet but its a lot smaller than mine so its probably more efficient and may provide better sample code for the forum than mine would. I'll be interested to see how you do the stacking. I found that for most figures, the stack remains very small (maybe just 3 or 5 points on the stack). However in exremely complex figures, the stack gets incredibly large (I wouldn't be surprised at a 64K stack). I'm using an array right now for the stack but thats got limited dimensions and if I make it very large it ties up memory (also, TML has a limit on the amount of memory an array can use and also the max value of its index). As an alternative I'm going to try a TML suggestion which involves allocating a block of memory with MM to hold the stack and using a pointer to push things in and pop them off. This way the stack could be made large right from the start and disposed of right after the fill... or the routine could probably make use of toolbox routines that e nlarge the size of the allocated block when needed. When the fill is finished the block can be completely disposed. The procedure below creates a very complex pattern on the screen. You may want to try your fill routine out on it and see how it goes with your stack. {Assumes QDIntf is available} Procedure DrawPattern; Const DotColor = 5; Var X, Y ,I : Integer; LocPtr :^Byte; Begin Moveto(0,0);LineTo(319,0);LineTo(319,199);LineTo(0,199);LineTo(0,0); LocPtr:=Pointer($E12000); repeat For I:=1 to 80 do begin LocPtr^:=BitAnd(LocPtr^, 15)+ DotColor*16; LocPtr:=Pointer(LongInt(LocPtr)+161); LocPtr^:=BitAnd(LocPtr^, 15)+ DotColor*16; LocPtr:=Pointer(LongInt(LocPtr)-159); end; {For I:=} LocPtr:=Pointer(LongInt(LocPtr)+160); Until LongInt(LocPtr)>($E12000+31999); End; {DrawPattern} Subj: Complex pattern test 89-02-04 00:42:20 EDT From: Bud Gehr Sky, I'll try out that pattern generator and see how the fill I have working now handles it. My code, as you have probably already noticed sticks very close to the method and form that the sample MileW50 posted up here. Do remember that it does not check for single nibbles up or down and that this will create some situations where a fill will not be complete. It DOES let the routine fill just about all areas that it might encounter and is probably the main reason for my sample being smaller then yours is. I think the best way to set up boundry detection would be to do as you suggested, using an off screen bit map enclosed with 2 borders of different colors. This will no doubt result in the fastest boundry detection method. One thing I do like about filling on the visible screen is that the user can see where a fill is going and terminate it as required to keep it from doing anything he does not want (ie runaway fill) or if he just wants to do a partial fill of an area. An a part of my code that presently does work Okay, but I think can be done much better in my fill sample code is the nibble testing at the ends of the lines. I had a version that did the following to test for nibbles: if ((BytePtr(FillAddr)^ * $10) div $10) = ((FillFindColor * $10) div $10) then "low nibble needs to be filled"; FindFillColor is a byte with both nibbles set to the color that is being searched for. FillAddr is just a pointer to a byte you want to look at in memory to determine if it needs to have the low nibble filled. By my logic (?) the above line takes the byte value at FillAddr and first shifts the value of the low nibble to the hi nibble (* $10) in order to clear out the hi nibble, and then it shifts value back down to the low nibble position. This should result in the same value being contained in the low nibble as before and the hi nibble being set to 0. In other words, before the routine FillAddr might equal $AB and after the routine it should equal $0B ($A0 shold have been dropped). In practice this method of testing for single nibbles when dealing with the standard TML Pascal type : Byte (Byte = 0..255), does not seem to work, ie it did not sense the nibbles at the ends of the lines! I would like to use bitand with bytes to test the nibbles, but I believe it works only with Words and Longint's. Bud Subj: Re: External Functions 89-02-04 12:23:15 EDT From: BRCCMAIL Can anyone give me a short example of how to add external functions (written in assembly) to TML Pascal. I have the stand-alone version. I see on page 248 instructions on how to write the program and pass parameters, but I don't understand how to link the Pascal program and the assembly program together. John Subj: can't link asm to standalone TML 89-02-04 16:40:17 EDT From: Dave Lyons John, the standalone version of TML Pascal has no provision for linking with other languages, unfortunately. The most sane solution if you need assembly routines is to switch to the APW version of TML Pascal (and buy APW or ORCA to use it with). Alternatively, you _can_ write your routine "inline" in the Pascal program. See my public-domain CallByPtr unit in the library for an example of how to do this. Alternatively, you could _use_ that unit to call an assembly-language routine at any address in memory--so you could use InitialLoad in the Loader to load your routine from a separate file, and then use CallByPtr to call it. Icky, yes? Subj: checking nibbles withing bytes 89-02-04 16:45:39 EDT From: Dave Lyons Bud, the problem with your code is that the intermediate results during evaluation of a complicated expression are _not_ of type Byte, just because one of the values was. Try checking the nibbles w/ something like this: const LowNibble = $0f; HiNibble = $f0; var FillColor: byte; { $11, $22, etc } ... if bitand(BytePtr(FillAddr)^,LowNibble) = bitand(FillColor,LowNibble) then ... if bitand(BytePtr(FillAddr)^,HiNibble) = bitand(FillColor,HiNibble) then ... --Dave Subj: Nibble testing 89-02-05 00:11:33 EDT From: Bud Gehr Dave, I had not tested bitand with any types other then 16 bit integers and because according to my TML doc's bitand only takes 16 bit integers and 32 bit integers. I guess I should have tested it with bytes first just to see if it would work. I'll try out your example and see how I do. Other then the nibble testing what did you think about the rest of the flood fill? It looks almost identical to MikeW50's example which is odd considering it does the same fill in a very small % of time. I really think the toolbox should be faster. As it stands it is very slow. I just did not think a pascal program could get this close to assembly speed. Wish me luck with my next project, improving CheapPaints Zoom routine. I hope I get the speed increases with it that I got on the flood fill! By comparison it looks like a MUCH easier task! Bud Subj: bitand 89-02-05 17:56:56 EDT From: Dave Lyons Well, I don't think TML Pascal does _anything_ internally in less than 16 bits. Using BytePtr()^ will get you a value from 0 to 255 (or from -128 to 127, maybe, if it does "sign extension" making it into 16 bits), but the value will still be stored in 16 bits internally. Ummm...how do you know how close to "assembly speed" your flood fill is without first writing it in assembly? --Dave Subj: Re: StandAlone Upgrade 89-02-05 18:41:43 EDT From: BRCCMAIL What is the upgrade path from the standalone version of TML Pascal to the APW version. I already have APW and ORCA assemblers. John Subj: Nibble testing and speed 89-02-05 23:10:01 EDT From: Bud Gehr Dave, thanks for the nibble testing hint, I have added it to the flood fill routine. Its no faster with it, but it looks better in the source :) I have timed the fill routine I wrote against a couple of commercial programs and they are at best a couple of seconds faster the the routine I wrote. Bud Subj: TML Pascal upgrade 89-02-05 23:16:09 EDT From: Bud Gehr TML used to offer, I think a $50 upgrade from either version to another, but I believe that offer has come and gone. I would guess that unless TML is offering a new special, that you will have to pay full price, since it is not considered an upgrade from version 1.5 desktop to v1.5 APW. Subj: discount on APW TML Pascal? 89-02-06 02:04:45 EDT From: Dave Lyons John, you might just want to give TML Systems a call about that...I think they have a discount on APW TML Pascal if you already have the standalone version. Subj: Re: Questions 89-02-06 22:48:15 EDT From: BRCCMAIL After studying some of the sample source code which I've downloaded, I've come up with a few questions. First, I often see code like the following (with no error checking): TempHandle := NewHandle(Size,MyID,$C018,nil); What happens when there isn't any memory available? Isn't this dangerous code? Second Question: On NDA's I sometimes see that the program checks to see if QuickDraw Aux and ScrapManager are available. I wonder why this is necessary. Can you ever call a NDA without these tools being available? Third Question: After you open a port, is it necessary to Set the port? Fourth Question: Is there any way to get TML Pascal to abort a program (and then give info) if a ToolBox error has occurred? This would help in debugging some code. John Subj: NewHandle errors; SetPort; etc 89-02-07 00:57:38 EDT From: Dave Lyons >First, I often see code like the following (with no error >checking): > >TempHandle := NewHandle(Size,MyID,$C018,nil); Yes, leaving out the error checking is dangerous! What happens is: no memory is allocated; error $0201 is returned (in ToolErrorNum in TML Pascal); TempHandle is NIL. If you use NIL as a handle, you're using whatever is at $00/0000..0002 as a pointer to what you expect to be the memory block you just allocated. Things go downhill from there very quickly. >Second Question: On NDA's I sometimes see that the program >checks to see if QuickDraw Aux and ScrapManager are available. >I wonder why this is necessary. Can you ever call a NDA without >these tools being available? Table 5-2 on page 5-5 of the Toolbox Ref Vol I lists the only toolsets that are required to be started when NDAs are used: Tool Locator, Mem Mgr, Misc Tools, QuickDraw, Event Mgr, Window Mgr, Menu Mgr, Ctrl Mgr, Line Edit, Dialog Mgr, Scrap Mgr. QuickDraw Aux is not required to be started, and Scrap Manager is _supposed_ to be, but in practice there are some applications that don't start it even though it's required. It was probably my source to Show Clipboard that you saw starting Scrap Manager if it wasn't already started. >Third Question: After you open a port, is it necessary to Set >the port? OpenPort does not automatically do a SetPort to the newly-opened port, so Yes--if you want to draw/etc in your new port, you need to SetPort to it first. >Fourth Question: Is there any way to get TML Pascal to abort a >program (and then give info) if a ToolBox error has occurred? >This would help in debugging some code. You might write a Die procedure that takes a string message/etc and have it do something like this: SaveTextState, use text toolset to display error info, use RestoreTextState, shut down all the tools, and then Halt the program (I _think_ halt is the right name...exit(program-name) should also work). Subj: More clues to the fill routine. 89-02-07 03:01:48 EDT From: SkySinger Bud, I tried out your fill routine. For the most part it seems to work OK as far as it goes, but I did find that after running it, the same code would not compile correctly so maybe it overwrote some of memory where the Pascal compiler was stored (?). Here are the major elements you'll probably need to include as you develop it further. (1) You've got a stack that holds memory addresses from the line above and the line below the current line. The stack not only needs to hold the memory addresses that will be dealt with later in the routine, but will also need to store indications of whether it is the left nibble, the right nibble, or the full byte that needs filling. When you check above and below you may need to check nibbles and stack "WhichNibble" along with the address since you may not find a full byte of the OldColor at that above or below address. For example (there may be a typo or two in this code, but it should give you the idea of checking nibbles): {moving along the current line towards the right checking bytes...} {Constants FullByte = $FF, Left = $F0, Right = $0F} While (LocPtr^=OldColorByte) And (LongInt(LocPtr)=ClipLeft do LocPtr:=pointer(LongInt(LocPtr)-1);{stops when it hits an address that's not a full byte of OldColor} If (LongInt(LocPtr)>=ClipLeft) And (BitAnd(LocPtr^,Right)=OldColor) then begin {the last byte on the left needs only right nibble filled} LeftEndLocPtr:=LocPtr; LeftEndNibble:=Right; end else begin {right nibble doesn't need fill so move back one address to the right and make that the LeftEndLoc. } LocPtr:=Pointer(LongInt(LocPtr)+1); LeftEndLocPtr:=LocPtr; LeftEndNibble:=FullByte; {The next line checks to see if in fact the line's left end address is really the same as the address we just pulled off the stack. If it is, that means we haven't moved any further to the left ie. we were already at the left end of the line. If that's the case And the address isn't a full byte of OldColor, the nibble needing fill is the left (we know this since the routine only tried to move left in the first place if the address pulled of the stack was either a full byte of OldColor or had the Left Nibble indicated.)} If (LocPtr=PulledAddr If (LocPtr=PulledAddressPtr) And (LocPtr<>OldColorByte) then LeftEndNibble:=Left; end; (4) If the address you pull from your stack turns out to be the left-most address of the line, and only the left nibble needs filling, then the line is only one pixel in length. Be careful not to check the next address to the right for an extra nibble or you will get misleading results. (5) When actually filling in a line, I think its faster to fill in the extra nibbles at either end and then use the TML procedure FillChar to fill in the remaining full bytes. This fills in a chunk of memory with an indicated value. For example: If LongInt(LeftEndLocPtr)<=LongInt(RightEndLocPtr) then FillChar(LocPtr^,LongInt(EndLocPtr)-LongInt(LocPtr)+1,NewColorByte); The if/then is necessary because in the act of filling in any individual end nibbles, you also have to change the end addresses of the line to reflect this work... ie. LeftEnd:=LeftEnd+1 and RightEnd:=RightEnd-1... In some circumstances (a 2 pixel line with each pixel in a different byte) that change could leave you with a left end address that's to the right of the right end. Subj: Fill trashing memory 89-02-07 19:33:40 EDT From: Bud Gehr Sky, I am using the APW version of TML Pascal and have not had any trouble with recompiling the flood fill code. I am using 1.75 meg with 800k of it set aside as a RAM disk. However I have noticed that on occasion the tools will need to be reloaded after having run the shell fill application I am using before I can run the fill again. It sounds like the TML desktop is not into reloading itself if it gets bumped. I have had very few probelems with the code as it stands now as far as letting you return to a shell application after running the fill. It is no doubt the New() call taking away memory from the shell, but I would think that New() would use the memory manager, which should present no problems for any application that uses unpurgable memory. Thanks for the advise on implementing the fill nibble testing, I am sure it will help me out. I take it that you are using an array for your fill stack instead of New() to get memory allocated? Is it any faster? How did my flood fill routine compare on a screen fill as compared to yours? The "screen" I was speaking of was a large window (about 80% of the screen was the content area), so your times may have been more or less then mine were. Bud Subj: TML Pascal standalone reloading 89-02-07 21:55:31 EDT From: Dave Lyons The TML Pascal standalone environment _stays in RAM_ while you're running a program you Compile To Memory'd. If something's fried when you come back, the program you ran did it. Subj: Memory management 89-02-08 01:46:59 EDT From: Bud Gehr Dave, In regard to TML Pascal desktop version memory usage, I would think that if an application needs more memory then is available, due to the shell being in place that the shell would get flagged to reload or it should return an "unable to restart " message to the programmer if it had set memory to purgable status. While using APW version I have yet to run out of memory, maybe because I have more then enough available, I don't know. I have had occasion where most of the toolbox had to reload before I could run another application that used the desktop. If my fill routine is asking for memory via the NEW function then it is getting memory properly from Pascal and Pascal should handle it properly! I am not sure how TML allocates memory with the NEW function, but if they were doing it properly, then they would use the memory manager and it would return a NIL pointer if there was no memory available. If that is the case and a NIL pointer is returned then the Fill routine would sense it and cease doing any filling, since it is coded to stop when it comes upon a NIL pointer for its stack allocation. It sounds like TML is making its source buffer purgable, which is resulting in its contents getting overwritten. What do you think? Bud Subj: Re: Stack method in fill routine 89-02-08 21:30:19 EDT From: SkySinger Bud, First I tried using New() to create a linked list for stacking memory addresses. It worked fine for uncomplex fills but seemed to slow it down quite a bit on very complex fills. I replaced it with an array which worked faster but could not handle the problem of the LARGE stack (15000+) that grew during the fill of a very complex pattern such as the one I posted. What I finally did, was allocate a block of memory for the stack using NewHandle, and I move a pointer thru the block, treating it as if it is an array of addresses and nibble indicators. When the stack gets too large for the area of memory that was allocated, the routine uses the toolbox call that resizes the allocated Handle. To do this successfully, I had to reset the pointer into the array as an offset from the first byte of the allocated block. The address of the block may change when you resize the block. For very large stacks I also had to add some code that quickly pulled items off the stack and discarded them if those addresses had already been filled since many stacked addresses show up more than once in the stack in a complex fill. As far as speed. I didn't compare, but your routine seemed roughly around the same time. You may have to cut some corners when you add the extra code. Subj: Re: TML Pascal memory usage 89-02-08 22:25:51 EDT From: Dave Lyons Bud, TML standalone does _not_ mark its own code segments purgable when a Compile to Memory program is executing, but it does mark the file-editing buffers purgable (and also all unit symbol tables). Now, "purgable" means that the block is still allocated, but that the memory manager can purge it whenever necessary (the owner of the corresponding handle will find that the handle's master pointer is NIL, so it knows to reconstruct whatever data was in that block). I don't know of any bugs w/ the way TML handles that, and if another program is making things fry, it's overwriting memory that it doesn't own. Subj: Re: TML Pascal 89-02-08 23:16:09 EDT From: BillMack I'm a certified developer and have been converting Tom Swan's Apple Pascal Programs For Data Base Management to TMLPascal and the ProDOS operating system. After converting about 5 programs the operation of the system slowed down very dramatically. Even a linear search through a file is not bound by my Sider hard disk, but by the internal operation of my IIGS. Using SFGetfile, the operation is so slow, that at first I thought my system had hung up. I discussed this with Tom Leonard of TML Systems, and he had no thoughts or ideas. In some of the discussions here, I note that the NEW call is an area where slowness can crop up, but I'm only calling NEW 8 times. The initialization of the DB management system opens up boiler plate files up to MAXFILES which in this case equals 8. However, every time a new page is needed (Tom has devised a virtual memory system where data is stored in memory in pages 1024 bytes long) to hold more records, new is called. but none of this has anything to do with how many programs reside on disk. Another symptom I encountered is variables and parameters not getting updated or set even in an assignment statement. It is thought there are more than one copy of a parameter or variable and the wrong copy is being updated or set. Tom L. had no ideas on this one either. Jim, Dave, or anyone. Any ideas? I'm really stuck on this one! Thanks, Bill Subj: Re: Finder-Selecting & Path 89-02-08 23:29:33 EDT From: BillMack How does one get the pathname from a selected icon on the Finder desk top? In other words, I wish to be able to select or open an icon on the desk top then launch an NDA that will operate on this selection. How do I get the pathname info for the selected or opened file or icon? Reply to BillMack. Thanks, Bill Mack, certified developer. Subj: Memory trashing 89-02-09 02:03:28 EDT From: Bud Gehr Dave, So it would seem that the fill code I posted is overwriting the editing buffers when it starts filling up memory. It seems that the NEW function is at fault and not my code, it is the NEW function that gets memory for the routine and not my routine itself. As far as I know there is no way of testing to see if what NEW is looking for is actually legal memory to allocate. Also it would seem like the TML Pascal desktop is not handling things correctly if its handle is purged. Either that or the NEW function is just taking memory wherever it wants. Bud Subj: Re: TML Pascal 89-02-09 03:25:55 EDT From: AFL Jim Bill, I'm confused. Is SFGetFile slow in your program or in TML Pascal itself? Jim Subj: Memory trashing bites the dust. 89-02-09 20:29:49 EDT From: SkySinger Bud, Since I haven't found TML to be allocating memory improperly as you suggest it might be doing, I went back to your code to see if I could locate the problem there. The code declares two pointers, newcolor and oldcolor but it does not initialize them to point at any memory locations which means they could be pointing to crucial memory addresses when you assign values to them in the routine. I initialized them [New(newcolor) and New(oldcolor)] just before the assignment statements newcolor^:=... and oldcolor^:=... That seems to have done the trick as the code compiles correctly now even after the fill has been run through. Subj: Bud's New; Bill's odd problems 89-02-09 20:34:34 EDT From: Dave Lyons Bud, I don't think New has problems--I'm pretty sure it just calls NewHandle for you. Could your fill be filling off the screen by accident? Bill, no ideas from your description, but I'll take a look at your code if you want. Subj: Thanks Sky! 89-02-10 01:23:20 EDT From: Bud Gehr I guess I missed initializing the pointers! Thanks alot Sky! Subj: Memory trasher located! 89-02-10 01:24:52 EDT From: Bud Gehr Dave, I believe Sky found the bug that was causing the crash. I had a couple of pointers declared, but did not initialize them, so they were pointing at random. I agree with you about NEW, I think it just gets a chunk from the memory manager and the derferences it to get the pointer. Bud Subj: Re: Bill's ans to Dave 89-02-14 02:07:44 EDT From: BillMack Dave, Code is about two disk's worth due to necessary library routines. It's Tom Swan's code I'm converting so only minor parts of it are my stuff. If your willing, let me know how to get it to you. Thanks, Bill Subj: keyboard break... 89-02-25 22:49:06 EDT From: Howard12 Isn't the keyboard break supposed to bring you back to the compiler if you accidenly get into and infinite loop or something of the sort? I 'x'ed the keyboard break in prefences and tried to use it but pressing 'control C' while the program was running had no effect. either nothing happened or i got an inversed question mark on the screen. HELP!!! Howard Subj: Ctrl-C in TML Pascal 89-02-26 04:06:56 EDT From: Dave Lyons Howard, was your program in a Read or Readln statement when you hit Ctrl-C? If so, I think you have to hit Return before it takes effect. Honestly, I've never even tried using the keyboard break feature of TML Pascal. (My programs tend to have the opposite problem: rather than hanging in a harmless infinite loop, they fry the machine & make me reboot. I'm talking about programs _in development_, of course. :-) Subj: Re: TML Pascal Version#? 89-03-18 13:56:36 EDT From: The Mouse2 I'd just like to know the latest version of TML Pascal (stand-alone version). I currently have 1.50. Subj: Re: TML Pascal 1.50A 89-03-18 22:27:23 EDT From: Dave Lyons There is a version 1.50A; as far as I know, the only difference is that a bug with SEEK was fixed. (Is that the right name for Pascal?) Anyway, it doesn't affect most people. Subj: Re: TML Pascal 89-04-16 21:13:35 EDT From: HyperRam These messages are jst to even it out to 200 entries. :) Subj: Re: TML Pascal 89-04-16 21:14:09 EDT From: HyperRam Blah blah blah. hey anyone Pascal? :) goto the More TML Pascal folder. :)) Ram Subj: Re: TML Pascal Help 89-05-15 18:33:47 EDT From: Uncle GS I recently purchased TML Pascal with its Source Code Disk and the Speech Toolkit only to be disapointed by the fact that the documentation (good as it is) does not give a full review of Pascal. I know BASIC quite well and am ready to move up to Pascal as soon as possible. Can anyone reccomend some good books published by Addison Wesley or other Publisher that would give easy to understand, examples and explanations of Pascal on an Apple (IIgs) that I could get? I am looking for something along the lines of "Introduction to..." types of books. Uncle GS Subj: Re: TML Pascal 89-05-17 19:24:44 EDT From: HyperRam Please goto the More TML Pascal Folder. Um, I'm trying to learn pascal too. Subj: Re: TML Pascal 89-05-17 22:10:44 EDT From: SkipS Uncle, I'm learning Pascal to. Unfortunately, there is very little on the market for TML . I found one called Apple IIgs Toolbox from the Compute Library. It covers some Pascal, but also talks about C and Assembler (boo). The textbook Pascals help, like OH PASCAL, but they aren't specific for TML. Lotsa gotchas. See my post in the Folder 'Teaching Pascal'. We need some simple examples from some experienced TMLers. Skip Subj: Re: TML Pascal 89-07-06 21:08:43 EDT From: The Ronz I'd just like to mention Dave should write a book and make lots of $$ on Intro to TML Pascal for the GS... Also I guess people don't want to scroll through this whole folder anymore, Applelink should put in a "quickscan" in order to scan new messages since your last call, or have auto-new-folder create after 60 messages are entered in one folder--- create XYZ2 folder if you know what I mean... -Ron Subj: "Read New Messages"? 89-07-06 23:42:40 EDT From: Dave Lyons I don't understant the problem here...has something changed recently? Apple-4 = Read New Messages always gets me the messages since my last call, no problems. WRITE A BOOK? Ack! Not a bad idea, but first I need to invent a "Pause" button for the world. I haven't earned a sabbatical just yet. :-) --Dave ---------------------------------------------------------------------------- MORE TML Pascal ---------------------------------------------------------------------------- 8/13/89 3:22:47 PM Opening "More TML Pascal" for recording. Subj: More TML Pascal 89-02-11 21:10:54 EDT From: AFC Mark Msgs: 199 (89-06-16) The TML Pascal folder was getting a bit huge and unwieldy. Hope no one minds opening a second, new one! Subj: Re:Writeln problem 89-02-11 21:11:17 EDT From: AFC Mark I'm haveing trouble with the following segment of code... any suggestions {Global Variables... myFile : Text; TxtStr : Str255; Header : packed array [0..37] of byte; FontName : Str255;} procedure WriteLine; var TxtLine : Str255; path : Str255; theReply : ReplyRecord; begin {here I do a StdFile to get the pathname I want to save to} path := theReply.fullpathname; rewrite(myFile,path); {this DOES create the file!!!} TxtLine := concat(FontName,' ',IntToString(Header[6]), ' START'); writeln(myFile,TxtLine); {CRASH!!! RIGHT HERE!!!} So far, I've even tested to make sure that TxtLine is constructed properly... had it print to the working window, and it shows up just fine! HELP!!!! I'm stumpe Subj: Re: Rotations & Transformations 89-02-13 21:50:18 EDT From: BRCCMAIL Are there any TML Pascal (or any other language) routines available to do rotations and transformations (or translations) of IIGS graphics? Subj: Debugging 89-02-15 04:02:16 EDT From: AFL Jim Mark, The approach I usually take when I start hitting bugs is to remove parts of the code by remarking them out. For instance, if you think the Concat might be causing the problem, remark that line out and add a line to put some dummy text into the variable. If the program seems to run, you can check to see if the dummy data was writen to your file *and* you have a start towards finding the bug. Jim Subj: Graphics routines 89-02-15 04:05:58 EDT From: AFL Jim The last time I saw a anything that did graphics transformations was Kyan Software's Advanced Graphics Toolkit. Their routines were based on algorithms described in "Computer Graphics, A Programming Approach" by Steven Harrington (MacGraw-Hill Book Company). Jim Subj: Re: More TML Pascal 89-02-15 08:39:11 EDT From: AFL Scott I've found a great book for writing things like transforms and such... "Computer Graphics Software Construction". Written by John R. Rankin, published by Prentice Hall. ISBN 0 7248 0194 9. The book uses a toolbox approach in solving problems and every routine I've tried works by substituting IIgs toolbox calls for the authors calls. The books routines are already written in Pascal but can be easily ported to other languages. In my opinion, this is one of the best books available. It'll set you back $47.95. Subj: Re: Debugging 89-02-17 00:16:44 EDT From: AFC Mark Found my Writeln problem (thanks, Dave!). I had a whole slew of Str255's in the routine- caused the Stack to overload. Cut them down to size, and it works great! Subj: Re: Rotations & Translations 89-02-17 23:26:00 EDT From: BRCCMAIL I wasn't able to locate either of the books which were mentioned previously but I do have a copy of "Computer Graphics with Pascal" by Marc Berger (Benjamin/Cummings ISBN 0-8053-0790-7). I really like the explanations it gives and all the formulas for rotations and translations are included. I'm still working through the book's program examples, but have found that some of the early ones in the book have typos and some are just plain wrong. It's good training to track down the author's bugs but I think most of us have better things to do. I've pretty much given up on rotations in the 640 mode. The problems of the non-square aspect ratio and the color ditherization make me believe that any solution would be less than satisfactory although it may be possible to do. In the 320 mode, the aspect ratio is closer to square and the colors aren't a problem. Therefore, I'm limiting my programming on this problem to just the 320 mode. John Subj: Rotation 89-02-20 12:51:01 EDT From: AFL Floyd Forgetting about aspect ratios for the moment one neat way to say rotate a rectangular area 90 degrees is to do the following: Divide the rectangle into four equal quadrants. Then shift each quadrant clockwise (or counterclockwise depending on the direction of rotation). Now take those four shifted quadrants and divide each of them into four equal quadrants and repeat the shifting. Keep doing this until you get down to the smallest possible rectangle. The end result will be a 90 degree rotated object. This would be a good time to use recursion. ;) Floyd Subj: Rotations 89-02-20 21:40:11 EDT From: BRCCMAIL Floyd, It's funny that you should mention that method of doing rotations. Earlier today, I stumbled onto an article in the Nov 85 issue of MacTutor which shows how to do just that using CopyBits (CopyPixels on the IIGS). The program is written in C and I'm working on a conversion to TML Pascal. Wish me luck cuz I'm gonna need it! John Subj: Re: Printing to IMWRT LQ/LSR WRT 89-02-21 00:31:25 EDT From: Thomas McC Do I really have to read 2 or 3 books to learn how to print from Pascal programs simple strings in any given font to the ImageWriter LQ or the Laser Writer? Where do I begin? I hope TML is planning to publish perhaps an example procedure that will do this. Subj: Print Manager 89-02-21 21:04:09 EDT From: Dave Lyons Thomas, mostly you need to read about the Print Manager in the Toolbox Reference, Vol 2. Using the Print Manager will require a general understanding of QuickDraw and probably the some Memory Manager concepts. Subj: Print Manager Reference.. 89-02-23 00:01:20 EDT From: AFA Gary J (I can't believe this!!...I actually have an opportunity to correct Dave Lyons!! :) Actually, the Print Manager is documented in Volume 1 of the Apple IIGS Toolbox Reference, not Volume 2 as was stated. You'll really need to get both volumes (and should have them both) if you want to do as Dave suggested, and have an understanding of QuickDraw as a prerequisite. QuickDraw is covered in Volume 2. Gary Subj: A-P, Q-Z 89-02-23 01:45:01 EDT From: Dave Lyons Oops...I keep forgetting P comes before Q. :-) Subj: Memory Management Error? 89-02-25 23:07:07 EDT From: BRCCMAIL I've translated a Mac program into TML Pascal. The program works fine, but I'm having a problem which I'm unable to locate. The program used CopyPixels and offscreen LocInfoRec's. When I set the size of the RECT to 64 pixels square there's no problem, but when I just change the size to 128 pixels, the program still runs fine but when I recompile I get a variety of Link errors including Unresolved Linker Reference. I'm assuming this is a memory management error on my part. If so, how to I find it? John Subj: finding memory-trashing problems 89-02-26 04:03:50 EDT From: Dave Lyons Unfortunately, there's no terrific way in general to figure out what's causing memory to get trashed, since the Apple II hardware doesn't have any sort of scheme for detecting an unauthorized write to memory. (That means you don't find out about it until much later, when you can't tell what routine is responsible.) In this case, my first bet (based on very limited info about your program) is that there is some memory block whose size should vary in proportion to your rectangle's size, and you aren't expanding that memory block when you expand the rectangle. Subj: Re: opening output file on disk 89-02-26 21:48:58 EDT From: Ira Lunsk I am trying to read in a file as a string from the disk and ultimately write the output to another file on disk. The program runs with input from the keyboard and output to disk, but not with input from from disk and output to disk. The program compiles OK and everything seems to be working except that when I go to open the output file I get the message " error reading file". I have tried two different read procedures: 1. While not EOF(InFile) do Begin Read ( InFile, InString ); Readln ( InFile ); 2. While not EOF(InFile) do Begin Readln ( Infile, InString ); The reset, rewrite, and close statements are in the procedures where the reading and writing occur. Any help will be appreciated. thanks in advance. Ira Lunsk Subj: "error reading file" on rewrite? 89-02-26 21:58:36 EDT From: Dave Lyons Ira, can you post the part of the code that's executing when the error occurs? Do you have two separate file variables, or are you rewrite-ing InFile? I don't see how this is related to your problem, but read(file,string); readln(file); should be exactly the same as readln(file); --Dave Subj: Rotate Source Code 89-02-27 21:16:18 EDT From: BRCCMAIL Here's the TML Source Code which fries the Linker when SQ := 128. I think the problem may be caused by the failure to set ClipRect for the offscreen bitmaps. This code was translated from a C program for the Mac which appeared in the October 1985 issue of MacTutor. It rotates the upper left corner of the current window display by 90 degrees. John Procedure DoRotate; Var half_cell,sq: Integer; xRect,yRect,hackRect,irp: Rect; maskbits,tempbits, ibp: LocInfoRec; pixmap_1,pixmap_2 : ptr; Begin sq :=128; SetRect(xRect,0,0,sq,sq); SetRect(hackRect,0,0,sq+1,sq+1); SetRect(yRect,0,0,trunc(sq/2),trunc(sq/2)); ibp := GetPort^.portinfo; with tempbits do begin Width := trunc(sq/2) +16; pixmap_1 := NewHandle(MyMemoryID,(xRect.Bottom-xRect.Top)*Width,$c000+NoBankCross,nil)^; PixelImage := pixmap_1; PortSCB := $00; BoundsRect := xRect; end; with maskbits do begin Width := trunc(sq/2) +16; pixmap_2 := NewHandle(MyMemoryID,(xRect.Bottom-xRect.Top)*Width,$c000+NoBankCross,nil)^; PixelImage := pixmap_2; PortSCB := $00; BoundsRect := xRect; end; half_cell := trunc(sq/2); Hidecursor; SetSolidPenPat(0); PaintRect(xRect); ClipRect(xRect); SetSolidPenPat(15); PaintRect(yRect); CopyPixels(ibp,maskbits,xRect,maskbits.boundsRect,srcCopy,nil); OffsetRect(yRect,half_cell,half_cell); SetSolidPenPat(3); PaintOval(yRect); Moveto(10,10); Writeln('Rotate'); repeat SetRect(xRect,0,0,sq,sq); SetRect(yRect,0,0,sq,sq); { Phase 1 - Swap left and right cell halves} CopyPixels(maskbits,tempbits,xRect,xRect,srcCopy,nil); OffsetRect(yRect,0,half_cell); CopyPixels(maskbits,tempbits,xRect,yRect,srcOr,nil); CopyPixels(ibp,tempbits,xRect,xRect,notsrcbic,nil); CopyPixels(tempbits,ibp,xRect,xRect,srcXor,nil); OffsetRect(yRect,-half_cell,-half_cell); CopyPixels(ibp,tempbits,xRect,yRect,srcXor,nil); CopyPixels(ibp,ibp,xRect,yRect,srcOr,nil); OffsetRect(yRect,half_cell*2,0); CopyPixels(tempbits,ibp,xRect,yRect,srcXor,nil); {Phase 2 - Exchange lower-right and upper-left cell quads} CopyPixels(ibp,tempbits,xRect,xRect,srcCopy,nil); OffsetRect(yRect,-half_cell*2,-half_cell); CopyPixels(ibp,tempbits,xRect,yRect,srcXor,nil); CopyPixels(maskbits,tempbits,xRect,xRect,notsrcbic,nil); CopyPixels(tempbits,ibp,xRect,xRect,srcXor,nil); OffsetRect(yRect,half_cell*2,half_cell*2); CopyPixels(tempbits,ibp,xRect,yRect,srcXor,nil); {Phase 3 - Refine mask for next smaller cell size} half_cell := trunc(half_cell/2); SetRect(xRect,0,0,trunc(sq/2),trunc(sq/2)); SetRect(yRect,0,trunc(sq/2),trunc(sq/2),sq); CopyPixels(maskbits,maskbits,hackRect,xRect,srcCopy,nil); CopyPixels(maskbits,maskbits,xRect,yRect,srcCopy,nil); SetRect(xRect,0,0,trunc(sq/2),sq); SetRect(yRect,trunc(sq/2),0,sq,sq); CopyPixels(maskbits,maskbits,xRect,yRect,srcCopy,nil); until (half_cell=0) ; showcursor; WaitForEvent(MouseDown); DisposeHandle(FindHandle(pixmap_1)); DisposeHandle(FindHandle(pixmap_2)); end; begin StartUpGSTools; ShowCursor; DoRotate; ShutDownGSTools; end. Subj: Re: Rotate Source Bug 89-03-01 00:02:36 EDT From: BRCCMAIL Please swap the parameters in the two NewHandle calls in the rotate source code in the previous message. The blocksize should come before the User ID. Dumb Mistake on my part. It should be: NewHandle((xRect.Bottom-xRect.Top)*Width,MyMemoryID,$C000+NoBankCross,Nil)^); Subj: HP DeskJet and TML Pascal 89-03-12 02:03:07 EDT From: DaveOesper In order to output character values greater than $7F to my printer, TML told me (in very general terms) on the phone that I had to make a TextTools call and change the set output mask and value to $FF (the default is $7F). I have only done "plain vanilla" PASCAL programming so far, so I have attempted to write a routine which does this, but it won't even compile. What have or haven't I done??? - David Oesper ***************************************************************** program MANYCHAR (input,output); uses QDIntf,ConsoleIO,TextTools; var printer : text; i : integer; begin SetOutGlobals($7f 0); rewrite(printer,'printer:'); for i := 161 to 254 do begin write(printer,chr(i)); end; writeln(printer); end. Subj: Re: More TML Pascal 89-03-12 02:13:48 EDT From: DaveOesper That should read SetOutGlobals($FF,0); After that wouldn't compile, I tried messing around with this statement in hopes of gaining an understanding of the problem. I uploaded one of my experiments by accident, instead of the statement above. Thanks in advance for your help! Subj: SetOutGlobals 89-03-12 02:27:08 EDT From: Dave Lyons The statement looks just fine: SetOutGlobals($ff,0); is perfect. It would help _immensely_ to know what error message occurs when you try to compile it. My best guess is you're getting Identifier Not Declared because you don't have "Uses TextTools;" in your program. (The TextTools unit declares SetOutGlobals.) Subj: Re: More TML Pascal 89-03-14 03:52:37 EDT From: DaveOesper Thank You, Dave! Yes, I got "identifier not declared," and I will do as you instructed. I am new at Pascal programming, so thanks for bearing with me. Dave Oesper Subj: SetOutGlobals Problem 89-03-25 00:51:59 EDT From: DaveOesper Dave et al, This program still will not correctly send characters with values $80 to $ff to the printer -- it maps everything from $00 to $7f. The program compiles and runs, but unlike with WordPerfect, I cannot print characters with hex values greater than $7f. What next? program MANYCHAR (input,output); uses QDIntf,ConsoleIO,TextTools; var printer : text; i : integer; begin SetOutGlobals($ff,0); rewrite(printer,'printer:'); for i := 161 to 254 do begin write(printer,chr(i)); end; writeln(printer); end. Subj: SetOutGlobals working for me 89-03-25 14:23:05 EDT From: Dave Lyons Dave O, I compiled & ran your program, with my ImageWriter II in hex-dump mode (hold down Select while turning it on), and your program _is_ sending characters with the high bit on. So...how do you know it isn't sending >128 values to your printer? Is there anything else it could be? Subj: Re: More TML Pascal 89-03-30 20:17:15 EDT From: HyperRam I just bought TML. And havn't gotten a book yet? Which one by the way should I get. I want it to be easy to understand and step by step. In otherwords-in English. I bought the programmer intro-I can't get pass the first page! Oh. On Applesoft Basic you can make statements like: Input A$ If a$="Wow" then goto 30 How can you do that on Tml?? Can you use numbers like 10, 20 like in basic on TML? Where are the goto's? Gee. I am dying on this. I'm out of asprin too! :) HyperRam Subj: beginning Pascal 89-03-30 21:42:55 EDT From: Dave Lyons (HyperRam already knows some of this by now.) READLN is the closest equivalent to INPUT. GOTOs are available in Pascal, but I strongly recommend you _not_ use them at all until you are familiar with the more legible control structures Pascal provides. For example, repeat write('Enter a number from 1 to 10: '); readln(n); until (n >= 1) and (n <= 10); --Dave Subj: Re: More TML Pascal 89-03-30 23:32:11 EDT From: SkipS If you're just starting out with Pascal and have only used Basic in the past, then you need to backup a few steps. You've probably have taken on too much at once. To program effectively on the IIgs you need a very sound understanding of Pascal AND a thorough understanding of the Toolbox programming techniques. They are two different tasks. Learn the basics about Pascal first (use the plain vanilla mode) and get a few Pascal books, like 'Oh! Pascal' or 'Pascal from Basic' and many others. After several weeks or months then you're ready for the tough part. The ToolBox. Unfortunately TML assumes you already understand both. When you are ready for the toolbox, get the 2 volumes on Toolbox programming from Addison Wesely (references, not tutorials) and then get a book like 'Apple IIgs Toolbox' which has several tutorial sections on Pascal Toolbox programming. Also, stay in tune here. I've learned alot from this place. Good Luck, skip Subj: Re: More TML Pascal 89-03-31 11:22:11 EDT From: HyperRam Thank you. Ram Subj: Re: More TML Pascal 89-04-01 17:58:04 EDT From: HyperRam I can't get the *&&^* thing working!!!! AHHH! TML Pascal v1.50A crashes aot now. It locks up!!!! Help!!!!!!!!!!! PROGRAM GOB (INPUT, OUTPUT); VAR A:STRING[10]; X,Y: INTEGER; BEGIN WRITELN ('HI RAM'); FOR X:=1 TO 300 DO FOR Y:=1 TO 300 DO; WRITELN; WRITELN ('SIT DOWN'); WRITELN; WRITELN ('WHILE I SET THINGS UP'); FOR X:=1 TO 300 DO FOR Y:=1 TO 300 DO; WRITELN ('PLEASE PRESS A OR B'); READLN (A); END; IF (A='B') OR (A='b') THEN BEGIN WRITELN ('YOU PRESSED B, PLEASE PRESS RETURN'); READLN; END; IF (A='A') OR (A='a') THEN BEGIN WRITELN ('YOU PRESSED A'); WRITELN ('PRESS RETURN'); READLN; END; END. Subj: SetOutGlobals Problem 89-04-02 01:50:59 EDT From: DaveOesper Dave Lyons, thanks for compiling and running my program. I'll look into the matter further and see why I am not getting characters > 127 to come out on my HP DeskJet. Maybe a dip switch needs to be set differently, though WordPerfect 2.1 has no problem sending such characters with exactly the same configuration I am using for TML Pascal. Thanks for the help! David Oesper Subj: extra ENDs 89-04-03 01:46:18 EDT From: Dave Lyons HR, as you already know, the program you posted a few messages back had an extra END in it part-way through. The compiler treated that as the END matching up with the main BEGIN, and then it probably said that a "." was expected. Every END matches up with a BEGIN, a CASE, or a RECORD. (Did I get them all?) Subj: Re: Program crashes 89-04-03 01:49:05 EDT From: Beyonder 9 HyperRam I know why your program crashes. you have too many "end;" stsatements. I have placed a copy of your program below, pointing out the problem statements. PROGRAM GOB (INPUT, OUTPUT); VAR A:STRING[10]; X,Y: INTEGER; BEGIN WRITELN ('HI RAM'); FOR X:=1 TO 300 DO FOR Y:=1 TO 300 DO; WRITELN; WRITELN ('SIT DOWN'); WRITELN; WRITELN ('WHILE I SET THINGS UP'); FOR X:=1 TO 300 DO FOR Y:=1 TO 300 DO; WRITELN ('PLEASE PRESS A OR B'); READLN (A); END; <----- shouldn't be there IF (A='B') OR (A='b') THEN BEGIN WRITELN ('YOU PRESSED B, PLEASE PRESS RETURN'); READLN; END; <----- Same IF (A='A') OR (A='a') THEN BEGIN WRITELN ('YOU PRESSED A'); WRITELN ('PRESS RETURN'); READLN; END; <------once again END. Subj: Not fast enough 89-04-03 02:01:06 EDT From: Beyonder 9 It seems Dave beat me to the answer by a few minutes. But it was close. Chad Parker (also Chad P1) Subj: Huh? 89-04-03 22:32:32 EDT From: MikeW50 I missed the point. Granted, the program has an error. That diserves an error message. What was it that caused the crash? Mike Westerfield Subj: crash? 89-04-04 21:47:24 EDT From: Dave Lyons Mike, unless one of those guys informs me otherwise, I'll assume that "crash" meant that there was an error message during the compile. Subj: Re: More TML Pascal 89-04-05 00:12:37 EDT From: HyperRam No. The program TML Pascal locked up-it's not GSOS, I tried the ancient P16 way too. Sometimes after returning from my _awesome_ (hehe) programs it will lock up. Others times when it feels good and ready it will lock. Subj: Re: More TML Pascal 89-04-06 23:57:45 EDT From: SkipS HyperRam, I got to say something here. I've seen all your problems with AWGS and I'm sure most of the problems are with AWGS and some are probably with GSOS. But with ALL of the problems I'm seeing you have (now this one), nothing can really explain it except you got some computer malfunctions that are out of the ordinary! Now, its really difficult to analyze from here what they are, but I got to guess you probably have some bad RAM somewhere. You can run diagnostics by using the self-test and the diagnostic program available here on AL. Unfortunately, they aren't the best tests, but it's at least a start. You might try carefully duplicating the conditions that caused an error and see if the error keeps happening in a somewhat consistent manner. Then try moving your RAM chips in large chunks. Like swapping position of upper with lower RAM. Then see if the problem changes (ie goes away or something totally different goes wrong). If it changes, you probably have bad RAM. Another thing is to recopy your soft ware from the original disks to eliminate the possibility of corrupted files. With your problems, I'd start with GSOS. Good Luck and don't get discouraged! Skip PS - I don't know you, so let me say (hopefully, with tact) that you gotta power off when working inside the box. Also, be sure to ground yourself before touching the RAM chips to prevent ESD damage to the chips). Skip Subj: It doesn't hang for me.... 89-04-07 00:47:46 EDT From: Dave Lyons I'm trying to figure out why TML Pascal is hanging for you and not for me, HR. I know you aren't using toolbox calls yet...there should nothing your own programs could be doing to hang the machine, just using readln/writeln, for loops, etc. Do you have any CDAs and NDAs installed? You might try working without any of them for a little while and see if you have the same sorts of problems. Subj: Re: More TML Pascal 89-04-11 08:03:06 EDT From: HyperRam Yeah. Um, I got, Fommater Control Panel Catche Memory thats all I can remember. It isn't hanging as much. How do you use a boolean. In snytax. Subj: using booleans 89-04-12 03:46:44 EDT From: Dave Lyons Try studying the syntax charts! Examples: var TimeToStop: boolean; TimeToStop := false; TimeToStop := true; if TimeToStop then blahblahblah else blahblahblih; repeat blah until TimeToStop; if 1=2 then blah; The expression "1=2" has the boolean value "false". Look up "relational operators" in Oh! Pascal! for more examples. (Just guessing that you'll find that in the index--mine copy's in a box.) --Dave Subj: Re: Pascal Books 89-04-12 23:38:31 EDT From: SkySinger This is a copy of a letter I sent to someone who asked me about some books that might be good for learning Pascal (TML). The information might be useful for someone else too, so I'm including it here ... James, I haven't seen "Oh Pascal" so I can't compare it to the books I worked with. Here are some of the books I used: 1) "Pascal Wizard -- A Wiley Programmer's Reference" by Richard Wiener, published by Wiley. This gives a clear and orderly presentation of all aspects of the language. One of its best features is that it describes the language in less than 100 pages (if you skip the last few sections of the book which deal with particular extensions of the language that may not be of any use to you). 2) One book that I found useful, since I used to program a great deal in BASIC was "PASCAL for BASIC Programmers" by Charles Seiter and Robert Weiss (published by Addison Wesley). It points out the features in Pascal that accomplish the same things as familiar BASIC statements, and also introduces the features of Pascal which are not available in BASIC (although if you're tricky in BASIC I think you can do most anything). 3) Another book I used a bit is the one they often recommend in Computer Science classes since one of the authors is the developer of the Pascal language. Its called "Pascal -- User Manual and Report" by Jensen and Wirth, published by Springer-Verlag. This book has more of a "technical" feel to it and uses more computer science notation. However, it also gives some very good short descriptions of features of the language. I found it useful for reference and to help clarify some points I wasn't too clear about. However, one of the best ways to learn Pascal (or any language), after you're familiar with at least some of the features of language, is to find a lot of short example programs that demonstrate specific things, otherwise the information gets overwhelming. All of the above books are useful if you're going to use the "Plain Vanilla" mode of TML Pascal, which is typical Pascal. However, once you start to use the ToolBox in the IIGS (which can be a life long endeavor) you should definitely look at "Programmer's Introduction to the Apple IIGS" which gives invaluable examples of ToolBox programming using TML Pascal. You'll also need both volumes of the "Apple IIGS Toolbox Reference". ToolBox programming is a pretty massive undertaking, and, if you decide you can't live without it, you should have a good working knowledge of Pascal BEFORE you attempt it. Pascal is a nice language to work in. I think you'll find it an enjoyable programming experience. Good luck with it... -- David Subj: Re: Identifier not declared!? 89-04-13 18:07:50 EDT From: HyperRam PROGRAM TESTIII (INPUT, OUTPUT); VAR KEYPRESSED:BOOLEAN; A:STRING[10]; BEGIN WRITELN ('THIS IS ANOTHER TEST!'); WRITELN ('PRESS ANY KEY......'); REPEAT UNTIL KEYPRESSED; {HOME;} WRITELN ('IT WORKED!!!'); READLN; END. What am I doing wrong? I want to use a home statement (like in basic) and I want it to activate on any keypresses. Auugh Subj: ConsoleIO 89-04-14 01:39:08 EDT From: Jump Long HOME isn't part of TML Pascal. If you'd like something similar to use in "vanilla" mode, try including the ConsoleIO unit. ConsoleIO includes KeyPressed (something like Applesoft's GET, but doesn't return the keystroke), ReadChar (like Applesoft's GET), GotoXY (like Applesoft's HTAB and VTAB together), EraseScreen (like Applesoft's HOME), ClearEOL (like a CALL-868), InsertLine, and DeleteLine (Applesoft has no equivalents for these two). ConsoleIO also includes some string <-> number conversion functions and a procedure to set the color of the pen. JML Subj: Re: More TML Pascal 89-04-14 16:14:42 EDT From: HyperRam Put it in syntax, I don't know crap about Pascal! Where do you put Consol IO? The is getting discouraging! Subj: Re: More TML Pascal 89-04-14 21:35:38 EDT From: HyperRam How do you use units!? When I try to run a program with a QDIntf or whatever it goes-unit blah blah whatever it says. Subj: Re: More TML Pascal 89-04-14 21:36:41 EDT From: HyperRam How else to you avoid gotos!? How do you make HGR graphics? How do you make the TMLPascal at the top dissapear? I don't know how to use dialog boxes. Can you give me a list of the Pascal command that are equal to the ones I used in BASIC? I am dying badly. Subj: Re: More TML Pascal 89-04-15 01:18:37 EDT From: HyperRam PROGRAM TEXTGAME (INPUT,OUTPUT); USES CONSOLEIO; VAR {LABEL 1,2,3,4;} A:STRING[10]; B:STRING[10]; {DEFINE VARIBLES} C:INTEGER; D:BOOLEAN; PROCEDURE START; ERASESCREEN; PROCEDURE RAM; WRITELN('WELCOME TO RAM''S COOL TEXT GAME!!!'); WRITELN; WRITELN ('PRESS ANY KEY TO START........'); REPEAT UNTIL KEYPRESSED; BEGIN START RAM END. I cant get those goto xy's to work!!!! AHH Subj: Re: More TML Pascal 89-04-15 05:47:45 EDT From: HyperRam Pascal sucks!! You can't do nearly as much as basic!!! Boo!! I hate it!! It's much more complicated and stupider!!!! Boo!! I can't even finish this game!!!! PROGRAM TEXTGAME (INPUT,OUTPUT); USES CONSOLEIO; LABEL 1,2,3; VAR A:STRING[10]; B:STRING[10]; {DEFINE VARIBLES} C:INTEGER; D:BOOLEAN; PROCEDURE START; BEGIN ERASESCREEN; WRITELN('WELCOME TO RAM''S COOL TEXT GAME!!!'); WRITELN; WRITELN ('PRESS ANY KEY TO START........'); REPEAT UNTIL KEYPRESSED; END; {OF START} PROCEDURE STORYLINE; BEGIN ERASESCREEN; WRITELN('In the year of 2132 the planet Earth was attacked by aliens from'); WRITELN('the planet Zorgairian. All hope was lost once the aliens took most'); WRITELN('cities. The aliens have devastated the planet and you are the earth''s'); WRITELN('hope. Fight bravely....... The world is at stake!'); WRITELN; WRITELN('Press any key to continue.......'); REPEAT UNTIL KEYPRESSED; END; {OF STORYLINE} PROCEDURE TEXT1; BEGIN 3:ERASESCREEN; WRITELN ('YOU LOOK AROUND AND ARE SURROUNDED BY DELAPDATED BUILDINGS AND WRECKAGE'); WRITELN ('OF OLD AUTOMOBILES AND GARBAGE. ONE PATH LEADS NORTH TO NEW NEW YORK CITY,'); WRITELN ('AND ANOTHER PATH LEADS EAST TOWARD AN OCEAN'); WRITELN;WRITELN ('(N, E)'); READLN(A); IF (A='N' or 'n') THEN GOTO 2; ERASESCREEN; WRITELN ('YOU MOVE ON UP THE PATH LOOKING AROUND. AS THE BUILDINGS COME INTO VIEW.'); WRITELN ('YOU SEE A SMALL SHACK. THEN FROM A DISTANCE YOU THINK YOU HEAR THE WHIRR'); WRITELN ('OF AN ALIEN SKIMMER!'); WRITELN;WRITELN('(DUCK INTO SHACK, RUN, GO BACK)'); READLN(B); IF (B='duck into shack' or 'Duck into shack' or 'DUCK INTO SHACK') THEN BEGIN ERASESCREEN; WRITELN('YOU DUCK INTO THE SHACK. AS THE SKIMMER PASSES BY Subj: Re: More TML Pascal 89-04-15 14:01:32 EDT From: HyperRam Pascal now refuses it's OWN rules!!! PROGRAM TEXTGAME (INPUT,OUTPUT); USES CONSOLEIO; VAR A:STRING[10]; B:STRING[10]; {DEFINE VARIBLES} C:INTEGER; D:BOOLEAN; PROCEDURE START; BEGIN ERASESCREEN; WRITELN('WELCOME TO RAM''S COOL TEXT GAME!!!'); WRITELN; WRITELN ('PRESS ANY KEY TO START........'); REPEAT UNTIL KEYPRESSED; END; {OF START} PROCEDURE STORYLINE; BEGIN ERASESCREEN; WRITELN('In the year of 2132 the planet Earth was attacked by aliens from'); WRITELN('the planet Zorgairian. All hope was lost once the aliens took most'); WRITELN('cities. The aliens have devastated the planet and you are the earth''s'); WRITELN('hope. Fight bravely....... The world is at stake!'); WRITELN; WRITELN('Press any key to continue.......'); REPEAT UNTIL KEYPRESSED; END; {OF STORYLINE} PROCEDURE TEXT1; BEGIN ERASESCREEN; WRITELN ('YOU LOOK AROUND AND ARE SURROUNDED BY DELAPDATED BUILDINGS AND WRECKAGE'); WRITELN ('OF OLD AUTOMOBILES AND GARBAGE. ONE PATH LEADS NORTH TO NEW NEW YORK CITY,'); WRITELN ('AND ANOTHER PATH LEADS EAST TOWARD AN OCEAN'); WRITELN;WRITELN ('(N, E)'); READLN(A); IF (A='N') or (A='n') THEN BEGIN ERASESCREEN; WRITELN ('YOU MOVE ON UP THE PATH LOOKING AROUND. AS THE BUILDINGS COME INTO VIEW.'); WRITELN ('YOU SEE A SMALL SHACK. THEN FROM A DISTANCE YOU THINK YOU HEAR THE WHIRR'); WRITELN ('OF AN ALIEN SKIMMER!'); WRITELN;WRITELN('(DUCK INTO SHACK, RUN, GO BACK)'); READLN(B); IF (B='duck into shack') or (B='Duck into shack') or (B='DUCK INTO SHACK') THEN BEGIN ERASESCREEN; WRITELN('YOU DUCK INTO THE SHACK. AS THE SKIMMER PASSES BY, WHEW!'); END; BEGIN START; STORYLINE; TEXT1; END. It says error in startment! Cheap! Subj: Re: More TML Pascal 89-04-15 16:58:55 EDT From: Jump Long Match your BEGINs and ENDs... -JML Subj: Re: More TML Pascal 89-04-16 00:16:09 EDT From: HyperRam I did! Nothing wrong! This is cheap! Subj: Re: More TML Pascal 89-04-16 13:33:56 EDT From: AFL Dyfet Subj: How do you use it? 89-04-16 00:18:21EDT From: HyperRam Msgs: 1 (89-04-16) How do you use the toolbox commands in TML Pascal? IN SYNTAX TOO PLEASE!!! Subj: Re: CHARATER PROBLEMS! O MY GOD! 89-04-17 02:10:17 EDT From: HyperRam How come sometimes text turns invisible but when you delete, charaters 7 spaces back get deleted? Then sometimes Ill type something and part of it will appear, ex:I type GOTOXE then E will appear on the next line, sometimes whole lines are reproduced! It gets really weird. Then when it starts acting up it will crash-the pull down menus won't open etc. This is getting to be dangerous! Ram Subj: Re: Goto XY(64,98) or AHHH! 89-04-18 18:30:54 EDT From: HyperRam Ohh! I think I MAJORLY screwed up! Is it like this-GOTOXY (44,44) or GOTO (44,44)? I put GOTO(44,44). And, um, what command do you use to draw. I know Drawstring-but out right drawing? Ram Subj: Re: BASIC to Pascal 89-04-18 20:20:46 EDT From: SkySinger HyperRam, Stop freaking out. TML works just fine. You've got to take the time to learn Pascal (before you attempt any toolbox calls). You asked for a list of Pascal commands that correspond to BASIC commands. There's a book called "Pascal for BASIC programmers" by Charles Seiter and Robert Weiss, published by Addison Wesley. It shows you how to change BASIC to Pascal and also introduces elements of Pascal that are not found in BASIC. Its a good place to start. Subj: Re: More TML Pascal 89-04-19 18:15:59 EDT From: HyperRam Still, when the characters start dissapearing-CRASHO! Subj: Re: More TML Pascal 89-04-20 12:27:27 EDT From: HyperRam {i am finally starting to 'get' booleans! Can someone help me with this. I got the procedures messed up a bit. I don't know how to catalog or exit to basic either! :)} PROGRAM STARTUP (INPUT, OUTPUT); USES CONSOLEIO; VAR A:STRING[10]; Z:REAL; B:REAL; C:BOOLEAN; D:INTEGER; E:STRING[255]; PROCEDURE CATALOG; BEGIN ERASESCREEN; WRITELN('SORRY, THIS FUNCTION IS NOT OPERATIBLE YET....'); WRITELN('PRESS ANY KEY TO CONTINUE....'); REPEAT UNTIL KEYPRESSED; STARTUP; {GOES BACK TO STARTUP MAINMENU} END; PROCEDURE EXITTOBASIC; BEGIN ERASESCREEN; WRITELN('SORRY, THIS DOESN''T WORK YET.....'); WRITELN('PRESS A KEY TO CONTINUE'); REPEAT UNTIL KEYPRESSED; STARTUP; {GOES TO MAINMENU} END; PROCEDURE RAMSUPERCALC; BEGIN ERASESCREEN; WRITELN ('PRESS ENTER TWO NUMBERS TO ADD'); WRITELN ('ENTER YOUR FIRST NUMBER!'); READLN(B); WRITELN;WRITELN('PRESS ENTER YOUR SECOND NUMBER NOW MISTER!!!!!'); READLN(Z); WRITELN;WRITELN ('THE SUM IS ',B+Z,'DOPE!!!!!'); WRITELN;WRITELN('PRESS ANY KEY TO CONTINUE!!!'); REPEAT UNTIL KEYPRESSED; STARTUP; END; PROCEDURE STARTUP; BEGIN REPEAT C:=TRUE; GOTOXY(25,2); WRITELN ('STARTUP'); WRITELN; WRITELN ('1. CATALOG DISK'); WRITELN; WRITELN ('2. EXIT TO BASIC'); WRITELN; WRITELN('RUN SUPERRAMCALC3A'); WRITELN;WRITELN('PLEASE PICK ONE.....'); READLN(A); IF (A='1') THEN CATALOG; IF (A='2') THEN EXITTOBASIC; IF (A='3') THEN RAMSUPERCALC; C:=FALSE; UNTIL C:=TRUE; <-----for some reason it says error there. END; BEGIN STARTUP; END Subj: "=" vs. ":=", and editor problem 89-04-21 00:25:21 EDT From: Dave Lyons ":=" is for assigning a new value to a variable, and "=" is for testing two values for equality. The error message is perfectly correct (as I mentioned earlier in mail to HR). I have occasionally had the TML Pascal standalone editor do strange things to me while editing at the very end of the file. I recommend putting a couple blank lines at the end and leaving them there, but it isn't usually a problem. Subj: Re: More TML Pascal 89-04-22 04:54:39 EDT From: HyperRam What kind of books should I buy? I already got Oh! Pascal! and Pascal for Basic Users is coming. What else, and I mean in English, understandable, not going off like Oh! Pascal. Ram Subj: QUILITY JOB #9999999999999999!!! 89-04-22 16:01:55 EDT From: HyperRam This is getting annoying! It keeps on doing weird stuff with charaters. Like drawing half an I beam next to a letter! ANd I made a program-well part of one procedure says writeln('Divide by...') and it doesn't show up sometimes when I compile it into memory!! I get it to appear when I compile it to disk and run it there tho! How cheap! And it STILL crashes, hangs, locks whatever. I hope APW will read my files becuase TML Pascal isn't working right. Subj: No bad chips. 89-04-22 16:13:32 EDT From: HyperRam I got my chips checked before. Nothing. Hmmmm. Anyone wanna check out my great program? :) Subj: Random numbers 89-04-23 15:07:19 EDT From: Crescendo Recently I was attempting to program something in TML Pascal and noticed that there was no number generator. All right, so how do I go about creating one? Subj: Exit to basic, catalog, stack. 89-04-24 03:39:47 EDT From: HyperRam Can anyone help me with my program (vanilla)? I want it to be able to exit to basic-I know you need Basic system and catalog via typing in the pathname. Also what is a stack? And how do you reboot a slot from Pascal? Ram P.S. I still can't figure out graphics, anyone who knows anything please help. Subj: GLOBALS TOO... 89-04-24 03:46:53 EDT From: HyperRam What are globals? Subj: Help!!! 89-04-24 13:01:33 EDT From: HyperRam A textgame is too complexed!! I don't get ANYTHING in graphics!! Help please!!! I can't get this to work dave, Program text(input, output); uses consoleio, qdintf, gsintf; var x:boolean; begin writeln('HI! Press a key!!'); Repeat until keypressed; x:=flushevents(32+8); erasescreen; writeln('hi'); repeat until keypressed; x:=flushevents(32+8); end. TML Pascal is HANGING alot now-everytime I use it. :( Subj: FlushEvents 89-04-25 00:14:14 EDT From: Dave Lyons FlushEvents I explained in mail: try FlushEvents(32+8,0); to get rid of a keypress. Please elaborate on exactly WHEN it hangs, what is on the screen, and whether the mouse will move. What do you mean "I don't get anything in graphics"? Subj: Re: More TML Pascal 89-04-25 07:45:19 EDT From: HyperRam It crashes like this-it locks, mouse still moves-pull down windows work etc. I have gotten it to crash MORE when launching it from v4.0 system disk. My system configuration 1.25 megabytes an AE Ramkeeper Stereo card etc etc Subj: IT WON'T WORK! 89-04-25 07:55:29 EDT From: HyperRam PROGRAM TEXT(INPUT,OUTPUT); USES CONSOLEIO, QDINTF, GSINTF; VAR X:BOOLEAN; BEGIN WRITELN('HI'); REPEAT UNTIL KEYPRESSED; X:=FLUSHEVENTS(40,0) {<--operands ARE NOT ASSIGNABLE!!!} ERASESCREEN; WRITELN('HI'); REPEAT UNTIL KEYPRESSED; X:=FLUSHEVENTS(32+8,0) END. {<----OPERANDS ARE NOT ASSIGNMENT COMPATIBLE} Subj: Re: Problems with FOR statement 89-04-25 21:04:58 EDT From: ErikCh I just purchased TML Pascal last week (I have version 1.50, is this still the latest...). I am writing a "plain vanilla" program to help me workup scientific data. The problem is this: In a procedure, I have a FOR Z:=1 to N statement. I am reading data from an array using Z as the index. I have declared Z as an integer locally. The problem is that Z always starts from 0 and not from 1 and then counts up to N normally! I don't understand why this is occurring because I have FOR statements in the main body of the program which work fine. Please help...I'm going nuts... Erik Subj: operands not assignment compatib 89-04-25 22:49:37 EDT From: Dave Lyons That means that X and FlushEvents are not the same type. Try making X an integer instead. (I don't have my TML Pascal available to me yet, still.) Look for the declaration of FlushEvents in the GSIntf unit in the book. It will probably say something like function FlushEvents(...): integer; Subj: FOR loop problem? 89-04-25 22:51:44 EDT From: Dave Lyons Erik, let's see some code.... Subj: Re: More TML Pascal 89-04-26 00:00:29 EDT From: HyperRam I have eriks problem too! You know Dave, when you made that ADDITION procedure where you input how many numbers you add, I did that for subtract and it ALWAYS starts from 0! I checked everything! Ram Subj: ANSWER-TML SUCKS! 89-04-26 01:29:19 EDT From: HyperRam O.K. erik-I had the same problem then I compiled to disk and ran it and it didn't happen! Sometimes it doesn't compile right and it leaves out sentences like my DIVIDE BY and now it does this. My hyposthesis-TML Pascal sucks, for me it's-run-messup-crash these days! Subj: Re: Tenative Fix... 89-04-26 20:27:14 EDT From: ErikCh I found a way to fix my problem. Before the FOR statement, I set the counter equal to 1... Z:=1; FOR Z:=1 TO N This seems to clear up the problem. The actual segment of code follows... PROCEDURE CALCULATE; VAR Z: INTEGER; BEGIN YTot:=0; XYTot:=0; FOR Z:=1 TO N DO BEGIN YTot:=YTot+(ln(Inf-Cond[Z])); XYTot:=XYTOT+(Time[Z]*(ln(Inf-Cond[Z]))); END; END; This FOR loop always starts with Z=0! Time[0] and Cond[0] are not defi Subj: Re: More TML Pascal 89-04-27 07:04:54 EDT From: HyperRam Dave, I am working on the multipling one in my program and I want it to be like that addition one. But I can't figure how to make it! Subj: Re: TML Pascal 1.5A & GS/OS 89-04-27 18:29:04 EDT From: RobB18 I have a question: I believe I have found a bug or deficiency in TML with relation to GO/OS. Let me use the CREATE GS/OS call as an example. I have built the record type with all the parameters to pass to the GS/OS call. The one to note in particular is the PathName. I have it defined as a STRING. I set the longword pathname pointer equal to @PATH (PATH is my string). I fill in the other parameters: pCount = 4, Access = $00C3, FileType = $0004, AuxType = $00000001. I call CREATE like so: Procedure Create(Var p:CreateParam); ProDOS $2001; Create (c); Where c is my createparam record. I have check this much out: when I make the call from the GS/OS exerciser and examine the memory where the pathname is located I find: 1st the length byte, followed by a $00, followed by the string. After examining my TML String in memory I found: 1st, the length byte, followed immediately by the string. How do I create a string variable in TML with the 2 length bytes (if thats what they both are?) RobB18 P.S. I am using TML Pascal 1.5A Stand Alone Version Subj: Re: More TML Pascal 89-04-27 20:53:34 EDT From: HyperRam What is create gs/os? Subj: Re: Create GS/OS 89-04-27 22:51:51 EDT From: RobB18 Create is a GS/OS application level command. It will create a file on disk. You could then open it, read from it, write to it, delete it, etc... They are called much like toolbox commands. Subj: FOR loops? ; CREATE 89-04-28 00:50:23 EDT From: Dave Lyons HR or Rob: please email me the simplest complete program you can come up with that demonstrates the difficulty with FOR loops. I've never had trouble with it. Hopefully tomorrow I'll have my TML Pascal & everything available to me again. "STRING" in TML Pascal is a Pascal-style string, also known as a ProDOS string or a class 0 string. The first byte of one of these gives the length, so the maximum length is 255 characters. The $20xx calls in GS/OS want class 1 strings. Class 1 strings have a length WORD (2 bytes), so the maximum length is 65535 characters. (The actual maximum length handled by GS/OS is currently about 8000 characters.) If your strings will all be less than 256 characters long, you can build the string starting with the second character and force the first character (after the length byte) to be 0. MyString[1] := chr(0); Note that Pascal's idea of your string's length INCLUDES that second byte of the length, so be careful. --Dave Subj: Re: More TML Pascal 89-04-28 07:47:42 EDT From: HyperRam You can put CHR(4)'s in Pascal? God-I wanna be able to transfer or exit to basic or catalog and graphics to! That dumb book-Pascal for Basic Users STILL isn't in. It probably won't help. I don't know that much in Basic either-just AppleSoftBasic. I want to (tried of saying wanna:) TRY to make a multiply module that goes- Enter the multiple. Then 'How many numbers do you want tio multiply it with?' that stuff. Anyone want to help me with a text game? I am STILL gone on graphics. OO! This is confusing. Ram Subj: TML PASCAL SUCKS!!!! 89-04-28 20:01:28 EDT From: HyperRam It's dumb! Now it crashes when I compile a program!! Maybe it's the TransWarp GS, I don't know. Doesn't anyone want to help me with a desktop application, graphics, or a textgame? (no) I hate this!! I want to add choices to the GS demo and how to you make the dialog boxes bigger? I want to make my own dialog boxes too!! Help!! Subj: Re: More TML Pascal 89-04-28 20:23:19 EDT From: HyperRam How can you add choices to GS demo???? ahh! The compile isn't working!! Subj: Re: GS/OS Pathname strings 89-04-29 12:46:00 EDT From: RobB18 I believe I have solved the problem thanks to Dave Lyons suggestion. Here is a simple procedure that will convert a normal Pascal string into a word length byte type string for GS/OS calls: Procedure Gstring(Var GSstring : String; Expand : Boolean); Var X : Integer; Begin If Expand Then Begin For X := Ord(GSstring[0]) DownTo 1 Do GSstring[X+1] := GSstring[X]; GSstring[1] := Chr(0); End Else Begin For X := 2 To Ord(GSstring[0]) + 1 Do GSstring[X-1] := GSstring[X]; GSstring[Ord(GSstring[0]) + 1] := Chr(0); End; End; Expand should be True to convert a normal string to GO/OSable string, and false to convert a string returned from GS/OS back to a normal Pascal string. Maybe this will help some other working in this area. Anyone see anything in error with this procedure??? It seems to work just fine. Subj: Re: More TML Pascal 89-04-29 17:17:26 EDT From: HyperRam i don't get Str255. It goes error error. SO I just put String[255]. I finally got somewhere in graphics- R:Rect With r do begin top:=100; left:=100; bottom:=200;right:=0; end; Paintrect (r); and i made a rectangle. It's too hard to makre a good shape-HGR is MUCH better for graphics Subj: Pseudorandom Numbers 89-04-30 02:45:50 EDT From: Jump Long Crescendo: If your application is running in TML's "Plain Vanilla" mode or is a desktop application, then QuickDrawII is already started for you and you can use the RANDOM function included in QuickDrawII. RANDOM returns a pseudorandom integer number between -32768 and 32767. See page 192 of the TML Pascal stand alone manual for the interface file definition. See page 16-202 in the Apple IIGS Toolbox Reference for a description of the toolcall. --JML Subj: Re: More TML Pascal 89-04-30 08:46:40 EDT From: HyperRam O my god! I made a black square!! It's a start to graphics!! :)) Subj: Re: More TML Pascal 89-04-30 19:26:03 EDT From: HyperRam Can someone tell my why the cheap thing doesn't work? PROGRAM GRAPHICSIII(INPUT,OUTPUT); USES CONSOLEIO, QDINTF, GSINTF; VAR I:Integer; A,B,C:Str255;R:Rect;X:INTEGER; Procedure Draw2; Var D:Rect; Begin WIth d do begin Top:=100;left:=100;bottom:=100;right:=100; end; setforecolor(5); SETBACKCOLOR(1); paintrect(d); end; Procedure Draw1; Begin with r do begin Top:=20; left:=20; bottom:=20; right:=20; end; setforecolor(0); Paintrect(r); DRAW2; end; BEGIN DRAW1; READLN; END. Subj: Re: More TML Pascal 89-05-02 00:21:24 EDT From: ESeasholtz HR, your best bet would be to sit down and read a good introductory book on Pascal. Then, read your TML Pascal book from cover to cover. My TML Pascal works just fine... From all those code segments that I just had to read through, it looks like you just don't have a handle on the language yet. It'll get there... Subj: Re: More TML Pascal 89-05-02 00:25:23 EDT From: ESeasholtz HR, A stack is a storage area in memory. When you put things on the stack, you store them there so that you can free up your registers to do other things. Or, if you are using tool sets, you have to put some information on the stack before you call the tool that you need to use so that it can have the information available. You have to be sure to remove just the same amount of information from the stack that you put onto it or your program is going to go nuts... Subj: Re: More TML Pascal 89-05-02 00:29:15 EDT From: ESeasholtz HR, you can't just exit to basic from GS/OS. Basic.System is a Prodos 8 application and GS/OS is a 16 bit application. If you want to run Basic, you have to launch it and there you're getting into something a little deeper. Also, reading in a catalog is a little more involved as well. What you have to do is set up a data structure that will contain all of the information that will be returned, and then make a call to the operating system to read the directory. ORCA/Pascal has a very hand unit called GSOS already set up to make the call. But, that's going to get pretty deep as well... Subj: Applesoft vs. QuickDraw II? 89-05-02 02:01:35 EDT From: Dave Lyons Str255 is defined in QDIntf, I think. So you have to say USES QDIntf if you want to use it. Or you can declare it yourself, like TYPE Str255 = String[255]; at the appropriate place in your program (after CONSTs, before VARs). I don't agree that QuickDraw II is much harder to use than Applesoft's graphics commands, and QD is *much* more powerful. If you want to draw lines, try MoveTo and LineTo (also Move and Line to move by a certain distance rather than a particular point). Subj: Why HR's PaintRects do nothing 89-05-02 02:05:43 EDT From: Dave Lyons HyperRam, when you set the top, bottom, left, and right of a rectangle all to the same value, you have successfully created an EMPTY rectangle. When you paint an empty rectangle, you don't see anything very interesting happen to the screen. (Because nothing interesting DOES happen to the screen, unless you happen to knock it onto the floor at that exact moment.) Subj: Re: More TML Pascal 89-05-02 23:30:18 EDT From: HyperRam The how do you draw nice 'high resolution' pictures? In HGR (APPLESOFT BASIC) you can make nice pictures if you put your mind to it.... Ram Subj: More, more, more TML Pascal 89-05-03 18:17:14 EDT From: HyperRam I ordered Pascal for BASIC Users awhile ago and they say it won't come in for sometime. :( Can *someone* help me with graphics? E mail(If you can) me syntax to draw a shape, any shape, I don't care as long as it's not what I made-an ugly black square. Does anyone have any ideas to WHAT I could make in the first place? (Anything that I CAN make that is:) Here is all I can do with QuickDrawII, With R do begin Top:=10;Left:=10;Bottom:=10;Right:=10; end; Paintrect(r); I know it's _really_ sad and you can laugh but is there anything else besides rects? Subj: What's wrong with GOTO's!!?? 89-05-03 19:13:38 EDT From: HyperRam Why can't you use gotos!? No, I can't write a game unless I use gotos and you can't use them in procedures! god! I'll never get anywhere without them! Even with procedures it's ALOT more of a mess without them! It's like making a table with 700 legs! First you always have to define a procedure! Thats a pain! WHy can't you go Var: Procedure Start; and then have a procedure start!? In fact, I'm not getting ANYWHERE like this! I don't know what a recursive langauge is and I can't plan it on paper either because something ALWAYS goes wrong! You can't do that, or this, or that! Oh no, your varible isn't declared so you can't run you program! AppleSoft BASIC must of been actually planned. In the book, Oh! Pascal! It says:Gotos may be easier for people to use instead of implentmenting Pascal alternatives. It's ALOT easier! And FASTER! When even I use Repeat until I get confused! I don't know what while does and how to use it but I'm sure BASIC would be more efficient! I have no idea what a function is and the manu als and books aren't clear either. I don't even know why I have the Programmers Introduction or the ToolBox book 1 if I'm never going to use them. I wanted to use Pascal to make games and programs and ndas/cdas but I don't think I'll ever get there at this rate. I'm not even that good at AppleSoft BASIC either! What am I going to do? Better yet, what CAN I do? Isn't there a book thats fairly understandable, doesn't use math and gets to the point? I doubt even Pascal for Basic Users will be much of help. Ram(lost, confused, and dying very badly in this complicated langauge) Subj: QuickDraw; GOTOs; etc 89-05-04 07:04:12 EDT From: Dave Lyons HR, you asked a lot of good questions in that last message, and I promise I'll deal with them when I get back from AppleFest (gotta leave in 2 hours). There is TONS of stuff in QuickDraw II besides rectangles. Try LineTo; it's a lot like HPLOT TO. (Use MoveTo to start somewhere, then lots of LineTo's to draw lines.) Some of the stuff QuickDraw II has besides rectangles: lines, round rectangles, arcs, ovals, regions, polygons. You *can* use GOTOs inside procedures; it may be a little easier to write your program in the first place using GOTOs, but I guarantee you that you *and* other people will have a harder time understanding how the thing is supposed to work. Subj: Re: More TML Pascal 89-05-04 07:26:32 EDT From: HyperRam I checked out some books-Pascal for BASIC Users, Introduction to Pascal, Pascal Programming and Learning Pascal STep by STep. Ahh! None of them have helped me. Why does everyone get Pascal taught to them in college? Subj: Re: More TML Pascal 89-05-04 07:28:58 EDT From: HyperRam You can't jump OUT of procedures tho. Subj: Why doesn't it work? 89-05-04 12:44:36 EDT From: HyperRam Program Graphics4(Input,Output); Uses ConsoleIO, QDIntf, GSIntf; Var Count, howmany:integer; A:Str255; Begin EraseScreen; WriteLN('Please enter a number..'); ReadLN(HowMany); ERASESCREEN; For count:=1 to howmany do begin LineTO(Howmany, howmany); End; GotoXY(15,25); WriteLN('Please press return'); ReadLN; end. First of all the GotoXY won't work, it compiles but none of the results are intended! I want it to draw a shape like this-let's say I enter 6. It will keep drawing lines 1 sides to 1 down, 2 side ways to 2 down but it just draws a line! I found out that you put REAL/REAL and Integer DIV Integer or Integer MOD Integer. I can't really make the programs do mathematical operations because the thing can't even add right! I put Real+real. I entered 5 and 4.5 and I got something like 90000000E+4374-3!!! Ahh! Impossible! Pascal for BASIC users isn't that much of a help either. Ram Subj: Re: More TML Pascal 89-05-04 16:45:38 EDT From: HyperRam I borrowed Orca Pascal from a friend and IT'S MUCH BETTER! Not as easy to use and I don't know how to work it but it has A LOT more features for the same price! I couldn't program on it because it's pascal is ALOT differant! I couldn't even understand it, it's TOTALLY differant! Maybe I should of started with that. I only know TWO good programs written with TML Pascal! (and they're not mine :) The Pascal for BASIC users isn't helpful, I don't even know those commands in basic which they compare! :(( Help, please...... Ram (dead, and (already) lost) Subj: Re: More TML Pascal 89-05-08 03:15:17 EDT From: Dave Lyons The Pascal language is *not* all that different between TML Pascal and ORCA/Pascal. In some details, there are differences. Adding 5 and 4.5 should work just fine: let's see the program you used that didn't work. When you GotoXY(15,25), what do you expect to happen? Isn't 25 below the bottom of the screen? Look up DIV and MOD in the index of one of your Pascal books, and you'll find that you are right: DIV and MOD are for integers, and "/" is for reals (actually you can "/" integers, but the result is real; you can use TRUNC [or ROUND?] to get an integer out of it). What is your program supposed to *do*? It contains this: For count:=1 to howmany do begin LineTO(Howmany, howmany); End; Seems extremely pointless to me. For example, if I entered 15 for HowMany, then your program would draw a line from somewhere to the point (15,15) (which is near the top left of the window), and then it would draw a line from that place to the *same* place 14 more times. This isn't going to have a very interesting effect. The most you'll get is one line. Subj: Re: More TML Pascal 89-05-08 07:25:22 EDT From: HyperRam Oh! It WAS supposed to draw lines like 14,14,13,13,12,12,11,11 as the counter went down. I think it worked in BASIC though. I -STILL- am missing out on something. You guys all learned Pascal in college right? Then how do you know how to make desktop applications for the GS? I looked in 8 different books and they SAY NOTHING about desktop applications-just the vanilla mode. (Most of them were made before the IIgs came out) I -WISHED- that TML Pascal didn't appear over the vanilla window! It looks like a big advertisment! :) Ram Subj: Modify/Copy/What the heck! 89-05-10 01:58:37 EDT From: HyperRam How do you modify programs like GSDemo's menus? I can add choices but they can't do anything, I don't know how to make them do functions. I don't understand arrays, or functions either. God RAM, you 're so retarded, Read the TML BOOK!!! DUH!! Isn't TML going down the drain? If it does, my Pascal career is gone. :( Ram (The Ultimate Pascal Programmer who fixes anything, anytime, anywhere which he pleases! The Perfect person who founded the multitrillion dollars finacial empire of RAMTECHNOLOGIES!! The one who fixed all of AppleWorks GS's bugs in 5 minutes! The one who saved the world from certain death and destruction! The one who made spectacular games which sold by the billion!!!! The one who made the TRULY SUPEIOR LANGAUNG-RAMMULA 2000!!!! :))))) (This is totally fake but I don't really care!) Subj: Impossible..... 89-05-10 04:19:32 EDT From: HyperRam I can't even get past the vanilla mode-shows how much I got for programming talent. (0) Can I make it reboot slots like in BASIC -Print CHR$(4);"PR#5". Oh, and how do you boot a 3.5 disk drive after you have cold booted into a ROMDISK? That guy at my school who say he was the next generation of programers knows less that I do. The manaul-after trying to read it, I gave up, the manual is pathetic. It's (almost) as bad as AppleWorks GS's manuals, if you want to call them manuals. Is TML really a 3 person company? It will probably go out of business. Then I'll have to switch to Orca. ::Sigh:: Does anyone know what Parik wrote As the Link Turns in? (not Pascal probably) I'm so tried after staying up 3 nights in a row trying to learn this stupid langauge which I haven't gotten ANY further on. I have no idea what I can do, my Pascal programs are useless and don't do anything, (that is if they even compile which is doubtful) NO, none of my programs even work right. What's the use of programming in Pascal when I c an do the same in Basic but only 39 times faster, nicer, easier, better and the Basic programs actually work instead of falling asleep at the moniter because GS/OS is so slow. How can a user group help me, this hasn't, book havn't. I doubt they will be of any help either. I thought the Pascal for BASIC users would be of some use..... Ram Subj: making menu items do things, etc 89-05-12 00:59:46 EDT From: Dave Lyons To make a menu item do something when it's selected, you need to find the part of the main program that gets control when wInMenu is returned from TaskMaster. Most likely there is a big CASE statement there in a Pascal program. Be sure to give your new menu item an ID number that is different from all the other menu item ID numbers already being used, or you'll be sorry. >I can't even get past the vanilla mode-shows how much I got >for programming talent. It shows that you only STARTED trying to learn Pascal a few weeks ago. You should *continue* using plan vanilla mode until you are an expert at Pascal itself. Only then will you be able to dive into toolbox programming & have any hope of knowing what you are doing. TML Systems is definitely not going out of business. I believe they will even have a GS-related announcement for us in the next couple of weeks. Hang in there. A user group will help you if you can find somebody who will spend time with you face to face. There's only so much we can do over electronic mail to help you. As your programs get larger, the advantages of Pascal will become clearer. Subj: Re: More TML Pascal 89-05-12 23:25:01 EDT From: Don87 HR, I'm not much of a programmer but I'd recommend Oh! Pascal. It really has a lot of great examples and is written in an intelligent and entertaining manner. Try it ... you'll like it. Don Mocarski Subj: Re: More TML Pascal 89-05-12 23:30:19 EDT From: Don87 HR, For a plain vanilla without the TML at the top don't use (input,output) after Program. You'll just get a nice plain text screen. Don Mocarski Subj: Re: More TML Pascal 89-05-12 23:35:05 EDT From: Don87 HR, It might help if you try to forget BASIC for a while. Pascal has quite a different outlook on program control. Subj: Re: More TML Pascal 89-05-13 02:44:43 EDT From: HyperRam Ahhh! I can't ever get these programs to work!!!! (CUSS CUSS SWEAR!!) Program RAM (Input, Output); Uses ConsoleIO, QDIntf, GSIntf; Var X,Y,Wait:Integer; A:String[255]; Procedure Stop; Begin Repeat Until KeyPressed; Wait:=FlushEvents(40,0); End; Procedure ShutDown; Begin Halt; End; PROCEDURE ABOUT; Begin EraseScreen; WriteLN('Ram''s First ProDOS 16 Application......v1.1'); WriteLN; WriteLN('Written by Ram Rajadhyaksha'); WriteLN; WriteLN('Special Thanks to:'); WriteLN(' Dave Lyons'); WriteLN; WriteLN('Version 1.0 March 30, 1989'); WriteLN('Version 1.0.2 April 14, 1989'); WriteLN('Version 1.1 May 12, 1989'); WriteLN; WriteLN('Press a key to continue.....'); Stop; End; Procedure StartUp; Begin EraseScreen; WriteLN('Welcome to Ram''s AWESOME Program.'); WriteLN; WriteLN('Please Wait, Loading XYZ RAM Based Blah, Blah Tools'); WriteLN; WriteLN('Your IIgs is now loading.'); WriteLN; WriteLN('HINT:This may take a few years'); For X:=1 to 1000 do For Y:=1 to 1000 do; WriteLN; WriteLN('Tool loading is now complete.'); WriteLN('Press a key to start.....'); Stop; End; Procedure Text; Begin EraseScreen; WriteLN('Ram is SO cool!'); WriteLN('Have you heard Ram purchased TML Pascal?'); WriteLN('Yes, oh man! He''s probably going to become the'); WriteLN('programmer of ALL TIMES!!'); WriteLN('Yep! You are so right! This is his first actual'); WriteLN('ProDOS 16 application! Is that not cool?'); WriteLN('His first?! Wow! Maybe he will learn how to program'); WriteLN('Pascal! Then the world would be a better place!'); WriteLN('Well, he knows the basics like putting a semicolon after'); WriteLN('each line.'); WriteLN; WriteLN('Like totally cool man!! You mean if I put this file in a disk'); WriteLN('with ProDOS and the GS/OS system folder, it will boot by'); WriteLN('itself??!'); WriteLN; WriteLN ('(Press a key to continue...)'); Stop; EraseScreen; {Beginning of new page} WriteLN('Yessery!! A true ProDOS 16 application! Wow!'); WriteLN('The excitement in solid!!'); WriteLN('WOW!! TOTALLY COOL!! Jeeezz...I wish I could be just like'); WriteLN('Ram! (The Great)'); WriteLN; WriteLN('Well.., you can DREAM on- he''s to perfect for you!'); WriteLN('(With is his TML Pascal v1.50A)'); WriteLN; WriteLN('Then he''s my IDOL!!'); WriteLN('Someday he will know why they put the ''LN'' after'); WriteLN('Read and Write!'); WriteLN('Try tommorow! He''s ALREADY fixed ALL the bugs in'); WriteLN('AppleWorks GS in 5 minutes after he recieved TML Pascal!!!'); WriteLN('Wowzers!!!! What a MAN!! The ultimate programmer!!!'); WriteLN('Darn! I have to go Bobby! Bye!'); WriteLN('Bye Amy!!'); WriteLN('(Press any key to continue....)'); Stop; End; Begin StartUP; Repeat EraseScreen; WriteLN('Main Menu........'); WriteLN('1. Start the Program'); WriteLN('2. About'); WriteLN('3. Quit'); WriteLN; Write('Pick one and press the return key. -> '); ReadLN(A); Until (A='1') or (A='2') or (A='3'); If (A='1') THEN TEXT; IF (A='2') THEN ABOUT; IF (A='3') then ShutDown; {QuickStop} End. Subj: Re: More TML Pascal 89-05-13 02:46:18 EDT From: HyperRam It has it's features (tml) tho. Like the Halt command instead of If (a='1') then goto 1 1:End; (WHICH NEVER WORKED!!!) Subj: Re: FOR Loops 89-05-13 16:54:01 EDT From: ErikCh Has anybody figured out my problem with the FOR loop counter starting from 0 even though I used... FOR Count:=1 TO N The only way I avoided the problem was to put a Count:=1 statement before the FOR loop. This is not standard Pascal! Erik Subj: Re: More TML Pascal 89-05-13 18:06:26 EDT From: HyperRam I SAID ERIK-TML PASCAL'S DUMB!!! IT DOESN'T COMPILE ALL THE THINGS RIGHT!!!!!! Subj: Re: More TML Pascal 89-05-14 14:02:36 EDT From: HyperRam Gosh! I can't the darn thing to work!!! SILI+GFBIFUIFISF& (688 68tr687n6547\65!!!!!! BOO!!! This is STUPID!!!!!!! Program GetAverage (Input, Output); Uses ConsoleIO; Var SUM, Total, Data, Average:LongINT; Count:Integer; Begin EraseScreen; WriteLN('Please enter 10 numbers....'); WriteLN; For Count:=1 to 10 do begin WriteLN('Enter value #',Count, ': '); ReadLN(Data); End; WriteLN; Total:=Data/10; WriteLN('The average is ',Total, '.'); WriteLN('Press a key to continue...'); ReadLN; End. Subj: Re: More TML Pascal 89-05-14 14:14:29 EDT From: AFL Dyfet Subj: **Wanted: TML Pascal S. CODE** 89-05-14 01:37:55 EDT From: HyperRam Msgs: 1 (89-05-14) Anyone made any new TML Pascal source code? If you do, E Mail to HyperRAM. Ram P.S. I'm terrible at Pascal so thats why I need to leech off other people. :) Subj: Re: More TML Pascal 89-05-14 16:14:27 EDT From: HyperRam Hahhahahaha!! :) Subj: Re: More TML Pascal 89-05-14 16:16:02 EDT From: HyperRam Well? Does anyone have any source code? (Uh oh, I think my folder was deleted:-) Subj: Re: More TML Pascal 89-05-15 00:06:52 EDT From: HyperRam I wish I could write a SUPER simple desktop application. (that displays a dialog box) I could copy the ShutDown GStools and StartUp gs tools to start. Ram :) Subj: computing averages 89-05-15 03:16:07 EDT From: Dave Lyons Erik, I plan to catch up on all my "inbox" stuff in the next couple of days--haven't looked at the FOR loop problem yet. (I've been assembling furniture from Target instead. :-) HyperRam, the problem with your Averages program is that you never add up the 10 numbers. Try putting a Total := 0 before the loop, a Total := Total + Data after the readln(Data), and change Total := Data/10 to Total := Total / 10. It should work much better. You didn't say what was wrong with the previous program. I don't have time to download & try everything you post--if you explain what goes wrong I or someone else can probably figure it out quickly. --Dave Subj: Re: More TML Pascal 89-05-15 04:16:07 EDT From: HyperRam Hey, when you put Program XXX; it doesn't make a blank white terminal, you get this blue screen (Like in AppleSoft with 80 columns). How do you get the blank white screen? Subj: Re: More TML Pascal 89-05-15 05:42:51 EDT From: HyperRam I am having the same problems too. Like in one spot-when it tells the computer :WriteLN('Divide.....');, it doesn't write anything. And when I compile to the disk and run it from there, everything works fine. I thnk the compiler is bad. (I know it is. :---) Subj: Re: More TML Pascal 89-05-15 23:27:51 EDT From: Don87 HR, In addition to not finding the total of your numbers don't you have to declare the result of a division as a real variable rather than an integer? Don Mocarski Subj: Re: More TML Pascal 89-05-16 07:47:38 EDT From: HyperRam Yeah, and hey(!), I got a pull down menu to do something!!!! Wow! Technology! Subj: Pascal not Pascal? 89-05-17 01:43:47 EDT From: HyperRam When I look in a generic pascal book, it's only vanilla. Is that all Pascal is? The Vanilla mode? How do you draw a dialog screen with words and how do you initialize a disk. I want to put that as a choice on the file menu. This is neat. Subj: Columbus STINKS!! 89-05-17 20:30:56 EDT From: HyperRam I looked thru the Yellow Pages on computers and the only things they had for computers is IBM's and Macs! OOH! That makes me mad! Help! None of these stupid books have helped! If I had a mac or ibm right in front of me right now I would smash into bits!! I don't even think the colleges here teach Pascal! (This is a programmer's city) AHHHH!! Ram Subj: Re: TML AND SOUND TOOLBOX 89-05-17 22:35:52 EDT From: DavidC141 Can anyone provide some samples of the sound and notesyn toolboxes in TML Pascal? Are there any on TML's Source Code Library? Gookin and Davis have some good ones for assembler programmers in "Mastering the Apple IIGS Toolbox." However, I can't translate them into Pascal, particularly the instrument record. Thanks in advance for any examples or suggestions. Dave C. Subj: Re: Sound example 89-05-19 00:57:44 EDT From: SkySinger David C. Yes, there is an example of note generation on the TML source code library disk. Subj: Re: More TML Pascal 89-05-19 01:20:10 EDT From: SkipS I'm trying to learn TML Pascal but find myself stuck. Can someone explain why a Packed Array isn't compatible with the following assignment? Type Data = Packed Array [1..10] of char; {and} writeln(data): {causes compilier error 'Incompatible operand'} I have to do the following: for x:= 1 to 10 do write(data[x]); According to TML's book (pg113) what I'm trying to do is supposed to be legal. What am I doing wrong? Thanks for any info... Skip Subj: Re: More TML Pascal 89-05-19 07:44:18 EDT From: HyperRam On the Get Average the Total:=Total/10; ISN'T ASSINGMENT COMPATIBLE! I tried it with Sum:=10; then Total/Sum; Still not working. Subj: Total := Total / 10; 89-05-20 04:40:23 EDT From: Dave Lyons HyperRam, is Total a *real* variable, or an integer? You need it to be a real if you are using "/", since "/" results in a real. If you really want to use an integer variable, use DIV instead of "/". ----- Umm...you can't writeln a data type. Does this work? var data: packed array[1..10] of char; ... writeln(data); If not, try var data: string[10]; ... writeln(data); --Dave Subj: 32K arrays 89-05-20 08:51:51 EDT From: John Majka Will TML Pascal ever be able to handle arrays greater than 32K? Subj: Back to BASIC's.... 89-05-20 21:38:12 EDT From: HyperRam I think I'll go back to BASIC for awhile. This is complicated. I can do BASIC. Subj: Re: More TML Pascal 89-05-20 21:39:57 EDT From: HyperRam There is NOTHING I can do with Pascal anyway. I make launchers and stuff in BASIC but you can't do that in Pascal. My programs are boring too because they do nothing and have no features. At least in BASIC you can do all sorts of things but Uh uh in Pascal! I sent a letter to the user group and haven't recieved a reply. That really helped. If they don't reply then it is hopeless. Subj: Re: 32K Arrays 89-05-20 23:24:16 EDT From: SkySinger Don't know if TML will allow arrays larger than 32K but you can bypass the limit if you're familiar with using pointers. You can allocate any amount of memory you want using the Memory Manager and then maneuver through it as if it were an array by using a pointer (or pointers) and some offsets. It works real well and can be a very flexible way to create data structures. Subj: Re: GetIText 89-05-22 18:28:32 EDT From: RobB18 I have set up a dialog box which contains an edit text item. When I try to the edited text from the dialog item with the GetIText toolbox call TML (Version 1.5A/Stand Alone) informs me I have commited one of two errors as follows: GetIText (DialogPtr,ItemHit,@TString); This yields a: "Actual Parameter Must Be A Variable" Error! NamePtr : StringPtr; NamePtr := @TString; GetIText (DialogPtr,ItemHit,NamePtr); This yields a: "Not compatable variable" or something similar. Any idea...Help! Subj: Re:HR/Plain Vanilla mode 89-05-22 20:29:38 EDT From: ESeasholtz The standard Pascal that you find in most books is plain vanilla. The desktop environment is more specific to the individual computer and extensions are made to the compiler in order to create desktop applications. As for the part about initializing a disk from withing TML Pascal, I'd kinda like to see how to do that myself. Anyone got a program that just prompts you to insert a disk into 5,1 and then click to format? Subj: Re:HR/Total:=Total/10 89-05-22 20:40:21 EDT From: ESeasholtz HR, try changing your TOTAL:=TOTAL/10; to TOTAL:=Trunc(TOTAL/10); The problem is that you are dividing TOTAL by 10 and it's not an integer value. Since you have declared TOTAL to be a Longint, you have to use something to turn the answer back into an integer. Subj: Re:HR/Total:=Total/10 89-05-22 20:45:59 EDT From: ESeasholtz Ahh, Dave is right. Since it's an integer, you should use DEV instead of /. Subj: Re: GetIText & More 89-05-22 21:43:16 EDT From: RobB18 Well, I have solved my own problem with regards to GetIText. I needed to declare my string as STR255 whereas I had declared it at String[15] in my program. Using STR255 in the GetIText call and them moving it to my String[15] variable seems to work just fine. Another Question though: In the copy of the toolbox reference I have the List Manager states that at the time of publication there was no way to add a list control to a dialog box. Is this still the case? If there is a way could someone please drop a line to me as to how? Thanks in advance. Rob Balog P.S. Using TML PASCAL Version 1.5A Stand Alone Versi Subj: List Controls in dialogs; GetITe 89-05-22 22:28:37 EDT From: Dave Lyons Rob, Apple IIgs Technical Note #38 shows you how to put list controls in dialog boxes. It's available in the libraries under Apple Computer Releases. Also, note that you can declare GetIText yourself with your favorite parameters, if you want. Something like this: procedure MyGetIText(dlog: univ ptr; dItem: integer; theString: univ ptr); tool 21, 31; (Toolset 21 ($15) is the dialog manager, and function 31 ($1F) is GetIText.) UNIV means universal--see the TML manual. Subj: "can't do" from Pascal 89-05-22 22:31:25 EDT From: Dave Lyons HyperRam, it's not that you *can't* launch programs from TML Pascal, but it is quite a few times more complicated to do it under GS/OS & the desktop environment than to do it under ProDOS 8. Launching programs from a GS/OS BASIC is also complicated. Subj: formatting a disk in GS/OS 89-05-22 22:32:52 EDT From: Dave Lyons Formatting a disk isn't all that difficult. Here's some nice UNTESTED code you can play with (carefully!). type FormatRec = record pCount: integer; devName: ptr; volName: ptr; resultFileSystem: integer; requestFileSystem: integer; end; procedure Format(var Parameters: FormatRec); ProDOS $2024; procedure FormatSomething; var FmtRec: FormatRec; begin FmtRec.pCount := 3; { don't request any particular file system } FmtRec.devName := @'.appledisk3.5a'; { Note--don't assume any particular device names in real programs. Use DInfo. } Format(FmtRec); { error code in toolErrorNum } end; --Dave Subj: Re: More TML Pascal 89-05-23 19:01:39 EDT From: HyperRam Thanks Dave, I hope it displays a dialog before it formants like, do you want to formant this disk?. Subj: $#^&*$(^@$*^$&(&^&^$@*(^&$!!!!! 89-05-23 21:48:07 EDT From: HyperRam Nothing _EVER_ works!!!! None of my stupid programs work!! GROAN!! PROGRAM Desktop; Uses QDIntf, { QuickDraw graphics } GSIntf, { The "DeskTop" Toolsets and others } MiscTools, { Miscellaneous Tools } ConsoleIO; { TML Pascal Console I/O routines } Const ScreenMode = $80; { 640 mode } MaxX = 640; { Max X clamp (should correspond to ScreenMode } AppleMenu = 300; { Menu and Menu Item constants } AboutItem = 301; FileMenu = 400; FormatItem =401; QuitItem = 402; Editmenu = 500; UndoItem = 500; {----} CutItem = 501; CopyItem = 502; PastItem = 503; ClearItem = 504; WindowMenu = 600; Wind1Item = 600; Wind2Item = 601; {----} RectsItem = 602; OvalsItem = 603; RoundRItem= 604; GoodMenu = 700; SFGetItem = 705; ModalItem = 706; BeepItem = 701; {----} ArrowItem = 702; CrossItem = 703; IBeamItem = 704; RAMMenu = 800; RamItem = 801; type myCursor = { Our own custom size cursor type } record CursorHeight: Integer; CursorWidth: Integer; data: array[1..11,1..2] of LongInt; mask: array[1..11,1..2] of LongInt; hotSpot: Point; end; FormatRec = record pCount: integer; devName: ptr; volName: ptr; resultFileSystem: integer; requestFileSystem: integer; end; var MyMemoryID: Integer; { Application ID assigned by Memory Mgr } ToolsZeroPage: Handle; { Handle to Zero page memory for Tools } Done: Boolean; { Flag indicating user has chosen Quit } AppleMenuStr: Str255; { Menu definition strings } FileMenuStr: Str255; EditMenuStr: Str255; WindMenuStr: Str255; GoodiesMenuStr: Str255; RammenuStr: Str255; currentObj: Integer; { Indicates current graphics object } currCurs: Integer; { Indicates current cursor } TheCursor: myCursor; junk: LongInt; myWind: NewWindowParamBlk; { Globals to create our windows } myWindTitle1: String[40]; myWindTitle2: String[40]; myWindPtr1: WindowPtr; myWindPtr2: WindowPtr; procedure StartUpGSTools; { This routine initializes each of the //GS Tools required for every application. Depending upon which tools your application requires the code in this procedure would change. } var ToolRec: ToolTable; svToolErrorNum: Integer; btn: Integer; begin TLStartUp; { init Tool Locator } MyMemoryID := MMStartUp; { init Memory Manager } MTStartUp; { init Misc Tools } { Allocate 8 pages of memory in bank 0 for use by GS Tools. 3 pages for QuickDraw, 1 page for Event Manager, 1 page for Menu Manager, 1 page for Control Manager, 1 page for Line Edit 1 page for Standard File } ToolsZeroPage := NewHandle(8 * 256, { allocate 8 pages } MyMemoryID, { User ID for memory blocks } FixedBank+PageAligned+Fixedblk+Locked, { Attributes } ptr(0)); { start in bank 0 } QDStartUp (LoWord(ToolsZeroPage^), { low address of the first 3 zero pages } ScreenMode, { 640 mode } 160, { max size of scan line } MyMemoryID); { User ID for memory blocks } EMStartUp (LoWord(ToolsZeroPage^) + $300, { low address of 4th zero page } 20, { event queue size } 0, { X min clamp } MaxX, { X max clamp } 0, { Y min clamp } 200, { Y max clamp } MyMemoryID); { User ID for memory blocks } { Give a message while we load RAM based tools } MoveTo(40,40); SetBackColor(0); SetForeColor(15); DrawString('One moment please, This Cool Program is Loading...'); { Now load tools required by the application } ToolRec.NumTools := 10; ToolRec.Tools[1].TSNum := 4; { QuickDraw // } ToolRec.Tools[1].MinVersion := 1; ToolRec.Tools[2].TSNum := 5; { Desk Manager } ToolRec.Tools[2].MinVersion := 1; ToolRec.Tools[3].TSNum := 6; { Event Manager } ToolRec.Tools[3].MinVersion := 1; ToolRec.Tools[4].TSNum := 14; { Window Manager } ToolRec.Tools[4].MinVersion := 0; ToolRec.Tools[5].TSNum := 15; { Menu Manager } ToolRec.Tools[5].MinVersion := 1; ToolRec.Tools[6].TSNum := 16; { Control Manager } ToolRec.Tools[6].MinVersion := 1; ToolRec.Tools[7].TSNum := 21; { Dialog Manager } ToolRec.Tools[7].MinVersion := 0; ToolRec.Tools[8].TSNum := 20; { Line Edit } ToolRec.Tools[8].MinVersion := 0; ToolRec.Tools[9].TSNum := 22; { Scrap Manager } ToolRec.Tools[9].MinVersion := 0; ToolRec.Tools[10].TSNum := 23; { Standard File} ToolRec.Tools[10].MinVersion := 0; repeat LoadTools(ToolRec); { Load the tools I need } svToolErrorNum := ToolErrorNum; if svToolErrorNum <> 0 then begin { Error loading tools } btn := TLMountVolume (100,40, 'Error loading tools', 'Insert System Disk', 'Ok', 'Cancel'); if btn <> 1 then { Abort } SysFailMgr(svToolErrorNum,'Unable to load tools'); SysFailMgr(svToolErrorNum,'Unable to load tools'); end; until svToolErrorNum = 0; WindStartUp(MyMemoryID); { init Window Manager } RefreshDesktop(nil); CtlStartUp { init Control Manager } (MyMemoryID, { User ID for memory blocks } LoWord(ToolsZeroPage^) + $400); { low address of 5th zero page } MenuStartUp { init Menu Manager } (MyMemoryID, { UserID for memory blocks } LoWord(ToolsZeroPage^) + $500); { low address of 6th zero page } ScrapStartUp; { init Scrap Manager } LEStartUp { init Line Edit } (MyMemoryID, { User ID for memory blocks } LoWord(ToolsZeroPage^) + $600); { low address of 7th zero page } DialogStartUp { init Dialog Manager } (MyMemoryID); { User ID for memory blocks } SFStartUp { init standard file} (MyMemoryID, { user id for memory blocks} LoWord(ToolsZeroPage^) + $700); { low addr for 8th zero page} DeskStartUp; { init Desk Manager } end; { of StartUpGSTools } procedure ShutDownGSTools; { Shut down each of the //GS Tools initialized previously before exitting this application. If you change StartUpGSTools this procedure should be changed as well. } begin GrafOff; DeskShutDown; SFShutDown; DialogShutDown; LEShutDown; ScrapShutDown; MenuShutDown; WindShutDown; CtlShutDown; EMShutDown; QDShutDown; MTShutDown; MMShutDown(MyMemoryID); TLShutDown; end; { of ShutDownGSTools} procedure SetUpMenus; { This procedure creates the menus for the application. NOTE: The parameters to NewMenu MUST not be local variables or expressions. NewMenu maintains pointers to the string passed to it which must remain the same. Thus only global variables are allowable. } var Height: Integer; begin AppleMenuStr := concat('>>@\XN300\0', '==About RamTEXT...\N301\0', '==-\N302D\0..'); FileMenuStr := concat('>> File \N400\0', '==Format Disk\N401*Ss\0', '==-\N999D\0', '==Quit\N402*Qq\0.'); EditMenuStr := concat('>> Edit \N500\0', '==Undo\N500D*Zz\0', '==-\N999D\0', '==Cut\N501D*Xx\0', '==Copy\N502D*Cc\0', '==Paste\N503D*Vv\0', '==Clear\N504D\0.'); WindMenuStr := concat('>> Windows \N600\0', '==Window #1\N600\0', '==Window #2\N601\0', '==-\N999D\0', '==Rects\N602\0', '==Ovals\N603\0', '==Round Rects\N604\0.'); GoodiesMenuStr := concat('>> Goodies \N700\0', '==SF GetFile..\N705\0', '==Modal Dialog...\N706\0', '==Beep\N701\0', '==-\N999D\0', '==Arrow\N702\0', '==Cross\N703\0', '==I-Beam\N704\0.'); RamMenuStr := concat('>> RamSuperMenu \N800\0', '==About Ram...\N801\0.'); SetMTitleStart(10); InsertMenu(NewMenu(@RamMenuStr[1]),0); {Ram Menu} InsertMenu(NewMenu(@GoodiesMenuStr[1]),0); { Goodies Menu } InsertMenu(NewMenu(@WindMenuStr[1]),0); { Windows Menu } InsertMenu(NewMenu(@EditMenuStr[1]),0); { Edit Menu } InsertMenu(NewMenu(@FileMenuStr[1]),0); { File Menu } InsertMenu(NewMenu(@AppleMenuStr[1]),0); { Apple Menu } FixAppleMenu(AppleMenu); { Add DAs to apple menu } Height := FixMenuBar; { Set sizes of menus } DrawMenuBar; { ... and draw the menu bar! } end; {$LongGlobals+} procedure Window1Content; { This is the Window Content "Definition Procedure" for Window 1. It draws a 10 graphic objects depending upon the menu selection. REMEMBER, DEFINITION PROCEDURES MUST BE COMPILED WITH $LONGGLOBALS+ SO THAT GLOBAL VARIABLES ARE CORRECTLY ADDRESSED. } var r: Rect; i: Integer; begin SetRect(r,10,10,225,35); for i := 1 to 10 do begin SetDithColor(i); case CurrentObj of RectsItem: PaintRect(r); OvalsItem: PaintOval(r); RoundRItem: PaintRRect(r,10,10); end; OffsetRect(r,15,15); end; SetDithColor(0); end; { of Window1Content } procedure Window2Content; { This is the Window Content "Definition Procedure" for Window 1. It draws the message "TML Pascal is Great!" 10 times. } var i: Integer; begin for i := 1 to 10 do begin MoveTo(i*11+20,i*9+10); DrawString('Pascal is HARD!!!'); end; end; { of Window2Content } {$LongGlobals-} procedure SetUpWindows; { This procedure creates both of the demo windows for the application. } begin myWindTitle1 myWindTitle1 := 'Ram''s Window #1'; with myWind do begin param_length := sizeof(NewWindowParamBlk); wFrame := $DDA0; wTitle := @ Subj: *&*$*&(%$#*%(*$#!@!!!!!!!! 89-05-23 21:50:29 EDT From: HyperRam GOD!!! THE PROGRAM DIDN'T FIT IN THE LETTER!!!!!(^&($)$#*)&$*$@()$@$(@(^$@)!!!!! FORGET IT, ILL THROW IT OUT AND START OVER!!!!!! Subj: Re: More TML Pascal 89-05-23 22:24:55 EDT From: SkipS I'm getting a bit frustrated with TML Pascal. I have a fairly simple textbook example of a linked list that I'm trying to get running. The program works fine on my mainframe at work, but it won't run properly on my IIgs. I wish I could upload the code but my Avatex modem prohibits it (grrr). Basically, TML seems to trash some variables (an array of char) when a loop repeatedly calls a procedure that passes the variable. The first time thru the loop, everythings fine. The next time the array is full of trash! I first noticed something like this when using the Speech Toolkit. The SAY parameter needed to be reassigned each call or the parameter would get trashed. Is this a documented bug? Any ideas? Sure would appreciate any kind of help here, or I'm trashing TML. Thanks, Skip Subj: Loading Binary Sounds in TML 89-05-23 23:32:51 EDT From: EmmanuelT1 I finally figured out how to produce sound and how to change Instrument Defs but I have no idea how to load in Binary Sounds. I think you have to load it into the Instrument Def. but that didn't work (couldn't seem to translate the raw data to the Instrument Def) Can anyone help me. A thousand Thanx -- In advance for any help 8-) Emmanuel T. Subj: TransWarp GS NDA....... 89-05-26 23:19:55 EDT From: HyperRam Groan! Where do I start for a TransWarp GS NDA? I can't figure out anything. This is soo hard! (And not fun at the moment) I could give you the whatchamacallies to access the card, something like $0039sdokh oi4t-9y4w9yer... It's all in the weirdo langauge, JHA SJF!! Groan! All the books are mathematicly orrientated! The manual should explain some pascal too! {DeskAccs +60-1 whatever!!} GROAN! Ram (Dead, lost, confused, etc........) Subj: Re: More TML Pascal 89-05-27 00:05:00 EDT From: HyperRam Never mind, it's too hard and mine'll bomb! This is so retarded. You spend 321894587268 lines on making the desktop and 1 line on the program. IIgs programming isn't efficent, and is impossible. Hope someone else makes one...... Subj: Re: More TML Pascal 89-05-27 08:10:49 EDT From: HyperRam I meant unefficient. Whoooops! :)) Subj: Progress is ITEOTB. 89-05-27 08:59:41 EDT From: HyperRam Oh yeh?! Beat the progress!! Its the stupidest thing I've ever seen! {DeskAcc -1-1 TransWarp GS} {LongGlobals+} Program TransWarpGSNDA; Function DAOpen: WindowPTR; See that big progress????? The shows how good of a programmer I am! I'm LOST! Ram (Dead, Dead again, and Dying) Subj: Re: More TML Pascal 89-05-28 00:32:16 EDT From: Jimig HR: You're right, learning to program on the GS is a seemingly impossible task. There may be more help coming from TML, but it may really be minimal for a beginner. You could look for Macintosh books, particularly 'A Graphical approach to Programming the Macintosh' (I think that's the name). The toolbox approach is much the same, and maybe you'ld get some hints. Try the local college library, and grab all the mac books they have. Subj: Re: More TML Pascal 89-05-28 11:42:34 EDT From: HyperRam This is impossible, none of the pascal books have helped! Am I doing something wrong? Yes, I read the books, No, I don't read them cover to cover because I get lost on the 1st page! All this 'programming structer' which I know NOTHING about. What is a function? Were, when, and WHY would you put in a while statement? OR a Otherwise, else etc...... GROAN! Subj: Re: More TML Pascal 89-05-28 13:54:28 EDT From: SkySinger Reading Mac books to learn to program the GS could waste a lot of time since its just different enough to make it unusable on the GS. Probably a good way to approach GS programming (I know I'm repeating myself) is to FIRST learn Pascal well. AFTER you know Pascal, attempt some ToolBox programming. To learn the ToolBox, you'll need to see plenty of EXAMPLES because there are so many details. By the way, a function is like a procedure that yields a result. It is called like a procedure except it must be part of an assignment statement. For example Variable:=FunctionName. The function is called and when its finished, the Variable has been assigned the result of the function's operation. Subj: Re: More TML Pascal 89-05-28 19:29:11 EDT From: HyperRam Hey, I got something (finally) to work! YAA! It's pretty stupid but it's all I could think up. (I fixed up the demo calculater to, hehe) This program is pretty crumby, anyway to 'spiff it up'? Program TransWarpGS (Input, Output); Uses ConsoleIO, QDIntf; Var A,B,X:Integer; Procedure TWGS; Begin For X:=70to 123 do begin Moveto(X,X); WriteLN('TransWarp GS'); End; For X:=123 downto 70 do begin MoveTO(X,X); WriteLN('TransWarp GS'); End; End; Procedure Warp; Begin EraseScreen; MoveTo(10,20); WriteLN('TransWarp GS'); MoveTo(20,30); WriteLN('TransWarp GS'); MoveTo(30,40); WriteLN('TransWarp GS'); MoveTo(40,50); WriteLN('TransWarp GS'); MoveTO(50,60); WriteLN('TransWarp GS'); MoveTo(80,90); WriteLN('Experience computing in the fast lane!!!'); MoveTo(90,100); WriteLN('Put your IIgs in 4th gear today!! Buy Now!!'); MoveTo(100,110); WriteLN('Order today! Only (Cough) $399.99!!!'); MoveTo(110,120); WriteLN('Full 7.0 MHz! 1 Year Warrenty!'); MoveTo(120,130); WriteLN('BUY OR DIE!!!!'); End; Begin EraseScreen; WriteLN('TransWarp GS is AWESOME!!'); WriteLN; B:=0; Repeat B:=B+1; TWGS; {Procedure} Until B=5; Moveto(10,150); WriteLN('Don''t compute without it!'); WriteLN('Call 214-241-6060 for for information!!!'); WriteLN ('Press return.....'); ReadLN; Warp; MoveTO(10,150); WriteLN('Press return.....'); ReadLN; End. FOrget it, I will never be able to understand functions! I don't understand this stuff either: WriteLN('Blah':18:2); and what is EOS?? Or EOD whatever it was... And I've seen weird startments like WriteLN('The sum is', SUM [I]); What is the []'s for?? Groan! Subj: Re: More TML Pascal 89-05-28 19:34:50 EDT From: HyperRam Is there a good way to design a program before typing it in? I never know how many procedures or varibles I need. :(( ANy ideas on a program?? Subj: Re: More TML Pascal 89-05-31 04:04:25 EDT From: Dave Lyons HR, lots of people will probably give you different ideas on how to design a program before typing it in. I usually don't write down any actual program lines on paper--but I do draw diagrams of my data structures I'll be using, and I draw pictures showing different parts of the program and how they share information with each other. Some people like "flowcharts" (I don't). If you are *stuck* on page 1, do *not* go on to page 2! Ask us to explain page 1 instead. Really. You will eventually understand functions. You've almost certainly used them in Applesoft already. For example, PEEK is an Applesoft function (but POKE is *not*). A function is something that gives you a result back based on the "arguments" that you feed it in parentheses. So PRINT PEEK(0) gives you the value found at byte 0 in memory. The stuff inside the parentheses doesn't have to be just a simple number, either. You could use a variable, or the result of another function, or an expression as complicated as you want. PRINT PEEK(5+PEEK(4)) would work too (although it wouldn't do anything impressive). It would find the value at location 4; let's say it got 100. Then it'd calculate 5 plus 100 and feed that to the outer PEEK, so it would find the value at location 105. And then PRINT would print it. If you read the section on 'writeln', you'll find out what the weird colons and numbers mean. If I remember this right, then Writeln(123.45:10:4) means to write the number in an area 10 spaces wide with 4 digits after the decimal point. So it would write 123.4500 (notice the 2 blanks at the beginning to make the whole thing take up 10 spaces). "EOF" means "end of file." When you're reading information from a disk file, you usually need some way to tell when you reached the end, so you can stop. EOF is a function that takes a file and tells you (true or false) whether you've gotten to the end yet. For example: while not eof(myFile) do begin readln(myFile,myString); writeln(myString); end; This reads lines from myFile and writes them out--until they've all been read and displayed. "not eof(myFile)" is usually true, because "eof(myFile)" is usually false, since we haven't hit the end of the file yet. When we do hit the end, eof(myFile) is true, so "not eof(myFile)" is the opposite (false), so the "while" loop finishes. Square brackets [ ] are awesomely handy. Look up "arrays" in the index sometime. Arrays let you collect a bunch of items of the same type into a sort of list that you can grab any item from that you want to. You've actually been using arrays already, since Strings are actually arrays of characters. You can use square brackets to get or change individual characters inside a string. var s: str255; ... readln(s); writeln(s[2], s[1]); That would read a string and then print the first two characters in reverse order. --Da Subj: parameters getting trashed? 89-05-31 04:20:47 EDT From: Dave Lyons Skip, send me some code that I can play with & I'll figure out what's going wrong. I haven't had problems with my parameters getting trashed. Subj: reading binary sounds 89-05-31 04:21:32 EDT From: Dave Lyons Emmanuel, if the stuff you want to read from disk has a constant length, you can simply declare a "file of" the data type you want to read from the file, and use "reset" and "read" to read from the file. If you need a more flexible approach, get the ProDOS 16 manual (or better yet the GS/OS reference manuals from APDA) and use the ProDOS16 unit (or equivalent declarations of your own) to make GS/OS calls to OPEN, READ, and CLOSE files. You may also want to use New or NewHandle to allocate memory to read the data into. (Ask a more detailed question, get a more detailed answer.) --Dave Subj: Re: More TML Pascal 89-05-31 21:22:59 EDT From: HyperRam Thanks, didn't understand it but I needed it! :)) I send another letter saying 'I sent a letter before (hint hint hint:)'! They're probably just lazy! Subj: Re: More TML Pascal 89-05-31 21:25:04 EDT From: HyperRam I don't use peeks, just the simple Print "Hello" New I can't even read Peek ((5)(34.3432)a)(s)S) or whatever that was! :) Subj: Re: More TML Pascal 89-05-31 21:26:25 EDT From: HyperRam Oh, and check out the TML Pascal II folder. :) Hint Subj: Re: More TML Pascal 89-05-31 21:36:21 EDT From: HyperRam How does the formatting thing work?? There are 2 procedures! Which one do I call on??? How do you catalog too?? (I saw that in Utility Works) Can you format from the vanilla mode or does it really stink that badly? Every good feature is for the desktop envirment. Also-HOW DO YOU DRAW PICTURES????????? DANG! I can't figure this out! Throwing squares on the ground??? What does that mean?? How do you make a dialog box? I always fool around with the demos and BOOM! I majorly mess up a dialog so the OK is 100 times big or the dialog is too small I CAN'T reach the ok sign! :) Is that dumb or what? Then I have to reboot. :( Lucky with TML Pascal II you don't spend 9 gillion hours just starting up tools and menus and pop up, tear off menus (what are those?). You actually spend some time on the program.... What do you use for a nda? {DeskAc -1-1}?? What is the difference between -1-1 and -1-60??? This is impossible... Subj: BINARY SOUNDS 89-05-31 22:34:56 EDT From: EmmanuelT1 Thanks but know that I load it in where do I put it in order for it to play. (Instrument def, Wave def, etc..). Once again Thank yooooou in advance q8^) __________ Emmanuel|. Subj: oops.. 89-05-31 22:40:55 EDT From: EmmanuelT1 Excuse my mistake on the spelling of the word 'KNOW' I should of types 'NOW'. d8^) ___________ Emmanuel |. Subj: Re: More TML Pascal 89-05-31 23:28:28 EDT From: HyperRam Groan! I looked in Oh! Pascal! on functions and arrays and got MAJORLY screwed up! I don't understand THEM!!!!! This is hopeless!! I'll never understand them!! What is D:=(x,y,Intger)????!???!?!?? Help!! I'm stuck on graphics! Is an array like lets say the numbrs 1,2,3,5,3,6,7,7,7,10? And I could take one and use it??? How?? Why?? I modified GS Demo but it doesn't do anything! Subj: Re: More TML Pascal 89-06-01 02:20:51 EDT From: HyperRam Oh dang! This is embarresing! Programming is boring-there's NOTHING I TO WRITE THE I _CAN_ WRITE!!! Look-I can't even get this ULTRA SIMPLE program to work which you guys would ace in 0.05 seconds! Program BarTender (Input,Output); Uses ConsoleIO; Var A:Integer;X:Boolean; Procedure CheckAge; Begin If (A>21) or (A=21) then X:=True; If A<21 then X:=False; End; Begin WriteLN('You are at a bar...A bartender ask''s your age...'); WriteLN('How old are you?'); ReadLN(A); If X=True then Begin WriteLN('Have a drink then! It''s on me!'); End; If X=False then begin WriteLN('Get out of here you child! Man, kids these days!'); End; WriteLN; WriteLN('[Return]'); Repeat until Keypressed; End. Ram :((( P.S. Maybe I could write a text file reader, naa. Too incompentent. : Subj: Re: More TML Pascal 89-06-01 23:45:33 EDT From: SkipS HR- You never set variable x to a value. After your readln(A) you should have x set to true or false based on A. On the otherhand, are you old enough to write this program? :) Dave - Thanks for the offer. But I finally figured it out. TML is really tough on people trying to learn Pascal. I don't recommend this compilier for beginners unless they have an enormous amount of patience (of which I almost ran out). Apparently, whenever you use a pointer to a string variable as a value parameter one must use the STATIC parameter. Else your actual variable will get trashed! I couldn't find this documented in the TML reference and, of course, standard Pascal books don't refer to any Static parameters. Wow! That one had me going for days! Skip Subj: Re: More TML Pascal 89-06-02 00:09:54 EDT From: HyperRam I don't have patience-and I wished the dumb program worked! :) Subj: Re: More TML Pascal 89-06-03 22:15:05 EDT From: HyperRam How could I access the Apple Icon on top of the Apple Menu?? I just bought DeskWorks with Mr. Apple-it REALLY STINKS!! It's incompatible with most games and crashes!! How would you write one? ANd what would be the heading statement? {$DeskAcc 60-1 Apple} or {$DeskAcc -1-1 Apple}??? Help.... Ram Subj: Re: More TML Pascal 89-06-03 22:17:52 EDT From: HyperRam Whats a mask?? Subj: :( 89-06-03 22:28:58 EDT From: HyperRam Groan! I don't even know WHERE too start! :( How Bout this... {$DeskAcc -1-1 Apple} {$LongGlobals+} (whatever longglobals are....) Program AppleNDA; Function DAOpen: WindowPTR; Begin Dialog box (I can use the Dialog Layout Utility) End; Procedure DAClose; I have no idea what goes here.. Procedure DAAction; Help! What goes here??? Procedure DAInit; Dang! What goes here!??? Begin End. Help!! I don't know what to put in the procedures! The manual REALLY STINKS at telling this!!! Ram (Dead, Dead again, Died, Dying, Croaked) Subj: GROAN!!! HELP!!!!!!! 89-06-03 22:54:15 EDT From: HyperRam Gosh! This isn't working!! :(((((( JUST LOOK AT THIS GREAT (HA-HA) PROGRESS!!! {$DeskAcc -1 -1 Apple } {$LongGlobals+} Program AppleNDA; Uses ConsoleIO, QDIntf, MiscTools, GSIntf; Var MyWind : WindowPTR; DOESN'T THAT STINK???? IT'LL BE A COLD DAY IN HELL BEFORE THIS WORKS!! Ahhhhgh!! That lazy user group STILL hasn't sent a letter back! And I mailed it because I sen the TML System's letter! Hmm, I got a TML Systems reply 2 weeks ago! Ram ((*^#^)*@^&(*@(^@(^%*&!!!!!) :(((((((( Subj: Re: More TML Pascal 89-06-04 10:45:45 EDT From: HyperRam OK! Back to the drawing board! I looked in the manual and came up with this.... {$DeskAcc -1 -1 Apple } {$LongGlobals+} Program AppleNDA; Uses ConsoleIO, QDIntf, MiscTools, GSIntf; Var MyWindOpen: Boolean; MyWind : NewWindowParamBlk; myWindPtr: WindowPtr; Function DaOpen : WindowPtr; begin if myWindOpen then SelectWindow(myWindPtr) Else begin With myWind do begin var R : Rect; Dialog : DialogPtr; CurPort : GrafPtr; ItemHit : Integer; TString : Str255; Begin CurPort := GetPort; SetRect(R,8,18,632,195); Dialog := NewModalDialog(R,False,0); SetPort(Dialog); SetForeColor(0); SetBackColor(15); ShowWindow(Dialog); SetRect(R,122,72,275,81); NewDItem(Dialog,5,R,StatTextItem,@'This NDA is FREEware...',0,0,nil); SetRect(R,178,83,224,97); NewDItem(Dialog,4,R,ButtonItem,@'Ok',0,3,nil); SetRect(R,126,60,270,69); NewDItem(Dialog,3,R,StatTextItem,@'By Ram Rajadhyaksha',0,0,nil); SetRect(R,83,46,237,55); NewDItem(Dialog,2,R,CheckItem,@'Apple Activated...',0,0,nil); SetRect(R,144,34,249,43); NewDItem(Dialog,1,R,StatTextItem,@'Apple NDA v1.0',0,0,nil); SetRect(R,67,30,327,100); SetSolidPenPat(0); SetPenSize(1,1); FrameRRect(R,1,1); ItemHit := ModalDialog(nil); SetPort(CurPort); CloseDialog(Dialog); End; Begin If myWindOpen Then SelectWindow(MyWindPtr) Else begin MyWindOpen := True; {Set up MyWindow for creating the window} myWindPtr := NewWindow(MyWind); SetSysWindow (myWindPtr); End; DAOpen := myWindPtr; MyWindOpen := True; End; Procedure DAInit(Code:Integer); Begin If Code = 0 then begin end Else Begin myWindOpen:=False; End End; Procedure DAClose; Begin CloseWindow(MyWindPtr); MyWindOpen := false; End; I used the dialog layout utility (what else) to make the whatchamacallits (with r begin etc..). (This is just a prototype, I expect to get it working in by the year 2000. :) Can ANYONE get it to work?? Is it THAT hopeless? (probably) What do you do for the DAAction?? How do I get the apple to turn??? Heeeeelllpppp!! Ram (hint: HELPPP ME!!!) Subj: Re: More TML Pascal 89-06-04 10:49:59 EDT From: HyperRam Can anyone tell me what is WRONG with this???? Program BarTender (Input,Output); Uses ConsoleIO; Var A:Integer;X:Boolean; Procedure CheckAge; Begin If (A>21) or (A=21) then X:=True; If (A<>21) or (A<21) then X:=False; End; Begin WriteLN('You are at a bar...A bartender ask''s your age...'); WriteLN('How old are you?'); ReadLN(A); If X=True then Begin WriteLN('We have some good booze! Champain? Miller Light?'); WriteLN('Have a drink then! It''s on me!'); End; If X=False then begin WriteLN('Get out of here you child! Man, kids these days!'); End; WriteLN; WriteLN('[Return]'); Repeat until Keypressed; End. I thought I fixed it but it stills says get otu of here when its suppose to say have a drink! Ra Subj: Reproducable Crashes!! 89-06-04 11:25:56 EDT From: HyperRam Hey, I think I found a bug! (there are probably 2481742841 in it) Load TML Pascal, select new from the menu and close the window REALLY fast then click the apple menu-it LOCKS! All you can do is move the mouse! Subj: Re: More TML Pascal 89-06-04 18:37:59 EDT From: EmmanuelT1 Yo, Hyper after the ReAdLn(A) you need to do the procedure CheckAge it goes something like this, Begin {main} writeln(' Hey, kid how old are you ? '); read(A); CheckAge; etc... I Hope this helps ___________ Emmanuel |. Subj: Use the new folder 89-06-04 18:46:26 EDT From: EmmanuelT1 This folder has too many messages in it so I made a new one called More More TML Pascal. BTW - There is a bug in TML Pascal whene you select open then cancel it, really quick select a menu and it locks-up. ___________ Emmanuel |. Subj: TML not locking for me 89-06-05 06:10:42 EDT From: Dave Lyons HyperRam and Emmanual-- Both of you reported TML Pascal locking up when you click on a menu right away after (1) closing a window that was just opened or (2) cancelling an Open dialog. I tried both these & couldn't get it to lock up, but it *did* ignore my first mouse press. All I had to do was let go of the button and press it again, and all was well. Subj: various answers (to HR) 89-06-05 06:12:39 EDT From: Dave Lyons Geez, 13 questions (and 29 question marks) in one message, HyperRam! I'm impressed. The first two questions were "How does the formatting thing work?? There are 2 procedures! Which one do I call on???" I have no idea what these are talking about, so I suggest you re-ask them giving enough details that I have a shot at answering them without remembering what your previous messages were about (I do occasionally do things other than answer messages here, so I sometimes forget). How do you display a list of files from a directory under GS/OS? There is no simple way. You need to make the GS/OS calls OPEN, GET_DIR_ENTRY, and CLOSE, to begin with (you need the GS/OS manual, or the ProDOS 16 manual). That'll let you read the filenames (and other info about the files) into, say, an array. Then you need to decide what to do with them. (If you just want the user to select a file, use the Standard File toolset instead.) "Can you format from the vanilla mode?" Format what? A disk? Yes. Use the GS/OS "FORMAT" call. It will switch to text mode when you make the call since not all the desktop tools will be started up at that time, but it will switch back to your program's vanilla display automatically when the formatting dialog is done. "How do you draw pictures?[...]?" Too big a question. Use QuickDraw II. "Throwing squared on the ground??? What does that mean??" I don't know. You tell me. "I majorly mess up a dialog so the OK is 100 times big or the dialog is too small I CAN'T reach the ok sign! :) Is that dumb or what?" Yes. (Actually, experimenting is good; keep doing it. If the button you can't reach is the default button, you can press Return to select it even if you can't see it on the screen.) "...tear off menus (what are those?)" Tear-off menus are menus that you can drag down from the menu bar & just leave sitting around the desktop, where you can click on items just like if you were pulling it down from the menu bar. (When one is torn off, you can still use a copy of it from the menu bar, but you can only have one copy torn off at a time.) "What do you use for an NDA? {$DeskAcc -1 -1}??" Depends on what kinds of events your NDA wants to receive and how often the NDA wants to be called when nothing interesting is happening, in 60ths of a second. RTFM. "What is the difference between -1 -1 and -1 60?" The first -1 means all the different kinds of events will be received by the NDA. The second number specifies how often the NDA will be called when nothing is going on. -1 means never. 60 means every 60 60ths of a second (once a second). --Dave Subj: STATIC parameters not trashed? 89-06-05 06:27:39 EDT From: Dave Lyons Skip, I've never used the STATIC declaration, and I haven't been punished for it by having my actual parameters trashed. I bet something weirder is happening to you, but I don't know what. Subj: CheckAge never called 89-06-05 06:28:56 EDT From: Dave Lyons HR, Skip is right. Your program was never bothering to call the CheckAge procedure. When you declare a procedure in your program, it just *sits there* until you call it by name. Then it does its thing. By the way, this is a perfect example of how to use a function. I'll show you: Program BarTender (Input,Output); Uses ConsoleIO; Var Age:Integer; function OldEnough(howOld: integer): boolean; begin OldEnough := (howOld >= 21); { This is the same as saying: if (howOld>21) or (howOld=21) then OldEnough := true; if (howOld<21) then OldEnough := false; but it's simpler. } end; Begin WriteLN('You are at a bar...A bartender asks your age...'); WriteLN('How old are you?'); ReadLN(Age); If OldEnough(Age) then Begin WriteLN('Have a drink then! It''s on me!'); End else begin WriteLN('Get out of here you child! Man, kids these days!'); End; WriteLN; WriteLN('[Return]'); Repeat until Keypressed; End. Please ask about any of this that isn't clear. --Dave Subj: What's a mask? 89-06-05 06:34:47 EDT From: Dave Lyons A "mask" is something that allows or disallows things in a set of things. Usually one *bit* is used for each thing that can be allowed, so you can add together different values to enable several things. If you have a one-word value (16 bits, the same as an Integer in TML Pascal), the bits have values 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, and 32768. You can add together which ever ones you want to enable any collection of 16. Because "two's complement" numbers are used on the GS, you can subtract 65536 from any positive number and get a negative number that is represented in exactly the same way. If you add together all 16 values, you get 65535. When you subtract 65536, you get -1. SO -1 IS A MASK WITH EVERYTHING ENABLED! Event Masks are a good example--see the Event Manager chapter of Toolbox Ref, Vol 1 for specific values. Event Masks are used when you write an NDA--see the Desk Manager chapter. --Dave Subj: arrays and functions 89-06-05 06:40:38 EDT From: Dave Lyons More questions from HR. "What is D:=(x,y,Intger)????!???!?!??" I don't know--you tell me. To the compiler, it's an error as soon as you get to that first comma, if not earlier. Arrays are useful when you want to keep track of a bunch of items of the same kind. For example: program Reverse(input, output); var NumberList: array[1..10] of integer; i: integer; begin writeln('Enter 10 numbers one at a time, and I''ll show them'); writeln('to you in reverse order.'); for i := 1 to 10 do readln(NumberList[i]); for i := 10 downto 1 do writeln(NumberList[i]); end. --Dav Subj: HyperRam's Apple NDA, in progres 89-06-05 06:45:32 EDT From: Dave Lyons Your program is looking almost reasonable. The biggest problem is a chunk of VAR declarations where you're not allowed to have them--in the middle of a procedure. Function DaOpen : WindowPtr; { --- put them here --- } begin if myWindOpen then SelectWindow(myWindPtr) Else begin With myWind do begin { --- instead of here --- } var R : Rect; Dialog : DialogPtr; CurPort : GrafPtr; ItemHit : Integer; TString : Str255; Begin { you don't really need this BEGIN, or the END that goes with it, but it will work anyway } CurPort := GetPort; {...} The Action procedure is where you do the actual stuff that you want to do when your NDA is called while its window is already open. --Dave Subj: Re: More TML Pascal 89-06-05 21:11:47 EDT From: HyperRam Whoops aforgot the procedure! :) Sheesh! I BARELY UNDERSTANDED ANY OF THAT! O my gosh! I don't believe this! This IS helpless. (I can't enter my letter now-my degenerate brother keeps on disconeecting me!) Ram Subj: Re: More TML Pascal 89-06-05 21:48:35 EDT From: HyperRam Goto More MOre TML Pascal! Subj: Re: More TML Pascal 89-06-07 22:10:03 EDT From: SkipS Dave L, Boy you sure said a mouthful. This looks like a full time job! Thanks for your answers. About my STATIC problem, I've spent more time than I want to think about trying to figure it out. I'm pretty sure the problem is repeatable. Briefly, if a formal value parameter is a pointer to a string (or array of char) and in the scope of the procedure one uses the string (via the pointer) for almost anything (like a logical compare) the character data gets lunched, unless you use a STATIC parameter. If this is not the case, then I'd sure like to know what's going on! Thanks for any info, -Skip Subj: Re: More TML Pascal 89-06-07 22:17:38 EDT From: SkipS Oh yea, I forgot to add one more key ingredient. If there is nested function within the procedure that uses the string for a logical operation the problem will definitely happen. It's actually getting blown away within the nested function, not the procedure. I think the same thing happens with a nested procedure. I've found that if I assign a temp variable before the nested function and use only the temp variable in the function then everything works okay. I hope I understand this now. Please, tell me I do. :) -Skip Subj: Re: More TML Pascal 89-06-08 00:22:59 EDT From: EmmanuelT1 Dave, how does the FFStartSound work I think I understand the Record part (Wave address, freq, etc..) but Im not sure of the genNumFFsynth (what should I use for that ? ) Thanx in advance Emmanuel T. Subj: Re: More TML Pascal 89-06-08 00:26:48 EDT From: EmmanuelT1 BTW- what's the best book you can recomend for programing the Sound Toolset (I have the ToolBox Refrence 1 and 2) Subj: SkipS's TML problem 89-06-10 00:35:30 EDT From: AndyBoy1 SkipS, You mentioned problems with TML Pascal when combining VAR String, nested proc's, and STATIC. This sounds almost 100% like problems I've had with TML. There is definitely a compiler bug somewhere when you mix those ingredients. It would be useful to get some feedback from TML but I know I've definitely seen problems with that type of code. --Andy Subj: Re: More TML Pascal 89-06-12 18:26:24 EDT From: HyperRam I've noticed that sometimes it doesn't compile all the way-missing parts of the program. Ram Subj: nested procedures & trash 89-06-13 04:28:39 EDT From: Dave Lyons Ah! I hardly ever use nested procedures, so I have not noticed any bug that may exist there. Please send me the smallest program you can that demonstrates the problem--I'll compile it, verify the bug, and tell TML Systems about it pronto style, in case the alleged problem is still around in TML Pascal II. --Dave Subj: "missing parts of the program"? 89-06-13 04:31:00 EDT From: Dave Lyons HyperRam, what are you talking about? TML Pascal has never "missed" parts of my program unless I accidentally started a comment and didn't finish it. Subj: Re: More TML Pascal 89-06-13 20:37:15 EDT From: HyperRam No, like in part of the program lets say, WriteLN('Blah'); It won't print that on the screen when you compile. When you compile to disk and run it from there tho-everything is peachy. Subj: Re: More TML Pascal 89-06-13 23:15:07 EDT From: SkipS Dave, I wish I could upload an example but my Avatex keeps knocking me offline (grrr). Here's some psuedo code: var example: string; procedure test(sometext: string) {Static sometext: string -ok} function checkit begin if sometext = example then write(sometext); end; begin {test} checkit; end; begin example := 'abc'; readln(sometext); test(sometext); writeln(sometext) end. The 'sometext' variable will be garbaged, unless it's STATIC. -Skip Subj: Re: More TML Pascal 89-06-16 20:09:08 EDT From: HyperRam What is THAT!?