Silverfrost Forums

Welcome to our forums

Application with dbos on XP

16 Oct 2007 6:38 #2367

Hello,

I am a student in a university in Switzerland, currently I work on a semester project which is a application from the nineties. The application was compiled with ftn77 and uses dbos. It runs only on win 95 and win 98. My job is it, to recompile this application that it works on a newer windows like xp. Is it possible to use still dbos? by what can dbos be replaced? or what is the easiest way to run this application on win xp?

best regards

16 Oct 2007 8:00 #2368

Hello,

DBOS is history, you can forget it ! It's purpose was to allow ftn77 applications to address expanded memory beyond the 640 kilobyte limit of the 16bit processors of early PC's. It was an excellent product at the time and worked very well. But now, with 32bit (or Win32) machines it is no longer necessary. Just simply re-compile your source code with the latest ftn95 compiler. There is no real reason for it not to work, unless the original source code included some of the ftn77 code extensions (like graphics), but even then most of these have been ported to ftn95, and only a little work may be necessary to correct any problems.

16 Oct 2007 3:44 #2370

hello john,

thanks a lot for your prompt response. i will try to compile it with the ftn95. i will post again when it don't work.

regards

11 Nov 2007 10:02 #2420

hello john, I tried to re-compile the source code with the latest ftn95 compiler, but I have some errors that are bounded to the graphical library. So the next step I would like to do is to replace the graphical library. Do you now maybe an “open source“ library, that I could also modify, or a similar library that includes this functions:

screen_type() (graphics.h) graphics_mode_set() (graphics.h) text_mode() (graphics.h) draw_line() (graphics.h) draw_text() (graphics.h) clear_screen_area() (graphics.h) graphics_write_mode() (graphics.h) get_high_res() (graphics.h)

attach() (lib.h) get_printer_status()(lib.h)

best regards

11 Nov 2007 11:03 #2421

Users have reported that you can use DBOS and therefore FTN77/486 if you create a VM with Virtual PC. Virtual PC is free and would provide you with a running application while you think about your options.

http://www.microsoft.com/windows/products/winfamily/virtualpc/default.mspx

11 Nov 2007 2:49 #2423

The first stage in converting from FTN77 & DBOS era graphics to FTN95 is to accept that you are going to need to create a Windows application. This can be as primitive or as full-featured as you like. You can do it using .NET or the older ClearWin approach. I use ClearWin. There used to be a demo program named PLOT.FOR distributed with FTN77+clearwin. This became PLOT.F90 and seems to have disappeared from the demos distributed with FTN95. Basically, you open a window with Clearwin. In this window, you create a graphics region. It used to be done with the %dw code (the example is in PLOT.FOR), but the newer %gr is better (PLOT.F90 uses this). You need to tell windows that you want RGB graphics mode. The, you use the standard library graphics routines provided in FTN95 to draw into the graphics area. You will find direct replacements for every library subroutine in the old graphics library - some of them are even the same name. When it comes to printing your colour graphic, the simplest way is to get a screen dump and print that. The next simplest way is to open a windows printer and redraw the graphic. The graphics areas on the screen and printer obviously have different sizes, so that you need to interrogate any new 'device' for its size before you begin drawing. You switch between devices such as a graphics area on the screen or a printer by means of an integer number called a 'handle' - every windows object, be it a menu item, 'button', graphics area etc has its own unique handle. Here's my version of PLOT with printing built in ...

  OPTIONS (INTL)
  WINAPP

  PROGRAM PLOT
  IMPLICIT NONE
  INCLUDE <WINDOWS.INS>  ! you can USE CLRWIN instead

