Add files via upload

This commit is contained in:
Antoine Vignau 2020-06-08 22:52:15 +02:00 committed by GitHub
parent 256399c2d2
commit 2816592d97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 1781 additions and 0 deletions

View File

@ -0,0 +1,30 @@
# Twilight II Spirographics UNIX MakeFile
# by Jim Maricondo
# v1.0 - 11/30/92 3:08pm
# v1.0.1 - 12/23/92 5:55pm
# v1.0.2 - 1/2/93 2:25pm
# v1.0.3 - 1/9/93 1:19am
# First deal with all the dfork...
spiro.d.root: spiro.cc spiro.h 22/t2.h
compile +w spiro.cc keep=spiro.d
spiro.d: spiro.d.root 22/random3.c.root
link +w spiro.d 22:random3.c keep=spiro.d
# Now work with the rfork...
spiro.r: spiro.rez 22/t2common.rez
compile spiro.rez keep=spiro.r
# Now put it together.
# filetype spiro $bc $4004
spirographics: spiro.r spiro.d
duplicate -d spiro.d spirographics
duplicate -r spiro.r spirographics
setfile -at $4004 -t $bc spirographics -m .
cp spirographics :jim1:system:cdevs:twilight:spirographics
22:beep

View File

@ -0,0 +1,563 @@
/*
* SPIROGRAPHICS!
*
* An all new Twilight II module! (G2MF version.)
* By Jim Maricondo, August 10-11, 1992. Copyright 1992, All rights reserved.
*
* implement: varying scales?
*
* This is an improved C version of the following BASIC program:
*
PI = 3.14159
C = COS (PI / 3) : S = SIN (PI / 3)
C1 = COS (PI / 36) : S1 = SIN (PI / 36)
SF = .95 : X = 95 : Y = 0 : CX = 140 : CY = 96 : SC = 1.16 : HGR2 : HCOLOR= 3
FOR J = 1 TO 40
FOR I = 0 TO 6
SX = X * SC + CX : SY = CY + Y
IF I = 0 THEN HPLOT SX,SY
HPLOT TO SX,SY
XN = X * C - Y * S : Y = X * S + Y * C : X = XN : NEXT I
XN = SF * (X * C1 - Y * S1) : Y = SF * (X * S1 + Y * C1) : X = XN : NEXT J
*
* v1.0a1 - 10-11 August 1992 - JRM:
* = initial version
* - 27 September 1992 - JRM
* - 1, 6 October 1992 - JRM
* - 30 November 1992 - JRM:
* = new random routines used
* v1.0a2 - 23 December 92 - JRM:
* = updated for new LoadConfigResource proc
* = cleaned up code a LOT
* v1.0b1 - 23 December 92 - JRM:
* = repositioned setup controls (yech)
* = the options now work! (before they were ignored)
*
*/
#pragma keep "spiro.d"
#pragma optimize -1
#pragma cdev Spirographics
#include "spiro.h"
#pragma lint -1
/* Strings */
char toT2String[]=toT2Str;
char ImageDelayStr[]="\pSpiro: ImageDelay";
char SmallPenStr[]="\pSpiro: SmallPen";
/* Prototypes */
unsigned int draw_spirographic(extended, extended, int, int);
extern int random(void);
extern void set_random_seed(void);
extern void init_random(char *);
LongWord MakeT2Message(void);
void LoadSetupT2Message(void);
void SaveConfigResource(char *, word);
word LoadConfigResource(char *, word);
LongWord HitT2Message(LongWord);
LongWord BlankT2Message(void);
void SaveT2Message(void);
/* Global Variables */
Word *movePtr;
Word ImageDelay; /* Image delay */
Word SmallPen; /* Force small pen size? */
Word SetupFileNumber;
GrafPortPtr SetupWindow;
/*------ SPIROGRAPHICS main drawing control routine ------*/
LongWord BlankT2Message (void) {
extended vertex_angle, rotation_angle;
unsigned int shapes, sides;
Word startSane, MyID;
Long TargetTick;
struct startupToolsOut spiroToolsOut;
Ptr spiroToolsOutP = (Ptr) &spiroToolsOut;
/*
asm {
brk 0x00;
}*/
MyID = MMStartUp();
startSane = SANEStatus();
if (!startSane) {
SendRequest(t2StartupTools, stopAfterOne+sendToName, (long) toT2String,
(long) (((long) MyID<<16) + startshut_sane),
(Ptr) spiroToolsOutP);
if (spiroToolsOut.errors)
return (LongWord) NULL;
}
SetPenMode(modeCopy);
SetSolidPenPat(-1);
SetPenSize(1,1);
init_random(toT2String);
/*
* vertex_angle and rotation_angle can be any number in the range 1 thru 359
* repetitions should be between 10-45
* sides should be between 1-40
* the fewer sides, the fewer repetitions should be executed <- unimplemented
*/
while (!(*movePtr)) {
vertex_angle = (int) (random() & 31); /*32(cur),<<23>>,25,35,45,60*/
rotation_angle = (int) (random() % 38); /*40,50,70,80*/
shapes = (random() & 31) + 14; /*31-45(cur),35-45,25-47,30-45,30-50*/
sides = (random() & 15); /*16(cur),18,25,40*/
if (vertex_angle > 23)
vertex_angle = 0;
/*
* Now the variables have whole numbers. This is acceptable, but it will
* prevent us from seeing many unique shapes (like a triangle, where
* vertex_angle must be ~ 1.5) that only can be generated with radians with
* decimals. So give both randomized radian measures decimals, by adding
* a random number between 0 and 1.
*/
vertex_angle += ((unsigned int) random() / 65534.9);
rotation_angle += ((unsigned int) random() / 65534.9);
if (draw_spirographic(vertex_angle, rotation_angle, shapes, sides))
break;
TargetTick = GetTick () + (ImageDelay * 60);
while ((!(*movePtr)) && (GetTick () < TargetTick));
if (*movePtr)
break;
ClearScreen(0);
}
if (!startSane)
SendRequest(t2ShutdownTools, stopAfterOne+sendToName, (long) toT2String,
(long) startshut_sane,
(long) NULL);
/* No error occurred, so return a NULL handle */
return (LongWord) NULL;
}
/*------ SPIROGRAPHICS main figure drawing routine ------*/
unsigned int draw_spirographic(extended side_vertex_angle,
extended shape_rotation_angle, int shape_repetitions,
int shape_sides)
{
int i, j;
unsigned int new_color, w, h;
extended side_cosine, side_sine;
extended shape_cosine, shape_sine;
extended next_x;
int screen_x, screen_y;
extended x = 95;
extended y = 0;
extended scale_factor = 0.95;
/* No input parameters can be zero! */
if (!side_vertex_angle || !shape_repetitions || !shape_rotation_angle ||
!shape_sides)
return(FALSE);
/* Get a new color and stuff it manually into the proper palette entries */
new_color = random();
asm
{
lda new_color;
and #0x0FFF
sta >0xE19E02
sta >0xE19E04
sta >0xE19E06
sta >0xE19E0A
sta >0xE19E0C
sta >0xE19E0E
sta >0xE19E12
sta >0xE19E14
sta >0xE19E16
sta >0xE19E1A
sta >0xE19E1C
sta >0xE19E1E
lda #0 /* background color */
sta >0xE19E08
sta >0xE19E18
}
/* Randomize a new pen size */
switch (random() % 9) {
case 0:
w = 1; h = 4; /* "X" 1 (.5) long, 4 high */
break;
case 1:
w = 8; h = 1; /* "----" 8 (4) long, 1 high */
break;
case 2:
w = 4; h = 2; /* "==" 4 (2) long, 2 high */
break;
case 3:
w = 8; h = 2; /* "====" 8 (4) long, 2 high */
break;
case 4:
w = 4; h = 4; /* "XX" 4 (2) long, 4 high */
break;
case 5:
w = 4; h = 1; /* "--" 4 (2) long, 1 high */
break;
case 6:
case 7:
w = 1; h = 1; /* "." 1 (.5) long, 1 high */
break;
case 8:
w = 1; h = 2; /* ":" 1 (.5) long, 2 high */
break;
case 9:
w = 2; h = 1; /* "'" 2 (1) long, 1 high */
break;
}
if (!SmallPen)
SetPenSize(w,h);
/*
* The matrix of the rotation transformation is: | cos(TH) sin(TH) 0 |
* R = | -sin(TH) cos(TH) 0 |
* | 0 0 1 |.
* At each stage of calculation, we obtain the coordinates (XN, YN) of the
* next vertex from the coordinates of the current vertex by
* (XN, YN, 1) = (X, Y, 1)R, so that:
* XN = X*cos(TH) - Y*sin(TH)
* YN = X*sin(TH) + Y*cos(TH).
* For speed reasons, calculate sine and cosine only once here at the beginning,
* identifying cosine = cos(60dg) and sine = sin(60dg) so we can use them later.
* NOTE: 60 degrees is just for a hexagon figure (360/6).
* NOTE: side_vertex_angle must be 3 for a hexagon. This is because
* 60 degrees = PI/3 radians.
* --> degrees = radians*180/PI
* --> radians = degrees*PI/180
* (Each exterior angle of a hexagon is 60 degrees. (360 degrees / 6 sides).)
* To create an image of X sided figures rotating and being scaled smaller,
* set the side_vertex_angle to the radian measure of each exterior angle of
* the regular polygon you hope to reproduce. (360/number of sides (X) will
* give you the measure of each exterior angle).
* As an example, a real nice pattern can be created using regular hexagons
* (vertex_angle = 360/6 = 60 degrees = PI/3 radians) and a rotation_angle of
* 5 degrees (PI/36 radians).
* By this same token, to make a triangle, vertex_angle would have to be 1.5,
* for a true vertex angle of PI/1.5 radians, or 120 degrees.
*/
side_cosine = cos(PI / side_vertex_angle);
side_sine = sin(PI / side_vertex_angle);
shape_cosine = cos(PI / shape_rotation_angle);
shape_sine = sin(PI / shape_rotation_angle);
for (j = 1; j <= shape_repetitions; j++) {
if (*movePtr)
return(TRUE);
for (i = 0; i <= shape_sides; i++) {
if (*movePtr)
return(TRUE);
/*
* For each side, before plotting, translate to onscreen locations:
* Scale the points to make a 1:1 aspect ratio, and then adjust them so that
* they are centered on screen.
* Translate each point through (CENTER_X, CENTER_Y) by multiplication by the
* matrix: | 1 0 0 | CX = CENTER_X
* | 0 1 0 | CY = CENTER_Y
* | CX CY 1 |. */
screen_x = (int) (x*SCALE_X + CENTER_X);
screen_y = (int) (y + CENTER_Y);
if (!i)
MoveTo(screen_x, screen_y);
LineTo(screen_x, screen_y);
/*
* Since we have already precalculated the rotation sines and cosines, the
* calculation of the X and Y coordinates for the next vertex (XN, YN) becomes:
* XN = X*cosine - Y*sine
* YN = X*sine + Y*cosine. */
next_x = x*side_cosine - y*side_sine;
y = x*side_sine + y*side_cosine;
x = next_x;
}
/*
* Now we need to make the next figure (hexagon) smaller than the previous one.
* The size of the figures (hexagons) may be controlled by multiplication by the
* matrix: |SF 0 0| SF = scale_factor of our choice.
* |0 SF 0|
* |0 0 1|.
* To rotate each figure (hexagon) slightly, e agan will use the transformation
* matrix with a new value for theta.
* The transition from one hexagon to the next (scaling, rotation) is effected
* by: |SF 0 0||cos(TH) sin(TH) 0|
* (XN,YN,1) = (X,Y,1)|0 SF 0||-sin(TH) cos(TH) 0|
* |0 0 1|| 0 0 1|
* or:
* XN = X*SF*cos(TH) - Y*SF*sin(TH)
* YN = X*SF*sin(TH) + Y*SF*cos(TH) */
next_x = scale_factor * (x*shape_cosine - y*shape_sine);
y = scale_factor * (x*shape_sine + y*shape_cosine);
x = next_x;
}
return(FALSE);
}
/*****************************************************************************\
|* SaveConfigResource-
|* This function takes a word value and saves it as a rT2ModuleWord
|* resource in the Twilight.Setup file. The value is saved and a *|
|* name is added. Any previous rT2ModuleWord with the same name is
|* first removed before the new value is added.
\*****************************************************************************/
void SaveConfigResource (char *Name, Word SaveValue) {
Word FileID;
Long ResourceID;
Word **ConfigData;
/* Check to see if the named resource already exists */
ResourceID = RMFindNamedResource (rT2ModuleWord, Name, &FileID);
if (!toolerror ())
{
char NullString = '\x000';
/* The resource already exists, so first remove the name from */
/* the resource, then remove the resource itself */
RMSetResourceName (rT2ModuleWord, ResourceID, &NullString);
RemoveResource (rT2ModuleWord, ResourceID);
}
/* Create new handle for the future resource */
ConfigData =
(Word **) NewHandle (sizeof (Word), GetCurResourceApp(), attrLocked, 0L);
**ConfigData = SaveValue;
/* Find a new ID for the resource and add it */
ResourceID = UniqueResourceID (0, rT2ModuleWord);
AddResource ((handle) ConfigData, 0, rT2ModuleWord, ResourceID);
if (toolerror ())
DisposeHandle ((handle) ConfigData);
else
{
/* Set the name of the resource if it was added correctly */
RMSetResourceName (rT2ModuleWord, ResourceID, Name);
UpdateResourceFile (SetupFileNumber);
}
}
/*****************************************************************************\
|* LoadConfigResource- *|
|* This function attempts to load a named rT2ModuleWord resource. If *|
|* the resource exists, the value of the rT2ModuleWord resource is *|
|* returned, otherwise a default value is returned. *|
\*****************************************************************************/
Word LoadConfigResource (char *Name, Word DefaultValue) {
Word Result, fileID;
Long rID;
Handle ConfigData;
/**************************************/
/* Attempt to load the named resource */
/**************************************/
rID = RMFindNamedResource((Word) rT2ModuleWord, (Ptr) Name, &fileID);
ConfigData = LoadResource((Word) rT2ModuleWord, rID);
if (toolerror ())
Result = DefaultValue; /* Resource does not exist, so return the default value */
else {
HLock(ConfigData); /* Resource exists, return the rT2Module word value */
Result = **(word **)ConfigData;
HUnlock(ConfigData);
ReleaseResource(3, (Word) rT2ModuleWord, rID);
}
return Result;
}
/*****************************************************************************\
|* LoadSetupT2Message- *|
|* This function loads in the messages configuration data. *|
\*****************************************************************************/
void LoadSetupT2Message(void) {
ImageDelay = LoadConfigResource (ImageDelayStr, 7u);
SmallPen = LoadConfigResource (SmallPenStr, FALSE);
}
/*****************************************************************************\
|* MakeT2Message- *|
|* This function creates the controls for the messages setup window *|
|* and sets the value of the controls the the current setup. *|
\*****************************************************************************/
LongWord MakeT2Message(void) {
int i;
Word FileNumber;
pointer *extraInfoH;
handle df_rez_ctlH;
handle df_ctlH;
/* Save current resource file and switch in Twilight.Setup */
FileNumber = GetCurResourceFile ();
SetCurResourceFile (SetupFileNumber);
/* Make absolutely sure that the messages configuration data is loaded */
LoadSetupT2Message ();
/* Restore old resource file */
SetCurResourceFile (FileNumber);
/* Create setup controls and set their states to match current setup */
NewControl2 (SetupWindow, resourceToResource, MainControlList);
df_rez_ctlH = LoadResource (rControlTemplate, imageDelayCtl_rID);
extraInfoH = (pointer *) GetWRefCon( (GrafPortPtr) SetupWindow);
(long) (*df_rez_ctlH)[14] = (long) *extraInfoH;
df_ctlH = (handle) NewControl2((WindowPtr) SetupWindow, singlePtr, (long) *df_rez_ctlH);
ReleaseResource (3, rControlTemplate, imageDelayCtl_rID);
MakeThisCtlTarget ((CtlRecHndl) df_ctlH);
CallCtlDefProc ((CtlRecHndl) df_ctlH, (word) SetFieldValue, (((long)ImageDelay<<16)+34ul));
SetCtlValue (SmallPen, GetCtlHandleFromID (SetupWindow, forceSmallPenCtl));
/* Return the number of the last control */
return LastCtl;
}
/*****************************************************************************\
|* HitT2Message-
|* This function checks to see which control has been hit, and if a
|* control that requires the "Update" button has been hit, the
|* EnableFlag is set to true.
\*****************************************************************************/
LongWord HitT2Message (LongWord ControlHit) {
/* LongWord EnableFlag = 0L;*/
if ((ControlHit == imageDelayCtl) || (ControlHit == forceSmallPenCtl))
return 1L;
/* EnableFlag = 1L;*/
else
return 0L;
/* Return the update button enable flag */
/* return EnableFlag;*/
}
/*****************************************************************************\
|* SaveT2Message-
|* This function saves the values of all setup controls.
\*****************************************************************************/
void SaveT2Message (void) {
Word FileNumber;
/* Save current resource file and switch in Twilight.Setup */
FileNumber = GetCurResourceFile ();
SetCurResourceFile (SetupFileNumber);
/* Save control values */
ImageDelay = (unsigned int) CallCtlDefProc (GetCtlHandleFromID (SetupWindow,
imageDelayCtl), GetFieldValue, 34ul);
SaveConfigResource (ImageDelayStr, ImageDelay);
SmallPen = GetCtlValue (GetCtlHandleFromID (SetupWindow, forceSmallPenCtl));
SaveConfigResource (SmallPenStr, SmallPen);
/* Restore old resource file */
SetCurResourceFile (FileNumber);
}
/*****************************************************************************\
|* Spirographics-
|* This function checks the Twilight II message parameter and *|
|* dispatches control to the appropriate message handler. *|
\*****************************************************************************/
LongWord Spirographics (LongWord data2, LongWord data1, Word message) {
LongWord Result = 1L;
switch (message)
{
case MakeT2:
/* Save pointer to setup window and resource file number of Twilight.Setup */
SetupWindow = (GrafPortPtr) data1;
SetupFileNumber = (Word) data2;
/* Create the setup controls */
Result = MakeT2Message();
break;
case SaveT2:
SaveT2Message();
break;
case BlankT2:
movePtr=(Word *) data1;
Result = BlankT2Message();
break;
case LoadSetupT2:
LoadSetupT2Message();
case UnloadSetupT2:
case KillT2:
break;
case HitT2:
Result = HitT2Message(data2);
break;
}
return Result;
}

