America Online APPLE II DEVELOPMENT FORUM CONFERENCE LOG Tuesday, June 16, 1992 10:00 p.m. Eastern Time Topic: BASIC Programming Forum Leader: Gary Jacobson (AFL GaryJ) AFL GaryJ Welcome to the Apple II Development Forum! :) AFL GaryJ Tonight's topic is BASIC programming, and whatever else you'd like AFL GaryJ to discuss. AFL Marty I used to do BASIC. AFL GaryJ I think Fred is a BASIC fan, I take it? FredW GS BASIC #1 !!! AFL GaryJ What version of BASIC is your favorite, Fred? FredW GS Micol Advanced BASIC for GS. FredW GS For 8 bit machines I'd advise ZBASIC. Sheppy Ugh. Sheppy ^--- My opinion of ZBasic... :) FredW GS Don't like ZBASIC Sheppy?? Sheppy Not particularly. AFL GaryJ ZBASIC is pretty good for the 8-bit machine. Sheppy It's not bad... I just don't get along with it very well. :) FredW GS Really all I had to compare it to for 8 bits is Applesloth. AFL Marty ZBasic is pretty excellent for 8 bit. AFL GaryJ There's not much else available (other than some of the Applesof compilers) AFC SteveB Let's hear it for "GS Basic"...hehe. :) AFL GaryJ :) Sheppy I never figured out GS BASIC, actually... AFL Marty Micol makes a compiled basic for 8-bit machines, doesn't it? AFL GaryJ I think they do, Marty FredW GS Micol allows full access to the toolbox...and now has GSOS call support. AFL GaryJ Although, I don't know anyone who has it. (Most people use Micol for the IIGS that I AFL GaryJ know of) AFL Marty I have a copy of it around here somewhere. FredW GS Which leads me to a question...what GSOS calls need to be made to access the FredW GS modem port? Sheppy You can just read and write, can't you? FredW GS Not exactly...You can use INSLOT and OUTSLOT...but they have severe limitations AFA Jay Cantcha just open a driver and read and write to it? just like one would AFA Jay do for .Console? AFC SteveB Truthfully, Joe "Transfusion" Wankerl's prolly the expert. :) Sheppy Jay, yeah, you can do that. FredW GS I had thought you could use some TB calls but I was told "DON'T USE THE TEXT TOOLS" FredW GS So it was suggested that I use the Modem driver via GSOS calls. AFL GaryJ Fred, you can "open" and "read/write" to a modem port through GS/OS. Sheppy You have to find the modem port driver by searching the devices by DInfo calls, Sheppy since it's generated. JWankerl Yeah, modem device ID is 9 - start at device 1, do DInfo until you find a 9. Sheppy That's what the Character FST is for, anyway... printers, modems, and the Sheppy text screen. :) JWankerl However, the generated drivers don't buffer things. JWankerl Luckily the IIGS Firmware port buffers stuff for you. FredW GS Yep, that's what was suggested...I suppose I need the GSOS refernce manual?? AFL GaryJ Yes, Fred :) JWankerl Also, if you're going to an internal modem, it will show up as a generic JWankerl character device, not a modem device, plus it won't be buffered. FredW GS If they don't support buffering they are of no use...The firmware handle buffer FredW GS no? Sheppy The firmware buffers the built-in serial ports. It doesn't know how to Sheppy buffer anything else. FredW GS This would be specifically for the serial port...internals will have to come FredW GS later. Sheppy That makes your job MUCH easier! :) FredW GS OK well I guess its off to get the GSOS manuals >sigh< Sheppy Join the club... you can get by with just the GS/OS Ref., but you might want Sheppy the Driver Ref. too. FredW GS Can someone explain what 1st and 2nd level GSOS calls are? Sheppy 1st and 2nd? You mean Class zero and class one? FredW GS Let me check... Sheppy (ie, ProDOS 16 compatible and GS/OS calls) FredW GS MAB only supports class one calls. Sheppy MAB is a very nice program, then... those are real, honest-to-gosh GS/OS calls! Sheppy :) FredW GS Will I need class zero calls to use the modem port? JWankerl No, you should do everything with class 1 calls, Fred. Sheppy Never use class 0 calls unless you wanna run under P16. AFC SteveB Remember Fred, go First class! Not Zero class. :) AFC SteveB What I need to do is look for a modem driver, generated ever so AFC SteveB kindly by GSOS via DInfo calls. Then I OpenGS it... AFC SteveB And read/write. How much does GSOS like to spill out onto me AFC SteveB when I Read? 1 byte at a time? JWankerl You can read/write as much as you want. It works just like any other JWankerl read/write call. JWankerl I go for 1 character at a time, though. JWankerl Oh yeah... do a DStatus call... AND with $20 (I think) and that'll tell you JWankerl if a character is waiting or not. AFC SteveB 1 character sounds cool, too. And it with whar result from the param blk, Joe? JWankerl It's all in the transfusion source code, Steve... don't you got it? :-) FredW GS Look for a modem game by the end of the summer! IN BASIC!! AFL GaryJ (I got discouraged with my modem game) FredW GS Did someone here write one?? FredW GS How come Gary?? AFL GaryJ Fred: My game was designed to move faster than I could handle the info through the AFL GaryJ modem. FredW GS The problem with MAB built in routines is it hangs at the port if there is no FredW GS info there. FredW GS Well this WON't be an action game unfortunately...more like strategy. Sheppy Strategy games typically are easier to do on modems, anyway... FredW GS So charcters will come it small burst, but buffering should handle that till FredW GS I catch up :) FredW GS Question: Anyone have any ideas how to synchronize sound to video for my FredW GS project?? AFL GaryJ Fred, what kind of sound and video? FredW GS For MOVIE.VIEWER, I am adding sound to the movies. AFL GaryJ (I mean, how syncronized does it need to be?) FredW GS Perfectly :) AFL GaryJ I see. That would be difficult. FredW GS I can only think of making small sound chunks and keying them off specific frames AFL Marty Hopefully more synchronized than those old Chinese kung-fu movies :) AFL GaryJ That would be my suggestion, Fred (what you said). AFL GaryJ Otherwise, machines that run at different speeds would play the video differently. Sheppy Sounds like fun. _YOU_ do it, Fred! :) FredW GS :) AFL Marty You could just change the speed of the machine, couldn't you? FredW GS Right now, I'm just loading the sound up (long) and playing it in the backgroun FredW GS d. FredW GS Can I make a non-BASIC question. FredW GS HOW THE HECK DO YOU MULTIPLY IN ASSEMBLY???? AFC SteveB _Multiply :) AFC SteveB Use the IntMath call, Fred. FredW GS Succesive adds?? Sheppy Well, if speed don't count, use Int. Math's _Multiply. JWankerl Yeah, call the integer math tool set. :-) AFL GaryJ If you have access to the toolbox, then use it! JWankerl Multiply by 2 = ASL A Sheppy Then there's multiplying by 2s and adding what's left over (if ya wanna do it Sheppy all by yersef) :) AFL GaryJ Otherwise, you do adds and shifts. FredW GS I'll have to make up a logic table and see how hard it'll be to shift. JWankerl Well, then there's always SANE... (ducking :-) Sheppy I've seen very popular, highly rated COMMERCIAL programs that added and Sheppy subtracted successively to do multiplication and division. Ack!! :) FredW GS I have to multiply integers in the range of 1 to 16. AFL GaryJ The efficiency of the code depends on if you have a fixed value to multiply by. Sheppy Fred, do you mean two numbers from 1-16 being multiplied together or a Sheppy max. value of 16? Sheppy (as result) AFL GaryJ Most of the 8-bit assemblers came with source code or macros for doing AFL GaryJ integer math. AFL Marty Why don't you just set up a lookup table? FredW GS Two numbers up to a max value of 16 (so max result of 256 16x16. AFL Marty There are only 256 possible products. AFL GaryJ Good point, Marty. If there is a small and finite number of possibilities, you AFL GaryJ can use a lookup table. AFL GaryJ (It also depends on if speed is an issue) Sheppy Ah, I see, Fred. A lookup table might be a good way to go. Sheppy Yeah, if speed isn't a major concern, I'd just use _Multiply and be done Sheppy with it. FredW GS So time to buy the TB references to :( FredW GS I can't afford to progeram any more :) Sheppy >>> going out to buy bookstore <<< :) AFA Andy Fred, you should look at the cost of setting a Mac for programming. Sheppy MPW is pretty cool, but the learning curve is real steep. FredW GS The cost would be my soul :) Sheppy Yeah, Fred, I think Mac users put them in little pentagrams and light black Sheppy candles... :) AFL GaryJ Here's the man who could probably answer your HCIIGS question, Marty :) AFL Marty Mike... can ResCopy be used to copy rPicture resources from stack to stack? Nuzz I haven't ried that Marty, but it would be simple to do that Nuzz Just pass the rPicture resource # and see what happens AFL Marty I tried that earlier tonight but it didn't work. I may have made a mistake AFL Marty with the syntax though. Nuzz Just looked at the syntax, and it should work Marty Nuzz BTW, it has to be a Named Resource, Marty AFL GaryJ Has everyone here registered for the IIGS Pascal class? AFL GaryJ (Online at Programmer U) FredW GS <- The lone GS Basic crusader.. Matt DTS Any programming questions? Sheppy Say, is it normal to have to manually change the size of an rText resource Sheppy after doing a TEGetText into it? Matt DTS What do you mean "manually change the size?" Sheppy Well, here's the problem. I call TEGetText, passing the ID of an EXISTING Sheppy rText resource. Sheppy But when I display that text (doing a TESetText into a TE control), I get Sheppy garbage at the end of it. So I do a SetHandleSize, UpdateResourceFile on it, Sheppy and the trash is gone. Is that normal? Dave Lyons Sheppy, I'll take a look at it...what format are you getting the text with? It probably makes Dave Lyons a different (pstring, cstring, unformatted, LETextBox2, etc). Sheppy Oh, yuck... LETextBox2... :( Sheppy But I've never had problems with it when getting into a NEW resource ID. Pest II looked at Tim Swiharts twoo.beeps NDA Pest II haven't been able to change the window to a modelss dialog Dave Lyons Sheppy, so it's an rTextForLETextBox2 resource, right? Sheppy Right, Dave. Sheppy This happens when I'm replacing the contents of an LETextBox2 resource with Sheppy new text. Pest II I've been programming in Pascal with the Desktop (NDAs rather) AFL GaryJ Sign up for the online IIGS Pascal class from Jim Merritt Pest II I should shouldn't I...though I'm cheating a little since I'm not as up on Pest II Pascal as I should be AFL GaryJ (I have to fit that in there every chance I can get! I want enough people to AFL GaryJ sign up to make the class worthwhile :) Pest II how advanced is it Gary? AFL GaryJ Well, the class assumes that you already know Pascal. The class will AFL GaryJ be directed at utilizing IIGS features from Pascal (i.e. the Toolbox) AFL GaryJ And the course book will be to do the "Hello World" program from the Lichty and AFL GaryJ Eyes book in Pascal. Pest II I'd like to at least be a passive student -- perhaps take it as a non-credit Pest II couse :-) AFL GaryJ The course is free of charge, except for online connect charges, of course. AFL GaryJ And Jim Merritt will be teaching it. Pest II I'll probably be there then Gary AFL GaryJ The sign up is taking place right now, Pest, and the classes will begin on July 13th, AFL GaryJ with an open house on July 6th. Pest II alas...I still can't afford to go to KansasFest...but this I can afford FL GaryJ It should be really worthwhile. Jim has put a lot of preparation into the class. KimBrennan Pardon me, but do any of you still use Orca/C? [Silly leading question] Sheppy Sure, I use Orca/C. Sheppy (v1.3 even :) KimBrennan I encountered what looks like a shell bug...sorta weird one actually. Sheppy What's that? KimBrennan When I ran some code (developed for class) the number came out wrong..... KimBrennan however when I ran the same code redirected to a file the numbers were correct Sheppy Yeah? That IS strange? How wrong were these numbers? KimBrennan Blew my mind, and really irritated me (I don't know how long I was looking KimBrennan for a bug). KimBrennan I was initializing an 'array' to the index value i.e. 0 1 2 3 4 5 etc. Sheppy Right, then what? KimBrennan Without redirection the numbers appeared as 16553 3275 18 -1299 etc. KimBrennan Nothing near right. KimBrennan With redirection everything worked fine Sheppy Hmmmmm. KimBrennan I'me using 1.3 so I'm up to date. Sheppy That tugs a switch somewhere... Sheppy Yeah, that's a strange problem. Sounds like the bytes aren't being Sheppy dealt with correctly somehow. But I don't see how zero can come out to Sheppy 16553... Sheppy It's almost as if the variables were getting modified somehow. KimBrennan Of course, this is a little hard to show other people cause my redirected KimBrennan output looks fine :) KimBrennan The strange values are caused by the array not being initialized (as per KimBrennan the requirements of the program). Sheppy Yeah... that's the problem, isn't it? Um, do you get the same results every Sheppy time? Sheppy Ah, I see... So you're saying that when you don't redirect, your array Sheppy isn't getting initialized? KimBrennan Yep. KimBrennan The values are consistant in multiple runs one after the other. KimBrennan And consistant inbetween redirections Sheppy Hmmmm. I don't see how that could be... is that even across rebooting? KimBrennan They vary if I've compiled in between Sheppy Right. Okay... KimBrennan I'm using malloc (i'd rather use calloc, but got to follow what the prof wants) Sheppy That's definitely strange. I haven't the foggiest idea what's going on there. Sheppy Ah, for class, huh? Sheppy OH!! You're using a dynamically allocated array, then? KimBrennan Yes.... KimBrennan <---waiting for the shoe to drop.... Sheppy Hmmm.... I recall hearing somewhere that there's a bug or two in the malloc Sheppy routine. Sheppy How big is the array? KimBrennan Um, 8 integers. Sheppy Hmmmm. I don't _think_ that's the problem, then. KimBrennan I thought it interesting enough to want to bring it to others attentions Sheppy You might check out the Byteworks area. Someone may have already mentioned Sheppy this problem. KimBrennan Yah, I guess (wish they had a search on message title, like they do for xfers) KimBrennan HAHA, right like the prof will understand my code then ! Sheppy No, I mean, just to see if the code works right then. If it does, the prob. Sheppy is a bug in Orca. Sheppy Kim, your best bet is to check out the ByteWorks area... AFL GaryJ Mike Westerfield will be here in two weeks AFL GaryJ (To do a chat about ORCA/Debugger)