! Remember to declare your call-back functions EXTERNAL INTEGER4, EXTERNAL :: ABOUT_FUNCTION,PLOT_FUNCTION,CLEAR_FUNCTION INTEGER4, EXTERNAL :: PRNT_FUNCTION INTEGER A, ICTRL, iXRES, iYRES, ictrl COMMON / SCREEN / iXRES, iYRES, ictrl iXRES=GetSystemMetrics(SM_CXSCREEN)*0.7 iYRES=GetSystemMetrics(SM_CYSCREEN)*0.7 A=WINIO@('%ca[Simple drawing program]&') A=WINIO@('%mn[&File[E&xit]]&','EXIT') A=WINIO@('%mn[&Help[&About ClearWin+ PLOT]]&',ABOUT_FUNCTION) A=WINIO@('%ob%gr[rgb_colours]%cb%lw&',iXRES,iYRES,ictrl) A=WINIO@('%rj%10bt[Clear]&',CLEAR_FUNCTION) A=WINIO@('%2nl%rj%10`bt[&Plot]&',PLOT_FUNCTION) A=WINIO@('%2nl%rj%10bt[Print]&',PRNT_FUNCTION) A=WINIO@('%2nl%rj%10bt[E&xit]&','EXIT') A=WINIO@('%ww[maximise]') END

  INTEGER FUNCTION CLEAR_FUNCTION()
  USE CLRWIN         ! Salford Clearwin + GUI
  IMPLICIT NONE
  CALL CLEAR_SCREEN@()
  CLEAR_FUNCTION=1
  END

  INTEGER FUNCTION ABOUT_FUNCTION()
  USE CLRWIN
  IMPLICIT NONE
  INTEGER A
  A=WINIO@('%ca[About ClearWin+ PLOT demo program]&amp;')
  A=WINIO@('%cnPlot Demo&amp;')
  A=WINIO@('%2nl%cn%`7bt[OK]')
  ABOUT_FUNCTION=1
  END

  INTEGER*4 FUNCTION PLOT_FUNCTION()
  USE CLRWIN
  IMPLICIT NONE
  INTEGER A, ICTRL, iXRES, iYRES, ictrl, IX0,IX1, IY0,IY1
  COMMON / SCREEN / iXRES, iYRES, ictrl
  CHARACTER*20 TITLES(3)
  DATA TITLES/'First title         ', 'Second title        ', 
 1            'Third title         ' /
  call DRAW_TEXT@(TITLES(1),iXRES/10,iYRES/10,RGB@(255,0,0))
  call DRAW_TEXT@(TITLES(2),2*iXRES/10,2*iYRES/10,RGB@(0,255,0))
  call DRAW_TEXT@(TITLES(3),3*iXRES/10,3*iYRES/10,RGB@(0,0,255))
  IX0 = iXRES/10;   IX1 = iXRES*9/10
  IY0 = 5*iYRES/10; IY1 = iYRES*6/10
  CALL DRAW_LINE@(IX0,IY0,IX1,IY1,RGB@(0,0,0))      
  PLOT_FUNCTION=1
  END

  INTEGER*4 FUNCTION PRNT_FUNCTION()

C implicit integers used in this routine INCLUDE <WINDOWS.INS> CHARACTER20 TITLES(3) DATA TITLES/'First title ', 'Second title ', 1 'Third title ' / IA = OPEN_PRINTER@ (jHDC) CALL SET_CLEARWIN_STRING@(PRINTER_DOCUMENT, 'PLOT graphic') CALL GET_CURRENT_DC@ (jHDC) CALL USE_RGB_COLOURS@(0,1) C CALL USE_RGB_COLOURS@(0,.true.) C See info on Get Device Caps on MSDN iXRES = GetDeviceCaps(jHDC, HORZRES) iYRES = GetDeviceCaps(jHDC, VERTRES) CALL SELECT_FONT@('Arial') CALL SIZE_IN_POINTS@(14,7) call DRAW_TEXT@(TITLES(1),iXRES/10,iYRES/10,RGB@(255,0,0)) call DRAW_TEXT@(TITLES(2),2iXRES/10,2iYRES/10,RGB@(0,255,0)) call DRAW_TEXT@(TITLES(3),3iXRES/10,3iYRES/10,RGB@(0,0,255)) IX0 = iXRES/10; IX1 = iXRES9/10 IY0 = 5iYRES/10; IY1 = iYRES6/10 CALL DRAW_LINE@(IX0,IY0,IX1,IY1,RGB@(0,0,0)) CALL CLOSE_PRINTER@(JHDC)
! see other options if you want to print more than one page
PRNT_FUNCTION=1 END

You have to set font size, otherwise printed fonts are too small. SET_CLEARWIN_STRING@ gives a proper heading in the print queue. Note that in PRNT_FUNCTION, iXRES and iYRES aren't put into the common block! I have deliberately mixed USE CLRWIN and INCLUDE <CLEARWIN.INS> so that you can see both styles. Beware of where I have used C as a comment, and where I have used a continuation marker in column 6 - these don't come over well in this forum.

