General Information #

Author: Lloyd Burchill
Language: ACTION!
Compiler/Interpreter: ACTION!
Published: Antic Vol. 5 # (10/ 86)

VIDEO STRETCH#

Rubber visuals in ACTION!#

Stretch visual images like silly putty on any 8-bit Atari with at least 48K memory and a disk drive. Video Stretch requires the ACTION! language cartridge from Optimized Systems Software. (Disk subscribers this month will find a runtime version that doesn't require ACTION!) Paddle controllers are recommended.

Outstanding new graphics possibilies are still being discovered on the Atari 8-Bit computers. The Video Stretch program will vertically compress or stretch an entire screen and select different parts of it to view - in real time. It's a spectacular, eye-catching effect.

Video Stretch can be used for an impressive slide-show program, or just to see how your favorite screens look when warped all out of shape. In any case, the program demonstrates that the 8-bit Atari is still capable of surprising new feats.

The program will work with its own Graphics 9 sample picture. Or you can use your own pictures made with Micro-Painter, Graphic Master and Computereyes. If you have none of these, use Rapid Graphics Converter (Antic, November 1985) to change your images into a compatible format.

TRYING IT OUT #

You will need a pair of paddle controllers plugged into port 1. Paddle 0 controls the size of the display and paddle 1 selects the portion of the image to be seen. You can also use this program with a touch tablet, but it doesn't work quite as well as the paddles. And of course you can write your own routines to send values to Stretch().

Antic Disk subscribers: This month as a bonus you'll find a "runtime" version of Video Stretch that operates without the ACTION! cartridge. Follow the disk Help file instructions for loading STRETCH.EXE. This listing was too long to print in the magazine, and it cannot be adapted by the user as the ACTION! source code can be.

Carefully type in Listing 1, STRETCH.ACT, following the instructions in the ACTION! manual and save a copy before you run it. If you just want to see Video Stretch operate on the Graphics 9 demo picture, type D from the main menu.

If you have some 62-sector micro-screens to try it with, choose the L option from the main menu. The program will display any 62-sector file named D:PICTURE. You can change this default name by altering the filename in the Load() procedure.

You may alter the program to accept any 192-line graphics mode. To make the program accept pictures created in Graphics 15, for example, just redefine IR at the beginning of the program as 14, and change the graphics call in Rubber_Band to Graphics(15). If you have a non-XL computer, Graphics(15) is not available. You can replace it with Graphics(8), and the display will fix itself as soon as Stretch() operates.

Similar changes can be made to the program to make it work on any 192-line graphics mode, namely Graphics 8, 9,10, 11, 14, and 15. For the little-used Graphics 14, change a*40 in Sinit() to a*20.

HOW IT WORKS #

The program is written in ACTION! from Optimized Systems Software, which is ideal for the combination of speed and arithmetic that is required. The Stretch() routine needs two parameters; the first is the size, in scan lines, of the image that will appear on the screen. Normal size is 192 lines. You can choose any size from one to about 500 lines and the image will be proportioned correctly.

Since an image bigger than 192 lines can't be displayed all at once, the second parameter tells what line of the original image will appear at the top of the screen. (It should be between 0 and 191.) This allows you to scan any portion of the expanded image. It also works with images that are smaller than full-size, allowing you the interesting capability of expanding the picture and moving it up and down.

DETAILS #

The Stretch() procedure uses several line-drawing algorithms and speedy integer arithmetic to move each scan line to its proper place on your screen.

Before entering Stretch() you must initialize it with a call to Sinit(). A space of 580 bytes is required for the complex display list generated by the program. Each line has an independent LMS instruction.

Because the new display list is so long, your choice of places to put it is limited to the first 443 bytes in any given kilobyte. If you are using high-resolution Player/Missile graphics, those first three unused pages of P/M space are ideal.


Lloyd Burchill is a high school senior from Newcastle, New Brunswick who likes to write programs with an artistic flair. In 1985 he won a national award for a program about the moons of Uranus.
Listing 1.
;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

PDF: video Stretch/videostretch.PDF(info)