PIC2SPF.BAS

Go back

Below you'll find the source for the QBasic file PIC2SPF.BAS.

I've been in doubt if I'd republish this file again. Mainly for a few reasons;
1. The stuff I made as a kid is very childish (which kinda makes sense)
2. Times have changed; what was funny/innovative or sharable in 1997 doesn't meet standards in 2024.
3. Most of the code doesn't run natively anymore on modern operating systems.
4. It's in the Dutch language, where most of my shared content is in English.

Still, I've decided to share this file. Keep in mind the age of this content though.

Download PIC2SPF.BAS for QBasic

Com$ = COMMAND$                     'Als dit niet werkt, zet dan een ' vooraan
IF Com$ <> "" THEN
   DIM a$(1 TO 2)
   a = 1
   FOR b = 1 TO LEN(Com$)
      b$ = MID$(Com$, b, 1)
      a$(a) = RTRIM$(a$(a) + b$)
      IF b$ = " " THEN a = a + 1
      IF a = 3 THEN a = 2
   NEXT b
END IF
Pic$ = a$(1)
Spf$ = a$(2)
IF Pic$ = "" THEN LINE INPUT "PIC-bestand: "; Pic$
IF Spf$ = "" THEN
   Spf$ = LEFT$(Pic$, INSTR(Pic$, ".")) + "SPF"
END IF
OPEN Spf$ FOR OUTPUT AS #1
   OPEN Pic$ FOR INPUT AS #2
      FOR a = 0 TO 320
         FOR b = 0 TO 200
            INPUT #2, c
         NEXT b
      NEXT a
      PRINT #1, "256"
      FOR d = 1 TO 256
         INPUT #2, c, b, a
         PRINT #1, 65536 * a + 256 * b + c
      NEXT d
   CLOSE #2
   OPEN Pic$ FOR INPUT AS #2
      k = 0
      e = 0
      a$ = "BM0,0C0"
      FOR a = 0 TO 320
         FOR b = 0 TO 200
            INPUT #2, c
            IF c <> k THEN
               k = c
               a$ = a$ + "D" + LTRIM$(STR$(e))
               a$ = a$ + "C" + LTRIM$(STR$(c))
               e = 0
            END IF
            e = e + 1
            IF LEN(a$) > 70 THEN PRINT #1, a$: a$ = ""
         NEXT b
         a$ = a$ + "BR1BU201"
      NEXT a
      PRINT #1, a$
   CLOSE #2
CLOSE #1