Struggling with a strange on screen format issue

Click For Summary

Discussion Overview

The discussion revolves around a formatting issue encountered while trying to run an old Fortran program on a new computer. Participants explore potential causes of strange characters appearing on the screen, which are believed to be related to ANSI escape sequences used for terminal control. The scope includes technical explanations and troubleshooting advice related to software compatibility and legacy systems.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Experimental/applied

Main Points Raised

  • One participant notes that the strange characters may be ANSI escape sequences used for controlling screen formatting on older terminals, suggesting that the program may need modification for modern screens.
  • Another participant mentions that the program is currently running on an old Windows XP machine and is being moved to a Windows 7 environment, where the issue persists.
  • Some participants inquire about the availability of the source code, indicating that having it could facilitate troubleshooting.
  • It is suggested that the program might be a DOS application and that running it in compatibility mode or using DOSBox could resolve the issue.
  • One participant points out that certain features related to ANSI sequences were removed in later versions of Windows, implying that upgrading to Windows 10 might help.
  • Another participant provides detailed examples of ANSI escape sequences and their functions, emphasizing the need for proper handling in the current operating system.
  • A later post indicates that adding the device ansi.sys to the config.nt file resolved the issue, sharing a resource for others who might face the same problem.

Areas of Agreement / Disagreement

Participants generally agree that the strange characters are related to ANSI escape sequences and that modifications or specific configurations are necessary to address the issue. However, there are multiple suggestions regarding the best approach to resolve the problem, indicating that no single solution is universally accepted.

Contextual Notes

The discussion highlights the challenges of running legacy software on modern systems, including potential compatibility issues and the need for specific configurations that may not be straightforward for users without programming experience.

Who May Find This Useful

This discussion may be useful for individuals dealing with legacy software, particularly those transitioning old programs to modern operating systems, as well as those interested in ANSI escape sequences and terminal control in computing.

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: 672
Technology 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
The feature that is being discussed was removed at some point after XP and replaced in Windows 10. If you update to Windows 10, it should work.
 
  • Like
Likes   Reactions: Asymptotic
  • #10
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
  • #11
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
  • #12
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
  • #13
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:
 
  • #14
HAHA! Thanks but no thanks! (but thanks for the kind words :)
 

Similar threads

Replies
2
Views
1K
  • · Replies 3 ·
Replies
3
Views
4K
Replies
6
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 32 ·
2
Replies
32
Views
5K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 25 ·
Replies
25
Views
2K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 3 ·
Replies
3
Views
8K