Re: [Freedos-devel] CLS reimplementation (Re: VERIFY reimplementation)

2022-09-14 Thread Guti


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Remitente:    Steve Nickolas 
Destinatario: "Bitácora de Javier Gutiérrez Chamorro (Gu\\" <"Bitácora de 
Javier Gutiérrez Chamorro (Gu\\">
Fecha:        miércoles, 14 de septiembre de 2022, 14:42:02
Asunto:       [Freedos-devel] CLS reimplementation (Re: VERIFY reimplementation)
Archivos:     
--===--
On Wed, 14 Sep 2022, Bitácora de Javier Gutiérrez Chamorro (Guti) wrote:

> Dear Jim,   There is no practical purpose on my mind, just the challenge > of 
> rapidly and efficiently convert it. As you said, both CLS and VERIFY > are 
> internal commands.
> What surprised me about your ANSI fallback is that DOSBox, MS-DOS and > 
> DR-DOS already work it that way, but not the command console in Windows > 11. 
> It seems that with time we are losing capabilities instead of > gaining.
> In fact any argument passed to CLS will trigger the help screen no > matter 
> if it is -h, /? or whatever. It was simply silly to check for it, > since CLS 
> should not expect any argument. BTW, your implementation does > the same, 
> checking argc > 1 which is smart too.
> At least in your 2.01 and 2.1 versions there is no possibility of > changing 
> colors, maybe they were lost in previous versions. But as you > said, this 
> does not matter, just a curiosity.   Kind regards.

I myself only implemented cls at the same level as MS-DOS, and the most basic 
cls looks something like this (NASM):

; Copyright 2001, 2002, 2003, 2022 S. V. Nickolas.
;
; Redistribution in whole or in part, with or without modification, is
; hereby permitted without restriction.  This software is provided "as is"
; and all warranties, express or implied, are hereby disclaimed.

           cpu       8086
           org       0x0100
entry:    mov       ax, 0x4400
           mov       bx, 1               ; stdout
           int       0x21
           jc        .2
           test      dx, 0x0010          ; is CON:
           jz        .2
           mov       byte [maxrow], 24
           mov       ah, 0x12            ; do we have an EGA?
           mov       bx, 0xFF10
           mov       cx, 0x
           int       0x10
           cmp       cx, 0x          ; unchanged = MDA or CGA
           je        .1                  ;   = always 25 lines
           mov       ax, 0x0040          ; otherwise, lines-1 is stored at
           push      es                  ;   0040:0084
           mov       es, ax
           mov       ah, [es:0x0084]
           pop       es
           mov       [maxrow], ah
.1:       mov       ah, 0x0F            ; this, OTOH, works on anything
           int       0x10
           dec       ah
           mov       [maxcol], ah
           mov       ax, 0x0600          ; method used by MS-DOS COMMAND.COM
           mov       bh, 0x07
           xor       cx, cx
           mov       dx, [maxcol]        ; pulls in maxrow also
           push      bp                  ; BUG WORKAROUND
           int       0x10
           pop       bp
           xor       dx, dx
           mov       ah, 0x02
           xor       bh, bh
           int       0x10
           jmp short .3
.2:       mov       dx, eansi
           mov       ah, 0x09
           int       0x21
.3:       mov       ax, 0x4C00
           int       0x21                ; EXIT CODE 0

maxcol:   db        79                  ; Must be in this order
maxrow:   db        24

eansi:    db        27, "[2J$"

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
Like the idea of using the scroll zero lines instead of my method of changing 
video mode.___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] CLS reimplementation (Re: VERIFY reimplementation)

2022-09-14 Thread Steve Nickolas

On Wed, 14 Sep 2022, Bitácora de Javier Gutiérrez Chamorro (Guti) wrote:

Dear Jim,   There is no practical purpose on my mind, just the challenge 
of rapidly and efficiently convert it. As you said, both CLS and VERIFY 
are internal commands.


What surprised me about your ANSI fallback is that DOSBox, MS-DOS and 
DR-DOS already work it that way, but not the command console in Windows 
11. It seems that with time we are losing capabilities instead of 
gaining.


In fact any argument passed to CLS will trigger the help screen no 
matter if it is -h, /? or whatever. It was simply silly to check for it, 
since CLS should not expect any argument. BTW, your implementation does 
the same, checking argc > 1 which is smart too.


At least in your 2.01 and 2.1 versions there is no possibility of 
changing colors, maybe they were lost in previous versions. But as you 
said, this does not matter, just a curiosity.   Kind regards.


I myself only implemented cls at the same level as MS-DOS, and the most 
basic cls looks something like this (NASM):


; Copyright 2001, 2002, 2003, 2022 S. V. Nickolas.
;
; Redistribution in whole or in part, with or without modification, is
; hereby permitted without restriction.  This software is provided "as is"
; and all warranties, express or implied, are hereby disclaimed.

  cpu   8086
  org   0x0100
entry:mov   ax, 0x4400
  mov   bx, 1   ; stdout
  int   0x21
  jc.2
  test  dx, 0x0010  ; is CON:
  jz.2
  mov   byte [maxrow], 24
  mov   ah, 0x12; do we have an EGA?
  mov   bx, 0xFF10
  mov   cx, 0x
  int   0x10
  cmp   cx, 0x  ; unchanged = MDA or CGA
  je.1  ;   = always 25 lines
  mov   ax, 0x0040  ; otherwise, lines-1 is stored at
  push  es  ;   0040:0084
  mov   es, ax
  mov   ah, [es:0x0084]
  pop   es
  mov   [maxrow], ah
