home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / basic / bmag / loadpcx.bas < prev    next >
Encoding:
BASIC Source File  |  1994-04-13  |  2.1 KB  |  65 lines

  1. '─ Area: F-QUICKBASIC ─────────────────────────────────────────────────────────
  2. '  Msg#: 376                                          Date: 11 Apr 94  21:28:20
  3. '  From: Jared Grubb                                  Read: Yes    Replied: No 
  4. '    To: All Who Wanted This                          Mark:                     
  5. '  Subj: PCX files, not written by me!
  6. '──────────────────────────────────────────────────────────────────────────────
  7. 'From: BRENT ASHLEY
  8. 'Subj: PICTURES WITH QBASIC
  9. '---------------------------------------------------------------------------
  10. 'Here's a PCX loader I found and played with some time ago.  There are no
  11. 'comments and I'm not sure about converting to other screen modes, but 'it's a
  12. 'start and you're welcome to it.  For speed, you'll want to either 'modify this
  13. 'to write to an invisible page and then make the page visible '(apparent speed),
  14. 'or find a library with PCX routines (some of Tom 'Hanlin's have them) written
  15. 'in assembler.
  16. DEFINT A-Z
  17. DECLARE SUB PCXLOAD (File$)
  18.  
  19. File$ = "FILENAME.PCX"
  20.  
  21. CLS
  22. PCXLOAD File$
  23.  
  24. SUB PCXLOAD (File$) STATIC
  25.   SCREEN 12, , 0
  26.   OPEN File$ FOR INPUT AS #1 LEN = 16384
  27.   SEEK #1, 129
  28.   DEF SEG = &HA000
  29.   FOR ScrLin = 0 TO 479
  30.     Addr& = 80& * ScrLin
  31.     LinStrt& = Addr&: LinEnd& = Addr& + 80
  32.     Plane = 1
  33.     OUT &H3C4, 2: OUT &H3C5, Plane
  34.     DO WHILE Plane <= 8
  35.       Byte = ASC(INPUT$(1, 1))
  36.       IF EOF(1) THEN EXIT FOR
  37.       IF (Byte AND 192) <> 192 THEN
  38.         POKE Addr&, Byte
  39.         Addr& = Addr& + 1
  40.         IF Addr& >= LinEnd& THEN
  41.           Addr& = LinStrt&
  42.           Plane = Plane * 2
  43.           OUT &H3C4, 2: OUT &H3C5, Plane
  44.         END IF
  45.       ELSE
  46.         Byte = Byte AND 63
  47.         Byte2 = ASC(INPUT$(1, 1))
  48.         IF EOF(1) THEN EXIT FOR
  49.         FOR Expand = 1 TO Byte
  50.           POKE Addr&, Byte2
  51.           Addr& = Addr& + 1
  52.           IF Addr& >= LinEnd& THEN
  53.             Addr& = LinStrt&
  54.             Plane = Plane * 2
  55.             OUT &H3C4, 2: OUT &H3C5, Plane
  56.           END IF
  57.         NEXT
  58.       END IF
  59.     LOOP
  60.   NEXT
  61.   OUT &H3C4, 2: OUT &H3C5, &HF
  62.   DEF SEG
  63.   CLOSE #1
  64. END SUB
  65.