View File

@ -0,0 +1,46 @@
#include <types.h>
#include <quickdraw.h>
#include <orca.h>
#include <math.h>
#include <memory.h>
#include <sane.h>
#include <control.h>
#include <quickdraw.h>
#include <resources.h>
#include <window.h>
#include <locator.h>
#include <misctool.h>
#include "22:t2.h"
#define MAX_X 640
#define MAX_Y 200
#define CENTER_Y MAX_Y/2
#define CENTER_X MAX_X/2
/* Aspect ratio = 1.27 for 320 mode for standard displays
2.54 for 640 mode for standard displays
2.10 for 640 mode for Jim's condensed-type display */
#define SCALE_X 2.10
#define PI 3.141592653589793
/* resource IDs */
#define imageDelayCtl_rID 1L
#define forceSmallPenCtl_rID 2L
#define imageDelayStatTextCtl_rID 3L
#define spiroOptsStatTextCtl_rID 4L
#define iconCtl_rID 5L
#define MainControlList 1L
/* Control IDs */
#define forceSmallPenCtl 1L
#define imageDelayTxtCtl 2L
#define iconCtl 3L
#define imageDelayCtl 4L
#define LastCtl imageDelayCtl

View File

@ -0,0 +1,226 @@
#include "types.rez"
#include "22:T2Common.Rez"
// --- type rDataList ($1986) defines
#define imageDelayDataList 1
// --- type rTaggedStrings ($802E) defines
#define field1Strings 1
// --- type $8003 defines
#define spiroCtlLst 1
// --- type $8004 defines
#define imageDelayCtl 1
#define forceSmallPenCtl 2
#define imageDelayStatTextCtl 3
#define spiroOptsStatTextCtl 4
#define iconCtl 5
// --- type $8006 defines
#define forceSmallPen_pstr 2
#define spiroOpts_pstr 3
// --- type $800B defines
#define imageDelay_LText 1
// --- custom resource type defines
resource rT2ModuleFlags (moduleFlags) {
fSetup +
fFadeOut +
fFadeIn +
fLeavesUsableScreen +
fGrafPort640, // module flags
$01, // enabled flag (unimplemented)
$0110, // minimum T2 version required
NIL, // reserved
"Spirographics" // module name
};
// --- Icon Definitions
resource rIcon (moduleIcon) {
$8000, // kind
$0014, // height
$0016, // width
$"F00000000000000000000F"
$"0FFFFFFFFFFFFFFFFFFFF0"
$"0F0000000EEE00000000F0"
$"0F000000E000E0000000F0"
$"0F00000E00E00E000000F0"
$"0F0000E00E0E0E0D0000F0"
$"0F0000E0E00B0E0E0000F0"
$"0F0000E0E0000E0E0000F0"
$"0F0000E00E00E00E0000F0"
$"0F00000E00EE00E00000F0"
$"0F000000E0000E000000F0"
$"0F0000000EEEE0000000F0"
$"0FFFFFFFFFFFFFFFFAFFF0"
$"0000000000000000000000"
$"F0FFFFFFFFFFFFFFFFFF0F"
$"F0FFFFFFFFFFFFFFFFFF0F"
$"F0FF4AFFFFFFFFFFFFFF0F"
$"F0CCCCCCCCCCCCCCCCCC0F"
$"F0FFFFFFFFFFFFFFFAFF0F"
$"F00000000000000000000F",
$"0FFFFFFFFFFFFFFFFFFFF0"
$"FFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFF"
$"0FFFFFFFFFFFFFFFFFFFF0"
$"0FFFFFFFFFFFFFFFFFFFF0"
$"0FFFFFFFFFFFFFFFFFFFF0"
$"0FFFFFFFFFFFFFFFFFFFF0"
$"0FFFFFFFFFFFFFFFFFFFF0"
$"0FFFFFFFFFFFFFFFFFFFF0";
};
// --- Control List Definitions
resource rControlList (spiroCtlLst) {
{
iconCtl, // control 3
imageDelayStatTextCtl, // control 5
forceSmallPenCtl, // control 6
};
};
// --- Control Templates
resource rControlTemplate (forceSmallPenCtl) {
1, // ID
{ 92, 14,101,232}, // rect
checkControl {{
$0000, // flag
$3002, // moreFlags
$00000000, // refCon
forceSmallPen_pstr, // titleRef
$0000, // initialValue
0, // colorTableRef
{"F","f",$0100,$0100} // key equivalents
}};
};
resource rControlTemplate (imageDelayStatTextCtl) {
2, // ID
{ 77, 12, 87,249}, // rect
statTextControl {{
$0000, // flag
$1002, // moreFlags
$00000000, // refCon
imageDelay_LText // textRef
}};
};
resource rControlTemplate (iconCtl) {
3, // ID
{ 30, 58, 63,286}, // rect
iconButtonControl {{
$000C, // flag
$1022, // moreFlags
NIL, // refCon
moduleIcon, // iconRef
spiroOpts_pstr, // titleRef
NIL, // colorTableRef
$0000 // displayMode
}};
};
resource rControlTemplate (imageDelayCtl,locked) {
4, // control ID
{ 75,250, 88,302}, // rect - 306
dataFieldControl {{
ctlVisible, // flag
fCtlCanBeTarget+RefIsResource,
NIL, // refCon
imageDelayDataList, // dataListRef
{0,0,0,0,0,0,0,0} // fieldValues
}};
};
// --- rPString Templates
resource rPString (forceSmallPen_pstr) {
"Force Small Pen Size"
};
resource rPString (spiroOpts_pstr) {
"Spirographics Options"
};
// --- rTextForLETextBox2 Templates
resource rTextForLETextBox2 (imageDelay_LText) {
"Delay between images (seconds):"
};
resource rTextForLETextBox2 (moduleMessage) {
TBLeftJust
TBBackColor TBColorF
TBForeColor TBColor4
"Spirographics"
TBForeColor TBColor1
" generates intriguing progressive geometric "
"figures randomly on the screen.\nWho said geometry was boring?"
};
// --- datafield stuff
/* This structure describes the relative locations and strings associated with
each data field. Since there may be from 1 to 8 data fields in each control,
these location/string reference pairs repeat for each field. */
resource rDataList (imageDelayDataList, nospecialmemory,nocrossbank) {
{
{2,6}, // relative location of this field
field1Strings // reference to this field's string list
};
};
/* These are the tagged strings that are associated with each field in the
control. The tag value that is specified is used to track the current value
of each field. If you wish only to have a list of integers displayed, simply
provide the tag values and null (empty) strings as in the second field. */
resource rTaggedStrings (field1Strings) {
{
0,"0",
1,"1",
2,"2",
3,"3",
4,"4",
5,"5",
6,"6",
7,"7",
8,"8",
9,"9",
10,"10",
15,"15",
20,"20",
25,"25",
30,"30",
45,"45",
60,"60",
120,"120"
};
};
// --- rVersion Templates
resource rVersion (moduleVersion) {
{1,0,0,release,0}, // Version
verUS, // US Version
"T2 Spirographics Module", // program's name
"By Jim Maricondo.\n"
"Copyright 1992-93, Jim Maricondo." // copyright notice
};

