Source code Apple IIe Lo-Res conversion PRG     

Written in DarkBasic

DIM GR(1015)
DIM OFFSET(23)
 
OFFSET(0)=0
OFFSET(1)=128
OFFSET(2)=256
OFFSET(3)=384
OFFSET(4)=512
OFFSET(5)=640
OFFSET(6)=768
OFFSET(7)=896
OFFSET(8)=40
OFFSET(9)=168
OFFSET(10)=296
OFFSET(11)=424
OFFSET(12)=552
OFFSET(13)=680
OFFSET(14)=808
OFFSET(15)=936
OFFSET(16)=80
OFFSET(17)=208
OFFSET(18)=336
OFFSET(19)=464
OFFSET(20)=592
OFFSET(21)=720
OFFSET(22)=848
OFFSET(23)=976
 
PERFORM CHECKLIST FOR DISPLAY MODES
SET DISPLAY MODE 640,480,32
HIDE MOUSE
 
FOO:
X=0
READ FL$
IF FL$="END" THEN END
 
OP$="M:\LORES\GR\"+FL$
OPEN TO READ 1,OP$
 
BAR:
READ BYTE 1,GR(X)
X=X+1
T=FILE END(1)
IF T=0 THEN GOTO BAR
CLOSE FILE 1
 
FOR OS=0 TO 15
FOR X=0 TO 39 STEP 1
FOR Y=0 TO 39 STEP 1
T=MOD(X,2)
IF T=0 THEN GRCL=(GR(OFFSET(X/2)+Y)&15)
IF T=1 THEN GRCL=(GR(OFFSET(X/2)+Y)&240)/16
GRCL=GRCL+OS:GRCL=MOD(GRCL,16)
CL=GRCOLOR(GRCL)
GRPLOT(X,Y,CL)
NEXT Y
NEXT X
 
EX$=""
IF OS<10 THEN EX$="0"
FN$="M:\LORES\DB\"+FL$+EX$+STR$(OS)+".BMP"
SAVE BITMAP FN$
NEXT OS
GOTO FOO
 
DATA "!A125518.LRS","!A150177.LRS","!CIR.LRS","!CIR1.LRS","!CIR2.LRS"
DATA "!CIR3.LRS","!CIR4.LRS","!CIRNIC.LRS","!CIRNIC1.LRS","!CIRNIC2.LRS"
DATA "!SPIRAL1.LRS","!SPIRAL2.LRS","A0.LRS","A10A.LRS","A10B.LRS"
DATA "A11A.LRS","A11B.LRS","A12.LRS","A12B.LRS","A13.LRS"
DATA "A13B.LRS","A14.LRS","A14B.LRS","A15.LRS","A15B.LRS"
DATA "A16.LRS","A16B.LRS","A17.LRS","A17B.LRS","A18.LRS"
DATA "A18B.LRS","A19.LRS","A19B.LRS","A1A.LRS","A20.LRS"
DATA "A20B.LRS","A21.LRS","A21B.LRS","A22.LRS","A22B.LRS","A23.LRS"
DATA "A23B.LRS","A24.LRS","A24B.LRS","A25.LRS","A25B.LRS","A26.LRS"
DATA "A26B.LRS","A2A.LRS","A2B.LRS","A3A.LRS","A3B.LRS"
DATA "A4A.LRS","A4B.LRS","A5A.LRS","A5B.LRS","A6A.LRS"
DATA "A6B.LRS","A7A.LRS","A7B.LRS","A8A.LRS","A8B.LRS","A9A.LRS"
DATA "A9B.LRS","AND.LRS","AX.LRS","AX2.LRS","CIR1.LRS","CIR3.LRS"
DATA "CIR4.LRS","CIRCLE1.LRS","CIRCLE2.LRS","CIRCLE3.LRS","EOR.LRS","EOR2.LRS"
DATA "EOR3.LRS","EOR5.LRS","EXP1-2.LRS","EXP1.LRS","EXP2-2.LRS"
DATA "EXP2.LRS","EXP3-2.LRS","EXP3.LRS","EXP4-2.LRS","EXP4.LRS"
DATA "LINES.LRS","ORA.LRS","SA0.LRS","SA1.LRS","SPIRAL3.LRS"
DATA "SPIRAL4.LRS","SPIRAL8.LRS","SPIRAL9.LRS"
DATA "END"
 
function GRPLOT(X,Y,CL)
X#=X:Y#=Y
TP#=SCREEN WIDTH():XS#=TP#/40
TP#=SCREEN HEIGHT():YS#=TP#/40
X1#=X#*XS#:Y1#=Y#*YS#
X2#=(X#+1)*XS#:Y2#=(Y#+1)*YS#
INK CL,0
BOX INT(X1#),INT(Y1#),INT(X2#),INT(Y2#)
endfunction
 
function mod(c,dv)
dv#=dv:c#=c
rd#=((c#/dv#)-int(c#/dv#))*dv#
endfunction int(rd#)
 
function GRCOLOR(C)
CL=-10
SELECT C
CASE 0 : CL=RGB(0,0,0): ENDCASE
CASE 1 : CL=RGB(223,0,54): ENDCASE
CASE 2 : CL=RGB(0,3,149): ENDCASE
CASE 3 : CL=RGB(225,33,217): ENDCASE
CASE 4 : CL=RGB(5,117,31): ENDCASE
CASE 5 : CL=RGB(85,85,85): ENDCASE
CASE 6 : CL=RGB(35,35,253): ENDCASE
CASE 7 : CL=RGB(104,172,235): ENDCASE
CASE 8 : CL=RGB(125,85,23): ENDCASE
CASE 9 : CL=RGB(255,102,0): ENDCASE
CASE 10 : CL=RGB(85,85,85): ENDCASE
CASE 11 : CL=RGB(255,150,140): ENDCASE
CASE 12 : CL=RGB(18,219,1): ENDCASE
CASE 13 : CL=RGB(250,255,0): ENDCASE
CASE 14 : CL=RGB(66,255,153): ENDCASE
CASE 15 : CL=RGB(255,255,255): ENDCASE
ENDSELECT
endfunction CL