edrdos icon indicating copy to clipboard operation
edrdos copied to clipboard

drbio / drdos module ported to NASM - differences to SvarDOS repo

Open ecm-pushbx opened this issue 1 year ago • 35 comments

Remaining differences:

  • version.inc with text equates instead of directly writing strings with db
  • LFN variables in a different segment
  • line ending differences
  • fdos.def instead of lDOS's fdosdef.def
  • some JWasm port artefacts left:
  • https://github.com/SvarDOS/edrdos/blob/e3648e779e7d064869830bb77fbd13ce9eb9bc84/drdos/driver.equ#L1
  • https://github.com/SvarDOS/edrdos/blob/e3648e779e7d064869830bb77fbd13ce9eb9bc84/drdos/header.asm#L140
  • wlink file drdos.lnk
  • obsolete linkcmd file drdos.inp

Updates to lDOS source tree:

  • Trailing linebreak in WarpLink response file: https://hg.pushbx.org/ecm/edrdos/rev/c86e90ac20af
  • .nolist / .list directives in header.asm: https://hg.pushbx.org/ecm/edrdos/rev/beb0cd6db27c
  • Drop inaccessible version / copyright string in fdos.asm: https://hg.pushbx.org/ecm/edrdos/rev/2c8fe8ccd5f6
  • Update filename in country.asm: https://hg.pushbx.org/ecm/edrdos/rev/36dad591ab34 (The *.nas files did not update these names.)
  • Word align BDOS_CODE section in buffers.asm: https://hg.pushbx.org/ecm/edrdos/rev/ddc2931ef778

ecm-pushbx avatar Aug 24 '24 09:08 ecm-pushbx

Are you sure the following can be safely removed? Its a header, and I do not know if these bytes are tested anywhere... https://github.com/SvarDOS/edrdos/blob/e3648e779e7d064869830bb77fbd13ce9eb9bc84/drdos/header.asm#L140

boeckmann avatar Aug 24 '24 09:08 boeckmann

Restored in https://hg.pushbx.org/ecm/edrdos/rev/350b8462d5d2

I think you added the JWasm conversion comment there. But it doesn't cost much to add it in. (PCM_CODE after this appears to be byte-aligned and always was, so it started at 0000382Ah without this padding.)

ecm-pushbx avatar Aug 24 '24 10:08 ecm-pushbx

Are the text equates in version.inc problematic for NASM conversion?

boeckmann avatar Aug 24 '24 10:08 boeckmann

Yes, I will likely replace them by defines. I'm not at that point yet.

ecm-pushbx avatar Aug 24 '24 11:08 ecm-pushbx

drbio differences:

  • Whitespace or linebreak changes
  • WarpLink response file doesn't list .obj filename extensions
  • Some segments aligned differently
  • init.asm new init0 in the sector buffer, SvarDOS flavour single-file support and depacker
  • Another JWasm port left over comment: https://github.com/SvarDOS/edrdos/blob/53c026404f71e23dce107859dd116706683b6e1e/drbio/driver.equ#L1
  • bdosldr.asm (DOS loader)
  • biosinit.asm

ecm-pushbx avatar Aug 24 '24 12:08 ecm-pushbx

I finished the port of all SvarDOS specifics of both drbio and drdos to NASM. I did port the version.inc but renamed as svarver.inc / svarver.mac. (Must be copied into drbio directory. drdos doesn't use svarver.* yet.) So there's three files with version info now. This is obviously not desirable but I'd like you to make the switch to the NASM source tree before we fix this.

drbio files init.nas, biosinit.nas, and bdosldr.nas need a -DSVARDOS=1 define to enable use of the SvarDOS flavours, or =0 to disable same. If SvarDOS flavours are used these files also need -DSINGLEFILE=1 or =0. Non-SvarDOS flavour (ie lDOS flavour) automatically avoids the need to specify -DSINGLEFILE.

Current revision is https://hg.pushbx.org/ecm/edrdos/rev/af944adc33b6

ecm-pushbx avatar Aug 24 '24 21:08 ecm-pushbx

Oops, specifying -DSINGLEFILE=1 -DSVARDOS=0 does assemble the DOS loader even though it is never called. I will fix this at a later point.

ecm-pushbx avatar Aug 24 '24 21:08 ecm-pushbx

I meant -DSINGLEFILE=0 -DSVARDOS=0. Truthiness sense is hard!

ecm-pushbx avatar Aug 24 '24 21:08 ecm-pushbx

Further note: The lDOS init1 still contains a copy of a lot of what moved into init0 for SvarDOS, which isn't ideal either. (lDOS doesn't have an init0 but rather an equate as in init0 equ init1 now. This was needed to support use of ident86.)

