Näkee lpt dataa ja voi myös kirjottaa lpt dataa. Tein tän joku kaunis kevätiltapäivä kauan sitten niin ei valitettavasti ole kommentoitua mutta kyllä tosta saa selvää. Ja vaikka siinä on enkkua niin se on mun tekemä. Ei YHTÄÄN copypaste jutskaa, bittitiedot haettu "306 kytkentää" kirjasta ja jostain "tee itse pc elektroniikkaa" aattelin joskus kyhätä ledeistä tällasen.
DECLARE FUNCTION c$ (n!) DECLARE FUNCTION Bit! (b!) Lpt = 1 DEF SEG = 0 Addr = PEEK(&H408) + &H100 * PEEK(&H409) DEF SEG DIM Pin(1 TO 17), PinName$(1 TO 17), InOut$(1 TO 17), Col(1 TO 17) FOR i = 1 TO 17 READ InOut$(i), PinName$(i) NEXT FOR i = 1 TO 17 READ Col(i) NEXT DATA InOut,-Strobe,Out,Data 0,Out,Data 1,Out,Data 2,Out,Data 3,Out,Data 4 DATA Out,Data 5,Out,Data 6,Out,Data 7,In,-Ack,In,+Busy,In,+PaperEnd,In,+SelectIn DATA InOut,-AutoFeed,In,-Error,InOut,-Init,InOut,-Select DATA 14,4,4,4,4,4,4,4,4,2,2,2,2,14,2,14,14 Item = 1 CLS SCREEN , , 1, 0 DO p = INP(Addr) FOR i = 2 TO 9 IF (p AND Bit(i - 1)) = Bit(i - 1) THEN Pin(i) = 1 NEXT p = INP(Addr + 1) IF (p AND Bit(7)) = Bit(7) THEN Pin(10) = 1 IF (p AND Bit(8)) = Bit(8) THEN Pin(11) = 1 IF (p AND Bit(6)) = Bit(6) THEN Pin(12) = 1 IF (p AND Bit(5)) = Bit(5) THEN Pin(13) = 1 IF (p AND Bit(4)) = Bit(4) THEN Pin(15) = 1 p = INP(Addr + 2) IF (p AND Bit(1)) = Bit(1) THEN Pin(1) = 1 IF (p AND Bit(2)) = Bit(2) THEN Pin(14) = 1 IF (p AND Bit(3)) = Bit(3) THEN Pin(16) = 1 IF (p AND Bit(4)) = Bit(4) THEN Pin(17) = 1 CLS COLOR 7 PRINT "Lpt" + LTRIM$(STR$(Lpt)) + "(" + HEX$(Addr) + "h) Status (press esc to terminate scanning) " COLOR 7 PRINT "In/Out", "Name", "Pin", "Data" PRINT "------", "----", "---", "----" FOR i = 1 TO 17 COLOR Col(i): PRINT InOut$(i), PinName$(i), c$(i), c$(Pin(i)) NEXT COLOR 7 PRINT "In + Out", "Ground", "18-25" LOCATE Item + 3, 45: PRINT "*" COLOR 8 LOCATE 1, 60: PRINT "Key Map" LOCATE 2, 60: PRINT "-------" LOCATE 3, 60: PRINT "Esc (Quit)" LOCATE 4, 60: PRINT "Left (Turn data OFF)" LOCATE 5, 60: PRINT "Right (Turn data ON)" LOCATE 6, 60: PRINT "Up (Move up)" LOCATE 7, 60: PRINT "Down (Move down)" LOCATE 8, 60: PRINT "Space (Change LPT)" p = INP(Addr) LOCATE 10, 50: COLOR 4: PRINT "Data Port("; HEX$(Addr); "h):" LOCATE 11, 50: PRINT "data "; c$(p); " (hex " + HEX$(p); ")" p = INP(Addr + 1) LOCATE 13, 50: COLOR 2: PRINT "Input Port("; HEX$(Addr + 1); "h):" LOCATE 14, 50: PRINT "data "; c$(p AND 248); " (hex " + HEX$(p AND 248); ")" LOCATE 15, 50: PRINT "Real data "; c$(p); " (hex " + HEX$(p); ")" p = INP(Addr + 2) LOCATE 17, 50: COLOR 14: PRINT "Control Port("; HEX$(Addr + 2); "h):" LOCATE 18, 50: PRINT "data "; c$(p AND 15); " (hex " + HEX$(p AND 15); ")" LOCATE 19, 50: PRINT "Real data "; c$(p); " (hex " + HEX$(p); ")" COLOR 1: LOCATE 21, 37: PRINT "--------------Pin Assignment---------------" LOCATE 22, 37: PRINT "\ "; : COLOR 2: PRINT "13 12 11 10 "; COLOR 4: PRINT " 9 8 7 6 5 4 3 2 "; COLOR 14: PRINT " 1 "; : COLOR 1: PRINT "/ " LOCATE 23, 37: PRINT " \ "; : COLOR 8: PRINT "25 24 23 22 21 20 19 18"; COLOR 14: PRINT " 17 16 "; : COLOR 2: PRINT "15"; COLOR 14: PRINT " 14 "; : COLOR 1 PRINT "/": LOCATE 24, 37: PRINT " \---------------------------------/"; PCOPY 1, 0 a$ = INKEY$ SELECT CASE a$ CASE CHR$(27): EXIT DO CASE " " Addr = 0 WHILE Addr = 0 Lpt = Lpt + 1 IF Lpt = 4 THEN Lpt = 1 DEF SEG = 0 a = &H408 + 2 * (Lpt - 1) lsbaddr = PEEK(a) msbaddr = PEEK(a + 1) Addr = lsbaddr + &H100 * msbaddr DEF SEG WEND CASE CHR$(0) + "K": PinData = 0: GOSUB Duunaa CASE CHR$(0) + "M": PinData = 1: GOSUB Duunaa CASE CHR$(0) + "H" Item = Item - 1 IF Item = 0 THEN Item = 17 WHILE Col(Item) = 2 Item = Item - 1 WEND CASE CHR$(0) + "P" Item = Item + 1 IF Item = 18 THEN Item = 1 WHILE Col(Item) = 2 Item = Item + 1 WEND END SELECT FOR i = 1 TO 17 Pin(i) = 0 NEXT LOOP SCREEN , , 0, 0 END Duunaa: IF Col(Item) = 4 THEN IF PinData = 1 THEN OUT Addr, INP(Addr) OR (2 ^ (Item - 2)) ELSE OUT Addr, INP(Addr) AND (255 - (2 ^ (Item - 2))) END IF ELSE IF Item = 1 THEN BitDo = 1 IF Item = 14 THEN BitDo = 2 IF Item = 16 THEN BitDo = 4 IF Item = 17 THEN BitDo = 8 IF PinData = 1 THEN OUT Addr + 2, INP(Addr + 2) OR BitDo ELSE OUT Addr + 2, INP(Addr + 2) AND (255 - BitDo) END IF END IF RETURN FUNCTION Bit (b) Bit = 2 ^ (b - 1) END FUNCTION FUNCTION c$ (n) c$ = LTRIM$(RTRIM$(STR$(n))) END FUNCTION
joo hyvä käyttis...
eiks oo :) sitä mä just hioin ihan sairaasti
ihan hyvä. teitkö sille ledisysteemille joka on sun sivuilla.
Aihe on jo aika vanha, joten et voi enää vastata siihen.