Hi all, I did some experiments with ieee1284 plug and play handshaking, based on the docs on fapo.com ... Yes I know that Public Domain means "everybody can do everything with it, including removing any mention of me as the author". Anyway. Here is what I found:
Default data, control, status in plain DOS is 0, de, cc. In dosemu 1.3.4, it is 0, d8, 4, and in 1.3.2, the I/O ports are not even simulated. I dosemu, whenever you write to the data port, the data is printed even if you do not send a strobe! But you can detect dosemu by its simplified fake control and status: mov dx,378 ; or another baseport of your choice inc dx inc dx in al,dx ; read control bits out dx,al ; dummy control write, no strobe or anything dec dx ; access status bits next in al,dx ; next access clears 40, fake ack from dosemu mov ah,al in al,dx ; returns at once instead of 5 ysec later and ax,4040 cmp ax,0040 jz it_is_dosemu ; otherwise it is a real printer port So this is how we can avoid accidentally printing in dosemu. After that, we start the ieee1284 pnp id sequence: baseport is data, baseport+1 is status, baseport+2 is control. Places with (*) is where lpttest differs, probably lpttest bugs. data = 4 control = (control and f7) or 2 (for me: control is now c6) (selin is now in ieee1284 state, autofeed is also special) status now changes to be for me, status and 78 is 38 now control = control or 1 (strobe) (status changes to 3e for me, "busy" bit, might be irrelevant) control = control and fc (clear both strobe and afeed at once!) (*) (if you would only clear strobe, you would print a 4 now :-p) status changes to d6 for me, status and 30 is 10 now (*) (printer is okay with sequence and supports mode 4) do repeat ... control = control or 2 (autofeed) status changes to 86 for me, status and 40 is 0 now (some status bits now encode a first nibble) control = control and fd status changes to c6 for me, status and 40 is 40 now (some status bits now encode a second nibble) ... while status and 8 is not 8 I cannot figure out if it is possible to abort the transfer early. It seems to be good to leave while control = control and fd by changing after that control = control or 8 (return selin to classic state) but it often happened to me that I accidentally printed a char when returning selin to classic state. Maybe it is better to leave selin in ieee1284 state and leave it to whoever next prints something real to return it to classic, for example by assuming that the BIOS print stuff will do. Maybe part of the problem was that I ran the protocol very slowly, by typing I/O commands in debug manually. This explanation is Public Domain ;-). 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