Emulating Monochrome/VGA Multi-Screen setup?

Developer's Forum, for discussion of bugs, code, and other developmental aspects of DOSBox.

Re: Emulating Monochrome/VGA Multi-Screen setup?

Postby robertmo » 2012-5-12 @ 15:10

you posted some more info here viewtopic.php?t=7745
User avatar
robertmo
l33t
 
Posts: 4746
Joined: 2003-6-18 @ 10:35

Re: Emulating Monochrome/VGA Multi-Screen setup?

Postby ripsaw8080 » 2012-5-12 @ 16:17

There's also some games/apps listed in the huge wall of text up above.

You made me read it... again... but there's still nothing specific buried in there other than MJVGA.

I don't have Mechwarrior 2 Mercenaries, but it sounds like it uses the mono display passively, so may work with the patch as is.

Rise of the Triad does have a MONO command line switch, but it seems useless. 3DRealms released the ROTT source in 2002, and all of code that might try to write debug messages is marked off with "#if 0" blocks, so apparently not compiled into the release.

I'll see if I can get SoftICE working in dual mode, but I recall having trouble getting it to work at all in DOSBox...
User avatar
ripsaw8080
DOSBox Author
 
Posts: 4402
Joined: 2006-4-25 @ 23:24

Re: Emulating Monochrome/VGA Multi-Screen setup?

Postby DosFreak » 2012-5-12 @ 16:49

You made me read it... again... but there's still nothing specific buried in there other than MJVGA.


hehe mission accomplished!

Found this:

AutoCAD

http://www.vintage-computer.com/vcforum ... 10979.html

"I don't know about version 1, but in the 386 era, AutoCAD (for DOS only back then) was unique in that it wouldn't run if you had HIMEM.SYS and EMM386.EXE loaded. It also had dual-monitor support: EGA/VGA/etc. for graphics, and MDA monochrome for commands, as opposed to flipping back and forth between graphics and text mode, or having a small text window at the bottom of the CAD screen."

viewtopic.php?t=27372

"Too bad. There's a large amount of old business software for DOS out there that use this "dual" monitor setup. Like I said, many old C Developer Kits (like Watcom and Microsoft SDK) for instance, as well as some CAD programs."

Borland Turbo Debugger
http://www.seasip.info/VintagePC/dualhead.html
PowerBASIC DOS

http://sourceforge.net/projects/bochs/f ... ic/3001868

RHIDE
http://www.rhide.com/

SOFTICE

"You could also use a second monitor for debugging: the old monochrome ibm pc monitors with a hercules monochrome graphics card serves this purpose when issuing the command ALTSCR ON to softice."

WINDOWS/DESQVIEW/OS/2

http://www.hanselman.com/blog/TheSweetS ... nitor.aspx

"I've always wanted more than one monitor. I remember sometime in the mid-eighties being thrilled when I discovered that I could install a monochrome "Hercules" card alongside my existin g VGA card and type 'mode mono' from the DOS prompt while running Windows, Desqview or OS/2 and effectively run command line batch processes on one monitor while doing Windowy stuff on the other. This was 25+ years ago and I've never looked back."
User avatar
DosFreak
l33t++
 
Posts: 10424
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: Emulating Monochrome/VGA Multi-Screen setup?

Postby Stull » 2012-5-12 @ 18:00

This whole topic is pretty fascinating to me because I never knew it was possible. I wonder if any BBS packages would let you take advantage of a second display, maybe with stats you'd commonly see at the waiting-for-caller (WFC) screen?
User avatar
Stull
Member
 
Posts: 310
Joined: 2011-10-07 @ 20:46

Re: Emulating Monochrome/VGA Multi-Screen setup?

Postby robertmo » 2012-5-13 @ 09:16

I tried two versions of Mechwarrior 2 Mercenaries (normal and 3dfx one)
normal needed 105 and 106 patches for the -m switch to appear
the 3dfx already have it
both dont show anything in second window during play
User avatar
robertmo
l33t
 
Posts: 4746
Joined: 2003-6-18 @ 10:35

Re: Emulating Monochrome/VGA Multi-Screen setup?

Postby ripsaw8080 » 2012-5-14 @ 11:10

