bradley@drutx.ATT.COM (DavidsonBC) (08/28/90)
I am almost being forced to write a system for the University in Turbo pascal, But since I do not own turbo pascal let me ask some questions..... 1) How much control of the screen do I have for positioning characters and drawing with the extended ASCII set of the IBM? 2) If there is not that much control in Turbo Pascal then can I use C and link that together with the turbo Pascal? Is the parameter passing block defined anywhere or do I have to get Debug out? Opinions welcomed and even requested so that I can make an informed choice instead of a deformed choice. Thanks, Brad Davidson
lowey@herald.usask.ca (Kevin Lowey) (08/30/90)
From article <6028@drutx.ATT.COM>, by bradley@drutx.ATT.COM (DavidsonBC): > > 1) How much control of the screen do I have for positioning characters and > drawing with the extended ASCII set of the IBM? All the extended ASCII characters are available simply by writing CHR(x) where X is any number between 0 and 255. What the character actually is depends upon the DOS CODEPAGE currently in use. As for the control available, it depends upon whether you use the CRT unit or not. If you don't, then all you can use is ANSI.SYS calls to position the cursor, etc. If you add the line USES CRT; at the beginning of your program, then you get a rich set of routines for screen manipulation, including: CLREOL : Clear to end of line CLRSCR : Clear the screen DELAY : Pause the indicated amount of time DELLINE : Delete the line including the cursor GOTOXY : Go to a screen location HIGHVIDEO : Set high intensity characters (yellow by default) INSLINE : Scroll lines including and below cursor down one line within the current "window" (scrolling region) Lowvideo : Low intensity characters (grey by default) NormVideo : Set "normal" video (yellow I think by default) NoSound : Turn off the speaker Sound : Make sound on the speaker at given frequency. Usually used in SOUND ... DELAY ... NOSOUND sequence TEXTBACKGROUND : Set the current background colour TextColor : Set the current foreground colour Window : Define a rectangular scrolling region Keypressed: Returns TRUE if a key has been pressed READKEY : Waits for a key to be pressed, then return that key immediately without waiting for a RETURN. WHEREX : Return x location of the cursor. WHEREY : Return y location of the cursor. CHECKBREAK : Enable / disable CONTROL-C checking CHECKEOF : Treats CTRL-Z as EOF if TRUE, or ignores it if FALSE CHECKSNOW : Eliminates snow on CGA monitors when directvideo is true DIRECTVIDEO: Use BIOS calls if false, direct video access if TRUE LASTMODE : Remember last video mode so you can restore it later TEXTATTR : Text Attribute Byte. Assigning new values to it sets colours blinking, underline, etc. WINDMIN & WINDMAX : Current scrolling region coordinates ASSIGNCRT : Lets you associate a text file with a CRT device driver you write (advanced screen control for supporting alternate CRT units, like DesqView aware systems, or windowing systems) > 2) If there is not that much control in Turbo Pascal then can I use C > and link that together with the turbo Pascal? That should be good enough for you, but if you want to you can link in any .OBJ file with the compiler {$L} directive and procedures marked EXTERNAL. > Is the parameter passing block defined anywhere or do I have to > get Debug out? Chapter 15 of the Turbo Pascal 5.0 reference manual deals with the following topics: - The Heap Manager - Internal Data Formats - Calling Conventions - Linking with Assembly Language - Inline Machine Code - Direct Memory and Port Access - Interrupt Handling - Text File Device Drivers - Exit Procedures - Automatic Optimizations Should be enough of the nuts and bolts to keep anyone happy. And if not, the source code is available for all the libraries ... - Kevin Lowey (LOWEY@SASK.USASK.CA LOWEY@SASK.BITNET)
dmurdoch@watstat.waterloo.edu (Duncan Murdoch) (08/30/90)
In article <1990Aug29.235707.20159@herald.usask.ca> lowey@herald.usask.ca (Kevin Lowey) writes: >From article <6028@drutx.ATT.COM>, by bradley@drutx.ATT.COM (DavidsonBC): >> >> 2) If there is not that much control in Turbo Pascal then can I use C >> and link that together with the turbo Pascal? > >That should be good enough for you, but if you want to you can link in any >.OBJ file with the compiler {$L} directive and procedures marked EXTERNAL. Not quite true: only a very limited subset of .OBJ files are linkable. You have to write them specifically to meet TP's standards; you can just barely link C code, but not if it uses any library calls. Duncan Murdoch dmurdoch@watstat.waterloo.edu
derek@sun4dts.dts.ine.philips.nl (derek) (08/31/90)
bradley@drutx.ATT.COM (DavidsonBC) writes: > I am almost being forced to write a system for the University in Turbo pascal, > But since I do not own turbo pascal let me ask some questions..... > 1) How much control of the screen do I have for positioning characters and > drawing with the extended ASCII set of the IBM? > 2) If there is not that much control in Turbo Pascal then can I use C > and link that together with the turbo Pascal? > Is the parameter passing block defined anywhere or do I have to > get Debug out? >Opinions welcomed and even requested so that I can make an informed >choice instead of a deformed choice. >Thanks, >Brad Davidson You can do pretty well anything in TP as long as you know what you are doing. Some things are not too well documented, but normally you will not need them. One real power you have is inline code and inline macros, so those really difficult, but small things, can be coded in assembler. If you do need external code, it's easy to incorporate them as object files, but these have to follow certain rather stringent rules about names of sectors and such like. Microsoft C does not follow these rules, but turbo C does. Hope that helps. Best Regards, Derek Carr DEREK@DTS.INE.PHILIPS.NL Philips I&E TQV-5 Eindhoven, The Netherlands Standard Disclaimers apply.