[comp.sys.apollo] WANTED: Apollo melting screen program

trainor@lanai.cs.ucla.edu (Vulture of Light) (02/19/88)

Does anyone have that neat little program that melts the Apollo display?
It might've been written in assembler or something, but I'm interested
in having a copy.

    douglas

[][] trainor@cs.ucla.edu
[][] ...!{ihnp4,randvax,sch-loki,ucbvax}!ucla-cs!trainor

coy@ssc-vax.UUCP (Stephen B Coy) (02/23/88)

Ok, here's what I've done.  Various interesting effects can be
created by controlling the direction of the blit in some manner.
Also, playing with the bitplane mask produces some nice results on
colorful displays.  Have fun.

Stephen Coy 
uw-beaver!ssc-vax!coy

/***********************************************************\
*                                                           *
*       melt                                                *
*                                                           *
*       Copyright 1987 by Stephen Coy                       *
*                                                           *
*       This code may be distributed provided that no       *
*       money is charged for it and source code is          *
*       included with any object.                           *
*                                                           *
\***********************************************************/

#nolist
#include "/sys/ins/base.ins.c"
#include "/sys/ins/gpr.ins.c"

#define rnd()   (rand()/2)
#define DELTA   1
#define RANGE   (DELTA*2+1)

gpr_$offset_t           init_bitmap_size = {1280, 1024};
gpr_$bitmap_desc_t      init_bitmap;
gpr_$display_mode_t     mode = gpr_$borrow_nc;
gpr_$plane_t            hi_plane_id = 7;
gpr_$offset_t           size;
status_$t               status;

main()
{               
    init();
    disolve();
}

init()
{                    
    gpr_$init(mode,
            (short)1,
            init_bitmap_size,
            hi_plane_id,
            init_bitmap,
            status);
    gpr_$inq_bitmap(init_bitmap, status);
}
                       
disolve()
{                    
    register int    x, y;
    int             max_x, max_y;
    gpr_$window_t   window;
    gpr_$position_t dest;                

    gpr_$inq_bitmap_dimensions(init_bitmap,   
                         size,
                         hi_plane_id,
                         status);
    max_x = size.x_size;
    max_y = size.y_size;

    for(;;) {         
        x = rnd()%(max_x-RANGE) + RANGE;
        y = rnd()%(max_y-RANGE) + RANGE;  
        window.window_size.x_size  = x;
        window.window_size.y_size  = y;
        x = max_x - x;
        y = max_y - y;
        x = rnd() % x;
        y = rnd() % y;
        window.window_base.x_coord = x;
        window.window_base.y_coord = y;
        dest.x_coord = (rnd() % RANGE - DELTA) + x;
        dest.y_coord = (rnd() % RANGE - DELTA) + y;

        gpr_$pixel_blt(init_bitmap,
                       window,
                       dest,
                       status);
    }
}
  
  

nazgul@apollo.uucp (Kee Hinckley) (02/28/88)

In article <1695@ssc-vax.UUCP> coy@ssc-vax.UUCP (Stephen B Coy) writes:

Here's the original (well, almost, I changed it to do a triangle down
instead of a line).  It was written by John Francis at Apollo after I
suggested it as a hack that I figured he couldn't ignore.  You'll need
to add a random() routine for it, the original was in assembler, and it
should also check the screen size - it was written before that routine
was available.




Program Melter;
%Nolist;
%Include '/sys/ins/base.ins.pas';
%Include '/sys/ins/gpr.ins.pas';
%List;

PROCEDURE RanSet;EXTERN;
FUNCTION  Random (IN scale : integer) : integer;VAL_PARAM;EXTERN;

VAR
    Status  : Status_$t;
    Bitmap  : gpr_$bitmap_desc_t;
    Window  : gpr_$window_t := [[0,0],[1024,1024]];
    Origin  : gpr_$position_t;
    Cycle   : Integer;
    Count   : Integer;
    N_Rows  : Integer;
    N_Cols  : Integer;
    M_Col   : Integer;
    Tri     : gpr_$triangle_t;

BEGIN
Ranset;
gpr_$init(gpr_$borrow_nc,1,Window.Window_Size,7,Bitmap,Status);
gpr_$inq_bitmap_dimensions(Bitmap,Window.Window_Size,Count,Status);
N_Rows := Window.Window_Size.Y_Size;
N_Cols := Window.Window_Size.X_Size;
gpr_$set_draw_value(0, Status);
gpr_$set_fill_value(0, Status);

M_Col := N_Cols DIV 2;
Tri.P1.X_Coord := 0;
Tri.P1.Y_Coord := 0;
Tri.P2.X_Coord := M_Col;
Tri.P3.X_Coord := N_Cols-1;
Tri.P3.Y_Coord := 0;

FOR Cycle := 0 TO N_Rows-1 DO
    BEGIN
    Tri.P2.Y_Coord := Cycle;
    gpr_$triangle(Tri.P1, Tri.P2, Tri.P3, Status);
    FOR Count := 1 TO 20 DO
        BEGIN
        Origin.X_Coord := Random(5) - 2;
        Origin.Y_Coord := Random(4) + 1;
        Window.Window_Base.X_Coord := Random(N_Cols);
        Window.Window_Base.Y_Coord := N_Rows - Cycle - Origin.Y_Coord;
        IF Window.Window_Base.Y_Coord <= 0 THEN NEXT;
        Window.Window_Base.Y_Coord := Cycle + Random(Random(Random(Window.Window_Base.Y_Coord)+1)+1);
        Origin.X_Coord :=  Origin.X_Coord + Window.Window_Base.X_Coord;
        Origin.Y_Coord :=  Origin.Y_Coord + Window.Window_Base.Y_Coord;
        IF (Origin.X_Coord < 0) THEN Origin.X_Coord := 0
        ELSE IF (Origin.X_Coord >= N_Cols) THEN Origin.X_Coord := N_Cols - Random(5) - 1;
        Window.Window_Size.X_Size := Random(N_Cols - Origin.X_Coord)-1;
        Window.Window_Size.Y_Size := Random(N_Rows - Origin.Y_Coord)-1;
        gpr_$pixel_blt(Bitmap,Window,Origin,Status);
        END;
    END;
END.
-- 
### {mit-erl,yale,uw-beaver}!apollo!nazgul ###   (Apple ][e ProLine BBS)    ###
###      apollo!nazgul@eddie.mit.edu       ###    nazgul@pro-angmar.uucp    ###
###           nazgul@apollo.uucp           ### (617) 641-3722 300/1200/2400 ###
I'm not sure which upsets me more; that people are so unwilling to accept       responsibility for their own actions, or that they are so eager to regulate     everyone else's.