Binary file not shown.

View File

@ -0,0 +1,14 @@
nol ;turn listing off (NO List)
ovr ;always assemble
asm Static2
lnk Static.l
typ EXE
sav static.d
* cmd auxtype */system/cdevs/twilight/Static,$4004
* cmd =2/twilight/rSoundBrowser

View File

@ -0,0 +1,125 @@
PULLLONG MAC
DO ]0
PullWord ]1
PullWord ]1+2
ELSE
PullWord
PullWord
FIN
<<<
PULLWORD MAC
PLA
DO ]0
STA ]1
FIN
IF MX/2
PLA
DO ]0
STA ]1+1
FIN
FIN
<<<
^NEWHANDLE MAC
P2SL ]1
PxW ]2;]3
PHL ]4
Tool $902
<<<
_SOUNDSTARTUP MAC
Tool $208
<<<
^SOUNDTOOLSTATUS MAC
PHA
Tool $608
<<<
^WRITERAMBLOCK MAC
PHL ]1
PxW ]2;]3
Tool $908
<<<
^GETSOUNDVOLUME MAC
P1SW ]1
Tool $C08
<<<
^SETSOUNDVOLUME MAC
PxW ]1;]2
Tool $D08
<<<
PXW MAC
DO ]0/1
PHW ]1
DO ]0/2
PHW ]2
DO ]0/3
PHW ]3
DO ]0/4
PHW ]4
FIN
FIN
FIN
FIN
<<<
P2SL MAC
PHA
PHA
IF #=]1
PEA ^]1
ELSE
PHW ]1+2
FIN
PHW ]1
<<<
PHL MAC
IF #=]1
PEA ^]1
ELSE
PHW ]1+2
FIN
PHW ]1
<<<
P1SW MAC
PHA
IF #=]1
PEA ]1
ELSE
IF MX/2
LDA ]1+1
PHA
FIN
LDA ]1
PHA
FIN
<<<
PHW MAC
IF #=]1
PEA ]1
ELSE
IF MX/2
LDA ]1+1
PHA
FIN
LDA ]1
PHA
FIN
<<<
TOOL MAC
LDX #]1
JSL $E10000
<<<
^GETTICK MAC
PHS 2
Tool $2503
<<<
^SETALLSCBS MAC
PHW ]1
Tool $1404
<<<
PHS MAC
DO ]0
LUP ]1
PHA
--^
ELSE
PHA
FIN
<<<

View File

@ -0,0 +1,15 @@
# static makefile
# by Jim Maricondo
# v1.0 - 2/7/93 3:21pm - coded.
# v1.0.1 - 2/16/93 8:55pm - t2common.rez. (HB!??!)
static.r: static.rez 22/t2common.rez
compile static.rez keep=static.r
static: static.r static.d
duplicate -d static.d static
duplicate -r static.r static
setfile -at $4004 -t $bc static -m .
cp static *:system:cdevs:twilight:static
22:beep

View File

@ -0,0 +1,86 @@
#include "types.rez"
#include "22:t2common.rez"
resource rT2ModuleFlags (moduleFlags) {
fFadeIn +
fFadeOut, // module flags word
$01, // enabled flag (unimplemented)
$0110, // minimum T2 version required
NIL, // reserved
"Static" // module name
};
// --- Version resource
resource rVersion (moduleVersion) {
{1,0,1,release,0}, // Version
verUS, // US Version
"T2 Static Module", // program's name
"By Derek Young.\n" // copyright notice
"Copyr. 1992-93 DigiSoft Innovations."
};
// --- About icon resource
resource rIcon (moduleIcon) {
$8000, // kind
$0014, // height
$0016, // width
$"F00000000000000000000F"
$"0FFFFFFFFFFFFFFFFFFFF0"
$"0F000000000000000000F0"
$"0F030F0F3F0F0F330F00F0"
$"0F00F00F00303003F330F0"
$"0F0F03F033303F3030F0F0"
$"0F0300030F00F0303300F0"
$"0F0030F303330F303F30F0"
$"0F0F3F03F00F0303F0F0F0"
$"0F0300F00003F3030300F0"
$"0F00F330FF033F0FF030F0"
$"0F000000000000000000F0"
$"0FFFFFFFFFFFFFFFFAFFF0"
$"0000000000000000000000"
$"F0FFFFFFFFFFFFFFFFFF0F"
$"F0FFFFFFFFFFFFFFFFFF0F"
$"F0FF4AFFFFFFFFFFFFFF0F"
$"F0CCCCCCCCCCCCCCCCCC0F"
$"F0FFFFFFFFFFFFFFFAFF0F"
$"F00000000000000000000F",
$"0FFFFFFFFFFFFFFFFFFFF0"
$"FFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFF"
$"0FFFFFFFFFFFFFFFFFFFF0"
$"0FFFFFFFFFFFFFFFFFFFF0"
$"0FFFFFFFFFFFFFFFFFFFF0"
$"0FFFFFFFFFFFFFFFFFFFF0"
$"0FFFFFFFFFFFFFFFFFFFF0"
$"0FFFFFFFFFFFFFFFFFFFF0";
};
// --- rTextForLETextBox2 Templates
resource rTextForLETextBox2 (moduleMessage) {
TBFont TBShaston "\$00\$08"
TBLeftJust
TBBackColor TBColorF
TBForeColor TBColor1
TBStyleBold "Static"
TBForeColor TBColor0
TBStylePlain
" makes your monitor act like an old, broken television screen.\n"
"Better check the connection!"
};

View File

@ -0,0 +1,337 @@
*------------------------------------------------*
* *
* Static *
* A T2 blanker by Derek Young, DYA *
* Thanks to Dino for a neat idea *
* *
*------------------------------------------------*
lst off
xc
xc
mx %00
rel
use Static.macs
case IN
dum 0
MovePtr adrl 0
RezFileID da 0
MyID da 0
MemID da 0
modeMask da 0
colored da 0
oldvolume da 0
soundstatus da 0
temp adrl 0
dend
dum 1
Bank db 0 ;This is how the stack is set up
rtlAddr adr 0 ;with DP at the top and Result
T2data2 adrl 0 ;occupying the top four bytes
T2data1 adrl 0
T2Message da 0
T2Result adrl 0
T2StackSize adrl 0
dend
*-------------------------------------------------
* start of the blanker...
* this is a really simple blanker - no setup or
* anything else besides "T2Blank".
Start
phb
phk
plb
lda T2Message,s
cmp #2 ;must be BlankT2
beq :blank
brl Bye
:blank lda T2Data1,s
sta MovePtr ;save this in our own DP
lda T2Data1+2,s
sta MovePtr+2
lda T2Data2,s
sta RezFileID
lda T2Data2+2,s ;our memory ID
sta MyID
clc
adc #$100
sta MemID ;need a memory ID
*-------------------------------------------------
* The start of the program...
Blank
* This is all very easy - set the screen randomly to any values.
* Then set the scbs to point to random color tables. Then randomly
* fill the color tables with either white and black, or colors.
ldx #$200-2
lda #0
]loop stal $E19E00,x ;clear to start
dex
dex
bpl ]loop
* set up the paramaters
stz modeMask ;set to $8080 for "fine static" (640 mode)
* lda #1
* sta colored ;0=grey static, 1=colored static
lda #200
sta soundvolume ;volume of static sound
jsr Randomize ;get a random seed value to start
* make a random waveform to be the static sound loop
* the loop is one page long.
ldx #256-1
]loop jsr Random
sep $20
cmp #0
beq :again
sta wave,x
dex
:again rep $20
bpl ]loop
~SoundToolStatus
pla
sta soundstatus
bne :nosound
do 0
~NewHandle #$C115;MemID;#$8000;#0
PullLong temp
lda [temp]
pha
_SoundStartup ;start up the sound manager
fin
:nosound
ldx #$7D00-2
]loop jsr Random
stal $E12000,x ;fill pixel randomly
dex
dex
bpl ]loop
~GetTick
pla
sta tick+1
plx
bit #1
bne :1
~SetAllScbs #$00
bra :2
:1
ldx #200-2
]loop jsr Random
and #$0F0F ;do two at once
ora modeMask
stal $E19D00,x ;fill the scbs randomly
dex
dex
bpl ]loop
:2
tick lda #0
bit #%10
bne :3
lda #1
sta colored ;0=grey static, 1=colored static
bra :4
:3
stz colored
:4
* Now just keep filling the color palettes up with greys (or even colors)
lda soundstatus
bne :nosound2
do 0
~WriteRamBlock #wave;#0;#$100 ;copy the sound wave into sound ram
~GetSoundVolume #13 ;use generator 0 to play the sound
PullWord oldvolume
~SetSoundVolume soundvolume;#13
fin
* brk $02
* ~FFStartSound #0*256+0;#soundparms ;play the static
:nosound2
Static
lda [MovePtr] ;check for any movement
bne soundoff
lda colored ;does the user want colored static?
bne :colored
ldx #$200-2
]loop jsr Random
and #$F
asl
tay
lda Colors,y
stal $E19E00,x
dex
dex
bpl ]loop
bra Static
:colored ldx #$200-2
]loop jsr Random
and #$FFF
stal $E19E00,x
dex
dex
bpl ]loop
bra Static
soundoff
lda soundstatus
bne Bye
* brk $00
* ~FFStopSound #%00100000_00000000
* _SoundShutDown
Bye lda RTLaddr,s ;move up RTL address
sta T2data1+3,s
lda RTLaddr+1,s
sta T2data1+3+1,s
lda #0
sta T2Result,s
sta T2Result+2,s ;the result (nil for no error)
plb ;restore the bank
tsc ;remove the input parameters.
clc
adc #10
tcs
clc
rtl
Colors da $000,$111,$222,$333,$444,$555,$666,$777
da $888,$999,$AAA,$BBB,$CCC,$DDD,$EEE,$FFF
soundparms adrl wave ;pointer to wave
da 256 ;length of sound
da 100 ;frequency
da 00 ;DOC address
da 0 ;buffer size (1 page)
adrl 0 ;soundparms ;next sound
soundvolume da 0 ;volume
*------------------------------------------------*
* Random returns a random number in A *
* Randomize seeds the generator from the clock *
* *
* Adapted from the Merlin 16+ package *
*------------------------------------------------*
Random clc
phx
phy
ldx INDEXI
ldy INDEXJ
lda ARRAY-2,X
adc ARRAY-2,Y
sta ARRAY-2,X
dex
dex
bne :DY
ldx #17*2 ;Cycle index if at end of
:DY dey ; the array
dey
bne :SETIX
ldy #17*2
:SETIX stx INDEXI
sty INDEXJ
ply
plx
rts
INDEXI da 17*2 ;The relative positions of
INDEXJ da 5*2 ; these indexes is crucial
ARRAY da 1,1,2,3,5,8,13,21,54,75,129,204
da 323,527,850,1377,2227
Seed pha
ora #1 ;At least one must be odd
sta ARRAY
stx ARRAY+2
phx ;Push index regs on stack
phy
ldx #30
]LUP sta ARRAY+2,X
dex
dex
lda 1,S ;Was Y
sta ARRAY+2,X
dex
dex
lda 3,S ;Was X
sta ARRAY+2,X
lda 5,S ;Original A
dex
dex
bne ]LUP
lda #17*2
sta INDEXI ;Init proper indexes
lda #5*2 ; into array
sta INDEXJ
jsr Random ;Warm the generator up.
jsr Random
jsr Random
jsr Random
ply
plx
pla
rts
LineCounter = $E0C02E ;Vertical scanline counter
Randomize pha
pha
ldx #$2503
jsl $E10000
ply
pla
eor #'DY' ;mix X up a bit (it's not as random)
tax
ldal LineCounter
bra Seed
wave ds 256
sav Static.l

