flat assembler
Message board for the users of flat assembler.

Index > Windows > help with cmd.exe window size

Author
Thread Post new topic Reply to topic
MajorDill



Joined: 01 Nov 2010
Posts: 22
MajorDill 01 Nov 2010, 16:41
I am writing a .com program that runs in the cmd.exe window. I would like it to look like a Linux program that runs on another system, 37 rows by 100 characters. How can I resize the cmd window from within my program to achieve this effect. The program is a very small, non mouse, non graphics, line editor like vi or emacs.

Thank you in advance
Post 01 Nov 2010, 16:41
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 01 Nov 2010, 16:50
.com program can't do it. You can resize console window (for particular app) on YOUR machine by opening meny (click icon in upper left corner of window), and there in properties.
Post 01 Nov 2010, 16:50
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
pearlz



Joined: 07 Jun 2010
Posts: 55
Location: Viet Nam
pearlz 01 Nov 2010, 17:04
mouse click to icon on caption of cmd , properties and change setting in layout tab.
but if is dos program you can use "int 10h" to change video mode

http://ip-tietgennet.tietgen.dk/staff/mlha/PC/Prog/asm/int/int10.htm
Post 01 Nov 2010, 17:04
View user's profile Send private message Reply with quote
MajorDill



Joined: 01 Nov 2010
Posts: 22
MajorDill 01 Nov 2010, 17:47
If users have to manually adjust their menu, it will just yank them off. It would also be nice if I could set it back to the way I found it but...not really necessary.

Using the video mode only gets me to 80x25 as far as I can tell.

I figured since you can change the size, from the prompt, with the mode command:

c:>mode con: cols=100 rows=37

then it must be possible to do it from my program...if I only knew where to poke and prod it.
Post 01 Nov 2010, 17:47
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 01 Nov 2010, 20:36
If you want your app to be used by real users, write native Windows app, not DOS application to be emulated by NTVDM (which, by the way, doesn't work on 64-bit windows)
Post 01 Nov 2010, 20:36
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 02 Nov 2010, 07:02
vid wrote:
If you want your app to be used by real users, write native Windows app, not DOS application to be emulated by NTVDM (which, by the way, doesn't work on 64-bit windows)


What vid is (badly) trying to say is that .COM isn't even really a format, and it's an old DOS or CP/M "flat binary" creation that few utilize anymore. In other words, it's never been "Windows", directly or indirectly. (Win16 [and OS/2] supported NE .EXEs, Win32/64 support PE .EXEs.) Since most computers come with Windows by default, whether you like it or not, the lazy way out is to just support that. (I'm not convinced Java is a panacea here.)

On 32-bit Windows, NTVDM doesn't emulate, it runs natively (V86 mode) with some simple hooks for BIOS and DOS translation calls. Similarly, DOSEMU under Linux works very well (except that even under 64-bit it works, 32-bit DJGPP apps for example run at native speed there while 16-bit stuff has to be fully emulated [no V86], which is very slow, though still better than Windows' "nothing at all", not sure why they don't even halfway support it since they used to have 486 emulators for non-x86 NT versions "back in the day", sigh).
Post 02 Nov 2010, 07:02
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20486
Location: In your JS exploiting you and your system
revolution 02 Nov 2010, 07:08
I wonder if the problem that MS saw with including an emulator is that people will complain if the emulator doesn't support their own CPUs instruction set? The emulator will most probably be either over-specified (support more than the existing CPU), or under-specified (support less than the current CPU). And an exact match would only occur for a few "lucky" users.
Post 02 Nov 2010, 07:08
View user's profile Send private message Visit poster's website Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 02 Nov 2010, 09:08
rugxulo wrote:
though still better than Windows' "nothing at all", not sure why they don't even halfway support it since they used to have 486 emulators for non-x86 NT versions "back in the day", sigh).
Because maintaining a full CPU emulator is a pretty big effort, and most people don't need support for cruddy old DOS? Pretty simple cost/benefit calculation.

