Classic Computer Magazine Archive PROGRAM LISTING: 85-04/SPLASH3.ACT


;  SPLASH 3
;------------------------------------
;  Gr8
; Paul Chabot
;
MODULE
BYTE ARRAY mask=[128 64 32 16 8 4 2 1]
CARD ARRAY adrow(160)

PROC Clor(BYTE c)
BYTE i
FOR i=0 TO 7 DO 
  mask(7-i)=c:c==LSH 1
OD
RETURN

PROC Dot(CARD x,BYTE y)
BYTE xb,xr
BYTE ARRAY row
  ,premask=[127 191 223 239 247 251 253 254]
xb=x RSH 3:xr=x AND 7:row=adrow(y)
row(xb)==& premask(xr) % mask(xr)
RETURN

PROC BLine(CARD x1,BYTE y1,CARD x2,BYTE y2)
BYTE y,xf,yf,j
CARD x,i
INT a,b,t,dx,dy
Dot(x1,y1):Dot(x2,y2)    
IF x2>x1 THEN dx=x2-x1:xf=0
ELSE dx=x1-x2:xf=1 FI
IF y2>y1 THEN dy=y2-y1:yf=0
ELSE dy=y1-y2:yf=1 FI
IF dx<2 AND dy<2 THEN RETURN FI
x=x1:y=y1
IF dx>dy THEN a=dy+dy:t=a-dx:b=t-dx
  FOR i=2 TO dx DO 
    IF xf=0 THEN x==+1 ELSE x==-1 FI
    IF t<0 THEN t==+a
    ELSE t==+b
      IF yf=0 THEN y==+1 ELSE y==-1 FI
    FI Dot(x,y)
  OD
ELSE a=dx+dx:t=a-dy:b=t-dy
  FOR j=2 TO dy DO
    IF yf=0 THEN y==+1 ELSE y==-1 FI
    IF t<0 THEN t==+a
    ELSE t==+b
      IF xf=0 THEN x==+1 ELSE x==-1 FI
    FI Dot(x,y)
  OD 
FI
RETURN

PROC Gr8()
BYTE bor=710,i
CARD sa=88
Graphics(8):bor=18:adrow(0)=sa
FOR i=1 TO 159 DO
  adrow(i)=adrow(i-1)+40
OD
RETURN
;------------------------------------
; Variant of SPLASH
;
MODULE
BYTE c1=709,c2=710,bor=712,cur=752
  ,key=764,trow=656,tcol=657,y,s
CARD x

PROC Setup()
Gr8():c2=0:c1=14:cur=1:x=120:y=60:s=7
bor=16*Rand(16)+2
PrintE("���Ү���������ӠР̠��ӠȠ���������")
PrintE("CENTER 120 , 60   STEP 7 ")
PrintE("     [joystick]      [S] ")
RETURN

PROC Splash()
CARD i
bor=16*Rand(16)+2
FOR i=0 TO 319 STEP s DO
  BLine(x,y,i,0):BLine(x,y,i,159)
OD
FOR i=0 TO 159 STEP s DO
  BLine(x,y,0,i):BLine(x,y,319,i)
OD
RETURN

PROC IncStep()
s==+1:bor=16*Rand(16)+2
IF s>16 THEN s=1 FI
trow=1:tcol=25:PrintB(s):Print(" ")
RETURN

PROC Joystick()
BYTE st
trow=3:tcol=2
Print("[trigger] - SPLASH       ")
DO trow=1:tcol=9:st=Stick(0)
  PrintC(x):Print(" , "):PrintB(y):Print("  ")
  WHILE Stick(0)=15 DO
    IF Strig(0)=0 THEN RETURN FI
    IF key<255 THEN key=255:IncStep() FI
  OD st=Stick(0)
  IF st=7 AND x<319 THEN x==+1
  ELSEIF st=11 AND x>0 THEN x==-1
  ELSEIF st=13 AND y<159 THEN y==+1
  ELSEIF st=14 AND y>0 THEN y==-1
  FI
OD
RETURN

PROC Main()
DO key=255:Setup()
  DO Joystick():Splash()
    trow=3:tcol=2
    Print("[A]-Another     [C]-Clear")
    WHILE key=255 DO OD
      IF key=18 THEN EXIT FI
    key=255
  OD
OD
RETURN


Back to previous page