.1:   mov   ah, 0x0F; this, OTOH, works on anything
  int   0x10
  dec   ah
  mov   [maxcol], ah
  mov   ax, 0x0600  ; method used by MS-DOS COMMAND.COM
  mov   bh, 0x07
  xor   cx, cx
  mov   dx, [maxcol]; pulls in maxrow also
  push  bp  ; BUG WORKAROUND
  int   0x10
  pop   bp
  xor   dx, dx
  mov   ah, 0x02
  xor   bh, bh
  int   0x10
  jmp short .3
.2:   mov   dx, eansi
  mov   ah, 0x09
  int   0x21
.3:   mov   ax, 0x4C00
  int   0x21; EXIT CODE 0

maxcol:   db79  ; Must be in this order
maxrow:   db24

eansi:db27, "[2J$"
___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] CLS reimplementation (Re: VERIFY reimplementation)

2022-09-14 Thread Guti


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Remitente:    Jim Hall 
Destinatario: Technical discussion and questions for FreeDOS developers. 

Fecha:        miércoles, 14 de septiembre de 2022, 14:00:14
Asunto:       [Freedos-devel] CLS reimplementation (Re: VERIFY reimplementation)
Archivos:     
--===--
On Wed, Sep 14, 2022 at 6:24 AM Javier Gutiérrez Chamorro
 wrote:
> And now it is the turn of CLS (sorry Jim ;-) It reproduces the same
> CLS.C behaviour, including the redirection detection, but instead of
> a 9,080 bytes CLS.EXE it creates a 380 bytes CLS.COM.
> What I did not like about the original C implementation was the use
> of the non-portable clrscr() which is not available in OpenWatcom. So
> I guess that this ASM implementation would be also more portable.
> It is available at
> https://sourceforge.net/projects/nikkhokkho/files/CLS/


I don't mind. :-) I wrote that version of CLS long ago, back when I
wasn't sure if CLS should be an internal or external command. CLS is
now an internal command, so my original CLS is dead anyway.

With the original external CLS, I made an update that could also set
the text foreground and background colors, but I mainly did this
because rewriting CLS as an external command didn't make much sense if
all it did was clear the screen and reset the cursor. Changing the
colors justified (in my mind) making this an external "extended"
command. I think the usage was like "CLS white on blue" to set the
colors to 7,1 and "CLS bright white on blue" to set the colors to
15,1.

You are right, the original CLS external command used the clrscr()
function from Borland's conio library to clear the screen. I recall
the program detected if the user was on a console, and used clrscr()
to clear the screen - otherwise, it used an ANSI sequence to clear the
screen (such as a terminal). The equivalent console function in
OpenWatcom is _clearscreen(_GCLEARSCREEN) from graph.h. IA-16 GCC has
an i86 library that I believe implements clrscr() as well.

I'm curious: why does your CLS use "-h" for help instead of "/?"


___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
 
Dear Jim,
 
There is no practical purpose on my mind, just the challenge of rapidly and 
efficiently convert it. As you said, both CLS and VERIFY are internal commands.
What surprised me about your ANSI fallback is that DOSBox, MS-DOS and DR-DOS 
already work it that way, but not the command console in Windows 11. It seems 
that with time we are losing capabilities instead of gaining.
In fact any argument passed to CLS will trigger the help screen no matter if it 
is -h, /? or whatever. It was simply silly to check for it, since CLS should 
not expect any argument. BTW, your implementation does the same, checking argc 
> 1 which is smart too.
At least in your 2.01 and 2.1 versions there is no possibility of changing 
colors, maybe they were lost in previous versions. But as you said, this does 
not matter, just a curiosity.
 
Kind regards.___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] CLS reimplementation (Re: VERIFY reimplementation)

2022-09-14 Thread Jim Hall
On Wed, Sep 14, 2022 at 6:24 AM Javier Gutiérrez Chamorro
 wrote:
>
> And now it is the turn of CLS (sorry Jim ;-) It reproduces the same
> CLS.C behaviour, including the redirection detection, but instead of
> a 9,080 bytes CLS.EXE it creates a 380 bytes CLS.COM.
>
> What I did not like about the original C implementation was the use
> of the non-portable clrscr() which is not available in OpenWatcom. So
> I guess that this ASM implementation would be also more portable.
>
> It is available at
> https://sourceforge.net/projects/nikkhokkho/files/CLS/


I don't mind. :-) I wrote that version of CLS long ago, back when I
wasn't sure if CLS should be an internal or external command. CLS is
now an internal command, so my original CLS is dead anyway.

With the original external CLS, I made an update that could also set
the text foreground and background colors, but I mainly did this
because rewriting CLS as an external command didn't make much sense if
all it did was clear the screen and reset the cursor. Changing the
colors justified (in my mind) making this an external "extended"
command. I think the usage was like "CLS white on blue" to set the
colors to 7,1 and "CLS bright white on blue" to set the colors to
15,1.

You are right, the original CLS external command used the clrscr()
function from Borland's conio library to clear the screen. I recall
the program detected if the user was on a console, and used clrscr()
to clear the screen - otherwise, it used an ANSI sequence to clear the
screen (such as a terminal). The equivalent console function in
OpenWatcom is _clearscreen(_GCLEARSCREEN) from graph.h. IA-16 GCC has
an i86 library that I believe implements clrscr() as well.

I'm curious: why does your CLS use "-h" for help instead of "/?"


___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel