forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Changing screen text colours

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
richard



Joined: 03 Oct 2005
Posts: 1

PostPosted: Thu Oct 06, 2005 1:05 am    Post subject: Changing screen text colours Reply with quote

I wish to change the screen text colours (in DOS mode) by sending the appropriate escape sequences to ANSI.SYS. I have done this successfully with other Fortran compilers but I cannot get it to work with FTN95. What happens is that the escape sequence appears on the screen (which it shouldn't) and the text colour remains white. Thus it seems, in effect, that nothing reaches ANSI.SYS. I also wish to send the escape sequence to clear the screen. I haven't tried this yet but I suspect that this won't work either. Any suggestions would be much appreciatd!
Back to top
View user's profile Send private message
JohnH



Joined: 26 Sep 2005
Posts: 13

PostPosted: Thu Oct 06, 2005 2:31 am    Post subject: Changing screen text colours Reply with quote

Richard

Try the following format which I used to use in DOS mode (many years ago!):-


CHARACTER*9 F

COMMON /TEK/ISEQ(120)



F='( A1,$)'

WRITE(F(2:4),'(I3)')NCHAR

WRITE(6,F)(CHAR(ISEQ(I)),I=1,NCHAR)


Where ISEQ contained the character index numbers (= ICHAR(character) ) and NCHAR was the number of characters to send.

I hope it works.

John
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Thu Oct 06, 2005 10:34 am    Post subject: Changing screen text colours Reply with quote

Here is some undocumented stuff that may be useful....

PROGRAM colours
CALL SET_CONSOLE_COLOUR@(7)
CALL CONSOLE_WRITE@("7 ")
CALL SET_CONSOLE_COLOUR@(Cool
CALL CONSOLE_WRITE@("8 ")
CALL SET_CONSOLE_COLOUR@(9)
CALL CONSOLE_WRITE@("9 ")
CALL SET_CONSOLE_COLOUR@(10)
CALL CONSOLE_WRITE@("10 ")
CALL SET_CONSOLE_COLOUR@(11)
CALL CONSOLE_WRITE@("11 ")
CALL SET_CONSOLE_COLOUR@(12)
CALL CONSOLE_WRITE@("12 ")
CALL SET_CONSOLE_COLOUR@(13)
CALL CONSOLE_WRITE@("13 ")
CALL SET_CONSOLE_COLOUR@(14)
CALL CONSOLE_WRITE@("14 ")
CALL SET_CONSOLE_COLOUR@(15)
CALL CONSOLE_WRITE@("15 ")
CALL SET_CONSOLE_BACKGROUND@(9)
CALL CONSOLE_WRITE@("OK"//CHAR(10))
CALL GET_CONSOLE_CURSOR_POS@(ix,iy)
CALL SET_CONSOLE_CURSOR_POS@(20,iy+1)
CALL CONSOLE_WRITE_CHAR@(ICHAR('!'))
END
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Thu Oct 06, 2005 3:12 pm    Post subject: Changing screen text colours Reply with quote

Are you sure that the ANSI.SYS system is loaded? I seem to have great difficulty with this installable device driver in Windows XP, but have had much better luck with a small COM file named ANSI.COM which you run immediately after opening a console window. You can also get it to unload after use, although simply closing the console window unloads it. You run your console application through a batch file such as "runprog.bat", where the batch file looks like

ansi
myprog
ansi /u

The copy I have of ANSI.COM is only 3kb long. My copy is dated 1989. It supports all the usual ANSI ESCape codes, and a few that aren't in ANSI.sys. I did a GOOGLE, and after some searching I found it: http://www.pcmag.com/article2/0,1759,1556221,00.asp

There is something similar called NANSI, which is available in SYS and COM versions (http://alumnus.caltech.edu/~dank/nansi/ or maybe http://www.kegel.com/nansi/) and an update to that called NNANSI - I had forgotten about those oddities.

It seems that from Windows ME it has become difficult to impossible to load ANSI.SYS, so I really do suspect that not having ANSI.SYS is at the root of your problems.

Eddie B.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Fri Oct 07, 2005 12:30 am    Post subject: Changing screen text colours Reply with quote

Please note the following alternative to the code that I posted...

PROGRAM colours
INTEGER oldColour,SET_CONSOLE_COLOUR@
oldColour = SET_CONSOLE_COLOUR@(7)
Back to top
View user's profile Send private message AIM Address
Anonymous
Guest





PostPosted: Fri Oct 14, 2005 4:35 am    Post subject: Changing screen text colours Reply with quote

Thank you all very much for your advice and suggestions which really are appreciated. I have tried them all but I'm afraid that I am still struggling (which may, I realise, just be due to my own ignorance as I am more of an occasional programmer rather than an expert) The root cause of the problem would seem to be that, unlike previous compilers I have used, the WRITE statement in FTN95 does not seem to "reach" ANSI.SYS even though I have checked that it actually is loaded. I've also tried using ANSI.COM, again without success. I am sort of resigned to the fact that I will just have to live with this but if there are any more suggestions I would be very grateful to receive them. Once again, many thanks for all the support so far. Does anyone know how to send a command to clear the screen of text?

Richard Scott
Back to top
JohnH



Joined: 26 Sep 2005
Posts: 13

PostPosted: Fri Oct 14, 2005 12:36 pm    Post subject: Changing screen text colours Reply with quote

Okay Richard

This WILL work !

Any DOS command can be issued from a FTN95 application by calling CISSUE

So to clear the screen of text, do:-

CALL CISSUE('CLS',IFAIL)

IFAIL is returned as zero if the command was successful.

regards
John Smile
Back to top
View user's profile Send private message
Anonymous
Guest





PostPosted: Fri Oct 14, 2005 2:41 pm    Post subject: Changing screen text colours Reply with quote

John, thank you VERY MUCH!! Success at last! Seriously, I really am very grateful. Thanks.

Richard Very Happy

Richard
Back to top
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Fri Oct 14, 2005 3:09 pm    Post subject: Changing screen text colours Reply with quote

I have to apologise for misleading information. ANSI.com had enabled me to use ESCape codes in Windows 2000, and I assumed it would work in XP. It doesn't. What does work, however, are the old text screen commands from FTN77, e.g. SCREEN_CLEAR@.

Here is a use of SCREEN_CLEAR@

PROGRAM STUFF
WRITE(6,*) ' To be cleared '
CALL CLEAR_SCREEN@
WRITE(6,*) ' Now I am writing ... '
STOP
END

I just tried it, and you don't see " To be cleared ", but you do see " Now I am writing ..."

There is a mention of CLEAR_SCREEN@ in the FTN95 online documentation, but it does read as though this is a Windows function - it probably is as well.

Emboldened by this discovery, I added a call to COUP@ - another old DOS text screen routine - just before the STOP. The precise statement I used was:

CALL COUP@('Some coloured text', 5, 10,10)

Lo and behold, it worked. The parameters are a CHARACTER string to print, the DOS colour index (5 in my case), column and row (10 and 10 respectively, measured in standard way from top left of the screen). The colour index, according to FTN77 documentation, is the 8 least significant bits of an INTEGER. Bits 3,2,1,0 define the foreground colour (0 to 15), bits 6,5,4 the background colour (0 to 7) and bit 7 whether it flashes or not.

The 16 foreground colours are, as in ANSI, 8 colours in standard and "bright". The documentation (see later) says that to get the colour index for flashing red (4) text on a green (2) background, the index is set to 1*128 + 2*16 + 4.

The documentation is in Chapter 21, starting on page 163 of the "Library.pdf" file which used to be online as documentation for FTN77 (I don't know if it is still). COUP@ can't be found in the FTN95 help file - at least, I couldn't find it. If LIBRARY.PDF is no longer available, and Paul doesn't mind, I could send it to you ... some of the other stuff may work as well. It's around 2Mb.

I suppose this is also a definitive answer to your original question - hooray and about time too!

Eddie Bromhead
Back to top
View user's profile Send private message
Anonymous
Guest





PostPosted: Sat Oct 15, 2005 4:43 am    Post subject: Changing screen text colours Reply with quote

Eddie,

Real progress! The library file is still available online and I have successfully downloaded it. A veritable mine of useful information! Very many thanks indeed. Much appreciated.

Very Happy

Richard Scott
Back to top
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Sat Oct 15, 2005 11:55 am    Post subject: Changing screen text colours Reply with quote

Richard,

Glad to be of service, and apologies for misleading you originally.

I wonder what else from DBOS FTN77 is still lurking around, undocumented, in FTN95?

Eddie
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group