From e6f1db1ecf30a5524dc1b0b9d2e3edaf91d5bdb8 Mon Sep 17 00:00:00 2001 From: Antoine Vignau <34219772+antoinevignau@users.noreply.github.com> Date: Mon, 8 Jun 2020 23:06:12 +0200 Subject: [PATCH] Add files via upload --- source/twilight/nm/LedMsg.Macs | 279 ++++++++ source/twilight/nm/MiniFW2.Asm | 175 +++++ source/twilight/nm/ledmsg.rez | 233 +++++++ source/twilight/nm/ledmsg2.asm | 1 + source/twilight/nm/ledmsg2.asm.te | 442 ++++++++++++ source/twilight/nm/ledmsg2.rez.te | 55 ++ source/twilight/nm/my.source/imp.macros.s | 241 +++++++ source/twilight/nm/my.source/impulse.s | 775 ++++++++++++++++++++++ source/twilight/nm/my.source/makepdp.asm | 48 ++ source/twilight/nm/njm.t2.ver.hist | 318 +++++++++ 10 files changed, 2567 insertions(+) create mode 100644 source/twilight/nm/LedMsg.Macs create mode 100644 source/twilight/nm/MiniFW2.Asm create mode 100644 source/twilight/nm/ledmsg.rez create mode 100644 source/twilight/nm/ledmsg2.asm create mode 100644 source/twilight/nm/ledmsg2.asm.te create mode 100644 source/twilight/nm/ledmsg2.rez.te create mode 100644 source/twilight/nm/my.source/imp.macros.s create mode 100644 source/twilight/nm/my.source/impulse.s create mode 100644 source/twilight/nm/my.source/makepdp.asm create mode 100644 source/twilight/nm/njm.t2.ver.hist diff --git a/source/twilight/nm/LedMsg.Macs b/source/twilight/nm/LedMsg.Macs new file mode 100644 index 0000000..81ca645 --- /dev/null +++ b/source/twilight/nm/LedMsg.Macs @@ -0,0 +1,279 @@ + MACRO +&lab _GetCtlHandleFromID +&lab ldx #$3010 + jsl $E10000 + MEND + MACRO +&lab _GetCtlValue +&lab ldx #$1A10 + jsl $E10000 + MEND + MACRO +&lab _NewControl2 +&lab ldx #$3110 + jsl $E10000 + MEND + MACRO +&lab _SetCtlValue +&lab ldx #$1910 + jsl $E10000 + MEND + MACRO +&lab _MMStartUp +&lab ldx #$0202 + jsl $E10000 + MEND + MACRO +&lab _NewHandle +&lab ldx #$0902 + jsl $E10000 + MEND + MACRO +&lab _SysFailMgr +&lab ldx #$1503 + jsl $E10000 + MEND + MACRO +&LAB JCC &BP +&LAB BCS *+5 + BRL &BP + MEND + MACRO +&LAB LONG &A,&B + LCLB &I + LCLB &M +&A AMID &A,1,1 +&M SETB ("&A"="M").OR.("&A"="m") +&I SETB ("&A"="I").OR.("&A"="i") + AIF C:&B=0,.A +&B AMID &B,1,1 +&M SETB ("&B"="M").OR.("&B"="m").OR.&M +&I SETB ("&B"="I").OR.("&B"="i").OR.&I +.A +&LAB REP #&M*32+&I*16 + AIF .NOT.&M,.B + LONGA ON +.B + AIF .NOT.&I,.C + LONGI ON +.C + MEND + MACRO +&LAB SHORT &A,&B + LCLB &I + LCLB &M +&A AMID &A,1,1 +&M SETB ("&A"="M").OR.("&A"="m") +&I SETB ("&A"="I").OR.("&A"="i") + AIF C:&B=0,.A +&B AMID &B,1,1 +&M SETB ("&B"="M").OR.("&B"="m").OR.&M +&I SETB ("&B"="I").OR.("&B"="i").OR.&I +.A +&LAB SEP #&M*32+&I*16 + AIF .NOT.&M,.B + LONGA OFF +.B + AIF .NOT.&I,.C + LONGI OFF +.C + MEND + MACRO +&lab WordResult +&lab pha + MEND + MACRO +&lab LongResult +&lab pha + pha + MEND + MACRO +&lab mov &num1,&num2 +&lab lda &num1 + sta &num2 + MEND + MACRO +&lab killLdp +&lab pld + pla + pla + MEND + MACRO +&lab _Random +&lab ldx #$8604 + 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 _GetWRefCon +&lab ldx #$290E + jsl $E10000 + MEND + MACRO +&lab _AddResource +&lab ldx #$0C1E + jsl $E10000 + MEND + MACRO +&lab _GetCurResourceApp +&lab ldx #$141E + jsl $E10000 + MEND + MACRO +&lab _GetCurResourceFile +&lab ldx #$121E + jsl $E10000 + MEND + MACRO +&lab _MarkResourceChange +&lab ldx #$101E + jsl $E10000 + MEND + MACRO +&lab _ReleaseResource +&lab ldx #$171E + jsl $E10000 + MEND + MACRO +&lab _SetCurResourceFile +&lab ldx #$111E + jsl $E10000 + MEND + MACRO +&lab _UniqueResourceID +&lab ldx #$191E + jsl $E10000 + MEND + MACRO +&lab _UpdateResourceFile +&lab ldx #$0D1E + jsl $E10000 + MEND + MACRO +&lab _RMFindNamedResource +&lab ldx #$2A1E + jsl $E10000 + MEND + MACRO +&lab _RMLoadNamedResource +&lab ldx #$2C1E + jsl $E10000 + MEND + MACRO +&lab _RMSetResourceName +&lab ldx #$2D1E + jsl $E10000 + MEND + MACRO +&lab _TECompactRecord +&lab ldx #$2822 + jsl $E10000 + MEND + MACRO +&lab _TEGetText +&lab ldx #$0C22 + jsl $E10000 + MEND + MACRO +&lab _TESetText +&lab ldx #$0B22 + jsl $E10000 + MEND + macro +&l dosin &adr +&l dc i"l:~&sysname&syscnt" +~&sysname&syscnt dc c"&adr" + mend diff --git a/source/twilight/nm/MiniFW2.Asm b/source/twilight/nm/MiniFW2.Asm new file mode 100644 index 0000000..2ff394b --- /dev/null +++ b/source/twilight/nm/MiniFW2.Asm @@ -0,0 +1,175 @@ + mcopy Fireworks.Macs + +ColorDiff gequ 24 +MaxDHitable gequ 2 +MaxDItemNum gequ 5 + + copy T2.common.asm + copy T2.datactl.asm + +* +* +Globals data +* +* The Blanker's global data segment +* +* +NumFW ds 2 +Prefs ds 2 +rFWPrefs str 'MiniFireworks Prefs' + +* Blah + end + +* +* +DoBlankT2 Start +* +* Main blanker code +* +* + using CommonData + using Globals + jsr DoBlankT2_2 ;do the setup and all... +MovePtr equ 4 ;placed here by DoBlankT2_2 + +* Same stuff as LedMsg2.Asm + end + +* +* +DoMakeT2 start +* +* Handles the making of all the stuff in the setup window +* +* + using Globals + using CommonData + jsr DoMakeT2_2 ;call back for common stuff... + + ldx #0 ;high word of resource ID + ldy #1 ;low word of resource ID + jsr LoadCtrlsByID + +* Make sure we're dealing with the T2pref file. + + WordResult + _GetCurResourceFile + PushWord RezFileID + _SetCurResourceFile + + jsr load_setup + +noShapes1 anop +MoveOn _SetCurResourceFile + + lda NumFw + and #$7F + tay ;value to set it to + ldx #1 ;rControlTemplate ID + jsr Mk1stDatactl ;make the first datactl from disk + + lda NumFW + and #$8000 ;flag bit for clear screen first + clc ;rotate in a zero + rol a + rol a ;take highest bit to lowest + ldy #2 ;Launch Things check box + + jsr SetCtlToVal start + rts + end + +* +* +DoLoadSetupT2 start +* +* Handles the loading of all the stuff from the prefs file and all +* +* + using Globals + using CommonData + + jsr load_setup + rts + +load_setup entry + PushWord #$800F ;default value + PushWord #NumFW ;pointer to word-variable to store it in + lda #rT2ModuleWord ;type + ldx #rFWPrefs ;ptr to res name + ldy #0 ;loading only a word + jsr LoadAPref + rts + end + +* +* +DoSaveT2 start +* +* Handles the saving of the module's prefs and all +* +* + + using Globals + using CommonData + +* +* First, grab data from controls in window. +* + + ldy #1 ;NumFireworks DataCtl + jsr ReadDataCtl + sta NumFW ;store the value it has... + + ldy #2 ;launch checkbox + jsr GetACtlVal + beq JustSaveIt + lda NumFW + ora #$8000 + sta NumFW + +* +* Got data into the program, now store it to disk +* + +JustSaveIt WordResult + _GetCurResourceFile + PushWord RezFileID + _SetCurResourceFile + + PushWord #2 ;length of block in bytes + PushWord NumFW ;Value to store + lda #rT2ModuleWord + ldx #rFWPrefs ;ptr to res name + jsr SaveAPref + + PushWord RezFileID + _UpdateResourceFile + _SetCurResourceFile + rts + end + +* +* +DoHitT2 start +* +* Handle Item hits +* +* + using CommonData + jsr DoHitT2_2 + rts + end + + +* +* +DoKillT2 start +* +* "Handles" actions not supported by this module +* +* +DoUnloadSetupT2 entry + rts ;act very noncholant about it + end \ No newline at end of file diff --git a/source/twilight/nm/ledmsg.rez b/source/twilight/nm/ledmsg.rez new file mode 100644 index 0000000..ef6f312 --- /dev/null +++ b/source/twilight/nm/ledmsg.rez @@ -0,0 +1,233 @@ +#include "types.rez" +#include "t2common.rez" + +// --- Flags resource + +resource rT2ModuleFlags (moduleFlags) { + fFadeOut+fFadeIn+fGrafPort320+fSetup, // module flags word + $01, // enabled flag (unimplemented) + $0110, // minimum T2 version required + NIL, // reserved + "L.E.D. Message" // module name +}; + +// --- About text resource + +resource rTextForLETextBox2 (moduleMessage) { + TBLeftJust + TBBackColor TBColorF + TBForeColor TBColor1 + "L.E.D. Message" + TBForeColor TBColor0 + " scrolls a message of your choice across the screen.\n" + TBForeColor TBColor4 + "Written by Nathan Mates, dedicated to Ah-Ram Kim." +}; + +// --- Version resource + +resource rVersion (moduleVersion) { + {1,0,0,final,2}, // Version + verUS, // US Version + "T2 L.E.D. Message Module", // program's name + "By Nathan Mates.\n" + "Special Thanks to Jim Maricondo." // copyright notice +}; + +// --- About icon resource + +resource rIcon (moduleIcon) { + $8000, // kind + $0014, // height + $0016, // width + $"0000000000000000000000" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0F000000000000000000F0" + $"0F000000000000000000F0" + $"0F040000044400044400F0" + $"0F040000040000040040F0" + $"0F040000044000040040F0" + $"0F040000040000040040F0" + $"0F044404044404044404F0" + $"0F000000000000000000F0" + $"0F000000000000000000F0" + $"0F000000000000000000F0" + $"0FFFFFFFFFFFFFFFFAFFF0" + $"0000000000000000000000" + $"F0FFFFFFFFFFFFFFFFFF0F" + $"F0FFFFFFFFFFFFFFFFFF0F" + $"F0FF4AFFFFFFFFFFFFFF0F" + $"F0CCCCCCCCCCCCCCCCCC0F" + $"F0FFFFFFFFFFFFFFFAFF0F" + $"F00000000000000000000F", + + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0"; + +}; + +resource rControlList (0x00000001) {{ + 1, /* control resource id */ + 2, + 3, /* control resource id */ + 4, // Icon // + 5, // Descriptor string // +}; +}; + +resource rControlTemplate (0x00000001) { + 0x00000001, /* control id */ +{0x0044,0x000C,0x0080,0x0154}, /* control rectangle */ + editTextControl{{ /* control type */ + 0x0000, /* flags */ + 0x7400, /* more flags */ + 0, /* ref con */ + 0x42800000, /* TE text flags */ + {0xFFFF,0xFFFF,0xFFFF,0xFFFF}, /* indent rect, standard */ + 0xFFFFFFFF, /* TE vert scroll */ + 0, /* te vert movement */ + 0, /* MUST BE NUL version 1.0 */ + 0, /* MUST BE NUL version 1.0 */ + 0, /* style ref */ + 0, /* text descriptor */ + 0, /* text ref */ + 0, /* text length */ + 0, /* maximum characters */ + 0, /* MUST BE NUL version 1.0 */ + 0, /* MUST BE NUL version 1.0 */ + 0, /* MUST BE NUL version 1.0 */ + 0, /* color table */ + 0x0000, /* drawing mode */ + 0 /* filter proc */ +}}; +}; + + +resource rControlTemplate (0x00000003) { + 0x00000003, /* control id */ +{0x0035,0x000A,0x0042,0x0085}, /* control rectangle */ + statTextControl{{ /* control type */ + 0x0000, /* flags */ + 0x1002, /* more flags */ + 0, /* ref con */ + 0x00000003, /* text reference */ + 0x0010, /* text length */ + 0x0008 /* text justification not currently implemented (sys 5.0.2) */ +}}; +}; + + +resource rTextForLETextBox2 (0x00000003){ + "Text to display:" +}; + +resource rControlTemplate (4) { + 4, // ID + { 25, 84, 48,130}, // rect + iconButtonControl {{ + $000C, // flag + $1020, // moreFlags + $00000000, // refCon + moduleIcon, // iconRef + 0, // titleRef + 0, // colorTableRef + $0000 // displayMode + }}; +}; + +resource rControlTemplate (5) { + 5, // ID + { 32,142, 42,350}, // rect + statTextControl {{ + $0000, // flag + $1002, // moreFlags + $00000000, // refCon + 1 //txtref... + }}; +}; + +resource rTextForLETextBox2 (1) { + "L.E.D. Message Options" +}; + +resource rControlTemplate (0x00000002) { + 0x00000002, /* control id */ +{0x0032,0x00CE,0x003f,0x0154}, /* control rectangle */ + PopUpControl{{ /* control type */ + 0x0000, /* flags */ + 0x1002, /* more flags */ + 0, /* ref con */ + 0, /* title width */ + 0x00000003, /* menu reference */ + 0x012C, /* inital value */ + 0x00000000 /* color table id */ +}}; +}; +resource rMenu (0x00000003) { +0x001E, /* id of menu */ + RefIsResource*MenuTitleRefShift+RefIsResource*ItemRefShift+fAllowCache, + 0x00000003, /* id of title string */ + { + 0x0000000A, /* item reference */ + 0x0000000B, /* item reference */ + 0x0000000C, /* item reference */ + 0x0000000D, /* item reference */ +};}; +resource rPString (0x00000003) { +"Font:"}; +resource rMenuItem (0x0000000A) { + 0x012C, /* item id number */ + "","", /* hot key*/ + 0, /* check character */ + RefIsResource*ItemTitleRefShift+fXOR, + 0x0000000A, /* title reference */ +}; +resource rPString (0x0000000A) { +"Standard"}; +resource rMenuItem (0x0000000B) { + 0x012D, /* item id number */ + "","", /* hot key*/ + 0, /* check character */ + RefIsResource*ItemTitleRefShift+fXOR, + 0x0000000B, /* title reference */ +}; +resource rPString (0x0000000B) { +"Sans Serif"}; + +resource rMenuItem (0x0000000C) { + 0x012E, /* item id number */ + "","", /* hot key*/ + 0, /* check character */ + RefIsResource*ItemTitleRefShift+fXOR, + 0x0000000C, /* title reference */ +}; +resource rPString (0x0000000C) { +"Small"}; + +resource rMenuItem (0x0000000D) { + 0x012F, /* item id number */ + "","", /* hot key*/ + 0, /* check character */ + RefIsResource*ItemTitleRefShift+fXOR, + 0x0000000D, /* title reference */ +}; +resource rPString (0x0000000D) { +"Random"}; diff --git a/source/twilight/nm/ledmsg2.asm b/source/twilight/nm/ledmsg2.asm new file mode 100644 index 0000000..f27120c --- /dev/null +++ b/source/twilight/nm/ledmsg2.asm @@ -0,0 +1 @@ + Keep Led.Msg mcopy LedMsg.macs MaxDHitable gequ 2 MaxDItemNum gequ 5 copy T2.common.asm Speed gequ 2 ;1/20 second * * Globals data * * The Blanker's global data segment * * rLedMsgText str 'LedMsg: Text' rLEDMsgFont str 'LedMsg: Font' TheText dosout 500 ;504 byte buffer for text... MsgLen equ TheText+2 ;actual length of text ErrText dosin 'Twilight II is Awesome! This LED Message module was programmed by Nathan Mates, with special thanks to Jim Maricondo (code), the FTA (more code), Beagle Bros (font), and is dedicated to Ah-Ram Kim...' * Other stuff :) end * * DoBlankT2 Start * * Main blanker code * * using CommonData using Globals jsr DoBlankT2_2 ;do the setup and all... MovePtr equ 4 ;placed here by DoBlankT2_2 * Blah MainLoop lda [MovePtr] bne Done * Blah done rts end * * DoMakeT2 start * * Handles the making of all the stuff in the setup window * * using Globals using CommonData jsr DoMakeT2_2 ;call back for common stuff... ldx #0 ;high word of resource ID ldy #1 ;low word of resource ID jsr LoadCtrlsByID * Make sure we're dealing with the T2pref file. WordResult _GetCurResourceFile PushWord RezFileID _SetCurResourceFile jsr load_setup noShapes1 anop MoveOn _SetCurResourceFile PushWord #%011 ;ptr to gs/os output string PushLong #TheText PushWord #0 ;upper word of length PushWord MsgLen ;length of block PushWord #0 ;ptr to TEFormat... PushLong #0 ;nil ptr LongResult PushLong WindPtr PushLong #1 ;TE Control ID _GetCtlHandleFromID _TESetText lda TheFont ;value to set it to ldy #2 ;Low Word, control # jsr SetCtlToVal rts ;or just jmp there... end * * DoLoadSetupT2 start * * Handles the loading of all the stuff from the prefs file and all * * using Globals using CommonData jsr load_setup rts TextNotThere anop ;text not on disk, so make our own... ldx ErrText ;length word inx inx ;length of whole thing CopyErr2 lda ErrText,x sta TheText+2,x dex ;copy all words in string dex bpl CopyErr2 lda ErrText ;accound for possibility of odd-length string sta TheText+2 rts TextIsThere anop ldy #504 GetText lda [3],y ;pointer on stack... sta TheText,y dey dey bpl GetText mov #500,TheText ;buffer size rts load_setup entry PushWord #TextIsThere ;address of function if font is on disk PushWord #TextNotThere ;address of function if text is not on disk lda #rC1OutputString ;resource type ldx #rLedMsgText ldy #1 ;function calls jsr LoadAPref PushWord #300 ;default value PushWord #TheFont ;pointer to word-variable to store it in lda #rT2ModuleWord ;type ldx #rLEDMsgFont ldy #0 ;loading only a word jsr LoadAPref LongResult PushLong WindPtr PushLong #1 ;TE Control ID _GetCtlHandleFromID jsr MakePdp ldy #$10 lda [3],y and #%1111111110111111 sta [3],y ;mark saved killLdp rts end * * DoSaveT2 start * * Handles the saving of the module's prefs and all * * using Globals using CommonData * * First, grab data from controls in window. * LongResult PushWord #%011 ;ptr to gs/os output string PushLong #TheText PushLong #500 ;length of buffer size PushWord #0 ;ptr to TEFormat... PushLong #0 ;nil ptr LongResult PushLong WindPtr PushLong #1 ;TE Control ID _GetCtlHandleFromID ldy #$10 lda [3],y and #%1111111110111111 sta [3],y ;mark saved lda 3,s ;duplicate handle pha lda 3,s pha _TECompactRecord _TEGetText pla pla ;throw away result ldy #2 ;font popup jsr GetACtlVal sta TheFont ;leave in memory for blanker's use * * Got data into the program, now store it to disk * WordResult _GetCurResourceFile PushWord RezFileID _SetCurResourceFile PushWord #504 ;length of block in bytes PushWord #SaveText ;function ptr lda #rC1OutputString ;resource type ldx #rLedMsgText ;ptr to name string jsr SaveAPref PushWord #2 ;length of block in bytes PushWord TheFont ;Value to store lda #rT2ModuleWord ldx #rLedMsgFont ;ptr to name string jsr SaveAPref PushWord RezFileID _UpdateResourceFile _SetCurResourceFile rts SaveText mov #500,TheText ;buffer size ldy #504 SaveTheText lda TheText,y sta [3],y dey dey bpl SaveTheText rts end * * DoHitT2 start * * Handle Item hits * * using CommonData T2Data2 equ 5 T2Result equ 15 stz T2Result+2 stz T2Result ;assume nothing hit lda T2data2+2 ;ctlID hi word must be zero bne nothingHit lda T2data2 ;get ctlID dec a beq enable ;branch if was 1 (TE Control) dec a beq HitIt nothingHit rts enable anop LongResult PushLong WindPtr PushLong #1 ;TE Control ID _GetCtlHandleFromID jsr MakePdp ldy #$10 lda [3],y pld plx plx ;keep a-reg intact and #$40 ;dirty bit: has it changed? beq NothingHit HitIt lda #TRUE sta T2Result rts end * * DoKillT2 start * * "Handles" actions not supported by this module * * DoUnloadSetupT2 entry rts ;act very noncholant about it end \ No newline at end of file diff --git a/source/twilight/nm/ledmsg2.asm.te b/source/twilight/nm/ledmsg2.asm.te new file mode 100644 index 0000000..927996d --- /dev/null +++ b/source/twilight/nm/ledmsg2.asm.te @@ -0,0 +1,442 @@ + +TheText dosout 500 ;504 byte buffer for text... +MsgLen equ TheText+2 ;actual length of text + + +ErrText dosin 'Twilight II is Awesome! This LED Message module was programmed by Nathan Mates, with special thanks to Jim Maricondo (code), the FTA (more code), Beagle Bros (font), and is dedicated to Ah-Ram Kim...' + + +* +* +Setup anop +* +* Handle the Setup and all. Entry: Accum=T2Message +* +* + cmp #MakeT2 + beq doMake + cmp #HitT2 + jeq doHit +* cmp #KillT2 +* jeq doKill + cmp #SaveT2 + jeq doSave + cmp #LoadSetupT2 + jeq doLoadSetup +* cmp #UnloadSetupT2 +* jeq doUnloadSetup + brl Done + +*================================================= +* +* Create all the buttons in the window +* +doMake anop + + lda T2data1+2 + sta WindPtr+2 + lda T2data1 + sta WindPtr + lda T2data2 + sta RezFileID + WordResult + _MMStartUp + PullWord MyID + + LongResult + PushLong WindPtr + PushWord #9 ;resource 2 resource + PushLong #1 ;resource item ID=1 + _NewControl2 + plx + plx ;chuck result out + +* Make sure we're dealing with the T2pref file. + + WordResult + _GetCurResourceFile + PushWord RezFileID + _SetCurResourceFile + + jsr load_setup + +noShapes1 anop +MoveOn _SetCurResourceFile + + PushWord #%011 ;ptr to gs/os output string + PushLong #TheText + PushWord #0 ;upper word of length + PushWord MsgLen ;length of block + PushWord #0 ;ptr to TEFormat... + PushLong #0 ;nil ptr + + LongResult + PushLong WindPtr + PushLong #1 ;TE Control ID + _GetCtlHandleFromID + _TESetText + + lda TheFont + pha + LongResult + PushLong WindPtr + PushLong #2 ;type control # + _GetCtlHandleFromID + _SetCtlValue + + lda #5 ;5 items created + sta T2Result + brl Bye + +*================================================= + + + +temp ds 4 + +rLedMsgText str 'LedMsg: Text' +rLEDMsgFont str 'LedMsg: Font' +TheFont ds 2 + +* Format: Upper byte=clock type (ignored for now) +* 0=DClock; 1= AClock; 2=Random on Entry +* Lower byte=Refreshes between movement... + +*================================================= +doLoadSetup anop + + jsr load_setup + brl Bye + +load_setup anop + +* Load the fps/maxzoom/delay resource. + + LongResult + Pushword #rC1OutputString ;type + PushLong #rLedMsgText + _RMLoadNamedResource + bcc PrefsThere1 + plx + plx ;setup not saved yet... + + ldx ErrText ;length word + inx + inx ;length of whole thing +CopyErr2 lda ErrText,x + sta MsgLen,x + dex ;could be odd length + bpl CopyErr2 + bra NoText + +PrefsThere1 anop + makePdp + ldy #504 +GetText lda [3],y + sta TheText,y + dey + dey + bpl GetText + killLdp + mov #500,TheText ;buffer size + LongResult + PushLong WindPtr + PushLong #1 ;TE Control ID + _GetCtlHandleFromID + MakePdp + ldy #$10 + lda [3],y + and #%1111111110111111 + sta [3],y ;mark saved + killLdp + + PushWord #3 ;purge level + PushWord #rC1OutputString ;rtype for release + + LongResult + PushWord #rC1OutputString + PushLong #rLedMsgText + PushLong #Temp ;don't care about filenum, but toolbox does + _RMFindNamedResource ;get it + _ReleaseResource ;and throw it out. We have a copy now :) + +NoText anop + LongResult + Pushword #rT2ModuleWord ;type + PushLong #rLEDMsgFont + _RMLoadNamedResource + bcc PrefsThere2 + plx + plx ;setup not saved yet... + lda #300 ;Random Clock Type; Normal Speed + sta TheFont + bra NoPrefs + +PrefsThere2 anop + makePdp + lda [3] + sta TheFont + killLdp + + PushWord #3 ;purge levek + PushWord #rT2ModuleWord ;rtype for release + + LongResult + PushWord #rT2ModuleWord + PushLong #rLEDMsgFont + PushLong #Temp ;don't care about filenum, but toolbox does + _RMFindNamedResource ;get it + _ReleaseResource ;and throw it out. We have a copy now :) +NoPrefs rts + +*================================================= +doSave anop + + WordResult + _GetCurResourceFile + PushWord RezFileID + _SetCurResourceFile + + LongResult + PushWord #%011 ;ptr to gs/os output string + PushLong #TheText + PushLong #500 ;length of buffer size + PushWord #0 ;ptr to TEFormat... + PushLong #0 ;nil ptr + + LongResult + PushLong WindPtr + PushLong #1 ;TE Control ID + _GetCtlHandleFromID + lda 3,s ;duplicate handle + pha + lda 3,s + pha + _TECompactRecord + + _TEGetText + pla + pla ;throw away result + + LongResult + PushWord #rC1OutputString + PushLong #rLedMsgText + _RMLoadNamedResource + jcc HavePrefs1 + plx + plx + + LongResult + PushLong #506 ;length of block in bytes + WordResult + _GetCurResourceApp + PushWord #attrNoCross+attrNoSpec + phd + phd + _NewHandle + lda 1,s + sta temp + lda 1+2,s + sta temp+2 + mov #500,TheText ;buffer size + + LongResult + PushLong WindPtr + PushLong #1 ;TE Control ID + _GetCtlHandleFromID + _TECompactRecord + + makePdp + ldy #504 +SaveText lda TheText,y + sta [3],y + dey + dey + bpl SaveText + killLdp + + LongResult + PushLong WindPtr + PushLong #1 ;TE Control ID + _GetCtlHandleFromID + MakePdp + ldy #$10 + lda [3],y + and #%1111111110111111 + sta [3],y ;mark saved + killLdp + + PushLong temp ;handle + PushWord #attrNoSpec+attrNoCross ;attr + PushWord #rC1OutputString ;rtype + LongResult + PushWord #$FFFF + PushWord #rC1OutputString + _UniqueResourceID + lda 1,s + sta temp + lda 1+2,s + sta temp+2 + _AddResource + + PushWord #rC1OutputString ;rType + PushLong temp ;rID + PushLong #rLedMsgText ;ptr to name str + _RMSetResourceName + brl CreatedTxt + +HavePrefs1 anop + makePdp + + LongResult + PushLong WindPtr + PushLong #1 ;TE Control ID + _GetCtlHandleFromID + _TECompactRecord + + mov #500,TheText ;buffer size + ldy #504 +SaveText2 lda TheText,y + sta [3],y + dey + dey + bpl SaveText2 + killLdp + LongResult + PushLong WindPtr + PushLong #1 ;TE Control ID + _GetCtlHandleFromID + MakePdp + ldy #$10 + lda [3],y + and #%1111111110111111 + sta [3],y ;mark saved + killLdp + + PushWord #TRUE ;changeflag: true + PushWord #rC1OutputString ;rtype + + LongResult + PushWord #rC1OutputString + PushLong #rLedMsgText + PushLong #Temp ;don't care about filenum, but toolbox does + _RMFindNamedResource ;get it + _MarkResourceChange + +CreatedTxt anop + WordResult + LongResult + PushLong WindPtr + PushLong #2 ;Type popup... + _GetCtlHandleFromID + _GetCtlValue + pla + sta TheFont + + LongResult + PushWord #rT2ModuleWord + PushLong #rLedMsgFont + _RMLoadNamedResource + jcc HavePrefs2 + plx + plx + + + LongResult + PushLong #2 + WordResult + _GetCurResourceApp + PushWord #attrNoCross+attrNoSpec + phd + phd + _NewHandle + lda 1,s + sta temp + lda 1+2,s + sta temp+2 + makePdp + lda TheFont + sta [3] + killLdp + + PushLong temp ; handle + PushWord #attrNoSpec+attrNoCross ; attr + PushWord #rT2ModuleWord ; rtype + LongResult + PushWord #$FFFF + PushWord #rT2ModuleWord + _UniqueResourceID + lda 1,s + sta temp + lda 1+2,s + sta temp+2 + _AddResource + + PushWord #rT2ModuleWord ;rType + PushLong temp ;rID + PushLong #rLedMsgFont ;ptr to name str + _RMSetResourceName + bra created1 + +HavePrefs2 anop + makePdp + lda TheFont + sta [3] + killLdp + + PushWord #TRUE ; changeflag: true + PushWord #rT2ModuleWord ; rtype + + LongResult + PushWord #rT2ModuleWord + PushLong #rLedMsgFont + PushLong #Temp ;don't care about filenum, but toolbox does + _RMFindNamedResource ;get it + _MarkResourceChange + +created1 anop + PushWord RezFileID + _UpdateResourceFile + _SetCurResourceFile + brl Bye + +*================================================= +* Hit +* +* handle item hits + +doHit anop + + stz T2Result+2 + stz T2Result ;assume nothing hit + lda T2data2+2 ;ctlID hi word must be zero + bne nothingHit + lda T2data2 ;get ctlID + dec a + beq enable ;branch if was 1 (TE Control) + dec a + beq HitIt +nothingHit brl Bye + +enable anop + LongResult + PushLong WindPtr + PushLong #1 ;TE Control ID + _GetCtlHandleFromID + MakePdp + ldy #$10 + lda [3],y + pld + plx + plx ;keep a-reg intact + and #$40 ;dirty bit: has it changed? + beq NothingHit +HitIt lda #TRUE + sta T2Result + bra nothingHit + + +MyID ds 2 +WindPtr ds 4 +RezFileID ds 2 + end diff --git a/source/twilight/nm/ledmsg2.rez.te b/source/twilight/nm/ledmsg2.rez.te new file mode 100644 index 0000000..9323e00 --- /dev/null +++ b/source/twilight/nm/ledmsg2.rez.te @@ -0,0 +1,55 @@ + +resource rControlList (0x00000001) {{ + 1, /* control resource id */ + 2, + 3, /* control resource id */ + 4, // Icon // + 5, // Descriptor string // +}; +}; + +resource rControlTemplate (0x00000001) { + 0x00000001, /* control id */ +{0x0044,0x000C,0x0080,0x0154}, /* control rectangle */ + editTextControl{{ /* control type */ + 0x0000, /* flags */ + 0x7400, /* more flags */ + 0, /* ref con */ + 0x42800000, /* TE text flags */ + {0xFFFF,0xFFFF,0xFFFF,0xFFFF}, /* indent rect, standard */ + 0xFFFFFFFF, /* TE vert scroll */ + 0, /* te vert movement */ + 0, /* MUST BE NUL version 1.0 */ + 0, /* MUST BE NUL version 1.0 */ + 0, /* style ref */ + 0, /* text descriptor */ + 0, /* text ref */ + 0, /* text length */ + 0, /* maximum characters */ + 0, /* MUST BE NUL version 1.0 */ + 0, /* MUST BE NUL version 1.0 */ + 0, /* MUST BE NUL version 1.0 */ + 0, /* color table */ + 0x0000, /* drawing mode */ + 0 /* filter proc */ +}}; +}; + + +resource rControlTemplate (0x00000003) { + 0x00000003, /* control id */ +{0x0035,0x000A,0x0042,0x0085}, /* control rectangle */ + statTextControl{{ /* control type */ + 0x0000, /* flags */ + 0x1002, /* more flags */ + 0, /* ref con */ + 0x00000003, /* text reference */ + 0x0010, /* text length */ + 0x0008 /* text justification not currently implemented (sys 5.0.2) */ +}}; +}; + + +resource rTextForLETextBox2 (0x00000003){ + "Text to display:" +}; diff --git a/source/twilight/nm/my.source/imp.macros.s b/source/twilight/nm/my.source/imp.macros.s new file mode 100644 index 0000000..1b42915 --- /dev/null +++ b/source/twilight/nm/my.source/imp.macros.s @@ -0,0 +1,241 @@ + +*================================================= +* Macros + +add MAC + LDA ]1 + CLC + ADC ]2 + BPL Positive + CLC + ADC #512 + BRA Cont_Add +Positive CMP #512 + BCC Cont_Add + SEC + SBC #512 +Cont_Add STA ]1 + EOM + +TABLE_SPECIAL MAC + MX %00 + LDA ]1 ; Pas Elementaire + LSR + LDX Perspective + BNE Div2_Only +* LSR + LSR ; Divise par 2 +; pour recuperer un bit de precision +Div2_Only LDX ]2 ; Signe Pas elementaire + BEQ No_Inversaga + EOR #$FFFF + INC +No_Inversaga = * + STA Buf_VAL ; Valeur + LDA ]4 + ASL + CLC + ADC #]3 + STA Patch0 + LDA ]4 + ASL + STA Patch2 + LDX #0 + LDA #0 +]lp STA !$0000,X +Patch0 = *-2 + CLC + ADC Buf_VAL + CPX #0 +Patch2 = *-2 + BEQ Patch1 + INX + INX + BRA ]lp +Patch1 DEX + DEX + BMI Here ; Cas ou la dim = 0 + LDA #0 +]lp SEC + SBC Buf_VAL + STA ]3,X + DEX + DEX + BPL ]lp +Here EOM + +TABLE MAC + MX %00 + LDA ]1 ; Pas Elementaire + LSR ; Divise par 2 +; pour recuperer un bit de precision + LDX ]2 ; Signe Pas elementaire + BEQ No_Inversaga + EOR #$FFFF + INC +No_Inversaga = * + STA Buf_VAL ; Valeur + LDA ]4 + ASL + CLC + ADC #]3 + STA Patch0 + LDA ]4 + ASL + STA Patch2 + LDX #0 + LDA #0 +]lp STA !$0000,X +Patch0 = *-2 + CLC + ADC Buf_VAL + CPX #0 +Patch2 = *-2 + BEQ Patch1 + INX + INX + BRA ]lp +Patch1 DEX + DEX + BMI Here ; Cas ou la dim = 0 + LDA #0 +]lp SEC + SBC Buf_VAL + STA ]3,X + DEX + DEX + BPL ]lp +Here EOM + +Add MAC + CPY ]1 + BEQ Same_Signe0 + SEC + SBC ]2 + DEY + BEQ First_Negatif0 + BCC Inverse_Value0 + BRA Cont_Calc0 +Inverse_Value0 EOR #$FFFF + INC + INC ]3 + BRA Cont_Calc0 +First_Negatif0 BCS Cont_Calc0 + EOR #$FFFF + INC ; Change le signe + STZ ]3 + BRA Cont_Calc0 +Same_Signe0 CLC + ADC ]2 +Cont_Calc0 STA ]4 ; * + EOM + + +Plot1 MAC + txa + bmi ]aa + cmp #$7d01 + bcs ]aa + LDAL $012000-1,X + HEX 0901F1 + STAL $012000-1,X +]aa TXA + ADC #$2000-1 + CMP Old + BEQ No_Store + STA Old + cmp #$9d00+1 + bcs No_Store + STA [Ptr_Clear] + STA [Ptr_Tsb] + STA [Ptr_Tsb2] + INC Ptr_Clear + INC Ptr_Clear + INC Ptr_Clear + INC Ptr_Tsb + INC Ptr_Tsb + INC Ptr_Tsb + INC Ptr_Tsb2 + INC Ptr_Tsb2 + INC Ptr_Tsb2 +No_Store CLC + EOM + + EOM +Plot0 MAC + txa + bmi ]bb + cmp #$7d00 + bcs ]bb + LDAL $012000,X + HEX 091F10 + STAL $012000,X +]bb TXA + ADC #$2000 + CMP Old + BEQ No_Store + STA Old + cmp #$9d00 + bcs No_Store + STA [Ptr_Clear] + STA [Ptr_Tsb] + STA [Ptr_Tsb2] + INC Ptr_Clear + INC Ptr_Clear + INC Ptr_Clear + INC Ptr_Tsb + INC Ptr_Tsb + INC Ptr_Tsb + INC Ptr_Tsb2 + INC Ptr_Tsb2 + INC Ptr_Tsb2 +No_Store CLC + EOM + + +BCSL MAC + BCC Here + BRL ]1 +Here EOM + +BCCL MAC + BCS Here + BRL ]1 +Here EOM + +BNEL MAC + BEQ Here + BRL ]1 +Here EOM + +BMIL MAC + BPL Here + BRL ]1 +Here EOM + +bcsl MAC + BCC Here + BRL ]1 +Here EOM + +bccl MAC + BCS Here + BRL ]1 +Here EOM + +bnel MAC + BEQ Here + BRL ]1 +Here EOM + +beql MAC + BNE Here + BRL ]1 +Here EOM + +bmil MAC + BPL Here + BRL ]1 +Here EOM + +*================================================= diff --git a/source/twilight/nm/my.source/impulse.s b/source/twilight/nm/my.source/impulse.s new file mode 100644 index 0000000..fa73b36 --- /dev/null +++ b/source/twilight/nm/my.source/impulse.s @@ -0,0 +1,775 @@ + +************************************************** +* FTA/DYA Three-D T2 Module "Impulse" * +* * +* Originally by FTA. * +* Enhanced by Jim Maricondo, DYA. * +************************************************** + lst off + rel + xc + xc + mx %00 + TR OFF + + USE MACROS + USE MACROS2 + + put t2common.equ + +*================================================= +* Etalon = Zoom, Pnt = Ptr, VIT = SPEED +* BOU = LOOP, Comptuer = Counter, Calculateur = +* Calculator, Moins = Minus +*------------------------------------------------- +FPSCtlID = 1 +DelayPopCtlID = 2 +ShapePopCtlID = 3 +MaxZoomCtlID = 8 +CtlLst = 1 +resourceToResource = 9 + +* Bits of ImpulseFlag... +fFPSCounter = 1 +fBigShapes = 2 + +* SendRequest sendHow values +stopAfterOne equ $8000 +sendToAll equ 0 +sendToName equ 1 +sendToUserID equ 2 + +* NewHandle attributes +attrNoPurge equ $0000 ; Handle Attribute Bits - Not purgeable +attrBank equ $0001 ; Handle Attribute Bits - fixed bank +attrAddr equ $0002 ; Handle Attribute Bits - fixed address +attrPage equ $0004 ; Handle Attribute Bits - page aligned +attrNoSpec equ $0008 ; Handle Attribute Bits - may not use speci +attrNoCross equ $0010 ; Handle Attribute Bits - may not cross ba +attrFixed equ $4000 ; Handle Attribute Bits - not movable +attrLocked equ $8000 ; Handle Attribute Bits - locked + +Screen = $E12000 +*------------------------------------------------- + dum 1 +****dp da 0 +Bank db 0 ;This is how the stack is set up +rtlAddr adr 0 ;with DP at the top and Result +T2data2 adrl 0 ;occupying the top four bytes +T2data1 adrl 0 +T2Message da 0 +T2Result adrl 0 +T2StackSize adrl 0 + dend +*------------------------------------------------- + DUM $00 +MovePtr ds 4 + ERR *>$FF + DEND +*================================================= + mx %00 + +Start + phb + phk + plb + tdc + sta OurDP + +* brk 00 + + lda T2Message,s + cmp #BlankT2 + beq doBlank + cmp #MakeT2 + beql doMake + cmp #HitT2 + beql doHit +* cmp #KillT2 +* beql doKill + cmp #SaveT2 + beql doSave + cmp #LoadSetupT2 + beql doLoadSetup +* cmp #UnloadSetupT2 +* beql doUnloadSetup + brl Bye + +*------------------------------------------------- +doBlank = * + LDX #$FE ; init our DP +]lp STZ $00,X + DEX + DEX + BPL ]lp + + lda T2data1,s + sta MovePtr ;save this in our own DP + lda T2data1+2,s + sta MovePtr+2 + + ~MMStartUp + pla + ora #$0100 + sta MyID + + + ~DisposeAll MyID + lda MyID + and #$F0FF + pha + _MMShutDown + +Bye = * +skip = * + plb + lda 1,s ; move up RTL address + sta 1+10,s + lda 2,s + sta 2+10,s + tsc ; Remove input parameters. + clc + adc #10 + tcs + clc + rtl +*------------------------------------------------- +TOP +:skip lda [MovePtr] + BNEL return + BRL TOP ; next frame! + +*================================================= +*------------------------------------------------- +* HLine - FTA's famous line routine. +* +* DO NOT DISTRIBUTE!!!!!!!!!!!!!!!!!!!!!!!!!! +* +* On entry: +* L1 - line of first point +* C1 - column of first point (in bytes) +* L2 - line of second point +* C2 - column of second point +* The routine will connect the two points with a line. +* + MX %00 + +HLine = * + +* STA L2 +* STY C2 + + LDA L1 + CMP L2 + BCC ZNO_INV2 + LDY L2 + STA L2 + STY L1 + LDA C1 + LDY C2 + STY C1 + STA C2 +ZNO_INV2 = * + LDA L1 ;Calcule l'adresse base de trace + ASL + ASL + ADC L1 + ASL + ASL + ASL + ASL + ASL + ASL + ADC C1 + STA ADR + + LDA L2 + SEC + SBC L1 + STA DY + LDA C1 + CMP C2 + BCCL ZFDIR +ZFINDIR SBC C2 + STA DX + CMP DY + BCC ZFINDIR3 + BRL ZFINDIR2 + +ZFINDIR3 LDA DY + TAY + LSR + EOR #$FFFF + INC +]LOOP STA UT + LDA ADR + LSR + TAX + BCC ZP_GAU1 + CLC + BRA *+4 + +]LOOP2 STA UT + Plot0 + DEY + BMI ZFIN1 + TXA + ADC #$A0 + TAX + LDA DX + ADC UT + BMI ]LOOP2 + SBC DY + +]LOOP STA UT +ZP_GAU1 = * + Plot1 + DEY + BMI ZFIN1 + TXA + ADC #$A0 + TAX + LDA DX + ADC UT + BMI ]LOOP + SBC DY + DEX + BRL ]LOOP2 +ZFIN1 RTS + +ZFDIR LDA C2 + SEC + SBC C1 + STA DX + CMP DY + BCSL ZFDIR2 +ZFDIR3 LDA DY + TAY + INC + LSR + EOR #$FFFF + INC +]LOOP STA UT + LDA ADR + LSR + TAX + BCC ZP_GAU2 + CLC + BRA *+4 + +]LOOP2 STA UT + Plot0 + DEY + BMI ZFIN2 + TXA + ADC #$A0 + TAX + LDA DX + ADC UT + BMI ]LOOP2 + SBC DY + INX + +]LOOP STA UT +ZP_GAU2 = * + Plot1 + DEY + BMI ZFIN2 + TXA + ADC #$A0 + TAX + LDA DX + ADC UT + BMI ]LOOP + SBC DY + BRL ]LOOP2 +ZFIN2 RTS + +ZFDIR2 LDA DX + TAY + LSR + EOR #$FFFF + INC + STA UT + LDA ADR + LSR + TAX + BCC ZP_GAU4 + CLC + BRA *+4 + +]LOOP2 STA UT + Plot0 + DEY + BMI ZFIN4 + INX + LDA DY + ADC UT + BMI ZP_GAU4-2 + SBC DX + STA UT + TXA + ADC #$A0 + TAX + BRA *+4 + + STA UT +ZP_GAU4 = * + Plot1 + DEY + BMI ZFIN4 + LDA DY + ADC UT + BMIL ]LOOP2 + SBC DX + STA UT + TXA + ADC #$A0 + TAX + BRL ]LOOP2+2 +ZFIN4 RTS + + +ZFINDIR2 LDA DX + TAY + LSR + EOR #$FFFF + INC +]LOOP STA UT + LDA ADR + LSR + TAX + BCC ZP_GAU3 + CLC + BRA *+4 + +]LOOP2 STA UT + Plot0 + DEY + BMI ZFIN3 + LDA DY + ADC UT + BMI ZP_GAU3-2 + SBC DX + STA UT + TXA + ADC #$A0 + TAX + BRA *+4 + + STA UT +ZP_GAU3 = * + Plot1 + DEY + BMI ZFIN3 + DEX + LDA DY + ADC UT + BMIL ]LOOP2 + SBC DX + STA UT + TXA + ADC #$A0 + TAX + BRL ]LOOP2+2 +ZFIN3 RTS + +*================================================= + +*------------------------------------------------- +MyID ds 2 +WindPtr ds 4 +RezFileID ds 2 +*================================================= + mx %00 +*================================================= +* Hit +* +* handle item hits + +doHit = * + + lda #0 + sta T2Result+2,s + sta T2Result,s + lda T2data2+2,s ; ctlID hi word must be zero + bne :nothingHit + lda T2data2,s ; get ctlID + cmp #FPSCtlID + beq :enable + cmp #DelayPopCtlID + beq :enable + cmp #ShapePopCtlID + beq :enable + cmp #MaxZoomCtlID + beq :enable +:nothingHit brl Bye + +:enable lda #TRUE + sta T2Result,s + bra :nothingHit + +*================================================= +* +* Create all the buttons in the window +* +doMake = * + + lda T2data1+2,s + sta WindPtr+2 + lda T2data1,s + sta WindPtr + lda T2data2,s + sta RezFileID + ~MMStartUp + pla + sta MyID + + ~NewControl2 WindPtr;#resourceToResource;#CtlLst + plx + plx + +* Make sure we're dealing with the T2pref file. + + ~GetCurResourceFile + ~SetCurResourceFile RezFileID + + jsr load_setup + +:noShapes +:moveon _SetCurResourceFile + + lda ImpulseFlag + and #fFPSCounter ; fps off/on + pha + ~GetCtlHandleFromID WindPtr;#FPSCtlID + _SetCtlValue + + lda ImpulseFlag + and #fBigShapes ; large shapes off/on + lsr + pha + ~GetCtlHandleFromID WindPtr;#MaxZoomCtlID + _SetCtlValue + + lda ImpulseFlag + and #$FF00 + xba + pha + ~GetCtlHandleFromID WindPtr;#DelayPopCtlID + _SetCtlValue + + lda ImpulseShapes + pha + ~GetCtlHandleFromID WindPtr;#ShapePopCtlID + _SetCtlValue + + lda #8 + sta T2Result,s + brl Bye + +*================================================= + +* ImpulseFlag: +* (fFPSCounter) bit 0: 0 = fps off (default), 1 = fps on +* (fBigShapes) bit 1: 0 = big shapes off (default), 1 = big shapes on +* bits 8-15: delay. multiply by 10 to turn into seconds + +ImpulseFlag ds 2 + +* ImpulseShape: +* 1 = All +* 2 = random +* else, = shape + 2 (so shape 1 would = 3) + +ImpulseShapes ds 2 + +temp ds 4 + +rImpulseFlag str 'Impulse: Flags' +rImpulseShapes str 'Impulse: Shapes' +*================================================= +doLoadSetup = * + + jsr load_setup + brl Bye + +load_setup = * + +* Load the fps/maxzoom/delay resource. + + ~RMLoadNamedResource #rT2ModuleWord;#rImpulseFlag + bcc :flagThere + plx + plx ;setup not saved yet... + lda #$0200 ; 20 second delay, no fps, no large shapes + sta ImpulseFlag + bra :noFlag + +:flagThere + jsr makePdp + lda [3] + sta ImpulseFlag + killLdp + + PushWord #3 + PushWord #rT2ModuleWord ;rtype for release + ~RMFindNamedResource #rT2ModuleWord;#rImpulseFlag;#temp ;rID + _ReleaseResource + +:noFlag + +* Load the shapes resource. + + ~RMLoadNamedResource #rT2ModuleWord;#rImpulseShapes + bcc :shapesThere + plx + plx ; setup not saved yet... + lda #1 + sta ImpulseShapes ; all shapes + bra :noShapes + +:shapesThere + jsr makePdp + lda [3] + sta ImpulseShapes + killLdp + + PushWord #3 + PushWord #rT2ModuleWord ;rtype for release + ~RMFindNamedResource #rT2ModuleWord;#rImpulseShapes;#temp ;rID + _ReleaseResource + +:noShapes + rts + +*================================================= +doSave = * + + ~GetCurResourceFile + ~SetCurResourceFile RezFileID + + + wr + ~GetCtlHandleFromID WindPtr;#DelayPopCtlID + _GetCtlValue + pla + xba +* ora ImpulseFlag + sta ImpulseFlag + + + wr + ~GetCtlHandleFromID WindPtr;#FPSCtlID + _GetCtlValue + pla + beq :fpsoff + lda #fFPSCounter + tsb ImpulseFlag + +:fpsoff + wr + ~GetCtlHandleFromID WindPtr;#ShapePopCtlID + _GetCtlValue + pla + beq :bigoff + lda #fBigShapes + tsb ImpulseFlag + +:bigoff + + + ~RMLoadNamedResource #rT2ModuleWord;#rImpulseFlag + bcc :flagFound + plx + plx + + + lr + PushLong #2 + ~GetCurResourceApp +* PushWord MyID + PushWord #attrNoCross+attrNoSpec + phd + phd + _NewHandle + lda 1,s + sta temp + lda 1+2,s + sta temp+2 + jsr makePdp + lda ImpulseFlag + sta [3] + killLdp + + PushLong temp ; handle + PushWord #attrNoSpec+attrNoCross ; attr + PushWord #rT2ModuleWord ; rtype + ~UniqueResourceID #$FFFF;#rT2ModuleWord ; rID + lda 1,s + sta temp + lda 1+2,s + sta temp+2 + _AddResource + + PushWord #rT2ModuleWord ; rType + PushLong temp ; rID + PushLong #rImpulseFlag ; ptr to name str + _RMSetResourceName + bra :created1 + +:flagFound + jsr makePdp + lda ImpulseFlag + sta [3] + killLdp + + PushWord #TRUE ; changeflag: true + PushWord #rT2ModuleWord ; rtype + ~RMFindNamedResource #rT2ModuleWord;#rImpulseFlag;#temp ; rID + _MarkResourceChange + +:created1 + + + + wr + ~GetCtlHandleFromID WindPtr;#ShapePopCtlID + _GetCtlValue + pla + sta ImpulseShapes + + ~RMLoadNamedResource #rT2ModuleWord;#rImpulseShapes + bcc :shapesFound + plx + plx + + lr + PushLong #2 + ~GetCurResourceApp + PushWord #attrNoCross+attrNoSpec + phd + phd + _NewHandle + lda 1,s + sta temp + lda 1+2,s + sta temp+2 + jsr makePdp + lda ImpulseShapes + sta [3] + killLdp + + PushLong temp ; handle + PushWord #attrNoSpec+attrNoCross ; attr + PushWord #rT2ModuleWord ; rtype + ~UniqueResourceID #$FFFF;#rT2ModuleWord ; rID + lda 1,s + sta temp + lda 1+2,s + sta temp+2 + _AddResource + + PushWord #rT2ModuleWord ; rType + PushLong temp ; rID + PushLong #rImpulseShapes ; ptr to name str + _RMSetResourceName + bra :created2 + +:shapesFound + jsr makePdp + lda ImpulseShapes + sta [3] + killLdp + + PushWord #TRUE ; changeflag: true + PushWord #rT2ModuleWord ; rtype + ~RMFindNamedResource #rT2ModuleWord;#rImpulseShapes;#temp ; rID + _MarkResourceChange + +:created2 + + + ~UpdateResourceFile RezFileID + _SetCurResourceFile + + brl Bye +*================================================= +* ErrorMaker.. get the appropriate error string into a +* format acceptable by T2. +* +* Accumulator: +* error 1 = Not enough memory. +* error 2 = Shadow screen not available. +* +* Y Register: error code +* +ErrorMaker = * + + dec ;make that 0 through 1 + asl + tax + phx ;save this for a moment + + lr + phy + _HexIt + pla + sta error1 + pla + sta error1+2 + + lda 1,s + tax + + lr + pea 0 + lda Errorlengths,x ;size + pha + lda MyID + ora #$0F00 + pha ;memory ID + PushWord #attrLocked+attrFixed+attrNoCross+attrNoSpec + phd + phd + _NewHandle + PullLong ErrorHand + + plx + pea #^Errors + lda Errors,x + pha ;pointer + PushLong ErrorHand ;handle + pea 0 + lda Errorlengths,x + pha ;size + _PtrToHand ;copy the string into the handle + + lda ErrorHand + sta T2Result,s + lda ErrorHand+2 + sta T2Result+2,s + + brl return + +* errors that can be returned + +ErrorHand adrl 0 + +Errors da memoryErr + da screenErr + +Errorlengths + da screenErr-memoryErr + da endoferrors-screenErr + +memoryErr asc 'Impulse 3-D Fatal Memory Error: $' +error1 asc '????'0D + asc 'Could not allocate 192k continuous free memory.'00 +screenErr asc 'Impulse 3-D Fatal Shadow Error:'0D + asc 'Shadow screen unavailable. Try again later.'00 +endoferrors + +************************************************** + put makepdp.asm + SAV impulse.l diff --git a/source/twilight/nm/my.source/makepdp.asm b/source/twilight/nm/my.source/makepdp.asm new file mode 100644 index 0000000..474f856 --- /dev/null +++ b/source/twilight/nm/my.source/makepdp.asm @@ -0,0 +1,48 @@ + +*-----------------------------------------------------------------------------* +* makePdp. V1.00 - 12/08/91 by JRM. +* +* Dereference handle (make a pointer) on the stack. +* +* Inputs: +* +* |previous contents| +* |-----------------| +* | handle | Long - Handle to dereference. +* |-----------------| +* | rtsAddr | Word - Return address. +* |-----------------| +* +* Outputs: +* +* | | +* |previous contents| +* |-----------------| +* | pointer | Long - Dereferenced handle. +* |-----------------| +* | rtsAddr | Word - Return address. +* |-----------------| +* + +makePdp Start + kind $1000 ; no special memory + debug 'makePdp' + +TheHandle equ DP+2 +DP equ 1 + + plx ; yank return address + phd + tsc + tcd + ldy #2 + lda [TheHandle],y + tay + lda [TheHandle] + sta