Re: [Freedos-devel] LPTtest released

2007-07-09 Thread Japheth

>> - on PS/2 or newer, int 15 with ah=86 cx:dx=ysec might be useful for
>>   delays (usually 1024 Hz granularity, your 1000 ysec should be fine)
>>   but you will have to check first if the delay works, for example
>>   by checking the BIOS ID or by checking 40:[6c] before/after a call.
> I tried it and on my computer it doesn't work and I even think it works only
> on machines by IBM. I know it is described in RBIL but I have never seen any
> real source using this service.

It works not just on IMB machines, but one cannot really rely on it, and this 
call is known to fail in WinNT/XP. It's a better idea to access the RTC 
directly. This works reliable, even on WinNT/XP. Also, DosEmu v1.4 supports 
the RTC now, although it is slightly "fakeish" since it is based on a 
interrupt frequency of 100 Hz only.

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] LPTtest released

2007-07-09 Thread Jim Hall
On 7/9/07, Ladislav Lacina <[EMAIL PROTECTED]> wrote:
>
>
> Hello all, I wrote small and simple program witch can detect any device
> attached to parallel port.
> (It displays parallel port Plug and play device info)
> Maybe it isn't so useful for end users but may help to programmers.
> URL: http://www.laaca-mirror.ic.cz/lpttest.zip
>

I echo some of Eric's suggestions, but I'd also add these comments:

Your ASM program source says this is distributed under the GNU GPL:

;The following code is based on the IEEE-1284 probe code from Linux, which was
;written by Phil Blundell, Carsten Gross and Jose Renau and on Turbo pascal
;translation by unknown author.
;Implementation in assembler (TASM 4.1) is written by Laaca
;I am not sure about timing of signals because original source claims that it is
;important but it was difficult to rewrite in assembler preciously.

;This program can be spread under conditions of GNU/GPL licence.


You need to also include a copy of the GNU GPL with a copy of your
program.  To do so, put the following notice at the start of each
source file; each file should have at least the "copyright" line and a
pointer to where the full notice is found.  I'm using the GNU GPL v2
here, since the Linux code you reference (derived from) is still
covered ONLY BY GNU GPL v2.(**)  Therefore, it would be inappropriate
to automatically promote this derivation to GNU GPL v3.


Copyright (C)   

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, only version 2 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see .

Also add information on how to contact you by electronic and paper mail.

Since your program displays to the screen, it should output a short
notice like this, usually in a "Help" screen:

  Copyright (C)   
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; see COPYING for details.


(**) Just for reference, I grabbed the latest Linux kernel source, and
found this note in COPYING:

> Also note that the only valid version of the GPL as far as the kernel
> is concerned is _this_ particular version of the license (ie v2, not
> v2.2 or v3.x or whatever), unless explicitly otherwise stated.
>
>Linus Torvalds

And the two kernel source files that do 1284 don't mention a different
GNU GPL version (it mentions code snippets may be used in
documentation under the GFDL 1.1 or later, but that is not a source
code license.)

-jh

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] LPTtest released

2007-07-09 Thread Ladislav Lacina
Yes, we have discussed some of yout tips before. Version 1.2 is not the
final version and I will upgrade it. I only wanted to introduce it to
FreeDOS community.

> - lpttest only checks LPT1 and does not check if the baseport
>   of LPT1 is nonzero (in other words, if LPT1 exists...).
>   It should check all of LPT1 / LPT2 / LPT3 if they exist.
Yes, I'll do it.

