TIP: Click on subject to list as thread! ANSI
echo: power_bas
to: ALL
from: DAVE NAVARRO
date: 1995-10-21 18:54:00
subject: DECPCX.BAS for PowerB 1/2

'Decode PCX files
'by Dave Navarro, Jr.
DEFINT A-Z
TYPE PcxHeader
        Mfg    AS BYTE
        Ver    AS BYTE
        Enc    AS BYTE
        Bpp    AS BYTE
        XMin   AS INTEGER
        YMin   AS INTEGER
        XMax   AS INTEGER
        YMax   AS INTEGER
        Hres   AS INTEGER
        Vres   AS INTEGER
        Pal    AS STRING * 48
        Resrv  AS BYTE
        ColPl  AS BYTE
        Bpl    AS INTEGER
        PalTyp AS INTEGER
        Filler AS STRING * 58
END TYPE
DIM Header AS PcxHeader
DIM ByteBuffer AS BYTE
OPEN "B",1,"TMP.PCX"
         GET# 1,,Header
         IF Header.Mfg  10 AND Header.Ver  5 THEN
                 PRINT "Not a 256 color PCX file!"
                 END
         END IF
         Tmp& = LOF(1) - 768
         SEEK# 1, Tmp&
         GET$ 1,768,Palete$
         FOR I = 1 TO 768
                 Tmp? = ASC(MID$(Palete$,I,1))
                 SHIFT RIGHT Tmp?,2
                 MID$(Palete$,I,1)=CHR$(Tmp?)
         NEXT I
         SEEK# 1, 128
         Wid = Header.Xmax - Header.Xmin + 1
         Dep = Header.Ymax - Header.Ymin + 1
         Byt = Header.Bpl
         PRINT Wid;"x";Dep;"x";2^Header.Bpp
         I$=INPUT$(1)
         Mode13 1
         REG 1, &H1012
         REG 2, 0
         REG 3, 256
         REG 4, STRPTR(Palete$)
         REG 9, STRSEG(Palete$)
         CALL INTERRUPT &H10
   FOR Y = 0 TO Dep - 1
                 FOR X = 0 TO Byt - 1
                         GET# 1,,ByteBuffer
                         ByteBuffer = ByteBuffer AND &HFF
                         IF (ByteBuffer AND &HC0) = &HC0 THEN
                                 Times = ByteBuffer AND &H3F
                                 GET# 1,,ByteBuffer
                                 FOR I = 1 TO Times
                                         PlotPixel ByteBuffer
                                 NEXT I
                                ELSE
                                         PlotPixel ByteBuffer
                         END IF
                 NEXT X
         NEXT Y
CLOSE 1
BEEP
I$=INPUT$(1)
Mode13 0
END
SUB PlotPixel(Z AS BYTE)
        SHARED Wid
        STATIC X, Y
        DEF SEG = &HA000
                POKE Y*320+X, Z
        DEF SEG
        INCR X
(Continued to next message)
---
 * QMPro 1.53 * WOMAN.ZIP - Great Program.  No Docs, but fun to unZIP.
--- GEcho 1.20/Pro
---------------
* Origin: Toast House * (314) 994-0312 * (1:100/560)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.