DosTips.com

A Forum all about DOS Batch
It is currently 30 Aug 2016 16:28

All times are UTC-06:00




Post new topic  Reply to topic  [ 19 posts ]  Go to page Previous 1 2
Author Message
PostPosted: 07 Jun 2012 08:06 
Offline
Expert

Joined: 06 Dec 2011 22:15
Posts: 1184
Location: México City, México
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


Top
   
PostPosted: 21 Jun 2012 16:20 
Offline

Joined: 08 Apr 2012 17:11
Posts: 187
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:
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:


Top
   
PostPosted: 21 Jun 2012 17:16 
Offline
Expert

Joined: 15 Jun 2012 13:16
Posts: 696
Location: Italy, Rome
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:
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:
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


Top
   
PostPosted: 21 Jun 2012 20:17 
Offline
Expert

Joined: 13 Jan 2012 21:24
Posts: 469
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:
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


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 19 posts ]  Go to page Previous 1 2

All times are UTC-06:00


Who is online

Users browsing this forum: Yahoo [Bot] and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited