DECLARE SUB PIX (t$)
SCREEN 13
Inicio:
OPEN "dir.lst" FOR INPUT AS #7
k$ = INKEY$
WHILE NOT EOF(1) AND k$ = ""
   INPUT #7, archivo$
   PIX archivo$
   LOCATE 1, 1: PRINT LEFT$(archivo$, LEN(archivo$) - 4)
   SLEEP 3
   k$ = INKEY$
WEND
CLOSE 7
Fin:
SCREEN 0: WIDTH 80

SUB PIX (t$)
IF LEN(t$) < 4 THEN RETURN
IF RIGHT$(t$, 4) = ".px2" THEN GOTO otras
OPEN t$ FOR BINARY AS #1
DIM d AS STRING * 3
DIM dd AS INTEGER
IF LOF(1) = 0 THEN CLOSE #1: KILL t$: EXIT SUB
OUT &H3C8, 0
FOR i = 0 TO 255
GET 1, i * 3 + 64008, d: rgb$ = d
rojo = ASC(LEFT$(rgb$, 1))
verde = ASC(MID$(rgb$, 2, 1))
azul = ASC(RIGHT$(rgb$, 1))
OUT &H3C9, rojo
OUT &H3C9, verde
OUT &H3C9, azul
NEXT i
CLOSE 1
BLOAD t$
EXIT SUB
otras:
OPEN LEFT$(t$, LEN(t$) - 4) + ".plt" FOR BINARY AS #1
IF LOF(1) = 0 THEN CLOSE #1: KILL t$: EXIT SUB
FOR i = 0 TO 255
GET #1, , dd: rojo = dd
GET #1, , dd: verde = dd
GET #1, , dd: azul = dd
PALETTE i, rojo + 256 * verde + 65536 * azul
NEXT i
CLOSE 1
BLOAD t$
EXIT SUB
END SUB

