Struggling with a strange on screen format issue

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
13 replies · 2K views
NurseKaren
Messages
6
Reaction score
3
Hi,

I really hope someone here can help. I'm a nurse and not in the computer field (so I might be doing something dumb). We have a really old fortran system that we keep old history on. I'm trying to move the program onto a new computer. Its been a mission to do, but I've got through most issues on my own until I got to this one which I've been struggling with for a week.

The program starts up fine but seems to be showing strange characters before and after all messages on screen. A friend said they looks like 'carriage returns' to him.

See attached image.

Please help, thank you kindly in advance.
 

Attachments

  • fortran.png
    fortran.png
    1.3 KB · Views: 686
Physics news on Phys.org
:welcome:

I'm not 100% sure, it has been a while. But those characters look like the codes used to control screen colors, cursor position, bold, italic and so forth on one of those old video terminals. Terminals like the DEC VT100. I'm guessing that the program was written to be specific for that terminal. To fix it, you'll have to modify the program to take away all the stuff that does not apply to modern screens. That may not be easy. Good luck.
 
  • Like
Likes   Reactions: Asymptotic, 256bits and Tom.G
Okay interesting, thanks for the reply. The program is currently running on a really old Win XP machine and I'm trying to move it on Win7 running on a XP Virtual machine. I'm getting those characters on the new win7 machine.
 
Welcome to the PF. :smile:

Do you have the source code? Or are you trying to do this with just an executable?
 
berkeman said:
Welcome to the PF. :smile:

Do you have the source code? Or are you trying to do this with just an executable?
Just the executable. I can't code. Its really old not sure if the source code is still around.
 
It's worth it to ask around. If we have the source code, that would help a lot.
 
NurseKaren said:
Okay interesting, thanks for the reply. The program is currently running on a really old Win XP machine and I'm trying to move it on Win7 running on a XP Virtual machine. I'm getting those characters on the new win7 machine.
You are looking at Ainsi escape sequences.
The Ainsi command starts with the ESC character 27 dec ( 1Bhex ), which is showing up as the left arrow.
Then the bracket.
Then the characters that control the screen or keyboard.
https://www.computerhope.com/ansisys.htm

Is your program running in a compatibility mode on the old XP machine?
I would think your program is a DOS program ? Console.

You may have to check the old config.sys on XP - not sure of the file name, where the device Ainsi.sys is loaded.
Maybe someone else can help with the device driver loads for virtual systems.

Your new machine is probably running Win 7 64 bit.
That could complicate matters, just musing outloud.

Been a while also.
 
  • Like
Likes   Reactions: Asymptotic and berkeman
Those are formatting sequences, they do things like color. Looks like they worked in an older DOS, but not in the Windows shell because it's not actually DOS. It might work in PowerShell or Cygwin, but the easiest solution would probably to run the program through a program called DOSBox, which you can download for free. I use DOSBox for old DOS games, which do not work on Windows at all.
 
  • Like
Likes   Reactions: Asymptotic
Echoing what the others have said, you are looking at ANSI escape sequences hearkening back to the days of DEC video display terminals. The left arrow is what many DOS-based programs used to signify 'ESC' (ASCII code 27), and what comes after the left bracket are instructions to the display terminal on how to proceed.

For instance, from your example,
Code:
ESC[0;37;40m    
'm' suffix indicates this is a change in graphics mode
0; reset all attributes
37; set foreground color to white (foreground would be the text color in this case)
40; set background color to black
    Elsewhere, ";33:" sets foreground to yellow

ESC[2J
Erase display

ESC[06;30H
'H' suffix indicates where to place the cursor
Move cursor to line 6, column 30

ESC[K
erase line (this is what clears the password line after the password has been entered)

What operating system are you using?

I've never had the need, but get someone from your IT department involved, and find out whether Jason Hood's ANSICON utility does the trick.
 
  • Like
Likes   Reactions: berkeman
Wow, such amazing answers. So helpful, thank you so much. You folk are incredible. *hug*!

Will try some next week and see how I go.
 
  • Like
Likes   Reactions: berkeman
Hi again,

After a few hours struggling and lots of reboots it's finally working yay!

I added the device ansi.sys to the config.nt file and my problem disappeared.

Article how to do it in case anyone else has the problem: https://support.microsoft.com/en-au/help/101875/how-to-enable-ansi-sys-in-a-command-window

Thank you so much for your help, I wouldn't of solved this without you. Thank you!
 
  • Like
Likes   Reactions: Asymptotic and berkeman
NurseKaren said:
After a few hours struggling and lots of reboots it's finally working yay!
And after only a week! Are you sure you don't want a job as a Programmer?:wink:
 
HAHA! Thanks but no thanks! (but thanks for the kind words :)