;STRETCH
;BY LLOYD BURCHILL
;(c) 1986, ANTIC PUBLISHING
Module
byte key=764,IR
card scr=88,dlist=560
define dlspace="14592"
define dlsend= "14592 +575"
;a 580 byte long space is needed
;that includes no addresses on
;a 1K boundary
;(excepting first byte)
card array memline(192)
Proc Stretch(card lines,card vstart)
;Parameters:
;'lines' is number of scan lines the image should occupy on the screen
;'vstart' is scan line of original image that will appear at top of screen
Byte pointer p
card pointer q
card bigline,addr,inc,temp
inc=24576/lines
bigline=(inc rsh 1)+(vstart lsh 7)
p=dlspace+3
q=dlspace+4
do
temp=bigline rsh 7
addr=memline(temp)
p^=IR+64
p==+3
q^=addr
q==+3
bigline==+inc
if bigline>24576 or p>dlsend then exit fi
od
p^=65
Return
Proc Sinit() ;initialize
card a
setblock(dlspace,3,112)
for a=0 to 191 do
memline(a)=scr+a*40 od
;change to 'a*20' to use mode 14
stretch(192,0)
dlist =dlspace
Return
Proc Load() ;load disk picture
byte pointer p
Close(5)
Open(5,"D1:PICTURE",4,0)
for p=scr to scr+7679
do
p^=GetD(5)
od
p=712
p^=GetD(5)
for p=708 to 710
do
p^=GetD(5)
od
Close(5)
Return
Proc Drawing() ;example picture
byte t,u,v,w,x,y,z
for w=0 to 30
do
color=rand(16)
x=rand(76)
y=rand(180)
for z=0 to 3
do
Plot(x+z,y) Drawto(x+z,y+12)
od
od
for x=0 to 14
do
color=x+1
Plot(0,x) Drawto(79-x,95) Drawto(0,191-x)
Plot(0,29-x) Drawto(52+x,95) Drawto(0,163+x)
od
for w=0 to 15
do
z=10+ rand(70)
y=rand(192-z)
u=rand(20)
v=rand(50-u)+15
t=10+rand(21)
for x=0 to 14
do
color=(15-x)*t/30
Plot(v-x,y+z)
Drawto(v-10+u,y)
Drawto(v+x,y+z)
od
od
Return
Proc Rubber_Band() ;main procedure
byte pad1=624,pad2=625,mode
card h
do
IR=15
;use 15 for modes 8,9,10,11
;use 14 for mode 15, "graphics 7 1/2"
;use 12 for mode 14 (160 x 192 x 2 colors)
Graphics(0)
Poke (752,1)
PrintE ("Ìoad your own picture")
PrintE ("Äemo mode")
do
until key=0 OR key=58
od
mode=key
Poke(764,255)
if mode=58 then
Graphics(9) Poke(712,128)
Drawing()
elseif mode=0 then
Graphics(8) Poke(712,128)
IR=14
Load()
fi
;Use either Load() or Drawing()
;and adjust graphics call
;according to preference
Sinit()
do
h=pad1
if pad2<192 then
Stretch(h lsh 1 ,pad2)
fi
until key<>255
od
until 0=1
od
Return