diff --git a/source/twilight/patch/makefile b/source/twilight/patch/makefile new file mode 100644 index 0000000..168b880 --- /dev/null +++ b/source/twilight/patch/makefile @@ -0,0 +1,15 @@ + +# Sound Patcher UNIX Makefile +# by Jim Maricondo +# v1.0 - 1/9/93 - coded (jG?!!) + +patch.d: patch.asm + asml patch.asm keep=patch.d + +patch.r: patch.rez + compile patch.rez keep=patch.r + +patch: patch.d patch.r + duplicate -d patch.d patch + duplicate -r patch.r patch + filetype patch exe diff --git a/source/twilight/patch/old/SHELL.ASM b/source/twilight/patch/old/SHELL.ASM new file mode 100644 index 0000000..8f161c4 --- /dev/null +++ b/source/twilight/patch/old/SHELL.ASM @@ -0,0 +1 @@ + KEEP shell mcopy shell.macros copy shell.equ ;................................................................ TRUE gequ 1 FALSE gequ 0 TempHandle gequ 0 TempPtr gequ 4 ;................................................................ Shell Start using GlobalData phk ;Data bank==code bank plb jsr SetUp ;Set things up jsr MainEvent ;do the main program jsr ShutDown ;then shut them down again _QUIT QuitParams ;And quit End ;................................................................ GlobalData Data QuitParams anop dc i4'0' dc i'0' MyID ds 2 ;UserID MemID ds 2 ;auxiliary UserID QuitFlag dc i'0' SavedFlag dc i'0' EnableFlag dc i'$FFFF' ;wether the edit menu is enabled StartStopRec ds 4 ;returned by StartUpTools NewPtr ds 4 ;The pointer to window's grafport SaveName ds 4 ;The save name handle SavePath ds 4 ;The save path's handle SaveHandle ds 4 ;The handle for the window title End ;................................................................ SetUp Start using GlobalData using FileData _TLStartUp ;Start the Tool Locator pushword #0 ;And the Memory Manager _MMStartUp pullword MyID ora #$0100 ;And create an aux ID sta MemID ; for getting memory with pushlong #0 ;Start up the standard tools pushword MyID pushword #2 ;from a resource pushlong #TSTART_00000002 _StartUpTools pulllong StartStopRec jsr SetUpMenus ;And draw the menu _InitCursor ;Show the arrow cursor lda #DefaultSave ;set the save name to the default save sta SaveName ;string ('untitled') lda #DefaultSave+2 sta SaveName+2 rts End ;................................................................ SetUpMenus Start pushlong #0 ;Create a new menu bar pushword #2 ;from a resource pushlong #MBAR_00000001 pushlong #0 _NewMenuBar2 _SetSysBar ; and make it the current system bar pushlong #0 _SetMenuBar pushword #1 ;Install the Desk Accs _FixAppleMenu pushword #0 ;Calculate the sizes of the menus _FixMenuBar pla _DrawMenuBar ;And draw the bar rts End ;................................................................ MenuData Data MenuHandlers anop dc i'doClose' ;Close: 255 dc i'doAbout' ;About: 256 dc i'doQuit' ;Quit: 257 dc i'doNew' ;New: 258 dc i'doOpen' ;Open: 259 dc i'doSave' ;Save: 260 dc i'doSaveAs' ;SaveAs: 261 dc i'doDocs' ;Documentation: 262 dc i'Ignore' ;Print: 263 dc i'Ignore' ;Page Setup:264 End ;................................................................ MainEvent Start using TaskData using GlobalData again pushword #0 ;Main event loop... pushword #$FFFF pushlong #TaskRecord _TaskMaster pla asl a tax jsr (TaskHandlers,x) lda QuitFlag beq again rts End ;................................................................ TaskData Data TaskRecord anop What ds 2 Message ds 4 When ds 4 Where ds 4 Modifiers ds 2 TData ds 4 dc i4'$001FFFFF' LastClickTick ds 4 ClickCount ds 2 TaskData2 ds 4 TaskData3 ds 4 TaskData4 ds 4 LastClickPoint ds 4 TaskHandlers anop dc i'doNull' ;NullEvt dc i'Ignore' ;MouseDownEvt dc i'Ignore' ;MouseUpEvt dc i'Ignore' ;KeyDownEvt dc i'Ignore' ;Undefined dc i'Ignore' ;AutoKeyEvt dc i'Ignore' ;UpdateEvt dc i'Ignore' ;Undefined dc i'Ignore' ;ActivateEvt dc i'Ignore' ;SwitchEvt dc i'Ignore' ;DeskAccEvt dc i'Ignore' ;DriverEvt dc i'Ignore' ;App1Evt dc i'Ignore' ;App2Evt dc i'Ignore' ;App3Evt dc i'Ignore' ;App4Evt dc i'Ignore' ;wInDesk dc i'doMenus' ;wInMenuBar dc i'Ignore' ;wClickCalled dc i'Ignore' ;wInContent dc i'Ignore' ;wInDrag dc i'Ignore' ;wInGrow dc i'doClose' ;wInGoAway dc i'Ignore' ;wInZoom dc i'Ignore' ;wInInfo dc i'doMenus' ;wInSpecial dc i'Ignore' ;wInDeskItem dc i'Ignore' ;wInFrame dc i'Ignore' ;wInactMenu dc i'Ignore' ;wClosedNDA dc i'Ignore' ;wCalledSysEdit dc i'Ignore' ;wTrackZoom dc i'Ignore' ;wHitFrame dc i'Ignore' ;wInControl dc i'Ignore' ;wInControlMenu End ;................................................................ doNull Start using GlobalData pushlong #0 ;get the front window _FrontWindow pla plx cmp #0 ;if the ptr=NIL then disable things bne enable ;otherwise enable them cpx #0 bne enable lda EnableFlag ;see if we're already disabled beq done ;if so, then exit pushword #255 ;otherwise, disable the close item _DisableMItem pushword #$0080 ;and the Edit menu pushword #3 _SetMenuFlag _DrawMenuBar ;redraw the menu bar (so Edit will be ; ;dimmed) stz EnableFlag ;and indicate that things are disabled rts ;Exit enable lda EnableFlag ;see if things are already enabled bne done ;and if so, exit pushword #255 ;enable the close item _EnableMItem pushword #$FF7F ;and the Edit menu pushword #3 _SetMenuFlag _DrawMenuBar ;redraw the menu bar lda #$FFFF ;and indicate that things are enabled sta EnableFlag done rts End ;................................................................ Ignore Start rts ;Ignore all of these End ;................................................................ doMenus Start using MenuData using TaskData lda TData ;Find out which menu it was sec ;transform into a jump table offset sbc #255 asl a tax jsr (MenuHandlers,x) ;and jump pushword #FALSE ;Then unhilite it when done pushword TData+2 _HiliteMenu rts End ;................................................................ doClose Start using GlobalData using MenuData pushlong #0 ;get the front window _FrontWindow pulllong TempHandle lda TempHandle ;see if it's our window cmp NewPtr bne DC01 ;if not, skip this lda TempHandle+2 cmp NewPtr+2 bne DC01 pushword #260 ;Disable Save _DisableMItem pushword #261 ;Disable Save as _DisableMItem pushword #263 ;Disable Print _DisableMItem pushword #264 ;Disable Page Setup _DisableMItem pushword #258 ;Enable New _EnableMItem pushword #259 ;Enable Open _EnableMItem ; [Do window specific close stuff here] DC01 anop ;here you could check for other windows ; ;for which you need to do special stuff ; ;when closed close pushlong TempHandle ;close the window _CloseWindow pushlong #0 ;this will disable the close item _FrontWindow ;(ID = 255) if there are no more open pla ;windows plx cmp #0 bne done cpx #0 bne done pushword #255 _DisableMItem done rts End ;................................................................ doAbout Start pushword #0 ;Create our About as a standard alert pushword #4 ;from a resource pushlong #0 pushlong #ALERT_0000000E _AlertWindow pla rts End ;................................................................ doNew Start using FileData jsr newEngine ;open the window lda #DefaultSave ;and make the save name 'untitled' sta SaveName ; (see SetUP) lda #DefaultSave+2 sta SaveName+2 rts End ;................................................................ newEngine Start using GlobalData pushlong #0 ;Open the window, from a resource pushlong #0 pushlong #0 pushlong #drawNew pushlong #0 pushword #2 pushlong #WPARAM1_00000FFE pushword #$800E _NewWindow2 pulllong NewPtr pushword #255 ;Enable Close _EnableMItem pushword #260 ;Enable Save _EnableMItem pushword #261 ;Enable Save as _EnableMItem pushword #263 ;Enable Print _EnableMItem pushword #264 ;Enable Page setup _EnableMItem pushword #258 ;Disable New _DisableMItem pushword #259 ;Disable Open _DisableMItem rts End ;................................................................ drawNew Start using GlobalData phb ;save the data bank, then make phk ;data bank==code bank plb pushlong NewPtr ;draw the window's controls _DrawControls plb ;and restore the saved data bank rtl End ;................................................................ doOpen Start using FileData using GlobalData lda SavedFlag ;if the window has hever been saved, beq skip ;then skip this pushlong Name ;dispose of all the name and path _DisposeHandle ;strings pushlong Path _DisposeHandle pushlong SaveHandle _DisposeHandle skip pushword #30 ;Do your standard SFGetFile2 pushword #50 ;This is a little cramped in 640 mode pushword #0 ;but looks really nice in 320 pushlong #OpenString pushlong #0 pushlong #TypeList pushlong #SFReply _SFGetFile2 lda SFReply ;See if we should proceed bne ok brl abort ok lda Path ;Transfer the path to a dp location sta TempHandle lda Path+2 sta TempHandle+2 ldy #2 ;Load the pointer to the name lda [TempHandle] clc ; adding two to skip over the length adc #2 ; of buffer word sta OpenPath ;And store the ptr at OpenPath & sta SavePath ;SavePath lda [TempHandle],y adc #0 sta OpenPath+2 sta SavePath+2 _OpenGS openParams ;Open the file lda ORefNum ;Transfer out refNum sta RRefNum sta CRefNum pushlong #0 ;Get a block of memeory to load the pushlong Length ; file into pushword MemID pushword #$C000 pushlong #0 _NewHandle pulllong TempHandle ;And store it's ptr at both ldy #2 ;FilePtr & TempPtr lda [TempHandle],y sta FilePtr+2 sta TempPtr+2 lda [TempHandle] sta FilePtr sta TempPtr lda Length ;Transfer the length to the read length sta RLength lda Length+2 sta RLength+2 _ReadGS readParams ;Read the file _CloseGS closeParams ;And then close it jsr newEngine ;open the window pushword #5 ;Text block pushlong FilePtr pushlong Length pushword #0 pushlong #0 pushlong #0 _TESetText pushlong TempHandle ;we can discard the loaded text _DisposeHandle ;after the TE control has it jsr makeSaveName ;set the window's name lda #$FFFF ;indicate that the file has been saved sta SavedFlag abort rts End ;................................................................ doSave Start using GlobalData lda SavedFlag ;if we've been saved before, then bne saved ;just save the file. Otherwise, do jsr doSaveAs ;SaveAs rts ;exit saved jsr saveEngine ;just save the file rts End ;................................................................ doSaveAs Start using FileData using GlobalData pushword #25 ;Your standard SFPutFile2 pushword #50 ;Again, a little cramped in 640, but pushword #0 ;nice in 320 pushlong #SaveAsPrompt pushword #0 pushlong SaveName pushlong #SFReply _SFPutFile2 lda SFReply ;See if we're still hapening bne ok1 brl done ok1 lda SavedFlag ;if the file hasn't been saved then skip beq skip ; the next bit pushlong Path ;dispose all the name and path strings _DisposeHandle pushlong Name _DisposeHandle pushlong SaveHandle _DisposeHandle skip lda Path ;Transfer the path to a dp location sta TempHandle lda Path+2 sta TempHandle+2 ldy #2 ;Get the ptr lda [TempHandle] clc ;and add two to skip over the output adc #2 ;word sta SavePath lda [TempHandle],y adc #0 sta SavePath+2 jsr saveEngine ;save the file lda #$FFFF ;indicate that it's been saved sta SavedFlag jsr makeSaveName ;and rename the window done rts End ;................................................................ saveEngine Start using FileData lda SavePath ;load the pathname into all of the sta OpenPath ;appropriate places sta DPathPtr sta CPathPtr lda SavePath+2 sta OpenPath+2 sta DPathPtr+2 sta CPathPtr+2 _DestroyGS DestroyParams ;Destroy any existing file _CreateGS CreateParams ;Create a brand new one _OpenGS OpenParams ;Open it lda ORefNum ;Transfer ref nums sta CRefNum ; [Insert save code here] _CloseGS CloseParams ;And close the file rts End ;................................................................ FileData Data OpenString str 'Open which file:' SaveAsPrompt str 'Save file as:' DefaultSave GSstr 'Untitled' TypeList anop dc i'1' ;number of types dc i'$8000' ;flags dc i'4' ;fileType dc i4'0' ;auxType SFReply anop ds 2 type ds 2 auxType ds 4 dc i'3' Name ds 4 dc i'3' Path ds 4 openParams anop dc i'12' ORefNum ds 2 OpenPath ds 4 dc i'3' dc i'0' ds 2 ds 2 ds 4 ds 2 ds 8 ds 8 dc i4'0' Length ds 4 readParams anop dc i'4' RRefNum ds 2 FilePtr ds 4 RLength ds 4 ds 4 closeParams anop dc i'1' CRefNum ds 2 DestroyParams anop dc i'1' DPathPtr ds 4 CreateParams anop dc i'4' CPathPtr ds 4 dc i'$00C3' dc i'6' dc i4'$0000' End ;................................................................ doQuit Start using GlobalData lda #$FFFF ;Indicate that it's time to quit sta QuitFlag rts End ;................................................................ doDocs Start using DocData using GlobalData pushlong #0 ;open a window with the documentation pushlong #0 ;in it. pushlong #0 pushlong #drawDocs pushlong #0 pushword #2 pushlong #WPARAM1_00000FFD pushword #$800E _NewWindow2 pulllong DocPtr wait pushword #0 ;then wait for the person to hit the pushword #$FFFF ;close box, filtering out all other pushlong #DocTRecord ;events _TaskMaster pla cmp #$0016 bne wait pushlong DocPtr ;close the doc window _CloseWindow rts End ;................................................................ drawDocs Start using DocData phb ;save the data bank phk ;make the data bank==code bank plb pushlong DocPtr ;draw the controls _DrawControls plb ;restore the saved data bank rtl End ;................................................................ DocData Data DocPtr ds 4 DocTRecord anop DWhat ds 2 DMessage ds 4 DWhen ds 4 DWhere ds 4 DModifiers ds 2 DTData ds 4 dc i4'$0011A106' DLastClickTick ds 4 DClickCount ds 2 DTaskData2 ds 4 DTaskData3 ds 4 DTaskData4 ds 4 DLastClickPoint ds 4 End ;................................................................ ShutDown Start using GlobalData pushword #1 ;Shut down most of the tools pushlong StartStopRec _ShutDownTools pushword MyID ; then the Memory Manager _MMShutDown _TLShutDown ; then the Tool Locator rts End ;................................................................ makeSaveName Start using GlobalData lda Name ;This is really messy, but it works :) sta TempHandle ;store the Name handle into the dp lda Name+2 sta TempHandle+2 ldy #2 ;then derefrence the filename, adding lda [TempHandle] ;two to skip over the GS/OS buffer clc ;length word adc #2 sta SaveName ;store this as the SaveName (for the sta TempPtr ;SFPutFile2 dialog) lda [TempHandle],y ;and in TempPtr (so we can get at it) adc #0 sta SaveName+2 sta TempPtr+2 pushlong #0 ;Next, get another handle of the same pushlong #0 ;size as the first pushlong TempHandle _GetHandleSize pushword MemID pushword #$C000 pushlong #0 _NewHandle pulllong TempHandle ;putting the handle into both lda TempHandle ;the dp, so we can deref it, and sta SaveHandle ;SaveHandle, so we can discard it later lda TempHandle+2 sta SaveHandle+2 lda [TempHandle] ;load the first word of the pointer pha ;and store for a sec ldy #2 ;load the second byte lda [TempHandle],y sta TempHandle+2 ;and store it at TempHandle (I didn't pla ;want to use any more dp space :) sta TempHandle ;then put the first byte there too lda [TempPtr] ;load the length word, make it between and #$00FF ;0-255, and store it as a length byte sta [TempHandle] inc a ;also add two and store for future inc a ;refrence sta NameLength ldy #2 shortm ;work with bytes (letters) nextMove cpy NameLength ;see if we've done enough bytes yet beq moved ;if so, exit lda [TempPtr],y ;otherwise, move another byte from dey ;offset x in TempPtr to offset x-1 sta [TempHandle],y ;in TempHandle iny bra nextMove ;and go back to do another byte moved longm ;work with words again pushlong TempHandle ;set the window title pushlong NewPtr _SetWTitle rts ;and, finally, exit. Easy, huh? NameLength ds 2 End \ No newline at end of file diff --git a/source/twilight/patch/old/SHELL.MACROS b/source/twilight/patch/old/SHELL.MACROS new file mode 100644 index 0000000..13a6592 --- /dev/null +++ b/source/twilight/patch/old/SHELL.MACROS @@ -0,0 +1 @@ + MACRO &lab _DrawControls &lab ldx #$1010 jsl $E10000 MEND MACRO &lab _FixAppleMenu &lab ldx #$1E05 jsl $E10000 MEND MACRO &lab _TLStartUp &lab ldx #$0201 jsl $E10000 MEND MACRO &lab _TLShutDown &lab ldx #$0301 jsl $E10000 MEND MACRO &lab _StartUpTools &lab ldx #$1801 jsl $E10000 MEND MACRO &lab _ShutDownTools &lab ldx #$1901 jsl $E10000 MEND MACRO &lab _MMStartUp &lab ldx #$0202 jsl $E10000 MEND MACRO &lab _MMShutDown &lab ldx #$0302 jsl $E10000 MEND MACRO &lab _DisposeHandle &lab ldx #$1002 jsl $E10000 MEND MACRO &lab _NewHandle &lab ldx #$0902 jsl $E10000 MEND MACRO &lab _DisableMItem &lab ldx #$310F jsl $E10000 MEND MACRO &lab _DrawMenuBar &lab ldx #$2A0F jsl $E10000 MEND MACRO &lab _EnableMItem &lab ldx #$300F jsl $E10000 MEND MACRO &lab _FixMenuBar &lab ldx #$130F jsl $E10000 MEND MACRO &lab _HiliteMenu &lab ldx #$2C0F jsl $E10000 MEND MACRO &lab _SetMenuBar &lab ldx #$390F jsl $E10000 MEND MACRO &lab _SetMenuFlag &lab ldx #$1F0F jsl $E10000 MEND MACRO &lab _SetSysBar &lab ldx #$120F jsl $E10000 MEND MACRO &lab _NewMenuBar2 &lab ldx #$430F jsl $E10000 MEND MACRO &lab _QUIT ¶ms &lab jsl $E100A8 dc i2"$29" dc i4"¶ms" MEND MACRO &lab _InitCursor &lab ldx #$CA04 jsl $E10000 MEND MACRO &lab _SFGetFile2 &lab ldx #$0E17 jsl $E10000 MEND MACRO &lab _SFPutFile2 &lab ldx #$0F17 jsl $E10000 MEND MACRO &lab _AlertWindow &lab ldx #$590E jsl $E10000 MEND MACRO &lab _CloseWindow &lab ldx #$0B0E jsl $E10000 MEND MACRO &lab _FrontWindow &lab ldx #$150E jsl $E10000 MEND MACRO &lab _SetWTitle &lab ldx #$0D0E jsl $E10000 MEND MACRO &lab _TaskMaster &lab ldx #$1D0E jsl $E10000 MEND MACRO &lab _NewWindow2 &lab ldx #$610E jsl $E10000 MEND MACRO &lab _TESetText &lab ldx #$0B22 jsl $E10000 MEND MACRO &lab _CloseGS ¶ms &lab jsl $E100A8 dc i2"$2014" dc i4"¶ms" MEND MACRO &lab _CreateGS ¶ms &lab jsl $E100A8 dc i2"$2001" dc i4"¶ms" MEND MACRO &lab _DestroyGS ¶ms &lab jsl $E100A8 dc i2"$2002" dc i4"¶ms" MEND MACRO &lab _OpenGS ¶ms &lab jsl $E100A8 dc i2"$2010" dc i4"¶ms" MEND MACRO &lab _ReadGS ¶ms &lab jsl $E100A8 dc i2"$2012" dc i4"¶ms" MEND MACRO &lab pulllong &addr1,&addr2 &lab ANOP AIF C:&addr1=0,.a AIF C:&addr2=0,.b LCLC &C &C AMID &addr1,1,1 AIF "&C"="[",.zeropage pullword &addr1 sta &addr2 pullword &addr1+2 sta &addr2+2 MEXIT .a pullword pullword MEXIT .b pullword &addr1 pullword &addr1+2 MEXIT .zeropage ldy #&addr2 pullword &addr1,y ldy #&addr2+2 pullword &addr1,y MEND 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 str &string &lab dc i1'L:&string',C'&string' MEND MACRO &lab GSstr &string &lab dc i'L:&string',C'&string' MEND MACRO &lab _GetHandleSize &lab ldx #$1802 jsl $E10000 MEND MACRO &lab longm &lab ANOP rep #%00100000 longa on MEND MACRO &lab shortm &lab ANOP sep #%00100000 longa off MEND \ No newline at end of file diff --git a/source/twilight/patch/old/Shell.doc b/source/twilight/patch/old/Shell.doc new file mode 100644 index 0000000..8f933f3 --- /dev/null +++ b/source/twilight/patch/old/Shell.doc @@ -0,0 +1 @@ +I wrote this in about 5 hours today, so there are most likely some lingering bugs. If you find any, please send EMail to (America Online) JonahS or (GEnie) J.STICH1. I've included everything you need to recompile the program. In this archive you should have gotten: Shell.doc (This file) Shell.asm (The APW assembly source for the program) Shell.equ (The Genesys created equates for the Assembly source) Shell.r320.rez (The rez source for the 320 mode resource fork) Shell.r640.rez (The rez source for the 640 mode resource fork) Shell.macros (The macro file for the assembly source) Shell320.sys16 (The 320 mode version of the shell) Shell640.sys16 (The 640 mode version of the shell) To change the resource fork, you'll need either Rez or a resource editing tool (Genesys comes to mind....) To rebuild the program, you should do the following: compile shell.asm compile shell.rxxx.rez keep=shell.rfork linkiigs shell.root shell.a -o shell.dfork duplicate -d shell.dfork shell.sys16 duplicate -r shell.rfork shell.sys16 filetype shell.sys16 s16 That SHOULD do it. EMail me if you have problems, and I'll try to straighten you out. Hope you like the program and find it to be of some use. Enjoy! \ No newline at end of file diff --git a/source/twilight/patch/old/patch.asm.c b/source/twilight/patch/old/patch.asm.c new file mode 100644 index 0000000..700ad61 --- /dev/null +++ b/source/twilight/patch/old/patch.asm.c @@ -0,0 +1 @@ + KEEP patch mcopy patch.mac copy patch.equ copy 13:ainclude:e16.memory copy 13:ainclude:e16.types ;................................................................ TRUE gequ 1 FALSE gequ 0 TempHandle gequ <0 TempPtr gequ TempHandle+4 ;................................................................ Patcher Start Using GlobalDATA phk plb jsr SetUp ;Set things up jsr MainEvent ;do the main program jsr ShutDown ;then shut them down again _QUIT QuitParams ;And quit End ;................................................................ GlobalData Data QuitParams anop dc i4'0' dc i'0' MyID ds 2 ;UserID MemID ds 2 ;auxiliary UserID QuitFlag dc i'0' SavedFlag dc i'0' EnableFlag dc i'$FFFF' ;wether the edit menu is enabled StartStopRec ds 4 ;returned by StartUpTools NewPtr ds 4 ;The pointer to window's grafport SaveName ds 4 ;The save name handle SavePath ds 4 ;The save path's handle SaveHandle ds 4 ;The handle for the window title End ;................................................................ SetUp Start using GlobalData using FileData ~TLStartUp ;Start the Tool Locator ~MMStartUp pullword MyID ora #$0100 ;And create an aux ID sta MemID ; for getting memory with pushlong #0 ;Start up the standard tools pushword MyID pushword #2 ;from a resource pushlong #TSTART_00000002 _StartUpTools pulllong StartStopRec jsr SetUpMenus ;And draw the menu ~InitCursor ;Show the arrow cursor lda #DefaultSave ;set the save name to the default save sta SaveName ;string ('untitled') lda #DefaultSave+2 sta SaveName+2 rts End ;................................................................ SetUpMenus Start Using GlobalDATA ~NewMenuBar2 #2,#MBAR_00000001,#0 _SetSysBar ; and make it the current system bar ~SetMenuBar #0 ~FixAppleMenu #1 ; install desk accs ~FixMenuBar ; calculate menu sizes pla ~DrawMenuBar ;And draw the bar rts End ;................................................................ MenuData Data MenuHandlers anop dc i'doClose' ;Close: 255 dc i'doAbout' ;About: 256 dc i'doQuit' ;Quit: 257 dc i'doNew' ;New: 258 dc i'doOpen' ;Open: 259 dc i'doSave' ;Save: 260 dc i'doSaveAs' ;SaveAs: 261 dc i'doDocs' ;Documentation: 262 dc i'Ignore' ;Print: 263 dc i'Ignore' ;Page Setup:264 End ;................................................................ MainEvent Start using TaskData using GlobalData again anop ~TaskMaster #$FFFF,#TaskRecord pla asl a tax jsr (TaskHandlers,x) lda QuitFlag beq again rts End ;................................................................ TaskData Data TaskRecord anop What ds 2 Message ds 4 When ds 4 Where ds 4 Modifiers ds 2 TData ds 4 dc i4'$001FFFFF' LastClickTick ds 4 ClickCount ds 2 TaskData2 ds 4 TaskData3 ds 4 TaskData4 ds 4 LastClickPoint ds 4 TaskHandlers anop dc i'doNull' ;NullEvt dc i'Ignore' ;MouseDownEvt dc i'Ignore' ;MouseUpEvt dc i'Ignore' ;KeyDownEvt dc i'Ignore' ;Undefined dc i'Ignore' ;AutoKeyEvt dc i'Ignore' ;UpdateEvt dc i'Ignore' ;Undefined dc i'Ignore' ;ActivateEvt dc i'Ignore' ;SwitchEvt dc i'Ignore' ;DeskAccEvt dc i'Ignore' ;DriverEvt dc i'Ignore' ;App1Evt dc i'Ignore' ;App2Evt dc i'Ignore' ;App3Evt dc i'Ignore' ;App4Evt dc i'Ignore' ;wInDesk dc i'doMenus' ;wInMenuBar dc i'Ignore' ;wClickCalled dc i'Ignore' ;wInContent dc i'Ignore' ;wInDrag dc i'Ignore' ;wInGrow dc i'doClose' ;wInGoAway dc i'Ignore' ;wInZoom dc i'Ignore' ;wInInfo dc i'doMenus' ;wInSpecial dc i'Ignore' ;wInDeskItem dc i'Ignore' ;wInFrame dc i'Ignore' ;wInactMenu dc i'Ignore' ;wClosedNDA dc i'Ignore' ;wCalledSysEdit dc i'Ignore' ;wTrackZoom dc i'Ignore' ;wHitFrame dc i'Ignore' ;wInControl dc i'Ignore' ;wInControlMenu End ;................................................................ doNull Start using GlobalData ~FrontWindow pla plx cmp #0 ;if the ptr=NIL then disable things bne enable ;otherwise enable them cpx #0 bne enable lda EnableFlag ;see if we're already disabled beq done ;if so, then exit ~DisableMItem #255 ; otherwise, disable close item ~SetMenuFlag #$0080,#3 ; and edit menu _DrawMenuBar ;redraw the menu bar (so Edit will be ; ;dimmed) stz EnableFlag ;and indicate that things are disabled rts ;Exit enable lda EnableFlag ;see if things are already enabled bne done ;and if so, exit ~EnableMItem #255 ; enable close item ~SetMenuFlag #$FF7F,#3 ; and the edit menu _DrawMenuBar ;redraw the menu bar lda #$FFFF ;and indicate that things are enabled sta EnableFlag done rts End ;................................................................ Ignore Start rts ;Ignore all of these End ;................................................................ doMenus Start Using GlobalDATA using MenuData using TaskData lda TData ;Find out which menu it was sec ;transform into a jump table offset sbc #255 asl a tax jsr (MenuHandlers,x) ;and jump ~HiliteMenu #FALSE,TData+2 ; then unhilite it when done rts End ;................................................................ doClose Start using GlobalData using MenuData ~FrontWindow pulllong TempHandle lda TempHandle ;see if it's our window cmp NewPtr bne DC01 ;if not, skip this lda TempHandle+2 cmp NewPtr+2 bne DC01 ~DisableMItem #260 ; disable save ~DisableMItem #261 ; disable save as ~DisableMItem #263 ; disable print ~DisableMItem #264 ; disable page setup ~EnableMItem #258 ; enable new ~EnableMItem #259 ; enable open ; [Do window specific close stuff here] DC01 anop ;here you could check for other windows ; ;for which you need to do special stuff ; ;when closed close anop pei TempHandle+2 pei TempHandle _CloseWindow ; ;this will disable the close item ~FrontWindow ;(ID = 255) if there are no more open pla ;windows plx cmp #0 bne done cpx #0 bne done ~DisableMItem #255 done rts End ;................................................................ doAbout Start Using GlobalDATA ~AlertWindow #4,#0,#ALERT_0000000E plx rts End ;................................................................ doNew Start using FileData Using GlobalDATA jsr newEngine ;open the window lda #DefaultSave ;and make the save name 'untitled' sta SaveName ; (see SetUP) lda #DefaultSave+2 sta SaveName+2 rts End ;................................................................ newEngine Start using GlobalData LongResult ;Open the window, from a resource pushlong #0 pushlong #0 pushlong #drawNew pushlong #0 pushword #2 pushlong #WPARAM1_00000FFE pushword #$800E _NewWindow2 pulllong NewPtr ~EnableMItem #255 ; enable close ~EnableMItem #260 ; enable save ~EnableMItem #261 ; enable save as ~EnableMItem #263 ; enable print ~EnableMItem #264 ; enable page setup ~DisableMItem #258 ; disable new ~DisableMItem #259 ; disable open rts End ;................................................................ drawNew Start using GlobalData phb ;save the data bank, then make phk ;data bank==code bank plb ~DrawControls NewPtr plb ;and restore the saved data bank rtl End ;................................................................ doOpen Start using FileData using GlobalData lda SavedFlag ;if the window has hever been saved, beq skip ;then skip this ~DisposeHandle Name ;dispose name and path strings ~DisposeHandle Path ~DisposeHandle SaveHandle skip anop PushWord #120 whereX 640 PushWord #50 whereY 640 PushWord #refIsPointer promptRefDesc PushLong #OpenString promptRef PushLong #0 filterProcPrt PushLong #TypeList typeListPtr PushLong #SFReply replyPtr _SFGetFile2 lda SFReply ;See if we should proceed bne ok brl abort ok lda Path ;Transfer the path to a dp location sta TempHandle lda Path+2 sta TempHandle+2 ldy #2 ;Load the pointer to the name lda [TempHandle] clc ; adding two to skip over the length adc #2 ; of buffer word sta OpenPath ;And store the ptr at OpenPath & sta SavePath ;SavePath lda [TempHandle],y adc #0 sta OpenPath+2 sta SavePath+2 _OpenGS openParams ;Open the file lda ORefNum ;Transfer out refNum sta RRefNum sta CRefNum LongResult ;Get a block of memeory to load the pushlong Length ; file into pushword MemID pushword #$C000 pushlong #0 _NewHandle pulllong TempHandle ;And store it's ptr at both ldy #2 ;FilePtr & TempPtr lda [TempHandle],y sta FilePtr+2 sta TempPtr+2 lda [TempHandle] sta FilePtr sta TempPtr lda Length ;Transfer the length to the read length sta RLength lda Length+2 sta RLength+2 _ReadGS readParams ;Read the file _CloseGS closeParams ;And then close it jsr newEngine ;open the window pushword #5 ;Text block pushlong FilePtr pushlong Length pushword #0 pushlong #0 pushlong #0 _TESetText pei TempHandle+2 ;we can discard the loaded text pei TempHandle _DisposeHandle ;after the TE control has it jsr makeSaveName ;set the window's name lda #$FFFF ;indicate that the file has been saved sta SavedFlag abort rts End ;................................................................ doSave Start using GlobalData lda SavedFlag ;if we've been saved before, then bne saved ;just save the file. Otherwise, do jsr doSaveAs ;SaveAs rts ;exit saved jsr saveEngine ;just save the file rts End ;................................................................ doSaveAs Start using FileData using GlobalData pushword #25 ;Your standard SFPutFile2 pushword #50 ;Again, a little cramped in 640, but pushword #0 ;nice in 320 pushlong #SaveAsPrompt pushword #0 pushlong SaveName pushlong #SFReply _SFPutFile2 lda SFReply ;See if we're still hapening bne ok1 brl done ok1 lda SavedFlag ;if the file hasn't been saved then skip beq skip ; the next bit ~DisposeHandle Name ;dispose name and path strings ~DisposeHandle Path ~DisposeHandle SaveHandle skip lda Path ;Transfer the path to a dp location sta TempHandle lda Path+2 sta TempHandle+2 ldy #2 ;Get the ptr lda [TempHandle] clc ;and add two to skip over the output adc #2 ;word sta SavePath lda [TempHandle],y adc #0 sta SavePath+2 jsr saveEngine ;save the file lda #$FFFF ;indicate that it's been saved sta SavedFlag jsr makeSaveName ;and rename the window done rts End ;................................................................ saveEngine Start using FileData Using GlobalDATA lda SavePath ;load the pathname into all of the sta OpenPath ;appropriate places sta DPathPtr sta CPathPtr lda SavePath+2 sta OpenPath+2 sta DPathPtr+2 sta CPathPtr+2 _DestroyGS DestroyParams ;Destroy any existing file _CreateGS CreateParams ;Create a brand new one _OpenGS OpenParams ;Open it lda ORefNum ;Transfer ref nums sta CRefNum ; [Insert save code here] _CloseGS CloseParams ;And close the file rts End ;................................................................ FileData Data OpenString str 'Locate the Sound control panel:' SaveAsPrompt str 'Save file as:' DefaultSave GSstr 'Untitled' TypeList anop dc i'1' number of types dc i'$8000' flags: don't match auxtype dc i'$C7' fileType dc i4'$0000' auxType SFReply anop ds 2 type ds 2 auxType ds 4 dc i'3' Name ds 4 dc i'3' Path ds 4 openParams anop dc i'12' ORefNum ds 2 OpenPath ds 4 dc i'3' dc i'0' ds 2 ds 2 ds 4 ds 2 ds 8 ds 8 dc i4'0' Length ds 4 readParams anop dc i'4' RRefNum ds 2 FilePtr ds 4 RLength ds 4 ds 4 closeParams anop dc i'1' CRefNum ds 2 DestroyParams anop dc i'1' DPathPtr ds 4 CreateParams anop dc i'4' CPathPtr ds 4 dc i'$00C3' dc i'6' dc i4'$0000' End ;................................................................ doQuit Start using GlobalData lda #$FFFF ;Indicate that it's time to quit sta QuitFlag rts End ;................................................................ doDocs Start using DocData using GlobalData LongResult ;open a window with the documentation pushlong #0 ;in it. pushlong #0 pushlong #drawDocs pushlong #0 pushword #2 pushlong #WPARAM1_00000FFD pushword #$800E _NewWindow2 pulllong DocPtr wait anop ; then wait for the person to hit the close box, filtering out all other events ~TaskMaster #$FFFF,#DocTRecord pla cmp #$0016 bne wait ~CloseWindow DocPtr ; close doc window rts End ;................................................................ drawDocs Start using DocData phb ;save the data bank phk ;make the data bank==code bank plb ~DrawControls DocPtr plb ;restore the saved data bank rtl End ;................................................................ DocData Data DocPtr ds 4 DocTRecord anop DWhat ds 2 DMessage ds 4 DWhen ds 4 DWhere ds 4 DModifiers ds 2 DTData ds 4 dc i4'$0011A106' DLastClickTick ds 4 DClickCount ds 2 DTaskData2 ds 4 DTaskData3 ds 4 DTaskData4 ds 4 DLastClickPoint ds 4 End ;................................................................ ShutDown Start using GlobalData ~ShutDownTools #1,StartStopRec ; shutdown most of the tools ~MMShutDown MyID ~TLShutDown ; then the Tool Locator rts End ;................................................................ makeSaveName Start using GlobalData Using FileDATA lda Name ;This is really messy, but it works :) sta TempHandle ;store the Name handle into the dp lda Name+2 sta TempHandle+2 ldy #2 ;then derefrence the filename, adding lda [TempHandle] ;two to skip over the GS/OS buffer clc ;length word adc #2 sta SaveName ;store this as the SaveName (for the sta TempPtr ;SFPutFile2 dialog) lda [TempHandle],y ;and in TempPtr (so we can get at it) adc #0 sta SaveName+2 sta TempPtr+2 LongResult ;Next, get another handle of the same LongResult ;size as the first pei TempHandle+2 pei TempHandle _GetHandleSize pushword MemID pushword #attrLocked+attrFixed phd phd _NewHandle pulllong TempHandle ;putting the handle into both lda TempHandle ;the dp, so we can deref it, and sta SaveHandle ;SaveHandle, so we can discard it later lda TempHandle+2 sta SaveHandle+2 lda [TempHandle] ;load the first word of the pointer pha ;and store for a sec ldy #2 ;load the second byte lda [TempHandle],y sta TempHandle+2 ;and store it at TempHandle (I didn't pla ;want to use any more dp space :) sta TempHandle ;then put the first byte there too lda [TempPtr] ;load the length word, make it between and #$00FF ;0-255, and store it as a length byte sta [TempHandle] inc a ;also add two and store for future inc a ;refrence sta NameLength ldy #2 shortm ;work with bytes (letters) nextMove cpy NameLength ;see if we've done enough bytes yet beq moved ;if so, exit lda [TempPtr],y ;otherwise, move another byte from dey ;offset x in TempPtr to offset x-1 sta [TempHandle],y ;in TempHandle iny bra nextMove ;and go back to do another byte moved longm ;work with words again pei TempHandle+2 pei TempHandle ;set the window title pushlong NewPtr _SetWTitle rts ;and, finally, exit. Easy, huh? NameLength ds 2 End \ No newline at end of file diff --git a/source/twilight/patch/old/patch.asm.d b/source/twilight/patch/old/patch.asm.d new file mode 100644 index 0000000..ec5beaa --- /dev/null +++ b/source/twilight/patch/old/patch.asm.d @@ -0,0 +1 @@ + KEEP patch.d mcopy patch.mac copy patch.equ copy 13:ainclude:e16.memory copy 13:ainclude:e16.types copy 13:ainclude:e16.window copy 13:ainclude:e16.event copy 13:ainclude:e16.resources copy 13:ainclude:e16.misctool copy 13:ainclude:e16.gsos *-----------------------------------------------------------------------------* TRUE gequ 1 FALSE gequ 0 TempHandle gequ <0 TempPtr gequ TempHandle+4 TempDP gequ TempPtr+4 *-----------------------------------------------------------------------------* Patcher Start kind $1000 Using GlobalDATA debug 'Patcher' copy 22:dsdb.equ phk plb jsr Startup ;Set things up jsr MainEvent ;do the main program jsr Shutdown ;then shut them down again _QUIT QuitParms ;And quit End *-----------------------------------------------------------------------------* GlobalDATA Data QuitParms anop dc i4'0' dc i'0' MasterID ds 2 ;UserID MyID ds 2 ;auxiliary UserID QuitFlag dc i'0' EnableFlag dc i'$FFFF' ;wether the edit menu is enabled SSRecRefRet ds 4 ;returned by StartUpTools NewPtr ds 4 ;The pointer to window's grafport End *-----------------------------------------------------------------------------* Startup Start Using GlobalDATA Using FileDATA debug 'Startup' ~TLStartUp ;Start the Tool Locator ~MMStartUp PullWord MasterID ora #$0100 ;And create an aux ID sta MyID ; for getting memory with ~StartUpTools MasterID,#refIsResource,#toolTable PullLong SSRecRefRet jsr SetUpMenus ;And draw the menu ~InitCursor ;Show the arrow cursor rts End *-----------------------------------------------------------------------------* SetUpMenus Start Using GlobalDATA debug 'SetUpMenus' ~NewMenuBar2 #refIsResource,#menuBar,#0 _SetSysBar ; and make it the current system bar ~SetMenuBar #0 ~FixAppleMenu #1 ; install desk accs ~FixMenuBar ; calculate menu sizes pla ~DrawMenuBar ;And draw the bar rts End *-----------------------------------------------------------------------------* MenuDATA Data debug 'MenuDATA' MenuHandlers anop dc i'doClose' ;Close: 255 dc i'doAbout' ;About: 256 dc i'doQuit' ;Quit: 257 dc i'doOpen' ;Patch: 258 dc i'doHelp' ;Help: 259 End *-----------------------------------------------------------------------------* MainEvent Start Using TaskDATA Using GlobalDATA debug 'MainEvent' again anop ~TaskMaster #$FFFF,#TaskRecord pla asl a tax jsr (TaskHandlers,x) lda QuitFlag beq again rts End *-----------------------------------------------------------------------------* TaskDATA Data TaskRecord anop What ds 2 Message ds 4 When ds 4 Where ds 4 Modifiers ds 2 TData ds 4 dc i4'$001FFFFF' LastClickTick ds 4 ClickCount ds 2 TaskDATA2 ds 4 TaskDATA3 ds 4 TaskDATA4 ds 4 LastClickPoint ds 4 TaskHandlers anop dc i'doNull' ;NullEvt dc i'Ignore' ;MouseDownEvt dc i'Ignore' ;MouseUpEvt dc i'Ignore' ;KeyDownEvt dc i'Ignore' ;Undefined dc i'Ignore' ;AutoKeyEvt dc i'Ignore' ;UpdateEvt dc i'Ignore' ;Undefined dc i'Ignore' ;ActivateEvt dc i'Ignore' ;SwitchEvt dc i'Ignore' ;DeskAccEvt dc i'Ignore' ;DriverEvt dc i'Ignore' ;App1Evt dc i'Ignore' ;App2Evt dc i'Ignore' ;App3Evt dc i'Ignore' ;App4Evt dc i'Ignore' ;wInDesk dc i'doMenus' ;wInMenuBar dc i'Ignore' ;wClickCalled dc i'Ignore' ;wInContent dc i'Ignore' ;wInDrag dc i'Ignore' ;wInGrow dc i'doClose' ;wInGoAway dc i'Ignore' ;wInZoom dc i'Ignore' ;wInInfo dc i'doMenus' ;wInSpecial dc i'Ignore' ;wInDeskItem dc i'Ignore' ;wInFrame dc i'Ignore' ;wInactMenu dc i'Ignore' ;wClosedNDA dc i'Ignore' ;wCalledSysEdit dc i'Ignore' ;wTrackZoom dc i'Ignore' ;wHitFrame dc i'Ignore' ;wInControl dc i'Ignore' ;wInControlMenu End *-----------------------------------------------------------------------------* doNull Start Using GlobalDATA ~FrontWindow pla ora 1,s plx cmp #0 bne enableClose lda EnableFlag ;see if we're already disabled beq done ;if so, then exit ~DisableMItem #255 ; otherwise, disable close item ~SetMenuFlag #$0080,#3 ; and edit menu _DrawMenuBar ;redraw the menu bar (so Edit will be ; ;dimmed) ; lda #FALSE stz EnableFlag ;and indicate that things are disabled rts ;Exit enableClose lda EnableFlag ;see if things are already enabled bne done ;and if so, exit ~EnableMItem #255 ; enable close item ~SetMenuFlag #$FF7F,#3 ; and the edit menu _DrawMenuBar ;redraw the menu bar lda #TRUE ;and indicate that things are enabled sta EnableFlag done rts End *-----------------------------------------------------------------------------* Ignore Start rts ;Ignore all of these End *-----------------------------------------------------------------------------* doMenus Start Using GlobalDATA Using MenuDATA Using TaskDATA debug 'doMenus' lda TData ;Find out which menu it was sec ;transform into a jump table offset sbc #255 asl a tax jsr (MenuHandlers,x) ;and jump ~HiliteMenu #FALSE,TData+2 ; then unhilite it when done rts End *-----------------------------------------------------------------------------* doClose Start Using GlobalDATA Using MenuDATA debug 'doClose' ~FrontWindow bcs leave lda 1,s check if there is a front window ora 3,s bne ThereIsAWindow ~DisableMItem #255 ; disable close leave pla if there isn't, then abort close op pla clean up stack rts and return thereIsAWindow anop PullLong TempDP pointer to active window's GrafPort WordResult pei TempDP+2 pei TempDP _GetSysWFlag pla bne SystemWindow TRUE=system window pei TempDP+2 close our window pei TempDP _CloseWindow rts SystemWindow anop pei TempDP+2 pointer to window to close pei TempDP _CloseNDAbyWinPtr close system (NDA) window rts ~FrontWindow bcs leave2 lda 1,s check if there is a front window ora 3,s bne leave2 ~DisableMItem #255 ; disable close leave2 plx if there isn't, then abort close op plx clean up stack rts and return End *-----------------------------------------------------------------------------* doAbout Start Using GlobalDATA debug 'doAbout' ~AlertWindow #awPString+awResource+awButtonLayout,#0,#awAbout plx rts End *-----------------------------------------------------------------------------* doOpen Start Using FileDATA Using GlobalDATA debug 'doOpen' ; lda SavedFlag ;if the window has hever been saved, ; beq skip ;then skip this ; ~DisposeHandle Name ;dispose name and path strings ; ~DisposeHandle Path skip anop PushWord #120 whereX 640 PushWord #50 whereY 640 PushWord #refIsPointer promptRefDesc PushLong #OpenString promptRef PushLong #0 filterProcPrt PushLong #TypeList typeListPtr PushLong #SFReply replyPtr _SFGetFile2 lda SFReply ;See if we should proceed bne ok brl abort ok anop ~AlertWindow #awPString+awResource+awButtonLayout,#0,#awAreYouSure pla jne abort ; cancel (1) ; ~GetCurResourceFile lda Path ;Transfer the path to a dp location sta TempHandle lda Path+2 sta TempHandle+2 WordResult PushWord #readWriteEnable ; Read/Write file access! lda #$0000 pha pha ; pointer to resource map in memory ldy #2 ;Load the pointer to the name lda [TempHandle] clc ; adding two to skip over the length adc #2 ; of buffer word tax lda [TempHandle],y adc #0 pha phx _OpenResourceFile plx stx rFileID php pha ~DisposeHandle Name ;dispose name and path strings ~DisposeHandle Path pla plp bcc openOk brl error_mgr openOk anop ~LoadResource #rTaggedStrings,#1 plx stx TaggedH stx TempDP plx stx TaggedH+2 stx TempDP+2 bcc taggedOk ~CloseResourceFile rFileID clc lda #1 ; bad sound control panel brl error_mgr taggedOk anop ~HLock TaggedH ldy #2 ; deref it lda [TempDP] tax lda [TempDP],y stx TempDP sta TempDP+2 * get count word.. lda [TempDP] sta string_count * check if it already has strings for screen blanking and unblanking... * if a string is found for either, then refuse to patch this cdev. ldy #2 ; skip past count word keep_checking lda [TempDP],y cmp #sbScreenBlanking beq ya_patched ; already patched cmp #sbScreenUnblanking beq ya_patched iny iny lda [TempDP],y and #$FF ; get length byte sta addToY+1 iny tya clc addToY adc #0 tay dec string_count bne keep_checking beq not_patched ya_patched anop ~CloseResourceFile rFileID clc lda #2 ; already patched brl error_mgr not_patched anop ~HUnlock TaggedH * get room to house the new tagged strings ~GetHandleSize TaggedH lda 1,s sta end_offset+1 clc adc #strSize sta 1,s lda 3,s adc #0 sta 3,s PushLong TaggedH _SetHandleSize bcc handleOk pha ; ~ReleaseResource #3,#rTaggedStrings,#1 ~CloseResourceFile rFileID pla sec brl error_mgr handleOk anop lda TaggedH+2 sta TempDP+2 pha lda TaggedH sta TempDP pha _HLock ldy #2 ; deref it again lda [TempDP] tax lda [TempDP],y stx TempDP sta TempDP+2 * append our data to the end of it end_offset ldy #0 ldx #0 shortm keep_copying lda NewTaggedStrs,x sta [TempDP],y iny inx cpx #strSize blt keep_copying longm * increment string count lda [TempDP] inc a inc a sta [TempDP] * we're just about done! ~MarkResourceChange #TRUE,#rTaggedStrings,#1 ; ~ReleaseResource #3,#rTaggedStrings,#1 ~CloseResourceFile rFileID ~AlertWindow #awPString+awResource+awButtonLayout,#0,#awPatchSuccessful plx abort rts newTaggedStrs anop strSizeStart anop screenBlanking anop dc i'sbScreenBlanking' str 'Screen Blanking' screenUnblanking anop dc i'sbScreenUnblanking' str 'Screen Unblanking' strSizeEnd anop strSize equ strSizeEnd-strSizeStart rFileID ds 2 TaggedH ds 4 string_count ds 2 End *-----------------------------------------------------------------------------* FileDATA Data debug 'FileDATA' OpenString str 'Locate the Sound control panel:' TypeList anop dc i'1' number of types dc i'$8000' flags: don't match auxtype dc i'$C7' fileType dc i4'$0000' auxType SFReply anop ds 2 type ds 2 auxType ds 4 dc i'3' Name ds 4 dc i'3' Path ds 4 End *-----------------------------------------------------------------------------* error_mgr Start debug 'error_mgr' Using ErrorDATA bcs UnknownError dec a asl a asl a tax WordResult PushWord #awPString+awResource+awButtonLayout lda #0 pha pha ; sub array lda alert_ids+2,x pha lda alert_ids,x pha _AlertWindow plx rts UnknownError anop LongResult pha _HexIt PullLong asciiErr * Create an alert informing the user that there was an error. ~AlertWindow #awPString+awResource+awButtonLayout,#errorSub,#awUnknownErr plx rts End *-----------------------------------------------------------------------------* ErrorDATA Data debug 'ErrorDATA' * Alert string substitution array for error alert dialogs. errorSub dc i4'errorStr' errorStr anop dc h'04' ; length byte (pstring) asciiErr ds 4 * custom alert ids.. alert_ids anop dc i4'awBadCDev,awAlreadyPatched' End *-----------------------------------------------------------------------------* doQuit Start Using GlobalDATA debug 'doQuit' lda #TRUE ;Indicate that it's time to quit sta QuitFlag rts End *-----------------------------------------------------------------------------* doHelp Start Using HelpDATA Using GlobalDATA debug 'doHelp' LongResult ;open a window with the Help in it ldy #0 phy phy phy phy PushLong #drawContent phy phy PushWord #refIsResource PushLong #help_Window PushWord #rWindParam1 _NewWindow2 PullLong HelpPtr wait anop ; then wait for the person to hit the close box, filtering out all other events ~TaskMaster #$FFFF,#HelpTRecord pla cmp #autoKeyEvt beq noWKey cmp #keyDownEvt bne noKey lda HMessage and #$5F cmp #"W" bne noWKey lda HModifiers bit #appleKey ; beq noKey bne goClose noWKey ~SendEventToCtl #FALSE,HelpPtr,#HelpTRecord pla bra wait noKey cmp #wInGoAway bne wait goClose ~CloseWindow HelpPtr ; close Help window rts End *-----------------------------------------------------------------------------* DrawContent Start debug 'DrawContent' phb phk plb LongResult _GetPort _DrawControls plb rtl End *-----------------------------------------------------------------------------* HelpDATA Data HelpPtr ds 4 HelpTRecord anop HWhat ds 2 HMessage ds 4 HWhen ds 4 HWhere ds 4 HModifiers ds 2 HTData ds 4 dc i4'$0011A106' ;+tmControlKey' HLastClickTick ds 4 HClickCount ds 2 HTaskData2 ds 4 HTaskData3 ds 4 HTaskData4 ds 4 HLastClickPoint ds 4 End *-----------------------------------------------------------------------------* Shutdown Start debug 'Shutdown' Using GlobalDATA ~ShutDownTools #refIsHandle,SSRecRefRet ; shutdown most of the tools ~MMShutDown MasterID ~TLShutDown ; then the Tool Locator rts End *-----------------------------------------------------------------------------* \ No newline at end of file diff --git a/source/twilight/patch/old/patch.r.src b/source/twilight/patch/old/patch.r.src new file mode 100644 index 0000000..112c0e5 --- /dev/null +++ b/source/twilight/patch/old/patch.r.src @@ -0,0 +1 @@ +// -------------------------------------------------------------------- // Genesys created REZ data code // Simple Software Systems International, Inc. // APWREZ.SCG 1.2 // -------------------------------------------------------------------- #include "types.rez" // --- Control Templates resource rControlTemplate (CTLTMP_00007004, $0000) { $00007004, // ID { 0, 2,171,633}, // rect editTextControl {{ $0000, // flag $7400, // moreFlags $00000000, // refCon $27280000, // textFlags {65535,65535,65535,65535}, // indentRect $FFFFFFFF, // vertBar $0000, // vertAmount $00000000, // horzBar $0000, // horzAmount $00000000, // styleRef $0015, // textDescriptor PSTR_00000004, // textRef $00000000, // textLength $00000000, // maxChars $00000000, // maxLines $0000, // maxCharsPerLine $0000, // maxHeight 0, // colorTableRef $0000, // drawMode $00000000 // filterProcPtr }}; }; resource rControlTemplate (CTLTMP_00007005, $0000) { $00007005, // ID { 0, 2,147,555}, // rect editTextControl {{ $0000, // flag $7C00, // moreFlags $00000000, // refCon $22280000, // textFlags {65535,65535,65535,65535}, // indentRect $FFFFFFFF, // vertBar $0000, // vertAmount $00000000, // horzBar $0000, // horzAmount $00000000, // styleRef $0015, // textDescriptor PSTR_00000005, // textRef $00000000, // textLength $00000000, // maxChars $00000000, // maxLines $0000, // maxCharsPerLine $0000, // maxHeight 0, // colorTableRef $0000, // drawMode $00000000 // filterProcPtr }}; }; // --- rPString Templates resource rPString (PSTR_00000001, $C018) { "@" }; resource rPString (PSTR_00000002, $C018) { " File " }; resource rPString (PSTR_00000003, $C018) { " Edit " }; resource rPString (PSTR_000000FA, $C018) { "Undo" }; resource rPString (PSTR_000000FB, $C018) { "Cut" }; resource rPString (PSTR_000000FC, $C018) { "Copy" }; resource rPString (PSTR_000000FD, $C018) { "Paste" }; resource rPString (PSTR_000000FE, $C018) { "Clear" }; resource rPString (PSTR_000000FF, $C018) { "Close" }; resource rPString (PSTR_00000100, $C018) { "About Sound Patcher " "\$C9" }; resource rPString (PSTR_00000101, $C018) { "Quit" }; resource rPString (PSTR_00000102, $C018) { "New" }; resource rPString (PSTR_00000103, $C018) { "Patch " "\$C9" }; resource rPString (PSTR_00000104, $C018) { "Save" }; resource rPString (PSTR_00000105, $C018) { "Save As..." }; resource rPString (PSTR_00000106, $C018) { "Revert to Saved" }; resource rPString (PSTR_00000107, $C018) { "Help " "\$C9" }; resource rPString (PSTR_00000108, $C018) { "New Item" }; resource rPString (PSTR_00000109, $C018) { "Print..." }; resource rPString (PSTR_0000010A, $C018) { "Page Setup..." }; resource rPString (PSTR_00010000, $0000) { "Untitled" }; resource rPString (PSTR_00010001, $0000) { "Documentation" }; // --- Menu Bar Definitions resource rMenuBar (menuBar, $C018) { { AppleMenu, FileMenu, EditMenu }; }; // --- Menu Definitions resource rMenu (AppleMenu, $C018) { $0001, // menuID $A008, // menuFlag PSTR_00000001, { // menuTitleRef MENUITEM_00000100, MENUITEM_00000107 }; }; resource rMenu (FileMenu, $C018) { $0002, // menuID $A008, // menuFlag PSTR_00000002, { // menuTitleRef MENUITEM_00000103, MENUITEM_00000101 }; }; resource rMenu (EditMenu, $C018) { $0003, // menuID $A088, // menuFlag PSTR_00000003, { // menuTitleRef MENUITEM_000000FA, MENUITEM_000000FB, MENUITEM_000000FC, MENUITEM_000000FD, MENUITEM_000000FE }; }; // --- Menu Item Definitions resource rMenuItem (MENUITEM_000000FA, $C018) { $00FA, // itemID "Z","z", // itemChar, itemAltChar NIL, // itemCheck $8040, // itemFlag PSTR_000000FA // itemTitleRef }; resource rMenuItem (MENUITEM_000000FB, $C018) { $00FB, // itemID "X","x", // itemChar, itemAltChar NIL, // itemCheck $8000, // itemFlag PSTR_000000FB // itemTitleRef }; resource rMenuItem (MENUITEM_000000FC, $C018) { $00FC, // itemID "C","c", // itemChar, itemAltChar NIL, // itemCheck $8000, // itemFlag PSTR_000000FC // itemTitleRef }; resource rMenuItem (MENUITEM_000000FD, $C018) { $00FD, // itemID "V","v", // itemChar, itemAltChar NIL, // itemCheck $8000, // itemFlag PSTR_000000FD // itemTitleRef }; resource rMenuItem (MENUITEM_000000FE, $C018) { $00FE, // itemID "","", // itemChar, itemAltChar NIL, // itemCheck $8000, // itemFlag PSTR_000000FE // itemTitleRef }; resource rMenuItem (MENUITEM_000000FF, $0018) { $00FF, // itemID "W","w", // itemChar, itemAltChar NIL, // itemCheck $8080, // itemFlag PSTR_000000FF // itemTitleRef }; resource rMenuItem (MENUITEM_00000100, $0018) { $0100, // itemID "","", // itemChar, itemAltChar NIL, // itemCheck $8000, // itemFlag PSTR_00000100 // itemTitleRef }; resource rMenuItem (MENUITEM_00000101, $0018) { $0101, // itemID "Q","q", // itemChar, itemAltChar NIL, // itemCheck $8000, // itemFlag PSTR_00000101 // itemTitleRef }; resource rMenuItem (MENUITEM_00000102, $0018) { $0102, // itemID "N","n", // itemChar, itemAltChar NIL, // itemCheck $8000, // itemFlag PSTR_00000102 // itemTitleRef }; resource rMenuItem (MENUITEM_00000103, $0018) { $0103, // itemID "P","p", // itemChar, itemAltChar NIL, // itemCheck $8040, // itemFlag PSTR_00000103 // itemTitleRef }; resource rMenuItem (MENUITEM_00000104, $0018) { $0104, // itemID "S","s", // itemChar, itemAltChar NIL, // itemCheck $8080, // itemFlag PSTR_00000104 // itemTitleRef }; resource rMenuItem (MENUITEM_00000105, $0018) { $0105, // itemID "","", // itemChar, itemAltChar NIL, // itemCheck $80C0, // itemFlag PSTR_00000105 // itemTitleRef }; resource rMenuItem (MENUITEM_00000107, $0018) { $0106, // itemID "?","/", // itemChar, itemAltChar NIL, // itemCheck $8040, // itemFlag PSTR_00000107 // itemTitleRef }; resource rMenuItem (MENUITEM_00000109, $0018) { $0107, // itemID "P","p", // itemChar, itemAltChar NIL, // itemCheck $80C0, // itemFlag PSTR_00000109 // itemTitleRef }; resource rMenuItem (MENUITEM_0000010A, $0018) { $0108, // itemID "","", // itemChar, itemAltChar NIL, // itemCheck $8080, // itemFlag PSTR_0000010A // itemTitleRef }; // --- Window Templates resource rWindParam1 (help_Window, $0000) { $C020, // plFrame (frame bits) PSTR_00010001, // plTitle (title ID) $00000000, // p1RefCon { 0, 0, 0, 0}, // p1ZoomRect help_WColor, // p1ColorTable {$0000, $0000}, // p1YOrigin, p1XOrigin {$0000, $0000}, // p1DataHeight, p1DataWidth {$0000, $0000}, // p1MaxHeight, p1MaxWidth {$0000, $0000}, // p1VerScroll, p1HorScroll {$0000, $0000}, // p1VerPage, p1HorPage $00000000, // p1InfoText (info RefCon) $0000, // p1InfoHeight { 27, 4,197,636}, // p1Position infront, // p1Plane CTLTMP_00007004, // plControlList $0A02 // plInDesc }; // --- Window Color Templates resource rWindColor (help_WColor, $0000) { $0000, // frameColor $0F00, // titleColor $020F, // tBarColor $F0FF, // growColor $00F0 // infoColor }; // --- Tool Startup Table Templates resource rToolStartup (toolTable, $0000) { $C080, { // videoMode 3, $0300, // Miscellaneous Tools 4, $0301, // QuickDraw II 5, $0302, // Desk Manager 6, $0300, // Event Manager 7, $0200, // Scheduler 11, $0200, // Integer Math 14, $0301, // Window Manager 15, $0301, // Menu Manager 16, $0301, // Control Manager 18, $0301, // QuickDraw II Aux. 20, $0301, // LineEdit Tools 22, $0300, // Scrap Manager 23, $0301, // Standard File Tools 27, $0301, // Font Manager 28, $0301, // List Manager 30, $0100, // Resource Manager 34, $0101 // TextEdit Manager } }; // --- rAlertString Templates resource rAlertString (awAlreadyPatched, $0000) { "52~This copy of the Sound control panel already has been patched" "!~^#1" "\$00" }; resource rAlertString (awAreYouSure, $0000) { "73~Are you sure you want to patch this copy of the Sound control" " panel?" "\$0D" "The change will be permanent, but it will not harm normal operat" "ion in any way.~#1~^#0" "\$00" }; resource rAlertString (awAbout, $0000) { "53~Sound Patcher v1.0, by Jim Maricondo." "\$0D" "Copyright 1993, DigiSoft Innovations.~^#0" "\$00" }; // --- rText Templates resource rText (TXT_00000004, $0000) { "Sound Patcher v1.0" "\$0D" "by Jim Maricondo" "\$0D" "Copyright 1993, DigiSoft Innovations, All rights reserved." "\$0D" "\$0D" "This program is part of DigiSoft Innovations' Twilight" "\$CA" "II screen saver package. Twilight" "\$CA" "II and all its support files are fully copyrighted work. Please" " support the Apple II by not distributing them, so we can stay i" "n business! II Infinitum!" "\$0D" "\$0D" "Apple's System 6 Sound control panel does not normally allow you" " to assign sounds to " "\$D2" "Screen Blanking" "\$D3" " and " "\$D2" "Screen Unblanking" "\$D3" " because System 6 does not come with a screen saver. However, T" "wilight" "\$CA" "II takes advantage of these " "\$D2" "hidden" "\$D3" " features. This program makes a simple and Apple approved patch" " that allows you to use the Sound control panel to assign sounds" " to these screen saver related events." "\$0D" "\$0D" "To operate this program, select " "\$D2" "Patch " "\$C9" "\$D3" " from the File menu. Find your copy of the Sound control panel " "(usually found in the " "\$D2" "System:CDevs" "\$D3" " folder of your boot disk), and click Open. Sound Patcher will " "do the rest! After being patched, you will be able to assign be" "eps to " "\$D2" "Screen Blanking" "\$D3" " and " "\$D2" "Screen Unblanking." "\$D3" " It's that simple!" "\$0D" "\$0D" "For more help, or information on other DigiSoft products, you ca" "n contact us at:" "\$0D" "\$0D" "\$09" "DigiSoft Innovations" "\$0D" "\$09" "P.O. Box 380" "\$0D" "\$09" "Trumbull, CT 06611" "\$0D" "\$09" "(203) 375-0837" "\$0D" "\$0D" "\$09" "America Online: DigiSoft" "\$0D" "\$09" "Internet: digisoft@aol.com" "\$0D" "\$09" "Delphi: DYAJIM" "\$0D" "\$09" "GEnie: J.Maricondo1" "\$0D" }; \ No newline at end of file diff --git a/source/twilight/patch/old/shell.r320.rez b/source/twilight/patch/old/shell.r320.rez new file mode 100644 index 0000000..455371e --- /dev/null +++ b/source/twilight/patch/old/shell.r320.rez @@ -0,0 +1 @@ +/*-------------------------------------------------------------------- * Genesys created REZ data code * Simple Software Systems International, Inc. * APWREZ.SCG 1.0a1 *--------------------------------------------------------------------*/ #include "types.rez" /* Control Templates */ resource rControlTemplate (CTLTMP_00007004) { 0x00007004, /* ID */ {1, 4, 172, 317}, /* rect */ editTextControl {{ /* control type */ 0x0000, /* flag */ 0x7400, /* moreFlags */ 0x00000000, /* refCon */ 0x27380000, /* textFlags */ { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF}, /* indentRect */ 0xFFFFFFFF, /* vertBar */ 0x0000, /* vertAmount */ 0x00000000, /* horzBar */ 0x0000, /* horzAmount */ 0x00000000, /* styleRef */ 0x0015, /* textDescriptor */ PSTR_00000004, /* textRef */ 0x00000000, /* textLength */ 0x00000000, /* maxChars */ 0x00000000, /* maxLines */ 0x0000, /* maxCharsPerLine */ 0x0000, /* maxHeight */ 0, /* colorTableRef */ 0x0000, /* drawMode */ 0x00000000 /* filterProcPtr */ }}; }; resource rControlTemplate (CTLTMP_00007005) { 0x00007005, /* ID */ {0, 2, 122, 297}, /* rect */ editTextControl {{ /* control type */ 0x0000, /* flag */ 0x7C00, /* moreFlags */ 0x00000000, /* refCon */ 0x22280000, /* textFlags */ { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF}, /* indentRect */ 0xFFFFFFFF, /* vertBar */ 0x0000, /* vertAmount */ 0x00000000, /* horzBar */ 0x0000, /* horzAmount */ 0x00000000, /* styleRef */ 0x0015, /* textDescriptor */ PSTR_00000005, /* textRef */ 0x00000000, /* textLength */ 0x00000000, /* maxChars */ 0x00000000, /* maxLines */ 0x0000, /* maxCharsPerLine */ 0x0000, /* maxHeight */ 0, /* colorTableRef */ 0x0000, /* drawMode */ 0x00000000 /* filterProcPtr */ }}; }; /* rPString Templates */ resource rPString (PSTR_00000001) { "@" }; resource rPString (PSTR_00000002) { " File " }; resource rPString (PSTR_00000003) { " Edit " }; resource rPString (PSTR_000000FA) { "Undo" }; resource rPString (PSTR_000000FB) { "Cut" }; resource rPString (PSTR_000000FC) { "Copy" }; resource rPString (PSTR_000000FD) { "Paste" }; resource rPString (PSTR_000000FE) { "Clear" }; resource rPString (PSTR_000000FF) { "Close" }; resource rPString (PSTR_00000100) { "About Shell..." }; resource rPString (PSTR_00000101) { "Quit" }; resource rPString (PSTR_00000102) { "New" }; resource rPString (PSTR_00000103) { "Open..." }; resource rPString (PSTR_00000104) { "Save" }; resource rPString (PSTR_00000105) { "Save As..." }; resource rPString (PSTR_00000106) { "Revert to Saved" }; resource rPString (PSTR_00000107) { "Documentation" }; resource rPString (PSTR_00000108) { "New Item" }; resource rPString (PSTR_00000109) { "Print..." }; resource rPString (PSTR_0000010A) { "Page Setup..." }; resource rPString (PSTR_00010000) { "Untitled" }; resource rPString (PSTR_00010001) { "Documentation" }; /* Menu Bar Definitions */ resource rMenuBar (MBAR_00000001) { { MENU_00000001, MENU_00000002, MENU_00000003 }; }; /* Menu Definitions */ resource rMenu (MENU_00000001) { 0x0001, /* menuID */ 0xA008, /* menuFlag */ PSTR_00000001, /* menuTitleRef */ { MITEM_00000100, MITEM_00000107 }; }; resource rMenu (MENU_00000002) { 0x0002, /* menuID */ 0xA008, /* menuFlag */ PSTR_00000002, /* menuTitleRef */ { MITEM_00000102, MITEM_00000103, MITEM_000000FF, MITEM_00000104, MITEM_00000105, MITEM_0000010A, MITEM_00000109, MITEM_00000101 }; }; resource rMenu (MENU_00000003) { 0x0003, /* menuID */ 0xA088, /* menuFlag */ PSTR_00000003, /* menuTitleRef */ { MITEM_000000FA, MITEM_000000FB, MITEM_000000FC, MITEM_000000FD, MITEM_000000FE }; }; /* Menu Item Definitions */ resource rMenuItem (MITEM_000000FA) { 0x00FA, /* itemID */ "Z", "z", /* itemChar, itemAltChar */ 0x0000, /* itemCheck */ 0x8040, /* itemFlag */ PSTR_000000FA /* itemTitleRef */ }; resource rMenuItem (MITEM_000000FB) { 0x00FB, /* itemID */ "X", "x", /* itemChar, itemAltChar */ 0x0000, /* itemCheck */ 0x8000, /* itemFlag */ PSTR_000000FB /* itemTitleRef */ }; resource rMenuItem (MITEM_000000FC) { 0x00FC, /* itemID */ "C", "c", /* itemChar, itemAltChar */ 0x0000, /* itemCheck */ 0x8000, /* itemFlag */ PSTR_000000FC /* itemTitleRef */ }; resource rMenuItem (MITEM_000000FD) { 0x00FD, /* itemID */ "V", "v", /* itemChar, itemAltChar */ 0x0000, /* itemCheck */ 0x8000, /* itemFlag */ PSTR_000000FD /* itemTitleRef */ }; resource rMenuItem (MITEM_000000FE) { 0x00FE, /* itemID */ "", "", /* itemChar, itemAltChar */ 0x0000, /* itemCheck */ 0x8040, /* itemFlag */ PSTR_000000FE /* itemTitleRef */ }; resource rMenuItem (MITEM_000000FF) { 0x00FF, /* itemID */ "W", "w", /* itemChar, itemAltChar */ 0x0000, /* itemCheck */ 0x8080, /* itemFlag */ PSTR_000000FF /* itemTitleRef */ }; resource rMenuItem (MITEM_00000100) { 0x0100, /* itemID */ "?", "/", /* itemChar, itemAltChar */ 0x0000, /* itemCheck */ 0x8000, /* itemFlag */ PSTR_00000100 /* itemTitleRef */ }; resource rMenuItem (MITEM_00000101) { 0x0101, /* itemID */ "Q", "q", /* itemChar, itemAltChar */ 0x0000, /* itemCheck */ 0x8000, /* itemFlag */ PSTR_00000101 /* itemTitleRef */ }; resource rMenuItem (MITEM_00000102) { 0x0102, /* itemID */ "N", "n", /* itemChar, itemAltChar */ 0x0000, /* itemCheck */ 0x8000, /* itemFlag */ PSTR_00000102 /* itemTitleRef */ }; resource rMenuItem (MITEM_00000103) { 0x0103, /* itemID */ "O", "o", /* itemChar, itemAltChar */ 0x0000, /* itemCheck */ 0x8040, /* itemFlag */ PSTR_00000103 /* itemTitleRef */ }; resource rMenuItem (MITEM_00000104) { 0x0104, /* itemID */ "S", "s", /* itemChar, itemAltChar */ 0x0000, /* itemCheck */ 0x8080, /* itemFlag */ PSTR_00000104 /* itemTitleRef */ }; resource rMenuItem (MITEM_00000105) { 0x0105, /* itemID */ "", "", /* itemChar, itemAltChar */ 0x0000, /* itemCheck */ 0x80C0, /* itemFlag */ PSTR_00000105 /* itemTitleRef */ }; resource rMenuItem (MITEM_00000107) { 0x0106, /* itemID */ "D", "d", /* itemChar, itemAltChar */ 0x0000, /* itemCheck */ 0x8040, /* itemFlag */ PSTR_00000107 /* itemTitleRef */ }; resource rMenuItem (MITEM_00000109) { 0x0107, /* itemID */ "P", "p", /* itemChar, itemAltChar */ 0x0000, /* itemCheck */ 0x80C0, /* itemFlag */ PSTR_00000109 /* itemTitleRef */ }; resource rMenuItem (MITEM_0000010A) { 0x0108, /* itemID */ "", "", /* itemChar, itemAltChar */ 0x0000, /* itemCheck */ 0x8080, /* itemFlag */ PSTR_0000010A /* itemTitleRef */ }; /* Window Templates */ resource rWindParam1 (WPARAM1_00000FFD) { 0xC020, /* plFrame (frame bits) */ PSTR_00010001, /* plTitle (title ID) */ 0x00000000, /* plRefCon */ {0, 0, 0, 0}, /* plZoomRect */ WCOLOR_00000FFD, /* plColorTable */ {0x0000, 0x0000}, /* plYOrigin, plXOrigin */ {0x0000, 0x0000}, /* plDataHeight, plDataWidth */ {0x0000, 0x0000}, /* plMaxHeight, plMaxWidth */ {0x0000, 0x0000}, /* plVerScroll, plHorScroll */ {0x0000, 0x0000}, /* plVerPage, plHorPage */ 0x00000000, /* plInfoText (info RefCon) */ 0x0000, /* plInfoHeight */ {27, 2, 197, 318}, /* plPosition */ 0xFFFFFFFF, /* plPlane */ CTLTMP_00007004, /* plControlList */ 0x0A02 /* plInDesc */ }; resource rWindParam1 (WPARAM1_00000FFE) { 0xC1E0, /* plFrame (frame bits) */ PSTR_00010000, /* plTitle (title ID) */ 0x00000000, /* plRefCon */ {0, 0, 0, 0}, /* plZoomRect */ WCOLOR_00000FFE, /* plColorTable */ {0x0000, 0x0000}, /* plYOrigin, plXOrigin */ {0x00C8, 0x0280}, /* plDataHeight, plDataWidth */ {0x0000, 0x0000}, /* plMaxHeight, plMaxWidth */ {0x0005, 0x0005}, /* plVerScroll, plHorScroll */ {0x0032, 0x0032}, /* plVerPage, plHorPage */ 0x00000000, /* plInfoText (info RefCon) */ 0x0000, /* plInfoHeight */ {57, 12, 165, 308}, /* plPosition */ 0xFFFFFFFF, /* plPlane */ CTLTMP_00007005, /* plControlList */ 0x0A02 /* plInDesc */ }; /* Window Color Templates */ resource rWindColor (WCOLOR_00000FFD) { 0x0000, /* frameColor */ 0x0F00, /* titleColor */ 0x020F, /* tBarColor */ 0xF0FF, /* growColor */ 0x00F0 /* infoColor */ }; resource rWindColor (WCOLOR_00000FFE) { 0x0000, /* frameColor */ 0x0FF0, /* titleColor */ 0x020F, /* tBarColor */ 0xF0FF, /* growColor */ 0x00F0 /* infoColor */ }; /* Tool Startup Table Templates */ resource rToolStartup (TSTART_00000002) { 0xC000, /* videoMode */ { 1, 0x0300, /* Tool Locator */ 2, 0x0300, /* Memory Manager */ 3, 0x0300, /* Miscellaneous Tools */ 4, 0x0301, /* QuickDraw II */ 5, 0x0302, /* Desk Manager */ 6, 0x0300, /* Event Manager */ 11, 0x0200, /* Integer Math */ 14, 0x0301, /* Window Manager */ 15, 0x0301, /* Menu Manager */ 16, 0x0301, /* Control Manager */ 18, 0x0301, /* QuickDraw II Aux. */ 19, 0x0300, /* Print Manager */ 20, 0x0301, /* LineEdit Tools */ 21, 0x0301, /* Dialog Manager */ 22, 0x0300, /* Scrap Manager */ 23, 0x0301, /* Standard File Tools */ 27, 0x0301, /* Font Manager */ 28, 0x0301, /* List Manager */ 30, 0x0100, /* Resource Manager */ 34, 0x0101 /* TextEdit Manager */ } }; /* rAlertString Templates */ resource rAlertString (ALERT_0000000E) { "33~Shell v2.0" "\x0D" "by Jonah Stich" "\x0D" "\xA9" "1990 Bad Luck Software~^ Ok " }; /* rText Templates */ resource rText (TXT_00000004) { "Shell v2.0" "\x0D" "by Jonah Stich" "\x0D" "\xA9" "1990, Bad Luck Software" "\x0D" "\x0D" "NOTE: This is a utility intended for developers and people inter" "ested in programming the GS using Assembly and Resources. It is" " probably of absolutely no interest to the general public. " "\x0D" "\x0D" "WARNING: Although the Save and Save as functions in the File men" "u work, they don't write anything to the file they create. This " "means that opening a file and saving it again will erase the fil" "e, so be careful." "\x0D" "\x0D" "This is the second version of my " "\xD4" "shell" "\xD5" " program. This program starts up all the standard tools, create" "s a menu bar, and handles most of the standard menu choices. Us" "ing it can dramatically speed up development time" "\xD1" "simply add the application specific routines" "\xD1" "no more worrying about writing the startup and shutdown code. Th" "anks to SSSi" "\xD5" "s Genesys" "\xAA" " for helping to create the resource fork of this program. As a" "lways, donations to the cause are appreciated but not required. " " Send comments, suggestions, bug reports, and anything else to:" "\x0D" "\x0D" "\x09" "Jonah Stich" "\x0D" "\x09" "6 Lafayette West" "\x0D" "\x09" "Princeton, NJ 08540" "\x0D" "\x0D" "\x09" "America Online: JonahS" "\x0D" "\x09" "InterNet: jonah@amos.ucsd.edu" "\x0D" "\x09" "GEnie: J.STICH1" "\x0D" "\x09" "PHS BBS [(609) 924-7168;1200]: Jonah Stich (User #4)" }; resource rText (TXT_00000005) { " " }; \ No newline at end of file diff --git a/source/twilight/patch/old/shell.sys16 b/source/twilight/patch/old/shell.sys16 new file mode 100644 index 0000000..e197869 Binary files /dev/null and b/source/twilight/patch/old/shell.sys16 differ diff --git a/source/twilight/patch/patch.asm b/source/twilight/patch/patch.asm new file mode 100644 index 0000000..6454e45 --- /dev/null +++ b/source/twilight/patch/patch.asm @@ -0,0 +1,736 @@ + + KEEP patch.d + mcopy patch.mac + copy patch.equ + copy 13:ainclude:e16.memory + copy 13:ainclude:e16.types + copy 13:ainclude:e16.window + copy 13:ainclude:e16.event + copy 13:ainclude:e16.resources + copy 13:ainclude:e16.misctool + copy 13:ainclude:e16.gsos + copy 22:dsdb.equ +*-----------------------------------------------------------------------------* +TRUE gequ 1 +FALSE gequ 0 + +TempHandle gequ <0 +TempPtr gequ TempHandle+4 +TempDP gequ TempPtr+4 + +MaxFSTLen gequ 32 ; Maximum filename length supported +*-----------------------------------------------------------------------------* +Patcher Start + kind $1000 + Using GlobalDATA + debug 'Patcher' + + copy 22:dsdb.asm + + phk + plb + jsr Startup ;Set things up + jsr MainEvent ;do the main program + jsr Shutdown ;then shut them down again + + _QUIT QuitParms ;And quit + + End +*-----------------------------------------------------------------------------* +GlobalDATA Data + +QuitParms anop + dc i4'0' + dc i'0' + +MasterID ds 2 ;UserID +MyID ds 2 ;auxiliary UserID +QuitFlag dc i'0' +EnableFlag dc i'$FFFF' ;wether the edit menu is enabled + +SSRecRefRet ds 4 ;returned by StartUpTools + +NewPtr ds 4 ;The pointer to window's grafport + + End +*-----------------------------------------------------------------------------* +Startup Start + Using GlobalDATA + Using FileDATA + debug 'Startup' + + ~TLStartUp ;Start the Tool Locator + + ~MMStartUp + PullWord MasterID + ora #$0100 ;And create an aux ID + sta MyID ; for getting memory with + + ~StartUpTools MasterID,#refIsResource,#toolTable + PullLong SSRecRefRet + + jsr SetUpMenus ;And draw the menu + + ~InitCursor ;Show the arrow cursor + rts + + End +*-----------------------------------------------------------------------------* +SetUpMenus Start + Using GlobalDATA + debug 'SetUpMenus' + + ~NewMenuBar2 #refIsResource,#menuBar,#0 + _SetSysBar ; and make it the current system bar + + ~SetMenuBar #0 + + ~FixAppleMenu #1 ; install desk accs + + ~FixMenuBar ; calculate menu sizes + pla + + ~DrawMenuBar ;And draw the bar + rts + + End +*-----------------------------------------------------------------------------* +MenuDATA Data + debug 'MenuDATA' + +MenuHandlers anop + dc i'doClose' ;Close: 255 + dc i'doAbout' ;About: 256 + dc i'doQuit' ;Quit: 257 + dc i'doPatch' ;Patch: 258 + dc i'doHelp' ;Help: 259 + + End +*-----------------------------------------------------------------------------* +MainEvent Start + Using TaskDATA + Using GlobalDATA + debug 'MainEvent' + + jsr doPatch + +again anop + ~TaskMaster #$FFFF,#TaskRecord + pla + asl a + tax + jsr (TaskHandlers,x) + lda QuitFlag + beq again + rts + + End +*-----------------------------------------------------------------------------* +TaskDATA Data + +TaskRecord anop +What ds 2 +Message ds 4 +When ds 4 +Where ds 4 +Modifiers ds 2 +TData ds 4 + dc i4'$001FFFFF' +LastClickTick ds 4 +ClickCount ds 2 +TaskDATA2 ds 4 +TaskDATA3 ds 4 +TaskDATA4 ds 4 +LastClickPoint ds 4 + +TaskHandlers anop + dc i'doNull' ;NullEvt + dc i'Ignore' ;MouseDownEvt + dc i'Ignore' ;MouseUpEvt + dc i'Ignore' ;KeyDownEvt + dc i'Ignore' ;Undefined + dc i'Ignore' ;AutoKeyEvt + dc i'Ignore' ;UpdateEvt + dc i'Ignore' ;Undefined + dc i'Ignore' ;ActivateEvt + dc i'Ignore' ;SwitchEvt + dc i'Ignore' ;DeskAccEvt + dc i'Ignore' ;DriverEvt + dc i'Ignore' ;App1Evt + dc i'Ignore' ;App2Evt + dc i'Ignore' ;App3Evt + dc i'Ignore' ;App4Evt + dc i'Ignore' ;wInDesk + dc i'doMenus' ;wInMenuBar + dc i'Ignore' ;wClickCalled + dc i'Ignore' ;wInContent + dc i'Ignore' ;wInDrag + dc i'Ignore' ;wInGrow + dc i'doClose' ;wInGoAway + dc i'Ignore' ;wInZoom + dc i'Ignore' ;wInInfo + dc i'doMenus' ;wInSpecial + dc i'Ignore' ;wInDeskItem + dc i'Ignore' ;wInFrame + dc i'Ignore' ;wInactMenu + dc i'Ignore' ;wClosedNDA + dc i'Ignore' ;wCalledSysEdit + dc i'Ignore' ;wTrackZoom + dc i'Ignore' ;wHitFrame + dc i'Ignore' ;wInControl + dc i'Ignore' ;wInControlMenu + + End +*-----------------------------------------------------------------------------* +doNull Start + Using GlobalDATA + + ~FrontWindow + pla + ora 1,s + plx + cmp #0 + bne enableClose + + lda EnableFlag ;see if we're already disabled + beq done ;if so, then exit + + ~DisableMItem #255 ; otherwise, disable close item + + ~SetMenuFlag #$0080,#3 ; and edit menu + + _DrawMenuBar ;redraw the menu bar (so Edit will be +; ;dimmed) +; lda #FALSE + stz EnableFlag ;and indicate that things are disabled + rts ;Exit + +enableClose lda EnableFlag ;see if things are already enabled + bne done ;and if so, exit + + ~EnableMItem #255 ; enable close item + + ~SetMenuFlag #$FF7F,#3 ; and the edit menu + + _DrawMenuBar ;redraw the menu bar + + lda #TRUE ;and indicate that things are enabled + sta EnableFlag + +done rts + + End +*-----------------------------------------------------------------------------* +Ignore Start + + rts ;Ignore all of these + + End +*-----------------------------------------------------------------------------* +doMenus Start + Using GlobalDATA + Using MenuDATA + Using TaskDATA + debug 'doMenus' + + lda TData ;Find out which menu it was + sec ;transform into a jump table offset + sbc #255 + asl a + tax + jsr (MenuHandlers,x) ;and jump + + ~HiliteMenu #FALSE,TData+2 ; then unhilite it when done + rts + + End +*-----------------------------------------------------------------------------* +doClose Start + Using GlobalDATA + Using MenuDATA + debug 'doClose' + + ~FrontWindow + bcs leave + lda 1,s check if there is a front window + ora 3,s + bne ThereIsAWindow + ~DisableMItem #255 ; disable close +leave pla if there isn't, then abort close op + pla clean up stack + rts and return + +thereIsAWindow anop + PullLong TempDP pointer to active window's GrafPort + + WordResult + pei TempDP+2 + pei TempDP + _GetSysWFlag + pla + bne SystemWindow TRUE=system window + + pei TempDP+2 close our window + pei TempDP + _CloseWindow + rts + +SystemWindow anop + pei TempDP+2 pointer to window to close + pei TempDP + _CloseNDAbyWinPtr close system (NDA) window + rts + + ~FrontWindow + bcs leave2 + lda 1,s check if there is a front window + ora 3,s + bne leave2 + ~DisableMItem #255 ; disable close +leave2 plx if there isn't, then abort close op + plx clean up stack + rts and return + + End +*-----------------------------------------------------------------------------* +doAbout Start + Using GlobalDATA + debug 'doAbout' + + ~AlertWindow #awPString+awResource+awButtonLayout,#0,#awAbout + plx + rts + + End +*-----------------------------------------------------------------------------* +doPatch Start + Using FileDATA + Using GlobalDATA + debug 'doPatch' + +; lda SavedFlag ;if the window has hever been saved, +; beq skip ;then skip this + +; ~DisposeHandle Name ;dispose name and path strings +; ~DisposeHandle Path + +;skip anop + + _GetNameGS p_getName + + _GetDevNumberGS pGetDevNumber + + lda pGetDevNumber_devNum + sta pDInfo_devNum + + _DInfoGS pDInfo + + _VolumeGS pVolume + + lda pVolume_fileSysID + cmp #appleShareFSID + beq GoAShare ; skip setting the path + + _SetPrefixGS pSPfx + +GoAShare anop + PushWord #120 whereX 640 + PushWord #50 whereY 640 + PushWord #refIsPointer promptRefDesc + PushLong #OpenString promptRef + PushLong #0 filterProcPrt + PushLong #TypeList typeListPtr + PushLong #SFReply replyPtr + _SFGetFile2 + + lda SFReply ;See if we should proceed + bne ok + brl abort + +ok anop +; ~GetCurResourceFile + + lda Path ;Transfer the path to a dp location + sta TempHandle + lda Path+2 + sta TempHandle+2 + + WordResult + PushWord #readWriteEnable ; Read/Write file access! + lda #$0000 + pha + pha ; pointer to resource map in memory + ldy #2 ;Load the pointer to the name + lda [TempHandle] + clc ; adding two to skip over the length + adc #2 ; of buffer word + tax + lda [TempHandle],y + adc #0 + pha + phx + _OpenResourceFile + plx + stx rFileID + php + pha + ~DisposeHandle Name ;dispose name and path strings + ~DisposeHandle Path + pla + plp + bcc openOk + brl error_mgr + +openOk anop + + ~LoadResource #rTaggedStrings,#1 + plx + stx TaggedH + stx TempDP + plx + stx TaggedH+2 + stx TempDP+2 + bcc taggedOk + ~CloseResourceFile rFileID + clc + lda #1 ; bad sound control panel + brl error_mgr + +taggedOk anop + +* are you sure? + + ~AlertWindow #awPString+awResource+awButtonLayout,#0,#awAreYouSure + pla + beq sureThing ; patch (0) +; ; cancel (1) + + ~CloseResourceFile rFileID + brl abort + +sureThing anop + ~HLock TaggedH + + ldy #2 ; deref it + lda [TempDP] + tax + lda [TempDP],y + stx TempDP + sta TempDP+2 + +* get count word.. + + lda [TempDP] + sta string_count + +* check if it already has strings for screen blanking and unblanking... +* if a string is found for either, then refuse to patch this cdev. + + ldy #2 ; skip past count word +keep_checking lda [TempDP],y + cmp #sbScreenBlanking + beq ya_patched ; already patched + cmp #sbScreenUnblanking + beq ya_patched + iny + iny + lda [TempDP],y + and #$FF ; get length byte + sta addToY+1 + iny + tya + clc +addToY adc #0 + tay + dec string_count + bne keep_checking + beq not_patched + +ya_patched anop + ~CloseResourceFile rFileID + clc + lda #2 ; already patched + brl error_mgr + +not_patched anop + + ~HUnlock TaggedH + +* get room to house the new tagged strings + + ~GetHandleSize TaggedH + lda 1,s + sta end_offset+1 + clc + adc #strSize + sta 1,s + lda 3,s + adc #0 + sta 3,s + PushLong TaggedH + _SetHandleSize + bcc handleOk + pha +; ~ReleaseResource #3,#rTaggedStrings,#1 + ~CloseResourceFile rFileID + pla + sec + brl error_mgr + +handleOk anop + + lda TaggedH+2 + sta TempDP+2 + pha + lda TaggedH + sta TempDP + pha + _HLock + + ldy #2 ; deref it again + lda [TempDP] + tax + lda [TempDP],y + stx TempDP + sta TempDP+2 + +* append our data to the end of it + +end_offset ldy #0 + ldx #0 + shortm +keep_copying lda NewTaggedStrs,x + sta [TempDP],y + iny + inx + cpx #strSize + blt keep_copying + longm + +* increment string count + + lda [TempDP] + inc a + inc a + sta [TempDP] + +* we're just about done! + + ~MarkResourceChange #TRUE,#rTaggedStrings,#1 + +; ~ReleaseResource #3,#rTaggedStrings,#1 + ~CloseResourceFile rFileID + + ~AlertWindow #awPString+awResource+awButtonLayout,#0,#awPatchSuccessful + plx + +abort rts + +newTaggedStrs anop +strSizeStart anop +screenBlanking anop + dc i'sbScreenBlanking' + str 'Screen Blanking' +screenUnblanking anop + dc i'sbScreenUnblanking' + str 'Screen Unblanking' +strSizeEnd anop +strSize equ strSizeEnd-strSizeStart + +rFileID ds 2 +TaggedH ds 4 +string_count ds 2 + + End +*-----------------------------------------------------------------------------* +FileDATA Data + debug 'FileDATA' + +OpenString str 'Locate the Sound control panel:' + +TypeList anop + dc i'1' number of types + dc i'$8000' flags: don't match auxtype + dc i'$C7' fileType + dc i4'$0000' auxType + +SFReply anop + ds 2 +type ds 2 +auxType ds 4 + dc i'3' +Name ds 4 + dc i'3' +Path ds 4 + +p_getName GetNameRecGS curName +curName C1Result MaxFSTLen +pGetDevNumber DevNumRecGS (curName_textLen,0) +pDInfo DInfoRecGS (0,bootDevName,0,0,0,0,0,0) +bootDevName C1Result 40 +pVolume VolumeRecGS (bootDevName_textLen,curName,0,0,0,0,0,0) +pSPfx PrefixRecGS (8,CDevPfx) +CDevPfx GSStr '*:System:CDevs' + + End +*-----------------------------------------------------------------------------* +error_mgr Start + debug 'error_mgr' + Using ErrorDATA + + bcs UnknownError + dec a + asl a + asl a + tax + WordResult + PushWord #awPString+awResource+awButtonLayout + lda #0 + pha + pha ; sub array + lda alert_ids+2,x + pha + lda alert_ids,x + pha + _AlertWindow + plx + rts + +UnknownError anop + LongResult + pha + _HexIt + PullLong asciiErr + +* Create an alert informing the user that there was an error. + + ~AlertWindow #awPString+awResource+awButtonLayout,#errorSub,#awUnknownErr + plx + rts + + End +*-----------------------------------------------------------------------------* +ErrorDATA Data + debug 'ErrorDATA' + +* Alert string substitution array for error alert dialogs. + +errorSub dc i4'errorStr' +errorStr anop + dc h'04' ; length byte (pstring) +asciiErr ds 4 + +* custom alert ids.. + +alert_ids anop + dc i4'awBadCDev,awAlreadyPatched' + + End +*-----------------------------------------------------------------------------* +doQuit Start + Using GlobalDATA + debug 'doQuit' + + lda #TRUE ;Indicate that it's time to quit + sta QuitFlag + + rts + + End +*-----------------------------------------------------------------------------* +doHelp Start + Using HelpDATA + Using GlobalDATA + debug 'doHelp' + + LongResult ;open a window with the Help in it + ldy #0 + phy + phy + phy + phy + PushLong #drawContent + phy + phy + PushWord #refIsResource + PushLong #help_Window + PushWord #rWindParam1 + _NewWindow2 + PullLong HelpPtr + +wait anop + +; then wait for the person to hit the close box, filtering out all other events + + ~TaskMaster #$FFFF,#HelpTRecord + pla + cmp #autoKeyEvt + beq noWKey + cmp #keyDownEvt + bne noKey + lda HMessage + and #$5F + cmp #"W" + bne noWKey + lda HModifiers + bit #appleKey +; beq noKey + bne goClose +noWKey ~SendEventToCtl #FALSE,HelpPtr,#HelpTRecord + pla + bra wait + +noKey cmp #wInGoAway + bne wait + +goClose ~CloseWindow HelpPtr ; close Help window + rts + + End +*-----------------------------------------------------------------------------* +DrawContent Start + debug 'DrawContent' + + phb + phk + plb + LongResult + _GetPort + _DrawControls + plb + rtl + + End +*-----------------------------------------------------------------------------* +HelpDATA Data + +HelpPtr ds 4 + +HelpTRecord anop +HWhat ds 2 +HMessage ds 4 +HWhen ds 4 +HWhere ds 4 +HModifiers ds 2 +HTData ds 4 + dc i4'$0011A106' ;+tmControlKey' +HLastClickTick ds 4 +HClickCount ds 2 +HTaskData2 ds 4 +HTaskData3 ds 4 +HTaskData4 ds 4 +HLastClickPoint ds 4 + + End +*-----------------------------------------------------------------------------* +Shutdown Start + debug 'Shutdown' + Using GlobalDATA + + ~ShutDownTools #refIsHandle,SSRecRefRet ; shutdown most of the tools + ~MMShutDown MasterID + ~TLShutDown ; then the Tool Locator + rts + + End +*-----------------------------------------------------------------------------* \ No newline at end of file diff --git a/source/twilight/patch/patch.equ b/source/twilight/patch/patch.equ new file mode 100644 index 0000000..ee90c60 --- /dev/null +++ b/source/twilight/patch/patch.equ @@ -0,0 +1,19 @@ + +menuBar GEQU $00000001 + +AppleMenu GEQU $00000001 +FileMenu GEQU $00000002 +EditMenu GEQU $00000003 + +help_Window GEQU $00000FFD + +help_WColor GEQU $00000FFD + +toolTable GEQU $00000002 + +awAlreadyPatched gequ 1 +awAreYouSure gequ 2 +awAbout gequ 3 +awUnknownErr gequ 4 +awBadCDev gequ 5 +awPatchSuccessful gequ 6 diff --git a/source/twilight/patch/patch.mac b/source/twilight/patch/patch.mac new file mode 100644 index 0000000..4a0c1a2 --- /dev/null +++ b/source/twilight/patch/patch.mac @@ -0,0 +1,634 @@ + MACRO +&lab _DrawMenuBar +&lab ldx #$2A0F + jsl $E10000 + MEND + MACRO +&lab _SetSysBar +&lab ldx #$120F + jsl $E10000 + MEND + MACRO +&lab _QUIT ¶ms +&lab jsl $E100A8 + dc i2"$29" + dc i4"¶ms" + MEND + MACRO +&lab _SFGetFile2 +&lab ldx #$0E17 + jsl $E10000 + MEND + MACRO +&lab _CloseWindow +&lab ldx #$0B0E + jsl $E10000 + MEND + MACRO +&lab _NewWindow2 +&lab ldx #$610E + jsl $E10000 + MEND + MACRO +&lab pulllong &addr1,&addr2 +&lab ANOP + AIF C:&addr1=0,.a + AIF C:&addr2=0,.b + LCLC &C +&C AMID &addr1,1,1 + AIF "&C"="[",.zeropage + pullword &addr1 + sta &addr2 + pullword &addr1+2 + sta &addr2+2 + MEXIT +.a + pullword + pullword + MEXIT +.b + pullword &addr1 + pullword &addr1+2 + MEXIT +.zeropage + ldy #&addr2 + pullword &addr1,y + ldy #&addr2+2 + pullword &addr1,y + MEND + 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 str &string +&lab dc i1'L:&string',C'&string' + MEND + macro +&lab ~FixAppleMenu &menuID +&lab ph2 &menuID + Tool $1E05 + mend + macro +&lab ~MMStartUp +&lab WordResult + Tool $0202 + mend + macro +&lab ~MMShutDown &userID +&lab ph2 &userID + Tool $0302 + mend + macro +&lab ~DisposeHandle &theHandle +&lab ph4 &theHandle + Tool $1002 + mend + macro +&lab ~DrawMenuBar +&lab Tool $2A0F + mend + macro +&lab ~FixMenuBar +&lab WordResult + Tool $130F + mend + macro +&lab ~HiliteMenu &hiliteFlag,&menuID +&lab ph2 &hiliteFlag + ph2 &menuID + Tool $2C0F + mend + macro +&lab ~NewMenuBar2 &refDesc,&menuBarTRef,&windowPtr +&lab LongResult + ph2 &refDesc + ph4 &menuBarTRef + ph4 &windowPtr + Tool $430F + mend + macro +&lab ~SetMenuFlag &newValue,&menuID +&lab ph2 &newValue + ph2 &menuID + Tool $1F0F + mend + macro +&lab ~InitCursor +&lab Tool $CA04 + mend + macro +&lab ~TLStartUp +&lab Tool $0201 + mend + macro +&lab ~TLShutDown +&lab Tool $0301 + mend + macro +&lab ~ShutDownTools &startStopRefDesc,&startStopRef +&lab ph2 &startStopRefDesc + ph4 &startStopRef + Tool $1901 + mend + macro +&lab ~AlertWindow &alertFlags,&subStrPtr,&alertStrRef +&lab WordResult + ph2 &alertFlags + ph4 &subStrPtr + ph4 &alertStrRef + Tool $590E + mend + macro +&lab ~CloseWindow &windowPtr +&lab ph4 &windowPtr + Tool $0B0E + mend + macro +&lab ~FrontWindow +&lab LongResult + Tool $150E + mend + macro +&lab ~TaskMaster &eventMask,&taskRecPtr +&lab WordResult + ph2 &eventMask + ph4 &taskRecPtr + Tool $1D0E + mend + macro +&lab Tool &number +&lab ldx #&number + jsl $E10000 + mend + macro +&lab ph2 &addr,&offset +&lab anop + lclc &char +&char amid "&addr",1,1 + aif "&char"="@",.accumulator + aif "&char"="*",.smartmacros + aif "&char"="#",.immediate + aif "&char"="<",.directPage + aif "&char"="[",.zeropage + aif C:&offset=0,.nooffset + aif "&offset"="s",.stack + lda &addr,&offset + pha + mexit +.nooffset + lda &addr + pha + mexit +.stack + lda &addr,s + pha + mexit +.smartmacros + mexit +.accumulator + pha + mexit +.directPage +&addr amid &addr,2,L:&addr-1 + pei &addr + mexit +.immediate +&addr amid &addr,2,L:&addr-1 + pea &addr + mexit +.zeropage + aif C:&offset<>0,.zeroPageOff + lda &addr + pha + mexit +.zeroPageOff + aif "&offset"="X",.zeroPageReg + aif "&offset"="Y",.zeroPageReg + aif "&offset"="x",.zeroPageReg + aif "&offset"="y",.zeroPageReg + ldy #&offset + lda &addr,y + pha + mexit +.zeroPageReg + lda &addr,&offset + pha + mend + macro +&lab ph4 &addr,&offset +&lab anop + lclc &char +&char amid &addr,1,1 + aif "&char"="@",.registers + aif "&char"="*",.smartmacros + aif "&char"="#",.immediate + aif "&char"="<",.directPage + aif "&char"="[",.zeropage + aif c:&offset=0,.nooffset + aif "&offset"="s",.stack +.yesoffset + lda &addr+2,&offset + pha + lda &addr,&offset + pha + mexit +.nooffset + lda &addr+2 + pha + lda &addr + pha + mexit +.stack + lda &addr+2,s + pha + lda &addr,s + pha + mexit +.registers + phy + phx + mexit +.smartmacros + mexit +.immediate +&addr amid &addr,2,L:&addr-1 + pea +(&addr)|-16 + pea &addr + mexit +.directPage +&addr amid &addr,2,L:&addr-1 + pei &addr+2 + pei &addr + mexit +.zeroPage + aif C:&offset<>0,.zeroPageOffset + ldy #2 + lda &addr,y + pha + lda &addr + pha + mexit +.zeroPageOffset + aif "&offset"="X",.zeroPageRegX + aif "&offset"="Y",.zeroPageRegY + aif "&offset"="x",.zeroPageRegX + aif "&offset"="y",.zeroPageRegY + ldy #&offset+2 + lda &addr,y + pha + ldy #&offset + lda &addr,y + pha + mexit +.zeroPageRegX + lda &addr,&offset + tay + inx + inx + lda &addr,&offset + pha + phy + mexit +.zeroPageRegY + lda &addr,&offset + tax + iny + iny + lda &addr,&offset + pha + phx + mend + MACRO +&lab WordResult +&lab phd + MEND + MACRO +&lab LongResult +&lab phd + phd + MEND + macro +&lab ~StartUpTools &userID,&startStopRefDesc,&startStopRef +&lab LongResult + ph2 &userID + ph2 &startStopRefDesc + ph4 &startStopRef + Tool $1801 + mend + macro +&lab ~SetMenuBar &barHandle +&lab ph4 &barHandle + Tool $390F + mend + MACRO +&lab _DrawControls +&lab ldx #$1010 + jsl $E10000 + MEND + MACRO +&lab _CloseNDAbyWinPtr +&lab ldx #$1C05 + jsl $E10000 + MEND + MACRO +&lab _GetPort +&lab ldx #$1C04 + jsl $E10000 + MEND + MACRO +&lab _GetSysWFlag +&lab ldx #$4C0E + jsl $E10000 + MEND + macro +&lab ~DisableMItem &itemNum +&lab ph2 &itemNum + Tool $310F + mend + macro +&lab ~EnableMItem &itemNum +&lab ph2 &itemNum + Tool $300F + mend + macro +&lab ~SendEventToCtl &targetOnlyFlag,&ctlWindowPtr,&eTaskRecPtr +&lab WordResult + ph2 &targetOnlyFlag + ph4 &ctlWindowPtr + ph4 &eTaskRecPtr + Tool $2910 + mend + MACRO +&lab _HexIt +&lab ldx #$2A0B + jsl $E10000 + MEND + MACRO +&lab _HLock +&lab ldx #$2002 + jsl $E10000 + MEND + MACRO +&lab _SetHandleSize +&lab ldx #$1902 + jsl $E10000 + MEND + MACRO +&lab longm +&lab ANOP + rep #%00100000 + longa on + MEND + MACRO +&lab shortm +&lab ANOP + sep #%00100000 + longa off + MEND + MACRO +&lab _AlertWindow +&lab ldx #$590E + jsl $E10000 + MEND + MACRO +&lab _OpenResourceFile +&lab ldx #$0A1E + jsl $E10000 + MEND + macro +&lab ~GetHandleSize &theHandle +&lab LongResult + ph4 &theHandle + Tool $1802 + mend + macro +&lab ~HLock &theHandle +&lab ph4 &theHandle + Tool $2002 + mend + macro +&lab ~HUnlock &theHandle +&lab ph4 &theHandle + Tool $2202 + mend + macro +&lab ~CloseResourceFile &fileID +&lab ph2 &fileID + Tool $0B1E + mend + macro +&lab ~LoadResource &resourceType,&resourceID +&lab LongResult + ph2 &resourceType + ph4 &resourceID + Tool $0E1E + mend + macro +&lab ~MarkResourceChange &changeFlag,&resourceType,&resourceID +&lab ph2 &changeFlag + ph2 &resourceType + ph4 &resourceID + Tool $101E + 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 + macro +&lab C1Result &size,&text +&lab anop +&lab._bufsize dw &size + aif c:&text=0,.nodefault +&lab._textlen dw l:&text +&lab._text dc c"&text" + ds &size-4-(l:&text) + mexit +.nodefault +&lab._textlen dw +&lab._text ds &size-$04 + mend + macro +&lab dw &location +&lab anop + aif c:&location<>0,.exists + ds 2 + mexit +.exists + dc i2'&location' + mend + MACRO +&lab _VolumeGS ¶ms +&lab jsl $E100A8 + dc i2"$2008" + dc i4"¶ms" + MEND + macro +&lab GetNameRecGS ¶meters + lcla &pCount +&pCount seta c:¶meters +&lab anop +&lab._pCount dc i2'&pCount' +&lab._dataBuffer dc i4'¶meters(1)' + mend + macro +&lab VolumeRecGS ¶meters + lcla &pCount +&pCount seta c:¶meters +&lab anop +&lab._pCount dc i2'&pCount' +&lab._devName dc i4'¶meters(1)' +&lab._volName dc i4'¶meters(2)' + aif c:¶meters=2,.exit +&lab._totalBlocks dc i4'¶meters(3)' + aif c:¶meters=3,.exit +&lab._freeBlocks dc i4'¶meters(4)' + aif c:¶meters=4,.exit +&lab._fileSysID dc i2'¶meters(5)' + aif c:¶meters=5,.exit +&lab._blockSize dc i2'¶meters(6)' + aif c:¶meters=6,.exit +&lab._characteristics dc i2'¶meters(7)' + aif c:¶meters=7,.exit +&lab._deviceID dc i2'¶meters(8)' +.exit + mend + macro +&lab DevNumRecGS ¶meters + lcla &pCount +&pCount seta c:¶meters +&lab anop +&lab._pCount dc i2'&pCount' +&lab._devName dc i4'¶meters(1)' +&lab._devNum dc i2'¶meters(2)' + mend + macro +&lab DInfoRecGS ¶meters + lcla &pCount +&pCount seta c:¶meters +&lab anop +&lab._pCount dc i2'&pCount' +&lab._devNum dc i2'¶meters(1)' +&lab._devName dc i4'¶meters(2)' + aif c:¶meters=2,.exit +&lab._characteristics dc i2'¶meters(3)' + aif c:¶meters=3,.exit +&lab._totalBlocks dc i4'¶meters(4)' + aif c:¶meters=4,.exit +&lab._slotNum dc i2'¶meters(5)' + aif c:¶meters=5,.exit +&lab._unitNum dc i2'¶meters(6)' + aif c:¶meters=6,.exit +&lab._version dc i2'¶meters(7)' + aif c:¶meters=7,.exit +&lab._deviceID dc i2'¶meters(8)' + aif c:¶meters=8,.exit +&lab._headLink dc i2'¶meters(9)' + aif c:¶meters=9,.exit +&lab._forwardLink dc i2'¶meters(10)' + aif c:¶meters=10,.exit +&lab._extendedDIBPtr dc i4'¶meters(11)' +.exit + mend + MACRO +&lab _DInfoGS ¶ms +&lab jsl $E100A8 + dc i2"$202C" + dc i4"¶ms" + MEND + MACRO +&lab _GetDevNumberGS ¶ms +&lab jsl $E100A8 + dc i2"$2020" + dc i4"¶ms" + MEND + MACRO +&lab GSStr &GSstring +&lab dc i2'L:&GSstring',C'&GSstring' + MEND + MACRO +&lab _GetNameGS ¶ms +&lab jsl $E100A8 + dc i2"$2027" + dc i4"¶ms" + MEND + MACRO +&lab _SetPrefixGS ¶ms +&lab jsl $E100A8 + dc i2"$2009" + dc i4"¶ms" + MEND + macro +&lab PrefixRecGS ¶meters + lcla &pCount +&pCount seta c:¶meters +&lab anop +&lab._pCount dc i2'&pCount' +&lab._prefixNum dc i2'¶meters(1)' +&lab._prefix dc i4'¶meters(2)' + mend diff --git a/source/twilight/patch/patch.rez b/source/twilight/patch/patch.rez new file mode 100644 index 0000000..35730e3 --- /dev/null +++ b/source/twilight/patch/patch.rez @@ -0,0 +1,441 @@ + +#include "types.rez" + +// --- type $8004 defines +#define CTLTMP_00007004 $00007004 +// --- type $8006 defines +#define PSTR_00000001 $00000001 +#define PSTR_00000002 $00000002 +#define PSTR_00000003 $00000003 +#define PSTR_000000FA $000000FA +#define PSTR_000000FB $000000FB +#define PSTR_000000FC $000000FC +#define PSTR_000000FD $000000FD +#define PSTR_000000FE $000000FE +#define PSTR_000000FF $000000FF +#define PSTR_00000100 $00000100 +#define PSTR_00000101 $00000101 +#define PSTR_00000103 $00000103 +#define PSTR_00000107 $00000107 +#define PSTR_00010000 $00010000 +#define PSTR_00010001 $00010001 +// --- type $8008 defines +#define menuBar $00000001 +// --- type $8009 defines +#define AppleMenu $00000001 +#define FileMenu $00000002 +#define EditMenu $00000003 +// --- type $800A defines +#define MENUITEM_000000FA $000000FA +#define MENUITEM_000000FB $000000FB +#define MENUITEM_000000FC $000000FC +#define MENUITEM_000000FD $000000FD +#define MENUITEM_000000FE $000000FE +#define MENUITEM_000000FF $000000FF +#define MENUITEM_00000100 $00000100 +#define MENUITEM_00000101 $00000101 +#define MENUITEM_00000103 $00000103 +#define MENUITEM_00000105 $00000105 +#define MENUITEM_00000107 $00000107 +// --- type $800E defines +#define help_Window $00000FFD +// --- type $8010 defines +#define help_WColor $00000FFD +// --- type $8013 defines +#define toolTable $00000002 +// --- type $8015 defines +#define awAlreadyPatched 1 +#define awAreYouSure 2 +#define awAbout 3 +#define awUnknownErr 4 +#define awBadCDev 5 +#define awPatchSuccessful 6 +// --- type $8016 defines +#define TXT_00000004 $00000004 + +// --- Version resource + +resource rVersion (1) { + {1,0,0,release,0}, // Version + verUS, // US Version + "Twilight\$CAII\$AA Sound Patcher", // program's name + "Copyright 1993, DigiSoft Innovations.\n" // copyright notice + "All rights reserved." +}; + +// --- Control Templates + +resource rControlTemplate (CTLTMP_00007004) { + 1, // ID + { 0, 2,171,633}, // rect + editTextControl {{ + $0000, // flag + $7400, // moreFlags + $00000000, // refCon + $27280000, // textFlags + {65535,65535,65535,65535}, // indentRect + $FFFFFFFF, // vertBar + $0000, // vertAmount + $00000000, // horzBar + $0000, // horzAmount + $00000000, // styleRef + $0015, // textDescriptor + TXT_00000004, // textRef + $00000000, // textLength + $00000000, // maxChars + $00000000, // maxLines + $0000, // maxCharsPerLine + $0000, // maxHeight + 0, // colorTableRef + $0000, // drawMode + $00000000 // filterProcPtr + }}; +}; + +// --- rPString Templates + +resource rPString (555) { + " Help " +}; + +resource rPString (PSTR_00000001, $C018) { + "@" +}; + +resource rPString (PSTR_00000002, $C018) { + " File " +}; + +resource rPString (PSTR_00000003, $C018) { + " Edit " +}; + +resource rPString (PSTR_000000FA, $C018) { + "Undo" +}; + +resource rPString (PSTR_000000FB, $C018) { + "Cut" +}; + +resource rPString (PSTR_000000FC, $C018) { + "Copy" +}; + +resource rPString (PSTR_000000FD, $C018) { + "Paste" +}; + +resource rPString (PSTR_000000FE, $C018) { + "Clear" +}; + +resource rPString (PSTR_000000FF, $C018) { + "Close" +}; + +resource rPString (PSTR_00000100, $C018) { + "About Sound Patcher \$C9" +}; + +resource rPString (PSTR_00000101, $C018) { + "Quit" +}; + +resource rPString (PSTR_00000103, $C018) { + "Patch " + "\$C9" +}; + +resource rPString (PSTR_00000107, $C018) { + "Help \$C9" +}; + +// --- Menu Bar Definitions + +resource rMenuBar (menuBar, $C018) { + { + AppleMenu, + FileMenu, + EditMenu + }; +}; + +// --- Menu Definitions + +resource rMenu (AppleMenu, $C018) { + $0001, // menuID + $A008, // menuFlag + PSTR_00000001, { // menuTitleRef + MENUITEM_00000100, + MENUITEM_00000107 + }; +}; + +resource rMenu (FileMenu, $C018) { + $0002, // menuID + $A008, // menuFlag + PSTR_00000002, { // menuTitleRef + MENUITEM_00000103, + MENUITEM_000000FF, + MENUITEM_00000101 + }; +}; + +resource rMenu (EditMenu, $C018) { + $0003, // menuID + $A088, // menuFlag + PSTR_00000003, { // menuTitleRef + MENUITEM_000000FA, + MENUITEM_000000FB, + MENUITEM_000000FC, + MENUITEM_000000FD, + MENUITEM_000000FE + }; +}; + +// --- Menu Item Definitions + +resource rMenuItem (MENUITEM_000000FA, $C018) { + $00FA, // itemID + "Z","z", // itemChar, itemAltChar + NIL, // itemCheck + $8040, // itemFlag + PSTR_000000FA // itemTitleRef +}; + +resource rMenuItem (MENUITEM_000000FB, $C018) { + $00FB, // itemID + "X","x", // itemChar, itemAltChar + NIL, // itemCheck + $8000, // itemFlag + PSTR_000000FB // itemTitleRef +}; + +resource rMenuItem (MENUITEM_000000FC, $C018) { + $00FC, // itemID + "C","c", // itemChar, itemAltChar + NIL, // itemCheck + $8000, // itemFlag + PSTR_000000FC // itemTitleRef +}; + +resource rMenuItem (MENUITEM_000000FD, $C018) { + $00FD, // itemID + "V","v", // itemChar, itemAltChar + NIL, // itemCheck + $8000, // itemFlag + PSTR_000000FD // itemTitleRef +}; + +resource rMenuItem (MENUITEM_000000FE, $C018) { + $00FE, // itemID + "","", // itemChar, itemAltChar + NIL, // itemCheck + $8000, // itemFlag + PSTR_000000FE // itemTitleRef +}; + +resource rMenuItem (MENUITEM_000000FF, $0018) { + $00FF, // itemID --CLOSE + "W","w", // itemChar, itemAltChar + NIL, // itemCheck + $8080, // itemFlag + PSTR_000000FF // itemTitleRef +}; + +resource rMenuItem (MENUITEM_00000100, $0018) { + $0100, // itemID --ABOUT + "","", // itemChar, itemAltChar + NIL, // itemCheck + $8000, // itemFlag + PSTR_00000100 // itemTitleRef +}; + +resource rMenuItem (MENUITEM_00000101, $0018) { + $0101, // itemID --QUIT + "Q","q", // itemChar, itemAltChar + NIL, // itemCheck + $8000, // itemFlag + PSTR_00000101 // itemTitleRef +}; + +resource rMenuItem (MENUITEM_00000103, $0018) { + $0102, // itemID --PATCH + "P","p", // itemChar, itemAltChar + NIL, // itemCheck + $8040, // itemFlag + PSTR_00000103 // itemTitleRef +}; + +resource rMenuItem (MENUITEM_00000107, $0018) { + $0103, // itemID --HELP + "?","/", // itemChar, itemAltChar + NIL, // itemCheck + $8040, // itemFlag + PSTR_00000107 // itemTitleRef +}; + +// --- Window Templates + +resource rWindParam1 (help_Window) { + $C020, // plFrame (frame bits) + 555, // plTitle (title ID) + $00000000, // p1RefCon + { 0, 0, 0, 0}, // p1ZoomRect + help_WColor, // p1ColorTable + {$0000, $0000}, // p1YOrigin, p1XOrigin + {$0000, $0000}, // p1DataHeight, p1DataWidth + {$0000, $0000}, // p1MaxHeight, p1MaxWidth + {$0000, $0000}, // p1VerScroll, p1HorScroll + {$0000, $0000}, // p1VerPage, p1HorPage + $00000000, // p1InfoText (info RefCon) + $0000, // p1InfoHeight + { 27, 4,197,636}, // p1Position + infront, // p1Plane + CTLTMP_00007004, // plControlList + $0A02 // plInDesc +}; + +// --- Window Color Templates + +resource rWindColor (help_WColor) { + $0000, // frameColor + $0F00, // titleColor + $020F, // tBarColor + $F0FF, // growColor + $00F0 // infoColor +}; + +// --- Tool Startup Table Templates + +resource rToolStartup (toolTable) { + $C080, { // videoMode + 1, $0300, // Tool Locator + 2, $0300, // Memory Manager + 3, $0300, // Miscellaneous Tools + 4, $0301, // QuickDraw II + 5, $0302, // Desk Manager + 6, $0300, // Event Manager + 7, $0200, // Scheduler + 11, $0200, // Integer Math + 14, $0301, // Window Manager + 15, $0301, // Menu Manager + 16, $0301, // Control Manager + 18, $0301, // QuickDraw II Aux. + 20, $0301, // LineEdit Tools + 21, $0301, // Dialog Manager + 22, $0300, // Scrap Manager + 23, $0301, // Standard File Tools + 27, $0301, // Font Manager + 28, $0301, // List Manager + 30, $0100, // Resource Manager + 34, $0101 // TextEdit Manager + } +}; + +// --- rAlertString Templates + +resource rAlertString (awAlreadyPatched) { + "52~This copy of the Sound control panel already has been patched" + "!~^#1" + "\$00" +}; + +resource rAlertString (awAreYouSure) { + "73~Are you sure you want to patch this copy of the Sound control" + " panel?\n" + "The change will be permanent, but it will not harm normal operat" + "ion in any way.~Patch~^#1" + "\$00" +}; + +resource rAlertString (awAbout) { + "53~Sound Patcher v1.0, by Jim Maricondo.\n" + "Copyright 1993, DigiSoft Innovations.\n" + "All rights reserved.~^#0" + "\$00" +}; + +resource rAlertString (awUnknownErr) { + "52~Unknown error. Operation aborted. ($*0)~^#1" + "\$00" +}; + +resource rAlertString (awBadCDev) { + "52~This is not Apple\$D5s " + "Sound control panel or is an unrecognized version.~^#1" + "\$00" +}; + +resource rAlertString (awPatchSuccessful) { + "63~The patch has been applied successfully.\n" + "You may now assign beeps to \$D2Screen Blanking\$D3" + " and \$D2Screen Unblanking\$D3" + " using the Sound Control Panel.~^#0" + "\$00" +}; + +// --- rText Templates + +resource rText (TXT_00000004) { + "Sound Patcher v1.0\n" + "by Jim Maricondo\n" + "Copyright 1993, DigiSoft Innovations, All rights reserved." + "\n\n" + "This program is part of DigiSoft Innovations\$D5 Twilight\$CA" + "II\$AA screen saver package. Twilight\$CA" + "II and all its support files are fully copyrighted work. Please" + " support the Apple II by not distributing them, so we can stay i" + "n business! II Infinitum!" + "\n\n" + "Apple\$D5s System 6 Sound control panel does not normally allow you" + " to assign sounds to " + "\$D2Screen Blanking\$D3 and \$D2Screen Unblanking\$D3" + " because System 6 does not come with a screen saver. However, T" + "wilight\$CAII takes advantage of these \$D2hidden\$D3" + " features. This program makes a simple Apple approved patch" + " that allows you to use the Sound control panel to assign sounds" + " to these screen saver related events." + "\n\n" + "To operate this program, select " + "\$D2Patch \$C9\$D3" + " from the File menu. Find your copy of the Sound control panel " + "(usually found in the " + "\$D2System:CDevs\$D3" + " folder of your boot disk), and click Open. Sound Patcher will " + "do the rest! After being patched, you will be able to assign be" + "eps to \$D2Screen Blanking\$D3 and \$D2Screen Unblanking.\$D3" + " It\$D5s that simple!" + "\n\n" + "For more help, or information on other DigiSoft products, you ca" + "n contact us at:" + "\n\n" + "\tDigiSoft Innovations\n" + "\tP.O. Box 380\n" + "\tTrumbull, CT 06611\n" + "\t(203) 375-0837" + "\n\n" + "\tAmerica Online: DigiSoft\n" + "\tInternet: digisoft@aol.com\n" + "\tDelphi: DYAJIM\n" + "\tGEnie: DYA\n" +}; + +resource rComment (1) { + "\n" + "Sound Patcher.\n" + "Part of DYA\$D5s Twilight\$CAII\$AA Screen Saver Project.\n" + "\n" + "Twilight\$CAII, the ultimate screen saver for your Apple IIgs. " + "Support us, so we can support you, and make Twilight\$CAII even better " + "for the future!\n" + "\n" + "Twilight\$CAII requires System 6. Special thanks to all the fantastic " + "people who helped in the creation of this product.\n" + "\n" + "Twilight II: A quality DYA product, from DigiSoft Innovations. " + "Support the II: do not distribute any parts of Twilight II! " + "II Infinitum!" +// "\n" +}; diff --git a/source/twilight/phantom/Effects/Blank b/source/twilight/phantom/Effects/Blank new file mode 100644 index 0000000..460048e Binary files /dev/null and b/source/twilight/phantom/Effects/Blank differ diff --git a/source/twilight/phantom/Effects/Blankers.Docs b/source/twilight/phantom/Effects/Blankers.Docs new file mode 100644 index 0000000..61c2184 --- /dev/null +++ b/source/twilight/phantom/Effects/Blankers.Docs @@ -0,0 +1,52 @@ +Scott's Phantasm Modules +Version 1.0 +by Scott Walker +written in Orca/C + +What is it? +This archive contains five different modules for the Phantasm screen saver CDev. + Phantasm is part of the Signature package put out by Q-Labs. + +How to install it +1) Open up the Control Panel NDA and open the Phantasm CDev. +2) Click the Add Button. +3) Select the blanker module you wish to install. +4) Type in the name you wish it to have. +5) The name should now appear selected in the list of blankers. + +The Modules + Bounce - A ball bounces in a parabolic path around the screen. Color changes + every 12 bounces or so. + Trifly - Three triangles colored red, yellow, and blue bounce around the screen. + Wormz - A colored worm is generated until it goes off the screen. Then it + it changes color and stars again. + Stars - 75 stars are displayed in blue,gray,white, and light blue then are + shifted randomly about the screen. + Snake - A gradient colored snake bounces around the screen. Color changes about + every 30 seconds. + +Notes +1) Sorry about the lack of options, but I tried for five hours and I still can't get + the @#&%# things to work! However, I still think the modules turned out well. +2) Also, Bounce and Trifly have noticble flicker (I'm not much of an animation + person). This is reduced, however, if you have a ZipGS or TranswarpGS. + +Other Important Stuff +Hopefully I'll release updates when I figure out how to include options. + +This is FREEWARE! Stick anywhere you want as long as you don't a) change it, +b) say you wrote it, or c) sell it. + +Send any comments to: +AOL : Scottwalk1 +Internet : dante@carina.unm.edu + cs1walker@apsicc.aps.edu + +Thanks to D. Proni for releasing the info on how to program Phantasm modules, +and to GS+ Magazine for printing it. (Hint: if you haven't picked up a copy of this +magazine, do it!) + +Apple II forever!! + + + \ No newline at end of file diff --git a/source/twilight/phantom/Effects/Bounce b/source/twilight/phantom/Effects/Bounce new file mode 100644 index 0000000..6195ef9 Binary files /dev/null and b/source/twilight/phantom/Effects/Bounce differ diff --git a/source/twilight/phantom/Effects/Cosmic.Worm b/source/twilight/phantom/Effects/Cosmic.Worm new file mode 100644 index 0000000..781508d Binary files /dev/null and b/source/twilight/phantom/Effects/Cosmic.Worm differ diff --git a/source/twilight/phantom/Effects/DesktopShuffle b/source/twilight/phantom/Effects/DesktopShuffle new file mode 100644 index 0000000..1bfa5a2 Binary files /dev/null and b/source/twilight/phantom/Effects/DesktopShuffle differ diff --git a/source/twilight/phantom/Effects/LINES.1 b/source/twilight/phantom/Effects/LINES.1 new file mode 100644 index 0000000..f6da266 Binary files /dev/null and b/source/twilight/phantom/Effects/LINES.1 differ diff --git a/source/twilight/phantom/Effects/LINES.2 b/source/twilight/phantom/Effects/LINES.2 new file mode 100644 index 0000000..9fa8cdd Binary files /dev/null and b/source/twilight/phantom/Effects/LINES.2 differ diff --git a/source/twilight/phantom/Effects/LINES.3 b/source/twilight/phantom/Effects/LINES.3 new file mode 100644 index 0000000..3f619a4 Binary files /dev/null and b/source/twilight/phantom/Effects/LINES.3 differ diff --git a/source/twilight/phantom/Effects/Linear.Lines b/source/twilight/phantom/Effects/Linear.Lines new file mode 100644 index 0000000..0aa3676 Binary files /dev/null and b/source/twilight/phantom/Effects/Linear.Lines differ diff --git a/source/twilight/phantom/Effects/Lines.4 b/source/twilight/phantom/Effects/Lines.4 new file mode 100644 index 0000000..66da365 Binary files /dev/null and b/source/twilight/phantom/Effects/Lines.4 differ diff --git a/source/twilight/phantom/Effects/Lines.Dox.Teach b/source/twilight/phantom/Effects/Lines.Dox.Teach new file mode 100644 index 0000000..910c9ef --- /dev/null +++ b/source/twilight/phantom/Effects/Lines.Dox.Teach @@ -0,0 +1,15 @@ + +-------------------------------------------+ + | | + | | + | Cool Lines #2-4 | + | by Tim Buchheim | + | | + | | + +-------------------------------------------+ + + + +These are numbers two, three, and four in the ÒCool LinesÓ series of screen savers by Tim Buchheim. They were written for the Phantasmª screen saver which is part of the Signature GS package from Quality computers, but should also work under Twilight IIª. While they aren't the worldÕs best, they are public domain, so do what you want with them. I only ask that you distribute them with this file. (Or the docs from another ÒCool LinesÓ effect, I just want people to see my name! :) Have fun with them. + + -Tim Buchheim Ô¹Õ + (GEnie: T.BUCHHEIM) diff --git a/source/twilight/phantom/Effects/Lines.Dox.Text b/source/twilight/phantom/Effects/Lines.Dox.Text new file mode 100644 index 0000000..b221a3d --- /dev/null +++ b/source/twilight/phantom/Effects/Lines.Dox.Text @@ -0,0 +1,11 @@ + ------------------------------------------- + Cool Lines #2-4 + by Tim Buchheim + ------------------------------------------- + + + +These are numbers two, three, and four in the "Cool Lines" series of screen savers by Tim Buchheim. They were written for the Phantasm screen saver which is part of the Signature GS package from Quality computers, but should also work under Twilight II. While they aren't the world's best, they are public domain, so do what you want with them. I only ask that you distribute them with this file. (Or the docs from another "Cool Lines" effect, I just want people to see my name! :) Have fun with them. + + -Tim Buchheim '¹' + (GEnie: T.BUCHHEIM) \ No newline at end of file diff --git a/source/twilight/phantom/Effects/MagicMolecules b/source/twilight/phantom/Effects/MagicMolecules new file mode 100644 index 0000000..6da5d98 Binary files /dev/null and b/source/twilight/phantom/Effects/MagicMolecules differ diff --git a/source/twilight/phantom/Effects/MagicSlash b/source/twilight/phantom/Effects/MagicSlash new file mode 100644 index 0000000..5e6ce2d Binary files /dev/null and b/source/twilight/phantom/Effects/MagicSlash differ diff --git a/source/twilight/phantom/Effects/Message b/source/twilight/phantom/Effects/Message new file mode 100644 index 0000000..20229f0 Binary files /dev/null and b/source/twilight/phantom/Effects/Message differ diff --git a/source/twilight/phantom/Effects/Raindrops b/source/twilight/phantom/Effects/Raindrops new file mode 100644 index 0000000..32573e1 Binary files /dev/null and b/source/twilight/phantom/Effects/Raindrops differ diff --git a/source/twilight/phantom/Effects/RectangRiot b/source/twilight/phantom/Effects/RectangRiot new file mode 100644 index 0000000..bdfbd0e Binary files /dev/null and b/source/twilight/phantom/Effects/RectangRiot differ diff --git a/source/twilight/phantom/Effects/SlimySlugs b/source/twilight/phantom/Effects/SlimySlugs new file mode 100644 index 0000000..a270fa5 Binary files /dev/null and b/source/twilight/phantom/Effects/SlimySlugs differ diff --git a/source/twilight/phantom/Effects/Snake b/source/twilight/phantom/Effects/Snake new file mode 100644 index 0000000..20e2ffe Binary files /dev/null and b/source/twilight/phantom/Effects/Snake differ diff --git a/source/twilight/phantom/Effects/Stars b/source/twilight/phantom/Effects/Stars new file mode 100644 index 0000000..2373df0 Binary files /dev/null and b/source/twilight/phantom/Effects/Stars differ diff --git a/source/twilight/phantom/Effects/Swirl b/source/twilight/phantom/Effects/Swirl new file mode 100644 index 0000000..9b160c0 Binary files /dev/null and b/source/twilight/phantom/Effects/Swirl differ diff --git a/source/twilight/phantom/Effects/Trifly b/source/twilight/phantom/Effects/Trifly new file mode 100644 index 0000000..435ef9e Binary files /dev/null and b/source/twilight/phantom/Effects/Trifly differ diff --git a/source/twilight/phantom/Effects/Warpspeed b/source/twilight/phantom/Effects/Warpspeed new file mode 100644 index 0000000..cad77f5 Binary files /dev/null and b/source/twilight/phantom/Effects/Warpspeed differ diff --git a/source/twilight/phantom/Effects/WebWorld b/source/twilight/phantom/Effects/WebWorld new file mode 100644 index 0000000..e0ef5f8 Binary files /dev/null and b/source/twilight/phantom/Effects/WebWorld differ diff --git a/source/twilight/phantom/Effects/Wormz b/source/twilight/phantom/Effects/Wormz new file mode 100644 index 0000000..5b99560 Binary files /dev/null and b/source/twilight/phantom/Effects/Wormz differ diff --git a/source/twilight/phantom/Effects/mondrian b/source/twilight/phantom/Effects/mondrian new file mode 100644 index 0000000..8d857d9 Binary files /dev/null and b/source/twilight/phantom/Effects/mondrian differ diff --git a/source/twilight/phantom/Effects/readme b/source/twilight/phantom/Effects/readme new file mode 100644 index 0000000..8d367ec --- /dev/null +++ b/source/twilight/phantom/Effects/readme @@ -0,0 +1,17 @@ +Here are four screen saver modules for Phantasm. +The first is a simple one, it just blanks out the screen to black. No fancy animations or stuff like that....just a plain black screen. If I get a chance I might go back and rewrite it so that it will fade to a given intensity set by the user. +The second one is a Swirl screen saver. It kinda creates spirograph type patterns. Its a bit fancier, but not by much. If you have my first version, please kill it since it contained a bug. +The third is a Linear line drawing saver; makes for interesting results. +Still pretty simple. +The forth one is a bit more bizzare.... the end result is the thing looks like +a colorful worm. + +As you can tell, I have no imagination! I have three more modules in the works, which may or may not get finished. All depends on if people want to see them or not. If you have any ideas for screen savers drop me mail or if you have any comments/complaints also feel free to drop me mail. + +Please try and keep the ideas original! I don't need a ton of people asking for Fish or Flying Toasters! (that is if I do get people asking for more, since my first release, I only got one reply! ohh joy!) + +Feel free to do what you wish with em! Use 'em, kill 'em, spead 'em around if you wish. I really don't care. + +mike@pro-calgary.cts.com or +mike@griffin.cuc.ab.ca + \ No newline at end of file diff --git a/source/twilight/phantom/makefile b/source/twilight/phantom/makefile new file mode 100644 index 0000000..94c2198 --- /dev/null +++ b/source/twilight/phantom/makefile @@ -0,0 +1,26 @@ + +# Twilight II Strobe UNIX MakeFile +# by Jim Maricondo +# v1.0 - 2/19/93 8:36pm + +# First deal with all the dfork... + +phantom.d.root: phantom.asm phantom.mac 22/t2common.equ 22/dsdb.equ + compile +w phantom.asm keep=phantom.d + +phantom.d: phantom.d.root + link +w phantom.d keep=phantom.d + +# Now work with the rfork... + +phantom.r: phantom.rez 22/t2common.rez + compile phantom.rez keep=phantom.r + +# Now put it together. + +phantom: phantom.r phantom.d + duplicate -d phantom.d phantom + duplicate -r phantom.r phantom + setfile -at $4004 -t $bc phantom -m . + duplicate phantom :jim1:system:cdevs:twilight:phantom + 22:beep diff --git a/source/twilight/phantom/phantom b/source/twilight/phantom/phantom new file mode 100644 index 0000000..4e5ded4 Binary files /dev/null and b/source/twilight/phantom/phantom differ diff --git a/source/twilight/phantom/phantom.asm b/source/twilight/phantom/phantom.asm new file mode 100644 index 0000000..9ef70a6 --- /dev/null +++ b/source/twilight/phantom/phantom.asm @@ -0,0 +1,1858 @@ + + mcopy phantom.mac + keep phantom.d + copy 22:t2common.equ +; copy 22:dsdb.equ + copy 2:ainclude:e16.control + copy 2:ainclude:e16.memory + copy 2:ainclude:e16.resources + copy 2:ainclude:e16.types + copy 2:ainclude:e16.gsos + copy 2:ainclude:e16.window + copy 2:ainclude:e16.locator +*-----------------------------------------------------------------------------* +* Inputs: +* +* |previous contents| +* |-----------------| +* | T2Result | Long - Result space. +* |-----------------| +* | T2Message | Word - Action to perform. +* |-----------------| +* | T2data1 | Long - Action specific input. +* |-----------------| +* | T2data2 | Long - Action specific input. +* |-----------------| +* | rtlAddr | 3 bytes - Return address. +* |-----------------| +* +* Outputs: +* +* |previous contents| +* |-----------------| +* | T2Result | Long - Result space. +* |-----------------| +* | rtlAddr | 3 bytes - Return address. +* |-----------------| +* +*-----------------------------------------------------------------------------* +debugSymbols gequ $F +debugBreaks gequ $C +debugCode gequ TRUE + +effectPathStrCtl gequ 4 + +* constants +PLAY gequ 1 +STOP gequ 2 +DEMO gequ 3 +CONFIGURE gequ 4 +DEMOLIMIT gequ 200 + +movePtr gequ <0 + +* Resources, ids, etc within T2.. +AlertUnknownError GEQU $07FEFFFD +T2SetupUpdateCtlID gequ $07FEFFFE ; save control in setup window +*-----------------------------------------------------------------------------* +phantom Start + kind $1000 ; no special memory + debug 'phantom' + Using MainDATA + + DefineStack +dpageptr word +dbank byte +rtlAddr block 3 +T2data2 long +T2data1 long +T2message word +T2result long + + phb + phk + plb + phd + tdc + sta OurDP + tsc + tcd + + lda action+1 + + phb ;save everything in case the blanker does + phd ;something it's not supposed to. + php + + shortm + lda >EntryPt+3 + pha + plb + longm + +action PushWord #0 ; action code + PushLong >workH ; workspace pointer + jsr makePdp + pld + lda >pModuleID + ora #$0100 + jsl EntryPt + + plp + pld + plb + rts + +EntryPt entry + jml >0 + + End +*-----------------------------------------------------------------------------* +MainDATA Data + debug 'MainDATA' + +T2Actions anop + dc i'doMake' ; MakeT2 procedure 0 + dc i'doSave' ; SaveT2 procedure 1 + dc i'doBlank' ; BlankT2 procedure 2 + dc i'doLoadSetup' ; LoadSetupT2 procedure 3 + dc i'doUnloadSetup' ; UnloadSetupT2 procedure 4 + dc i'doKill' ; KillT2 procedure 5 + dc i'doHit' ; HitT2 procedure 6 + +OldX ds 2 +OldY ds 2 +OldStat ds 2 + +RealError ds 2 +ErrorMsg ds 2 + +pathH ds 4 +workH ds 4 + +MasterID ds 2 +MyID ds 2 +pModuleID ds 2 + +WindPtr ds 4 +RezFileID ds 2 +OurDP ds 2 +temp ds 4 +PathHandle ds 4 +;PicHandle ds 4 +;ErrorHandle ds 4 + +pathname ds 4 + +rEffectPath str 'Phantom Path' ; rezName of wstring path rez + +tempH ds 4 +ZeroString str '' + +NamePStrP ds 4 ; pointer to module's filename pstr + +filenameH ds 4 + +OurPort ds $AA + + End +*-----------------------------------------------------------------------------* +DisPatch start + kind $1000 ; no special memory + debug 'DisPatch' + Using MainDATA + +disptch1 equ $E10000 +disptch2 equ $E10004 + + longa on + longi on + +* Assumes entry in long mode via JSL + phb + phk + plb + php ;(to fill out an even 2 words) + phk + per MyPatch ;3 byte address of your patch + jsr Install + pla + pla ;Remove our longword from the stack + + plb + rtl + + +RemoveIt entry + debug 'RemoveIt!' + + longa on + longi on + +* Assumes entry in long mode via JSL + phb + phk + plb + php ;(to fill out an even 2 words) + phk + per MyPatch ;3 byte address of your patch + jsr Remove + pla + pla ;Remove our longword from the stack + + plb + rtl + + +Install entry + debug 'Install' + +oldPatch equ 1 +rtszp equ oldPatch+4 +zpsize equ rtszp-oldPatch +newPatch equ rtszp+2 + + tsc + sec + sbc #zpsize + tcs + phd ;Allocate some Direct-page space + tcd ; off the stack + php + sei ;Important: don't leave interrupts on! + + ldy #6 +loop1 tyx ;Copy the current two tool vectors + lda >disptch1,x ; into our patch's header section + sta [newPatch],y + dey + dey + bpl loop1 + + lda >disptch1+3 + and #$00FF + sta oldPatch+2 ;Set up address of previous patch (or + pha ; the actual dispatcher if no other + lda >disptch1+1 ; patches are installed) + sec + sbc #$0011 + sta oldPatch + pha + jsr ChkPatch ;Anyone else patching the Dispatcher? + plx + plx + bcs First ;->No, we're the first! + + ldy #8 +loop2 lda [oldPatch],y ;Set up the linked-list + sta [newPatch],y + iny + iny + cpy #$F + blt loop2 + bra PatchIt + +First ldy #$E ;Set up the linked-list + ldx #6 +loop3 lda >disptch1,x + sta [newPatch],y + dey + dey + dex + dex + bpl loop3 + +PatchIt clc ;Now patch us into the Dispatch vectors + lda newPatch + adc #$0015 + sta newPatch + xba + and #$FF00 + ora #$005C + sta >disptch2 + lda newPatch+1 + sta >disptch2+2 + sec + lda newPatch + sbc #$0004 + sta newPatch + xba + and #$FF00 + ora #$005C + sta >disptch1 + lda newPatch+1 + sta >disptch1+2 + + plp ;Re-enable interrupts + pld ; and put everything back + tsc + clc + adc #zpsize + tcs + clc + rts + + +Remove entry + debug 'Remove' + +patchDsp equ 1 +prevHdr equ patchDsp+5 +zprts equ prevHdr+4 +sizezp equ zprts-patchDsp +patchRmv equ zprts+2 + + tsc + sec + sbc #sizezp + tcs + phd + tcd ;Allocate DP space off the stack + php + sei ;Leave the phone off the hook + + pei patchRmv+2 + pei patchRmv + jsr ChkPatch ;Make sure it's a valid patch + plx + plx + bcs goerrRmv ;->Uh-oh, something bad's going on... + + lda patchRmv + adc #$0011 ;(carry is clear after BCS fails) + sta patchDsp+1 + lda patchRmv+2 + sta patchDsp+3 + lda patchDsp + and #$FF00 + ora #$005C + sta patchDsp + cmp >disptch1 + bne notFirst + lda >disptch1+2 + cmp patchDsp+2 + bne notFirst + + ldy #6 +nxt1 tyx + lda [patchRmv],y + sta >disptch1,x + dey + dey + bpl nxt1 + bra alldone + +notFirst sec + lda >disptch1+1 + sbc #$0011 + sta prevHdr + lda >disptch1+3 + and #$00FF + sta prevHdr+2 +nxt2 pei prevHdr+2 + pei prevHdr + jsr ChkPatch + plx + plx +goerrRmv bcs errRmv + lda [prevHdr] + cmp patchDsp + bne nope + ldy #2 + lda [prevHdr],y + cmp patchDsp+2 + bne nope + + ldy #6 +nxt3 lda [patchRmv],y + sta [prevHdr],y + dey + dey + bpl nxt3 + bra alldone + +nope ldy #2 + lda [prevHdr],y + tax + lda [prevHdr] + sta prevHdr + stx prevHdr+2 + sec + lda prevHdr+1 + sbc #$11 + sta prevHdr + lda prevHdr+3 + and #$00FF + sta prevHdr+2 + bra nxt2 + +alldone ldy #0 +getout plp + pld + tsc + clc + adc #sizezp + tcs + tya + cmp #0001 ;Check for errors, set carry if so + rts +errRmv ldy #1 + bra getout + + + +ChkPatch entry + debug 'ChkPatch' + +dprts equ 1 +nwPtchAd equ dprts+2 + + tsc + phd + tcd + lda nwPtchAd+2 + and #$FF00 + bne BadPatch + ldy #0 +check jsr chkValue ;Check 1st JML + bne BadPatch + cpy #0016 ;Checked 4 JML's? + bcc check + + lda [nwPtchAd],y ;Get rtl/phk opcodes + cmp #$4B6B + bne BadPatch + iny + lda [nwPtchAd],y ;Get phk/pea opcodes + cmp #$F44B + bne BadPatch + clc + lda nwPtchAd + adc #$000F + ldy #$13 + cmp [nwPtchAd],y + bne BadPatch + pld + clc + rts + +BadPatch pld + sec + rts + +chkValue lda [nwPtchAd],y + iny + iny + iny + iny + and #$00FF + cmp #$005C + rts + + + +MyPatch anop ;Header for a Dispatcher patch +next1vct jml next1vct +next2vct jml next2vct +disp1vct jml disp1vct +disp2vct jml disp2vct +anRTL rtl + +NewDsp1 phk ;Don't change these two lines; they + pea anRTL-1 ; are required by the patch protocol + +NewDsp2 anop ;Your patch code goes here! + + cpx #$0e1e ; loadResource + beq LoadResource +; cpx #$1604 +; beq SetMasterSCB + cpx #$1905 ; systemTask + bne next2vct + +************************************* +SystemTask name + +rtl1_st equ 1 +rtl2_st equ rtl1_st+3 + + phb + phk + plb + +indemo entry + lda #0 + beq movement ; not in demo + ~ReadMouse + pla + cmp OldStat + beq sameStat + plx + plx + bra stopIt +sameStat anop + pla + cmp OldY + beq sameY + plx + bra stopIt +sameY anop + pla + cmp OldX + bne stopIt + + shortm + lda KEYMODREG + longm + and #%11011011 ; OA, opt, shift, ctrl, repeat, keypad + bne stopIt + + shortm + lda KBD + longm + and #$80 + beq return_now + bra stopIt + +movement entry + lda >0 + beq return_now + +stopIt anop + lda #STOP + jsr Phantasm + +return_now anop + plb + lda #0 ; we called waitcursor ourselves + clc ; so just return! + rtl + + + ago .past +************************************* +SetMasterSCB anop + brk + lda 5,s + sta 5+2,s + lda 3,s + sta 3+2,s + lda 1,s + sta 1+2,s + pla + clc + rtl +.past +************************************* +LoadResource name + +rtl1_lr equ 1 +rtl2_lr equ rtl1_lr+3 +rID_lr equ rtl2_lr+3 +type_lr equ rID_lr+4 +result_lr equ type_lr+2 + + lda type_lr,s + cmp #rTextBlock + bne next + lda rID_lr+2,s + bne next + lda rID_lr,s + cmp #$360 + bne next + + PushWord #t2GetBuffers + PushWord #stopAfterOne+sendToName + PushLong #toT2String ; target + phy + phy ; dataIn (none) + PushLong #getBufferDataOut ; dataOut + _SendRequest + +; shortm +; lda SHADOW +; longm +; bit #$08 +; bne shadow_off +; +; lda >buffer01 +; sta result_lr,s +; lda >buffer01+2 +; sta result_lr+2,s +; bra strip6_return +; +;shadow_off anop + lda >bufferE1 + sta result_lr,s + lda >bufferE1+2 + sta result_lr+2,s + +strip6_return lda 5,s + sta 5+6,s + lda 3,s + sta 3+6,s + lda 1,s + sta 1+6,s + pla + pla + pla + clc + rtl + +next brl next2vct + +toT2String str 'DYA~Twilight II~' + +getBufferDataOut anop + ds 2 +bufferE1 ds 4 +buffer01 ds 4 + ds 4 ; palBuffer + + End +*-----------------------------------------------------------------------------* +doMake Start + Using MainDATA + debug 'doMake' + + lda 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 ~MMStartUp +&lab WordResult + Tool $0202 + mend + macro +&lab ~DisposeHandle &theHandle +&lab ph4 &theHandle + Tool $1002 + mend + macro +&lab ~GetNewID &idTag +&lab WordResult + ph2 &idTag + Tool $2003 + mend + macro +&lab Tool &number +&lab ldx #&number + jsl $E10000 + mend + macro +&lab ph2 &addr,&offset +&lab anop + lclc &char +&char amid "&addr",1,1 + aif "&char"="@",.accumulator + aif "&char"="*",.smartmacros + aif "&char"="#",.immediate + aif "&char"="<",.directPage + aif "&char"="[",.zeropage + aif C:&offset=0,.nooffset + aif "&offset"="s",.stack + lda &addr,&offset + pha + mexit +.nooffset + lda &addr + pha + mexit +.stack + lda &addr,s + pha + mexit +.smartmacros + mexit +.accumulator + pha + mexit +.directPage +&addr amid &addr,2,L:&addr-1 + pei &addr + mexit +.immediate +&addr amid &addr,2,L:&addr-1 + pea &addr + mexit +.zeropage + aif C:&offset<>0,.zeroPageOff + lda &addr + pha + mexit +.zeroPageOff + aif "&offset"="X",.zeroPageReg + aif "&offset"="Y",.zeroPageReg + aif "&offset"="x",.zeroPageReg + aif "&offset"="y",.zeroPageReg + ldy #&offset + lda &addr,y + pha + mexit +.zeroPageReg + lda &addr,&offset + pha + mend + macro +&lab ph4 &addr,&offset +&lab anop + lclc &char +&char amid &addr,1,1 + aif "&char"="@",.registers + aif "&char"="*",.smartmacros + aif "&char"="#",.immediate + aif "&char"="<",.directPage + aif "&char"="[",.zeropage + aif c:&offset=0,.nooffset + aif "&offset"="s",.stack +.yesoffset + lda &addr+2,&offset + pha + lda &addr,&offset + pha + mexit +.nooffset + lda &addr+2 + pha + lda &addr + pha + mexit +.stack + lda &addr+2,s + pha + lda &addr,s + pha + mexit +.registers + phy + phx + mexit +.smartmacros + mexit +.immediate +&addr amid &addr,2,L:&addr-1 + pea +(&addr)|-16 + pea &addr + mexit +.directPage +&addr amid &addr,2,L:&addr-1 + pei &addr+2 + pei &addr + mexit +.zeroPage + aif C:&offset<>0,.zeroPageOffset + ldy #2 + lda &addr,y + pha + lda &addr + pha + mexit +.zeroPageOffset + aif "&offset"="X",.zeroPageRegX + aif "&offset"="Y",.zeroPageRegY + aif "&offset"="x",.zeroPageRegX + aif "&offset"="y",.zeroPageRegY + ldy #&offset+2 + lda &addr,y + pha + ldy #&offset + lda &addr,y + pha + mexit +.zeroPageRegX + lda &addr,&offset + tay + inx + inx + lda &addr,&offset + pha + phy + mexit +.zeroPageRegY + lda &addr,&offset + tax + iny + iny + lda &addr,&offset + pha + phx + mend + MACRO +&lab killLdp +&lab pld + ply + ply + 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 + MACRO +&lab _SetCurResourceFile +&lab ldx #$111E + jsl $E10000 + MEND + MACRO +&lab pulllong &addr1,&addr2 +&lab ANOP + AIF C:&addr1=0,.a + AIF C:&addr2=0,.b + LCLC &C +&C AMID &addr1,1,1 + AIF "&C"="[",.zeropage + pullword &addr1 + sta &addr2 + pullword &addr1+2 + sta &addr2+2 + MEXIT +.a + pullword + pullword + MEXIT +.b + pullword &addr1 + pullword &addr1+2 + MEXIT +.zeropage + ldy #&addr2 + pullword &addr1,y + ldy #&addr2+2 + pullword &addr1,y + MEND + MACRO +&lab str &string +&lab dc i1'L:&string',C'&string' + MEND + MACRO + DefineStack + GBLA &DummyPC +&DummyPC SETA 1 + MEND + MACRO +&lab BYTE +&lab equ &DummyPC +&DummyPC SETA &DummyPC+1 + MEND + MACRO +&lab WORD +&lab equ &DummyPC +&DummyPC SETA &DummyPC+2 + MEXIT + MEND + MACRO +&lab LONG +&lab equ &DummyPC +&DummyPC SETA &DummyPC+4 + MEND + MACRO +&lab BLOCK &Value + AIF C:&lab=0,.skiplab +&lab equ &DummyPC +.skiplab +&DummyPC SETA &DummyPC+&Value + MEND + MACRO +&lab _SFShutDown +&lab ldx #$0317 + jsl $E10000 + MEND + MACRO +&lab _DisposeControl +&lab ldx #$0A10 + jsl $E10000 + MEND + MACRO +&lab _HideControl +&lab ldx #$0E10 + jsl $E10000 + MEND + MACRO +&lab _NewControl2 +&lab ldx #$3110 + jsl $E10000 + MEND + MACRO +&lab _PtrToHand +&lab ldx #$2802 + jsl $E10000 + MEND + MACRO +&lab _SetHandleSize +&lab ldx #$1902 + jsl $E10000 + MEND + MACRO +&lab _SFGetFile2 +&lab ldx #$0E17 + jsl $E10000 + MEND + MACRO +&lab _SFStartUp +&lab ldx #$0217 + jsl $E10000 + MEND + MACRO +&lab _CompileText +&lab ldx #$600E + jsl $E10000 + MEND + MACRO +&lab _AddResource +&lab ldx #$0C1E + jsl $E10000 + MEND + MACRO +&lab _DetachResource +&lab ldx #$181E + jsl $E10000 + MEND + MACRO +&lab _RemoveResource +&lab ldx #$0F1E + jsl $E10000 + MEND + macro +&lab ~GetCtlHandleFromID &ctlWindowPtr,&ctlID +&lab LongResult + ph4 &ctlWindowPtr + ph4 &ctlID + Tool $3010 + mend + macro +&lab ~GetHandleSize &theHandle +&lab LongResult + ph4 &theHandle + Tool $1802 + mend + macro +&lab ~HLock &theHandle +&lab ph4 &theHandle + Tool $2002 + mend + macro +&lab ~NewHandle &blockSize,&userID,&attributes,&locationPtr +&lab LongResult + ph4 &blockSize + ph2 &userID + ph2 &attributes + ph4 &locationPtr + Tool $0902 + mend + macro +&lab ~GetCurResourceFile +&lab WordResult + Tool $121E + mend + macro +&lab ~LoadResource &resourceType,&resourceID +&lab LongResult + ph2 &resourceType + ph4 &resourceID + Tool $0E1E + mend + macro +&lab ~ReleaseResource &purgeLevel,&resourceType,&resourceID +&lab ph2 &purgeLevel + ph2 &resourceType + ph4 &resourceID + Tool $171E + mend + macro +&lab ~SetCurResourceFile &fileID +&lab ph2 &fileID + Tool $111E + mend + macro +&lab ~UniqueResourceID &IDRange,&resourceType +&lab LongResult + ph2 &IDRange + ph2 &resourceType + Tool $191E + mend + macro +&lab ~UpdateResourceFile &fileID +&lab ph2 &fileID + Tool $0D1E + mend + macro +&lab ~SFStatus +&lab WordResult 0 + Tool $0617 + mend + macro +&lab ~LoadOneTool &toolNumber,&minVersion +&lab ph2 &toolNumber + ph2 &minVersion + Tool $0F01 + mend + MACRO +&lab makeDP +&lab phd + tsc + tcd + MEND + macro +&lab ~RMLoadNamedResource &rType,&namePtr +&lab LongResult + PushWord &rType + PushLong &namePtr + Tool $2C1E + mend + macro +&lab ~RMFindNamedResource &rType,&namePtr,&fileNumPtr +&lab LongResult + PushWord &rType + PushLong &namePtr + PushLong &fileNumPtr + Tool $2A1E + mend + MACRO +&lab _RMSetResourceName +&lab ldx #$2D1E + jsl $E10000 + MEND + macro +&lab ~HUnlock &theHandle +&lab ph4 &theHandle + Tool $2202 + mend + macro +&lab ~UnloadOneTool &toolNumber +&lab ph2 &toolNumber + Tool $1001 + mend + MACRO +&lab _SetHandleId +&lab ldx #$3002 + jsl $E10000 + MEND + macro +&lab ~GetCurResourceApp +&lab wordresult + Tool $141E + mend + macro +&lab handle +&lab ds 4 + mend + MACRO +&lab _GetPrefixGS ¶ms +&lab jsl $E100A8 + dc i2"$200A" + dc i4"¶ms" + MEND + MACRO +&lab _SetPrefixGS ¶ms +&lab jsl $E100A8 + dc i2"$2009" + dc i4"¶ms" + MEND + macro +&lab ~SetHandleSize &newSize,&theHandle +&lab ph4 &newSize + ph4 &theHandle + Tool $1902 + mend + macro +&lab PrefixRecGS ¶meters + lcla &pCount +&pCount seta c:¶meters +&lab anop +&lab._pCount dc i2'&pCount' +&lab._prefixNum dc i2'¶meters(1)' +&lab._prefix dc i4'¶meters(2)' + mend + MACRO +&lab _HLock +&lab ldx #$2002 + jsl $E10000 + MEND + macro +&lab ~AlertWindow &alertFlags,&subStrPtr,&alertStrRef +&lab WordResult + ph2 &alertFlags + ph4 &subStrPtr + ph4 &alertStrRef + Tool $590E + mend + macro +&lab ~InitCursor +&lab Tool $CA04 + mend + MACRO +&lab _HexIt +&lab ldx #$2A0B + jsl $E10000 + MEND + MACRO +&LAB JNE &BP +&LAB BEQ *+5 + BRL &BP + MEND + macro +&lab ~DeleteID &userID +&lab ph2 &userID + Tool $2103 + mend + macro +&lab ~HexIt &intValue +&lab LongResult + ph2 &intValue + Tool $2A0B + mend + MACRO +&LAB JEQ &BP +&LAB BNE *+5 + BRL &BP + MEND + macro +&lab ~RefreshDesktop &redrawRect +&lab ph4 &redrawRect + Tool $390E + mend + macro +&lab ~ReadMouse +&lab WordResult + WordResult + WordResult + Tool $1703 + mend + MACRO +&lab _DisposeHandle +&lab ldx #$1002 + jsl $E10000 + MEND + MACRO +&lab _HideCursor +&lab ldx #$9004 + jsl $E10000 + MEND + MACRO +&lab _ShowCursor +&lab ldx #$9104 + jsl $E10000 + MEND + MACRO +&lab _HiliteControl +&lab ldx #$1110 + jsl $E10000 + MEND + MACRO +&lab longmx +&lab ANOP + rep #%00110000 + longa on + longi on + MEND + MACRO +&lab shortmx +&lab ANOP + sep #%00110000 + longa off + longi off + MEND + MACRO +&lab _SetPort +&lab ldx #$1B04 + jsl $E10000 + MEND + macro +&lab ~ClosePort &grafPort +&lab ph4 &grafPort + Tool $1A04 + mend + macro +&lab ~GetPort +&lab LongResult + Tool $1C04 + mend + macro +&lab ~OpenPort &resultPortPtr +&lab ph4 &resultPortPtr + Tool $1804 + mend + macro +&lab ~SetPort &portPtr +&lab ph4 &portPtr + Tool $1B04 + mend + macro +&lab _SendRequest +&lab ldx #$1c01 + jsl $E10000 + mend + macro +&lab ~GetMasterSCB +&lab WordResult + Tool $1704 + mend + MACRO +&lab _SetMasterSCB +&lab ldx #$1604 + jsl $E10000 + MEND + MACRO +&lab _HandToHand +&lab ldx #$2A02 + jsl $E10000 + MEND + macro +&lab ~SetHandleId &newID,&handle +&lab WordResult + PushWord &newID + PushLong &handle + Tool $3002 + mend + macro +&lab errorbrk &op +&lab anop + aif debugCode=1,.doit + mexit +.doit + bcc *+4 + aif c:&op=1,.value + brk $BB + mexit +.value + brk &op + mend + MACRO +&lab ename +&lab entry + aif t:DebugSymbols="G",.begin + MEXIT +.begin + brl pastName&SYSCNT + dc i'$7771' + dc i1'L:&lab',c'&lab' +pastName&SYSCNT anop +.pastName + MEND diff --git a/source/twilight/phantom/phantom.rez b/source/twilight/phantom/phantom.rez new file mode 100644 index 0000000..b1f975c --- /dev/null +++ b/source/twilight/phantom/phantom.rez @@ -0,0 +1,210 @@ + +#include "types.rez" +#include "22:t2common.rez" + +// --- type $8006 defines +#define PSTR_0000000E $0000000E +#define PSTR_0000000F $0000000F +#define PSTR_00000010 $00000010 +#define PSTR_00000011 $00000011 +#define PSTR_00000012 $00000012 +#define PSTR_000000FC $000000FC + +resource rT2ModuleFlags (moduleFlags) { + fLoadSetupBoot + + fSetup, // module flags + $01, // enabled flag (unimplemented) + $0110, // minimum T2 version required + NIL, // reserved + "Phantom" // module name +}; + +// --- About text resource + +resource rTextForLETextBox2 (moduleMessage) { + TBLeftJust + TBBackColor TBColorF + TBForeColor TBColor4 + "Phantom" + TBForeColor TBColor1 + " runs all effects for the Phantasm\$AA screen saver from QLabs..\n" + "Some effects may not \$D2demo\$D3 correctly. The save button saves the " + "selected effect only." +}; + +// --- Version resource + +resource rVersion (moduleVersion) { + {1,0,0,release,0}, // Version + verUS, // US Version + "T2 Phantom Module", // program's name + "By Jim Maricondo & Derek Young\n" + "Copyright 1993, Jim Maricondo." // copyright notice +}; + +// --- About icon resource + +resource rIcon (moduleIcon) { + $8000, // kind + $0014, // height + $0016, // width + + $"F00000000000000000000F" + $"0FFFFFFFFF44FFFFFFFFF0" + $"0F00002F44FF44EE0000F0" + $"0F0EEEC4FF4FF447EEE0F0" + $"0F0EEE4FFFCFFFC7EEE0F0" + $"0F0EE4FFF4444FC4EEE0F0" + $"0F0EE4F44440444F4EE0F0" + $"0F0EE4F4F4444FFF4EE0F0" + $"0F0EEEC7FF44FFF4EEE0F0" + $"0F0EEEC4FFFC4F47EEE0F0" + $"0F0EEEE5FFFFFFFEEEE0F0" + $"0F00002F44444F200000F0" + $"0FFFFFFFFFFFFFFFFAFFF0" + $"C000000000000000000003" + $"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 (1) { + { + 1, + 2, + 3, +// 4, + 5, + 6, + }; +}; + +// --- Control Templates + +resource rControlTemplate (1) { + 1, // ID + { 62,178, 74,316}, // rect + simpleButtonControl {{ + $0000, // flag + $3002, // moreFlags + NIL, // refCon + PSTR_0000000E, // titleRef + 0, // colorTableRef + {"E","e",$0100,$0100} // key equivalents + }}; +}; + +resource rControlTemplate (2) { + 2, // ID + { 43,178, 55,318}, // rect + simpleButtonControl {{ + $0000, // flag + $3002, // moreFlags + NIL, // refCon + PSTR_0000000F, // titleRef + 0, // colorTableRef + {"C","c",$0100,$0100} // key equivalents + }}; +}; + +resource rControlTemplate (3) { + 3, // ID + { 28,178, 40,318}, // rect + simpleButtonControl {{ + $0000, // flag + $3002, // moreFlags + NIL, // refCon + PSTR_00000010, // titleRef + 0, // colorTableRef + {"D","d",$0100,$0100} // key equivalents + }}; +}; + +resource rControlTemplate (4) { + 4, // ID + { 81, 24-2,127,329}, // rect + statTextControl {{ + $0000, // flag + $1002, // moreFlags + NIL, // refCon + 1 // textRef + }}; +}; + +resource rControlTemplate (5) { + 5, // ID + { 38-4, 14, 71-4,158}, // rect + iconButtonControl {{ + $000C, // flag + $1022, // moreFlags + NIL, // refCon + moduleIcon, // iconRef + PSTR_00000011, // titleRef + NIL, // colorTableRef + $0000 // displayMode + }}; +}; + +resource rControlTemplate (6) { + 6, // ID + { 58,176, 59,320}, // rect + rectangleControl {{ + $FF01, // flag (%01 = gray pattern) + fCtlProcNotPtr, // moreFlags (required values) + NIL // refCon + }}; +}; + +// --- rPString Templates + +resource rPString (PSTR_0000000E) { + "Select Effect..." +}; + +resource rPString (PSTR_0000000F) { + "Configure" +}; + +resource rPString (PSTR_00000010) { + "Demo" +}; + +resource rPString (PSTR_00000011) { + "Phantom Options" +}; + +// --- rTextForLETextBox2 Templates + +resource rTextForLETextBox2 (1) { + TBLeftJust + TBLeftMargin "\$00\$00" + TBStyleItalic "Active\$CAEffect:" TBStylePlain " \$D2*0\$D3" +};