From 12bfecb5757ef914641f9d84c39119cdc8bd1ed3 Mon Sep 17 00:00:00 2001 From: Antoine Vignau <34219772+antoinevignau@users.noreply.github.com> Date: Mon, 8 Jun 2020 22:47:04 +0200 Subject: [PATCH] Add files via upload --- source/twilight/tiler/makefile | 31 + source/twilight/tiler/tiler.asm | 1718 +++++++++++++++++++++++++ source/twilight/tiler/tiler.mac | 396 ++++++ source/twilight/tiler/tiler.rez | 272 ++++ source/twilight/universe/makefile | 29 + source/twilight/universe/universe.asm | 1386 ++++++++++++++++++++ source/twilight/universe/universe.mac | 445 +++++++ source/twilight/universe/universe.rez | 476 +++++++ source/twilight/worms/Worms.Mac | 202 +++ source/twilight/worms/makefile | 26 + source/twilight/worms/worms.asm | 331 +++++ source/twilight/worms/worms.rez | 83 ++ source/twilight/ydi/Blank.Atf | Bin 0 -> 8007 bytes source/twilight/ydi/Disk.EATF | Bin 0 -> 38317 bytes source/twilight/ydi/Ydi.Mac | 614 +++++++++ source/twilight/ydi/blank.eatf.c | Bin 0 -> 16754 bytes source/twilight/ydi/fileicons.rez | 118 ++ source/twilight/ydi/makefile | 28 + source/twilight/ydi/makey | 49 + source/twilight/ydi/movie.asm | 986 ++++++++++++++ source/twilight/ydi/read.me | 17 + source/twilight/ydi/sd/YDI.config.asm | 455 +++++++ source/twilight/ydi/sd/YDI.old.Asm | 1094 ++++++++++++++++ source/twilight/ydi/sd/Ydi.Config | Bin 0 -> 1614 bytes source/twilight/ydi/sd/Ydi.Config.Mac | 316 +++++ source/twilight/ydi/sd/ydi.asm | 1314 +++++++++++++++++++ source/twilight/ydi/sd/ydi.asm.back | 1356 +++++++++++++++++++ source/twilight/ydi/sd/ydi.asm.c | 1514 ++++++++++++++++++++++ source/twilight/ydi/sd/ydi.equ | 10 + source/twilight/ydi/sd/ydi.fix.rez | 274 ++++ source/twilight/ydi/sd/ydi.mac | 552 ++++++++ source/twilight/ydi/sd/ydi.old.equ | 26 + source/twilight/ydi/sd/ydi.old.rez | 239 ++++ source/twilight/ydi/sd/ydi.rez | 256 ++++ source/twilight/ydi/sd/ydi.rez.b | 245 ++++ source/twilight/ydi/sfd/read.me | 17 + source/twilight/ydi/sfd/sfdraw | 453 +++++++ source/twilight/ydi/sfdraw | 453 +++++++ source/twilight/ydi/ydi.asm | 1672 ++++++++++++++++++++++++ source/twilight/ydi/ydi.asm.y | 1682 ++++++++++++++++++++++++ source/twilight/ydi/ydi.equ | 10 + source/twilight/ydi/ydi.rez | 186 +++ source/twilight/ydi/youdrawit | Bin 0 -> 4863 bytes 43 files changed, 19331 insertions(+) create mode 100644 source/twilight/tiler/makefile create mode 100644 source/twilight/tiler/tiler.asm create mode 100644 source/twilight/tiler/tiler.mac create mode 100644 source/twilight/tiler/tiler.rez create mode 100644 source/twilight/universe/makefile create mode 100644 source/twilight/universe/universe.asm create mode 100644 source/twilight/universe/universe.mac create mode 100644 source/twilight/universe/universe.rez create mode 100644 source/twilight/worms/Worms.Mac create mode 100644 source/twilight/worms/makefile create mode 100644 source/twilight/worms/worms.asm create mode 100644 source/twilight/worms/worms.rez create mode 100644 source/twilight/ydi/Blank.Atf create mode 100644 source/twilight/ydi/Disk.EATF create mode 100644 source/twilight/ydi/Ydi.Mac create mode 100644 source/twilight/ydi/blank.eatf.c create mode 100644 source/twilight/ydi/fileicons.rez create mode 100644 source/twilight/ydi/makefile create mode 100644 source/twilight/ydi/makey create mode 100644 source/twilight/ydi/movie.asm create mode 100644 source/twilight/ydi/read.me create mode 100644 source/twilight/ydi/sd/YDI.config.asm create mode 100644 source/twilight/ydi/sd/YDI.old.Asm create mode 100644 source/twilight/ydi/sd/Ydi.Config create mode 100644 source/twilight/ydi/sd/Ydi.Config.Mac create mode 100644 source/twilight/ydi/sd/ydi.asm create mode 100644 source/twilight/ydi/sd/ydi.asm.back create mode 100644 source/twilight/ydi/sd/ydi.asm.c create mode 100644 source/twilight/ydi/sd/ydi.equ create mode 100644 source/twilight/ydi/sd/ydi.fix.rez create mode 100644 source/twilight/ydi/sd/ydi.mac create mode 100644 source/twilight/ydi/sd/ydi.old.equ create mode 100644 source/twilight/ydi/sd/ydi.old.rez create mode 100644 source/twilight/ydi/sd/ydi.rez create mode 100644 source/twilight/ydi/sd/ydi.rez.b create mode 100644 source/twilight/ydi/sfd/read.me create mode 100644 source/twilight/ydi/sfd/sfdraw create mode 100644 source/twilight/ydi/sfdraw create mode 100644 source/twilight/ydi/ydi.asm create mode 100644 source/twilight/ydi/ydi.asm.y create mode 100644 source/twilight/ydi/ydi.equ create mode 100644 source/twilight/ydi/ydi.rez create mode 100644 source/twilight/ydi/youdrawit diff --git a/source/twilight/tiler/makefile b/source/twilight/tiler/makefile new file mode 100644 index 0000000..0100c48 --- /dev/null +++ b/source/twilight/tiler/makefile @@ -0,0 +1,31 @@ + +# Twilight II Tiler UNIX MakeFile +# by Jim Maricondo +# v1.0 - 10/24/92 8:24pm +# v1.1 - 12/13/92 4:40pm +# v1.1.1 - 12/23/92 4:55pm +# v1.1.2 - 12/29/92 9:41pm +# v1.1.3 - 1/2/93 3:20pm +# v1.1.4 - 1/9/93 1:19am + +# First deal with all the dfork... + +tiler.d.root: tiler.asm tiler.mac 22/t2common.equ 22/dsdb.equ 22/makepdp.asm + compile +w tiler.asm keep=tiler.d + +tiler.d: tiler.d.root 22/random3.a.root + link +w tiler.d 22:random3.a keep=tiler.d + +# Now work with the rfork... + +tiler.r: tiler.rez 22/t2common.rez + compile tiler.rez keep=tiler.r + +# Now put it together. + +tiler: tiler.r tiler.d + duplicate -d tiler.d tiler + duplicate -r tiler.r tiler + setfile -at $4004 -t $bc tiler -m . + cp tiler :jim1:system:cdevs:twilight:tiler + 22:beep diff --git a/source/twilight/tiler/tiler.asm b/source/twilight/tiler/tiler.asm new file mode 100644 index 0000000..c7e7e04 --- /dev/null +++ b/source/twilight/tiler/tiler.asm @@ -0,0 +1,1718 @@ + + mcopy tiler.mac + keep tiler.d + copy 2:ainclude:e16.quickdraw +; copy tiler.equ + copy 2:ainclude:e16.control + copy 2:ainclude:e16.types + copy 2:ainclude:e16.memory + copy 2:ainclude:e16.event + copy 22:t2common.equ + copy 22:dsdb.equ +*-----------------------------------------------------------------------------* +! Twilight II Tiler Module. +! +! Based on an early version of Jim Mensch's cool TILEX NDA, discovered on an +! Apple IIgs floor computer at the Apple Central Expo July 1991. +! Special thanks to Jim Mensch for allowing me to use his disassembled code, +! and for providing me with the source to the final version (which I decided +! not to use as I don't like it as well as this :-) +! Modified to include slow/fast speeds, and selectable tile sizes by Jim +! Maricondo, August 1991. Also modified to work with 320 mode. +! +! Revision history: +! V1.00 - August 1991 - Initial version. +! V1.10 - May ~8, 1992 - Revised for new Generation II Module Format. +! V1.00b7 - May 23, 1992 - Revised doBlank with SmartMacros. +! Now use wantGrafPort bit of T2ModuleFlags. +! Revised to comply with G2MF ERS v1.1.1. (v1.0d32) +! v1.0.1b1 - October 24, 1992 - Revised to use private ipc for random. +! v1.0.1b2 - December 13, 1992 - Revised to respect mfOverrideSound. (v1.0.1b2) +! Fixed dumb bug in doHit that screwed it up. +! +! Versions: 10x10 tile matrix FAST 640/320 +! 10x10 tile matrix SLOW 640/320 +! 5x5 tile matrix FAST 640/320 +! 5x5 tile matrix SLOW 640/320 +! +! Copyright (c) 1991, 1992 Jim Maricondo. All rights reserved. +*-----------------------------------------------------------------------------* +Tiler_CtlLst gequ $101 +*-----------------------------------------------------------------------------* +Tiler Start + debug 'Tiler' + Using TilerDATA + + copy 22:dsdb.asm + + phb + phk + plb + phd + tdc + sta OurDP + tsc + tcd + + lda = 9, re-randomize + inc a HORIZ2 = HORIZ1 + 1 +LRCommon sta HORIZ2 + lda VERT1 VERT1 = VERT2 + sta VERT2 + rts + +willBeRIGHT lda HORIZ1 + beq Randomize + dec a HORIZ2 = HORIZ1 - 1 + bra LRCommon + +willBeUP lda VERT1 + cmp #9 0 thru 8 only + bge Randomize if >= 9, re-randomize + inc a VERT2 = VERT1 + 1 +UDCommon sta VERT2 + lda HORIZ1 HORIZ1 = HORIZ2 + sta HORIZ2 + rts + +willBeDOWN lda VERT1 + beq Randomize if = 0, re-randomize + dec a VERT2 = VERT1 - 1 + bra UDCommon + +V1isV2_H1isH2 lda HORIZ2 + sta HORIZ1 + lda VERT2 + sta VERT1 + rts + +UP stz repeatNum first we get what block + lda VERT1 we're moving (vertically) + jsr x20 multiply by 20 to get the + sta Rect_top line number of the top line + clc add 40 to get the bottom + adc #40 line of the block directly + sta Rect_bottom below the one to move + lda HORIZ1 get which block we're moving + jsr x32 (horizontally) + sta Rect_left add 32 to get the far right + clc column of our block + adc #32 (32 is 1/10th the horiz screen) + sta Rect_right +f1 anop +upLoop ldy #-2 [-2] vertical scroll + ldx #0 [00] horizontal scroll + jsr ScrollIt move it 2 lines + lda repeatNum move it 10 times + inc a for a total of 20 lines + sta repeatNum moved total, which is 1/10th +f2 anop + cmp #10 the height of the SHR screen + blt upLoop + jsr Click + brl V1isV2_H1isH2 + +DOWN stz repeatNum first, get what block we're + lda VERT2 moving (vertically) + jsr x20 multiply by 20 to get the + sta Rect_top line number of the top of the + clc block to move + adc #40 add 40 to get the bottom line + sta Rect_bottom of the block directly below us + lda HORIZ2 get which block we're moving + jsr x32 (horizontally) + sta Rect_left x32 to get the start column + clc of the block. add 32 to get + adc #32 the end column of the block. + sta Rect_right +f3 anop +downLoop ldy #2 [+2] vertical scroll + ldx #0 [00] horizontal scroll + jsr ScrollIt move it 2 lines + lda repeatNum move it 10 times + inc a for a total of 20 lines + sta repeatNum moved, which is 1/10th the +f4 anop + cmp #10 height of the SHR screen + blt downLoop + jsr Click + brl V1isV2_H1isH2 + +LEFT stz repeatNum first, get which block we're + lda VERT1 moving (vertically) + jsr x20 multiply by 20 to get the + sta Rect_top top line of the block + clc add 20 to get the bottom + adc #20 line of the block + sta Rect_bottom then get which block we're + lda HORIZ1 moving (horizontally) + jsr x32 multiply by 32 to get the + sta Rect_left start column of the block + clc add 64 to get the end column + adc #64 of the block next to us + sta Rect_right +leftLoop ldy #0 [00] vertical scroll +f5 anop + ldx #-4 [-4] horizontal scroll + jsr ScrollIt move it 4 of 320 pixels over + lda repeatNum + inc a move it 4 pixels 8 times + sta repeatNum for 32 pixels distance moved +f6 anop + cmp #8 this is 1/10th of the screen + blt leftLoop across + jsr Click + brl V1isV2_H1isH2 + +RIGHT stz repeatNum first, get which block we're + lda VERT2 moving (horizontally) + jsr x20 multiply by 20 to get the top + sta Rect_top line of the block + clc then add 20 to get the bottom + adc #20 line of the block + sta Rect_bottom then get which block we're + lda HORIZ2 moving (vertically) + jsr x32 multiply by 32 to get the + sta Rect_left start column of the block + clc add 64 to get the end column + adc #64 of the block next to us + sta Rect_right +rightLoop ldy #0 [00] vertical scroll +f7 anop + ldx #4 [+4] horizontal scroll + jsr ScrollIt move it 4 of 320 pixels over + lda repeatNum move it over 8 times + inc a so by the end it will have + sta repeatNum moved 32 pixels which is +f8 anop + cmp #8 1/10th of the width of a + blt rightLoop 320 mode screen + jsr Click + brl V1isV2_H1isH2 + +ScrollIt anop + PushLong #Rect_top rect to scroll in + phx horizontal scroll + phy vertical scroll + PushLong #0 updateRgnHndl + _ScrollRect + rts + +x32 asl a x2 + asl a x4 + asl a x8 + asl a x16 + asl a x32 + rts + +x20 asl a x2 + pha + asl a x4 + asl a x8 + clc + adc 1,s +x2 + plx + asl a x20 total + rts + +repeatNum ds 2 +VERT1 ds 2 +HORIZ1 ds 2 +VERT2 ds 2 +HORIZ2 ds 2 +RoutineNum dc i'1' +Rect_top ds 2 +Rect_left ds 2 +Rect_bottom dc i'20-1' +Rect_right dc i'32-1' + + End +*-----------------------------------------------------------------------------* +Tiler25_320 Start + debug 'Tiler25 320' + Using TilerDATA + + stz VERT1 + stz HORIZ1 + stz VERT2 + stz HORIZ2 + + + + lda SpeedFlag + beq fast + +slow anop + lda #-2 + sta f1+1 + lda #20 + sta f2+1 + lda #2 + sta f3+1 + lda #20 + sta f4+1 + lda #-4 + sta f5+1 + lda #16 + sta f6+1 + lda #4 + sta f7+1 + lda #16 + sta f8+1 + + bra doneSpeedMod + +fast anop + lda #-4 + sta f1+1 + lda #10 + sta f2+1 + lda #4 + sta f3+1 + lda #10 + sta f4+1 + lda #-8 + sta f5+1 + lda #8 + sta f6+1 + lda #8 + sta f7+1 + lda #8 + sta f8+1 + +doneSpeedMod anop + +loop320 anop + jsr Randomize + lda RoutineNum + asl a + tax + jsr (JMPTbl320,x) + + pld ; restore DP aligned with stack + lda [T2data1] ; movePtr + jne exitHere +; lda decr +; dec a +; sta decr +; jeq exitHere2 + phd ; save DP aligned with stack + lda OurDP ; restore our DP space + tcd + bra loop320 + +JMPTbl320 dc i'DOWN' + dc i'RIGHT' + dc i'UP' + dc i'LEFT' + +Randomize anop +; WordResult +; _Random get a random number +; pla + jsl random + and #$0003 make it a # ranged 0 thru 3 + tax + eor #$0002 + cmp RoutineNum + beq Randomize + txa + sta RoutineNum that will be our new direction + beq willBeDOWN + dec a + beq willBeRIGHT + dec a + beq willBeUP +willBeLEFT lda HORIZ1 + cmp #4 0 thru 3 only + bge Randomize if >= 4, re-randomize + inc a HORIZ2 = HORIZ1 + 1 +LRCommon sta HORIZ2 + lda VERT1 VERT1 = VERT2 + sta VERT2 + rts + +willBeRIGHT lda HORIZ1 + beq Randomize + dec a HORIZ2 = HORIZ1 - 1 + bra LRCommon + +willBeUP lda VERT1 + cmp #4 0 thru 3 only + bge Randomize if >= 4, re-randomize + inc a VERT2 = VERT1 + 1 +UDCommon sta VERT2 + lda HORIZ1 HORIZ1 = HORIZ2 + sta HORIZ2 + rts + +willBeDOWN lda VERT1 + beq Randomize if = 0, re-randomize + dec a VERT2 = VERT1 - 1 + bra UDCommon + +V1isV2_H1isH2 lda HORIZ2 + sta HORIZ1 + lda VERT2 + sta VERT1 + rts + +UP stz repeatNum first we get what block + lda VERT1 we're moving (vertically) + jsr x40 multiply by 40 to get the + sta Rect_top line number of the top line + clc add 80 to get the bottom + adc #80 line of the block directly + sta Rect_bottom below the one to move + lda HORIZ1 get which block we're moving + jsr x64 (horizontally) + sta Rect_left add 64 to get the far right + clc column of our block + adc #64 (64 is 1/5th the horiz screen) + sta Rect_right +f1 anop +upLoop ldy #-4 [-4] vertical scroll + ldx #0 [00] horizontal scroll + jsr ScrollIt move it 4 lines + lda repeatNum move it 10 times + inc a for a total of 40 lines + sta repeatNum moved total, which is 1/5th +f2 anop + cmp #10 the height of the SHR screen + blt upLoop + jsr Click + brl V1isV2_H1isH2 + +DOWN stz repeatNum first, get what block we're + lda VERT2 moving (vertically) + jsr x40 multiply by 40 to get the + sta Rect_top line number of the top of the + clc block to move + adc #80 add 80 to get the bottom line + sta Rect_bottom of the block directly below us + lda HORIZ2 get which block we're moving + jsr x64 (horizontally) + sta Rect_left x64 to get the start column + clc of the block. add 64 to get + adc #64 the end column of the block. + sta Rect_right +f3 anop +downLoop ldy #4 [+4] vertical scroll + ldx #0 [00] horizontal scroll + jsr ScrollIt move it 4 lines + lda repeatNum move it 10 times + inc a for a total of 40 lines + sta repeatNum moved, which is 1/5th the +f4 anop + cmp #10 height of the SHR screen + blt downLoop + jsr Click + brl V1isV2_H1isH2 + +LEFT stz repeatNum first, get which block we're + lda VERT1 moving (vertically) + jsr x40 multiply by 40 to get the + sta Rect_top top line of the block + clc add 40 to get the bottom + adc #40 line of the block + sta Rect_bottom then get which block we're + lda HORIZ1 moving (horizontally) + jsr x64 multiply by 64 to get the + sta Rect_left start column of the block + clc add 128 to get the end column + adc #128 of the block next to us + sta Rect_right +leftLoop ldy #0 [00] vertical scroll +f5 anop + ldx #-8 [-8] horizontal scroll + jsr ScrollIt move it 8 of 320 pixels over + lda repeatNum + inc a move it 8 pixels 8 times + sta repeatNum for 64 pixels distance moved +f6 anop + cmp #8 this is 1/5th of the screen + blt leftLoop across + jsr Click + brl V1isV2_H1isH2 + +RIGHT stz repeatNum first, get which block we're + lda VERT2 moving (horizontally) + jsr x40 multiply by 40 to get the top + sta Rect_top line of the block + clc then add 40 to get the bottom + adc #40 line of the block + sta Rect_bottom then get which block we're + lda HORIZ2 moving (vertically) + jsr x64 multiply by 64 to get the + sta Rect_left start column of the block + clc add 128 to get the end column + adc #128 of the block next to us + sta Rect_right +rightLoop ldy #0 [00] vertical scroll +f7 anop + ldx #8 [+8] horizontal scroll + jsr ScrollIt move it 8 of 320 pixels over + lda repeatNum move it over 8 times + inc a so by the end it will have + sta repeatNum moved 64 pixels which is +f8 anop + cmp #8 1/5th of the width of a + blt rightLoop 320 mode screen + jsr Click + brl V1isV2_H1isH2 + +ScrollIt anop + PushLong #Rect_top rect to scroll in + phx horizontal scroll + phy vertical scroll + PushLong #0 updateRgnHndl + _ScrollRect + rts + +x64 asl a x2 + asl a x4 + asl a x8 + asl a x16 + asl a x32 + asl a x64 + rts + +x40 asl a x2 + pha + asl a x4 + asl a x8 + clc + adc 1,s +x2 + plx + asl a x20 + asl a x40 + rts + +repeatNum ds 2 +VERT1 ds 2 +HORIZ1 ds 2 +VERT2 ds 2 +HORIZ2 ds 2 +RoutineNum dc i'1' +Rect_top ds 2 +Rect_left ds 2 +Rect_bottom dc i'40-1' +Rect_right dc i'64-1' + + End +*-----------------------------------------------------------------------------* +Tiler640 Start + debug 'Tiler 640' + + lda SizeFlag + beq Tiler100_640 + brl Tiler25_640 + + End +*-----------------------------------------------------------------------------* +Tiler100_640 Start + debug 'Tiler100 640' + Using TilerDATA + + stz VERT1 + stz HORIZ1 + stz VERT2 + stz HORIZ2 + + + lda SpeedFlag + beq fast + +slow anop + lda #-1 + sta f1+1 + lda #20 + sta f2+1 + lda #1 + sta f3+1 + lda #20 + sta f4+1 + lda #-4 + sta f5+1 + lda #16 + sta f6+1 + lda #4 + sta f7+1 + lda #16 + sta f8+1 + + bra doneSpeedMod + +fast anop + lda #-2 + sta f1+1 + lda #10 + sta f2+1 + lda #2 + sta f3+1 + lda #10 + sta f4+1 + lda #-8 + sta f5+1 + lda #8 + sta f6+1 + lda #8 + sta f7+1 + lda #8 + sta f8+1 + +doneSpeedMod anop + +loop640 anop + jsr Randomize + lda RoutineNum + asl a + tax + jsr (JMPTbl640,x) + + pld ; restore DP aligned with stack + lda [T2data1] ; movePtr + jne exitHere +; lda decr +; dec a +; sta decr +; jeq exitHere2 + phd + lda OurDP + tcd + bra loop640 + +JMPTbl640 dc i'DOWN' + dc i'RIGHT' + dc i'UP' + dc i'LEFT' + +Randomize anop +; WordResult +; _Random get a random number +; pla + jsl random + and #$0003 make it a # ranged 0 thru 3 + tax + eor #$0002 + cmp RoutineNum + beq Randomize + txa + sta RoutineNum that will be our new direction + beq willBeDOWN + dec a + beq willBeRIGHT + dec a + beq willBeUP +willBeLEFT lda HORIZ1 + cmp #9 0 thru 8 only + bge Randomize if >= 9, re-randomize + inc a HORIZ2 = HORIZ1 + 1 +LRCommon sta HORIZ2 + lda VERT1 VERT1 = VERT2 + sta VERT2 + rts + +willBeRIGHT lda HORIZ1 + beq Randomize + dec a HORIZ2 = HORIZ1 - 1 + bra LRCommon + +willBeUP lda VERT1 + cmp #9 0 thru 8 only + bge Randomize if >= 9, re-randomize + inc a VERT2 = VERT1 + 1 +UDCommon sta VERT2 + lda HORIZ1 HORIZ1 = HORIZ2 + sta HORIZ2 + rts + +willBeDOWN lda VERT1 + beq Randomize if = 0, re-randomize + dec a VERT2 = VERT1 - 1 + bra UDCommon + +V1isV2_H1isH2 lda HORIZ2 + sta HORIZ1 + lda VERT2 + sta VERT1 + rts + +UP stz repeatNum first we get what block + lda VERT1 we're moving (vertically) + jsr x20 multiply by 20 to get the + sta Rect_top line number of the top line + clc add 40 to get the bottom + adc #40 line of the block directly + sta Rect_bottom below the one to move + lda HORIZ1 get which block we're moving + jsr x64 (horizontally) + sta Rect_left add 64 to get the far right + clc column of our block + adc #64 (64 is 1/10th the horiz screen) + sta Rect_right +f1 anop +upLoop ldy #-2 [-2] vertical scroll + ldx #0 [00] horizontal scroll + jsr ScrollIt move it 2 lines + lda repeatNum move it 10 times + inc a for a total of 20 lines + sta repeatNum moved total, which is 1/10th +f2 anop + cmp #10 the height of the SHR screen + blt upLoop + jsr Click + brl V1isV2_H1isH2 + +DOWN stz repeatNum first, get what block we're + lda VERT2 moving (vertically) + jsr x20 multiply by 20 to get the + sta Rect_top line number of the top of the + clc block to move + adc #40 add 40 to get the bottom line + sta Rect_bottom of the block directly below us + lda HORIZ2 get which block we're moving + jsr x64 (horizontally) + sta Rect_left x64 to get the start column + clc of the block. add 64 to get + adc #64 the end column of the block. + sta Rect_right +f3 anop +downLoop ldy #2 [+2] vertical scroll + ldx #0 [00] horizontal scroll + jsr ScrollIt move it 2 lines + lda repeatNum move it 10 times + inc a for a total of 20 lines + sta repeatNum moved, which is 1/10th the +f4 anop + cmp #10 height of the SHR screen + blt downLoop + jsr Click + brl V1isV2_H1isH2 + +LEFT stz repeatNum first, get which block we're + lda VERT1 moving (vertically) + jsr x20 multiply by 20 to get the + sta Rect_top top line of the block + clc add 20 to get the bottom + adc #20 line of the block + sta Rect_bottom then get which block we're + lda HORIZ1 moving (horizontally) + jsr x64 multiply by 64 to get the + sta Rect_left start column of the block + clc add 128 to get the end column + adc #128 of the block next to us + sta Rect_right +leftLoop ldy #0 [00] vertical scroll +f5 anop + ldx #-8 [-8] horizontal scroll + jsr ScrollIt move it 8 of 640 pixels over + lda repeatNum + inc a move it 8 pixels 8 times + sta repeatNum for 64 pixels distance moved +f6 anop + cmp #8 this is 1/10th of the screen + blt leftLoop across + jsr Click + brl V1isV2_H1isH2 + +RIGHT stz repeatNum first, get which block we're + lda VERT2 moving (horizontally) + jsr x20 multiply by 20 to get the top + sta Rect_top line of the block + clc then add 20 to get the bottom + adc #20 line of the block + sta Rect_bottom then get which block we're + lda HORIZ2 moving (vertically) + jsr x64 multiply by 64 to get the + sta Rect_left start column of the block + clc add 128 to get the end column + adc #128 of the block next to us + sta Rect_right +rightLoop ldy #0 [00] vertical scroll +f7 anop + ldx #8 [+8] horizontal scroll + jsr ScrollIt move it 8 of 640 pixels over + lda repeatNum move it over 8 times + inc a so by the end it will have + sta repeatNum moved 64 pixels which is +f8 anop + cmp #8 1/10th of the width of a + blt rightLoop 640 mode screen + jsr Click + brl V1isV2_H1isH2 + +ScrollIt anop + PushLong #Rect_top rect to scroll in + phx horizontal scroll + phy vertical scroll + PushLong #0 updateRgnHndl + _ScrollRect + rts + +x64 asl a x2 + asl a x4 + asl a x8 + asl a x16 + asl a x32 + asl a x64 + rts + +x20 asl a x2 + pha + asl a x4 + asl a x8 + clc + adc 1,s +x2 + plx + asl a x20 total + rts + +repeatNum ds 2 +VERT1 ds 2 +HORIZ1 ds 2 +VERT2 ds 2 +HORIZ2 ds 2 +RoutineNum dc i'1' +Rect_top ds 2 +Rect_left ds 2 +Rect_bottom dc i'20-1' +Rect_right dc i'64-1' + + End +*-----------------------------------------------------------------------------* +Tiler25_640 Start + debug 'Tiler25 640' + Using TilerDATA + + stz VERT1 + stz HORIZ1 + stz VERT2 + stz HORIZ2 + + + + lda SpeedFlag + beq fast + +slow anop + lda #-2 + sta f1+1 + lda #20 + sta f2+1 + lda #2 + sta f3+1 + lda #20 + sta f4+1 + lda #-8 + sta f5+1 + lda #16 + sta f6+1 + lda #8 + sta f7+1 + lda #16 + sta f8+1 + + bra doneSpeedMod + +fast anop + lda #-4 + sta f1+1 + lda #10 + sta f2+1 + lda #4 + sta f3+1 + lda #10 + sta f4+1 + lda #-16 + sta f5+1 + lda #8 + sta f6+1 + lda #16 + sta f7+1 + lda #8 + sta f8+1 + +doneSpeedMod anop + +loop640 anop + jsr Randomize + lda RoutineNum + asl a + tax + jsr (JMPTbl640,x) + + pld ; restore DP aligned with stack + lda [T2data1] ; movePtr + jne exitHere +; lda decr +; dec a +; sta decr +; jeq exitHere2 + phd ; save DP aligned with stack + lda OurDP ; restore our DP space + tcd + bra loop640 + +JMPTbl640 dc i'DOWN' + dc i'RIGHT' + dc i'UP' + dc i'LEFT' + +Randomize anop +; WordResult +; _Random get a random number +; pla + jsl random + and #$0003 make it a # ranged 0 thru 3 + tax + eor #$0002 + cmp RoutineNum + beq Randomize + txa + sta RoutineNum that will be our new direction + beq willBeDOWN + dec a + beq willBeRIGHT + dec a + beq willBeUP +willBeLEFT lda HORIZ1 + cmp #4 0 thru 3 only + bge Randomize if >= 4, re-randomize + inc a HORIZ2 = HORIZ1 + 1 +LRCommon sta HORIZ2 + lda VERT1 VERT1 = VERT2 + sta VERT2 + rts + +willBeRIGHT lda HORIZ1 + beq Randomize if = 0, re-randomize + dec a HORIZ2 = HORIZ1 - 1 + bra LRCommon + +willBeUP lda VERT1 + cmp #4 0 thru 3 only + bge Randomize if >= 4, re-randomize + inc a VERT2 = VERT1 + 1 +UDCommon sta VERT2 + lda HORIZ1 HORIZ1 = HORIZ2 + sta HORIZ2 + rts + +willBeDOWN lda VERT1 + beq Randomize if = 0, re-randomize + dec a VERT2 = VERT1 - 1 + bra UDCommon + +V1isV2_H1isH2 lda HORIZ2 + sta HORIZ1 + lda VERT2 + sta VERT1 + rts + +UP stz repeatNum first we get what block + lda VERT1 we're moving (vertically) + jsr x40 multiply by 40 to get the + sta Rect_top line number of the top line + clc add 80 to get the bottom + adc #80 line of the block directly + sta Rect_bottom below the one to move + lda HORIZ1 get which block we're moving + jsr x128 (horizontally) + sta Rect_left add 128 to get the far right + clc column of our block + adc #128 (128 is 1/5th the horiz screen) + sta Rect_right +f1 anop +upLoop ldy #-4 [-4] vertical scroll + ldx #0 [00] horizontal scroll + jsr ScrollIt move it 4 lines + lda repeatNum move it 10 times + inc a for a total of 40 lines + sta repeatNum moved total, which is 1/5th +f2 anop + cmp #10 the height of the SHR screen + blt upLoop + jsr Click + brl V1isV2_H1isH2 + +DOWN stz repeatNum first, get what block we're + lda VERT2 moving (vertically) + jsr x40 multiply by 40 to get the + sta Rect_top line number of the top of the + clc block to move + adc #80 add 80 to get the bottom line + sta Rect_bottom of the block directly below us + lda HORIZ2 get which block we're moving + jsr x128 (horizontally) + sta Rect_left x128 to get the start column + clc of the block. add 128 to get + adc #128 the end column of the block. + sta Rect_right +f3 anop +downLoop ldy #4 [+4] vertical scroll + ldx #0 [00] horizontal scroll + jsr ScrollIt move it 4 lines + lda repeatNum move it 10 times + inc a for a total of 40 lines + sta repeatNum moved, which is 1/5th the +f4 anop + cmp #10 height of the SHR screen + blt downLoop + jsr Click + brl V1isV2_H1isH2 + +LEFT stz repeatNum first, get which block we're + lda VERT1 moving (vertically) + jsr x40 multiply by 40 to get the + sta Rect_top top line of the block + clc add 40 to get the bottom + adc #40 line of the block + sta Rect_bottom then get which block we're + lda HORIZ1 moving (horizontally) + jsr x128 multiply by 128 to get the + sta Rect_left start column of the block + clc add 256 to get the end column + adc #256 of the block next to us + sta Rect_right +leftLoop ldy #0 [00] vertical scroll +f5 anop + ldx #-16 [-16] horizontal scroll + jsr ScrollIt move it 16 of 640 pixels over + lda repeatNum + inc a move it 16 pixels 8 times + sta repeatNum for 128 pixels distance moved +f6 anop + cmp #8 this is 1/5th of the screen + blt leftLoop across + jsr Click + brl V1isV2_H1isH2 + +RIGHT stz repeatNum first, get which block we're + lda VERT2 moving (horizontally) + jsr x40 multiply by 40 to get the top + sta Rect_top line of the block + clc then add 40 to get the bottom + adc #40 line of the block + sta Rect_bottom then get which block we're + lda HORIZ2 moving (vertically) + jsr x128 multiply by 128 to get the + sta Rect_left start column of the block + clc add 256 to get the end column + adc #256 of the block next to us + sta Rect_right +rightLoop ldy #0 [00] vertical scroll +f7 anop + ldx #16 [+16] horizontal scroll + jsr ScrollIt move it 16 of 640 pixels over + lda repeatNum move it over 8 times + inc a so by the end it will have + sta repeatNum moved 128 pixels which is +f8 anop + cmp #8 1/5th of the width of a + blt rightLoop 640 mode screen + jsr Click + brl V1isV2_H1isH2 + +ScrollIt anop + PushLong #Rect_top rect to scroll in + phx horizontal scroll + phy vertical scroll + PushLong #0 updateRgnHndl + _ScrollRect + rts + +x128 asl a x2 + asl a x4 + asl a x8 + asl a x16 + asl a x32 + asl a x64 + asl a x128 + rts + +x40 asl a x2 + pha + asl a x4 + asl a x8 + clc + adc 1,s +x2 + plx + asl a x20 + asl a x40 + rts + +repeatNum ds 2 +VERT1 ds 2 +HORIZ1 ds 2 +VERT2 ds 2 +HORIZ2 ds 2 +RoutineNum dc i'1' +Rect_top ds 2 +Rect_left ds 2 +Rect_bottom dc i'40-1' +Rect_right dc i'128-1' + + End +*-----------------------------------------------------------------------------* +* Here's a little sound routine. It's a modified white +* noise generator Derek found in Nibble. You can play modify +* the frequency/duration/volume if you want. +Click Start + debug 'Click' + +DUR equ 50 +FREQ equ 200 +VOL equ 60 + + lda soundFlag + beq noClick + + shortmx + lda #DUR + sta temp + +LoopL6 lda SPKR + ldy #VOL +YLoopL6 dey + bne YLoopL6 + lda SPKR + ldx temp + lda $FFF000,x ;this is neat. It reads the Applesoft + clc ;ROM and uses it as random values! + adc #FREQ + tax +xloopL6 dex + bne xloopL6 + dec temp + bne LoopL6 + longmx +noClick rts + +temp ds 1 ;temporary loop-counter + + End +*-----------------------------------------------------------------------------* + copy 22:makepdp.asm \ No newline at end of file diff --git a/source/twilight/tiler/tiler.mac b/source/twilight/tiler/tiler.mac new file mode 100644 index 0000000..7cff4b0 --- /dev/null +++ b/source/twilight/tiler/tiler.mac @@ -0,0 +1,396 @@ + MACRO +&lab WordResult +&lab phd + MEND + MACRO +&lab LongResult +&lab phd + phd + 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 longmx +&lab ANOP + rep #%00110000 + longa on + longi on + 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 JNE &BP +&LAB BEQ *+5 + BRL &BP + MEND + MACRO +&lab _NewHandle +&lab ldx #$0902 + jsl $E10000 + MEND + MACRO +&lab _NewControl2 +&lab ldx #$3110 + jsl $E10000 + MEND + macro +&lab ~GetMasterSCB +&lab WordResult + Tool $1704 + mend + macro +&lab ~GetCurResourceFile +&lab WordResult + Tool $121E + mend + macro +&lab ~GetCtlHandleFromID &ctlWindowPtr,&ctlID +&lab LongResult + ph4 &ctlWindowPtr + ph4 &ctlID + Tool $3010 + mend + MACRO +&lab _SetCurResourceFile +&lab ldx #$111E + jsl $E10000 + MEND + macro +&lab ~SetCurResourceFile &fileID +&lab ph2 &fileID + Tool $111E + mend + MACRO +&lab str &string +&lab dc i1'L:&string',C'&string' + MEND + MACRO +&lab _AddResource +&lab ldx #$0C1E + jsl $E10000 + MEND + MACRO +&lab _SetCtlValue +&lab ldx #$1910 + jsl $E10000 + MEND + MACRO +&lab _GetCtlValue +&lab ldx #$1A10 + jsl $E10000 + MEND + MACRO +&lab _ReleaseResource +&lab ldx #$171E + jsl $E10000 + MEND + macro +&lab ~UpdateResourceFile &fileID +&lab ph2 &fileID + Tool $0D1E + 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",.ze +oPageReg + 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 ~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 shortmx +&lab ANOP + sep #%00110000 + longa off + longi off + MEND + MACRO +&lab _GetCtlHandleFromID +&lab ldx #$3010 + jsl $E10000 + MEND + macro +&lab ~UniqueResourceID &IDRange,&resourceType +&lab LongResult + ph2 &IDRange + ph2 &resourceType + Tool $191E + mend + macro +&lab ~SetBackPat &patternPtr +&lab ph4 &patternPtr + Tool $3404 + mend + MACRO +&lab _RMSetResourceName +&lab ldx #$2D1E + jsl $E10000 + MEND + MACRO +&lab _ScrollRect +&lab ldx #$7E04 + jsl $E10000 + MEND + MACRO +&lab _MarkResourceChange +&lab ldx #$101E + jsl $E10000 + MEND + MACRO +&lab _UpdateResourceFile +&lab ldx #$0D1E + jsl $E10000 + MEND + macro +&lab ~FindRadioButton &windPtr,&famNum +&lab WordResult + PushLong &windPtr + PushWord &famNum + Tool $3910 + mend + macro +&lab ~GetCurResourceApp +&lab wordresult + Tool $141E + mend + MACRO +&lab _GetSCB +&lab ldx #$1304 + jsl $E10000 + MEND + MACRO +&lab _SetSCB +&lab ldx #$1204 + jsl $E10000 + MEND + MACRO +&LAB JEQ &BP +&LAB BNE *+5 + BRL &BP + MEND diff --git a/source/twilight/tiler/tiler.rez b/source/twilight/tiler/tiler.rez new file mode 100644 index 0000000..9d6521f --- /dev/null +++ b/source/twilight/tiler/tiler.rez @@ -0,0 +1,272 @@ + +#include "types.rez" +#include "22:t2common.rez" + +// --- type $8003 defines +#define Tiler_CtlLst $101 +// --- type $8004 defines +#define SoundFXCtl $101 +#define FastSpeedCtl $102 +#define SlowSpeedCtl $103 +#define SpeedStrCtl $104 +#define TilerOptionsStrCtl $105 +#define SmallSizeCtl $106 +#define LargeSizeCtl $107 +#define TileSizeStrCtl $108 +#define TilerIconCtl $109 +// --- type $8006 defines +#define SoundFXStr $102 +#define FastStr $103 +#define SlowStr $104 +#define SmallStr $105 +#define LargeStr $106 +// --- type $800B defines +#define TileSize_LText $101 +#define TilerOptions_LText $102 +#define Speed_LText $103 + + +resource rT2ModuleFlags (moduleFlags) { + fMostCommonPalette+ + fSetup+ + fLoadSetupBoot+ + fLeavesUsableScreen+ + fReqUsableScreen, // module flags word + $01, // enabled flag (unimplemented) + $0110, // minimum T2 version required + NIL, // reserved + "Tiler" // module name +}; + +// --- About text resource + +resource rTextForLETextBox2 (moduleMessage) { + TBLeftJust + TBBackColor TBColorF + TBForeColor TBColor4 + "Tiler" + TBForeColor TBColor1 + " turns your screen into an automated version of the classic picture tile " + "matrix puzzle game. Watch the computer solve - and unsolve - itself!" +}; + +// --- Version resource + +resource rVersion (moduleVersion) { + {1,0,1,release,0}, // Version + verUS, // US Version + "T2 Tiler Module", // program's name + "By J.Maricondo and Mensch.\n" + "Copyright 1991-93, Jim Maricondo." // copyright notice +}; + +// --- icon resource + +resource rIcon (moduleIcon) { + $8000, // kind + $0014, // height + $001C, // width + + $"FFF0000000000000000000000FFF" + $"FFF0FFFFFFFFFFFFFFFFFFFF0FFF" + $"FFF0F000000000000000000F0FFF" + $"FFF0F0FF00FF00FF00FF000F0FFF" + $"FFF0F0FF00FF00FF00FF000F0FFF" + $"FFF0F000FF00FF00FF00FF0F0FFF" + $"FFF0F000FF00FF00FF00FF0F0FFF" + $"FFF0F0FF00FF00FF00FF000F0FFF" + $"FFF0F0FF00FF00FF00FF000F0FFF" + $"FFF0F000FF00FF00FF00FF0F0FFF" + $"FFF0F000FF00FF00FF00FF0F0FFF" + $"FFF0F000000000000000000F0FFF" + $"FFF0FFFFFFFFFFFFFFFFAFFF0FFF" + $"FFF0000000000000000000000FFF" + $"FFFF0FFFFFFFFFFFFFFFFFF0FFFF" + $"FFFF0FFFFFFFFFFFFFFFFFF0FFFF" + $"FFFF0FF4AFFFFFFFFFFFFFF0FFFF" + $"FFFF0CCCCCCCCCCCCCCCCCC0FFFF" + $"FFFF0FFFFFFFFFFFFFFFAFF0FFFF" + $"FFFF00000000000000000000FFFF", + + $"000FFFFFFFFFFFFFFFFFFFFFF000" + $"000FFFFFFFFFFFFFFFFFFFFFF000" + $"000FFFFFFFFFFFFFFFFFFFFFF000" + $"000FFFFFFFFFFFFFFFFFFFFFF000" + $"000FFFFFFFFFFFFFFFFFFFFFF000" + $"000FFFFFFFFFFFFFFFFFFFFFF000" + $"000FFFFFFFFFFFFFFFFFFFFFF000" + $"000FFFFFFFFFFFFFFFFFFFFFF000" + $"000FFFFFFFFFFFFFFFFFFFFFF000" + $"000FFFFFFFFFFFFFFFFFFFFFF000" + $"000FFFFFFFFFFFFFFFFFFFFFF000" + $"000FFFFFFFFFFFFFFFFFFFFFF000" + $"000FFFFFFFFFFFFFFFFFFFFFF000" + $"000FFFFFFFFFFFFFFFFFFFFFF000" + $"0000FFFFFFFFFFFFFFFFFFFF0000" + $"0000FFFFFFFFFFFFFFFFFFFF0000" + $"0000FFFFFFFFFFFFFFFFFFFF0000" + $"0000FFFFFFFFFFFFFFFFFFFF0000" + $"0000FFFFFFFFFFFFFFFFFFFF0000" + $"0000FFFFFFFFFFFFFFFFFFFF0000"; +}; + +// --- Control List Definitions + +resource rControlList (Tiler_CtlLst) { + { + LargeSizeCtl, + SmallSizeCtl, + SlowSpeedCtl, + FastSpeedCtl, + SoundFXCtl, + TileSizeStrCtl, + TilerOptionsStrCtl, + SpeedStrCtl, + TilerIconCtl, + }; +}; + +// --- Control Templates + +resource rControlTemplate (SoundFXCtl) { + $00000001, // ID + {111, 60,120,188}, // rect + checkControl {{ + $0000, // flag + $1002, // moreFlags + $00000000, // refCon + SoundFXStr, // titleRef + $0000 // initialValue + }}; +}; + +resource rControlTemplate (FastSpeedCtl) { + $00000002, // ID + { 87,110, 96,168}, // rect + radioControl {{ + $0001, // flag + $1002, // moreFlags + $00000000, // refCon + FastStr, // titleRef + $0000 // initialValue + }}; +}; + +resource rControlTemplate (SlowSpeedCtl) { + $00000003, // ID + { 98,110,107,172}, // rect + radioControl {{ + $0001, // flag + $1002, // moreFlags + $00000000, // refCon + SlowStr, // titleRef + $0000 // initialValue + }}; +}; + +resource rControlTemplate (SmallSizeCtl) { + $00000004, // ID + { 74, 80, 84,266}, // rect + radioControl {{ + $0000, // flag + $1002, // moreFlags + $00000000, // refCon + SmallStr, // titleRef + $0000 // initialValue + }}; +}; + +resource rControlTemplate (LargeSizeCtl) { + $00000005, // ID + { 63, 80, 72,254}, // rect + radioControl {{ + $0000, // flag + $1002, // moreFlags + $00000000, // refCon + LargeStr, // titleRef + $0000 // initialValue + }}; +}; + +resource rControlTemplate (TileSizeStrCtl) { + $00000006, // ID + { 52, 56, 61,131}, // rect + statTextControl {{ + $0000, // flag + $1002, // moreFlags + $00000000, // refCon + TileSize_LText // textRef + }}; +}; + +resource rControlTemplate (TilerIconCtl) { + $00000007, // ID + { 26, 88, 47,132}, // rect + iconButtonControl {{ + $000C, // flag + $1020, // moreFlags + $00000000, // refCon + $0010DD01, // iconRef + 0, // titleRef + 0, // colorTableRef + $0000 // displayMode + }}; +}; + +resource rControlTemplate (SpeedStrCtl) { + $00000008, // ID + { 87, 58, 96,109}, // rect + statTextControl {{ + $0000, // flag + $1002, // moreFlags + $00000000, // refCon + Speed_LText // textRef + }}; +}; + +resource rControlTemplate (TilerOptionsStrCtl) { + $00000009, // ID + { 32,142, 41,239}, // rect + statTextControl {{ + $0000, // flag + $1002, // moreFlags + $00000000, // refCon + TilerOptions_LText // textRef + }}; +}; + +// --- rPString Templates + +resource rPString (SoundFXStr) { + "Sound Effects" +}; + +resource rPString (FastStr) { + "Fast" +}; + +resource rPString (SlowStr) { + "Slow" +}; + +resource rPString (SmallStr) { + "Small (10*10 matrix)" +}; + +resource rPString (LargeStr) { + "Large (5*5 matrix)" +}; + +// --- rTextForLETextBox2 Templates + +resource rTextForLETextBox2 (TileSize_LText) { + "Tile Size:" +}; + +resource rTextForLETextBox2 (TilerOptions_LText) { + "Tiler Options" +}; + +resource rTextForLETextBox2 (Speed_LText) { + "Speed:" +}; diff --git a/source/twilight/universe/makefile b/source/twilight/universe/makefile new file mode 100644 index 0000000..22baf87 --- /dev/null +++ b/source/twilight/universe/makefile @@ -0,0 +1,29 @@ + +# Twilight II Universe UNIX MakeFile +# by Jim Maricondo +# v1.0 - 10/24/92 8:38pm +# v1.1 - 1/2/93 2:32pm 3:18pm +# v1.1.1 - 1/9/93 1:19am +# v1.1.2 - 2/16/93 8:55pm - t2common.rez. (HB!??!) + +# First deal with all the dfork... + +Universe.d.root: Universe.asm Universe.mac 22/t2common.equ 22/dsdb.equ 22/makepdp.asm + compile +w Universe.asm keep=Universe.d + +Universe.d: Universe.d.root 22/random3.a.root + link +w Universe.d 22:random3.a keep=Universe.d + +# Now work with the rfork... + +Universe.r: Universe.rez 22/t2common.rez + compile Universe.rez keep=Universe.r + +# Now put it together. + +Universe: Universe.r Universe.d + duplicate -d Universe.d Universe + duplicate -r Universe.r Universe + setfile -at $4004 -t $bc universe -m . + cp Universe :jim1:system:cdevs:twilight:Universe + 22:beep diff --git a/source/twilight/universe/universe.asm b/source/twilight/universe/universe.asm new file mode 100644 index 0000000..d558da2 --- /dev/null +++ b/source/twilight/universe/universe.asm @@ -0,0 +1,1386 @@ + + mcopy Universe.Mac + keep Universe.d + copy 2:ainclude:e16.control + copy 2:ainclude:e16.types + copy 2:ainclude:e16.memory + copy 2:ainclude:e16.event + copy 2:ainclude:e16.resources + copy 22:t2common.equ + copy 22:dsdb.equ +*-----------------------------------------------------------------------------* +! Twilight II Universe Module. +! +! By Jim Maricondo. Thanks to Shawn G. Quick. +! +! v1.0b1 - 08 August 91 - Initial Version. +! v1.0b2 - 24 May 92 - Updated for G2MF ERS v1.1.1. (T2 v1.0d32-v1.0d33) +! v1.0b3 - 17 Sept 92 - Options partially implemented! +! v1.0b4 - 24 October 92 - Uses priv ipc (for random.) (T2 v1.0.1b1) +! v1.0b5 - 12 December 92 - Fixed Greg Templeman's bugs :-) (T2 v1.0.1b2) +! v1.0.1f1 - 1 Jan 93 - Smoothened everything for release. (T2 v1.0.1b3) +! +! Copyright (c) 1991, 1992, 1993 Jim Maricondo. All rights reserved. +*-----------------------------------------------------------------------------* +! You can experiment with this program to give faster motion through +! the galaxy by increasing the ZDEC (startspeed) variable. You may also want to +! increase/decrease the number of stars (INITSTARS) or the viewing +! angle (XYSPAN) and reassembling the program +*-----------------------------------------------------------------------------* +left gequ -160 full screen position +right gequ 160 +top gequ -100 +bottom gequ 100 +org_v gequ 160 center of universe, vertical +org_h gequ 100 center of universe, horizontal + +startstars gequ 165 max # of possible stars at beginning +initstars gequ 30 number of stars to display at start +autostars gequ 100 number of stars to zoom to +;maxstars gequ 190 maximum number of stars possible +;xyspan gequ $4000 ; defines viewing angle, MUST be power of 2 +;zspan gequ 255 farthest visible point, MUST be < 256 +screenbank gequ $00E1 bank number of where to draw +;startspeed gequ $06 speed at which stars approach viewer +! bigger is faster, 0 is stop + +* offsets into star record +;xpos gequ 0 X position of star in space +;ypos gequ 2 Y position of star in space +;zpos gequ 4 Z position of star in space +;xdraw gequ 6 last drawn x position +;ydraw gequ 8 last drawn y pos +;zdraw gequ 10 last drawn z pos +;starfill gequ 12 bytes 12-15 undefined + +screenptr gequ <128 pointer used to access screen +newx gequ screenptr+4 temp storage of star (used by drawstar) +newy gequ newx+2 +newz gequ newy+2 +sLookup gequ newz+2 +galaxy_xpos gequ sLookup+4 +galaxy_ypos gequ galaxy_xpos+4 +galaxy_zpos gequ galaxy_ypos+4 +galaxy_xdraw gequ galaxy_zpos+4 +galaxy_ydraw gequ galaxy_xdraw+4 +galaxy_zdraw gequ galaxy_ydraw+4 +movePtr gequ galaxy_zdraw+4 +*-----------------------------------------------------------------------------* +Universe Start + debug 'Universe' + Using MainDATA + kind $1000 ; no special memory! + + copy 22:dsdb.asm + + phb + phk + plb + phd + tdc + sta OurDP + tsc + tcd + + lda 2D transform: + +! screenX=spaceX/spaceZ +! screenY=spaceY/spaceZ + +; lda galaxy+zpos,y get the Z position in space + lda [galaxy_zpos],y ; neu + tax put in X (divisor) for divide +; lda galaxy+xpos,y get the X space of star + lda [galaxy_xpos],y ; neu + cmp u_xyspanD2 > 1/2 of xyspan? +! (which indicates negative condition) + blt nonegL0 no..so we're positive + sec set bit 15 of NEGFLAG + ror negflag + sec + sbc u_xyspanD2 subtract 1/2 of XYSPAN to make positive +! for divide. +nonegL0 anop + jsr divide newx=xpos/zpos + cpx #$8000 is remainder>0.5?? + blt testneg1L0 no..so no rounding + inc a round off result + +testneg1L0 bit negflag was the original value negative? + bpl pos1L0 no..so we're OK! + eor #$FFFF otherwise make two's complement + inc a +pos1L0 sta newx save our screen X position +! (3DX --> 2DX) + +! now...let's convert our Y coordinate + ldy offset get offset into galaxy of current star + stz negflag clear NEGFLAG from above +; lda galaxy+zpos,y get the Z space value in X (divisor) + lda [galaxy_zpos],y ; neu + tax +; lda galaxy+ypos,y get the Y space + lda [galaxy_ypos],y ; neu + cmp u_xyspanD2 is it negative? + blt noneg1L0 no..so do nothing with it + sec + ror negflag set our neg flag + sec and convert to positive + sbc u_xyspanD2 by subtracting 1/2 of XYSPAN + +noneg1L0 jsr divide newy=ypos/zpos + cpx #$8000 + blt testneg2L0 should we round off? + inc a round the A reg larger + +testneg2L0 bit negflag was it negative? + bpl pos2L0 + eor #$FFFF yes..so take 2's complement + inc a +pos2L0 sta newy now save our screen Y location + +; ldx offset again...get our offset to star rec +; lda galaxy+zpos,x put the Z space into our new Z var + ldy offset ; neu + tyx ; neu / needed? + lda [galaxy_zpos],y ; neu + sta newz + +! at this point we want to check to +! see if the star has changed position +! on the screen or if the Z position +! changes it's appearance. +! ; If nothing needs updating...we do nothing! + +; lda galaxy+xdraw,x test last drawn X position... + lda [galaxy_xdraw],y ; neu + cmp newx + bne drawL0 +; lda galaxy+ydraw,x test last drawn Y position... + lda [galaxy_ydraw],y ; neu + cmp newy + bne drawL0 + +! I changed the code slightly to get the +! program working properly..so this code +! looks unnessary since the Z will ALWAYS +! have changed...bear with me!!! + +; lda galaxy+zdraw,x test last Z condition vs. new condition + lda [galaxy_zdraw],y ; neu + cmp newz + bne drawL0 + brl nextstarL0 ; the star hasn't moved/changed so don't draw it + +drawL0 bit galaxyinit if the galaxy has just been initialized + bpl draw1L0 we don't have anything to erase +! because no stars have been drawn. + + pei newx save our NEW variables + pei newy since DRAWSTAR requires the star info in + pei newz NEWX..NEWZ and we don't want to lose +! this info just to erase!! +! THIS IS A GOOD PLACE TO OPTIMIZE +; ldx offset +; lda galaxy+xdraw,x get the star's last position into + ldy offset ; neu + tyx ; neu / needed? + lda [galaxy_xdraw],y ; neu + sta newx NEWX,NEWY,NEWZ +; lda galaxy+ydraw,x + lda [galaxy_ydraw],y ; neu + sta newy + stz newz zero in NEWZ means erase + jsr drawstar DRAW (erase) the old star + + pla restore the new values.... + sta newz + pla + sta newy + pla + sta newx + +draw1L0 anop +; ldx offset now get ready to draw the star in it's + ldy offset ; neu + tyx ; neu / needed? +! new position and format. + lda newx put new values into the last drawn part +! of the star record +; sta galaxy+xdraw,x + sta [galaxy_xdraw],y ; neu + lda newy +; sta galaxy+ydraw,x + sta [galaxy_ydraw],y ; neu + lda newz +; sta galaxy+zdraw,x + sta [galaxy_zdraw],y ; neu + + jsr drawstar all the parameters are there already +! so just draw the star + bcc nextstarL0 ; if carry clear the star is still on the screen + + lda numstars get number of last star + cmp starctL0 is it our current star? + bne nextstarL0 + lda deletestars any stars to delete? + beq nextstarL0 + dec deletestars + dec numstars + bne nsL0 + stz deletestars +nsL0 lda u_zspan ; if it has left the screen...we need a new + jsr newstar star on the horizon to replace it. + + +nextstarL0 dec starctL0 whew!! do it all again for more stars. + brl loopL0 + +exitL0 lda maxstar + sec + sbc numstars + sta starctL0 +lupV1 lda starctL0 + beq exit1L0 + dec starctL0 + brl lupV1 +exit1L0 sec + ror galaxyinit the galaxy has been drawn so set the +! init flag to false. + plp + rts + + End +*-----------------------------------------------------------------------------* +NewStar Start + debug 'Unv:NewStar' + Using MainDATA + + php enters with new Z position in A + longmx +; ldx offset get global offset to current star rec +; sta galaxy+zpos,x save the new Z value. + ldy offset ; neu + tyx ; neu / needed? + sta [galaxy_zpos],y ; neu + +; WordResult +; _Random +; pla get the number + jsl random + and u_xyspanS1 force into range... + pha save for later.. + +; WordResult get another random number +; _Random +; pla + jsl random + and u_xyspanS1 force into range + +; ldx offset get our offset +; sta galaxy+xpos,x save 1 random number into X pos + ldy offset ; neu + tyx ; neu / needed? + sta [galaxy_xpos],y ; neu + pla get the other number +; sta galaxy+ypos,x and put it in star's Y position + sta [galaxy_ypos],y ; neu + plp + rts + + End + +*-----------------------------------------------------------------------------* +DrawStar Start + debug 'Unv:DrawStar' + Using MainDATA + + php + longmx + + stz colorL2 set color bytes to 0 + + lda newz ; are we drawing (NEWZ<>0) or erasing (NEWZ=0) +; beq nocolorL2 + bne drawIt + ldx eraseOverride + beq noColorL2 + plp + rts + +drawIt anop + and #$00F0 do some tricks to get color number from + eor #$00F0 high nybble of the low byte of Z position. + lsr a the EOR is done so that higher Z pos + lsr a numbers (farther away) return lower + lsr a color numbers (blacker). + + tax thus, the stars get brighter as they move +! toward the viewer + + lda tblL2,x get the color word from table + sta colorL2 and save it + +nocolorL2 anop + + lda newx check to see if X screen is within + cmp #left our range (-160..159) + bge xokL2 + cmp #right + bge newL2 out of range..so signal this star +! has moved off of screen +xokL2 clc normalize the screen X so that origin + adc #org_v is at center of CRT + sta xL2 and save it. + + lda newy now check for in range Y (-100..99) + cmp #top + bge yokL2 + cmp #bottom + bge newL2 it's not..so signal off screen + +yokL2 clc + adc #org_h normalize origin at line 100 of CRT + + asl a create an index into scanline table + tax and remember it in X + + ldy #$00 now see if X position is even or odd + lsr xL2 shift our pixel count to convert to +! bytes (remember 320 mode has 2 pixels per byte!) + + bcc noinyL2 even/odd flag is now in carry + iny put carry into byte/mask index +noinyL2 anop + + phy + + txy + +! lda screentbl,x get the start address of this scanline + lda [SLookUp],y get the start address of this scanline + + tyx + + ply + + clc + adc xL2 add in shifted X byte + sta screenptr save in DP pointer + lda #screenbank get the bank number we are currently + sta screenptr+2 drawing to..and save in DP too. + + shortm we only need 8 bit here + lda [screenptr] get the current screen byte + and masktbl,y ; mask off which ever pixel we're dealing with + ora colorL2,y OR in color value + sta [screenptr] and put back on screen + longm back to 16 bit +xitL2 plp + clc carry clear indicates star OK and drawn + rts +newL2 plp + sec indicate this star is off screen + rts + + End +*-----------------------------------------------------------------------------* +Divide Start + debug 'Unv:Divide' + Using MainDATA + + longa on + longi on + + cpx #$0000 check for zero division + beq zeroL11 + cpx #$0001 check for divide by 1 + beq byoneL11 + +! you could check here for other special cases...like power of two divisors +! where you could do LSR's + + sta dividend save our stuff + stx divisor + + ldx #0 Start scale counter + + lda divisor put the divisor in A + bmi divL11 divisor > $7fff + +*-------------------------------------- +* Scale the divisor. Allign divisor to the left until > dividend +* or until bit 15 is set. Count in x. +*-------------------------------------- + +scaleL11 cmp dividend + bcs scaledL11 + inx + asl a + bpl scaleL11 +scaledL11 anop + sta divisor Scaled divisor + +* Start Subtracting + +divL11 lda dividend + stz quotient Clear quotient + +div1L11 tay save the A +div2L11 sec + sbc divisor Repeated conditional subtract + bcs rol1L11 subtraction successful? +rol0L11 tya restore old A (before subtact) + rol quotient ROL in a 0 + lsr divisor + dex + bpl div2L11 Y already has copy of A + + tax same exit code as below + lda quotient duplicated here to avoid a jmp/bra + rts + +rol1L11 rol quotient ROL in a 1 + lsr divisor + dex + bpl div1L11 back to div1 to save new A in Y + +exitL11 tax put remainder in X + lda quotient get the Quotient in A + rts return to caller + +zeroL11 ldx #$FFFF + txa division by 0 returns $FFFF/$FFFF + rts + +byoneL11 ldx #$00 zero remainder, A already has quotient + rts + + End +*-----------------------------------------------------------------------------* +up Start + debug 'Unv:up' + Using MainDATA + + longmx + lda numstars + cmp maxstar + jge loopL4 + inc numstars + lda numstars + dec a + asl a + asl a + asl a + asl a + sta offset + lda u_zspan + jsr newstar + brl loopL4 + + End +*-----------------------------------------------------------------------------* +StartUp Start + debug 'Unv:StartUp' + Using MainDATA + + ~GetAddress #1 ; get lookup table + PullLong SLookUp get pointer to table + +; ldx #$7D00+198 zero pixel data and SCB's only +; lda #0 +;nextScr sta SHR,x +; dex +; dex +; bpl nextScr + + ldx #$0000 make color table a gray scale + txa +grey sta PALETTES,x + clc + adc #$222 grays... + inx + inx + cpx #$10 + blt grey + + PushLong #toT2String + jsl init_random + +; ~ReadTimeHex ; set random seed +; _SetRandSeed +; plx +; plx + + LongResult + PushWord #0 ; hi word + lda u_maxstars + asl a ; x2 + asl a ; x4 + asl a ; x8 + asl a ; x16 + pha +; lda 0,.a +&BL SETA L:&SYSOPR+1 +.a +&REST AMID "&SYSOPR",2,&BL-2 + dc I1'$F4',I2'&REST' + MEND + MACRO +&lab longmx +&lab ANOP + rep #%00110000 + longa on + longi on + MEND + MACRO +&lab longm +&lab ANOP + rep #%00100000 + longa on + MEND + MACRO +&lab shortm +&lab ANOP + sep #%00100000 + longa off + MEND + MACRO +&lab killLdp +&lab pld + ply + ply + MEND + MACRO +&lab makeDP +&lab phd + tsc + tcd + 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 JCS &BP +&LAB BCC *+5 + BRL &BP + MEND + macro +&lab WordResult &zero +&lab anop + aif c:&zeros=1,.zero + phd + mexit +.zero +&lab pea $0000 + mend + macro +&lab LongResult &zeros +&lab anop + aif c:&zeros=1,.zeros + phd + phd + mexit +.zeros + pea $0000 + pea $0000 + mend + MACRO +&lab _NewHandle +&lab ldx #$0902 + jsl $E10000 + MEND + MACRO +&lab _NewControl2 +&lab ldx #$3110 + jsl $E10000 + 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 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",.ze +oPageReg + 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 ~GetCtlHandleFromID &ctlWindowPtr,&ctlID +&lab LongResult + ph4 &ctlWindowPtr + ph4 &ctlID + Tool $3010 + mend + MACRO +&lab dbrk &num + aif t:debugBreaks="G",.begin + mexit +.begin + brk &num + MEND + macro +&lab ~GetCurResourceApp +&lab wordresult + Tool $141E + mend + MACRO +&LAB JGE &BP +&LAB BLT *+5 + BRL &BP + MEND + MACRO +&lab _SetCurResourceFile +&lab ldx #$111E + jsl $E10000 + MEND + macro +&lab ~SetCurResourceFile &fileID +&lab ph2 &fileID + Tool $111E + mend + MACRO +&lab str &string +&lab dc i1'L:&string',C'&string' + MEND + MACRO +&lab _AddResource +&lab ldx #$0C1E + jsl $E10000 + MEND + MACRO +&lab _ReleaseResource +&lab ldx #$171E + jsl $E10000 + MEND + macro +&lab ~UpdateResourceFile &fileID +&lab ph2 &fileID + Tool $0D1E + mend + macro +&lab Tool &number +&lab ldx #&number + jsl $E10000 + mend + MACRO +&lab _UDivide +&lab ldx #$0B0B + jsl $E10000 + MEND + MACRO +&lab _CallCtlDefProc +&lab ldx #$2C10 + jsl $E10000 + MEND + MACRO +&lab _MakeThisCtlTarget +&lab ldx #$2810 + jsl $E10000 + MEND + macro +&lab ~GetAddress &tableID +&lab LongResult + ph2 &tableID + Tool $0904 + mend + macro +&lab ~UniqueResourceID &IDRange,&resourceType +&lab LongResult + ph2 &IDRange + ph2 &resourceType + Tool $191E + mend + MACRO +&lab _RMSetResourceName +&lab ldx #$2D1E + jsl $E10000 + MEND + MACRO +&lab _GetWRefCon +&lab ldx #$290E + jsl $E10000 + 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 _MarkResourceChange +&lab ldx #$101E + jsl $E10000 + MEND + macro +&lab ~MMStartUp +&lab WordResult + Tool $0202 + mend diff --git a/source/twilight/universe/universe.rez b/source/twilight/universe/universe.rez new file mode 100644 index 0000000..2acee4e --- /dev/null +++ b/source/twilight/universe/universe.rez @@ -0,0 +1,476 @@ + +#include "types.rez" +#include "22:t2common.rez" + +// --- type $8003 defines +#define univCtlLst 1 +// --- type $8004 defines +#define CTLTMP_00006FF9 1 +#define VisionFieldStrCtl 2 +#define CTLTMP_00006FFB 3 +#define CTLTMP_00006FFC 4 +#define CTLTMP_00006FFD 5 +#define CTLTMP_00006FFE 6 +#define ViewingAngleStrCtl 7 +#define StarSpeedStrCtl 8 +#define UniverseOptionsStrCtl 9 +#define iconCtl 10 +// --- type $800B defines +#define LETXTBOX_00000001 $000000c1 +#define LETXTBOX_00000002 $000000c2 +#define LETXTBOX_00000003 $000000c3 +#define LETXTBOX_00000004 $000000c4 +#define LETXTBOX_00000005 $000000c5 +// --- type rDataList ($1986) defines +#define fieldOfVisionDataList 1 +#define MaxStarsDataList 2 +#define viewingAngleDataList 3 +#define StarSpeedDataList 4 +// --- type rTaggedStrings ($802E) defines +#define fieldOfVisionStrings 1 +#define MaxStarsFieldStrings 2 +#define viewingAngleFieldStrings 3 +#define starSpeedFieldStrings 4 + +resource rT2ModuleFlags (moduleFlags) { + fFadeOut+fFadeIn+fSetup+fGrafPort320, // module flags word + $01, // enabled flag (unimplemented) + $0110, // minimum T2 version required + NIL, // reserved + "Universe" // module name +}; + +// --- About text resource + +resource rTextForLETextBox2 (moduleMessage) { + TBLeftJust + TBBackColor TBColorF + TBForeColor TBColor4 + "Universe" + TBForeColor TBColor1 + " simulates an intergalactic trek through the cosmos.\n" + "Relax and enjoy the ride!" +}; + +// --- Version resource + +resource rVersion (moduleVersion) { + {1,0,1,release,0}, // Version + verUS, // US Version + "T2 Universe Module", // program's name + "By J.Maricondo. Thanks S.Quick!\n" + "Copyright 1990-93, Jim Maricondo." // copyright notice +}; + +// --- About icon resource + +resource rIcon (moduleIcon) { + $8000, // kind + $0014, // height + $0016, // width + + $"0000000000000000000000" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0F000000000000000000F0" + $"0F00000000F000000F00F0" + $"0F00F000000030F00000F0" + $"0F000000C00C00000000F0" + $"0F000300000000F00C00F0" + $"0F00000F0030C000CF30F0" + $"0F000C00000000000C00F0" + $"0F00CF3030C003000000F0" + $"0F000C00000F0000F000F0" + $"0F000000000000000000F0" + $"0FFFFFFFFFFFFFFFFAFFF0" + $"0000000000000000000000" + $"F0FFFFFFFFFFFFFFFFFF0F" + $"F0FFFFFFFFFFFFFFFFFF0F" + $"F0FF4AFFFFFFFFFFFFFF0F" + $"F0CCCCCCCCCCCCCCCCCC0F" + $"F0FFFFFFFFFFFFFFFAFF0F" + $"F00000000000000000000F", + + $"0FFFFFFFFFFFFFFFFFFFF0" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0"; +}; + +// --- Control List Definitions + +resource rControlList (1) { + { + 2, + 3, + 7, + 8, + 9, + 10, + }; +}; + +// --- Control Templates + +// -- FIELD OF VISION DATAFIELD CONTROL TEMPLATE + +resource rControlTemplate (1) { + 1, // ID + {108,136,121,190}, // rect 246 + dataFieldControl {{ + ctlVisible, // flag + fCtlCanBeTarget+RefIsResource, // moreFlags + NIL, // refCon + fieldOfVisionDataList, // dataListRef + {0,0,0,0,0,0,0,0} // fieldValues + }}; +}; + +// -- MAXIMUM STARS DATAFIELD CONTROL TEMPLATE + +resource rControlTemplate (4) { + 2, // ID + { 94,136,107,190}, // rect + dataFieldControl {{ + ctlVisible, // flag + fCtlCanBeTarget+RefIsResource, // moreFlags + NIL, // refCon + MaxStarsDataList, // dataListRef + {0,0,0,0,0,0,0,0} // fieldValues + }}; +}; + +// -- VIEWING ANGLE DATAFIELD CONTROL TEMPLATE + +resource rControlTemplate (5) { + 3, // ID + { 80,136, 93,210}, // rect 210,214 + dataFieldControl {{ + ctlVisible, // flag + fCtlCanBeTarget+RefIsResource, // moreFlags + NIL, // refCon + viewingAngleDataList, // dataListRef + {0,0,0,0,0,0,0,0} // fieldValues + }}; +}; + +// -- STAR SPEED DATAFIELD CONTROL TEMPLATE + +resource rControlTemplate (6) { + 4, // ID + { 66,136, 79,180}, // rect + dataFieldControl {{ + ctlVisible, // flag + fCtlCanBeTarget+RefIsResource, // moreFlags + NIL, // refCon + StarSpeedDataList, // dataListRef + {0,0,0,0,0,0,0,0} // fieldValues + }}; +}; + +resource rControlTemplate (2) { + 5, // ID + {110, 20,119,133}, // rect + statTextControl {{ + ctlVisible, // flag + $1002, // moreFlags + $00000000, // refCon + LETXTBOX_00000005 // textRef + }}; +}; + +resource rControlTemplate (3) { + 6, // ID + { 96, 20,106,125}, // rect + statTextControl {{ + ctlVisible, // flag + $1002, // moreFlags + $00000000, // refCon + LETXTBOX_00000004 // textRef + }}; +}; + +resource rControlTemplate (7) { + 7, // ID + { 82, 20, 91,125}, // rect + statTextControl {{ + $0000, // flag + $1002, // moreFlags + $00000000, // refCon + LETXTBOX_00000003 // textRef + }}; +}; + +resource rControlTemplate (8) { + 8, // ID + { 68, 20, 78,103}, // rect + statTextControl {{ + $0000, // flag + $1002, // moreFlags + $00000000, // refCon + LETXTBOX_00000002 // textRef + }}; +}; + +resource rControlTemplate (9) { + 9, // ID + { 51,116, 60,239}, // rect + statTextControl {{ + $0000, // flag + $1002, // moreFlags + $00000000, // refCon + LETXTBOX_00000001 // textRef + }}; +}; + +resource rControlTemplate (10) { + 10, // ID + { 24,148, 50,202}, // rect + iconButtonControl {{ + $000C, //no border, don't track hits! flag + $1020, // moreFlags + $00000000, // refCon + moduleIcon, // iconRef + 0, // titleRef + 0, // colorTableRef + $0000 // displayMode + }}; +}; + +// --- rTextForLETextBox2 Templates + +resource rTextForLETextBox2 (LETXTBOX_00000001) { + "Universe Options" +}; + +resource rTextForLETextBox2 (LETXTBOX_00000002) { + "Star Speed: " +}; + +resource rTextForLETextBox2 (LETXTBOX_00000003) { + "Visibility:" +/* "Viewing Angle:"*/ +}; + +resource rTextForLETextBox2 (LETXTBOX_00000004) { + "Maximum Stars:" +}; + +resource rTextForLETextBox2 (LETXTBOX_00000005) { +/* "Field of Vision:"*/ + "Star proximity:" +}; + +/* This structure describes the relative locations and strings associated with + each data field. Since there may be from 1 to 8 data fields in each control, + these location/string reference pairs repeat for each field. */ + +resource rDataList (fieldOfVisionDataList, nospecialmemory,nocrossbank) { + { + {2,6}, // relative location of this field + fieldOfVisionStrings // reference to this field's string list + }; +}; + +resource rDataList (MaxStarsDataList, nospecialmemory,nocrossbank) { + { + {2,6}, // relative location of this field + MaxStarsFieldStrings // reference to this field's string list + }; +}; + +resource rDataList (viewingAngleDataList, nospecialmemory,nocrossbank) { + { + {2,6}, // relative location of this field + viewingAnglefieldStrings // reference to this field's string list + }; +}; + +resource rDataList (starSpeedDataList, nospecialmemory,nocrossbank) { + { + {2,6}, // relative location of this field + starSpeedFieldStrings // reference to this field's string list + }; +}; + +/* These are the tagged strings that are associated with each field in the + control. The tag value that is specified is used to track the current value + of each field. If you wish only to have a list of integers displayed, simply + provide the tag values and null (empty) strings as in the second field. */ + +resource rTaggedStrings (fieldOfVisionStrings) { + { + 5,"5", + 10,"10", + 15,"15", + 20,"20", + 25,"25", + 30,"30", + 35,"35", + 40,"40", + 45,"45", + 50,"50", + 55,"55", + 60,"60", + 65,"65", + 70,"70", + 75,"75", + 80,"80", + 85,"85", + 90,"90", + 95,"95", + 100,"100", + 105,"105", + 110,"110", + 115,"115", + 120,"120", + 125,"125", + 130,"130", + 135,"135", + 140,"140", + 145,"145", + 150,"150", + 155,"155", + 160,"160", + 165,"165", + 170,"170", + 175,"175", + 180,"180", + 185,"185", + 190,"190", + 195,"195", + 200,"200", + 205,"205", + 210,"210", + 215,"215", + 220,"220", + 225,"225", + 230,"230", + 235,"235", + 240,"240", + 245,"245", + 250,"250", + 255,"255" + }; +}; + +resource rTaggedStrings (MaxStarsFieldStrings) { + { + 15,"15", + 20,"20", + 25,"25", + 30,"30", + 35,"35", + 40,"40", + 45,"45", + 50,"50", + 55,"55", + 60,"60", + 65,"65", + 70,"70", + 75,"75", + 80,"80", + 85,"85", + 90,"90", + 95,"95", + 100,"100", + 105,"105", + 110,"110", + 115,"115", + 120,"120", + 125,"125", + 130,"130", + 135,"135", + 140,"140", + 145,"145", + 150,"150", + 155,"155", + 160,"160", + 165,"165", + 170,"170", + 175,"175", + 180,"180", + 185,"185", + 190,"190", + 195,"195", + 200,"200", + 205,"205", + 210,"210", + 215,"215", + 220,"220", + 225,"225", + 230,"230", + 235,"235", + 240,"240", + 245,"245", + 250,"250", + 255,"255", + 260,"260", + 265,"265", + 270,"270", + 275,"275", + 280,"280", + 285,"285", + 290,"290", + 295,"295", + 300,"300" + }; +}; + +resource rTaggedStrings (viewingAngleFieldStrings) { + { +/* 2,"2", + 4,"4", + 8,"8", + 16,"16", + 32,"32", + 64,"64", + 128,"128", */ + 256,"256", + 512,"512", + 1024,"1024", + 2048,"2048", + 4096,"4096", + 8192,"8192", + 16384,"16384", + 32768,"32768"/*, + 32769,"65536", + 32770,"131072", + 32771,"262144" // 2 ^ 18 */ + }; +}; + +resource rTaggedStrings (starSpeedFieldStrings) { + { + 1,"1", + 2,"2", + 3,"3", + 4,"4", + 5,"5", + 6,"6", + 7,"7", + 8,"8", + 9,"9", + 10,"10", + 11,"11", + 12,"12", + 13,"13", + 14,"14", + 15,"15" + }; +}; diff --git a/source/twilight/worms/Worms.Mac b/source/twilight/worms/Worms.Mac new file mode 100644 index 0000000..68ecc5f --- /dev/null +++ b/source/twilight/worms/Worms.Mac @@ -0,0 +1,202 @@ + MACRO +&lab _UDivide +&lab ldx #$0B0B + jsl $E10000 + 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 WordResult +&lab phd + MEND + MACRO +&LAB JEQ &BP +&LAB BNE *+5 + BRL &BP + MEND + MACRO +&lab str &string +&lab dc i1'L:&string',C'&string' + MEND + macro +&lab QDRect +&lab anop +&lab._top ds 2 +&lab._left ds 2 +&lab._bottom ds 2 +&lab._right ds 2 + mend + macro +&lab ~PaintOval &rectPtr +&lab ph4 &rectPtr + Tool $5904 + mend + MACRO +&LAB JNE &BP +&LAB BEQ *+5 + BRL &BP + MEND + macro +&lab ~GetMasterSCB +&lab WordResult + Tool $1704 + mend + macro +&lab ~Set640Color &color +&lab ph2 &color + Tool $db04 + mend + MACRO +&LAB PH2 &N1 + LCLC &C +&LAB ANOP +&C AMID &N1,1,1 + AIF "&C"="#",.D + AIF S:LONGA=1,.A + REP #%00100000 +.A + AIF "&C"<>"{",.B +&C AMID &N1,L:&N1,1 + AIF "&C"<>"}",.G +&N1 AMID &N1,2,L:&N1-2 + LDA (&N1) + PHA + AGO .E +.B + LDA &N1 + PHA + AGO .E +.D +&N1 AMID &N1,2,L:&N1-1 + PEA &N1 + AGO .F +.E + AIF S:LONGA=1,.F + SEP #%00100000 +.F + MEXIT +.G + MNOTE "Missing closing '}'",16 + MEND + MACRO +&LAB PH4 &N1 + LCLC &C +&LAB ANOP +&C AMID &N1,1,1 + AIF "&C"="#",.D + AIF S:LONGA=1,.A + REP #%00100000 +.A + AIF "&C"<>"{",.B +&C AMID &N1,L:&N1,1 + AIF "&C"<>"}",.G +&N1 AMID &N1,2,L:&N1-2 + LDY #2 + LDA (&N1),Y + PHA + LDA (&N1) + PHA + AGO .E +.B + AIF "&C"<>"[",.C + LDY #2 + LDA &N1,Y + PHA + LDA &N1 + PHA + AGO .E +.C + LDA &N1+2 + PHA + LDA &N1 + PHA + AGO .E +.D +&N1 AMID &N1,2,L:&N1-1 + PEA +(&N1)|-16 + PEA &N1 + AGO .F +.E + AIF S:LONGA=1,.F + SEP #%00100000 +.F + MEXIT +.G + MNOTE "Missing closing '}'",16 + MEND + MACRO +&lab _GetSCB +&lab ldx #$1304 + jsl $E10000 + MEND + MACRO +&lab _SetSCB +&lab ldx #$1204 + jsl $E10000 + MEND + macro +&lab Tool &number +&lab ldx #&number + jsl $E10000 + mend diff --git a/source/twilight/worms/makefile b/source/twilight/worms/makefile new file mode 100644 index 0000000..5cc956b --- /dev/null +++ b/source/twilight/worms/makefile @@ -0,0 +1,26 @@ + +# Twilight II Worms UNIX MakeFile +# by Jim Maricondo +# v1.0 - 1/2/93 4:43pm + +# First deal with all the dfork... + +worms.d.root: worms.asm worms.mac 22/t2common.equ 22/dsdb.equ + compile +w worms.asm keep=worms.d + +worms.d: worms.d.root 22/random3.a.root + link +w worms.d 22:random3.a keep=worms.d + +# Now work with the rfork... + +worms.r: worms.rez 22/t2common.rez + compile worms.rez keep=worms.r + +# Now put it together. + +worms: worms.r worms.d + duplicate -d worms.d worms + duplicate -r worms.r worms + setfile -at $4004 -t $bc worms -m . + cp worms :jim1:system:cdevs:twilight:worms + 22:beep diff --git a/source/twilight/worms/worms.asm b/source/twilight/worms/worms.asm new file mode 100644 index 0000000..123f5f6 --- /dev/null +++ b/source/twilight/worms/worms.asm @@ -0,0 +1,331 @@ + +*-----------------------------------------------------------------------------* +! Twilight II Worms Module. ! +! ! +! By Jim Maricondo and Jonah Stich. ! +! ! +! Copyright (c) 1991-1993 Jim Maricondo. All rights reserved. ! +*-----------------------------------------------------------------------------* + mcopy worms.mac + copy 22:t2common.equ + copy 22:dsdb.equ + copy 13:ainclude:e16.quickdraw + keep worms.d +*-----------------------------------------------------------------------------* +movePtr gequ <0 +*-----------------------------------------------------------------------------* +Worms Start + using WormsDATA + kind $1000 ; no special memory + + copy 22:dsdb.asm + + phb + phd + phk + plb + + lda T2Message,s + cmp #BlankT2 ;must be BlankT2 + jne skip + +; ~InitColorTable #wormsPalette +; ~SetColorTable #0,#wormsPalette + + lda #0 + sta T2Result,s + sta T2Result+2,s + + PushLong #toT2String + jsl init_random + + lda T2data1,s + sta movePtr + lda T2data1+2,s + sta movePtr+2 + + ldx #200-1 +forcePal0 phx + phx + phd + phx + _GetSCB + pla + and #$F0 + pha + _SetSCB + plx + dex + bpl forcePal0 + + ~GetMasterSCB + pla + bit #mode640 + beq on320 + lda #310 + sta modeFill0+1 + lda #330 + sta modeFill1+1 + lda #640 + sta horizFill+1 + lda #6 ; was 6 + sta modew + asl a + sta modew2 + bra allFilled + +on320 anop + lda #155 + sta modeFill0+1 + lda #165 + sta modeFill1+1 + lda #320 + sta horizFill+1 + lda #3 + sta modew + sta modew2 + +allFilled anop + + lda #15 + sta initTop+1 + lda #25 + sta initTop2+1 + + ldx #0 +initTop lda #15 + sta CircRects,x ; top +initTop2 lda #25 + sta CircRects+4,x ; bottom +modeFill0 lda #155 + sta CircRects+2,x ; left +modeFill1 lda #165 + sta CircRects+6,x ; right + lda initTop+1 + clc + adc #10 + sta initTop+1 + lda initTop2+1 + clc + adc #10 + sta initTop2+1 + txa + clc + adc #8 + tax + cmp #8*16 + blt initTop + +again anop + ~Set640Color #0 + ~PaintOval #CircRect1 +; ~Set640Color #0 +; ~FrameOval #CircRect1 + + ~Set640Color #1 + ~PaintOval #CircRect2 +; ~Set640Color #0 +; ~FrameOval #CircRect2 + + ~Set640Color #2 + ~PaintOval #CircRect3 +; ~Set640Color #0 +; ~FrameOval #CircRect3 + + ~Set640Color #3 + ~PaintOval #CircRect4 +; ~Set640Color #0 +; ~FrameOval #CircRect4 + + ~Set640Color #4 + ~PaintOval #CircRect5 +; ~Set640Color #0 +; ~FrameOval #CircRect5 + + ~Set640Color #5 + ~PaintOval #CircRect6 +; ~Set640Color #0 +; ~FrameOval #CircRect6 + + ~Set640Color #6 + ~PaintOval #CircRect7 +; ~Set640Color #0 +; ~FrameOval #CircRect7 + + ~Set640Color #7 + ~PaintOval #CircRect8 +; ~Set640Color #0 +; ~FrameOval #CircRect8 + + ~Set640Color #8 + ~PaintOval #CircRect9 + + ~Set640Color #9 + ~PaintOval #CircRect10 + + ~Set640Color #10 + ~PaintOval #CircRect11 + + ~Set640Color #11 + ~PaintOval #CircRect12 + + ~Set640Color #12 + ~PaintOval #CircRect13 + + ~Set640Color #13 + ~PaintOval #CircRect14 + + ~Set640Color #14 + ~PaintOval #CircRect15 + + ~Set640Color #15 + ~PaintOval #CircRect16 + + ldx #0 +bigLoop phx + + WordResult + WordResult + jsl random + pha + PushWord #3 + _UDivide + pla + PullWord XInc + + WordResult + WordResult + jsl random + pha + PushWord #3 + _UDivide + pla + PullWord YInc + + plx + + lda YInc +; cmp #0 + bne tryDown + lda CircRects,x + sec + sbc modew ;#3 +; bmi doHoriz + bpl doUp ;neu + cmp #-2 ;neu + blt doHoriz ;neu +doUp sta CircRects,x + lda CircRects+4,x + sec + sbc modew + sta CircRects+4,x + bra doHoriz + +tryDown cmp #1 + bne doHoriz + lda CircRects,x + clc + adc modew + cmp #200 + bge doHoriz + sta CircRects,x + lda CircRects+4,x + clc + adc modew + sta CircRects+4,x + +doHoriz lda XInc +; cmp #0 + bne tryRight + lda CircRects+2,x + sec + sbc modew2 +; bmi doneCirc + bpl doLeft ; neu + cmp #-2 ;neu + blt doneCirc ;neu - should it be try Right? +doLeft sta CircRects+2,x + lda CircRects+6,x + sec + sbc modew2 + sta CircRects+6,x + bra doneCirc + +tryRight cmp #1 + bne doneCirc + lda CircRects+2,x + clc + adc modew2 +horizFill cmp #320 + bge doneCirc + sta CircRects+2,x + lda CircRects+6,x + clc + adc modew2 + sta CircRects+6,x + +doneCirc txa + clc + adc #8 + cmp #8*16 + bge doneLoop + tax + brl bigLoop + +doneLoop lda [movePtr] + jeq again + +; brk + +skip anop + pld + plb + lda 2,s + sta 2+10,s + lda 1,s + sta 1+10,s + tsc Remove input paramaters + clc + adc #10 + tcs + clc + rtl + + End +*-----------------------------------------------------------------------------* +WormsDATA Data +; kind $1000 ; no special memory + +CircRects anop +CircRect1 QDRect +CircRect2 QDRect +CircRect3 QDRect +CircRect4 QDRect +CircRect5 QDRect +CircRect6 QDRect +CircRect7 QDRect +CircRect8 QDRect +CircRect9 QDRect +CircRect10 QDRect +CircRect11 QDRect +CircRect12 QDRect +CircRect13 QDRect +CircRect14 QDRect +CircRect15 QDRect +CircRect16 QDRect + +XInc ds 2 +YInc ds 2 + +;wormsPalette ds 32 + +;ColorTable dc i'$000,$777,$841,$72C,$00f,$080,$f70,$d00,$fa9,$ff0,$0e0' +; dc i'$4df,$DAF,$78f,$CCC,$fff' + +modew ds 2 ;3 for 320, 6 for 640 +modew2 ds 2 ;3 for 320, 12 for 640 + +toT2String str 'DYA~Twilight II~' + + End +*-----------------------------------------------------------------------------* \ No newline at end of file diff --git a/source/twilight/worms/worms.rez b/source/twilight/worms/worms.rez new file mode 100644 index 0000000..3ece6ed --- /dev/null +++ b/source/twilight/worms/worms.rez @@ -0,0 +1,83 @@ + +#include "types.rez" +#include "22:t2common.rez" + +resource rT2ModuleFlags (moduleFlags) { + fLeavesUsableScreen+fReqUsableScreen, // module flags word + $01, // enabled flag (unimplemented) + $0110, // minimum T2 version required + NIL, // reserved + "Worms" // module name +}; + +// --- About text resource + +resource rTextForLETextBox2 (moduleMessage) { + TBLeftJust + TBBackColor TBColorF + TBForeColor TBColor4 + "Worms" + TBForeColor TBColor1 + " draws multicolored, circular bodied worms across all parts of your " + "screen, leaving their trails behind." +}; + +// --- Version resource + +resource rVersion (moduleVersion) { + {1,0,0,release,0}, // Version + verUS, // US Version + "T2 Worms Module", // program's name + "By J. Maricondo and Stich.\n" + "Copyright 1991-93, Jim Maricondo." // copyright notice +}; + +// --- About icon resource + +resource rIcon (moduleIcon) { + $8000, // kind + $0014, // height + $001C, // width + + $"FFF0000000000000000000000FFF" + $"FFF0FFFFFFFFFFFFFFFFFFFF0FFF" + $"FFF0F000000000000000000F0FFF" + $"FFF0F000800000800000800F0FFF" + $"FFF0F008000008000008000F0FFF" + $"FFF0F008002008002008000F0FFF" + $"FFF0F000800800800800800F0FFF" + $"FFF0F000800800800800800F0FFF" + $"FFF0F002008002008002000F0FFF" + $"FFF0F000008000008000000F0FFF" + $"FFF0F000000800000800000F0FFF" + $"FFF0F000000000000000000F0FFF" + $"FFF0FFFFFFFFFFFFFFFFAFFF0FFF" + $"FFF0000000000000000000000FFF" + $"FFFF0FFFFFFFFFFFFFFFFFF0FFFF" + $"FFFF0FFFFFFFFFFFFFFFFFF0FFFF" + $"FFFF0FF4AFFFFFFFFFFFFFF0FFFF" + $"FFFF0CCCCCCCCCCCCCCCCCC0FFFF" + $"FFFF0FFFFFFFFFFFFFFFAFF0FFFF" + $"FFFF00000000000000000000FFFF", + + $"000FFFFFFFFFFFFFFFFFFFFFF000" + $"000FFFFFFFFFFFFFFFFFFFFFF000" + $"000FFFFFFFFFFFFFFFFFFFFFF000" + $"000FFFFFFFFFFFFFFFFFFFFFF000" + $"000FFFFFFFFFFFFFFFFFFFFFF000" + $"000FFFFFFFFFFFFFFFFFFFFFF000" + $"000FFFFFFFFFFFFFFFFFFFFFF000" + $"000FFFFFFFFFFFFFFFFFFFFFF000" + $"000FFFFFFFFFFFFFFFFFFFFFF000" + $"000FFFFFFFFFFFFFFFFFFFFFF000" + $"000FFFFFFFFFFFFFFFFFFFFFF000" + $"000FFFFFFFFFFFFFFFFFFFFFF000" + $"000FFFFFFFFFFFFFFFFFFFFFF000" + $"0000FFFFFFFFFFFFFFFFFFFF0000" + $"0000FFFFFFFFFFFFFFFFFFFF0000" + $"0000FFFFFFFFFFFFFFFFFFFF0000" + $"0000FFFFFFFFFFFFFFFFFFFF0000" + $"0000FFFFFFFFFFFFFFFFFFFF0000" + $"0000FFFFFFFFFFFFFFFFFFFF0000" + $"0000FFFFFFFFFFFFFFFFFFFF0000"; +}; diff --git a/source/twilight/ydi/Blank.Atf b/source/twilight/ydi/Blank.Atf new file mode 100644 index 0000000000000000000000000000000000000000..63bb0edfe85047cf78c130655a8fabfff4fb07f1 GIT binary patch literal 8007 zcmeHM&5jf|5U$>tVVA(r2W~m!M@j++g+z*!=NYwNFXG{i6gJEPZ8x6a^jdH zJsZ$+n->^uZn>@c1(5T7WtYd@)7>+W9TvgNs@iV5{JC6ZS5#GY03IJ=u6=K3c3}_J(RzI_CY^_)-k88X`O5Q9ffRytz&J5X>0rj^L!4v7Utxm?7iJJfcL02hX!%}!i07up>s4j8ds$`BY)B%L_NTtyd(iXTv7y#-~7 zFv3X;#unFrAp_a6_622>dH^}8ltdIn_##nV1A;4LcNmy)0t1O!Nfbx^L0;A6P*(;e z%@vv$C@K?@Hw@D20ypRJEY9PHX_EgFZa2{%Sxj_EALjmfkA0Pfz!-ajr&mXAVM4rD zr?-mRpkxrqtHT)Alepo-oCT4_Foa(X+nN!SGSXLzNj)H?>~KP|BSTKYwa3ta)e_^< zh0G-)7;r=|YzbJ5Zi})(FO1exq%U4JhRt3$c4`C;tB;{JsEjLIhKQljT6H{(WY2=x zI>l3CtH8*rY9A}5Y^%1hBIE{^U-k3Dtd*t(b^Zm1vFWbsIw)wPmUmSx>rEa8yj6HH z>o)&jDpEbiarCEs@y=l9xDs`YIK>CJdq7&h-*JZ^#fksM7>iswIr#@J48Xno1Mjad zdVYW}!H0jM6T6`Br_Mfvhit-EJ*$N?q)!}q=?k}o*ITX1k?9e=b4#Rudp%f)Gb6T3 znN6b!5jv^k1KO}x0~&9Kff*L*VK(&+Jn~sF2dkOP&UI|)6)ZE618iBrr5fXOAtP>h zpF+$dUc}+m9gdK5de%Z@=NZA7icJ7vA`+RH7KOdjoK4&_FvgMRb#C3lnn3YWeh4f} z8#+<+P(>Jh3r!mB*|W`r#%Cb7K-j}aJmT>olxI*UovjL)vZEE74Wf>AVN zC)jm5p&jg?lNQiIhMdsym<3tefSF`%n}eao6qgsFum-Fjl;y3X?|}98oJ$$<9&NzV zO>8t%mVPS8tC)#m9Z`budh{P(dYsFRd_PToJeJ;Plc4ER&@VK-l zZB_JQD;mANr<~JR0Uh%K4%H>ia>(ehT`WnP1hYgnFQRR|jtHFDF)*P%ZuN*ts$5D6^AV)J=VeuK= z4c=w1x{RkN3uYiAv7hCX$`CQaCI_OvMMRw(i2ttq_d9el+`oJCGm*c3{_`XJ^X!rc gOa7XrZxwlx?Pf=aOpnk2_ZrFi`$~kB+OPfnKhlEpMF0Q* literal 0 HcmV?d00001 diff --git a/source/twilight/ydi/Disk.EATF b/source/twilight/ydi/Disk.EATF new file mode 100644 index 0000000000000000000000000000000000000000..5365d0d03176b88fa17cef4bb685067ef95a13de GIT binary patch literal 38317 zcmeHQTaO&ab*|}|*{h_nphU10!x=9F^C1tUNkIbgV!Jgpa6#R#HAL{o8N?me}Ko|cdDwZFV(ZV zGu_K5ZV9zBQ>RazQ>QN7{JyH{M}MSL>yJM3xzEq5Pd6G$ssB>__U3%FcxQR03zuhV=JHFCoE>eEtVM ze~4t|-^F)cGer7kBE4w7-@xZzA^i!`XOX^u^s-6J`%9Dl5ug8V@_&p^{$}ELCd$5# z#JukzSv~7}vQCrg_+{ua(f{utu`WN!B-WRCwyuAN@2nr|`He*SSM&WkK3_mO%{rcg zy^kZEM|wPyuHrXiK0vyHw28!c{SDGTA<^%DF`sPfe@0>~7?-aiJ)cOdGuxFh|2opM zNNY%!k-lxxAL8>FlbH7dB*u@iwe867v~>-Mv0^{_l1cP6TL=Dr4C(ifSl15H@0)bi zdtpcmuRi+zarN9jecKS zyF+Wpg*7$U?Faq7v1tXgIo0K~j6$sCds0uewtG=sr0Jijdo+z~m~IS^-?%8IodBk% zy}qr>kB#4Ewbj~=YIRjhJ(YCewsBxbwY#dRo=Q29)C-FAR5w(O0zJy8mvzWQV^sxh zUF^X@Iv%U42}i{lCz47)2X3+oPM~859XRRJK_J8l(TJlWP6W8EhlA#Gf3_}VN~76! zSsp;xRqD*@Q@U6ug)56%7(9NVNE5TknQoCLgc4G3M+w%t^y;#SjTPt9^{mD_(L^!#&sbll~xN?8$#2EoD7Rv_kMJwcBlR|Bn_U+UoEgM%9 z*}C0uw@LNU*{;tRzqf6t9y=Alfo&b>?Re@*Od(Dvkw)v7DP&qbI7E9k8u#vuP;g`I z@k>1&<^4O`dL|wr9KnDB6AveuO{0BTN{T(WJ(>%Ljg4n7U2J?3H-isd-rv40F5Dh1 zY-|jM5CospcLOJxRRvDaO6&w$e+M_7%a~5*1~NAGZ<;_rG89Q;jyL7&Nx_UNZC#l4 zV*lm{Ua04Bi@l_MxGg?N{*d|Vl6a8Fp89gwW-%Gt&*9GdgsH!@g0YQ!^@Ogy%id5^ zUe0MjL}Y-nXE zAIek9__Htms6XFbX?!Bt4<&!deD#S$FP!ai+V=DT4mjHhQjz5lHNC*)qa~(R$X5Oq z8)J76>Y8tBBg~ASiLdV`a!-CK3{u~={@t6S=BtAT2ZQs{ApTP*4Bl)qb|&r*L|oEzPYMqANnbaQKj|M4T- zQll_>RC{~s(uQu64{P6|Q50?697UsB_%hl?+6tq`OeB$gs?q><8Mg)c22ZwLe)XLP z--))gJJV;hbs4tkyJ&-`z1MH`&qvXJhS8$5cDb1*%B;yk}?-v znXKKCn1j7`FAP^!d%xB1oxeq!kyLS1m1HSlhki8KfIHC~+=zY}t?%^a`s=;((JchK zCEfn?WTqh=Vq_vX1D9?^(R$dM@ArG~i5;LL(K&so@r}{CyAwUkXx)j{d%ZrQWn7bR zow6|PR=~a#HP(Bp{iY6=^{Hx!&kwb}+HYlIqy4B(;`8GXw9u;bpb^H`@>|k_b|URc zMZyo|Y}&Dg4x%l$r1ylqeJrvw^-pxN6T3yzp* zUzaRvsuB*tVRadXg2q#rmWA?4Wf2NliuQG3DQw;EISwHKjtGkQP~=EV`M-e;s82NRRk$8xu|eod8WhY;{)ItlWxJp67@EY-2BtZb74{6t$Z5OW;u5C4o z=?oNWPO_V-SbH!7mjLnQ+ zG1m~H%GqdHzCp`UWheD=WXv)3ti6m&ASUb_l9;qkz&?Pl3LNu!0!8!)s|TMl+ys28 zgo9Yt90Vtz49@|8kPHYX^JPv@Rgw_JR0m%?$ zMqD~f=g5f^vR?uT!Fs!5;?h~`MCkMUhX$oJRZ}iyLDLCv`c&u#MnP(nx0Z3I5(Xmf zeCg6@I^XrcGnC9f#I?80Y%FA}UM2+rn+XcT5*x5s6BA@jPMvy~OnI1ppV!1hO-z(V zS=7YDRFp>=@ve!93;~i3Pu288nr=zb96moP;vOazTN4vqVepPkXw<}nhvuk>iJ&YF z!pm#?KO!cY+z#=^N->4f1Yq~x>)6J$s{ogHSd!+sL-iiu(#|0+8XxYdd44E09d+41-xBs! zEIFP7v6x5Pq+Yw~0VT0uD97qh+beB*#T*z1Fd$;FGaetJm3Fb}ODu-t01b9YD##rc z;gEYNO5I~&z`HlmjSPwoE5JgrP_oSJ6oy2I&49ZQGdrr)C00woG|xfAaNe@!MF^tV zRnL?3+LrUkng!Y}W~bTeFj2=s>_SPzwG?wpgxGQaoWMF@UOdzFpy+C?hn*Kbwt|b@ zRk+#uYrTQO+lnxZSptA`F|7ch7btJ6b$iP021xs$@fmtY(vfL0qjd;-MH=!*cf`zzAXetdS&&?m^@U z(z@*Q!he^a1@I>saS(p2l}3WoMm(1@T*$UY2%d)33Vd_Kg$ zU|%GJ&NeG|?*Ik?q4*;vY1?0>-wKd!0JMvN;%Og|7W?Mm&W=O(&??mjNRNH10Mtv_ zJ^;G}?075IU{mrM(>m2$KxCD8J+Sz?JxlF#PN84pnC2Sp!FGd37Aa*wxp6b1(*nx zxc)z})So_AyVO64oBJMKxn%tm7x)L};e=DL{Nr0cobbt&Q}TUU+^@Yd{}3L>kBxe+ zgY*Z2A@GMr3_Bm zg*u)|)lOzUgt>9HU059vA&G zs{<(Ju=AP<&Y!goNR0l!u6@Dcn~atSQ(LYBSLp;xvUX%{$tZ$Z^|B6G zZw=t+HZA}xkVWnD*RJ4fL=EISX$m=Z*#ua?v)D6YoItL}d^aC%Hi$#A^QAXB;EE>j z|Fhv{;KRnnm$QSxrWf0n)0H-_U3o!coGDaYG$FfMtU13q*wkK$<}M~ujy;W#b31|w zLJpTk*$~1j8zE;I^^uJXn}fkszgJx)G85ap=KQt6l?h%UnA)(15X zqcG{Q-z!inPfqJqi}ViKA2%p3ErjhgY$boJ;1y+snn$#t3K)*Ar)*&sc2pCxfj&Ua z?r_i@G5|3Y_?*g65f`OOMxQTjlqj6buTnM6b2Lx42$q^2WJWTNft zP6h;a>JyXVdS-Skr1KLNvX!roSb9y>M=YK8Axe`EZ>o=2I_Y6d3EqX%Y_+^g@qtZA zMuvV6sXavoMzHq+duAE>ePUrIAKqkqGq`rWlcCjh?lqQ_nq-Ni}@FGT>~1-35K1ZUybOc5H{v+jj?Aw>W{ z-NwaX$cPINW~{HoqIU!#k4?ANy2P}>spRXUX^A2NAVp{tc!d}66nLfS6a=!sD`6#y zyox!Ce0|tHF`-fD6L4@GS^Q7K92xzfOn*sUWO59*gVklu`sNfIKleu)F0 ztQZP|@|U}D0_bkym?Zbk2Y|b|bCS}qea$ckOkcmmL3d2IucDAJNDGdkP%{kqcRkb$ zL(MSMFL5AjH{Gwdc7LWIxJ|x)aSzzX8y43WxAzrjBOn~pr z1Vrm0Y+*Z}$FjxT3y&=#^sU(kuVvuS0v4NwP4NWuT!i}Ap!`a7!PR~2h1A(?UnsQ9 zeFg=dYs_AIUSPQpuNS8!S`#g=6hQ0ZcoDSj0P@TUMC5t`wxZU|Sk_25_yYQtVKFp@ z&a<7gaHiddYdLc(Rr16Vx&`D_O+u?*rv8 zR?pU@%r)sKo9Fh}wwd~L9!$RarNAudq=)cm_&4@prg!$Tl=?)Sso%R>pQtn8g}X^~ zmHq6L*KY%cqt*MgM%!4w538`#ma9JX#%Ha%vu%9VCa!LtUYJKMZ6A)YtoodqI25z2 ze0FP?a}k~zEj-RjWozw&d`=DPP~y2Xi38JFa=G}H4`{=YF>k`m5tddO-HHx?;UO`{ zKR(4>`D5s{R-gV%SE>L0)XgPS;31{>$^WvSI#;QU#-|%^0wsC|831$RWaX1S5u?<9 J`QHyh{%goo=X3x7 literal 0 HcmV?d00001 diff --git a/source/twilight/ydi/Ydi.Mac b/source/twilight/ydi/Ydi.Mac new file mode 100644 index 0000000..d7269d8 --- /dev/null +++ b/source/twilight/ydi/Ydi.Mac @@ -0,0 +1,614 @@ + 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 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 + 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 longresult +&lab phd + phd + MEND + MACRO +&lab _SFShutDown +&lab ldx #$0317 + jsl $E10000 + MEND + MACRO +&lab GSStr &GSstring +&lab dc i2'L:&GSstring',C'&GSstring' + 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 ~DisposeHandle &theHandle +&lab ph4 &theHandle + Tool $1002 + 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 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 makeDP +&lab phd + tsc + tcd + MEND + macro +&lab WordResult &zero +&lab anop + aif c:&zeros=1,.zero + phd + mexit +.zero +&lab pea $0000 + mend + MACRO +&lab Debug &string + aif t:debugSymbols="G",.begin + mexit +.begin + dc i1'$82' + dc i2'(L:&string)+3' + dc i2'$7771' + dc i1'L:&string',C'&string' + MEND + 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 _CloseGS ¶ms +&lab jsl $E100A8 + dc i2"$2014" + 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 _Multiply +&lab ldx #$090B + jsl $E10000 + MEND + MACRO +&lab _NewHandle +&lab ldx #$0902 + jsl $E10000 + MEND + MACRO +&lab _UnPackBytes +&lab ldx #$2703 + jsl $E10000 + MEND + MACRO +&LAB JEQ &BP +&LAB BNE *+5 + BRL &BP + MEND + MACRO +&LAB JNE &BP +&LAB BEQ *+5 + BRL &BP + MEND + MACRO +&lab longm +&lab ANOP + rep #%00100000 + longa on + MEND + MACRO +&lab shortm +&lab ANOP + sep #%00100000 + longa off + MEND + macro +&lab ~HUnlock &theHandle +&lab ph4 &theHandle + Tool $2202 + mend + macro +&lab ~GetAddress &tableID +&lab LongResult + ph2 &tableID + Tool $0904 + mend + macro +&lab ~UnloadOneTool &toolNumber +&lab ph2 &toolNumber + Tool $1001 + mend + macro +&lab ~HexIt &intValue +&lab LongResult + ph2 &intValue + Tool $2A0B + 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 ~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 _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 ~MMStartUp +&lab WordResult + Tool $0202 + mend diff --git a/source/twilight/ydi/blank.eatf.c b/source/twilight/ydi/blank.eatf.c new file mode 100644 index 0000000000000000000000000000000000000000..807435a6affe51723ca99820e0afb409fa390c8c GIT binary patch literal 16754 zcmeHN&5qne5N_}6ZjucfAGjgJj|4)1`2ST7kPO*D0g{NH0Lp#$8_s*P`9o)_JG@8jAe`rw%ay@s}TB6`Dpe>39c_bVW--5t;m zpr1fLgT4Y?1#!ME`R}^^rcPb_)Tha-@?Sz9ZOuWiJ9@=kH*j4wtuuDGhOdGcH(!Dn zH(!Ik1APyoZ@E4sUGG(1HFnl*BXyaBabInV0t>fJ14nK)T|t<+3#v_(QM@kPrF_vnBVw1}~LVnDd;OBk-IO zLl!GXDzs`}E9_E#wI|Yz5+TeO4DFQ|3VK3I_=#eP%4{^JVW<# z%6oRTMjt-0K72%YY9hx^2aDyAG&w>By^o||b5HwVX>weea%#3+@}47uNZPHcy(Q;O zW_l8*=Zlw4PX6K3D-Nmq$FWe@%r@b;soCVn(~Pt8QO-k+tMFLbJD<;_g?Y+|eRNS} z${xSaf09gD`DEO*Vrrjty3-sTvf6Y!7o1)1p4k$UQKO96XIS)@ZbKqk+Wi537RUng zS&}6l_Ay&uFt|ac;`s!fj6r#ydcqS8sPHPT%j?+@LVR0_DJKCIva`S;J%ivX27ouF zTDFshF7DjyBWMkdfCa`(%@%I4AhN3k$!S^9P%3225O>NVn4+?wAKDjFrtpu}$_s z6)s>yPYIy8mn#P5UhBE!Ix7>9*k`hI*fvBGa@d1!~@! zW3FB?jBHA@b#*|}9vn7dZdsw$IGbF0SGGA$5>RhM*t#kK>+9-dc~J_PENC9yzMWm~ zsUzZ{3TynVo5(vUmqdXij&{ID7VKdH$p=Id6PE;$>j{R1l*8JmU2Ysr2pmQVN?!j) z+3e#%3M%uz+$$kt7JP!Q&|vV;J;g14oKaS}DFLhn2r`dh{{kFWIX=qVHWo&?OITf=8`dl;@r?VtHK}%6T(zVhh5z z^ar}J#iTA43eYHTCP0FP$#YS=f!_VogzZ)1kv~r<6$ciWC_D!>rd7dWUVELo^`%6f z7R0h!uGoOV*61L5#wR7#gg6GI#m7Kcpqh)gC8w1Dsn`h`Wp-EE5NKGrJSlR??E{8e zoaO8~Uoc5qf(F_$@{BpO9Tm3aF^!ER{*}X6WRW4OIbyIee~j2kD?oeqpZ&gPA>Bu5 z2EwwKNtF$%DLRrWO&iGSkd}_J$AR%lUm>T1#$uLu7huMGpU;tDtQ-vUc~F~xfQSSk zRi?v@9$wD<5$Y5Gj@mO133MS-#3slq5(w}U1QG~EV5>q;Lz+DDdLEwO#z)BFv^w75 ze7RyeoTq}H|LB>To;4iPfO=R7!Ypew0TtFHC@Pq$Epl6C=DTyjq+&8h#`lpI72zRm=-|x^wU$2`h|rFD6nMqK0F-h8GkC3L%dV}Td`nN{0H~n_ zHLQoi2o`QP?Y2~He?EfOW&%z0$cxAciW1HQ6)ch<9&keBTq+cQU^S@Vv=>NX0a1{U z={s~Upax^E5kt}hYow~}&`%H}zt<529$ib7`Y94QvWiD*AyNf6}De!M}gQyco4 zYCyaqCLP@_iCkUcyN13gMn7?+PMa?dow0ZHMm+{xASbJRd5A#A|B#(ytQ@w$LG3M} z@ZdLf3~>Pe + +This draw routine is not and end-all-be-all drawing routine. To be completely +correct I should be checking the memberFlag and dimming the item if it is not +selectable. But, since I know that my filter doesn't allow files to be dimmed, +it only displays selectable files, I know that I could remove that code. + +Let me know if you want code to draw filenames dimmed (it is in a technote +somewhere--under fast list draws I think). + +Also, to do this the best way, I'd probably also use GetSysIcon for things like +the folder icon--but this app that I stole the code from also runs under 5.0.4 +so I couldn't use it. + +In any case, let me know if you have any problems! + +Bryan diff --git a/source/twilight/ydi/sd/YDI.config.asm b/source/twilight/ydi/sd/YDI.config.asm new file mode 100644 index 0000000..0b36f19 --- /dev/null +++ b/source/twilight/ydi/sd/YDI.config.asm @@ -0,0 +1,455 @@ + + mcopy YDI.Config.Mac + mcopy 7/m16.memory + mcopy 7/m16.resources + copy YDI.equ + copy 7/e16.types + copy 7/e16.window + copy 7/e16.memory + copy 7/e16.control +*-----------------------------------------------------------------------------* +FALSE gequ 0 +TRUE gequ 1 + +INCBUSYFLG gequ $E10064 increment busy flag +DECBUSYFLG gequ $E10068 decrement busy flag + +rC1InputString gequ $8005 +rWindParam1 gequ $800E + +MyID gequ <0 +TempDP gequ MyID+2 +OldPort gequ TempDP+4 +OurWindow gequ OldPort+4 +OurPath gequ OurWindow+4 +C1Ptr gequ OurPath+4 +C1Handle gequ C1Ptr+4 +TextSize gequ C1Handle+4 +LETextHndl gequ TextSize+2 +ToolDP gequ LETextHndl+4 +*-----------------------------------------------------------------------------* +DSConfig Start + Using GlobalDATA + + phb + phk + plb + + DefineStack +oldBank byte +returnAddress block 3 +MasterID word +ourPathname long + + lda MasterID,s + ora #$0A00 + sta MyID + + lda ourPathname,s + sta OurPath + lda ourPathname+2,s + sta OurPath+2 + + WordResult + _GetCurResourceApp + PullWord OldResourceApp + + WordResult + _GetCurResourceFile + PullWord OldResourceFile + + pei MyID + _ResourceStartUp + + WordResult + PushWord #3 request read/write access + PushLong #0 open a new file + pei OurPath+2 + pei OurPath + _OpenResourceFile + plx + stx RezFileID +* jcs Error + + LongResult + _GetPort + PullLong OldPort + + LongResult + PushLong #0 ; no replacment title + PushLong #0 ; no replacement refCon + PushLong #DrawContent ; ptr to replacment contentDraw routine + PushLong #0 ; no replacement window definition proc + PushWord #refIsResource + PushLong #Configuration_Window + PushWord #rWindParam1 + _NewWindow2 + lda 1,s + sta OurWindow + lda 1+2,s + sta OurWindow+2 + _SetPort + PushWord #$0004 ; use dithered color text in window... + _SetFontFlags + + + LongResult + PushWord #rC1InputString + PushLong #SavedPathC1IStr + _LoadResource + PullLong C1Handle + ldy #2 + lda [C1Handle] + sta C1Ptr + lda [C1Handle],y + sta C1Ptr+2 + + pei C1Ptr+2 ; PUSH POINTER TO TEXT + lda C1Ptr + inc a ; hop past length word + inc a + pha ; PUSH POINTER TO TEXT + lda [C1Ptr] ; get length word + pha ; PUSH LENGTH WORD + LongResult ; for GetCtlTitle + LongResult ; for GetCtlHandleFromID + pei OurWindow+2 + pei OurWindow + PushLong #PathLECtl + _GetCtlHandleFromID + _GetCtlTitle + _LESetText + + pei OurWindow+2 + pei OurWindow + _DrawControls + +wait entry + WordResult ; then wait for the person to hit the + PushWord #$FFFF ; OK button, filtering out all other + PushLong #CfgTaskRec ; events + _TaskMaster + pla + cmp #wInControl ; control selected? + beq ControlHit ; if not, loop + cmp #wInInfo + beq beep + cmp #wInMenuBar + beq beep + cmp #wInDesk + beq beep + cmp #wInContent + beq check + cmp #wInFrame + beq Check + cmp #wInDrag + bne wait +check lda cTData + cmp OurWindow + bne beep + lda cTData+2 + cmp OurWindow+2 + bne beep + bra wait +beep _SysBeep + bra wait + +ControlHit anop + lda cTaskData4 ; ID of pressed control + cmp #CancelCtl ; cancel pressed? + jeq cancelled + cmp #SmartFindFileCtl + jeq SFF + cmp #OKCtl ; OK pressed? + bne wait + +Exit anop +* brk $01 + +* Get a handle to the text in the LineEdit control. + LongResult ; for LEGetTextHand + LongResult ; for GetCtlTitle + LongResult ; for GetCtlHandleFromID + pei OurWindow+2 + pei OurWindow + PushLong #PathLECtl + _GetCtlHandleFromID + _GetCtlTitle + lda 1,s + sta TempDP + lda 3,s + sta TempDP+2 + _LEGetTextHand + PullLong LETextHndl + + +* Set size of the resource's handle to the size of the length of the text +* in the LineEdit control adding two for the length word of a C1InputString. + PushWord #0 ; hi word of zero for new size of handle + WordResult + pei TempDP+2 + pei TempDP + _LEGetTextLen ; get lo word for new size of handle + lda 1,s ; add 2 + sta TextSize + inc a + inc a + sta 1,s + pei C1Handle+2 ; SET SIZE OF THE C1 RESOURCE TO THE + pei C1Handle ; SIZE OF THE TEXT+2 FOR LENGTH WORD + _SetHandleSize + +* Copy the text out of the control and into the resource starting at offset +* +02 into the resource to the end of the resource. + pei LETextHndl+2 ;and copy the text into the resource's + pei LETextHndl ;pointer (source) + pei C1Ptr+2 + lda C1Ptr + inc a + inc a + pha ; (dest) + PushWord #0 ; hi word + pei TextSize (size) + _HandToPtr + +* Get the length of the text and pop it into offset +00 of the C1InputString +* resource. + lda TextSize + sta [C1Ptr] + + PushLong LETextHndl ;release the handle returned by LE + _DisposeHandle + + PushWord #TRUE ;indicate that the resource has changed. + PushWord #rC1InputString + PushLong #SavedPathC1IStr + _MarkResourceChange + +cancelled anop + pei OurWindow+2 + pei OurWindow + _CloseWindow + + pei OldPort+2 + pei OldPort + _SetPort + + PushWord RezFileID + _CloseResourceFile + + _ResourceShutDown + + PushWord OldResourceFile + _SetCurResourceFile + + PushWord OldResourceApp + _SetCurResourceApp + + pei MyID + _DisposeAll + + plb + lda 2,s + sta 2+6,s + lda 1,s + sta 1+6,s + tsc Remove input paramaters + clc + adc #6 (MasterID+ourPathname) + tcs + clc + rtl + + End +*-----------------------------------------------------------------------------* +GlobalDATA Data + +RezFileID ds 2 +OldResourceApp ds 2 +OldResourceFile ds 2 +DelayTime ds 2 +Seconds ds 2 +TimeTxt ds 2 ; text string version of seconds + +CfgTaskRec anop ; Configuration window's task record +cWhat ds 2 +cMessage ds 4 +cWhen ds 4 +cWhere ds 4 +cModifiers ds 2 +cTData ds 4 + dc i4'$001B2004' +cLastClickTick ds 4 +cClickCount ds 2 +cTaskData2 ds 4 +cTaskData3 ds 4 +cTaskData4 ds 4 +cLastClickPoint ds 4 + +SFStatus ds 2 +temp ds 4 + +OpenString str 'Use which animation file?' + +TypeList anop + dc i'4' number of types + dc i'$0000' flags: normal.. :-) + dc i'$C0' fileType + dc i4'$0002' auxType + dc i'$A000' flags: dim all $C1 file entries + dc i'$C1' fileType + dc i4'0' auxType + dc i'$2000' flags: dim all $C0 $0000 pics + dc i'$C0' fileType + dc i4'$0000' auxType + dc i'$2000' flags: dim all $C0 $0001 pics + dc i'$C1' fileType + dc i4'$0001' auxType + +SFReply anop + ds 2 +fileType ds 2 +auxType ds 4 + dc i'3' +Nom ds 4 + dc i'3' +Path ds 4 + +MyPortLoc anop +SCB dc i'$0080' portSCB +Pix dc i4'$E12000' ptrToPixImage + dc i'$00A0' width in bytes of each line in image +bounds dc i'0,0' boundary rectangle +mode dc i'200,640' + +MyPort ds $AA + +orgPort ds 4 + + End +*-----------------------------------------------------------------------------* +DrawContent Start + + phb + phk + plb + LongResult + _GetPort + _DrawControls + plb + rtl + + END +*-----------------------------------------------------------------------------* +SFF Start + Using GlobalDATA + + PushWord #$17 SF toolset + PushWord #$0101 version + _LoadOneTool + + WordResult + _SFStatus + pla + sta SFStatus + bne Active + + LongResult Get dp space for SF + PushLong #$100 + pei MyID + PushWord #attrLocked+attrFixed+attrPage+attrBank + PushLong #$000000 + _NewHandle + plx + stx ToolDP + plx + stx ToolDP+2 +* jcs MemoryErr0 ;ExitWithBeep + + pei MyID + lda [ToolDP] + pha + _SFStartUp +* jcs SFStartErr0 ;ExitWithBeep + +active anop + LongResult + _GetPort + PushLong #MyPort Open a new grafPort + _OpenPort + PushLong #MyPort + _SetPort + PushLong #MyPortLoc make it point to our memory + _SetPortLoc + PushLong #bounds + _SetPortRect + + jsl >INCBUSYFLG + + PushWord #120 whereX 640 + PushWord #50 whereY 640 + PushWord #refIsPointer promptRefDesc + PushLong #OpenString promptRef + PushLong #0 filterProcPrt + PushLong #TypeList typeListPtr + PushLong #SFReply replyPtr + _SFGetFile2 + + jsl >DECBUSYFLG + + _SetPort + + lda SFStatus + bne noShutIt + _SFShutDown + + pei ToolDP+2 + pei ToolDP + _DisposeHandle + +noShutIt anop + lda SFReply See if user clicked cancel + jeq exit + + lda Path Transfer the path to a dp location + sta TempDP + lda Path+2 + sta TempDP+2 + + ldy #2 Load the pointer to the name + lda [TempDP] + clc adding two to skip over the length + adc #2 of buffer word + tax + lda [TempDP],y + sta TempDP+2 + stx TempDP + + pei TempDP+2 ; PUSH POINTER TO TEXT + lda TempDP + inc a ; hop past length word + inc a + pha ; PUSH POINTER TO TEXT + lda [TempDP] ; get length word + pha ; PUSH LENGTH WORD + LongResult ; for GetCtlTitle + LongResult ; for GetCtlHandleFromID + PushLong OurWindow + PushLong #PathLECtl + _GetCtlHandleFromID + _GetCtlTitle + _LESetText + + PushLong Path + PushLong Nom + _DisposeHandle + _DisposeHandle + + pei OurWindow+2 + pei OurWindow + _DrawControls + +exit brl Wait + + END +*-----------------------------------------------------------------------------* \ No newline at end of file diff --git a/source/twilight/ydi/sd/YDI.old.Asm b/source/twilight/ydi/sd/YDI.old.Asm new file mode 100644 index 0000000..41db00e --- /dev/null +++ b/source/twilight/ydi/sd/YDI.old.Asm @@ -0,0 +1,1094 @@ + + copy 7/e16.memory + copy YDI.Equ + mcopy YDI.Mac + mcopy 7/m16.quickdraw + case off +*-----------------------------------------------------------------------------* +! You Draw It v2.1 +spkr gequ $E0C030 +Strobe gequ $E0C000 +ClearStrobe gequ $E0C010 +NewVideo gequ $E0C029 +VBLWait gequ $E0C019 bit 7 = 1 if not VBL +INCBUSYFLG gequ $E10064 increment busy flag +DECBUSYFLG gequ $E10068 decrement busy flag + +rC1InputString gequ $8005 + +Shape1Start gequ $00A2 +$2000 not included +Shape2Start gequ $00C0 +Shape3Start gequ $00DE +Shape4Start gequ $00FC +Shape5Start gequ $011A +Shape6Start gequ $2442 +Shape7Start gequ $2460 +Shape8Start gequ $247E +Shape9Start gequ $249C +Shape10Start gequ $24BA +Shape11Start gequ $47E2 +Shape12Start gequ $4800 +Shape13Start gequ $481E +Shape14Start gequ $483C +Shape15Start gequ $00A2+$7D00 +$2000 not included +Shape16Start gequ $00C0+$7D00 +Shape17Start gequ $00DE+$7D00 +Shape18Start gequ $00FC+$7D00 +Shape19Start gequ $011A+$7D00 +Shape20Start gequ $2442+$7D00 +Shape21Start gequ $2460+$7D00 +Shape22Start gequ $247E+$7D00 +Shape23Start gequ $249C+$7D00 +Shape24Start gequ $24BA+$7D00 +Shape25Start gequ $47E2+$7D00 +Shape26Start gequ $4800+$7D00 +Shape27Start gequ $481E+$7D00 +Shape28Start gequ $483C+$7D00 +LastShape5 gequ $6A3A-$2000 +$E12000 not included +LastShape6 gequ $71BA-$2000 +LastShape7 gequ $793A-$2000 +LastShape8 gequ $80BA-$2000 +LastShape9 gequ $883A-$2000 +LastShape10 gequ $6A4F-$2000 +LastShape11 gequ $71CF-$2000 +LastShape12 gequ $794F-$2000 +LastShape13 gequ $80CF-$2000 +LastShape14 gequ $884F-$2000 + +MasterID gequ <0 +MyID gequ MasterID+2 +TempDP gequ MyID+2 +PicPtr gequ TempDP+4 +PackedPtr gequ PicPtr+4 +SLookUp gequ PackedPtr+4 +SCBPtr gequ SLookUp+4 +x gequ SCBPtr+4 +y gequ x+2 +CurrX gequ y+2 +CurrY gequ CurrX+2 +CurrShape gequ CurrY+2 +YSave gequ CurrShape+2 +NumShapes gequ YSave+2 +depth gequ NumShapes+2 +Action gequ depth+2 +twice gequ Action+2 +bottom gequ twice+2 +TempHandle gequ bottom+2 +SFStatus gequ TempHandle+4 +FrontWindow gequ SFStatus+2 +OurPath gequ FrontWindow+4 +*-----------------------------------------------------------------------------* +YDI2 Start + Using GlobalDATA + + longa on + longi on + + phb + phk + plb + + jsr StartUp + +; Load Picture + _OpenGS openParams + jcs GSOSErr0 ;ExitWithBeep if error, quit + + lda OpenID + sta ReadID + sta CloseID + + lda eof + sta readLength + + LongResult + PushLong eof + pei MyID + PushWord #attrLocked+attrFixed+attrNoCross+attrNoSpec + PushLong #0 + _NewHandle + plx + stx TempDP + plx + stx TempDP+2 + jcs MemoryErr2 ;ExitWithBeep2 if error, quit + + lda [TempDP] + sta PackedPtr + sta PicDestIN + ldy #2 + lda [TempDP],y + sta PackedPtr+2 + sta PicDestIN+2 + + _ReadGS ReadParams + jcs GSOSErr2 ;ExitWithBeep2 if error, quit + + _CloseGS CloseParams close picture + + PushWord #3 + PushWord #rC1InputString + PushLong #SavedPathC1IStr + _ReleaseResource + +; Unpack Picture + ldx #$7D00-2 make screen black; zero pixel data + lda #0 +nextZero sta $E12000,x + dex + dex + bpl nextZero + + LongResult get memory for unpacked pic + PushLong #$8000 + pei MyID + PushWord #attrLocked+attrFixed+attrNoCross+attrNoSpec + PushLong #0 + _NewHandle + plx + stx TempDP + plx + stx TempDP+2 + jcs MemoryErr0 ;ExitWithBeep if error, quit + + lda [TempDP] + sta PicPtr + sta ScreenHandle + ldy #2 + lda [TempDP],y + sta PicPtr+2 + sta ScreenHandle+2 + +* lda #$2000 reset where to unpack as Unpackbytes +* sta ScreenHandle thrashes this info (how rude!! :) +* lda #$E1 +* sta ScreenHandle+2 + + lda eof load filesize + clc and add to it the beginning + adc PackedPtr of the file buffer + sta endfile so we have the END of the file + + lda eof+2 + clc just do the same for the high + adc PackedPtr+2 byte + sta endfile+2 + +checkmain ldy #5 load the 5th byte of the data + lda [PackedPtr],y + and #$7F7F mask off the HIGH bits + cmp #$414D is it a "MA"? + jne notpref nope, this isn't the correct block + iny or file + iny + lda [PackedPtr],y get the next two bytes + cmp #$4E49 is it a "IN"? + jne notpref nope + + ldy #11 (pixelsperscanline) + lda [PackedPtr],y get the width of the picture + sta width + + cmp #320 is it 320 mode? + beq pref2 yes + cmp #640 is it 640 mode? + beq pref2 yes + +* brl exitWithBeep if it's neither, than we don't support +; it, so abort this picture + brl BadAPFFile + +pref2 ldy #9 + lda [PackedPtr],y get the master mode + sta preftemp store it + xba move it into the high byte also + ora preftemp so it'll be $0X0X + and #$F0F0 and just to make sure mask the high + + ldx #0 nibbles off +pref3 sta $E19D00,x store this master mode Scan Contro + inx Byte into the enter SCBs + inx data buffer + cpx #$C8 have we gone to 200 bytes yet? + bne pref3 nope + + LongResult + ldy #13 get the number of palettes + lda [PackedPtr],y + pha multiply it by 32 bytes, which is + PushWord #$0020 how many bytes per palette + _Multiply + pla pull the result + sta palettenum store it as the byte offset past the + clc palettes information + adc #17 add 17 to it to make it correct + sta preftemp store it as the preferred temp area + plx + + lda PackedPtr + clc load the 0 direct page space, and + adc preftemp add to it the data grabbed and store + sta SCBPtr it at $04 DP space. Now we have + lda PackedPtr+2 a pointer to the SCBs information + sta SCBPtr+2 contained in the file!!! + + ldy preftemp load the pointer to the SCBs area + dey and subtract 2 from it so we + dey get the number of scb's + lda [PackedPtr],y get the number of SCBs in the file + cmp #257 is it greater than 256? + blt scbsok yes + lda #256 no more than 256 SCBs +scbsok sta scbnum store it as the # of SCBs + ldx #0 initialize some counters + ldy #2 +scbs_set anop + lda [SCBPtr],y move the individual SCBs in the file + sta $E19D00,x + iny + iny + iny + iny ; we just did a double check by using + inx ; both the Master SCB and the individual SCBs + cpx scbnum + blt scbs_set + + lda palettenum load the pointer to the SCBs + sta preftemp and store it for future reference + + ldx #0 + ldy #13 initialize counters +pref5 iny + iny + lda [PackedPtr],y we're just going to move the + sta $E19E00,x palettes from the file into the + inx actual palettes area ($E19E00) + inx + lda palettenum decrement the palette size + dec a + dec a + sta palettenum are we done yet? + bne pref5 no + +* ldx #0 save original screen palette +*nextTempPal lda $E19E00,x +* sta TempPal,x +* inx +* inx +* cpx #32 +* bne nextTempPal +* +* lda #0 black out screen palette 0 +* ldx #0 +*nextBlack sta $E19E00,x +* inx +* inx +* cpx #32 +* bne nextBlack + + lda preftemp we're done + clc adjust the SCBs pointer to skip + adc #15 the first bytes + tay + lda [PackedPtr],y load the number of SCBs + iny + iny + tax + tya +pref6 clc +* OK, it's a PARIK LOOP.. fix it if you like. :) + adc #4 and adjust the pointer to + dex skip the entire SCBs area since + bne pref6 we've already worked with it + sta preftemp and finally point to the packed data! + + lda #$7D00*2 the size of the screen for + sta ScreenLength unpacking purposes + + WordResult + pei PackedPtr+2 push hi byte of buffer containing +; the packed data + lda PackedPtr load the original buffer + clc + adc preftemp add the number of bytes to skip + pha + lda eof load the filesize + sec and subtract from it the + sbc preftemp number of bytes to skip + pha + PushLong #ScreenHandle push handle to screen + PushLong #ScreenLength push pointer to screen size word + _UnPackBytes + pla discard result + + pei TempDP+2 get rid of packed data buffer + pei TempDP + _DisposeHandle + +* pea $E1E1 +* plb +* plb +* +* ldx #$7D00-2 +* txy +*copy lda |$2000,x +* sta [PicPtr],y +* dex +* dex +* dey +* dey +* bpl copy +* +* phk +* plb + + lda [PicPtr] + cmp #$D2FE ID byte + jeq NewFormat + +; Check how many frames are in animation + + ldy #lastshape5 + lda [PicPtr],y + cmp #$EEEE + bne last5 + ldy #lastshape6 + lda [PicPtr],y + cmp #$EEEE + bne last6 + ldy #lastshape7 + lda [PicPtr],y + cmp #$EEEE + bne last7 + ldy #lastshape8 + lda [PicPtr],y + cmp #$EEEE + bne last8 + ldy #lastshape9 + lda [PicPtr],y + cmp #$EEEE + bne last9 + ldy #lastshape10 + lda [PicPtr],y + cmp #$EEEE + bne last10 + ldy #lastshape11 + lda [PicPtr],y + cmp #$EEEE + bne last11 + ldy #lastshape12 + lda [PicPtr],y + cmp #$EEEE + bne last12 + ldy #lastshape13 + lda [PicPtr],y + cmp #$EEEE + bne last13 + ldy #lastshape14 + lda [PicPtr],y + cmp #$EEEE + bne last14 + + brl BadATFFile +* brl exitWithBeep user messed up... + +last5 anop + lda #5 + sta numShapes + brl cont +last6 anop + lda #6 + sta numShapes + brl cont +last7 anop + lda #7 + sta numShapes + brl cont +last8 anop + lda #8 + sta numShapes + brl cont +last9 anop + lda #9 + sta numShapes + brl cont +last10 anop + lda #10 + sta numShapes + brl cont +last11 anop + lda #11 + sta numShapes + brl cont +last12 anop + lda #12 + sta numShapes + brl cont +last13 anop + lda #13 + sta numShapes + brl cont +last14 anop + lda #14 + sta numShapes + brl Cont + + +NewFormat anop + ldy #lastshape5 + lda [PicPtr],y + cmp #$EEEE + bne aLast10 + ldy #lastshape6 + lda [PicPtr],y + cmp #$EEEE + bne aLast12 + ldy #lastshape7 + lda [PicPtr],y + cmp #$EEEE + bne aLast14 + ldy #lastshape8 + lda [PicPtr],y + cmp #$EEEE + bne aLast16 + ldy #lastshape9 + lda [PicPtr],y + cmp #$EEEE + bne aLast18 + ldy #lastshape10 + lda [PicPtr],y + cmp #$EEEE + bne aLast20 + ldy #lastshape11 + lda [PicPtr],y + cmp #$EEEE + bne aLast22 + ldy #lastshape12 + lda [PicPtr],y + cmp #$EEEE + bne aLast24 + ldy #lastshape13 + lda [PicPtr],y + cmp #$EEEE + bne aLast26 + ldy #lastshape14 + lda [PicPtr],y + cmp #$EEEE + bne aLast28 + + brl BadATFFile +* brl exitWithBeep user messed up... + +aLast10 anop + lda #10 + sta numShapes + bra cont +aLast12 anop + lda #12 + sta numShapes + bra cont +aLast14 anop + lda #14 + sta numShapes + bra cont +aLast16 anop + lda #16 + sta numShapes + bra cont +aLast18 anop + lda #18 + sta numShapes + bra cont +aLast20 anop + lda #20 + sta numShapes + bra cont +aLast22 anop + lda #22 + sta numShapes + bra cont +aLast24 anop + lda #24 + sta numShapes + bra cont +aLast26 anop + lda #26 + sta numShapes + bra cont +aLast28 anop + lda #28 + sta numShapes + bra Cont + + +cont anop + +; Zero variables + stz CurrShape + stz y + stz x + stz Action + stz twice + +* ldx #0 restore old palette +*nextRestPal lda TempPal,x +* sta $E19E00,x +* inx +* inx +* cpx #32 +* bne nextRestPal + + +; Main animation loop +mainloop anop + lda CurrShape + asl a times two + tax + lda AddrTable,x get start addr from table + sta YSave + + lda y + clc + adc #50 + lsr a + clc + adc #$80 + sta Bottom + shortm +wait2 lda >$E0C02E + cmp Bottom + bne wait2 + longm + jsr CopyShape + + DefineStack +oldDP word +oldBank byte +returnAddress block 3 +MasterID word +MovePtr long +TextPtr long + + phd check if keypress, mouse click, etc + tsc + tcd + lda [MovePtr] + jne done + pld + + lda Action + beq down_right + cmp #1 + beq up_right + cmp #2 + beq down_left + cmp #3 + beq up_left + + brl exitWithBeep <- shouldn't ever be called.. + +up_left anop + lda y + dec a + jeq downLeftNext + sta y + + lda x + dec a + jeq upRightNext + sta x + bra next + +down_left anop + lda y + inc a + cmp #199-56 + jeq upLeftNext + sta y + + lda x + dec a + jeq downRightNext + sta x + bra next + +up_right anop + lda y + dec a + jeq downRightNext + sta y + + lda x + inc a + cmp #160-28 + jeq upLeftNext + sta x + bra next + +down_right anop + lda y + inc a + cmp #199-56 + jeq upRightNext + sta y + + lda x + inc a + cmp #160-28 + jeq downLeftNext + sta x + +next anop + + lda twice + beq noIncShape + + lda CurrShape + inc a + cmp numShapes + bne fine + lda #0 +fine sta CurrShape + stz twice + brl mainloop + +noIncShape anop + lda #1 + sta twice + brl mainloop + +done pld + brl Exit + +MemoryErr2 anop + _CloseGS CloseParams close picture +MemoryErr0 anop + lda MemoryString get length byte + and #$00FF + inc a + sta <$FE + jsr GetMemory + shortm + ldx #0 + txy +copyStr anop + lda MemoryString,x + sta [$F0],y + inx + iny + cpx <$FE + blt copyStr + longm + jsr ErrorBeep + brl Exit2 + +SFStartErr0 anop + lda StartupString get length byte + and #$00FF + inc a + sta <$FE + jsr GetMemory + shortm + ldx #0 + txy +copyStr2 anop + lda StartupString,x + sta [$F0],y + inx + iny + cpx <$FE + blt copyStr2 + longm + jsr ErrorBeep + brl Exit2 + +GSOSErr2 anop + _CloseGS CloseParams close picture +GSOSErr0 anop + lda NotFoundString get length byte + and #$00FF + inc a + sta <$FE + jsr GetMemory + shortm + ldx #0 + txy +copyStr3 anop + lda NotFoundString,x + sta [$F0],y + inx + iny + cpx <$FE + blt copyStr3 + longm + jsr ErrorBeep + brl Exit2 + +BadATFFile anop + lda BadCountString get length byte + and #$00FF + inc a + sta <$FE + jsr GetMemory + shortm + ldx #0 + txy +copyStr4 anop + lda BadCountString,x + sta [$F0],y + inx + iny + cpx <$FE + blt copyStr4 + longm + jsr ErrorBeep + bra Exit2 + +BadAPFFile anop + lda BadAPFString get length byte + and #$00FF + inc a + sta <$FE + jsr GetMemory + shortm + ldx #0 + txy +copyStr5 anop + lda BadAPFString,x + sta [$F0],y + inx + iny + cpx <$FE + blt copyStr5 + longm + jsr ErrorBeep + bra Exit2 + +*exitWithBeep2 anop +* _CloseGS CloseParams close picture +exitWithBeep anop do a nifty little beep of mine :) + jsr ErrorBeep + +exit Entry +; Shutdown procedures + + stz ErrHandle + stz ErrHandle+2 + +exit2 Entry + lda SFStatus + bne wuzActiveAt1st + _SFShutDown + PushWord #$17 + _UnloadOneTool + +wuzActiveAt1st anop + PushLong OldPort + _SetPort restore original port + + PushWord RezFileID + _CloseResourceFile + + _ResourceShutDown + + PushWord OldResourceFile + _SetCurResourceFile + + PushWord OldResourceApp + _SetCurResourceApp + + pei MyID dispose all our allocated memory + _DisposeAll + +* _CloseGS CloseParams make sure all files are closed + + plb + lda 2,s + sta 12,s + lda 1,s + sta 11,s + tsc Remove input paramaters + clc + adc #10 (MasterID+MovePtr+TextPtr) + tcs + lda >ErrHandle + ora >ErrHandle+2 + beq noErrs +ErrOccurred anop + ldy #$DEAD + lda >ErrHandle+2 + tax + lda >ErrHandle + sec + rtl +noErrs anop + lda #0 + tay + tax + clc + rtl + +GetMemory anop + LongResult + pea 0 push hi word of zero + pha + pei MasterID + PushWord #attrLocked+attrFixed+attrNoSpec+attrNoCross + PushLong #0 + _NewHandle + pla + sta <$F0 + sta ErrHandle + pla + sta <$F2 + sta ErrHandle+2 + lda [$F0] + tax + ldy #2 + lda [$F0],y + sta <$F2 + stx <$F0 + rts + +ErrorBeep anop + php + sei + ldx #95 +click1 lda >Spkr + lda #440 +middleC dec a + bne middleC +click2 lda >Spkr + lda #300 +anotherkey dec a + bne anotherkey + dex + bne click1 + plp + rts + + +upRightNext anop + lda #1 + sta Action + brl next +downLeftNext lda #2 + sta Action + brl next +downRightNext stz Action + brl next +upLeftNext lda #3 + sta Action + brl Next + +CopyShape anop + lda y + sta CurrY + lda x + sta CurrX + + lda #56 + sta Depth + +copyLoop anop + lda CurrY y = y coordinate + asl a multipy by 2 to get index into table + tay + lda [SLookUp],y get address from table + clc add x to base address + adc CurrX x = horizontal position (in bytes) + sta Fill+1 + + ldx #0 + ldy YSave +copyLine lda [PicPtr],y +fill sta $E12000,x + iny + iny + inx + inx + cpx #28 28 bytes wide + bne copyLine + + lda YSave + clc + adc #$A0 1 line down into shape + sta YSave + + inc CurrY store 1 line down into SHR + + dec depth + bne copyLoop + + rts + + +! This routine helps us find the MAIN block in the APF file.. +notpref anop + ldy #2 we're merely + lda [PackedPtr],y going to add + tay the block size of this "chunk" + lda [PackedPtr] which is held in the + clc first 4 bytes of + adc PackedPtr the apple preferred format + sta PackedPtr to the buffer address, and + tya if we've reached + adc PackedPtr+2 the end of the + sta PackedPtr+2 file, we are + lda PackedPtr done! + cmp endfile + lda PackedPtr+2 + sbc endfile+2 + jcc checkmain + + brl exit if no MAIN chunk found, there is no +; picture data, so abort + End +*-----------------------------------------------------------------------------* +GlobalDATA Data + +screenHandle dc i4'0' +screenLength dc i2'0' + +*MyString Entry +* ds 257 + +!name entry +! ds 33 + +!ame GSStr '*:system:cdevs:twilight:frames' + +openParams anop + dc i'12' pcount +openID ds 2 reference number +* dc i4'MyString' pathname of file to open +pathname dc i4'0' + dc i'0' request_access + dc i'0' resource_num + ds 2 access + ds 2 file_type + ds 4 aux_type + ds 2 storage_type + ds 8 create_td + ds 8 modify_td + ds 4 option_list +eof ds 4 + +readParams anop + dc i'4' +readID ds 2 reference number +picDestIN ds 4 pointer to DATA buffer +readLength ds 4 this many bytes + ds 4 how many xfered + +closeParams anop + dc i'1' +closeID ds 2 reference number + +QParms dc i4'0' + dc i'0' + +palettenum ds 2 ; offset into palettes from preferred +width ds 2 ; width of preferred file +preftemp ds 2 ; temporary Apple Preferred format cntr +scbnum ds 2 ; number of SCB we're on +endfile ds 4 ; end of buffer for Preferred + +*TempPal ds 32 + +AddrTable anop + dc i'Shape1start,shape2start,shape3start,shape4start' + dc i'shape5start,shape6start,shape7start,shape8start' + dc i'shape9start,shape10start,shape11start,shape12start' + dc i'shape13start,shape14start' + dc i'shape15start,shape16start,shape17start,shape18start' + dc i'shape19start,shape20start,shape21start,shape22start' + dc i'shape23start,shape24start,shape25start,shape26start' + dc i'shape27start,shape28start' + +oldResourceApp ds 2 +oldResourceFile ds 2 +oldPort ds 4 +RezFileID ds 2 +ErrHandle ds 4 +NotFoundString str '$8000: Animation template file loading error.' +BadCountString str '$8001: Number of frames not marked correctly.' +BadAPFString str '$8002: APF animation picture is unusable.' +MemoryString str '$8003: Unable to allocate necessary memory.' +StartupString str '$8004: Unable to startup StandardFile tool.' + + End +*-----------------------------------------------------------------------------* +StartUp Start + Using GlobalDATA + +; Startup procedures + + DefineStack +rtsAddress word +oldBank byte +returnAddress block 3 +MainID word +MovePtr long +ourPathname long + + lda MainID,s + sta MasterID + ora #$0A00 + sta MyID + + lda ourPathname,s + sta ourPath + lda ourPathname+2,s + sta ourPath+2 + + LongResult get lookup table + PushWord #1 lookup table code + _GetAddress + PullLong SLookUp get pointer to table + + LongResult + _GetPort + PullLong OldPort + +*! If we've been called in 320 mode than change the data areas in our code that +*! assume we're in 640 mode. +* lda #320 +* sta mode +* lda #40 was 30 +* sta fillX+1 + + WordResult + _GetCurResourceApp + PullWord OldResourceApp + + WordResult + _GetCurResourceFile + PullWord OldResourceFile + + PushWord MyID + _ResourceStartUp + + WordResult + PushWord #1 request read access + PushLong #0 open a new file + PushLong OurPath + _OpenResourceFile + plx + stx RezFileID +* jcs Error + + LongResult + PushWord #rC1InputString + PushLong #SavedPathC1IStr + _LoadResource + PullLong TempDP + ldy #2 + lda [TempDP] + sta PathName + lda [TempDP],y + sta PathName+2 + rts + + End +*-----------------------------------------------------------------------------* \ No newline at end of file diff --git a/source/twilight/ydi/sd/Ydi.Config b/source/twilight/ydi/sd/Ydi.Config new file mode 100644 index 0000000000000000000000000000000000000000..5dd9250bcb30f975517000b4b476a765458a3c3b GIT binary patch literal 1614 zcmdT@O=ufO6n^`5Y-3Vr0zI0>VbwH0#DU~c zimN|=;3kVA4RAqNo@0>(6XZ+2t*;@mSx^M2-g z-~8c6q$=eYC z|D^z?bvEWs0J}JLK87z_FggMqD=I@L73HD*S9lROt#&%}aWm7##_!S`;?l-%;ddAbXq&UYKxDE# zi%|;Nclk^QpNj5{bZ;T^HGP7h;s;eal&yq9ng4*3gejFubA~Faeu)E|QdLz+u1#Q7 zl6aESt^lJN_Pp9+)IPqKbs-EP*!!h(^RcB?@WUg?MGl#W1!R`^g zF-X+8)h5pMHjTMMpB3vpP%d85jrNX7xaD`O0t}p+nRajb^{;(*>Pr3c)Q$SpEAGYm zx6`M%$=69gG?q4E4tG7V8>G#>VQM#?8`SnsU`c2GgoZBH!Fw^0E_daWwCn1nZh>TA zNTZLxge?m_Z2g5FusxKB%~15c*SV>IK2)05x98pM`I>?i*OP@ zSbwzgh*q>Lc;zVtgAA)(Am}aVj_?-zyN!uM{<8MBP!_aOYd)zj7Ia95%*lf8ELBr( z(x2fLl2Wci_%{X^{)2&FU1PD1aBq#Gc~qi>EN;}|Ze_fd0,.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 + 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 BLOCK &Value + AIF C:&lab=0,.skiplab +&lab equ &DummyPC +.skiplab +&DummyPC SETA &DummyPC+&Value + MEND + MACRO +&lab _CloseWindow +&lab ldx #$0B0E + jsl $E10000 + MEND + MACRO +&lab _NewWindow2 +&lab ldx #$610E + jsl $E10000 + MEND + MACRO +&lab _TaskMaster +&lab ldx #$1D0E + jsl $E10000 + MEND + MACRO +&lab _CloseResourceFile +&lab ldx #$0B1E + jsl $E10000 + MEND + MACRO +&lab _GetCurResourceApp +&lab ldx #$141E + jsl $E10000 + MEND + MACRO +&lab _GetCurResourceFile +&lab ldx #$121E + jsl $E10000 + MEND + MACRO +&lab _LoadResource +&lab ldx #$0E1E + jsl $E10000 + MEND + MACRO +&lab _MarkResourceChange +&lab ldx #$101E + jsl $E10000 + MEND + MACRO +&lab _OpenResourceFile +&lab ldx #$0A1E + jsl $E10000 + MEND + MACRO +&lab _ResourceShutDown +&lab ldx #$031E + jsl $E10000 + MEND + MACRO +&lab _ResourceStartUp +&lab ldx #$021E + jsl $E10000 + MEND + MACRO +&lab _SetCurResourceApp +&lab ldx #$131E + jsl $E10000 + MEND + MACRO +&lab _SetCurResourceFile +&lab ldx #$111E + jsl $E10000 + MEND + MACRO +&lab LONG +&lab equ &DummyPC +&DummyPC SETA &DummyPC+4 + MEND + MACRO +&lab _SFShutDown +&lab ldx #$0317 + jsl $E10000 + MEND diff --git a/source/twilight/ydi/sd/ydi.asm b/source/twilight/ydi/sd/ydi.asm new file mode 100644 index 0000000..0d45c3d --- /dev/null +++ b/source/twilight/ydi/sd/ydi.asm @@ -0,0 +1,1314 @@ + + mcopy YDI.Mac + copy YDI.Equ + copy 22:t2common.equ + copy 13:ainclude:e16.memory + copy 13:ainclude:e16.event + copy 13:ainclude:e16.types + copy 13:ainclude:e16.resources + copy 13:ainclude:e16.control + keep YDI.d +*-----------------------------------------------------------------------------* +* You Draw It! +* V1.0b1- 05/25/92: Original new version, complying with G2MF 1.1.1. (d33) +* +* Inputs: +* +* |previous contents| +* |-----------------| +* | T2Result | Long - Result space. (currently reserved) +* |-----------------| +* | 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. (reserved at this time) +* |-----------------| +* | rtlAddr | 3 bytes - Return address. +* |-----------------| +* +*-----------------------------------------------------------------------------* +debugSymbols gequ $BAD ; Put in debugging symbols ? +debugBreaks gequ $BAD ; Put in debugging breaks + +Shape1Start gequ $00A2 +$2000 not included +Shape2Start gequ $00C0 +Shape3Start gequ $00DE +Shape4Start gequ $00FC +Shape5Start gequ $011A +Shape6Start gequ $2442 +Shape7Start gequ $2460 +Shape8Start gequ $247E +Shape9Start gequ $249C +Shape10Start gequ $24BA +Shape11Start gequ $47E2 +Shape12Start gequ $4800 +Shape13Start gequ $481E +Shape14Start gequ $483C +Shape15Start gequ $00A2+$7D00 +$2000 not included +Shape16Start gequ $00C0+$7D00 +Shape17Start gequ $00DE+$7D00 +Shape18Start gequ $00FC+$7D00 +Shape19Start gequ $011A+$7D00 +Shape20Start gequ $2442+$7D00 +Shape21Start gequ $2460+$7D00 +Shape22Start gequ $247E+$7D00 +Shape23Start gequ $249C+$7D00 +Shape24Start gequ $24BA+$7D00 +Shape25Start gequ $47E2+$7D00 +Shape26Start gequ $4800+$7D00 +Shape27Start gequ $481E+$7D00 +Shape28Start gequ $483C+$7D00 +LastShape5 gequ $6A3A-$2000 +$E12000 not included +LastShape6 gequ $71BA-$2000 +LastShape7 gequ $793A-$2000 +LastShape8 gequ $80BA-$2000 +LastShape9 gequ $883A-$2000 +LastShape10 gequ $6A4F-$2000 +LastShape11 gequ $71CF-$2000 +LastShape12 gequ $794F-$2000 +LastShape13 gequ $80CF-$2000 +LastShape14 gequ $884F-$2000 +*-----------------------------------------------------------------------------* +YDI Start + debug 'You Draw It!' + kind $1000 + Using YDIDATA + + mnote '' + aif t:debugSymbols="G",.begin + mnote '## Note - Debug Symbols: OFF' + ago .jet +.begin + mnote '## Note - Debug Symbols: ON' +.jet + aif t:debugBreaks="G",.begin2 + mnote '## Note - Debugging Breaks: OFF' + ago .jet2 +.begin2 + mnote '## Note - Debugging Breaks: ON' +.jet2 + + DefineStack +dpageptr word +dbank byte +rtlAddr block 3 +T2data2 long +T2data1 long +T2message word +T2result long + + phb + phk + plb + phd + tsc + tcd + + lda INCBUSYFLG + + PushWord #120 whereX 640 + PushWord #50 whereY 640 + PushWord #refIsPointer promptRefDesc + PushLong #OpenString promptRef + PushLong #0 filterProcPrt + PushLong #TypeList typeListPtr + PushLong #SFReply replyPtr + _SFGetFile2 + +; jsl >DECBUSYFLG + +; _SetPort + + lda SFStatus + bne noShutIt + _SFShutDown + ~UnloadOneTool #$17 + + ~DisposeHandle ToolDP + +noShutIt anop + lda SFReply See if user clicked cancel + bne noCancel + rts + +noCancel anop + PushLong Path + jsr makePdp + inc <3 + inc <3 ; past buff size word + pld + PushLong Path + ~GetHandleSize Path + lda 1,s ; lo word + dec a + dec a + sta 1,s + _PtrToHand + + ~GetHandleSize Path + lda 1,s ; lo word + dec a + dec a + sta 1,s + PushLong Path + _SetHandleSize + + ~HLock Path + + lda Path + sta PathHandle + lda Path+2 + sta PathHandle+2 + +; ~DisposeHandle Path + ~DisposeHandle Nom + + PushLong PathHandle + jsr makePdp + lda [3] + xba + sta [3] + inc <3 + pld ; ptr to source string + PullLong PathPtr + + LongResult ; for disposecontrol + ~GetCtlHandleFromID WindPtr,#2 ; animpathctl id + lda 1,s + sta 5,s + lda 1+2,s + sta 5+2,s + _HideControl + _DisposeControl + + jsr substitute + +exit anop + + rts + +SFStatus ds 2 + +OpenString str 'Use which animation file?' + +TypeList anop + dc i'4' number of types + dc i'$0000' flags: normal.. :-) + dc i'$C0' fileType + dc i4'$0002' auxType + dc i'$A000' flags: dim all $C1 file entries + dc i'$C1' fileType + dc i4'0' auxType + dc i'$2000' flags: dim all $C0 $0000 pics + dc i'$C0' fileType + dc i4'$0000' auxType + dc i'$2000' flags: dim all $C0 $0001 pics + dc i'$C1' fileType + dc i4'$0001' auxType + +SFReply anop + ds 2 +fileType ds 2 +auxType ds 4 + dc i'3' +Nom ds 4 + dc i'3' +Path ds 4 + +ToolDP ds 4 + + End +*-----------------------------------------------------------------------------* +doKill Start + debug 'doKill' + Using YDIDATA + +; dbrk $04 + + ~DisposeHandle PathHandle + rts + + End +*-----------------------------------------------------------------------------* +doBlank Start + debug 'doBlank' + Using YDIDATA + +PicPtr equ <0 +SLookUp equ PicPtr+4 +x equ SLookUp+4 +y equ x+2 +CurrX equ y+2 +CurrY equ CurrX+2 +CurrShape equ CurrY+2 +YSave equ CurrShape+2 +NumShapes equ YSave+2 +depth equ NumShapes+2 +Action equ depth+2 +twice equ Action+2 +bottom equ twice+2 + + phd + lda |OurDP + tcd + +; dbrk $10 + + lda CLOCKCTL + and #$FFF0 + sta CLOCKCTL + + ~GetAddress #1 + PullLong $E0C02E + cmp Bottom + bne wait2 + longm + jsr CopyShape + + pld ; restore DP aligned with stack parms + lda [T2data1] ; movePtr + jne exitHere + phd ; save DP aligned with stack + lda OurDP ; restore our DP space + tcd + + lda Action + beq down_right + cmp #1 + beq up_right + cmp #2 + beq down_left + cmp #3 + beq up_left + +; brl exitWithBeep <- shouldn't ever be called.. + brl exitHere + +up_left anop + lda y + dec a + jeq downLeftNext + sta y + + lda x + dec a + jeq upRightNext + sta x + bra next + +down_left anop + lda y + inc a + cmp #199-56 + jeq upLeftNext + sta y + + lda x + dec a + jeq downRightNext + sta x + bra next + +up_right anop + lda y + dec a + jeq downRightNext + sta y + + lda x + inc a + cmp #160-28 + jeq upLeftNext + sta x + bra next + +down_right anop + lda y + inc a + cmp #199-56 + jeq upRightNext + sta y + + lda x + inc a + cmp #160-28 + jeq downLeftNext + sta x + +next anop + + lda twice + beq noIncShape + + lda CurrShape + inc a + cmp numShapes + bne fine + lda #0 +fine sta CurrShape + stz twice + brl mainloop + +noIncShape anop + lda #1 + sta twice + brl mainloop + + + + +upRightNext anop + lda #1 + sta Action + brl next +downLeftNext lda #2 + sta Action + brl next +downRightNext stz Action + brl next +upLeftNext lda #3 + sta Action + brl Next + +CopyShape anop + lda y + sta CurrY + lda x + sta CurrX + + lda #56 + sta Depth + +copyLoop anop + lda CurrY y = y coordinate + asl a multipy by 2 to get index into table + tay + lda [SLookUp],y get address from table + clc add x to base address + adc CurrX x = horizontal position (in bytes) + sta Fill+1 + + ldx #0 + ldy YSave +copyLine lda [PicPtr],y +fill sta $E12000,x + iny + iny + inx + inx + cpx #28 28 bytes wide + bne copyLine + + lda YSave + clc + adc #$A0 1 line down into shape + sta YSave + + inc CurrY store 1 line down into SHR + + dec depth + bne copyLoop + rts + + +AddrTable anop + dc i'Shape1start,shape2start,shape3start,shape4start' + dc i'shape5start,shape6start,shape7start,shape8start' + dc i'shape9start,shape10start,shape11start,shape12start' + dc i'shape13start,shape14start' + dc i'shape15start,shape16start,shape17start,shape18start' + dc i'shape19start,shape20start,shape21start,shape22start' + dc i'shape23start,shape24start,shape25start,shape26start' + dc i'shape27start,shape28start' + +;NotFoundString str '$8000: Animation template file loading error.' +;BadCountString str '$8001: Number of frames not marked correctly.' +;BadAPFString str '$8002: APF animation picture is unusable.' +;MemoryString str '$8003: Unable to allocate necessary memory.' +;StartupString str '$8004: Unable to startup StandardFile tool.' + + +exitHere entry + ~HUnLock PicHandle + rts + +Palette entry + ds 32 + + End +*-----------------------------------------------------------------------------* + copy :jim4:dya:twilight:makePdp.ASM \ No newline at end of file diff --git a/source/twilight/ydi/sd/ydi.asm.back b/source/twilight/ydi/sd/ydi.asm.back new file mode 100644 index 0000000..b7e5020 --- /dev/null +++ b/source/twilight/ydi/sd/ydi.asm.back @@ -0,0 +1,1356 @@ + + mcopy YDI.Mac + copy YDI.Equ + copy :jim4:dya:twilight:t2common.equ + copy 13:ainclude:e16.memory + copy 13:ainclude:e16.event + copy 13:ainclude:e16.types + copy 13:ainclude:e16.resources + copy 13:ainclude:e16.control + keep YDI.d +*-----------------------------------------------------------------------------* +* You Draw It! +* V1.0b1- 05/25/92: Original new version, complying with G2MF 1.1.1. (d33) +* +* Inputs: +* +* |previous contents| +* |-----------------| +* | T2Result | Long - Result space. (currently reserved) +* |-----------------| +* | 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. (reserved at this time) +* |-----------------| +* | rtlAddr | 3 bytes - Return address. +* |-----------------| +* +*-----------------------------------------------------------------------------* +debugSymbols gequ $BAD ; Put in debugging symbols ? +debugBreaks gequ $BAD ; Put in debugging breaks + +Shape1Start gequ $00A2 +$2000 not included +Shape2Start gequ $00C0 +Shape3Start gequ $00DE +Shape4Start gequ $00FC +Shape5Start gequ $011A +Shape6Start gequ $2442 +Shape7Start gequ $2460 +Shape8Start gequ $247E +Shape9Start gequ $249C +Shape10Start gequ $24BA +Shape11Start gequ $47E2 +Shape12Start gequ $4800 +Shape13Start gequ $481E +Shape14Start gequ $483C +Shape15Start gequ $00A2+$7D00 +$2000 not included +Shape16Start gequ $00C0+$7D00 +Shape17Start gequ $00DE+$7D00 +Shape18Start gequ $00FC+$7D00 +Shape19Start gequ $011A+$7D00 +Shape20Start gequ $2442+$7D00 +Shape21Start gequ $2460+$7D00 +Shape22Start gequ $247E+$7D00 +Shape23Start gequ $249C+$7D00 +Shape24Start gequ $24BA+$7D00 +Shape25Start gequ $47E2+$7D00 +Shape26Start gequ $4800+$7D00 +Shape27Start gequ $481E+$7D00 +Shape28Start gequ $483C+$7D00 +LastShape5 gequ $6A3A-$2000 +$E12000 not included +LastShape6 gequ $71BA-$2000 +LastShape7 gequ $793A-$2000 +LastShape8 gequ $80BA-$2000 +LastShape9 gequ $883A-$2000 +LastShape10 gequ $6A4F-$2000 +LastShape11 gequ $71CF-$2000 +LastShape12 gequ $794F-$2000 +LastShape13 gequ $80CF-$2000 +LastShape14 gequ $884F-$2000 +*-----------------------------------------------------------------------------* +YDI Start + debug 'You Draw It!' + kind $1000 + Using YDIDATA + + mnote '' + aif t:debugSymbols="G",.begin + mnote '## Note - Debug Symbols: OFF' + ago .jet +.begin + mnote '## Note - Debug Symbols: ON' +.jet + aif t:debugBreaks="G",.begin2 + mnote '## Note - Debugging Breaks: OFF' + ago .jet2 +.begin2 + mnote '## Note - Debugging Breaks: ON' +.jet2 + + DefineStack +dpageptr word +dbank byte +rtlAddr block 3 +T2data2 long +T2data1 long +T2message word +T2result long + + phb + phk + plb + phd + tsc + tcd + + lda INCBUSYFLG + + PushWord #120 whereX 640 + PushWord #50 whereY 640 + PushWord #refIsPointer promptRefDesc + PushLong #OpenString promptRef + PushLong #0 filterProcPrt + PushLong #TypeList typeListPtr + PushLong #SFReply replyPtr + _SFGetFile2 + +; jsl >DECBUSYFLG + +; _SetPort + + lda SFStatus + bne noShutIt + _SFShutDown + ~UnloadOneTool #$17 + + ~DisposeHandle ToolDP + +noShutIt anop + lda SFReply See if user clicked cancel + bne noCancel + rts + +noCancel anop + PushLong Path + jsr makePdp + inc <3 + inc <3 ; past buff size word + pld + PushLong Path + ~GetHandleSize Path + lda 1,s ; lo word + dec a + dec a + sta 1,s + _PtrToHand + + ~GetHandleSize Path + lda 1,s ; lo word + dec a + dec a + sta 1,s + PushLong Path + _SetHandleSize + + ~HLock Path + + lda Path + sta PathHandle + lda Path+2 + sta PathHandle+2 + +; ~DisposeHandle Path + ~DisposeHandle Nom + + PushLong PathHandle + jsr makePdp + lda [3] + xba + sta [3] + inc <3 + pld ; ptr to source string + PullLong PathPtr + + LongResult ; for disposecontrol + ~GetCtlHandleFromID WindPtr,#2 ; animpathctl id + lda 1,s + sta 5,s + lda 1+2,s + sta 5+2,s + _HideControl + _DisposeControl + + jsr substitute + +exit anop + + rts + +SFStatus ds 2 + +OpenString str 'Use which animation file?' + +TypeList anop + dc i'4' number of types + dc i'$0000' flags: normal.. :-) + dc i'$C0' fileType + dc i4'$0002' auxType + dc i'$A000' flags: dim all $C1 file entries + dc i'$C1' fileType + dc i4'0' auxType + dc i'$2000' flags: dim all $C0 $0000 pics + dc i'$C0' fileType + dc i4'$0000' auxType + dc i'$2000' flags: dim all $C0 $0001 pics + dc i'$C1' fileType + dc i4'$0001' auxType + +SFReply anop + ds 2 +fileType ds 2 +auxType ds 4 + dc i'3' +Nom ds 4 + dc i'3' +Path ds 4 + +ToolDP ds 4 + + End +*-----------------------------------------------------------------------------* +doKill Start + debug 'doKill' + Using YDIDATA + +; dbrk $04 + + ~DisposeHandle PathHandle + rts + + End +*-----------------------------------------------------------------------------* +doBlank Start + debug 'doBlank' + Using YDIDATA + +PicPtr equ <0 +SLookUp equ PicPtr+4 +x equ SLookUp+4 +y equ x+2 +CurrX equ y+2 +CurrY equ CurrX+2 +CurrShape equ CurrY+2 +YSave equ CurrShape+2 +NumShapes equ YSave+2 +depth equ NumShapes+2 +Action equ depth+2 +twice equ Action+2 +bottom equ twice+2 + + phd + lda |OurDP + tcd + +; dbrk $10 + + lda CLOCKCTL + and #$FFF0 + sta CLOCKCTL + + ~GetAddress #1 + PullLong $E0C02E + cmp Bottom + bne wait2 + longm + jsr CopyShape + + pld ; restore DP aligned with stack parms + lda [T2data1] ; movePtr + jne exitHere + phd ; save DP aligned with stack + lda OurDP ; restore our DP space + tcd + + lda Action + beq down_right + cmp #1 + beq up_right + cmp #2 + beq down_left + cmp #3 + beq up_left + +; brl exitWithBeep <- shouldn't ever be called.. + brl exitHere + +up_left anop + lda y + dec a + jeq downLeftNext + sta y + + lda x + dec a + jeq upRightNext + sta x + bra next + +down_left anop + lda y + inc a + cmp #199-56 + jeq upLeftNext + sta y + + lda x + dec a + jeq downRightNext + sta x + bra next + +up_right anop + lda y + dec a + jeq downRightNext + sta y + + lda x + inc a + cmp #160-28 + jeq upLeftNext + sta x + bra next + +down_right anop + lda y + inc a + cmp #199-56 + jeq upRightNext + sta y + + lda x + inc a + cmp #160-28 + jeq downLeftNext + sta x + +next anop + + lda twice + beq noIncShape + + lda CurrShape + inc a + cmp numShapes + bne fine + lda #0 +fine sta CurrShape + stz twice + brl mainloop + +noIncShape anop + lda #1 + sta twice + brl mainloop + + + + +upRightNext anop + lda #1 + sta Action + brl next +downLeftNext lda #2 + sta Action + brl next +downRightNext stz Action + brl next +upLeftNext lda #3 + sta Action + brl Next + +CopyShape anop + lda y + sta CurrY + lda x + sta CurrX + + lda #56 + sta Depth + +copyLoop anop + lda CurrY y = y coordinate + asl a multipy by 2 to get index into table + tay + lda [SLookUp],y get address from table + clc add x to base address + adc CurrX x = horizontal position (in bytes) + sta Fill+1 + + ldx #0 + ldy YSave +copyLine lda [PicPtr],y +fill sta $E12000,x + iny + iny + inx + inx + cpx #28 28 bytes wide + bne copyLine + + lda YSave + clc + adc #$A0 1 line down into shape + sta YSave + + inc CurrY store 1 line down into SHR + + dec depth + bne copyLoop + rts + + +AddrTable anop + dc i'Shape1start,shape2start,shape3start,shape4start' + dc i'shape5start,shape6start,shape7start,shape8start' + dc i'shape9start,shape10start,shape11start,shape12start' + dc i'shape13start,shape14start' + dc i'shape15start,shape16start,shape17start,shape18start' + dc i'shape19start,shape20start,shape21start,shape22start' + dc i'shape23start,shape24start,shape25start,shape26start' + dc i'shape27start,shape28start' + +;NotFoundString str '$8000: Animation template file loading error.' +;BadCountString str '$8001: Number of frames not marked correctly.' +;BadAPFString str '$8002: APF animation picture is unusable.' +;MemoryString str '$8003: Unable to allocate necessary memory.' +;StartupString str '$8004: Unable to startup StandardFile tool.' + + +exitHere entry + rts + +Palette entry + ds 32 + + End +*-----------------------------------------------------------------------------* + copy :jim4:dya:twilight:makePdp.ASM diff --git a/source/twilight/ydi/sd/ydi.asm.c b/source/twilight/ydi/sd/ydi.asm.c new file mode 100644 index 0000000..7466804 --- /dev/null +++ b/source/twilight/ydi/sd/ydi.asm.c @@ -0,0 +1,1514 @@ + + mcopy YDI.Mac + copy YDI.Equ + copy 22:t2common.equ + copy 13:ainclude:e16.memory + copy 13:ainclude:e16.event + copy 13:ainclude:e16.types + copy 13:ainclude:e16.resources + copy 13:ainclude:e16.control + copy 22:dsdb.equ + keep YDI.d +*-----------------------------------------------------------------------------* +* You Draw It! +* V1.0b1- 05/25/92: Original new version, complying with G2MF 1.1.1. (d33) +* 05/31/92: Updated to use T2 internal DrawString error module. +* v1.0b2- 06/03/92: Fixed little bug where "Update" was getting enabled even +* when the user hit Cancel in the SFGetFile2 box. (d34) +* v1.0b3- 06/10/92: Updated for new HitT2 parms. +* Larger pathnames can be viewed (sticky space added) +* 06/14/92: Error now displayed if path rez can't be found. (d34) +* v1.0.1b1- 11/28/92: Fixed bug where unpack size was being set incorrectly +* (passed to unpackbytes). T2v1.0.1b1. Thanks GregT! +* 11/29/92: Handle of ATF unpacked pix data is always set to L=7d00. +* Handle of EATF unpacked pix data should be L=fa00. +* +* Inputs: +* +* |previous contents| +* |-----------------| +* | T2Result | Long - Result space. (currently reserved) +* |-----------------| +* | 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. (reserved at this time) +* |-----------------| +* | rtlAddr | 3 bytes - Return address. +* |-----------------| +* +*-----------------------------------------------------------------------------* +Shape1Start gequ $00A2 +$2000 not included +Shape2Start gequ $00C0 +Shape3Start gequ $00DE +Shape4Start gequ $00FC +Shape5Start gequ $011A +Shape6Start gequ $2442 +Shape7Start gequ $2460 +Shape8Start gequ $247E +Shape9Start gequ $249C +Shape10Start gequ $24BA +Shape11Start gequ $47E2 +Shape12Start gequ $4800 +Shape13Start gequ $481E +Shape14Start gequ $483C +Shape15Start gequ $00A2+$7D00 +$2000 not included +Shape16Start gequ $00C0+$7D00 +Shape17Start gequ $00DE+$7D00 +Shape18Start gequ $00FC+$7D00 +Shape19Start gequ $011A+$7D00 +Shape20Start gequ $2442+$7D00 +Shape21Start gequ $2460+$7D00 +Shape22Start gequ $247E+$7D00 +Shape23Start gequ $249C+$7D00 +Shape24Start gequ $24BA+$7D00 +Shape25Start gequ $47E2+$7D00 +Shape26Start gequ $4800+$7D00 +Shape27Start gequ $481E+$7D00 +Shape28Start gequ $483C+$7D00 +LastShape5 gequ $6A3A-$2000 +$E12000 not included +LastShape6 gequ $71BA-$2000 +LastShape7 gequ $793A-$2000 +LastShape8 gequ $80BA-$2000 +LastShape9 gequ $883A-$2000 +LastShape10 gequ $6A4F-$2000 +LastShape11 gequ $71CF-$2000 +LastShape12 gequ $794F-$2000 +LastShape13 gequ $80CF-$2000 +LastShape14 gequ $884F-$2000 +*-----------------------------------------------------------------------------* +YDI Start + debug 'You Draw It!' + kind $1000 + Using YDIDATA + + copy 22:dsdb.asm + + DefineStack +dpageptr word +dbank byte +rtlAddr block 3 +T2data2 long +T2data1 long +T2message word +T2result long + + phb + phk + plb + phd + tsc + tcd + + lda INCBUSYFLG + + PushWord #120 whereX 640 + PushWord #50 whereY 640 + PushWord #refIsPointer promptRefDesc + PushLong #OpenString promptRef + PushLong #0 filterProcPrt + PushLong #TypeList typeListPtr + PushLong #SFReply replyPtr + _SFGetFile2 + +; jsl >DECBUSYFLG + +; _SetPort + + lda SFStatus + bne noShutIt + _SFShutDown + ~UnloadOneTool #$17 + + ~DisposeHandle ToolDP + +noShutIt anop + lda SFReply See if user clicked cancel + bne noCancel + rts + +noCancel anop + lda #TRUE + sta $E0C02E + cmp Bottom + bne wait2 + longm + jsr CopyShape + + pld ; restore DP aligned with stack parms + lda [T2data1] ; movePtr + jne exitHere + phd ; save DP aligned with stack + lda OurDP ; restore our DP space + tcd + + lda Action + beq down_right + cmp #1 + beq up_right + cmp #2 + beq down_left + cmp #3 + beq up_left + +up_left anop + lda y + dec a + jeq downLeftNext + sta y + + lda x + dec a + jeq upRightNext + sta x + bra next + +down_left anop + lda y + inc a + cmp #199-56 + jeq upLeftNext + sta y + + lda x + dec a + jeq downRightNext + sta x + bra next + +up_right anop + lda y + dec a + jeq downRightNext + sta y + + lda x + inc a + cmp #160-28 + jeq upLeftNext + sta x + bra next + +down_right anop + lda y + inc a + cmp #199-56 + jeq upRightNext + sta y + + lda x + inc a + cmp #160-28 + jeq downLeftNext + sta x + +next anop + + lda twice + beq noIncShape + + lda CurrShape + inc a + cmp numShapes + bne fine + lda #0 +fine sta CurrShape + stz twice + brl mainloop + +noIncShape anop + lda #1 + sta twice + brl mainloop + + + + +upRightNext anop + lda #1 + sta Action + brl next +downLeftNext lda #2 + sta Action + brl next +downRightNext stz Action + brl next +upLeftNext lda #3 + sta Action + brl Next + +CopyShape anop + lda y + sta CurrY + lda x + sta CurrX + + lda #56 + sta Depth + +copyLoop anop + lda CurrY y = y coordinate + asl a multipy by 2 to get index into table + tay + lda [SLookUp],y get address from table + clc add x to base address + adc CurrX x = horizontal position (in bytes) + sta Fill+1 + + ldx #0 + ldy YSave +copyLine lda [PicPtr],y +fill sta $E12000,x + iny + iny + inx + inx + cpx #28 28 bytes wide + bne copyLine + + lda YSave + clc + adc #$A0 1 line down into shape + sta YSave + + inc CurrY store 1 line down into SHR + + dec depth + bne copyLoop + rts + + +AddrTable anop + dc i'Shape1start,shape2start,shape3start,shape4start' + dc i'shape5start,shape6start,shape7start,shape8start' + dc i'shape9start,shape10start,shape11start,shape12start' + dc i'shape13start,shape14start' + dc i'shape15start,shape16start,shape17start,shape18start' + dc i'shape19start,shape20start,shape21start,shape22start' + dc i'shape23start,shape24start,shape25start,shape26start' + dc i'shape27start,shape28start' + +;NotFoundString str '$8000: Animation template file loading error.' +;BadCountString str '$8001: Number of frames not marked correctly.' +;BadAPFString str '$8002: APF animation picture is unusable.' +;MemoryString str '$8003: Unable to allocate necessary memory.' +;StartupString str '$8004: Unable to startup StandardFile tool.' + + +exitHere entry + ~HUnLock PicHandle + rts + +Palette entry + ds 32 + + +doOSerr anop + lda OSErrorNum + cmp #$C0D + jeq PathRezErr + + ~HexIt OSErrorNum ; convert error to ascii + PullLong asciiOSErr + + LongResult + PushLong #OSErrLen + pei 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 killLdp +&lab pld + ply + ply + MEND + MACRO +&lab makeDP +&lab phd + tsc + tcd + MEND + MACRO +&LAB JEQ &BP +&LAB BNE *+5 + BRL &BP + 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 JNE &BP +&LAB BEQ *+5 + BRL &BP + MEND + macro +&lab WordResult &zero +&lab anop + aif c:&zeros=1,.zero + phd + mexit +.zero +&lab pea $0000 + mend + macro +&lab LongResult &zeros +&lab anop + aif c:&zeros=1,.zeros + phd + phd + mexit +.zeros + pea $0000 + pea $0000 + mend + MACRO +&lab _NewHandle +&lab ldx #$0902 + jsl $E10000 + MEND + macro +&lab ~DisposeHandle &theHandle +&lab ph4 &theHandle + Tool $1002 + mend + macro +&lab ~GetCurResourceFile +&lab WordResult + Tool $121E + 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 _SetCurResourceFile +&lab ldx #$111E + jsl $E10000 + MEND + macro +&lab ~SetCurResourceFile &fileID +&lab ph2 &fileID + Tool $111E + 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 BLOCK &Value + AIF C:&lab=0,.skiplab +&lab equ &DummyPC +.skiplab +&DummyPC SETA &DummyPC+&Value + MEND + MACRO +&lab LONG +&lab equ &DummyPC +&DummyPC SETA &DummyPC+4 + MEND + macro +&lab ~HUnlock &theHandle +&lab ph4 &theHandle + Tool $2202 + mend + macro +&lab Tool &number +&lab ldx #&number + jsl $E10000 + mend + MACRO +&lab _NewControl2 +&lab ldx #$3110 + jsl $E10000 + MEND + macro +&lab ~GetHandleSize &theHandle +&lab LongResult + ph4 &theHandle + Tool $1802 + 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 ~LoadOneTool &toolNumber,&minVersion +&lab ph2 &toolNumber + ph2 &minVersion + Tool $0F01 + 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",.ze +oPageReg + aif "&offset"="x",.zeroPageReg + aif "&offset"="y",.zeroPageReg + ldy #&offset + lda &addr,y + pha + mexit +.zeroPageReg + lda &addr,&offset + pha + mend + macro +&lab ~GetCtlHandleFromID &ctlWindowPtr,&ctlID +&lab LongResult + ph4 &ctlWindowPtr + ph4 &ctlID + Tool $3010 + mend + macro +&lab ~NewHandle &blockSize,&userID,&attributes,&locationPtr +&lab LongResult + ph4 &blockSize + ph2 &userID + ph2 &attributes + ph4 &locationPtr + Tool $0902 + mend + MACRO +&lab _Multiply +&lab ldx #$090B + jsl $E10000 + MEND + macro +&lab ~HLock &theHandle +&lab ph4 &theHandle + Tool $2002 + mend + MACRO +&lab str &string +&lab dc i1'L:&string',C'&string' + MEND + macro +&lab ~UpdateResourceFile &fileID +&lab ph2 &fileID + Tool $0D1E + mend + MACRO +&lab _PtrToHand +&lab ldx #$2802 + jsl $E10000 + MEND + MACRO +&lab _CloseGS ¶ms +&lab jsl $E100A8 + dc i2"$2014" + dc i4"¶ms" + MEND + MACRO +&lab _OpenGS ¶ms +&lab jsl $E100A8 + dc i2"$2010" + dc i4"¶ms" + MEND + MACRO +&lab _AddResource +&lab ldx #$0C1E + jsl $E10000 + MEND + MACRO +&lab _RemoveResource +&lab ldx #$0F1E + jsl $E10000 + MEND + MACRO +&lab GSStr &GSstring +&lab dc i2'L:&GSstring',C'&GSstring' + MEND + MACRO +&lab _SetHandleSize +&lab ldx #$1902 + jsl $E10000 + MEND + MACRO +&lab _ReadGS ¶ms +&lab jsl $E100A8 + dc i2"$2012" + dc i4"¶ms" + MEND + MACRO +&lab _DetachResource +&lab ldx #$181E + jsl $E10000 + MEND + MACRO +&lab _DisposeControl +&lab ldx #$0A10 + jsl $E10000 + MEND + MACRO +&lab _HideControl +&lab ldx #$0E10 + jsl $E10000 + MEND + MACRO +&lab _SFShutDown +&lab ldx #$0317 + 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 ~UniqueResourceID &IDRange,&resourceType +&lab LongResult + ph2 &IDRange + ph2 &resourceType + Tool $191E + mend + macro +&lab ~SFStatus +&lab WordResult 0 + Tool $0617 + 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 _UnPackBytes +&lab ldx #$2703 + jsl $E10000 + MEND + macro +&lab ~GetAddress &tableID +&lab LongResult + ph2 &tableID + Tool $0904 + mend + macro +&lab ~UnloadOneTool &toolNumber +&lab ph2 &toolNumber + Tool $1001 + mend + MACRO +&lab _InvalCtls +&lab ldx #$3710 + jsl $E10000 + MEND diff --git a/source/twilight/ydi/sd/ydi.old.equ b/source/twilight/ydi/sd/ydi.old.equ new file mode 100644 index 0000000..64c5057 --- /dev/null +++ b/source/twilight/ydi/sd/ydi.old.equ @@ -0,0 +1,26 @@ +***************************************************************** +* Genesys created ASM65816 resource equates +* Simple Software Systems International, Inc. +* ORCAM.SCG 1.2 +* + +Control_List GEQU $1003 + +EnterPathStrCtl GEQU $1 +PathLECtl GEQU $2 +SmartFindFileCtl GEQU $3 +CancelCtl GEQU $4 +OKCtl GEQU $5 + +SavedPathC1IStr GEQU $1 + +DefaultLEPathStr GEQU $1 +SmartFindFileStr GEQU $2 +CancelStr GEQU $3 +OKStr GEQU $5 + +EnterPath_LText GEQU $1 + +Configuration_Window GEQU $FFA + +Configuration_Code GEQU $1 diff --git a/source/twilight/ydi/sd/ydi.old.rez b/source/twilight/ydi/sd/ydi.old.rez new file mode 100644 index 0000000..3b7038e --- /dev/null +++ b/source/twilight/ydi/sd/ydi.old.rez @@ -0,0 +1,239 @@ + +#include "types.rez" + +#define EnterPath_LText_CNT 60 + +// --- type $8003 defines +#define Control_List $00001003 +// --- type $8004 defines +#define EnterPathStrCtl $00000001 +#define PathLECtl $00000002 +#define SmartFindFileCtl $00000003 +#define CancelCtl $00000004 +#define OKCtl $00000005 +// --- type $8005 defines +#define SavedPathC1IStr $00000001 +// --- type $8006 defines +#define ModuleNameStr $00000001 +#define SmartFindFileStr $00000002 +#define CancelStr $00000003 +#define DefaultLEPathStr $00000004 +#define OKStr $00000005 +// --- type $800B defines +#define EnterPath_LText $00000001 +// --- type $800E defines +#define Configuration_Window $00000FFA +// --- type $8017 defines +#define Configuration_Code $00000001 + +// --- Version resource + +resource rVersion (0x1, $0000) { + { $2,$1,$0,development,$1 }, // Version 2.1.0d1 + verUS, // US Version + "Twilight II YouDrawIt Module", // program's name + "Copyright 1991 Jim Maricondo." // copyright notice +}; + +// --- Control List Definitions + +resource rControlList (Control_List, $0000) { + { + EnterPathStrCtl, // control 1 + PathLECtl, // control 2 + SmartFindFileCtl, // control 3 + CancelCtl, // control 4 + OKCtl, // control 5 + }; +}; + +// --- Control Templates + +resource rControlTemplate (EnterPathStrCtl, $0000) { + $00000001, // ID + { 2, 12, 12,263}, // rect + statTextControl {{ + $0000, // flag + $1002, // moreFlags + $00000000, // refCon + EnterPath_LText, // textRef + EnterPath_LText_CNT, // textSize + $0000 // just + }}; +}; + +resource rControlTemplate (PathLECtl, $0000) { + $00000002, // ID + { 12, 10, 25,422}, // rect + editLineControl {{ + $0000, // flag + $7002, // moreFlags + $00000000, // refCon + $0041, // maxSize + DefaultLEPathStr // defaultRef + }}; +}; + +resource rControlTemplate (SmartFindFileCtl, $0000) { + $00000003, // ID + { 30,128, 43,296}, // rect + simpleButtonControl {{ + $0000, // flag + $1002, // moreFlags + $00000000, // refCon + SmartFindFileStr // titleRef + }}; +}; + +resource rControlTemplate (CancelCtl, $0000) { + $00000004, // ID + { 30, 10, 43,100}, // rect + simpleButtonControl {{ + $0000, // flag + $3002, // moreFlags + $00000000, // refCon + CancelStr, // titleRef + 0, // colorTableRef + {"\$1B", "\$1B",$0000,$0000} // key equivalents + }}; +}; + +resource rControlTemplate (OKCtl, $0000) { + $00000005, // ID + { 30,326, 43,416}, // rect + simpleButtonControl {{ + $0001, // flag + $3002, // moreFlags + $00000000, // refCon + OKStr, // titleRef + 0, // colorTableRef + {"\$0D", "\$0D",$0000,$0000} // key equivalents + }}; +}; + +// --- rC1InputString Templates + +resource rC1InputString (SavedPathC1IStr, $0000) { + "" +}; + +// --- rPString Templates + +resource rPString (ModuleNameStr, $0000) { + "YouDrawIt 2.1" +}; + +resource rPString (SmartFindFileStr, $0000) { + "SmartFind File" +}; + +resource rPString (CancelStr, $0000) { + "Cancel" +}; + +resource rPString (DefaultLEPathStr, $0000) { + "" +}; +resource rPString (OKStr, $0000) { + "OK" +}; + +// --- rTextForLETextBox2 Templates + +resource rTextForLETextBox2 (EnterPath_LText, $0000) { + "\$01" + "J" + "\$00" + "\$00" + "\$01" + "L" + "\$00" + "\$00" + "\$01" + "R" + "\$04" + "\$00" + "\$01" + "F" + "\$FE" + "\$FF" + "\$00" + "\$08" + "\$01" + "C" + "\$00" + "\$00" + "\$01" + "B" + "\$FF" + "\$FF" + "Pathname of animation file to use:" +}; + +// --- Window Templates + +resource rWindParam1 (Configuration_Window, $0000) { + $20A0, // plFrame (frame bits) + NIL, // plTitle (no Title) + $00000000, // plRefCon + { 0, 0, 0, 0}, // plZoomRect + NIL, // plColorTable (standard colors) + {$0000, $0000}, // plYOrigin, plXOrigin + {$0000, $0000}, // plDataHeight, plDataWidth + {$0000, $0000}, // plMaxHeight, plMaxWidth + {$0000, $0000}, // plVerScroll, plHorScroll + {$0000, $0000}, // plVerPage, plHorPage + $00000000, // plInfoText (info RefCon) + $0000, // plInfoHeight + { 52,104,101,534}, // plPosition + infront, // plPlane + Control_List, // plControlList + $0009 // plInDesc +}; + +// --- Code resources + +read rCodeResource (0x1,locked,convert) "YDI.config"; /* the config part */ + +data 0x8014 (0x18003) { + $"0100 0100 0000 0310 0000 0C43 6F6E 7472" /* ...........Contr */ + $"6F6C 204C 6973 74" /* ol List */ +}; + +data 0x8014 (0x18004) { + $"0100 0500 0000 0400 0000 0943 616E 6365" /* ...........Cance */ + $"6C43 746C 0100 0000 0F45 6E74 6572 5061" /* lCtl.....EnterPa */ + $"7468 5374 7243 746C 0500 0000 054F 4B43" /* thStrCtl.....OKC */ + $"746C 0200 0000 0950 6174 684C 4543 746C" /* tl.....PathLECtl */ + $"0300 0000 1053 6D61 7274 4669 6E64 4669" /* .....SmartFindFi */ + $"6C65 4374 6C" /* leCtl */ +}; + +data 0x8014 (0x18005) { + $"0100 0100 0000 0100 0000 0F53 6176 6564" /* ...........Saved */ + $"5061 7468 4331 4953 7472" /* PathC1IStr */ +}; + +data 0x8014 (0x18006) { + $"0100 0400 0000 0300 0000 0943 616E 6365" /* ...........Cance */ + $"6C53 7472 0100 0000 1044 6566 6175 6C74" /* lStr.....Default */ + $"4C45 5061 7468 5374 7205 0000 0005 4F4B" /* LEPathStr.....OK */ + $"5374 7202 0000 0010 536D 6172 7446 696E" /* Str.....SmartFin */ + $"6446 696C 6553 7472" /* dFileStr */ +}; + +data 0x8014 (0x1800B) { + $"0100 0100 0000 0100 0000 0F45 6E74 6572" /* ...........Enter */ + $"5061 7468 204C 5465 7874" /* Path LText */ +}; + +data 0x8014 (0x1800E) { + $"0100 0100 0000 FA0F 0000 1443 6F6E 6669" /* ...........Confi */ + $"6775 7261 7469 6F6E 2057 696E 646F 77" /* guration Window */ +}; + +data 0x8014 (0x18017) { + $"0100 0100 0000 0100 0000 1243 6F6E 6669" /* ...........Confi */ + $"6775 7261 7469 6F6E 2043 6F64 65" /* guration Code */ +}; + diff --git a/source/twilight/ydi/sd/ydi.rez b/source/twilight/ydi/sd/ydi.rez new file mode 100644 index 0000000..166fb52 --- /dev/null +++ b/source/twilight/ydi/sd/ydi.rez @@ -0,0 +1,256 @@ + +#include "types.rez" +#include "22:t2common.rez" + +// --- type $8001 defines +#define YDI_Icon $10dd01 +// --- type $8003 defines +#define YDI_CtlLst $00000005 +// --- type $8004 defines +#define YDISetAnimPathCtl $00006FFF +#define YDIAnimPathStrCtl $00007000 +#define YDIStrCtl $00007001 +#define YDIIconCtl $00007002 +// --- type $8006 defines +#define YDISetAnimPathStr $00000011 +// --- type $800B defines +#define YDI_LText $00000001 +#define AnimPath_LText $00000002 + + +resource rT2ModuleFlags (0x1) { + setupSupported +}; + + +// --- Module name resource + +resource rPString (1) { + "You Draw It!" +}; + + +// --- About text resource + +resource rTextForLETextBox2 ($0010DD01) { + "\$01" + "J" + "\$00" + "\$00" + "\$01" + "L" + "\$00" + "\$00" + "\$01" + "C" + "\$11" + "\$11" + "\$01" + "B" + "\$FF" + "\$FF" + "The YouDrawIt! module allows you to create your own animations to" + " be displayed when it's time to blank!" +}; + +// --- Version resource + +resource rVersion (0x1, $0000) { + { $1,$0,$0,beta,$1 }, // Version 1.0b1 + verUS, // US Version + "Twilight II YouDrawIt! Module", // program's name + "By Jim Maricondo.\n" + "Copyright 1991, 1992 Jim Maricondo." // copyright notice +}; + + + +// --- Icon Definitions + +resource rIcon (YDI_Icon) { + $8000, // kind + $0014, // height + $0016, // width + + $"0000000000000000000000" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0F000000000000000000F0" + $"0F0F0FC0FFFFFFFFFFF0F0" + $"0F0F0FC0FFFFFFFFFFF0F0" + $"0F0F0003FFFFFFFFFFF0F0" + $"0F0F0880FFFFFFFFFFF0F0" + $"0F0F0AA0FFFF888F8FF0F0" + $"0F0FC0103FFAAAFAFFF0F0" + $"0F0FFF000F1111111FF0F0" + $"0F0FFFFFFFFFFFFFFFF0F0" + $"0F000000000000000000F0" + $"0FFFFFFFFFFFFFFFFAFFF0" + $"0000000000000000000000" + $"F0FFFFFFFFFFFFFFFFFF0F" + $"F0FFFFFFFFFFFFFFFFFF0F" + $"F0FF4AFFFFFFFFFFFFFF0F" + $"F0CCCCCCCCCCCCCCCCCC0F" + $"F0FFFFFFFFFFFFFFFAFF0F" + $"F00000000000000000000F", + + $"0FFFFFFFFFFFFFFFFFFFF0" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0"; +}; + +// --- Control List Definitions + +resource rControlList (YDI_CtlLst, $0000) { + { + YDIIconCtl, // control 3 + YDIStrCtl, // control 4 +// YDIAnimPathStrCtl, // control 5 + YDISetAnimPathCtl, // control 6 + }; +}; + +// --- Control Templates + +resource rControlTemplate (YDISetAnimPathCtl, $0000) { + $00000001, // ID + { 72, 92, 85,250}, // rect + simpleButtonControl {{ + $0000, // flag + $3002, // moreFlags + $00000000, // refCon + YDISetAnimPathStr, // titleRef + 0, // colorTableRef + {"S","s",$0100,$0100} // key equivalents + }}; +}; + +resource rControlTemplate (YDIAnimPathStrCtl, $0000) { + $00000002, // ID + { 93, 12,125,331}, // rect + statTextControl {{ + $0000, // flag + $1002, // moreFlags + $00000000, // refCon + AnimPath_LText, // textRef + NIL, // textSize + $0000 // just + }}; +}; + +resource rControlTemplate (YDIStrCtl, $0000) { + $00000003, // ID + { 56,128, 64,247}, // rect + statTextControl {{ + $0000, // flag + $1002, // moreFlags + $00000000, // refCon + YDI_LText, // textRef + NIL, // textSize + $0000 // just + }}; +}; + +resource rControlTemplate (YDIIconCtl, $0000) { + $00000004, // ID + { 33,146, 53,194}, // rect + iconButtonControl {{ + $000C, // flag + $1020, // moreFlags + $00000000, // refCon + YDI_Icon, // iconRef + 0, // titleRef + 0, // colorTableRef + $0000 // displayMode + }}; +}; + +// --- rPString Templates + +resource rPString (YDISetAnimPathStr, $0000) { + "Set Animation Path" +}; + +// --- rTextForLETextBox2 Templates + +resource rTextForLETextBox2 (YDI_LText, $0000) { + "You Draw It!" +}; + +resource rTextForLETextBox2 (AnimPath_LText, $0000) { + "\$01" + "J" + "\$00" + "\$00" + "\$01" + "L" + "\$00" + "\$00" + "\$01" + "R" + "\$04" + "\$00" + "\$01" + "F" + "\$FE" + "\$FF" + "\$02" + "\$08" + "\$01" + "C" + "\$00" + "\$00" + "\$01" + "B" + "\$FF" + "\$FF" + "Animation Path:" + "\$01" + "F" + "\$FE" + "\$FF" + "\$00" + "\$08" + "\$01" + "C" + "\$00" + "\$00" + "\$01" + "B" + "\$FF" + "\$FF" + " " + "\$D2" + "*0" + "\$D3" + "\$01" + "F" + "\$FE" + "\$FF" + "\$00" + "\$08" + "\$01" + "C" + "\$00" + "\$00" + "\$01" + "B" + "\$FF" + "\$FF" +}; diff --git a/source/twilight/ydi/sd/ydi.rez.b b/source/twilight/ydi/sd/ydi.rez.b new file mode 100644 index 0000000..22b9850 --- /dev/null +++ b/source/twilight/ydi/sd/ydi.rez.b @@ -0,0 +1,245 @@ + +#include "types.rez" +#include ":jim4:dya:twilight:t2common.rez" + +// --- type $8001 defines +#define YDI_Icon $10dd01 +// --- type $8003 defines +#define YDI_CtlLst $00000005 +// --- type $8004 defines +#define YDISetAnimPathCtl $00006FFF +#define YDIAnimPathStrCtl $00007000 +#define YDIStrCtl $00007001 +#define YDIIconCtl $00007002 +// --- type $8006 defines +#define YDISetAnimPathStr $00000011 +// --- type $800B defines +#define YDI_LText $00000001 +#define AnimPath_LText $00000002 + + +resource rT2ModuleFlags (moduleFlags) { + fSetupSupported+fWantFadeOut+fWantFadeIn+fForceLoadSetupAtBlank +}; + + +// --- Module name resource + +resource rPString (moduleName) { + "YouDrawIt!" +}; + + +// --- About text resource + +resource rTextForLETextBox2 (moduleMessage) { + TBLeftJust +// TBLeftMargin +// "\$00\$00" + TBForeColor TBColor1 + TBBackColor TBColorF + "The YouDrawIt! module allows you to create your own animations to" + " be displayed when it's time to blank!" +}; + +// --- Version resource + +resource rVersion (moduleVersion) { + { $1,$0,$0,beta,$3 }, // Version 1.0b3 + verUS, // US Version + "Twilight II YouDrawIt! Module", // program's name + "By Jim Maricondo.\n" + "Copyright 1991, 1992 Jim Maricondo." // copyright notice +}; + + + +// --- Icon Definitions + +resource rIcon (moduleIcon) { + $8000, // kind + $0014, // height + $0016, // width + + $"0000000000000000000000" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0F000000000000000000F0" + $"0F0F0FC0FFFFFFFFFFF0F0" + $"0F0F0FC0FFFFFFFFFFF0F0" + $"0F0F0003FFFFFFFFFFF0F0" + $"0F0F0880FFFFFFFFFFF0F0" + $"0F0F0AA0FFFF888F8FF0F0" + $"0F0FC0103FFAAAFAFFF0F0" + $"0F0FFF000F1111111FF0F0" + $"0F0FFFFFFFFFFFFFFFF0F0" + $"0F000000000000000000F0" + $"0FFFFFFFFFFFFFFFFAFFF0" + $"0000000000000000000000" + $"F0FFFFFFFFFFFFFFFFFF0F" + $"F0FFFFFFFFFFFFFFFFFF0F" + $"F0FF4AFFFFFFFFFFFFFF0F" + $"F0CCCCCCCCCCCCCCCCCC0F" + $"F0FFFFFFFFFFFFFFFAFF0F" + $"F00000000000000000000F", + + $"0FFFFFFFFFFFFFFFFFFFF0" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0"; +}; + +// --- Control List Definitions + +resource rControlList (YDI_CtlLst, $0000) { + { + YDIIconCtl, // control 3 + YDIStrCtl, // control 4 +// YDIAnimPathStrCtl, // control 5 + YDISetAnimPathCtl, // control 6 + }; +}; + +// --- Control Templates + +resource rControlTemplate (YDISetAnimPathCtl, $0000) { + $00000001, // ID + { 72, 92, 85,250}, // rect + simpleButtonControl {{ + $0000, // flag + $3002, // moreFlags + $00000000, // refCon + YDISetAnimPathStr, // titleRef + 0, // colorTableRef + {"S","s",$0100,$0100} // key equivalents + }}; +}; + +resource rControlTemplate (YDIAnimPathStrCtl, $0000) { + $00000002, // ID + { 93, 12,125,331}, // rect + statTextControl {{ + $0000, // flag + $1002, // moreFlags + $00000000, // refCon + AnimPath_LText, // textRef + NIL, // textSize + $0000 // just + }}; +}; + +resource rControlTemplate (YDIStrCtl, $0000) { + $00000003, // ID + { 56,128, 64,247}, // rect + statTextControl {{ + $0000, // flag + $1002, // moreFlags + $00000000, // refCon + YDI_LText, // textRef + NIL, // textSize + $0000 // just + }}; +}; + +resource rControlTemplate (YDIIconCtl, $0000) { + $00000004, // ID + { 33,146, 53,194}, // rect + iconButtonControl {{ + $000C, // flag + $1020, // moreFlags + $00000000, // refCon + YDI_Icon, // iconRef + 0, // titleRef + 0, // colorTableRef + $0000 // displayMode + }}; +}; + +// --- rPString Templates + +resource rPString (YDISetAnimPathStr, $0000) { + "Set Animation Path" +}; + +// --- rTextForLETextBox2 Templates + +resource rTextForLETextBox2 (YDI_LText, $0000) { + "You Draw It!" +}; + +resource rTextForLETextBox2 (AnimPath_LText, $0000) { + "\$01" + "J" + "\$00" + "\$00" + "\$01" + "L" + "\$00" + "\$00" + "\$01" + "R" + "\$04" + "\$00" + "\$01" + "F" + "\$FE" + "\$FF" + "\$02" + "\$08" + "\$01" + "C" + "\$00" + "\$00" + "\$01" + "B" + "\$FF" + "\$FF" + "Animation Path:" + "\$01" + "F" + "\$FE" + "\$FF" + "\$00" + "\$08" + "\$01" + "C" + "\$00" + "\$00" + "\$01" + "B" + "\$FF" + "\$FF" + " " + "\$D2" + "*0" + "\$D3" + "\$01" + "F" + "\$FE" + "\$FF" + "\$00" + "\$08" + "\$01" + "C" + "\$00" + "\$00" + "\$01" + "B" + "\$FF" + "\$FF" +}; diff --git a/source/twilight/ydi/sfd/read.me b/source/twilight/ydi/sfd/read.me new file mode 100644 index 0000000..b217fa3 --- /dev/null +++ b/source/twilight/ydi/sfd/read.me @@ -0,0 +1,17 @@ +Sorry it took so long to get this to you--I kinda forgot about it + +This draw routine is not and end-all-be-all drawing routine. To be completely +correct I should be checking the memberFlag and dimming the item if it is not +selectable. But, since I know that my filter doesn't allow files to be dimmed, +it only displays selectable files, I know that I could remove that code. + +Let me know if you want code to draw filenames dimmed (it is in a technote +somewhere--under fast list draws I think). + +Also, to do this the best way, I'd probably also use GetSysIcon for things like +the folder icon--but this app that I stole the code from also runs under 5.0.4 +so I couldn't use it. + +In any case, let me know if you have any problems! + +Bryan diff --git a/source/twilight/ydi/sfd/sfdraw b/source/twilight/ydi/sfd/sfdraw new file mode 100644 index 0000000..af7e5e4 --- /dev/null +++ b/source/twilight/ydi/sfd/sfdraw @@ -0,0 +1,453 @@ +; ************************************ 6/23/92 5:01:08 PM *** +; * +; * Subroutine: DrawSFDialog +; * +; ************************************************************* + +DrawSFDialog start + name DrawSFDialog + using Globals + + DefineStack long +clipHndl long +clipPtr long +ctlPtr long +atype long +ftype word +xx word +yy word +iconOffset word +nameOffset word + endlocals + + FixStack + + begparms +itemDrawPtr long + endparms + +reserved block 24 +ctlHandle long +memberPtr long +theRect long + + BeginStack + +*-------------------------------------------------------------- +* fix offsets depending on graphics mode: +*-------------------------------------------------------------- + ldx #6 ; offset for icon + lda #22 ; offset for filename + ldy grafmode ; are we 320 or 640 mode? + bne setoffsets + lsr a ; halve offsets since we are in + ldx #3 ; 320 mode + +setoffsets stx iconOffset + sta nameOffset + +*-------------------------------------------------------------- +* calculate where we need to be in order to draw: +*-------------------------------------------------------------- + ~GetClipHandle + pll clipHndl + + dref clipHndl,clipPtr + + lda [theRect] + dec a + ldy #orgnBBox+obottom + cmp [clipPtr],y + blt skip2 + brl noDraw +skip2 ldy #obottom + lda [theRect],y + inc a + ldy #orgnBBox+otop + cmp [clipPtr],y + bltl noDraw + +noTest ~EraseRect $E0C02E + cmp Bottom + bne wait2 + longm + jsr CopyShape + + pld ; restore DP aligned with stack parms + lda [T2data1] ; movePtr + jne exitHere + phd ; save DP aligned with stack + lda OurDP ; restore our DP space + tcd + + lda Action + beq down_right + cmp #1 + beq up_right + cmp #2 + beq down_left + cmp #3 + beq up_left + +up_left anop + lda y + dec a + jeq downLeftNext + sta y + + lda x + dec a + jeq upRightNext + sta x + bra next + +down_left anop + lda y + inc a + cmp #199-56 + jeq upLeftNext + sta y + + lda x + dec a + jeq downRightNext + sta x + bra next + +up_right anop + lda y + dec a + jeq downRightNext + sta y + + lda x + inc a + cmp #160-28 + jeq upLeftNext + sta x + bra next + +down_right anop + lda y + inc a + cmp #199-56 + jeq upRightNext + sta y + + lda x + inc a + cmp #160-28 + jeq downLeftNext + sta x + +next anop + + lda twice + beq noIncShape + + lda CurrShape + inc a + cmp numShapes + bne fine + lda #0 +fine sta CurrShape + stz twice + brl mainloop + +noIncShape anop + lda #1 + sta twice + brl mainloop + + + + +upRightNext anop + lda #1 + sta Action + brl next +downLeftNext lda #2 + sta Action + brl next +downRightNext stz Action + brl next +upLeftNext lda #3 + sta Action + brl Next + +CopyShape anop + lda y + sta CurrY + lda x + sta CurrX + + lda #56 + sta Depth + +copyLoop anop + lda CurrY y = y coordinate + asl a multipy by 2 to get index into table + tay + lda [SLookUp],y get address from table + clc add x to base address + adc CurrX x = horizontal position (in bytes) + sta Fill+1 + + ldx #0 + ldy YSave +copyLine lda [PicPtr],y +fill sta $E12000,x + iny + iny + inx + inx + cpx #28 28 bytes wide + bne copyLine + + lda YSave + clc + adc #$A0 1 line down into shape + sta YSave + + inc CurrY store 1 line down into SHR + + dec depth + bne copyLoop + rts + + +AddrTable anop + dc i'Shape1start,shape2start,shape3start,shape4start' + dc i'shape5start,shape6start,shape7start,shape8start' + dc i'shape9start,shape10start,shape11start,shape12start' + dc i'shape13start,shape14start' + dc i'shape15start,shape16start,shape17start,shape18start' + dc i'shape19start,shape20start,shape21start,shape22start' + dc i'shape23start,shape24start,shape25start,shape26start' + dc i'shape27start,shape28start' + +;NotFoundString str '$8000: Animation template file loading error.' +;BadCountString str '$8001: Number of frames not marked correctly.' +;BadAPFString str '$8002: APF animation picture is unusable.' +;MemoryString str '$8003: Unable to allocate necessary memory.' +;StartupString str '$8004: Unable to startup StandardFile tool.' + + +exitHere entry + ~HUnLock PicHandle + rts + +Palette entry + ds 32 + + End +*-----------------------------------------------------------------------------* +ErrorMaker Start + debug 'ErrorMaker' + kind $1000 + Using YDIDATA + +; brk + + ~HexIt RealError + pla + sta ascii0 + sta ascii1 + sta ascii2 + pla + sta ascii0+2 + sta ascii1+2 + sta ascii2+2 + + lda ErrorMsg + cmp #6 ;errors 1 through 5 are good +; bge unknown + blt known + stz $E0C02E + cmp Bottom + bne wait2 + longm + jsr CopyShape + + pld ; restore DP aligned with stack parms + lda [T2data1] ; movePtr + jne exitHere + phd ; save DP aligned with stack + lda OurDP ; restore our DP space + tcd + + lda Action + beq down_right + cmp #1 + beq up_right + cmp #2 + beq down_left + cmp #3 + beq up_left + +up_left anop + lda y + dec a + jeq downLeftNext + sta y + + lda x + dec a + jeq upRightNext + sta x + bra next + +down_left anop + lda y + inc a + cmp #199-56 + jeq upLeftNext + sta y + + lda x + dec a + jeq downRightNext + sta x + bra next + +up_right anop + lda y + dec a + jeq downRightNext + sta y + + lda x + inc a + cmp #160-28 + jeq upLeftNext + sta x + bra next + +down_right anop + lda y + inc a + cmp #199-56 + jeq upRightNext + sta y + + lda x + inc a + cmp #160-28 + jeq downLeftNext + sta x + +next anop + + lda twice + beq noIncShape + + lda CurrShape + inc a + cmp numShapes + bne fine + lda #0 +fine sta CurrShape + stz twice + brl mainloop + +noIncShape anop + lda #1 + sta twice + brl mainloop + + + + +upRightNext anop + lda #1 + sta Action + brl next +downLeftNext lda #2 + sta Action + brl next +downRightNext stz Action + brl next +upLeftNext lda #3 + sta Action + brl Next + +CopyShape anop + lda y + sta CurrY + lda x + sta CurrX + + lda #56 + sta Depth + +copyLoop anop + lda CurrY y = y coordinate + asl a multipy by 2 to get index into table + tay + lda [SLookUp],y get address from table + clc add x to base address + adc CurrX x = horizontal position (in bytes) + sta Fill+1 + + ldx #0 + ldy YSave +copyLine lda [PicPtr],y +fill sta $E12000,x + iny + iny + inx + inx + cpx #28 28 bytes wide + bne copyLine + + lda YSave + clc + adc #$A0 1 line down into shape + sta YSave + + inc CurrY store 1 line down into SHR + + dec depth + bne copyLoop + rts + + +AddrTable anop + dc i'Shape1start,shape2start,shape3start,shape4start' + dc i'shape5start,shape6start,shape7start,shape8start' + dc i'shape9start,shape10start,shape11start,shape12start' + dc i'shape13start,shape14start' + dc i'shape15start,shape16start,shape17start,shape18start' + dc i'shape19start,shape20start,shape21start,shape22start' + dc i'shape23start,shape24start,shape25start,shape26start' + dc i'shape27start,shape28start' + +;NotFoundString str '$8000: Animation template file loading error.' +;BadCountString str '$8001: Number of frames not marked correctly.' +;BadAPFString str '$8002: APF animation picture is unusable.' +;MemoryString str '$8003: Unable to allocate necessary memory.' +;StartupString str '$8004: Unable to startup StandardFile tool.' + + +exitHere entry + ~HUnLock PicHandle + rts + +Palette entry + ds 32 + + +doOSerr anop + lda OSErrorNum + cmp #$C0D + jeq PathRezErr + + ~HexIt OSErrorNum ; convert error to ascii + PullLong asciiOSErr + + LongResult + PushLong #OSErrLen + pei 4v;)AR=#LoF9pN1=#641bD

}#afm#6znn(gS(ll6FQN~Xe z2;lHy1!tK=3Abh?;GK95XPmL2sK6Shqax1Vqk*n1>YgP3`8S5JC$X_IH!vb+5*_ct0ZT_&)# z0338NBE>V@6CqoHz7yKb$yom-nb*5(ypkZp-&p1v=ETrI0w7TiO4-Pv04G~*$)sEl;SLgxk#H@9>ma5Bc>y>@ zy|q%37Z6E)fFM^tRthi;0Y*>&rOZaj&|PrSD$XMStyT>NQDYoKQtOHQIFWx%)U`x@ zl9pWJuVUW&jFjqJzoJ9VEFqMq2HNMB$6YHiS>!!Bg) z?0lk<69k(V0NErnK8{2r4Tm&9{Sj?3Ob~srzdQea|5Z8AdHAU1Cv0RkLs%1pDy|$9o1)CRml8Qn;%q zbGAE_cAXIp4YjL7bHg68jru?(X#cm-Cn`A;C3_7B7?dttB31Jv-H~QC%HOmtqnj=qwbZAQ$*=F;Jyc6bx3HJ^OJt)>2=suH4 zvr<+_TPJdqvI5%Zmt*PlEJ`NBH4vV~c-Qk7fr0COI2$n-YM`CSvj8)rgM7JxoF6qv(JT}b%x&sbV-$K$#ZQqrMVoOGciuRzHw`2>M}7$tN{eHwYT@HDlK5~eBo4@L1z z6fDh(T1`a-sHlh?)D?Ui>FiWjB8e2!l7b298Y)tap*#UoK?iC8@mHfxX`?&U z8pxXkT{>sl{OTldq-^qEEQ?d^dI$cLvV5vIwS?cGlwC_Zm~dsqY&)}1at-2f*VArN zP4yEt(6IaZkSb*?@X>xt47e#D!sIf{p#jxraHvZREXin*X7HMZd732Tr?N8@TtZh% z=xGf0VQE^955Y3C?BZN4;QjsJ$kwj9>(munON=>_|_fimnu_AYonz8-&aF z0VSq4l1>DDG8wGYp~*l%lX3WR;7{R1swV~o4%&ovy=)hL*bt}04zi0D?y4U1#zP$J zO}s7!Uxkg^HjvjvT0iA^m!SoEvCJ(i2D!bMf}kS`)8<9xgCjEksbOKm#9{jP$5b4LHOLxG7c$GomxY zTDi=0+14qvNi0Tal|y!*?5rfEL;6uj+=$*|zZXprfcx&Fy`v`j?lvhUESFJkoR{H(ph+!Vn|QXOu0aV zU~#ju)Wy4(zMZViQLM~93L1q5+A}<+&sBBHJmPZ6yHFBcjb5Lt+3Rl<7kL{zkJ`rAt&+gKE*PR4kw+n(RJ)7OK&~p8mGDd@UAioPxdKLk7=d@h1aelAzlg@ zvd5Zc)9fK$DTP1^aUFmMc^3)30+Fhz`yu}I*In+&fmvGX!AR9St>ugyaB8jlBUO^t znjfi2aoiU z{Tswglzsv+fzlHYGgJB&#BwP;46!^){|GS)rTZ?Yy(^>r{Tc1+Guor3Dedbr+Rx5t zUz5@P?u_r&PDA#1yQU0NO2d50fek>d+^RaS|#kk z+ZeS4Kkma%hLA1zZlBv0{7WC+OtEvcFDisAQDZ1Kb_;|CMlHgw{k+YSE04=l0A48E z4?93S+1c6M{dp;LosAaSyb%Z$p0*qv*mc~gU_O2dynaX(TM`uM2=LQbWX9fS-!PQ&X45JfcbC_%mWYHv)tR@T`V<=Q>KW=GarmY-W8|& z-7O6saZ*#0zo{y3LZ)yn#ZSpbm(L?M`kTdNo@TLS=@7A^d^|qGe=J(Ht8rMf*yM4! zuUq78bR$fIXJNC)&FZ7r?C~vaa5Z~ajr>2cT@4NXg%rcn=x=&C_ z8vkd^i7rhwt#n_cpI9+r=3SzMTk$lB-o{5<4PN)~AwSj-Y2b_ZELJqO_#Q+&{~~cw z6WV$iA}{neHKCCj9us}8rX?OKB&ppe*ym4(tkZww{O%@tXbiEA9&_`pW5fricKDo7R`;PXG-|l<$jd$Mr@T;Eh`wELo z29*sdA2wplt#?kIxp&_ioo|0QAa77v`OV{I*3ETGO*?+~hgS}FetPPBZ}E_y4!`cE z>9gj}f5`Xqr`q=Y>Cf+f{IBnejk!fvUq5#I^xC!;et+;t{Oxy6oj!Md02w%Z)a})d zd*`=q-4>3#dN_XUuV>F)xSBT>l?)m@VpR2H&(cQ%Yd3D%7VbFs+FS2`{MkRgJbSJv zzo@)o^vx3|Ii}5+y};#pxMgLa!(1_P+}!!n!y7g|^X&6F`v>HPJMMqTJo>3$y>aaL zdmo}T&Km}gV8%Mf^(=vMK=K=nya?0aJNl0r9US4x>s%rDLU;StU%(7pvWKfBNM7dV zP$KY*ZwSAh$KKDhUKKx$f`$1lba1ntEqPkc24B|u4LE2uu)%9JGF2lp4QxqK4x6jh h$h;gj_@MDc6Y}|tM=4om?53njm?0o3wT!XAe*oaUCD8x? literal 0 HcmV?d00001