> USBSTATUS # Enumerate USB device statuses # Needs to run in I/O processor (: 2 &80: "USB STATUS v0.01" < data% 255 F: P"usb_Init:usb_Sync:usb_Flush Z0usb_Cmd(&11) : Extended Command Set d,usb_Cmd("IPH") : I/O in binary n,usb_WrStr("FWV"+13): Firmware Version x:usb_RdStr: $usb_result%  $usb_result%,1)=">" 11;10 :  port%=1 2 usb_Cmd("QP"+port%) G "Port ";port%;": ";h0(usb_result%?0,2);" ";h0(usb_result%?1,2); & usb_result%?1<>0:usb_result%?0=0 A%=usb_result%?0  bit%=7 0 -1 N A% (2^bit%): " ";"SERRESPRNHIDCRCBMDOTHHUB",bit%*3+1,3); " ---"; bit%: port%: : : QDn only gives binary result when Short Command used 'usb_Cmd("SCS"): Short Command Set G " CtrlSz InNm OutNm Toggle res Index Sub " "L "Dev Addr| |InSz |OutSz|Type |Port |Class|Proto| | | | Speed" ,J " | | | | | | | | | | | | | | | | | | | | | |" 6 device%=0 15 @%usb_WrStr(&85+" "+device%+13) J. byte%=0 31:data%?byte%=usb_Rd: byte% T d(device%,2);": "; ^3 byte%=0 21:h0(data%?byte%,2);" ";: byte% h data%?11=11:"Card"; r data%?11=9:"Hub"; | data%?11=8:"Disk";  data%?11=7:"Printer"; * data%?11=3: data%?13=1:"Keyboard"; ' data%?11=3: data%?13=2:"Mouse";   usb_Sync  device%  usb_Sync  : : #ݤh0(A%,N%)="0000000"+~A%,N%) #ݤd(A%,N%)=" "+A%,N%) :  > USBLib 1.00 :  USB access routines & =================== 0+usb_Sync:A%=?usb_D:(?usb_S 128): :!usb_Flush:(?usb_S 128): D2'"Flushing USB";::A%=?usb_D:(?usb_S 128) N$A%=+20:>A%:(?usb_S 128): XVݤusb_Err:?usb_result%=13 usb_result%?1=":":=0 "USB Error: "$usb_result%:= b;usb_Cmd(A$):usb_Sync:usb_WrStr(A$+13):usb_RdStr: l(ݤusb_Cmd(A$):usb_Cmd(A$):=usb_Err v3usb_WrStr(A$): A%=1 A$:(?usb_S 64)=0 ?usb_D=A$,A%,1):: ?usb_RdStr:A%=usb_result%-1:A%=A%+1:?A%=usb_Rd:?A%=13: .usb_Wr(A%):(?usb_S 64)=0:?usb_D=A%: 'ݤusb_Rd:(?usb_S 128)=0:=?usb_D usb_Init usb_D=&FCF8:usb_S=&FCF9 +usb_result%=usb_result%: usb_result%:  usb_result% 63,mc% 99  P=0 1:P%=mc%:[OPT P*2 .usb_RdData 'TAY:LDA #data% 255:STA usb_RdLp+4 *LDA #data% 256:STA usb_RdLp+5:LDX #0 5.usb_RdLp:JSR usb_Rd:STA data%,X:INX:BNE usb_RdLp 'INC usb_RdLp+5:DEY:BNE usb_RdLp:RTS  4.usb_Rd:BIT usb_S:BPL usb_Rd2:BIT &FF:BPL usb_Rd .usb_Rd2:LDA usb_D:RTS  .usb_WrData *'TAY:LDA #data% 255:STA usb_WrLp+1 4*LDA #data% 256:STA usb_WrLp+2:LDX #0 >$.usb_WrLp:LDA data%,X:JSR usb_Wr H0.usb_WrLp2:LDA usb_D:BIT usb_S:BPL usb_WrLp2 RINX:BNE usb_WrLp \'INC usb_WrLp+2:DEY:BNE usb_WrLp:RTS f4.usb_Wr:BIT usb_S:BVC usb_Wr2:BIT &FF:BPL usb_Wr p.usb_Wr2:STA usb_D:RTS z]: :