Eddie Bromhead

11 Nov 2007 2:56 #2424

The message was truncated. Here's the rest:

  INTEGER*4 FUNCTION PRNT_FUNCTION()

C implicit integers used in this routine INCLUDE <WINDOWS.INS> CHARACTER20 TITLES(3) DATA TITLES/'First title ', 'Second title ', 1 'Third title ' / IA = OPEN_PRINTER@ (jHDC) CALL SET_CLEARWIN_STRING@(PRINTER_DOCUMENT, 'PLOT graphic') CALL GET_CURRENT_DC@ (jHDC) CALL USE_RGB_COLOURS@(0,1) C CALL USE_RGB_COLOURS@(0,.true.) C See info on Get Device Caps on MSDN iXRES = GetDeviceCaps(jHDC, HORZRES) iYRES = GetDeviceCaps(jHDC, VERTRES) CALL SELECT_FONT@('Arial') CALL SIZE_IN_POINTS@(14,7) call DRAW_TEXT@(TITLES(1),iXRES/10,iYRES/10,RGB@(255,0,0)) call DRAW_TEXT@(TITLES(2),2iXRES/10,2iYRES/10,RGB@(0,255,0)) call DRAW_TEXT@(TITLES(3),3iXRES/10,3iYRES/10,RGB@(0,0,255)) IX0 = iXRES/10; IX1 = iXRES9/10 IY0 = 5iYRES/10; IY1 = iYRES6/10 CALL DRAW_LINE@(IX0,IY0,IX1,IY1,RGB@(0,0,0)) CALL CLOSE_PRINTER@(JHDC)
! see other options if you want to print more than one page
PRNT_FUNCTION=1 END

Note that I have used both forms (USE CLRWIN and INCLUDE <WINDOWS.INS>) for getting the standard definitions in. CALL SET_CLEARWIN_STRING@ is used to put a proper title in the print queue. The standard font size is fine on the screen, but too small in the hard copy, hence SIZE_IN_POINTS@.

Beware - I use fixed format, and so my continuation markers in column 6 don't show properly here in the forum, and where I have used a C in col 1 for a comment this doesn't show well either.

Regards

Eddie Bromhead

20 Nov 2007 12:56 #2453

Hello, at first thanks for your respond. Because I need an alternative if the compilation failed, I installed Virtual PC, and installed win98 on it, how you said. The win98 runs well, but not dbos. Anyone knows how I should install dbos on win98 in Virtual PC? Do I have the correct version of dbos? Thats the error message:

Microsoft(R) Windows 98 (C)Copyright Microsoft Corp 1981-1999.

C:\WINDOWS>DBOS [DBOS/486 Version 3.12 Copyright (c) Salford Software Ltd 1995] General protection exception at User/7F983845 In routine _oinit(<ref>struct-ostream_withassign,int) at location +AB In routine __initialise_cpplib at location +01A1 In routine INITIALISE_SYSTEM@ at location +0546 Trace aborted Flags=00010202 (GT No carry Even parity DF = forward Co-cw/sw = 037F/0000) EAX%=786EDD10 EBX%=00000000 ECX%=00000001 EDX%=786EDD04 EBP%=786EDDAC ESI%=786EDC68 EDI%=786EDD10 ESP%=786EDC98 7F983845) INB AL%,DX%

@ LitusSaxonicum: thanks for your code, but at the moment I am not sure what I will exactly do with my application. I have to understand more about the source code that I get of the application before.

20 Nov 2007 2:15 #2454

DBOS has been unsupported for many years so we are unable to provide detailed support.

You will need access to an old FTN77 manual otherwise it is difficult to see how you can proceed.

After that you will need to modify the SYSTEM.INI file in order to use the WDBOS.386 virtual device driver. WDBOS.386 is essential if you wish to run DBOS in a DOS box in Windows enhanced mode.

Find the “[386enh]” section in your SYSTEM.INI. On a fresh line, after the last “device=” directive, enter: device=c:\dbos.dir\wdbos.386

or its equivalent depending on where wdbos.386 is located.

Please login to reply.