Each HP-IL peripheral defined what it wants to publish and how to do it.
The HP-IL module function INSTAT (input status) is only able to get the first byte of the peripheral status byte array.
The HP-IL Extended-I/O module function STAT (read device status) is able to get the peripheral status byte array of up to 23 bytes long.
HP-IL loop test setup
Code:
Addr Device
0 HP-41
PIL-Box-1 (pyILPER - IL Scope #1 - tracing outbound frames)
1 82162A Thermal Printer
2 82161A Cassette Drive
PIL-Box-2 (pyILPER - IL Scope #2 - tracing inbound frames)
0 HP-41
Example #1: the 82161A Cassette Drive publish a 1-byte status that contains the following ...
Code:
Status Binary Condition Definition
0-15 0000---- Idle Condition No error and not executing a previous command.
16 00010000 Not used.
17 00010001 End Of Tape Error Unexpectedly reached end of tape.
18 00010010 Stall Error Tape has stalled.
19 00010011 End/Stall Error End Of Tape and Stall conditions.
20 00010100 No Tape Error No tape is installed in drive.
21 00010101 Device Error Device possibly requires service.
22 00010110 Device Error Device possibly requires service.
23 00010111 New Tape Error A new tape has been inserted but not positioned.
24 00011000 Time Out Error No data detected on tape.
25 00011001 Record Number Error Retrieved record number not as expected.
26 00011010 Checksum Error Computed checksum differs from expected.
27 00011011 Not used.
28 00011100 Size Error Specified track number greater than 1.
29 00011101 Not used.
30 00011110 Not used.
31 00011111 Not used.
32-63 001----- Busy Condition Device is executing a previous command. (This is not an error.)
82161A Cassette Drive Status (1 byte) [no tape in drive]
Code:
2 ; 82161A Cassette Drive address
SELECT ; make peripheral primary
INSTAT ; HP-IL / X=20 / 0x14 / 41 flags: 76543210 → 00010100 / No Tape Error
STAT ; Ext-IO / A="S " / status bytes encoded as string
ALENGIO ; Ext-IO / X=2 / characters in ALPHA
0
ATOXX ; Ext-IO / X=83 / "S" status identifier from STAT
1
ATOXX ; Ext-IO / X=20 / 0x14 / 00010100 / peripheral status / No Tape Error
HP-IL messages tracing extract
Code:
IL Scope #1 IL Scope #2
ctrl → loop loop → ctrl
------------ ------------
TAD 02 (442) tad 02 (442)
RFC (500) rfc (500)
SST (561) dab 14 (014)
DAB 14 (014) eto (540)
UNT (45F) unt (45f)
RFC (500) rfc (500)
Example #2: the 82162A Thermal Printer publish a 2-bytes status that contains the following ...
Code:
Status __MSB___:__LSB___ Name Definition
76543210:76543210
0: 1 00000000:00000001 LC Lowercase, Set if printer is in Eight-Bit mode and set to lowercase mode.
0: 2 00000000:00000010 CO Column mode, Set if printer set to column mode.
0: 4 00000000:00000100 DW Double wide. Set if printer set to double wide mode.
0: 8 00000000:00001000 RJ Right justify. Set if printer set to right-justify mode.
0: 16 00000000:00010000 EB Eight bit. Set if printer is in Eight-Bit mode.
0: 32 00000000:00100000 BE Buffer empty. Set if no information is accumulated in print buffer.
0: 64 00000000:01000000 ID Idle. Set if printer is not printing.
0:128 00000000:10000000 EL End line. Set if carriage return was last byte received.
1: 0 00000001:00000000 LA Long advance.
2: 0 00000010:00000000 PR Print. Set while PRINT key is down.
4: 0 00000100:00000000 PA Paper advance. Set while PAPER ADVANCE key is down.
8: 0 00001000:00000000 ER Error condition. Set for out-of-paper or carriage jam.
16: 0 00010000:00000000 MA Print mode/jam. [MB:MA Description] [0:1 Trace] [0:0 Manual]
32: 0 00100000:00000000 MB Print mode/jam. [MB:MA Description] [1:1 Jam] [1:0 Normal]
64: 0 01000000:00000000 SR Service request.
128: 0 10000000:00000000 -- Always zero.
82162A Thermal Printer Status (2 bytes)
Code:
1 ; 82162A Thermal Printer address
SELECT ; make peripheral primary
INSTAT ; HP-IL / X=0 / 0x00 / 41 flags: 76543210 → 00000000 / we are loosing the status LSB value here
STAT ; Ext-IO / A="S " / status bytes encoded as string
ALENGIO ; Ext-IO / X=3 / characters in ALPHA
0
ATOXX ; Ext-IO / X=83 / "S" status identifier from STAT
1
ATOXX ; Ext-IO / X=00 / 0x00 / 00000000 / peripheral status MSB /
2
ATOXX ; Ext-IO / X=96 / 0x60 / 01100000 / peripheral status LSB / ID and BE set
HP-IL messages tracing extract
Code:
IL Scope #1 IL Scope #2
ctrl → loop loop → ctrl
------------ ------------
TAD 01 (441) tad 01 (441)
RFC (500) rfc (500)
SST (561) dab 00 (000)
DAB 00 (000) dab 60 (060)
DAB 60 (060) eto (540)
UNT (45F) unt (45f)
RFC (500) rfc (500)
edit: typos