Mechwarrior 2: Mercenaries v1.06 does display the AI state info on the mono display. The -m switch must be given to MW2.EXE, but it isn't carried over from the MERCS.EXE launcher. I don't know if this is simply the way it is designed, or if the launcher or shell programs decide not to carry over the switch for some reason. It might make sense that an advanced debugging feature is only possible with the manual command line.

When you choose "Instant Action" from the menu, MW2.EXE is launched like this:

MW2.EXE ran0scn1 -b=launch.scr -cd=D

The first parameter is the name of one of the .BWD files, the third parameter is the CD drive letter. You can execute the above line directly to start the instant action scenario, and of course add the -m switch.
User avatar
ripsaw8080
DOSBox Author
 
Posts: 4402
Joined: 2006-4-25 @ 23:24

Re: Emulating Monochrome/VGA Multi-Screen setup?

Postby ripsaw8080 » 2012-5-20 @ 17:34

I have enhanced the patch to where the secondary display can be used actively. By "actively" I mean displaying the shell and running programs; making the window active will shut off input to DOSBox.

- Writing the display is done with a 50 Hz refresh (like MDA), and a render cache is employed to avoid unnecessary writes. The previous patch had the memory handler hooked directly to the display routine, which bogged down the system when lots of data was rapidly written to the video memory.

- The cursor is emulated using a character similar to the intended cursor shape. This is not ideal, but PDCurses is character-based, so there's no other option. I think it works reasonably well, all things considered. Note that the cursor is not enabled until the display is made active, so it won't appear for passive uses like the mahjong game.

- Started out making some small fixes for DCC (Display Combination Code), but ended up making a unified function for getting/setting DCC.

- MODE.COM is implemented as an internal program on the Z: drive. Make the secondary display active with the command "mode mono", and the primary display active with a color adapter mode, such as "mode co80". Changing the keyboard typematic rates is also possible. Use the "mode" command with no parameters to get usage info. The real DOS utility does more than this, but a lot of it is either not useful to DOSBox or found in other config settings.

- MORE.COM is also implemented just for fun. It works pretty much identical to the real DOS utility. Piping is not currently supported in DOSBox, so you have to use the redirection form (e.g. MORE < README.TXT); however, you can use piping with the 4DOS shell.

- There are a few shell command enhancements. Most notably the CLS command only clears the screen instead of setting mode 3; which preserves loaded fonts in EGA/VGA, and also doesn't leave mono mode. PAUSE and TYPE have small improvements I learned about from MORE.

Some DOS programs pay attention to the color/mono flag in the BIOS config word, but some don't. Even if they're essentially text-based, they may insist on using color functionality even when executed from mono mode, causing various effects on the primary display. Rogue and Snipes are examples of text mode games that adapt themselves to the color/mono flag.

Image

The SoftICE and CodeView debuggers detect and use the secondary display. However, they have issues in DOSBox caused by their sleight of hand with BIOS data. DOSBox's internal video BIOS and mouse driver depend a great deal on INT 10h calls to change video parameters, but the dual-screen debugging swaps in different mode data without calling INT 10h to switch screens.

