VOGONS


VGA problem with a Sharp MZ-700 emulator

Topic actions

First post, by beard

User metadata
Rank Newbie
Rank
Newbie

Hi, I'm a newbie with a special problem.

I have a problem with an emulator for my first home computer. A SHARP MZ-700.
It works perfect, but.... only below WinNT.

To use it in Windows XP I tried several DOS emulators and VMs.
All with the same effect, that the graphic resolution is not working as in reality.

The graphic card is initialized with:

void InitVGA(void)
{
union REGS Register;


// set 200 scan lines -> 8x8 font will be activated
Register.w.ax = 0x1200;
Register.w.bx = 0x0030;
int86(0x10, &Register, &Register);

// mode 1, 40 x 25 colour mode
// with MSB set, the screen is not cleared
Register.w.ax = 0x0081;
int86(0x10, &Register, &Register);

// activate page 0
Register.w.ax = 0x0500;
int86(0x10, &Register, &Register);


// read Cursorsize
Register.h.ah = 0x03;
Register.h.bh = 0x00; // page 0
int86(0x10, &Register, &Register);
CursorStartLine = Register.h.ch;
CursorEndLine = Register.h.cl;
}

And it uses the possibility of an own characterset:

void CGRAMToVGA(void)
{
/*
* Copy the MZ-CharacterFont (CG-RAM) into the VGA-Card
*
*/

__dpmi_regs Register;
unsigned char MZMirrorCGRAM[4096];
unsigned short i;

for(i = 0; i < 4096; i++) MZMirrorCGRAM[i] = Mirror(MZCGRAM[i]);


dosmemput(&MZMirrorCGRAM[0], 0x800, __tb);

Register.h.ah = 0x11;
Register.h.al = 0x10;
Register.h.bh = 8; // 8 scan lines
Register.h.bl = 0; // in table 0
Register.x.cx = 256; // 256 characters
Register.x.dx = 0; // first character is ASCII 0
Register.x.es = __tb >> 4;
Register.x.bp = __tb & 0x0F;
__dpmi_int(0x10, &Register);


dosmemput(&MZMirrorCGRAM[0x800], 0x800, __tb);

Register.h.ah = 0x11;
Register.h.al = 0x00;
Register.h.bh = 8; // 8 scan lines
Register.h.bl = 1; // in table 1
Register.x.cx = 256; // 256 characters
Register.x.dx = 0; // first character is ASCII 0
Register.x.es = __tb >> 4;
Register.x.bp = __tb & 0x0F;
__dpmi_int(0x10, &Register);


Register.h.ah = 0x11;
Register.h.al = 0x03;
Register.h.bl = 0x04;
__dpmi_int(0x10, &Register);

// Cursor off (have placed here, of course above INT's switches cursor on)
Register.h.ah = 0x01;
Register.x.cx = 0x2100;
__dpmi_int(0x10, &Register);
}

It works with DOSBox, (the own charactreset) but the screenresolution is not changed to 320 by 200. I always see garbage on the lower part of the DOSBox screen.

That's 1. ugly and 2. the characters are very small.

5490eae4.gif

The emulator is freeware and you can download it from:
http://www.sharpmz.org/bkkemu.htm

If someone want to test this.
The sourcecode is also downloadable.

I tried all available -machine switches.
It is independent from the PC which I use.
I think it is a general problem of the VGA emulation of DOSBox.

Any ideas?

Best regards,

Beard

Reply 1 of 50, by MiniMax

User metadata
Rank Moderator
Rank
Moderator

DOSBox now emulates several different graphics cards, and 2-3 VGA cards. Please try changing the machine-type in the DOSBox configuration and see if it helps.

DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32

Reply 2 of 50, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

(works with external video BIOS - see ldgfxrom)

1+1=10

Reply 3 of 50, by beard

User metadata
Rank Newbie
Rank
Newbie

@MinMax
If you read my posting carefully, you can read that I tried already all available -machine values.

@h-a-l-9000
I'll give it a try.

Thanks

Beard

Reply 4 of 50, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

so our videocard emulation is correct, but one of the bios functions isn't ?

Water flows down the stream
How to ask questions the smart way!

Reply 5 of 50, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

I'd draw this conclusion.

1+1=10

Reply 6 of 50, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Wild guess: set mode resetting the scanline stuff ?

Water flows down the stream
How to ask questions the smart way!

Reply 7 of 50, by beard

User metadata
Rank Newbie
Rank
Newbie

@h-a-l-9000
excuse me, but the command ldgfxrom is not available inside the DOSBox.
Please give me a hint.

@QBix
Hm. it is not easy to describe.
For me it looks like that the switching to 40x25 mode works, but the
DOSBox window is not effected by this resolution switch.

I'll write a small test program and post it here soon.

Beard

Reply 8 of 50, by beard

User metadata
Rank Newbie
Rank
Newbie

@QBix
the scanline stuff is neccessary to tell the card to use the 8x8 character set.

Beard

Reply 9 of 50, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

What if you do the 40x25 modeswitch first and then set 200 lines mode?

ldgfxrom is only availible in debug DOSBox builds and it needs a video BIOS dump file of a corresponding real hardware card.

1+1=10

Reply 10 of 50, by beard

User metadata
Rank Newbie
Rank
Newbie

It has nothing todo with the rouitines I showed before.

I'd just written a small test program. For my suprise it was possible to switch
to the 40x25 mode without problems.

