Page 2 of 2

Re: DOS and VBScript - A Better Interaction?

Posted: 07 Jun 2012 08:06
by Aacini
foxidrive wrote:Do you mean Win64 bit compatible? 32 bit Windows can run .com files.

I meant Win32 API function calls compatible. Old programs use DOS API function calls, that currently not run in Windows 64-bits versions (even if they are .EXE file format).

The current standard is Win32 API functions, that run in any Windows version.

Antonio

Re: DOS and VBScript - A Better Interaction?

Posted: 21 Jun 2012 16:20
by Fawers
Aacini wrote:I only use the best: assembly language!

More than 25 years ago I wrote several small programs as auxiliary commands for Batch files. They were really small files, less than 400 bytes the majority. For example, below is my GetKey program that read a key from keyboard and return its Ascii code via ERRORLEVEL. This is the MS-DOS 16-bits version:

Code: Select all

mov   ah,8         ;DOS function: Keyboard input without echo
int   21H         ;AL = Ascii code of key pressed
mov   ah,4CH      ;DOS function: Terminate program
int   21H         ;Return Ascii code via ERRORLEVEL

This program generate a .COM file 8 (eight) bytes long! This program requires several modifications to make it Windows 32-bits compatible, so the resulting .EXE file is 1,536 bytes long! (although many of these are zero-filled bytes required in .EXE file format).

Antonio

I find Assembly very interesting, yet hard to learn; I just can't understand what all those MOVs and INTs stand for. :lol:

Re: DOS and VBScript - A Better Interaction?

Posted: 21 Jun 2012 17:16
by einstein1969
Fawers wrote:
Aacini wrote:I only use the best: assembly language!

More than 25 years ago I wrote several small programs as auxiliary commands for Batch files. They were really small files, less than 400 bytes the majority. For example, below is my GetKey program that read a key from keyboard and return its Ascii code via ERRORLEVEL. This is the MS-DOS 16-bits version:

Code: Select all

mov   ah,8         ;DOS function: Keyboard input without echo
int   21H         ;AL = Ascii code of key pressed
mov   ah,4CH      ;DOS function: Terminate program
int   21H         ;Return Ascii code via ERRORLEVEL

This program generate a .COM file 8 (eight) bytes long! This program requires several modifications to make it Windows 32-bits compatible, so the resulting .EXE file is 1,536 bytes long! (although many of these are zero-filled bytes required in .EXE file format).

Antonio

I find Assembly very interesting, yet hard to learn; I just can't understand what all those MOVs and INTs stand for. :lol:


Code: Select all

Mov ah,8       Move in the register AH (like a variable) the value 8
int 21H          Call the interrupt number 21Hex (like a subroutine in the bios or emulated)
                   ah=8 is like a parameter/index for the function/subroutine in the bios code

Re: DOS and VBScript - A Better Interaction?

Posted: 21 Jun 2012 20:17
by Liviu
Aacini wrote:I only use the best: assembly language!

More than 25 years ago I wrote several small programs as auxiliary commands for Batch files. They were really small files, less than 400 bytes the majority. For example, below is my GetKey program that read a key from keyboard and return its Ascii code via ERRORLEVEL. This is the MS-DOS 16-bits version:

Code: Select all

mov   ah,8         ;DOS function: Keyboard input without echo
int   21H         ;AL = Ascii code of key pressed
mov   ah,4CH      ;DOS function: Terminate program
int   21H         ;Return Ascii code via ERRORLEVEL

This program generate a .COM file 8 (eight) bytes long! This program requires several modifications to make it Windows 32-bits compatible, so the resulting .EXE file is 1,536 bytes long! (although many of these are zero-filled bytes required in .EXE file format).

In fairness, 16-bit DOS had no notion of character codes wider than 8-bit, no ANSI vs. OEM codepage concerns, no ALT+[0]### keyboard input etc.

As for assembly, it is indeed what every other language translates down to, eventually. But as they say, one can write bad (or good) code in any language. I still have a skeleton C console-mode program somewhere, in perfectly valid 32b PE format, which parses and echoes back its arguments, compiled to an .exe of just 1,024 bytes. Only "hackish" part of it was to trim down the 16b stub - the one which prints "This program cannot be run in DOS mode" if you really tried to run it under 16b DOS - mine simply beeps, instead ;-) The rest was a combination of "libctiny" and frugal compiler/linker switches.

Liviu