For dual-screen debugging to work without glitches, you will probably have to load a real video BIOS, boot real DOS, and load a real mouse driver (if you can find one that doesn't rely on INT 10h to detect mode change). The patch enables the LDGFXROM program on the Z: drive, allowing a video BIOS to be loaded; and all of the BIOSes I have tried correctly detect the secondary mono adapter.
User avatar
ripsaw8080
DOSBox Author
 
Posts: 4402
Joined: 2006-4-25 @ 23:24

Re: Emulating Monochrome/VGA Multi-Screen setup?

Postby ripsaw8080 » 2012-6-14 @ 12:38

The patch now supports most of what a secondary mono display can be used for, so this is probably the last iteration unless problems are found or people volunteer to do development and/or testing on the Mac and Linux platforms. There are a few video BIOS fixes (such as the INT 43h vector in text modes), the CLS command handles graphics modes the way real DOS does, and the major enhancement is that dual-display debugging works correctly.

The remaining problem with dual-display debugging was "non-initializing mode changes" (my term for it), where a program changes the video mode by writing a different mode number into BIOS data without calling INT 10h function 00h. The issue with this kind of mode change is that DOSBox's CurMode object (containing various mode parameters) is not updated. I found a generic solution that appears to work well; and I no longer see signs of confusion in the internal video BIOS, mouse driver, and DOS regarding which mode, and thus which display, is active.

CodeView, SoftICE, Turbo Debugger, and PowerBASIC are working fine and no glitches appear as with the previous patch. The Turbo Debugger for Windows 3.x is particularly interesting to see working in dual-display mode. The DOSBox debugger is IMO a better choice for low-level debugging than something like SoftICE, but CV, TD, and PB can work at a higher level with source code and symbol data.

Image

I expect that few people will actually use the patch for dual-display debugging, but of course the passive functionality of the secondary display is still available for games like Mah Jongg VGA and MechWarrior 2.

Speaking of games, the ZZT series works in mono mode, but the Kroz series has an issue. Kroz asks if you have color or monochrome, using different attributes depending on your choice; however, it relies on mode 3 being translated to mode 7, which works in a mono-only environment, but not in a dual mono/color environment. It's possible to use a simple TSR to constrain text modes to mode 7 while the system is in mono mode, which mostly works for games like Kroz, Castle Adventure, and others provided they use INT 10h to write to the screen. A limitation of monochrome for ZZT is that colored doors and their matching keys are visually indistinguishable. It seems that ZZT, Kroz, Castle Adventure, Rogue, and similar games benefit from using the lowest possible key repeat delay, so it's useful to have the built-in MODE.COM for changing that.

Image

In addition to the patch and build, I've attached an archive containing an assortment of IBM video adapter (MDA, CGA, EGA, VGA) fonts converted to Windows raster fonts that are suitable for the console as well as other uses.
Attachments
display2_active2.diff
Patch
(27.81 KiB) Downloaded 327 times
dosbox_display2_active2.zip
Win32 build
(1.19 MiB) Downloaded 420 times
IBM_console_fonts.zip
Console fonts in FON format
(22.1 KiB) Downloaded 343 times
User avatar
ripsaw8080
DOSBox Author
 
Posts: 4402
Joined: 2006-4-25 @ 23:24

Re: Emulating Monochrome/VGA Multi-Screen setup?

Postby NY00123 » 2012-6-14 @ 21:16

...And, here is a quick and dirty port to Linux. The attached diff file has been generated, based on ripsaw's latest diff and against a bit older SVN revision I've got here (r3779).

Some caveats to watch out for:

- As usual, if one is trying this out, you're using this at your own risk!
- The modification has been tested on Ubuntu 12.04, x86_64 arch. While I've left Windows-specific code in the diff, that has been untested. In general, different environments are totally untested.
- I couldn't get automatic terminal resizing to work; So, outside Windows, it's disabled for now. I know that, with the help of ncurses, the DOSBox debugger can do it here; Or at least, if gnome-terminal is used (and not, say, xterm). For some reason, I couldn't replicate it even with gnome-terminal for the dual-head state.
- "Unusual" characters (non-ASCII ones) may not appear as expected. Maybe it can be fixed with the right codepage, but I haven't dealt with it for now.
- I also haven't tried any font other than the default.

As for a couple of actual results: The ROTT copy I've got here seems to output nothing to the Hercules screen, even with "ROTT MONO" passed. Maybe it's a forgotten leftover, indeed.
However, I've then tried running the "Monkey Island" demo, with "midemo h". The result is some textual "garbage" appearing on the terminal. As you quit, the DOSBox prompt basically relocates to the (Hercules) terminal! It seems to do the job with a few basic commands like... dir...

There is surely more to test. It's been more of another quick attempt at something here...
Attachments
display2_active2_lin.diff
Modified diff for Linux
(62.38 KiB) Downloaded 293 times
NY00123
Member
 
Posts: 235
Joined: 2010-2-13 @ 19:42

Re: Emulating Monochrome/VGA Multi-Screen setup?

Postby ripsaw8080 » 2012-6-14 @ 21:49

Thanks for working on Linux support. I didn't try to tackle it because the example of the DOSBox debugger left me with questions about what to do; terminal resizing being one.
"Unusual" characters (non-ASCII ones) may not appear as expected. Maybe it can be fixed with the right codepage,

I hope you can configure the console to use a full character set for CP 437, otherwise it will be an unfortunate limitation.
I've then tried running the "Monkey Island" demo, with "midemo h". The result is some textual "garbage" appearing on the terminal.

It's not a "Hercules terminal". The secondary display emulates (sort of) a text-only MDA display. Hercules graphics will not work.
As you quit, the DOSBox prompt basically relocates to the (Hercules) terminal!

The normal way to activate the secondary mono display (i.e. move the command prompt there) is the command "mode mono". When you get tired of being in mono mode, use the command "mode co80" to activate the primary color display. While in mono mode there is a BIOS flag that tells programs to use the mono display; but not all programs pay attention to the flag, and they may use color anyway (possibly because they detect the presence of EGA/VGA, or maybe they just aren't programmed to do anything else).
It seems to do the job with a few basic commands like... dir...

All of DOSBox's shell commands and internal programs should work on the secondary display, and just about any command-line based program (e.g. pkzip) that writes to the display through the console device. Some text mode games work in mono mode, but it's hit-and-miss for the reason mentioned above.
User avatar
ripsaw8080
DOSBox Author
 
Posts: 4402
Joined: 2006-4-25 @ 23:24

Re: Emulating Monochrome/VGA Multi-Screen setup?

Postby zaphod » 2012-6-26 @ 16:55

Mighty Zarquon!!! I honestly had given up hope of ever getting this to work and thought I would just check back for the fun of it and found all THIS! I can't thank you enough for figuring this out! I got it working great with turbo pascal 7.0 and this is going to make my life so much easier! trying to debug programs with only one screen is just too difficult to describe. It is just wonderful to use my modern flat screens for this! The screen on my old IBM monochrome screen is getting smaller and smaller, I suspect it will just be a dot in the center eventually.

I am having a few minor issues, I think I might just be doing something wrong.

First of all, I can't seem to get any color except white on the secondary display. I see from all the other posts that green and amber works, so I don't know what I did wrong to be only getting white. I am starting it with

dosbox -display2 green
dosbox -display2 amber

I am getting the seconday display, and it's working great, just it's always white no matter what argument I give it. but If I give it the command

dosbox -display2

with no color agurment, I don't get the secondary display, but the status window instead.

One thing that makes actually working with this a little odd, is that when I task switch out to do something else, clicking on the 'secondary display' window does not get me back to dos box... I need to click on the dosbox windows, however, that is not the window that my keystrokes and mouse are active in. It would be great if clicking on the secondary display got you back to dosbox. I'm not sure if anything can be done about this though, but it would be helpful.

I am not sure of the proper way to implement the fonts provided, are these meant to be installed as windows fonts on my host system? or are they meant to be used by dosbox directly somehow.

Just for information, I am running this on a windows 7 pc, with dosbox 0.74

Amazing work ripsaw, and thanks again!!

Zaphod
zaphod
Newbie
 
Posts: 13
Joined: 2010-9-29 @ 02:46

Re: Emulating Monochrome/VGA Multi-Screen setup?

Postby zaphod » 2012-6-26 @ 17:17

a quick update, the colors not working seems to be a windows 7 thing.. I re-installed everything on my windows XP machine and the colors work great. Just for fun, I tried running it in a windows XP SP3 VM under microsoft virtual pc2007 on my windows 7 machine, and it worked great there as well. now to try a virtualbox VM set up with 2 screens and put each one on a different monitor :p
zaphod
Newbie
 
Posts: 13
Joined: 2010-9-29 @ 02:46

Re: Emulating Monochrome/VGA Multi-Screen setup?

Postby ripsaw8080 » 2012-6-26 @ 17:49

I can't seem to get any color except white on the secondary display.

Are you using the "active2" build attached here, or a different build?

Where/how are you specifying the parameters? In WinXP I add them to the end of the "Target:" line in a shortcut. If the path to dosbox.exe has long folder names, make sure the path is in double quotes and the parameters are outside the quotes on the end.

Dunno why Win7 would be different than WinXP in this regard, but it could be the command line parsing of the GCC runtime libraries at fault, and maybe a build made with a more recent version of the runtime libs would work better. You can also try experimenting with things like putting the colors in quotes... I think I saw ykhwong suggesting that in his build notes.

It would be great if clicking on the secondary display got you back to dosbox.

It can take some getting used to, I know. I sometimes forget and wonder (briefly) why there is no response. ;)

DOSBox must be the active window for it to read input; I don't know of a good way around that. I looked at using PDCurses input stuff to feed to DOSBox from the console window, but it seemed to be non-trivial with some things that wouldn't work well or at all.

I am not sure of the proper way to implement the fonts provided, are these meant to be installed as windows fonts on my host system?

Yes, you install them in Windows. For example, in WinXP, drag/drop fonts into the Fonts folder under the Control Panel, then click the icon on any console window title bar, choose properties, font tab, select a font either for that session or have Windows remember to use the font subsequently (by shortcut, or by window name, depending on how you ran DOSBox).
User avatar
ripsaw8080
DOSBox Author
 
Posts: 4402
Joined: 2006-4-25 @ 23:24

Re: Emulating Monochrome/VGA Multi-Screen setup?

Postby zaphod » 2012-6-26 @ 19:29

Are you using the "active2" build attached here, or a different build?

I am using active 2 build listed on this page

Where/how are you specifying the parameters? In WinXP I add them to the end of the "Target:" line in a shortcut. If the path to dosbox.exe has long folder names, make sure the path is in double quotes and the parameters are outside the quotes on the end.


I initially was specifying them by just getting a command prompt and changing to the folder where dos box is installed and starting it with the lines I specified, I have also done it by changing the shortcut as you mention here, and while I do get the second display window and it works, it's white all the time. Starting it on the windows XP machine the same way it comes out whatever color I put as intended.


It can take some getting used to, I know. I sometimes forget and wonder (briefly) why there is no response. Wink

DOSBox must be the active window for it to read input; I don't know of a good way around that. I looked at using PDCurses input stuff to feed to DOSBox from the console window, but it seemed to be non-trivial with some things that wouldn't work well or at all.


I thought it might be terribly complicated to make it work by clicking on the second display window... I am getting used to just clicking on the dosbox window, and this is so great that it works so well in every other way that this is an extremely minor issue.


One other thing, just our of curiosity, is there a way to make the second display full screen? I have got a font that is pretty big so I can make it take up most of my screen, but it would be cool to make it full screen. Also, is there a way to make it remember the font settings for the secondary display? I select the box to remember this setting, but when I re-start it, it is always back to the small default font.

Also, running it under a virtual machine, while the color is right, unfortunately, the mouse block move erratically and disappears a lot.. but on a real windows XP machine it is fine and on my windows 7 machine it is also fine, except for it being white.. again, a minor point. It's not too surprising that there would be problems running an emulator under a virtual machine though.. and there may be some setting to my virtual machine mouse emulator that would fix it.. but it does the same thing on both virtual pc and virtualbox, so it's probably something about emulating a virtual mouse.
zaphod
Newbie
 
Posts: 13
Joined: 2010-9-29 @ 02:46

Re: Emulating Monochrome/VGA Multi-Screen setup?

Postby DosFreak » 2012-6-26 @ 19:41

You can uninstall or disable the additions for the mouse in VPC/Vmware/Virtualbox. I've had to do this for games in a couple of cases.
User avatar
DosFreak
l33t++
 
Posts: 10424
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: Emulating Monochrome/VGA Multi-Screen setup?

Postby ripsaw8080 » 2012-6-26 @ 20:40

is there a way to make the second display full screen?

Not that I know of. The window maximize button just moves the console window to the upper left corner of the screen.

is there a way to make it remember the font settings for the secondary display?

I think it's problematic because the name of the window is changed. I'll research what the name of the window is when it's created, which may allow the font to be set by that name. In WinXP there is a way to set the default font of *all* console windows with a registry tweak, which is what I use, but not sure if you'll want to go there...
User avatar
ripsaw8080
DOSBox Author
 
Posts: 4402
Joined: 2006-4-25 @ 23:24

Re: Emulating Monochrome/VGA Multi-Screen setup?

Postby zaphod » 2012-6-26 @ 21:00

You can uninstall or disable the additions for the mouse in VPC/Vmware/Virtualbox.


I disabled the mouse integration on virtualbox and it works great!!

In WinXP there is a way to set the default font of *all* console windows with a registry tweak, which is what I use, but not sure if you'll want to go there...


I wouldn't mind doing the registry tweak. especially since I got it working on the virtual machine... I can just copy my virtual hard drive and if I mess it up, just copy it back. do you happen to know where to look or what to search for to find the tweak?

the white color in windows 7 still has me confused, I was thinking of re-compiling it making green the default color just to see if it was a command line issue, but it seems pretty complicated to get together all the various libraries to be able to do that, and then I need to figure out what compiler to use and how to work that.. I guess white isn't all THAT bad :happyhappy: I am so happy that this works at all!
zaphod
Newbie
 
Posts: 13
Joined: 2010-9-29 @ 02:46

Re: Emulating Monochrome/VGA Multi-Screen setup?

Postby ripsaw8080 » 2012-6-26 @ 22:00

where to look or what to search for to find the tweak?

This is for WinXP; WinOther may vary. Under the key: "HKEY_CURRENT_USER\Console" you change the values:

FaceName (the name of the font exactly as it appears in the Font folder under the Control Panel)
FontSize (a bit tricky, see below)
FontWeight (should be 0x190; maybe not essential, but Windows always sets it)

The FontSize is a dword value where the high-word is the height of the font and the low-word is the width, so for example 0x00100008 is 8x16.

To change the default font back to the Windows default, just blank/zero all three values.

These registry entries aren't critical, so you shouldn't be able to mess anything up by tweaking them (at worst you won't get the font you wanted), but nonetheless you should probably be comfortable with editing the registry before doing stuff like this.
User avatar
ripsaw8080
DOSBox Author
 
Posts: 4402
Joined: 2006-4-25 @ 23:24

Re: Emulating Monochrome/VGA Multi-Screen setup?

Postby zaphod » 2012-6-26 @ 22:35

Thanks for the info on the font size. I have no trouble editing the registry.

It seems my dosbox screen (not the secondary display is locked at a relatively small size. I can make it full screen, or the small window, but nothing in the middle. it is usable this way, but I would love to make it a somewhat larger window. could someone point me in the right direction to accomplish this?

I have one more little strange thing happening with this, easy to work around, if you know what is going on... Since the secondary display is not really where everything is happening, it's in the primary dos window, the mouse does not always do what you want it to, even on a real system. The main issue is when you task switch out of dos box, then click inside the main dosbox window to get back into it... it matters where you click inside the window!! if you click near the center of the window, then everything is great, because from that position, the mouse had room to move in all directions in the dosbox window, and so it will work fine in the secondary display. However if you click way over toward the right side of the dosbox window, appearantly it tries to put the mouse further than it will fit on the secondary display, and cause it to scroll 1000 characters to the right, and in my turbo pascal compiler, this adds like 700 spaces to the end of the line and I get a 'line too long' error. I can duplicate this every time.. click in the center of the dosbox window, everything is fine, click way in the lower left corner, and it goes way out and gives me the error.

Also, I once had it not be able to get all the way to the top of the secondary window.. I task switched out then clicked the center of the dosbox window, and then I was able to reach the entire screen.

So.. just click in the center of the dosbox window when you want to get back to it and everything is fine. not sure if there might be some way to make it auto-correct for trying to go past the edge of the screen.
zaphod
Newbie
 
Posts: 13
Joined: 2010-9-29 @ 02:46

Re: Emulating Monochrome/VGA Multi-Screen setup?

Postby ripsaw8080 » 2012-6-26 @ 22:48

You can use scalers in the config settings to change the size of the output window, and you may need to add the word "forced" in some situations. (e.g. scaler=normal3x forced)

Another way to lock/unlock the mouse in DOSBox is Ctrl-F10, which might cause fewer problems with "task switching" than alt-tabbing to unlock and clicking in the primary window to lock.
User avatar
ripsaw8080
DOSBox Author
 
Posts: 4402
Joined: 2006-4-25 @ 23:24

PreviousNext

Return to DOSBox Development

Who is online

Users browsing this forum: No registered users and 2 guests