> - lpttest writes the value 4 to the data port without first
>   doing some ieee1284 control / status handshake test. This
>   means it will print a diamond sign on non plug and play
>   printers and in dosemu. That should be avoided. See for
>   example www.theiling.de/parport/introduction.html etc?
Well, I looked at it but I don't understand it very much. There is only
described the status of the pins in cable but not the contain of registers.
> - lpttest uses an array of 8 bytes as 64 bit delay counter. This
>   is overly complicated. Please use 3 or four 16 bit registers
>   instead, code will be more compact and easier to maintain.
Yes, it is quite compicated but works OK and I understand it. Other people
can take it as a blackbox :-)
Adding some I/O reads is quite good idea but isn't really needed because it
is no problem to increase the counter to MANY-bit delay counter. Inner loops
are quite similar, IMO.
> - lpttest uses some "shl/shr reg,imm" (neither 1 nor CL). This
>   seems to be the only thing which makes it 8086 incompatible?
>   As 8086 compatibility is easy to repair, please support 8086.
Uff, it is a stupid bug. Already corrected.
> - lpttest assumes that a timer tick is 64 msec, not 55, and I am
>   not sure if the calculation works out okay on the byte string.
Yes! I am proud to this ugly hack. Proper routine for dividing array of
bytes by 55 would be so complicated...
So, my timer is a little bit faster but why not. LPTtest is not for
scientific measuring :-)
For one byte strings it works too.
> - your stack seems to be very small. In a .com program, it is
>   better to leave the stack setup to the operating system unless
>   you need to shrink the stack eg to allocate more heap or go TSR.
Really? OK, I'll increase it. LPTtest is my first program written in
assembler so it is not perfect.
(I already wrote quite a lot of assembler code but it allways was an
included assembler in pascal source)
> - the Linux printer port plug and play probe combines per inter-
>   action timeouts with two global limits: Plug and play is aborted
>   if the printer sends more than 2 kB of data or if the whole
>   communication takes more than 5 seconds. Nice idea :-).
Well, why not, I could try it to write it too.
> - you could try to make lpttest fit into 1 kilobyte ;-) For example
>   present / second / ok_id / err_id / our_size + ret_size / failed_1
>   and failed_2 could be shorter and delay stuff could be simpler.
:-D
Why? It is not TSR so it would be only a programmers masturbation :-)
> - on PS/2 or newer, int 15 with ah=86 cx:dx=ysec might be useful for
>   delays (usually 1024 Hz granularity, your 1000 ysec should be fine)
>   but you will have to check first if the delay works, for example
>   by checking the BIOS ID or by checking 40:[6c] before/after a call.
I tried it and on my computer it doesn't work and I even think it works only
on machines by IBM. I know it is described in RBIL but I have never seen any
real source using this service.


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] LPTtest released

2007-07-09 Thread Eric Auer

Hi Ladislav,

> Hello all, I wrote small and simple program which can detect
> any device attached to parallel port.
> (It displays parallel port Plug and play device info)
> Maybe it isn't so useful for end users but may help to programmers.
> URL: http://www.laaca-mirror.ic.cz/lpttest.zip

I would like to report some bugs, so you can make lpttest
more useful for end users :-). Thank you for writing lpttest!

- lpttest only checks LPT1 and does not check if the baseport
  of LPT1 is nonzero (in other words, if LPT1 exists...).
  It should check all of LPT1 / LPT2 / LPT3 if they exist.

- lpttest writes the value 4 to the data port without first
  doing some ieee1284 control / status handshake test. This
  means it will print a diamond sign on non plug and play
  printers and in dosemu. That should be avoided. See for
  example www.theiling.de/parport/introduction.html etc?

- lpttest uses an array of 8 bytes as 64 bit delay counter. This
  is overly complicated. Please use 3 or four 16 bit registers
  instead, code will be more compact and easier to maintain.

- lpttest does not use I/O port reads in the delay counter and
  the delay counter calibration. This means that counts will
  be very high (CPU can count much faster than it can read I/O)
  and that calibration and count durations can differ more
  (inner loops should be the same in both functions ideally).

- lpttest uses some "shl/shr reg,imm" (neither 1 nor CL). This
  seems to be the only thing which makes it 8086 incompatible?
  As 8086 compatibility is easy to repair, please support 8086.

- lpttest assumes that a timer tick is 64 msec, not 55, and I am
  not sure if the calculation works out okay on the byte string.
  A chain of shr/rcr over 3-4 registers would be nice for 64 msec
  but you can also calibrate 9 ticks as "512" msec ;-).

- your stack seems to be very small. In a .com program, it is
  better to leave the stack setup to the operating system unless
  you need to shrink the stack eg to allocate more heap or go TSR.

Wishes:

- the Linux printer port plug and play probe combines per inter-
  action timeouts with two global limits: Plug and play is aborted
  if the printer sends more than 2 kB of data or if the whole
  communication takes more than 5 seconds. Nice idea :-).

- you could try to make lpttest fit into 1 kilobyte ;-) For example
  present / second / ok_id / err_id / our_size + ret_size / failed_1
  and failed_2 could be shorter and delay stuff could be simpler.

- on PS/2 or newer, int 15 with ah=86 cx:dx=ysec might be useful for
  delays (usually 1024 Hz granularity, your 1000 ysec should be fine)
  but you will have to check first if the delay works, for example
  by checking the BIOS ID or by checking 40:[6c] before/after a call.

Have a nice lpttest time :-)

Eric


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


[Freedos-devel] LPTtest released

2007-07-09 Thread Ladislav Lacina
Hello all, I wrote small and simple program witch can detect any device 
attached to parallel port.
(It displays parallel port Plug and play device info)
Maybe it isn't so useful for end users but may help to programmers.
URL: http://www.laaca-mirror.ic.cz/lpttest.zip

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel