AppleLink APPLE II DEVELOPMENT FORUM CONFERENCE LOG August 8, 1989 10:00 p.m. eastern time Topic: Assembly Language Forum Leader: Dave Sugar (AFL Dyfet) A GibberFC Coach.... I think I might have a fix for Aple and the unclaimmed interrupt problem. A GibberFC I am using a Practical Prepherials External... and I haven't run into a problem A GibberFC yet.... I have been using the different modem for about 3 days now Nagendra I HAVE A QUESTION FOR PRE START Nagendra HOW DO I SET UP A FONT IN MEMORY? Coach101 Hmmmmmm...... I am beginning to suspect that some interrupts are not AFL Dyfet Okay, LISTEN UP, we will be starting tonight's conference NOW *CRACK* A GibberFC Got rid of my Internal Datalink 2400 A GibberFC Owwwwch Coach101 claimed by ALPE when the 6850 reports errors via interrupts... AFL Dyfet Good evening and welcome to The Apple // Development Forum Tuesday night AFL Dyfet conference. We WILL be using PROTOCOL here tonight, (And yes, your question AFL Dyfet was not forgotten, Nagendra...), which means that from now, if you wish to AFL Dyfet ask a question, please enter a '?' on a line by itself, and if you wish to AFL Dyfet comment on the question currently being discussed, enter a '!' on a line by AFL Dyfet itself. Tonight's topic is Assembly Language Programming, and our first AFL Dyfet question will be from Nagendra. You have the floor now, Magendra, please go AFL Dyfet ahead... Nagendra I WANTED TO KNOW HOW TO SET UP A FONT IN MEMORY Nagendra MEANING HOW DO I TELL THE TOOLS THAT I WANT THE NEXT CHARACTER OUTPUT Nagendra TO BE IN THE FONT I SPECIFY A2GS Crowded! AFL Dyfet Are you wishing to use fonts already located in the fonts subdirectory or a A GibberFC (afk) AFL Dyfet new font from your application only? Nagendra A NEW FONT NOT IN THE DIRECTORY AFL Dyfet Okay, who feels like tackeling this one tonight (looking at Matt)...GA Matt :) Matt DTS Given the lack of takers, may I suggest this moves to the message base where it can get the time it Matt DTS probably needs? AFL Dyfet I think I will have to agree with you there, Matt...any other takers? DavidD117 taken AFL Dyfet Okay. GA Nagendra, you still have the floor... Nagendra I'M USING THE SETFONT(HANDLE) TOOLCALL, BUT THEN WHEN I DISPLAY Nagendra SOMETHING ON THE SCREEN, THE OUTPUT IS BLANK.. AFL Dyfet GA Dave...seems we're narrowing down :) Dave Lyons Lemme see if I understand this: Are you loading a disk-based font, in exactly Dave Lyons the same format as the ones in the Fonts directory, into a (locked) handle of Dave Lyons your own, and using SetFont on it? (If so, there is a problem.) Nagendra yes, that's a what I'm a doing Dave Lyons Oh--and are you dereferencing the handle? (SetFont takes a *pointer*, not Dave Lyons a handle.) Dave Lyons The first problem is that a font like the ones in the Fonts directory has some Dave Lyons stuff *before* the real QuickDraw font. There's a File Type Note on this, Dave Lyons in the July batch, I think. It's just a one-byte length count followed by Dave Lyons a string that's the name of the font--but you'll have to skip over that before Dave Lyons using SetFont on that data. Matt DTS (May batch, I think.) Dave Lyons (Ok.) Matt DTS Nagendra O.K. what if I move the font into the /fonts/ directory? Dave Lyons Then the new font is accessible the *next* time you start up the Font Manager, Matt DTS ! (unless you wanna keep going) Dave Lyons which usually means the next time you run your program. Shutting down and Matt DTS ! (anyway; Dave's missing something) Dave Lyons restarting the FM is a possibility if you're the application, but you shouldn't Dave Lyons do it unless you feel comfortable with the consequences. What am I missing, Dave Lyons Matt? Nagendra I don't know to approach it that way AFL Dyfet GA Matt... Matt DTS SetFont isn't an FM call - it's a QD call. There may not be an FM here. Nagendra That's correct it's tool 4, function 148 Dave Lyons (I wasn't missing that, I was just ignoring it. To use the Font Manager, Dave Lyons you'd use InstallFont instead of SetFont.) AFL Dyfet Okay...I think at this point we should probably move this to the appropriate AFL Dyfet discussion folder, so that others may have a chance to benifit from this AFL Dyfet insight... AFL Dyfet I see that the floor is now open for questions...feel free to get yours in :) SUPERMAN20 I have a question! AFL Dyfet Okay, Superman, GA... SUPERMAN20 How do you access the auxillary memory in the IIE/IIC? AFL Dyfet That depends on what you wish to do...there is a firmware routine at $c3xx for AFL Dyfet moving chunks of memory back and forth between main and auxillory memory. You AFL Dyfet can also, concievably, use the ProDOS 8 ramdisk driver block I/O calls for the AFL Dyfet same purpose. AFL Dyfet GA Parik. AFA Parik $C311 moves memory between main and aux. $C314 transfers control from main AFA Parik and aux. you can also use softswitches to transfer between main and aux. AFA Parik ga AFL Dyfet You have to be careful using the softswitches though..you do not want the AFL Dyfet piece of code that is doing that to be in a part of memory that is being AFL Dyfet switched out :) AFL Dyfet Any further comments? AFL Dyfet Okay, I guess we will be turning the floor over to Parik, then...GA Parik... AFA Parik does anyone know of a good utility for Orca/M or APW that will let you see what AFA Parik parts of your source code are unused? maybe something that uses the obj files? AFA Parik ga AFL Dyfet You mean to find dead end code and such? Hmm...a tricky thing to do, even for AFL Dyfet most optimizing compilers :)..>GA Matt. Matt DTS I don't know of one. It would be tricky to do all right, especially given GS tendencies... Matt DTS ...to push addresses on the stack and RTS or RTL. :) Sorry. GA. AFL Dyfet Coach? GA... Coach101 I have seen it done by compilers (and cursed the sons-of-bitches for Coach101 complaining when I was commenting out code in a debugging session) but A GibberFC cancell ? Coach101 have never seen it done with object units. I think it would be nearly Coach101 impossible to do it from object units... sorry.... gs AFA Parik bummer :) how big is a relocation dictionary? Coach101 gs ==> ga AFA Parik (sorry if I ramble, just thinking of things I've always wondered about :) AFL Dyfet Well, in regards to the relocation dictionary, since the 65xxx can do very A GibberFC (brb) AFL Dyfet little with relative addressing, any memory reference will have to be adjusted, AFL Dyfet so they can get quite large...:) AFA Parik so is it better to use BRLs than jumps, etc? AFL Dyfet GA A2GS... A2GS I would assume that the larger your SRC the larger the Dictionary and would... A2GS have to definitely agree that BRL's are the way to make them shorter if... A2GS your really worried :) AFA Parik :) AFL Dyfet I believe BRL's take a few more cycles than a pure JMP, but yes, there would AFL Dyfet not be a relocation entry for a BRL, and hence the resulting object module AFL Dyfet would be smaller on disk (although it will, after loading, still use the same AFL Dyfet ammount of memory, of course). AFA Parik (i wonder what orca/c and pascal and tml pascal II...etc use) AFL Dyfet GA A2GS... A2GS the # of cycles depends on whether your doing a JML as opposed to a JMP... A2GS in which case it would be the same. :) (just maintaining a level of accuracy) AFL Dyfet I would assume we would be comparing to a JMP, since BRL's cannot go beyond the AFL Dyfet current code segment. A2GS good point! AFL Dyfet Okay, I believe our next question is from Joe...Ga Joe... JSchober Mmm... _DrawString has really been acting strangely on me lately. I use it to A2GS Bra's tend to be equal or shorter to JMP's depending on whether their direct A2GS or nt. JSchober put comments and titles around my dialogs (modal), but instead of drawing the JSchober text I want it to, it just puts up all sorts of neat symbols. I've taken a JSchober look at what's being pushed onto the stack, tracing with NList, and it seems to JSchober all be in order. Am I just flakey?? (What makes it worse is that this is JSchober =generated= code, from DLU) GA... Matt DTS (drat; he beat me) Dave Lyons Since you get symbols and not just garbage pixels, the Font is probably still Dave Lyons okay. Are you pushing a pointer to something that can't move? (Don't pass Dave Lyons a pointer to a string in an unlocked&unfixed handle.) ga AFL Dyfet Matt? GA... JSchober Mmm, well, it's to a static text string within the code itself.. Matt DTS Mine was simpler - make sure the high bits are cleared. (sometimes assembler directives can Matt DTS sneak up on you.) GA. Dave Lyons What language is DLU generating the source for, Joe? JSchober Zat's not it, Matt -- sometimes I get parts of directory listings, mail from JSchober ALink, anything. ;) '816, Dave. I'm using pure assembly, no bizarre multi- JSchober language development. Matt DTS Are you using 16-bit addressing and pushing a pointer when the B register may not be set? Matt DTS (B = DBR) Dave Lyons (That was my next guess.) Dave Lyons (So DR=1. :-) Matt DTS (that's *always* his next guess. It's embarassing at restaurants when they're out of Pepsi.) JSchober Mmmmm... I'm pushing a pointer to a text string. Don't think I fiddle with JSchober the registers. Funny thing is, some DrawStrings work, others (still made by Matt DTS What's the "push the pointer" code look like? JSchober DLU) don't. Seems random. JSchober Hold a sec, Matt. Dave Lyons So you have PUSHLONG #xyz, or PEA xyz|-16, PEA xyz ?? Matt DTS (or ph4 #xyz, for ORCA/Maniacs) AFL Dyfet :) JSchober PushLong #SvTypDLHeader, _DrawString, [...] A2GS Is it always the same string which get's screwed up? JSchober SvTypDLHeader DW 'Save picture in which format:' JSchober Yes, A2GS. JSchober (the colors are all correct, BTW, and I use a MoveTo to put the symbols in the JSchober right place... %) A2GS You sure your not changing the DBR anytime previously? Matt DTS What's the "DW" directive do? JSchober I'm =pretty= sure, but I'll check. Think it's identical to STR, Matt. Dave Lyons Have you located the string in memory before and/or after the code gets Dave Lyons executed? JSchober After. It's in the same place where the PEA's in the code are pointing to. Matt DTS (The debugger init comes in real handy for these kinds of things.) Matt DTS Something else must be wrong. Send us a sample that fails and we'll track it down. JSchober Ok, it'll be in your box right after this chat. Thanks. :) Dave Lyons After the thing gets drawn wrong, the string is still in memory & correct? JSchober Yuppers, Dave. A2GS try doing a phk, plb before running the DrawString routine if you are A2GS supposed to be in the same bank as where your code is executing from. Dave Lyons The B register doesn't matter for DrawString--if he's using PH4 # or whatever, Dave Lyons it doesn't matter for that, either. Dave Lyons (ga) Matt DTS (ga) A2GS is he using a label for the pointer push address? JSchober Right, it's a long address. Well, I'll just beam over the code fragment. JSchober Thanks. :) GA... (yup, A2GS...) AFL Dyfet Okay, any further comments? JSchober (but I only have one segment of code) AFA Parik (never mind mine) AFL Dyfet (your question, Parik?) A2GS could have something to do with it, would have to look at src :) AFA Parik yes AFL Dyfet Okay, the floor is open to questions again... A2GS Why does hair turn gray (sometimes)? hehe :) AFL Dyfet Don't all rush now... Matt DTS I think Earthquakes are a large part of it, A2GS. AFL Dyfet I heard about that, Matt... A2GS Been to San Fran. lately? Matt DTS The quake was centered about 5-15 miles south of Cupertino. AFL Dyfet 5.1 was it? Matt DTS 5.1, with 4.1 and 4.2 aftershocks. A2GS Their goes the new GS. A2GS The Apple II production plant fell into a huge hole created by the earthquake.. AFL Dyfet Still some aftershocks for 5.0??? :) AFA Gary J How was the 8th floor? (or whatever it is) A2GS as claimed by Apple. Matt DTS The Apple II production line is in Singapore! A2GS Their feeling the aftershocks. AFA Gary J Ahhh! It fell all the way to China! AFA Gary J Wow. AFL Dyfet The Mac plants are still in the US, I believe...:) Dave Lyons We're only on the 3rd floor...no damage in *my* cube. A2GS I wonder why? Mothers always like to keep their children near them :) Dave Lyons (My cube doesn't *need* any damage, of course...you couldn't tell by just Dave Lyons *looking* at it that an earthquake hadn't caused all that stuff to be all over Dave Lyons the floor. :) Matt DTS The main US Mac factory is in Fremont, CA; the main international one is in Cork, Ireland. AFL Dyfet Fremont is at the end of one of the Bart lines, from what I recall... AFL Dyfet South one, I believe... Matt DTS Anything else? AFL Dyfet The floor is still open for questions....feel free to ask away... A2GS Anyone had any experience with programming a Ray Tracer? AFL Dyfet Ray tracing? No, I have not...now there is a good use for Math co-processors:) AFL Dyfet (I almost typed Matt co-processors :) AFA Gary J heheh A2GS Anyone familiar with the algorithms associated with a Ray Tracer? Matt DTS Just what you need - extra power working at being me. JSchober Might want to get in touch with AFL Scott. He's the graphics guru of ALink. :) A2GS Thanks. AFL Dyfet This is true... AFL Dyfet GA Doctor, you have the floor... Doctor Why Any words of wisdom on using SetHeartBeat? Matt DTS We have words on ClrHeartBeat. Boy, do we have words. AFL Dyfet Just don't use purge to remove your task when your done! :)...GA A2GS... AFA Parik and sentences? and paragraphs? A2GS I could very well be wrong, but doesn't Gary Little have some example src in A2GS his book on operating systems? AFL Dyfet I do not recall offhand...the format and rules for a heartbeat task are fairly AFL Dyfet easy to follow, however....I should know, even I was able to do it :) AFA Parik yes - Little has stuff on heartbeat, 1 second, and other interrupt routines A2GS thought so, thanx AFA Parik in Exploring GS/OS and ProDOS 8 JSchober Gotta cruise -- see y'all later! AFL Dyfet One think to keep in mind is that your heartbeat task will have to reset the Matt DTS A2GS bye AFL Dyfet task tick counter when it's called, or your task will never be called again! A2GS I think its easier to use the softswitches and then patching the interrupt Doctor Why Can the Heartbeat routine be written a higher level language? A2GS handler pointer in bank E1. AFL Dyfet I think that would be a no-no, A2GS :) Matt DTS It's easier to crash the system that way, for sure. AFL Dyfet Or as Matt said... AFA Parik why would it crash the system? Doctor Why I seem to pretty good at that already. :) A2GS against Apple, true, but easier to keep track of what's going on every step A2GS of the way. Matt DTS Softswitches and interrupt vectors are generally system resources that are finicky in nature. Matt DTS It especially tends to disagree with AppleTalk. AFL Dyfet And subject to change... AFA Parik but the main int vector is guaranteed not to change. as long as you jsl back AFA Parik to the original one, I don't see why it would be "bad"? AFA Parik (er, JML A2GS Dyfet that's really the only problem....Heartbeat has to eventually patch Matt DTS As long as whatever interrupts you didn't process weren't lost in the time you took to look at them. A2GS the pointers. AFL Dyfet I've taken over the main int. vector myself to impliment multitask threading, AFA Parik ok, i see. Matt DTS I wouldn't feel so bad about patching the VBL interrupt vector, but please leave the main one Matt DTS alone if you possibly can. AFL Dyfet but it does add overhead chaining to the 'proper' routine down the road... Matt DTS (I think we've lost protocol, Dave) Dave Lyons (Got kicked off trying to abort an upload. :-( ) You *can* legitimately do a A2GS the hard way :) going through the main interrupt manager. Dave Lyons VBL task from C--I helped somebody do that a couple weeks ago. Just declare Dave Lyons and fill in an appropriate header structure--when you get to where the code Dave Lyons goes, put a CHAR with value 0x5C (a long Jump) and then a pointer to your A2GS HG Dave Lyons function. Works neat. Remember to preserve and set the B register inside A2GS Had no problems patching it for a # of interrupts, so far....hehe Dave Lyons your function if you're using global variables in there. Also you need to Dave Lyons REP #$30 in there somewhere. That's important (& I forgot to do it the first Dave Lyons time or two.)