So I included the next step.
I installed the own characterset

void CGRAMToVGA(void)
{
/*
* Copy the MZ-CharacterFont (CG-RAM) into the VGA-Card
*
*/

__dpmi_regs Register;
unsigned char MZMirrorCGRAM[4096];
unsigned short i;

for(i = 0; i < 4096; i++) MZMirrorCGRAM[i] = Mirror(MZCGRAM[i]);


dosmemput(&MZMirrorCGRAM[0], 0x800, __tb);

Register.h.ah = 0x11;
Register.h.al = 0x10;
Register.h.bh = 8; // 8 scan lines
Register.h.bl = 0; // in table 0
Register.x.cx = 256; // 256 characters
Register.x.dx = 0; // first character is ASCII 0
Register.x.es = __tb >> 4;
Register.x.bp = __tb & 0x0F;
__dpmi_int(0x10, &Register);


dosmemput(&MZMirrorCGRAM[0x800], 0x800, __tb);

Register.h.ah = 0x11;
Register.h.al = 0x00;
Register.h.bh = 8; // 8 scan lines
Register.h.bl = 1; // in table 1
Register.x.cx = 256; // 256 characters
Register.x.dx = 0; // first character is ASCII 0
Register.x.es = __tb >> 4;
Register.x.bp = __tb & 0x0F;
__dpmi_int(0x10, &Register);


Register.h.ah = 0x11;
Register.h.al = 0x03;
Register.h.bl = 0x04;
// __dpmi_int(0x10, &Register);

// Cursor off (have placed here, of course above INT's switches cursor on)
Register.h.ah = 0x01;
Register.x.cx = 0x2100;
// __dpmi_int(0x10, &Register);
}

And than it happens inside DOSBox.

Normally the last 2 INT10 calls are included, but for testing, I commented them out.

The link here is removed. See 2 postings below.
It is now attached.

Sourcecode and exe is included

without a parameter it uses the normal characterset,
with a parameter it downloads the MZ characterset.

Beard

Last edited by beard on 2009-08-17, 18:09. Edited 1 time in total.

Reply 11 of 50, by eL_PuSHeR

User metadata
Rank l33t++
Rank
l33t++

I am moving this thread to DEVELOPMENT section. There is a lot of code here.

Intel i7 5960X
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
8 GB GeForce GTX 1070 G1 Gaming (Gigabyte)

Reply 12 of 50, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

loadfont changes the scanline register as well as some others. However most of that code has been in dosbox for a long time. (the scanline stuff for 6 years).

Water flows down the stream
How to ask questions the smart way!

Reply 13 of 50, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Can't download from that site.

Hal, does vgabios or elpin work?

Reply 14 of 50, by beard

User metadata
Rank Newbie
Rank
Newbie

Hi QBix,

you are right.
I just updated the files and attached them here.

Now it is reduced to the minimum.
It happens when the user font is activated.

I had only one short fast look into the DOSBox sourcecode, so I can not say
anything about it.

It looks that the change of the scanlines has no effect to the DOSBox window.

Again:
without parameter the normal 40 by 25 mode is set.
with a parameter (DOSBoxTest xyz) the own font is activated.

Beard

Reply 15 of 50, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Does the test app work on a real system any different than dosbox?

Reply 16 of 50, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

This is a known limitation of DOSBox regarding INT 10/AH=12/BL=30. Trying to change to 200 or 350 scanlines in VGA does not work properly, only 400 scanline text modes are supported. This was covered in another thread.

Loading a video BIOS such as the one from Bochs in a debug build of DOSBox works.

Reply 17 of 50, by h-a-l-9000

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Elpin works.
What's vgabios?

1+1=10

Reply 18 of 50, by beard

User metadata
Rank Newbie
Rank
Newbie

@wd
On a real PC booted with FreeDOS or in a fullscreen DOS box of Win98 it works correct:
I see 320 by 200 pixels on the fullscreen and not only on half of the screen.

@ripsaw8080
That's strange, because when I make a boot disk image with FreeDOS and
run it with Bochs 2.4.1 I got the same result as with DOSBox.
Also when I use the elpin BIOS.

Beard

Reply 19 of 50, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

There aren't many games that use the alternate scanlines, but I know of a couple:

Indenture uses 200 scanlines with a custom font, but I made a workaround for it here.

Wrath of Earth uses 350 scanlines with a custom font in its installer and exit screens, but it's mostly a cosmetic issue, not really important:

woein.png

Because there are few games that need the feature, I didn't think support would be added internally, so I made a TSR program that acts as an extension to DOSBox's video BIOS in order to support the alternate scanlines. An archive is attached that contains a few text mode utilities that I made, including the TSR.

SCANRES.COM is the resident program that should be loaded prior to running anything that tries to change the scanlines.

CGA.COM, EGA.COM, and VGA.COM are programs that simply switch the DOS text display to 200, 350, and 400 scanlines, respectively; and SCANRES.COM must be loaded for them to work.

CLR.COM is a program to use in place of the CLS command. DOSBox's CLS sets mode 3, so you loose the current mode and any loaded font; but this program uses the scroll window function to clear the screen, as real DOS does, and the current mode and font are preserved.

*X*.COM are a bunch of programs that set a variety of text screen dimensions, including some pretty large ones.

I've only tested the utilities with machine=svga_s3, so anything else might not work. At some point I plan to roll up all these little programs into a single program that takes a command line parameter, but I haven't gotten around to that project yet.