View File

@ -0,0 +1,18 @@
echo asml Strobe.asm keep=Strobe.d
asml Strobe.asm keep=Strobe.d
echo duplicate -d Strobe.d Strobe
duplicate -d Strobe.d Strobe
echo duplicate -r Strobe.r Strobe
duplicate -r Strobe.r Strobe
echo filetype Strobe $BC
filetype Strobe $BC
echo setfile Strobe -at $4004
setfile Strobe -at $4004
echo copy -c Strobe /jim1/system/cdevs/Twilight/Strobe
copy -c Strobe /jim1/system/cdevs/Twilight/Strobe

View File

@ -0,0 +1,95 @@
*-----------------------------------------------------------------------------*
! Twilight II Strobe Module. !
! !
! By Jim Maricondo and Jonah Stich. !
! !
! Copyright (c) 1991-1993 Jim Maricondo. All rights reserved. !
*-----------------------------------------------------------------------------*
mcopy strobe.mac
copy 22:t2common.equ
copy 22:dsdb.equ
copy 13:ainclude:e16.quickdraw
keep strobe.d
*-----------------------------------------------------------------------------*
movePtr gequ <0
*-----------------------------------------------------------------------------*
Strobe Start
kind $1000 ; no special memory
debug 'Strobe'
copy 22:dsdb.asm
phb
phd
phk
plb
lda T2Message,s
cmp #BlankT2 ;must be BlankT2
jne skip
PushLong #toT2String
jsl init_random
lda T2data1,s
sta movePtr
lda T2data1+2,s
sta movePtr+2
stz anchorDelayPt
GetNumber anop
jsl random
cmp #50 ;100
bge CheckQuit
cmp #40
blt stayBlack
lda #$0FFF
sta PALETTES
shortm
lda CLOCKCTL
and #$F0
ora #$0F
sta CLOCKCTL
longm
~WaitUntil anchorDelayPt,#960/24 ; delay 1/16 second
PullWord anchorDelayPt
bra CheckQuit
stayBlack anop
shortm
lda CLOCKCTL
and #$F0
sta CLOCKCTL
longm
lda #$0000
sta PALETTES
~WaitUntil anchorDelayPt,#960/24 ; delay 1/16 second
PullWord anchorDelayPt
CheckQuit lda [movePtr]
beq GetNumber
skip anop
pld
plb
lda 2,s
sta 2+10,s
lda 1,s
sta 1+10,s
tsc Remove input paramaters
clc
adc #10
tcs
clc
rtl
anchorDelayPt ds 2
toT2String str 'DYA~Twilight II~'
End
*-----------------------------------------------------------------------------*

