Author Topic: Amazing options in FLAT or UNREAL Mode  (Read 1958 times)

Gunther

  • Member
  • *****
  • Posts: 3723
  • Forgive your enemies, but never forget their names
Amazing options in FLAT or UNREAL Mode
« on: March 01, 2021, 02:56:07 PM »
The last days I had to do with an embedded DOS system and wrote a test program for it. There I could experiment a bit with the FLAT or UNREAL mode.

The application is a small DOS program written in PB 3.5; but the real dirty work is done by the assembly language procedures. So I think the 16-bit DOS
sub-forum is the right place for the upload. However, Hutch might also think that it belongs in the PB subforum. In principle it doesn't matter.

The program establishes the FLAT mode, copies an array over 1 MB and restores it. After that the Barnsley fern is calculated in VGA 640x480, 16 colors
and the whole screen is saved over 1 MB. Finally, the Mandelbrot set is computed, once with 256 colors and once then in a True Color mode, each time
with the linear frame buffer that VESA offers. That brings considerable time advantages. In the True Color mode the Mandelbrot set is colored with a
continuous color gradient.

The program works under plain DOS with HIMEM.SYS and in a virtual machine under the direction of VMWare, VirtualBox, VirtualPC, Bochs etc. Also DOSBox
version 0.74 works quite well, although DOSBox has some bugs in the emulation. I have already written to the authors and I'm working on an
error report.

The archive is vbe.zip contains the following files:

VBE.ASM: Assembly language source
VBE.BAS: PowerBASIC source
VBI.INC: INCLUDE file for the compiler
VBE.OBJ: OBJ file
VBE.EXE: The running application

I had to assemble the assembly language source with the old TASM 4, because JWASM for DOS doesn't like the system instruction:

lgdt pword ptr ds:[GDTadr]

Therefore I packed the OBJ into the archive.

I have tested the program under different configurations and it runs stable and well, for example on NVIDIA GeForce GT 1030 or
AMD Radeon HD 7570. Tests on other hardware are always welcome.

Gunther
Get your facts first, and then you can distort them.

jj2007

  • Member
  • *****
  • Posts: 11550
  • Assembler is fun ;-)
    • MasmBasic
Re: Amazing options in FLAT or UNREAL Mode
« Reply #1 on: March 01, 2021, 04:34:09 PM »
I had to assemble the assembly language source with the old TASM 4, because JWASM for DOS doesn't like the system instruction:

lgdt pword ptr ds:[GDTadr]

Remember the old db x, y, z trick... I can't test what you are doing, but it sounds interesting :thumbsup:

Gunther

  • Member
  • *****
  • Posts: 3723
  • Forgive your enemies, but never forget their names
Re: Amazing options in FLAT or UNREAL Mode
« Reply #2 on: March 01, 2021, 06:27:12 PM »
Jochen,

Remember the old db x, y, z trick... I can't test what you are doing, but it sounds interesting :thumbsup:

yes, of course, but but the whole thing with JWASM is ridiculous. After all, the old TASM can do it.

You can always install Oracle VirtualBox and FreeDOS in it. Both are free.

Gunther
Get your facts first, and then you can distort them.

nidud

  • Member
  • *****
  • Posts: 2212
    • https://github.com/nidud/asmc
Re: Amazing options in FLAT or UNREAL Mode
« Reply #3 on: March 01, 2021, 07:34:25 PM »
Using FWORD should work.

Code: [Select]
    .686p
    .model flat

    .data
    GDTadr df 0

    .code

    lgdt GDTadr
    lgdt fword ptr ds:[edi]

    end

Gunther

  • Member
  • *****
  • Posts: 3723
  • Forgive your enemies, but never forget their names
Re: Amazing options in FLAT or UNREAL Mode
« Reply #4 on: March 02, 2021, 06:46:36 AM »
Nidud,

thank you, I'll try that.

Gunther
Get your facts first, and then you can distort them.

Gunther

  • Member
  • *****
  • Posts: 3723
  • Forgive your enemies, but never forget their names
Re: Amazing options in FLAT or UNREAL Mode
« Reply #5 on: March 02, 2021, 06:55:08 AM »
Jochen,

A very simple way is to install DOSBox. It is a native 32-bit Windows program. The respective DOS application then runs in this sandbox and cannot do
any damage. The configuration effort is minimal and the data exchange between DOS and Windows is no problem, because this emulated DOS is connected
to a directory of your choice. You should definitely try this once.

Gunther
Get your facts first, and then you can distort them.

jj2007

  • Member
  • *****
  • Posts: 11550
  • Assembler is fun ;-)
    • MasmBasic
Re: Amazing options in FLAT or UNREAL Mode
« Reply #6 on: March 02, 2021, 08:38:52 AM »
Gunther,

I've installed DosBox now, but whenever I try to launch an exe, it tells me "illegal command". I managed to mount a drive, and can run 16-bit programs created with RichMasm, but there is no editor, and I can't run an assembler...

In contrast, I can build and run very easily \Masm32\MasmBasic\Res\HelloWorld16.asc by opening it in RichMasm and hitting F6 - on Win7-64. The secret is called msdos.exe, and it works just fine with 16-bit exe or com, even passing a commandline is straightforward, as shown below :cool:

There is also a 16-bit COM example that works out-of-the-box, see \Masm32\MasmBasic\Res\HelloWorldCOM.asc

OPT_Run \Masm32\bin\msdos.exe HelloWorld16.exe Hello World, how are you today?  ; download; use binary\i486_x64\msdos.exe