ecm-pushbx avatar Aug 24 '24 21:08 ecm-pushbx

Will probably setup a mercurial mirror of your repo and re-build some makefiles previously made for JWasm. This will help let the repos stay in-sync. But not before next weekend, I think. Busy next days...

boeckmann avatar Aug 24 '24 21:08 boeckmann

Good, okay. Side question: Do you know how to pass a quoted string with blanks as a define to JWasm's command line, in DOS? Whatever I tried it seemed to parse the blank as a parameter separator. I added the DATETIME define which can be overridden to change the "built

ecm-pushbx avatar Aug 24 '24 22:08 ecm-pushbx

Do you know how to pass a quoted string with blanks as a define to JWasm's command line, in DOS? Whatever I tried it seemed to parse the blank as a parameter separator.

No, sorry.

boeckmann avatar Aug 24 '24 22:08 boeckmann

NASM in DOS (FreeCOM) does allow blanks as in nasm test.asm -DFOO="bar baz quux" (define as not quoted text) or nasm test.asm -DFOO="'bar baz quux'" (define as quoted string). Exactly the same as when calling nasm in Linux (bash).

ecm-pushbx avatar Aug 25 '24 07:08 ecm-pushbx

NASM in DOS (FreeCOM) does allow blanks as in nasm test.asm -DFOO="bar baz quux" (define as not quoted text) or nasm test.asm -DFOO="'bar baz quux'" (define as quoted string). Exactly the same as when calling nasm in Linux (bash).

FreeCOM probably understands quoted arguments. SvarCOM does not have any special treatment for quotes. Does MSDOS?

mateuszviste avatar Aug 25 '24 09:08 mateuszviste

Isn't this left to the application, as the command line tail is copied more or less unaltered to the PSP / CMDLINE env? Apart from using quotes to specify the executable there is no special treatment in FreeCOM either, if I remember correct.

boeckmann avatar Aug 25 '24 10:08 boeckmann

Isn't this left to the application, as the command line tail is copied more or less unaltered to the PSP / CMDLINE env? Apart from using quotes to specify the executable there is no special treatment in FreeCOM either, if I remember correct.

+1

ecm-pushbx avatar Aug 25 '24 10:08 ecm-pushbx

Isn't this left to the application, as the command line tail is copied more or less unaltered to the PSP / CMDLINE env? Apart from using quotes to specify the executable there is no special treatment in FreeCOM either, if I remember correct.

Unless a BAT file is involved (like bat "links" used by freedos some years ago). Otherwise I don't see why the behavior would change depending on the shell used.

mateuszviste avatar Aug 25 '24 11:08 mateuszviste

I added the lCFG block as an option for lDOS drkernpl, which also supports passing through the uncompressed lCFG block from inicomp if the kernel is compressed. The drkernpl to drbio protocol is extended to have cx:di point to the lCFG block for drbio to pick up, which for now resides between 00600h and 00700h. The various options are collected into the kernwrap scripts.

There is a new patch utility, patchdeb, which is based on patchpro to find the lCFG block but acts on the new byte "check debugger" (at offset 20) instead. Two flags are recognised for display yet, 1 = check and 2 = assume. (User input must be numeric.) Unlike the current FreeDOS kernel's use of its "check debugger" value, we treat these as flags.