View File

@ -0,0 +1,115 @@
MACRO
&lab pullword &SYSOPR
&lab ANOP
pla
AIF C:&SYSOPR=0,.end
sta &SYSOPR
.end
MEND
MACRO
&lab pushlong &addr,&offset
&lab ANOP
LCLC &C
LCLC &REST
&C AMID &addr,1,1
AIF "&C"="#",.immediate
AIF "&C"="[",.zeropage
AIF C:&offset=0,.nooffset
AIF "&offset"="s",.stack
pushword &addr+2,&offset
pushword &addr,&offset
MEXIT
.nooffset
pushword &addr+2
pushword &addr
MEXIT
.immediate
&REST AMID &addr,2,L:&addr-1
dc I1'$F4',I2'(&REST)|-16'
dc I1'$F4',I2'&REST'
MEXIT
.stack
pushword &addr+2,s
pushword &addr+2,s
MEXIT
.zeropage
ldy #&offset+2
pushword &addr,y
ldy #&offset
pushword &addr,y
MEND
MACRO
&lab pushword &SYSOPR
&lab ANOP
AIF C:&SYSOPR=0,.b
LCLC &C
&C AMID "&SYSOPR",1,1
AIF ("&C"="#").AND.(S:LONGA),.immediate
lda &SYSOPR
pha
MEXIT
.b
pha
MEXIT
.immediate
LCLC &REST
LCLA &BL
&BL ASEARCH "&SYSOPR"," ",1
AIF &BL>0,.a
&BL SETA L:&SYSOPR+1
.a
&REST AMID "&SYSOPR",2,&BL-2
dc I1'$F4',I2'&REST'
MEND
MACRO
&lab longm
&lab ANOP
rep #%00100000
longa on
MEND
MACRO
&lab shortm
&lab ANOP
sep #%00100000
longa off
MEND
MACRO
&LAB JNE &BP
&LAB BEQ *+5
BRL &BP
MEND
MACRO
&lab str &string
&lab dc i1'L:&string',C'&string'
MEND
macro
&lab ~WaitUntil &delayfrom,&delayamount
&lab WordResult
PushWord &delayfrom
PushWord &delayamount
Tool $3A03
mend
macro
&lab Tool &number
&lab ldx #&number
jsl $E10000
mend
macro
&lab WordResult &zero
&lab anop
aif c:&zeros=1,.zero
phd
mexit
.zero
&lab pea $0000
mend
MACRO
&lab Debug &string
aif t:debugSymbols="G",.begin
mexit
.begin
dc i1'$82'
dc i2'(L:&string)+3'
dc i2'$7771'
dc i1'L:&string',C'&string'
MEND