_________________
Image - carpe noctem
Post 02 Nov 2010, 09:08
View user's profile Send private message Visit poster's website Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 02 Nov 2010, 12:41
f0dder wrote:
rugxulo wrote:
though still better than Windows' "nothing at all", not sure why they don't even halfway support it since they used to have 486 emulators for non-x86 NT versions "back in the day", sigh).
Because maintaining a full CPU emulator is a pretty big effort, and most people don't need support for cruddy old DOS? Pretty simple cost/benefit calculation.


Et tu, fodde?

They have like 90,000 programmers, for freak's sake, how hard can it be to maintain???
Post 02 Nov 2010, 12:41
View user's profile Send private message Visit poster's website Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 02 Nov 2010, 12:50
rugxulo wrote:
Et tu, fodde?
Laughing
Yes, I do believe DOS is pretty cruddy and without justification today - there might be a few very special cases, but you're probably better off with another solution there as well. YMMV, but Microsoft caters to the majority... that's just how business works Smile

rugxulo wrote:
They have like 90,000 programmers, for freak's sake, how hard can it be to maintain???
"Hard enough"? Especially when the few people who need it can be directed to DOSBox or full-blown virtual machine solutions?

_________________
Image - carpe noctem
Post 02 Nov 2010, 12:50
View user's profile Send private message Visit poster's website Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 02 Nov 2010, 20:43
MajorDill wrote:
I figured since you can change the size, from the prompt, with the mode command:

c:>mode con: cols=100 rows=37

then it must be possible to do it from my program...if I only knew where to poke and prod it.
mode.com (NT+) is really a regular PE in disguise (so it can use Win32 API to adjust console size). There is old utility, Z.Com, which you may download from www.whitetown.com — this pure DOS program does console window resizing along with many other things you may find useful.
Post 02 Nov 2010, 20:43
View user's profile Send private message Reply with quote
MajorDill



Joined: 01 Nov 2010
Posts: 22
MajorDill 03 Nov 2010, 19:28
I sorry, I should have been more clear. The old code I received was a COM file. I can change it to an EXE but I'm already sitting at 7k and I probably shouidn't exceed 10k overall, so I don't really see the point in doing that. I should also mention this IS going to be running on some old 16 machines as well as 32, some Linux, some Windows.

So I tried throwing it in a batch file with "mode" command before the program, but as soon as my prog executes, it throws it back to 80 chars but interesting enough NOT 25 lines (like mode 03) but changes it from 37 to 43 lines?

I think what I really need is DETAILED documentation on the workings of the cmd program if anyone knows a book or web page where I can find it.

Thanks for all the replies so far.
Post 03 Nov 2010, 19:28
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 03 Nov 2010, 19:56
MajorDill,

Cross-platform binary? You'll have a hard time to develop it.

cmd.exe, while not being easy reading, is quite straightforward: read input, parse it, execute action prescribed, rinse and repeat.
Post 03 Nov 2010, 19:56
View user's profile Send private message Reply with quote
MajorDill



Joined: 01 Nov 2010
Posts: 22
MajorDill 04 Nov 2010, 15:15
It turns out that in some corners of the globe Window, Microsoft and DOS are all the same thing. Once I got someone with better english skills to take a look, it turns out all the hardwired machines are an old version of DOS and are booted from one 20meg hard card...yes...a "hard card" if anyone remembers what that is. The Linux machines are just networked to the system and installed after 2000, so probably 32 bit. Problem solved...thanks for the help.
Post 04 Nov 2010, 15:15
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 04 Nov 2010, 15:48
MajorDill wrote:
it turns out all the hardwired machines are an old version of DOS and are booted from one 20meg hard card...yes...a "hard card" if anyone remembers what that is.
I would have thought one of those very early SSDs, but apparently not - cute Smile

_________________
Image - carpe noctem
Post 04 Nov 2010, 15:48
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
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
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.