Gunther

  • Member
  • *****
  • Posts: 3723
  • Forgive your enemies, but never forget their names
Re: Amazing options in FLAT or UNREAL Mode
« Reply #7 on: March 02, 2021, 10:02:50 AM »
Jochen,

that has to do with your settings.

In your users directory (here is my path: c:\users\Gunther\AppData\Local) you'll find a file dosbox-0.74.conf with your configuration settings.

At the end of that file I've written that:
Code: [Select]
mount c e:\dos
c:
set path=c:\;c:\nc;c:\basic\bin;c:\tasm\bin;c:\nasm\bin;c:\jwasm\bin
first I've mounted drive C to a directory e:\dos
The next command is to change the drive. Then set the PATH variables, so that the needed paths are open.

If that's done, you can fire up the application.

Hope that helps.

Gunther
Get your facts first, and then you can distort them.

jj2007

  • Member
  • *****
  • Posts: 11550
  • Assembler is fun ;-)
    • MasmBasic
Re: Amazing options in FLAT or UNREAL Mode
« Reply #8 on: March 02, 2021, 10:59:19 AM »
Which editor do you use in DosBox?

HSE

  • Member
  • *****
  • Posts: 1741
  • <AMD>< 7-32>
Re: Amazing options in FLAT or UNREAL Mode
« Reply #9 on: March 02, 2021, 11:10:13 AM »
Which editor do you use in DosBox?
Edit ?


But you can open with RichMasm because DosBox don't limit file access.

If you create a new file that must be inside DosBox, but if you have a config file is more easy to create new file out of DosBox, close DosBox and open again.

jj2007

  • Member
  • *****
  • Posts: 11550
  • Assembler is fun ;-)
    • MasmBasic
Re: Amazing options in FLAT or UNREAL Mode
« Reply #10 on: March 02, 2021, 11:39:39 AM »
illegal command: edit
RichMasm: This program cannot be run in DOS mode.

HSE

  • Member
  • *****
  • Posts: 1741
  • <AMD>< 7-32>
Re: Amazing options in FLAT or UNREAL Mode
« Reply #11 on: March 02, 2021, 12:12:37 PM »
Open RichMasm like every day, then open or save file in the directory that in DosBox you mounted as a "theorethical" drive.
I have to say that I use qEditor     :biggrin:

Gunther

  • Member
  • *****
  • Posts: 3723
  • Forgive your enemies, but never forget their names
Re: Amazing options in FLAT or UNREAL Mode
« Reply #12 on: March 02, 2021, 01:01:37 PM »
Jochen,

what the hell are you going to do? DOSBox emulates a DOS for you. Why do you want to edit files in DOSBox with a DOS editor?
If you need to edit something, do it under Windows, copy the result into your mounted directory (with the appropriate paths open) and run the DOS compiler or assembler over it.

But if you absolutely want to edit under DOS, try EDIT from FeeDos. It's halfway ok, but it's an old DOS editor.
DOSBox is designed to run the old DOS games or other old DOS applications. But it is also suitable for testing software and my program VBE.EXE runs under DOSBox, both in the
window and in full screen mode (switch with ALT+ENTER).

Gunther
Get your facts first, and then you can distort them.

Gunther

  • Member
  • *****
  • Posts: 3723
  • Forgive your enemies, but never forget their names
Re: Amazing options in FLAT or UNREAL Mode
« Reply #13 on: March 02, 2021, 01:23:31 PM »
Jochen,

another possibility - under whatever operating system - to emulate DOS is VirtualBox from Oracle. This is faster and nicer than DOSBox, but also trickier to establish.
You need an image, preferably of FreeDOS, and install FreeDOS inside VirtualBox, using the network tools.

Then a very nicely emulated DOS runs inside VirtualBox. But then the problems start. The data exchange between host and guest is not so simple.
DOS has hardly any USB drivers. Some in the experimental stage, others don't like sticks over 2 GB, for still others you have to pay. The NTFS disks are not recognized by DOS anyway.
So what to do to move files back and forth? If you have installed the network tools, FreeDOS (but only those) offers an FTP server. This is started and with a FTP client under Windows
the data exchange works then very well, fast and comfortably.

I didn't want to put you through all that. That's why I suggested DOSBox, because the data exchange works well there. How should I know that you want to edit under DOS?

Gunther
Get your facts first, and then you can distort them.

jj2007

  • Member
  • *****
  • Posts: 11550
  • Assembler is fun ;-)
    • MasmBasic
Re: Amazing options in FLAT or UNREAL Mode
« Reply #14 on: March 02, 2021, 10:09:48 PM »
Jochen,

what the hell are you going to do? DOSBox emulates a DOS for you. Why do you want to edit files in DOSBox with a DOS editor?
If you need to edit something, do it under Windows, copy the result into your mounted directory (with the appropriate paths open) and run the DOS compiler or assembler over it.

Gunther,

I don't want to edit anything under DOS. But the method you suggest (edit in 32- or 64-bit mode, copy the asm file to DOSBOX, launch the build process there) is very, very clumsy compared to what I am using right now with msdos.exe:
- open the source in RichMasm
- edit whatever you need (no need to save)
- hit F6, and half a second later you see the output of the running file.exe or .com...

Test it, the source is attached. You need MasmBasic and msdos.exe: put binary\i486_x64\msdos.exe into \Masm32\bin\msdos.exe (923,648 bytes, 2 January 2021).