View File

@ -0,0 +1,27 @@
# Twilight II Strobe UNIX MakeFile
# by Jim Maricondo
# v1.0 - 1/2/93 5:48pm
# v1.0.1 - 1/9/93 1:19am
# First deal with all the dfork...
strobe.d.root: strobe.asm strobe.mac 22/t2common.equ 22/dsdb.equ
compile +w strobe.asm keep=strobe.d
strobe.d: strobe.d.root 22/random3.a.root
link +w strobe.d 22:random3.a keep=strobe.d
# Now work with the rfork...
strobe.r: strobe.rez 22/t2common.rez
compile strobe.rez keep=strobe.r
# Now put it together.
strobe: strobe.r strobe.d
duplicate -d strobe.d strobe
duplicate -r strobe.r strobe
setfile -at $4004 -t $bc strobe -m .
cp strobe :jim1:system:cdevs:twilight:strobe
22:beep

View File

@ -0,0 +1,84 @@
#include "types.rez"
#include "22:t2common.rez"
resource rT2ModuleFlags (moduleFlags) {
fFadeIn +
fFadeOut, // module flags
$01, // enabled flag (unimplemented)
$0110, // minimum T2 version required
NIL, // reserved
"Strobe" // module name
};
// --- About text resource
resource rTextForLETextBox2 (moduleMessage) {
TBLeftJust
TBBackColor TBColorF
TBForeColor TBColor4
"Strobe"
TBForeColor TBColor1
" turns your screen into a strobing, pulsating light, flashing on and "
"off to bring light and dark at random intervals."
};
// --- Version resource
resource rVersion (moduleVersion) {
{1,0,0,release,0}, // Version 1.0f2
verUS, // US Version
"T2 Strobe Module", // program's name
"By Jim R. Maricondo.\n"
"Copyright 1991-93, Jim Maricondo." // copyright notice
};
// --- About icon resource
resource rIcon (moduleIcon) {
$8000, // kind
$0014, // height
$001C, // width
$"FFF0000000000000000000000FFF"
$"FFF0FFFFFFFFFFFFFFFFFFFF0FFF"
$"FFF0F000000000000000000F0FFF"
$"FFF0F00000001FFFD000000F0FFF"
$"FFF0F00000001FFD0000000F0FFF"
$"FFF0F0000001FFFFD000000F0FFF"
$"FFF0F00000001FFD0000000F0FFF"
$"FFF0F0000001FFD00000000F0FFF"
$"FFF0F0000001FD000000000F0FFF"
$"FFF0F0000001D0000000000F0FFF"
$"FFF0F000000100000000000F0FFF"
$"FFF0F000000000000000000F0FFF"
$"FFF0FFFFFFFFFFFFFFFFAFFF0FFF"
$"FFF0000000000000000000000FFF"
$"FFFF0FFFFFFFFFFFFFFFFFF0FFFF"
$"FFFF0FFFFFFFFFFFFFFFFFF0FFFF"
$"FFFF0FF4AFFFFFFFFFFFFFF0FFFF"
$"FFFF0CCCCCCCCCCCCCCCCCC0FFFF"
$"FFFF0FFFFFFFFFFFFFFFAFF0FFFF"
$"FFFF00000000000000000000FFFF",
$"000FFFFFFFFFFFFFFFFFFFFFF000"
$"000FFFFFFFFFFFFFFFFFFFFFF000"
$"000FFFFFFFFFFFFFFFFFFFFFF000"
$"000FFFFFFFFFFFFFFFFFFFFFF000"
$"000FFFFFFFFFFFFFFFFFFFFFF000"
$"000FFFFFFFFFFFFFFFFFFFFFF000"
$"000FFFFFFFFFFFFFFFFFFFFFF000"
$"000FFFFFFFFFFFFFFFFFFFFFF000"
$"000FFFFFFFFFFFFFFFFFFFFFF000"
$"000FFFFFFFFFFFFFFFFFFFFFF000"
$"000FFFFFFFFFFFFFFFFFFFFFF000"
$"000FFFFFFFFFFFFFFFFFFFFFF000"
$"000FFFFFFFFFFFFFFFFFFFFFF000"
$"000FFFFFFFFFFFFFFFFFFFFFF000"
$"0000FFFFFFFFFFFFFFFFFFFF0000"
$"0000FFFFFFFFFFFFFFFFFFFF0000"
$"0000FFFFFFFFFFFFFFFFFFFF0000"
$"0000FFFFFFFFFFFFFFFFFFFF0000"
$"0000FFFFFFFFFFFFFFFFFFFF0000"
$"0000FFFFFFFFFFFFFFFFFFFF0000";
};