For the SvarDOS flavours, two of the device headers are moved aside and initialised later when the lCFG block has been processed. I also added comments that the kernel flags debugger flag is no longer used.

This largely does what I mused about in https://github.com/SvarDOS/edrdos/issues/102#issuecomment-2307727959


Note that the build is a bit broken for SvarDOS flavours, you have to provide tmp/edrdosl.mac for the include directive in https://hg.pushbx.org/ecm/edrdos/rev/d4f67d33b5bf#l1.47 (Running mak.sh from the lDOS EDR-DOS repo which calls mak.sh from kernwrap will create this file.)

The build is further broken in that you need to run ./ltools/compkern drbio/bin/drbio.bin drdos/bin/drdos.pag bin/drkernel.sys [uncompressed] manually after making a single-file SvarDOS flavour using the scripts in my repo. To use the double-file SvarDOS flavour, drbio/bin/drbio.bin must be renamed to drbio.sys and drdos/bin/drdos.sys moved to use as drdos file.

ecm-pushbx avatar Sep 02 '24 19:09 ecm-pushbx

in drbio\make.bat there are lines >126 characters. This seems to make the build fail under DosBox-X, and probably EDR using its native COMMAND.COM.

boeckmann avatar Sep 04 '24 09:09 boeckmann

Thanks, it worked for me (FreeCOM in dosemu2) somehow but I will upload a patch to fix this later. I detected the offending lines using perl -ne 'if (length ($_) > 120) { print }' drbio/make.bat drdos/make.bat

ecm-pushbx avatar Sep 04 '24 09:09 ecm-pushbx

Not for that :) I first try to build your unmodified version before starting to do any changes...

boeckmann avatar Sep 04 '24 09:09 boeckmann

What is this c:\autowat.bat file referenced in cfg.bat? Has it to do with Open Watcom? Can it be guarded by an if exist?

boeckmann avatar Sep 04 '24 09:09 boeckmann

What is this c:\autowat.bat file referenced in cfg.bat? Has it to do with Open Watcom?

Yes, it contains the lines that OW DOS installer adds to autoexec.bat

Can it be guarded by an if exist?

I'll add this during my noon break.

ecm-pushbx avatar Sep 04 '24 09:09 ecm-pushbx

You can provide ovr.bat though in which case autowat.bat is not called from cfg.bat

ecm-pushbx avatar Sep 04 '24 09:09 ecm-pushbx

Oops, bdosldr is built with the DOS loader in my most recent builds. I will fix this too.

ecm-pushbx avatar Sep 04 '24 09:09 ecm-pushbx

FreeCOM set up a CMDLINE= environment variable for the one case in which the resulting command line tail (with variables expanded) exceeded 126 bytes. This seems to be parsed by DJGPP NASM properly. One mystery less.

ecm-pushbx avatar Sep 04 '24 09:09 ecm-pushbx

in drbio\init.nas there is a %include "../tmp/edrdosl.mac". But this file seem neither be included in the repo, nor generated by the build.

boeckmann avatar Sep 04 '24 10:09 boeckmann

in drbio\init.nas there is a %include "../tmp/edrdosl.mac". But this file seem neither be included in the repo, nor generated by the build.

I mentioned this earlier: https://github.com/SvarDOS/edrdos/issues/104#issuecomment-2325238505

Note that the build is a bit broken for SvarDOS flavours, you have to provide tmp/edrdosl.mac for the include directive in https://hg.pushbx.org/ecm/edrdos/rev/d4f67d33b5bf#l1.47 (Running mak.sh from the lDOS EDR-DOS repo which calls mak.sh from kernwrap will create this file.)

ecm-pushbx avatar Sep 04 '24 11:09 ecm-pushbx

Basically you need to run nasm lcfg.asm -o tmp/edrdosl.mac: https://hg.pushbx.org/ecm/kernwrap/rev/4e0c178bb110#l1.21

ecm-pushbx avatar Sep 04 '24 11:09 ecm-pushbx

I also pushed several other updates now.

ecm-pushbx avatar Sep 04 '24 11:09 ecm-pushbx