Add files via upload

This commit is contained in:
Antoine Vignau 2020-06-08 22:44:58 +02:00 committed by GitHub
parent 1994bd80c0
commit dd98c02b9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 2994 additions and 0 deletions

View File

@ -0,0 +1,187 @@
*-------------------------------------------------
* Here is a routine that will quickly draw the
* apple. Somewhere before this is called,
* set HiRes+2 to $E1. No other setup is needed.
* Add the word sized dp's offset and RealOffset.
* ("width" is not needed now.) This routine
* gets its speed from its very tiny inner loop!
DrawApple anop
lda yposition ; set up the index onto the screen once,
asl a ; ahead of time....
tay
lda [SLookUp],y
clc
adc xposition
sta HiRes
sta RealOffset ; used to compute HiRes inside the loop
lda image_height ; depth of shape
sta depth
ldy #0 ; index into the shape and the screen
yloop ldx image_wordwidth ; width (in words) of shape
xloop lda Apple,y
sta [HiRes],y
iny ; only one register to increment!
iny
dex
bne xloop
sty offset ; use this to adjust the HiRes pointer
lda RealOffset ; just go line by line like normal
clc
adc #160
sta RealOffset
sec
sbc offset ; then subtract out Y so that
sta HiRes ; HiRes+Y = the start of the next line!
dec depth
bne yloop
rts
*-------------------------------------------------
* This should draw Sculley a lot faster.
* Just set "Sculley" to the address of the shape
* (32 bits) and this routine should draw it.
* ("Sculley" should be in the Direct Page.)
* Also: It should not cross banks! I don't think
* it did originally so it shouldn't be a problem.
DrawSculley anop
lda yposition
asl a
tay
lda [SLookUp],y
clc
adc xposition
sta HiRes ; set up the index onto the screen now
lda image_height ; depth of shape
sta depth
clc ; Carry will stay clear
; ; throughout the loop.
yloop ldx image_wordwidth ; width (in words) of shape
ldy #0
xloop lda [Sculley],y
sta [HiRes],y
iny ; only one register to increment!
iny
dex
bne xloop
lda Sculley
adc image_bytewidth ; next line of Mr. Sculley
sta Sculley
lda HiRes ; next line on the screen
adc #160
sta HiRes
dec depth
bne yloop
rts
*-------------------------------------------------
* I thought you might want to have the random
* number generator I use. I haven't tested it
* against QuickDraw but there was a demo with Merlin
* that showed it and it was VERY fast and random
* looking. (I could send it if you want.)
* Use this for whatever you want.
*-------------------------------------------------
*=================================================
* RANDOM returns a random number in A
* RANDOMIZE seeds the generator from the clock
* SEED seeds the generator from AXY.
*
* Adapted by Derek Young from RANDOM, from the
* Merlin 16+ package.
*
* X and Y registers preserved, number returned in A
Random phx
phy
clc
ldx INDEXI
ldy INDEXJ
lda ARRAY-2,X
adc ARRAY-2,Y
sta ARRAY-2,X
dex
dex
bne DYL7
ldx #17*2 ; Cycle index if at end of
DYL7 dey ; the array
dey
bne SETIXL7
ldy #17*2
SETIXL7 stx INDEXI
sty INDEXJ
ply
plx
rts
INDEXI dc a'17*2' ; The relative positions of
INDEXJ dc a'5*2' ; these indexes is crucial
ARRAY dc a'1,1,2,3,5,8,13,21,54,75,129,204'
dc a'323,527,850,1377,2227'
*=================================================
* Randomize sets the random number seed from the
* clock.
Randomize anop
pha
pha
pha
pha
ldx #$D03 ; ReadTimeHex
jsl $E10000 ; (like this so we don't need macros)
pla
plx
ply
sta 1,S
ora #1 ; At least one must be odd
sta ARRAY
stx ARRAY+2
phx ; Push index regs on stack
phy
ldx #30
LUPV1 sta ARRAY+2,X
dex
dex
lda 1,S ; Was Y
sta ARRAY+2,X
dex
dex
lda 3,S ; Was X
sta ARRAY+2,X
lda 5,S ; Original A
dex
dex
bne LUPV1
lda #17*2
sta INDEXI ; Init proper indexes
lda #5*2 ; into array
sta INDEXJ
jsr Random ; Warm the generator up.
jsr Random
ply
plx
pla
rts
end

View File

@ -0,0 +1,317 @@
* Here is a routine that will wait for any scanline
* number. I don't know if this will fix the problem.
* I usually just wait for a VBL...
WaitLine sep $20 ;wait for a scan line
sta Line
]loop ldal $C02F
asl
ldal $C02E
rol
cmp Line
bne ]loop
rep $20
rts
Line db 0
* I can't see why this would make any difference but
* try this routine, maybe it will fix it... it's
* basically yours with some changes.
DrawBullet
jsr PlaySound ;Bang!
randomize
WordResult
_Random
pla
and #$0FFF <- to optimize!! think about it... :)
cmp #2100
bge randomize
sta bullet_offset ;I can't see where you use this <---
sta bul_off_temp
stz image_index init an index into the shape data
lda #15 depth of bullet
sta depth
clc ;move this out of the loop
ldx #0
ldy bul_off_temp ;use Y as a horizontal offset
yloop
lda [bas2],y
and bulmsk4,x get byte of shape
ora bullet4,x
sta [bas2],y
iny ;move over a word to the right
iny
lda [bas2],y
and bulmsk4+2,x get byte of shape
ora bullet4+2,x
sta [bas2],y
iny ;move over a word to the right
iny
lda [bas2],y
and bulmsk4+2,x get byte of shape
ora bullet4+2,x
sta [bas2],y
iny ;move over a word to the right
iny
lda [bas2],y
and bulmsk4+2,x get byte of shape
ora bullet4+2,x
sta [bas2],y
iny ;move over a word to the right
iny
lda [bas2],y
and bulmsk4+2,x get byte of shape
ora bullet4+2,x
sta [bas2],y
txa
adc #5*2 ;10 bytes wide (the bullet)
tax
tya ;move ptr one line down
adc #30 ;30 bytes wide (skulley shape)
tay
dec depth see if done all lines
bne yloop
* I think this is drawing a black box....
* Add Right as a DP address somewhere.
lda Bas2
clc
adc #28
sta Right ;precalculate the right side
ldy #bWidth*75-bWidth ;count down
sec
zero0 lda #0
sta [Bas2],y ;draw the left and right
sta [Right],y
tya
sbc #bWidth
tay
bpl zero0
ldy #bWidth-2
lda #0
zero2 sta [Bas2],y ;draw the top and bottom
sta [Bas22],y
dey
dey
bpl zero2
rts
*-------------------------------------------------
* Here is a routine that will quickly draw the
* apple. Somewhere before this is called,
* set HiRes+2 to $E1. No other setup is needed.
* Add the word sized dp's offset and RealOffset.
* ("width" is not needed now.) This routine
* gets its speed from its very tiny inner loop!
DrawApple
lda yposition ;set up the index onto the screen once,
asl ;ahead of time....
tay
lda [SLookUp],y
clc
adc xposition
sta HiRes
sta RealOffset ;used to compute HiRes inside the loop
lda image_height ;depth of shape
sta depth
ldy #0 ;index into the shape and the screen
yloop ldx image_wordwidth ;width (in words) of shape
xloop lda Apple,y
sta [HiRes],y
iny ;only one register to increment!
iny
dex
bne xloop
sty offset ;use this to adjust the HiRes pointer
lda RealOffset ;just go line by line like normal
clc
adc #160
sta RealOffset
sec
sbc offset ;then subtract out Y so that
sta HiRes ;HiRes+Y = the start of the next line!
dec depth
bne yloop
rts
*-------------------------------------------------
* This should draw Sculley a lot faster.
* Just set "Skulley" to the address of the shape
* (32 bits) and this routine should draw it.
* ("Skulley" should be in the Direct Page.)
* Also: It should not cross banks! I don't think
* it did originally so it shouldn't be a problem.
DrawSculley
pei Skulley ;save this while we draw
lda yposition
asl
tay
lda [SLookUp],y
clc
adc xposition
sta HiRes ;set up the index onto the screen now...
lda image_height ;depth of shape
sta depth
clc ;the carry will stay clear throughout the loop
yloop ldx image_wordwidth ;width (in words) of shape
ldy #0
xloop lda [Skulley],y
sta [HiRes],y
iny ;only one register to increment!
iny
dex
bne xloop
lda Skulley
adc image_bytewidth ;next line of Mr. Sculley
sta Skulley
lda HiRes ;next line on the screen
adc #160
sta HiRes
dec depth
bne yloop
pla
sta Skulley
rts
*-------------------------------------------------
* I thought you might want to have the random
* number generator I use. I haven't tested it
* against QuickDraw but there was a demo with Merlin
* that showed it and it was VERY fast and random
* looking. (I could send it if you want.)
* Use this for whatever you want.
*-------------------------------------------------
*=================================================
* RANDOM returns a random number in A
* RANDOMIZE seeds the generator from the clock
* SEED seeds the generator from AXY.
*
* Adapted by Derek Young from RANDOM, from the
* Merlin 16+ package.
*
* X and Y registers preserved, number returned in A
Random phx
phy
clc
ldx INDEXI
ldy INDEXJ
lda ARRAY-2,X
adc ARRAY-2,Y
sta ARRAY-2,X
dex
dex
bne :DY
ldx #17*2 ;Cycle index if at end of
:DY dey ; the array
dey
bne :SETIX
ldy #17*2
:SETIX stx INDEXI
sty INDEXJ
ply
plx
rts
INDEXI da 17*2 ;The relative positions of
INDEXJ da 5*2 ; these indexes is crucial
ARRAY da 1,1,2,3,5,8,13,21,54,75,129,204
da 323,527,850,1377,2227
*=================================================
* Randomize sets the random number seed from the
* clock.
Randomize lda #0
pha
pha
pha
pha
ldx #$D03 ;ReadTimeHex
jsl $E10000 ;(like this so we don't need macros)
pla
plx
ply
sta 1,S
ora #1 ;At least one must be odd
sta ARRAY
stx ARRAY+2
phx ;Push index regs on stack
phy
ldx #30
]LUP sta ARRAY+2,X
dex
dex
lda 1,S ;Was Y
sta ARRAY+2,X
dex
dex
lda 3,S ;Was X
sta ARRAY+2,X
lda 5,S ;Original A
dex
dex
bne ]LUP
lda #17*2
sta INDEXI ;Init proper indexes
lda #5*2 ; into array
sta INDEXJ
jsr Random ;Warm the generator up.
jsr Random
ply
plx
pla
rts

View File

@ -0,0 +1,189 @@
*-------------------------------------------------
* Here is a routine that will quickly draw the
* apple. Somewhere before this is called,
* set HiRes+2 to $E1. No other setup is needed.
* Add the word sized dp's offset and RealOffset.
* ("width" is not needed now.) This routine
* gets its speed from its very tiny inner loop!
DrawApple
lda yposition ;set up the index onto the screen once,
asl ;ahead of time....
tay
lda [SLookUp],y
clc
adc xposition
sta HiRes
sta RealOffset ;used to compute HiRes inside the loop
lda image_height ;depth of shape
sta depth
ldy #0 ;index into the shape and the screen
yloop ldx image_wordwidth ;width (in words) of shape
xloop lda Apple,y
sta [HiRes],y
iny ;only one register to increment!
iny
dex
bne xloop
sty offset ;use this to adjust the HiRes pointer
lda RealOffset ;just go line by line like normal
clc
adc #160
sta RealOffset
sec
sbc offset ;then subtract out Y so that
sta HiRes ;HiRes+Y = the start of the next line!
dec depth
bne yloop
rts
*-------------------------------------------------
* This should draw Sculley a lot faster.
* Just set "Skulley" to the address of the shape
* (32 bits) and this routine should draw it.
* ("Skulley" should be in the Direct Page.)
* Also: It should not cross banks! I don't think
* it did originally so it shouldn't be a problem.
DrawSculley
pei Skulley ;save this while we draw
lda yposition
asl
tay
lda [SLookUp],y
clc
adc xposition
sta HiRes ;set up the index onto the screen now...
lda image_height ;depth of shape
sta depth
clc ;the carry will stay clear throughout the loop
yloop ldx image_wordwidth ;width (in words) of shape
ldy #0
xloop lda [Skulley],y
sta [HiRes],y
iny ;only one register to increment!
iny
dex
bne xloop
lda Skulley
adc image_bytewidth ;next line of Mr. Sculley
sta Skulley
lda HiRes ;next line on the screen
adc #160
sta HiRes
dec depth
bne yloop
pla
sta Skulley
rts
*-------------------------------------------------
* I thought you might want to have the random
* number generator I use. I haven't tested it
* against QuickDraw but there was a demo with Merlin
* that showed it and it was VERY fast and random
* looking. (I could send it if you want.)
* Use this for whatever you want.
*-------------------------------------------------
*=================================================
* RANDOM returns a random number in A
* RANDOMIZE seeds the generator from the clock
* SEED seeds the generator from AXY.
*
* Adapted by Derek Young from RANDOM, from the
* Merlin 16+ package.
*
* X and Y registers preserved, number returned in A
Random phx
phy
clc
ldx INDEXI
ldy INDEXJ
lda ARRAY-2,X
adc ARRAY-2,Y
sta ARRAY-2,X
dex
dex
bne :DY
ldx #17*2 ;Cycle index if at end of
:DY dey ; the array
dey
bne :SETIX
ldy #17*2
:SETIX stx INDEXI
sty INDEXJ
ply
plx
rts
INDEXI da 17*2 ;The relative positions of
INDEXJ da 5*2 ; these indexes is crucial
ARRAY da 1,1,2,3,5,8,13,21,54,75,129,204
da 323,527,850,1377,2227
*=================================================
* Randomize sets the random number seed from the
* clock.
Randomize lda #0
pha
pha
pha
pha
ldx #$D03 ;ReadTimeHex
jsl $E10000 ;(like this so we don't need macros)
pla
plx
ply
sta 1,S
ora #1 ;At least one must be odd
sta ARRAY
stx ARRAY+2
phx ;Push index regs on stack
phy
ldx #30
]LUP sta ARRAY+2,X
dex
dex
lda 1,S ;Was Y
sta ARRAY+2,X
dex
dex
lda 3,S ;Was X
sta ARRAY+2,X
lda 5,S ;Original A
dex
dex
bne ]LUP
lda #17*2
sta INDEXI ;Init proper indexes
lda #5*2 ; into array
sta INDEXJ
jsr Random ;Warm the generator up.
jsr Random
ply
plx
pla
rts

View File

@ -0,0 +1,11 @@
*------------------------------------------------*
* *
* SuperBounce v.1 *
* A Twilight II Blanker *
* Derek Young *
* *
*------------------------------------------------*
lst off
xc
xc
mx %00

View File

@ -0,0 +1,16 @@
* Link the tunnel module.
filelen geq $133F
asm Tunnel.t2
lnk Tunnel.twlt.l
lnk CIRCLES ;link in the compressed circles
ds $1000
typ RTL
sav Tunnel.twlt
end
cmd auxtype Tunnel.twlt,$5457

View File

@ -0,0 +1,171 @@
_TLStartUp MAC
Tool $201
<<<
_TLShutDown MAC
Tool $301
<<<
~MMStartUp MAC
PHA
Tool $202
<<<
~MMShutDown MAC
PHW ]1
Tool $302
<<<
~NewHandle MAC
P2SL ]1
PxW ]2;]3
PHL ]4
Tool $902
<<<
~DisposeAll MAC
PHW ]1
Tool $1102
<<<
~QDStartUp MAC
PxW ]1;]2;]3;]4
Tool $204
<<<
_QDShutDown MAC
Tool $304
<<<
_SetSolidPenPat MAC
Tool $3704
<<<
~FrameOval MAC
PHL ]1
Tool $5804
<<<
_QUIT MAC
DOS16 $29;]1
<<<
DOS16 MAC
JSL $E100A8
DA ]1
ADRL ]2
<<<
PxW MAC
DO ]0/1
PHW ]1
DO ]0/2
PHW ]2
DO ]0/3
PHW ]3
DO ]0/4
PHW ]4
FIN
FIN
FIN
FIN
<<<
P2SL MAC
PHA
PHA
IF #=]1
PEA ^]1
ELSE
PHW ]1+2
FIN
PHW ]1
<<<
PHL MAC
IF #=]1
PEA ^]1
ELSE
PHW ]1+2
FIN
PHW ]1
<<<
PHW MAC
IF #=]1
PEA ]1
ELSE
IF MX/2
LDA ]1+1
PHA
FIN
LDA ]1
PHA
FIN
<<<
PullLong MAC
DO ]0
PullWord ]1
PullWord ]1+2
ELSE
PullWord
PullWord
FIN
<<<
PullWord MAC
PLA
DO ]0
STA ]1
FIN
IF MX/2
PLA
DO ]0
STA ]1+1
FIN
FIN
<<<
Tool MAC
LDX #]1
JSL $E10000
<<<
~SetHeartBeat MAC
PHL ]1
Tool $1203
<<<
~DelHeartBeat MAC
PHL ]1
Tool $1303
<<<
~SetPenPat MAC
PHL ]1
Tool $3004
<<<
~GetPenPat MAC
PHL ]1
Tool $3104
<<<
~InitPort MAC
PHL ]1
Tool $1904
<<<
~SetPort MAC
PHL ]1
Tool $1B04
<<<
~GetPort MAC
PHS 2
Tool $1C04
<<<
PHS MAC
DO ]0
LUP ]1
PHA
--^
ELSE
PHA
FIN
<<<
~OpenPort MAC
PHL ]1
Tool $1804
<<<
_SetMasterSCB MAC
Tool $1604
<<<
~GetMasterSCB MAC
PHA
Tool $1704
<<<
~SetMasterSCB MAC
PHW ]1
Tool $1604
<<<
~ClosePort MAC
PHL ]1
Tool $1A04
<<<

View File

@ -0,0 +1,280 @@
*------------------------------------------------*
* *
* Tunnel *
* A Twilight II blanker *
* By Derek Young *
* *
*------------------------------------------------*
lst off
rel
xc
xc
mx %00
use Tunnel.macs
dum $00
Color da 0 ;for drawing the circles
i da 0
DP adrl 0
MyID da 0
MemID da 0
dend
delay = 1
NumCircles = 189
phk
plb
lda #$FFF
sta LastC
lda #$FFF
stal $E19E00
stz CycleColor
stz VCount
* ~SetHeartBeat #Cycler
jsr StartUp
jsr DrawCircles
sep $20
]loop ldal $C000
bpl ]loop
stal $C010
rep $20
* ~DelHeartBeat #Cycler
jsr ShutDown
_QUIT :1
:1 adrl 0
da 0
*-------------------------------------------------
* Draw the huge ring of circles on the screen
DrawCircles
lda #160
sta h1
sta h2
lda #100
sta v1
sta v2
lda #1
sta Color
lda #NumCircles
sta i
:Loop
pei Color
_SetSolidPenPat
;yuck! QuickDraw :(
~FrameOval #CRect
lda Color
inc
and #%1111 ;keep it between 0 and fifteen
bne :ok
inc ;skip 1
:ok sta Color
dec v1
dec h1
inc v2
inc h2
dec i
bne :Loop
rts
CRect
v1 da 0
h1 da 0
v2 da 0
h2 da 0
*-------------------------------------------------
* The color cycler.
* It uses a heartbeat task.
Cycler
adrl 0
Period da delay
da $A55A
phk
plb
rep $30
lda #delay
sta Period
lda #$FFFF
sta DoNext
lda VCount
inc
sta VCount
cmp #91
bge :bigger
stz DoNext
:bigger
phb ;Cycle the 15 first colors
pea $E1E1
plb
plb
* lda $9E02
* sta $9E00
lda $9E04
sta $9E02
lda $9E06
sta $9E04
lda $9E08
sta $9E06
lda $9E0A
sta $9E08
lda $9E0C
sta $9E0A
lda $9E0E ;move each color down one
sta $9E0C
lda $9E10
sta $9E0E
lda $9E12
sta $9E10
lda $9E14
sta $9E12
lda $9E16
sta $9E14
lda $9E18
sta $9E16
lda $9E1A
sta $9E18
lda $9E1C
sta $9E1A
lda $9E1E
sta $9E1C
plb
lda VCount
cmp #91
blt :smaller
stz VCount
:smaller
lda LastC
stal $E19E1E
lda DoNext
beq :else ;false...
ldy CycleColor
cpy #90*2
blt :ok
ldy #0
:ok lda CycleTable,y
sta LastC
iny
iny
sty CycleColor
stz DoNext
rtl
:else
ldal $E19E02
sta LastC
rtl
Timer da 0
LastC da 0
DoNext da 0
VCount da 0
CycleColor da 0
CycleTable da $F00,$F10,$F20,$F30,$F40,$F50,$F60,$F70,$F80
da $F90,$FA0,$FB0,$FC0,$FD0,$FE0,$FF0,$EF0,$DF0
da $CF0,$BF0,$AF0,$9F0,$8F0,$7F0,$6F0,$5F0,$4F0
da $3F0,$2F0,$1F0,$0F0,$0F1,$0F2,$0F3,$0F4,$0F5
da $0F6,$0F7,$0F8,$0F9,$0FA,$0FB,$0FC,$0FD,$0FE
da $0FF,$0EF,$0DF,$0CF,$0BF,$0AF,$09F,$08F,$07F
da $06F,$05F,$04F,$03F,$02F,$01F,$00F,$10F,$20F
da $30F,$40F,$50F,$60F,$70F,$80F,$90F,$A0F,$B0F
da $C0F,$D0F,$E0F,$F0F,$F0E,$F0D,$F0C,$F0B,$F0A
da $F09,$F08,$F07,$F06,$F05,$F04,$F03,$F02,$F01
*-------------------------------------------------
* Startup QuickDraw and the other tools
* (Won't be needed for the blanker :)
*-------------------------------------------------
StartUp
_TLStartUp
~MMStartUp
PullWord MyID
ora #$100
sta MemID
~NewHandle #$300;MemID;#$C005;#0
PullLong DP
~QDStartUp [DP];#0;#160;MyID
rts
ShutDown
_QDShutDown
~DisposeAll MemID
~MMShutDown MyID
_TLShutDown
rts
typ S16
sav Tunnel.l
end
If DoNext=true then begin
SetColorEntry(0,15,LastC); {restore last color}
TbCol:=TBCol+1;
If TBCol=91 then TBCol:=1;
LastC:=Table[TBCol]; {get last color}
DoNext:=False; {set to false}
end {IF donext}
else begin
SetColorEntry(0,15,LastC);
LastC:=GetColorEntry(0,1);
end; {Else}
for x:=1 to waittime do begin
end; {For X}
end; {Cycle}
InitScreen; {Start up graphics}
DrawCircles; {Draw the screen}
LastC:=$FFF; {pure white}
TBCol:=1; {table counter}
VCount:=0;
WaitTime:=800; {time to pause during cycle}
Quitflag:=false;
repeat
VCount:=VCount+1; {counter}
DoNext:=True;
if VCount<=90 then DoNext:=False; {indicate we want to cycle}
Cycle; {Cycle the Colors}
If VCount>90 then VCount:=0; {reset counter}
Process;
if Waittime>2700 then waittime:=2699;
if waittime<100 then waittime:=101;
until quitflag=true;

View File

@ -0,0 +1,287 @@
*------------------------------------------------*
* *
* Tunnel *
* A Twilight II blanker *
* By Derek Young *
* *
*------------------------------------------------*
lst off
rel
xc
xc
mx %00
use Tunnel.macs
dum $00
Color da 0 ;for drawing the circles
i da 0
DP adrl 0
MyID da 0
MemID da 0
MovePtr adrl 0 ;for twilight
dend
delay = 1
NumCircles = 189
lda 6,s
sta MovePtr
lda 8,s
sta MovePtr+2
phk
plb
lda #0
ldx #$7E00-2
]loop stal $E12000,x
dex
dex
bpl ]loop
ldx #32-2
]loop lda Palette,x
stal $E19E00,x
dex
dex
bpl ]loop
sep $20
ldal $C034
pha
and #$F
sta Border
pla
and #$F0
stal $C034
rep $20
lda #$FFF
sta LastC
stz CycleColor
stz VCount
~SetHeartBeat #Cycler
jsr DrawCircles
bcs :end
:loop lda [MovePtr]
beq :loop
:end ~DelHeartBeat #Cycler
sep $20
ldal $C034
and #$F0
ora Border
stal $C034
rep $20
lda 2,s ;move the RTL address up on the stack
sta 12,s
lda 1,s
sta 11,s
tsc
clc
adc #10
tcs
rtl
Border db 0
Palette da $000,$777,$841,$72C,$00F,$080,$F70,$D00
da $FA9,$FF0,$0E0,$4DF,$DAF,$78F,$CCC,$FFF
*-------------------------------------------------
* Draw the huge ring of circles on the screen
DrawCircles
~GetPort
PullLong OldPort
~GetMasterSCB
pla
sta oldSCB
and #$FF7F ;go to 320 mode
pha
_SetMasterSCB
~OpenPort #MyPort ;get a fresh port setup
lda #160
sta h1
sta h2
lda #100
sta v1
sta v2
lda #1
sta Color
lda #NumCircles
sta i
:Loop
pei Color
_SetSolidPenPat
;yuck! QuickDraw :(
~FrameOval #CRect
lda Color
inc
and #%1111 ;keep it between 0 and fifteen
bne :ok
inc ;skip 0
:ok sta Color
dec v1
dec h1
inc v2
inc h2
lda [MovePtr] ;incase the event happens while they're
bne :abort ;drawing.
dec i
bne :Loop
lda #0
:abort pha
~SetMasterSCB oldSCB
~SetPort OldPort
~ClosePort #MyPort
pla
cmp #1
rts
CRect
v1 da 0
h1 da 0
v2 da 0
h2 da 0
oldSCB da 0
OldPort adrl 0
MyPort ds 170 ;170 bytes. Hope this doesn't cause a
;problem in the future if this length changes.
*-------------------------------------------------
* The color cycler.
* It's a heartbeat task.
Cycler
adrl 0
Period da delay
da $A55A
phk
plb
rep $30
lda #delay
sta Period
lda #$FFFF
sta DoNext
lda VCount
inc
sta VCount
cmp #91
bge :bigger
stz DoNext
:bigger
phb ;Cycle the 15 first colors
pea $E1E1
plb
plb
lda $9E04
sta $9E02
lda $9E06
sta $9E04
lda $9E08
sta $9E06
lda $9E0A
sta $9E08
lda $9E0C
sta $9E0A
lda $9E0E ;move each color down one
sta $9E0C
lda $9E10
sta $9E0E
lda $9E12
sta $9E10
lda $9E14
sta $9E12
lda $9E16
sta $9E14
lda $9E18
sta $9E16
lda $9E1A
sta $9E18
lda $9E1C
sta $9E1A
lda $9E1E
sta $9E1C
plb
lda VCount
cmp #91
blt :smaller
stz VCount
:smaller
lda LastC
stal $E19E1E
lda DoNext
beq :else ;false...
ldy CycleColor
cpy #90*2
blt :ok
ldy #0
:ok lda CycleTable,y
sta LastC
iny
iny
sty CycleColor
stz DoNext
rtl
:else
ldal $E19E02
sta LastC
rtl
Timer da 0
LastC da 0
DoNext da 0
VCount da 0
CycleColor da 0
CycleTable da $F00,$F10,$F20,$F30,$F40,$F50,$F60,$F70,$F80
da $F90,$FA0,$FB0,$FC0,$FD0,$FE0,$FF0,$EF0,$DF0
da $CF0,$BF0,$AF0,$9F0,$8F0,$7F0,$6F0,$5F0,$4F0
da $3F0,$2F0,$1F0,$0F0,$0F1,$0F2,$0F3,$0F4,$0F5
da $0F6,$0F7,$0F8,$0F9,$0FA,$0FB,$0FC,$0FD,$0FE
da $0FF,$0EF,$0DF,$0CF,$0BF,$0AF,$09F,$08F,$07F
da $06F,$05F,$04F,$03F,$02F,$01F,$00F,$10F,$20F
da $30F,$40F,$50F,$60F,$70F,$80F,$90F,$A0F,$B0F
da $C0F,$D0F,$E0F,$F0F,$F0E,$F0D,$F0C,$F0B,$F0A
da $F09,$F08,$F07,$F06,$F05,$F04,$F03,$F02,$F01
typ RTL
sav Tunnel.twlt.l

View File

@ -0,0 +1,405 @@
*------------------------------------------------*
* *
* Tunnel *
* A Twilight II blanker *
* By Derek Young *
* *
*------------------------------------------------*
lst off
rel
xc
xc
mx %00
use Tunnel.macs
dum $00
MovePtr adrl 0 ;for twilight
SCREENAD DS 4 ;Pointer
PACKPTR DS 4 ;Address of packed data
LENGTH DS 4 ;Number of bytes to unpack
UNPACKPTR DS 4 ;Address of Unpacked data
RingIndex DS 2 ;Index to ring buffer
Flags DS 2 ;Index to flags
Line1 da 0
Line2 da 0
dend
* The RingBuffer is external. The loader will set aside
* the 4096 bytes needed at the end of the file...
ext Circles
lda 6,s
sta MovePtr
lda 8,s
sta MovePtr+2
phk
plb
ldx #$8000-2
lda #0
]loop stal $E12000,x
dex
dex
bpl ]loop
sep $20
ldal $C034
sta Border
lda #0
stal $C034
rep $20
jsr MakeCircles
lda #$FFF
sta LastC
stz CycleColor
stz VCount
]loop
jsr WaitVBL
jsr Cycler
lda [MovePtr]
beq ]loop ;wait for an event
sep $20
lda Border
stal $C034
rep $20
lda 2,s ;move the RTL address up on the stack
sta 12,s
lda 1,s
sta 11,s
tsc
clc
adc #10
tcs
rtl
Border db 0
WaitVBL
sep $20 ;I took this out of the heartbeat task...
]a ldal $E0C019
bmi ]a
]b ldal $E0C019
bpl ]b
rep $20
rts
*-------------------------------------------------
* Draw the huge ring of circles on the screen
* (Actually just unpack the screen. I hated QuickDraw :)
MakeCircles
jsr UnPackIt
* Half the screen has been unpacked - flip it.
phb
pea $E1E1
plb
plb
lda #$2000+16000-160
sta Line1
lda #$2000+16000
sta Line2
:flip
ldy #160-2
]loop lda (Line1),y
sta (Line2),y
dey
dey
bpl ]loop
lda Line2
clc
adc #160
sta Line2
lda Line1
sec
sbc #160
sta Line1
cmp #$2000-160
bge :flip
plb
ldx #32-2
]loop lda Palette,x
stal $E19E00,x
dex
dex
bpl ]loop
rts
Palette da $000,$111,$222,$333,$444,$555,$666,$777
da $888,$999,$AAA,$BBB,$CCC,$DDD,$EEE,$FFF
*Palette da $000,$777,$841,$72C,$00F,$080,$F70,$D00
* da $FA9,$FF0,$0E0,$4DF,$DAF,$78F,$CCC,$FFF
*
* Unpack a section of memory
*
RINGSIZE = 4096 ;/* size of ring buffer */
MATCHMAX = 18 ;/* upper limit for match_length */
THRESHOLD = 2 ;/* encode string into position and length
UnPackIt
lda #16000 ;just half of the pixel data is stored
sta LENGTH
lda #$E12000
sta UNPACKPTR
lda #^$E12000
sta UNPACKPTR+2
lda #Circles+4 ;skip over the length long word
sta PACKPTR
lda #^Circles+4
sta PACKPTR+2
SEC
LDA #0
SBC LENGTH
STA LENGTH
LDX #RINGSIZE-MATCHMAX-1
SEP #$20
]A STZ RingBuffer,X ;First fill the ring buffer
DEX
BPL ]A
REP #$20
LDA #RINGSIZE-MATCHMAX ;Set the index to the end of the buffer
STA RingIndex
STZ Flags ;Kill my flags
*
* Loop here
* Get a byte in flags to know if the next 8 samples are either
* words or bytes
*
]A LSR Flags ;Shift out a byte flag
LDA Flags
BIT #$100 ;Empty?
BNE :FLAGSOK
JSR GETBYTE ;Get new flags
ORA #$FF00 ;Or in $FF for an 8 bit count
STA Flags ;Save
:FLAGSOK BIT #1 ;Is this a raw byte or a pack string?
BEQ :DLZZ
JSR GETBYTE ;Get raw byte
JSR PUTBYTE ;Save it
LDX RingIndex ;Get ring buffer index
SEP #$20
STA RingBuffer,X ;Save data in ring buffer
REP #$20
INX ;Next index
TXA
AND #RINGSIZE-1 ;Keep in ring buffer!
STA RingIndex ;Save
BRA ]A ;Get another char!
*
* Decompress from ring buffer
*
:DLZZ JSR GETWORD ;Get count/index to buffer
TAY ;Save word
AND #$FFF ;Mask index
TAX ;Save as index to ring buffer
TYA
ROL ;Move upper 4 bits to lowest 4 bits
ROL
ROL
ROL
ROL
AND #$F ;Mask
INC ;Add threshold (2)
INC
STA SCREENAD
LDY RingIndex ;Get ring buffer index
]B LDA RingBuffer,X ;Get char from buffer
JSR PUTBYTE ;Save in decompressed buffer
SEP #$20
STA RingBuffer,Y
REP #$20
INY
TYA
AND #RINGSIZE-1
TAY
INX ;Next index
TXA
AND #RINGSIZE-1 ;Keep in buffer
TAX
DEC SCREENAD ;All bytes done?
BPL ]B ;Loop
STY RingIndex
BRA ]A ;Keep decompressing!
*
* Save byte in finished buffer
*
PUTBYTE SEP #$20
STA [UNPACKPTR] ;Save byte
REP #$20
INC UNPACKPTR ;Inc pointer
BNE :AA
INC UNPACKPTR+2
:AA INC LENGTH ;Dec length
BNE :BB
PLA ;Kill JSR to abort
:BB rts ;EXIT whole routine
*
* Get a byte of packed data
*
GETBYTE LDA [PACKPTR] ;Get byte
AND #$FF ;Mask
INC PACKPTR ;Inc pointer
BNE :AA
INC PACKPTR+2
:AA RTS
*
* Get a word of packed data
*
GETWORD LDA [PACKPTR] ;Get the word
INC PACKPTR ;Inc pointer twice
BNE :AA
INC PACKPTR+2
:AA INC PACKPTR
BNE :BB
INC PACKPTR+2
:BB RTS ;Exit
*-------------------------------------------------
* The color cycler.
Cycler
lda #$FFFF
sta DoNext
lda VCount
inc
sta VCount
cmp #91
bge :bigger
stz DoNext
:bigger
phb ;Cycle the 15 first colors
pea $E1E1
plb
plb
lda $9E04
sta $9E02
lda $9E06
sta $9E04
lda $9E08
sta $9E06
lda $9E0A
sta $9E08
lda $9E0C
sta $9E0A
lda $9E0E ;move each color down one
sta $9E0C
lda $9E10
sta $9E0E
lda $9E12
sta $9E10
lda $9E14
sta $9E12
lda $9E16
sta $9E14
lda $9E18
sta $9E16
lda $9E1A
sta $9E18
lda $9E1C
sta $9E1A
lda $9E1E
sta $9E1C
plb
lda VCount
cmp #91
blt :smaller
stz VCount
:smaller
lda LastC
stal $E19E1E
lda DoNext
beq :else ;false...
ldy CycleColor
cpy #90*2
blt :ok
ldy #0
:ok lda CycleTable,y
sta LastC
iny
iny
sty CycleColor
stz DoNext
rtl
:else
ldal $E19E02
sta LastC
rtl
Timer da 0
LastC da 0
DoNext da 0
VCount da 0
CycleColor da 0
CycleTable da $F00,$F10,$F20,$F30,$F40,$F50,$F60,$F70,$F80
da $F90,$FA0,$FB0,$FC0,$FD0,$FE0,$FF0,$EF0,$DF0
da $CF0,$BF0,$AF0,$9F0,$8F0,$7F0,$6F0,$5F0,$4F0
da $3F0,$2F0,$1F0,$0F0,$0F1,$0F2,$0F3,$0F4,$0F5
da $0F6,$0F7,$0F8,$0F9,$0FA,$0FB,$0FC,$0FD,$0FE
da $0FF,$0EF,$0DF,$0CF,$0BF,$0AF,$09F,$08F,$07F
da $06F,$05F,$04F,$03F,$02F,$01F,$00F,$10F,$20F
da $30F,$40F,$50F,$60F,$70F,$80F,$90F,$A0F,$B0F
da $C0F,$D0F,$E0F,$F0F,$F0E,$F0D,$F0C,$F0B,$F0A
da $F09,$F08,$F07,$F06,$F05,$F04,$F03,$F02,$F01
* The loader makes a zero-filled 4096 byte buffer here.
* The "filelen" constant is defined in the link file. It
* is the length of the Circles file.
RingBuffer = *+filelen
typ RTL
sav Tunnel.twlt.l

View File

@ -0,0 +1,300 @@
{$Keep 'Tunnel'}
program Tunnels;
uses Common,QuickDrawII;
const
circles=189; {number of times to iterate draw}
LeftArrow=$08;
RightArrow=$15;
UpArrow=$0B;
DownArrow=$0A;
Escape=$1B;
SpaceBar=$20;
type
CirclePosition=record
Xpos:integer; {UL postn of X}
Ypos:integer; {UL Postn of y}
{ LRXPos:integer; Lwr Rt postn of X}
{ LRYPos:integer; Lwr Rt postn of Y}
Color:integer; {Color of this circle}
end;
var
CirclePos:CirclePosition; {see above record}
CRect:rect; {used to define rect for Oval}
TempColors:Packed Array[1..16] of integer; {used to keep track of colors}
LastC:integer; {last color variable}
Table:packed array[1..90] of integer; {table}
TBCol:integer; {keeps track of loc. in table}
DoNext:Boolean; {true/false val of cycle}
VCount:integer; {counter}
waittime:integer; {user set wait time}
quitflag:boolean; {to quit}
ThisCol:integer; {Keep track of which color is next}
Temp1: integer; {Position for R - $x00}
Temp2: integer; {Position for G - $0x0}
Temp3: integer; {Position for B - $00x}
CNum: integer; {Position of TempColors array}
{Each time we need the right hand/bottom side of the circle, we will simply
add a multiple of 2, or the equation
Iteration Number * 2 = New position}
function GetKey: integer; var keyboard, strobe: ^byte;
begin
keyboard:=pointer($00C000); strobe:=pointer($00C010);
getkey:=keyboard^ & $7F;
strobe^:=0;
end;
Procedure InitScreen;
{Sets up the screen for drawing}
begin {InitScreen}
StartGraph(320);
SetPenMode(0);
SetPenSize(1,1);
SetBackColor(0); {Set up background to black}
end; {InitScreen}
Procedure DrawCircles ;
{Draws the circles on the screen... see above for equation for figuring
out which number is which}
var
jz:integer; {loop counter for drawing}
begin {DrawCircles}
for jz:=0 to circles do begin
with Crect do begin
v1:=CirclePos.ypos;
h1:=CirclePos.xpos;
v2:=CirclePos.ypos+(jz*2); {See above equation}
h2:=CirclePos.xpos+(jz*2);
end; {With}
SetSolidPenPat(CirclePos.Color); {Set Pen Color}
FrameOval(Crect); {Draw the oval}
With CirclePos do begin
xpos:=CirclePos.xpos-1;
ypos:=CirclePos.ypos-1;
Color:=CirclePos.Color+1;
end; {With}
If CirclePos.color=16 then CirclePos.color:=1;
end; {for jz}
end; {DrawCircles}
procedure Process;
{process keypresses}
begin {process}
Case GetKey of
LeftArrow:WaitTime:=WaitTime+1;
DownArrow:WaitTime:=WaitTime+20;
RightArrow:WaitTime:=WaitTime-1;
UpArrow:WaitTime:=WaitTime-20;
Escape:Quitflag:=true;
SpaceBar:WaitTime:=800;
otherwise: ;
end; {case getkey of}
end; {process}
procedure Cycle;
var
Colors:integer; {color to be stored}
z:integer; {loop counter}
x:integer; {wait var}
begin {Cycle}
for z:=2 to 15 do begin {Set colors 1-14}
Colors:=GetColorEntry(0,z);
SetColorEntry(0,z-1,Colors); {move colors down}
end; {For z}
If DoNext=true then begin
SetColorEntry(0,15,LastC); {restore last color}
TbCol:=TBCol+1;
If TBCol=91 then TBCol:=1;
LastC:=Table[TBCol]; {get last color}
DoNext:=False; {set to false}
end {IF donext}
else begin
SetColorEntry(0,15,LastC);
LastC:=GetColorEntry(0,1);
end; {Else}
for x:=1 to waittime do begin
end; {For X}
end; {Cycle}
procedure Action;
begin {Action}
ThisCol:=TempColors[CNum]; {set up the color}
Temp1:=ThisCol&$F00;
If Temp1<>0 then temp1:=temp1-1;
Temp2:=ThisCol&$0F0;
If Temp2<>0 then temp2:=temp2-1;
Temp3:=ThisCol&$00F;
if Temp3<>0 then temp3:=temp3-1;
Temp1:=Temp1*$100;
Temp2:=Temp2*$010;
ThisCol:=(Temp1+Temp2+Temp3);
end; {Action}
Procedure Fadeout;
{Fades out screen. Does stupid, simple fadeout by simply ANDing off
a position of the color value ($00F, $0F0, or $F00) and decrementing
it by $001 or $010 or $100.
Check first to see if it's a zero, if it is, continue}
var
OhWaiter: integer; {wait fade counter}
begin {Fadeout}
Cnum:=0;
repeat
Action; {action of the subroutine}
SetColorEntry(0,Cnum,ThisCol);
Cnum:=Cnum+1;
for OhWaiter:=1 to 32700 do begin
end; {for}
until cnum=17;
end; {Fadeout}
{------------------------------------------------------------------------}
begin {MAIN LOOP}
with CirclePos do begin
xpos:=160;
ypos:=100;
{ LRXpos:=160; }
{ LRYPos:=160; }
Color:=1;
end;
Table[1]:=$F00;
Table[2]:=$F10;
Table[3]:=$F20;
Table[4]:=$F30;
Table[5]:=$F40;
Table[6]:=$F50;
Table[7]:=$F60;
Table[8]:=$F70;
Table[9]:=$F80;
TABLE[10]:=$F90;
TABLE[11]:=$FA0;
TABLE[12]:=$FB0;
TABLE[13]:=$FC0;
TABLE[14]:=$FD0;
TABLE[15]:=$FE0;
TABLE[16]:=$FF0;
TABLE[17]:=$EF0;
TABLE[18]:=$DF0;
TABLE[19]:=$CF0;
TABLE[20]:=$BF0;
TABLE[21]:=$AF0;
TABLE[22]:=$9F0;
TABLE[23]:=$8F0;
TABLE[24]:=$7F0;
TABLE[25]:=$6F0;
TABLE[26]:=$5F0;
TABLE[27]:=$4F0;
TABLE[28]:=$3F0;
TABLE[29]:=$2F0;
TABLE[30]:=$1F0;
TABLE[31]:=$0F0;
TABLE[32]:=$0F1;
TABLE[33]:=$0F2;
TABLE[34]:=$0F3;
TABLE[35]:=$0F4;
TABLE[36]:=$0F5;
TABLE[37]:=$0F6;
TABLE[38]:=$0F7;
TABLE[39]:=$0F8;
TABLE[40]:=$0F9;
TABLE[41]:=$0FA;
TABLE[42]:=$0FB;
TABLE[43]:=$0FC;
TABLE[44]:=$0FD;
TABLE[45]:=$0FE;
TABLE[46]:=$0FF;
TABLE[47]:=$0EF;
TABLE[48]:=$0DF;
TABLE[49]:=$0CF;
TABLE[50]:=$0BF;
TABLE[51]:=$0AF;
TABLE[52]:=$09F;
TABLE[53]:=$08F;
TABLE[54]:=$07F;
TABLE[55]:=$06F;
TABLE[56]:=$05F;
TABLE[57]:=$04F;
TABLE[58]:=$03F;
TABLE[59]:=$02F;
TABLE[60]:=$01F;
TABLE[61]:=$00F;
TABLE[62]:=$10F;
TABLE[63]:=$20F;
TABLE[64]:=$30F;
TABLE[65]:=$40F;
TABLE[66]:=$50F;
TABLE[67]:=$60F;
TABLE[68]:=$70F;
TABLE[69]:=$80F;
TABLE[70]:=$90F;
TABLE[71]:=$A0F;
TABLE[72]:=$B0F;
TABLE[73]:=$C0F;
TABLE[74]:=$D0F;
TABLE[75]:=$E0F;
TABLE[76]:=$F0F;
TABLE[77]:=$F0E;
TABLE[78]:=$F0D;
TABLE[79]:=$F0C;
TABLE[80]:=$F0B;
TABLE[81]:=$F0A;
TABLE[82]:=$F09;
TABLE[83]:=$F08;
TABLE[84]:=$F07;
TABLE[85]:=$F06;
TABLE[86]:=$F05;
TABLE[87]:=$F04;
TABLE[88]:=$F03;
TABLE[89]:=$F02;
TABLE[90]:=$F01;
InitScreen; {Start up graphics}
DrawCircles; {Draw the screen}
LastC:=$FFF; {pure white}
TBCol:=1; {table counter}
VCount:=0;
WaitTime:=800; {time to pause during cycle}
Quitflag:=false;
repeat
VCount:=VCount+1; {counter}
DoNext:=True;
if VCount<=90 then DoNext:=False; {indicate we want to cycle}
Cycle; {Cycle the Colors}
If VCount>90 then VCount:=0; {reset counter}
Process;
if Waittime>2700 then waittime:=2699;
if waittime<100 then waittime:=101;
until quitflag=true;
Fadeout;
EndGraph;
End. {Main program}
{Append 'Circles.asm'}

View File

@ -0,0 +1,9 @@
* oldloader
asm old
lnk old.l
typ $BC
sav */system/cdevs/twilight/tester
cmd auxtype */system/cdevs/twilight/tester,$4004

View File

@ -0,0 +1,101 @@
^INITIALLOAD2 MAC
PHS 5
PHWL ]1;]2
PxW ]3;]4
Tool $2011
<<<
PHWL MAC
PHW ]1
PHL ]2
<<<
PXW MAC
DO ]0/1
PHW ]1
DO ]0/2
PHW ]2
DO ]0/3
PHW ]3
DO ]0/4
PHW ]4
FIN
FIN
FIN
FIN
<<<
PHL MAC
IF #=]1
PEA ^]1
ELSE
PHW ]1+2
FIN
PHW ]1
<<<
PHS MAC
DO ]0
LUP ]1
PHA
--^
ELSE
PHA
FIN
<<<
PUSHWORD mac
do ]0=0
pha
else
phw ]1
fin
eom
PHW mac
if #=]1
pea ]1
else
]D = *
lda ]1
do *-]d/3
if MX/2
ds -3
lda ]1+1
pha
lda ]1
fin
pha
else
ds -2
pei ]1
fin
fin
eom
PUSHLONG MAC
IF #=]1
PushWord #^]1
ELSE
PushWord ]1+2
FIN
PushWord ]1
<<<
PULLLONG MAC
DO ]0
PullWord ]1
PullWord ]1+2
ELSE
PullWord
PullWord
FIN
<<<
PULLWORD MAC
PLA
DO ]0
STA ]1
FIN
IF MX/2
PLA
DO ]0
STA ]1+1
FIN
FIN
<<<
TOOL MAC
LDX #]1
JSL $E10000
<<<

View File

@ -0,0 +1,143 @@
*------------------------------------------------*
* *
* Old Loader *
* A T2 blanker by Derek Young, DYA *
* *
* This blanker will load in blankers from *
* Twilight I in the old style and display them. *
*------------------------------------------------*
lst off
xc
xc
mx %00
rel
use old.macs
dum 0
RezFileID da 0
MyID da 0
MemID da 0
progstart adrl 0
dend
dum 1
Bank db 0 ;This is how the stack is set up
rtlAddr adr 0 ;with DP at the top and Result
T2data2 adrl 0 ;occupying the top four bytes
T2data1 adrl 0
T2Message da 0
T2Result adrl 0
T2StackSize adrl 0
dend
*-------------------------------------------------
* start of the blanker...
Start
phb
phk
plb
lda T2Message,s
cmp #2 ;must be BlankT2
bne Bye
lda T2Data1,s
sta MovePtr ;save this in our own DP
lda T2Data1+2,s
sta MovePtr+2
lda T2Data2,s
sta RezFileID
lda T2Data2+2,s ;our memory ID
sta MyID
clc
adc #$100
sta MemID ;need a memory ID
*-------------------------------------------------
* Blank the screen - load the old blanker into
* memory and call its blank function.
* We give the blanker our direct page since there is nothing
* in it that isn't saved. The text in the TextEdit box
* is taken from the setup procedure and is saved in the
* twilight.setup file. The stack looks like this on entry to
* the blanker:
*
* | previous |
* | contents... |
* +----------------+
* | TextPtr (Long) | Pointer to pascal string entered in TextEdit box
* +----------------+
* | MovePtr (Long) | Pointer to the movement flag
* +----------------+
* | MemID (Word) | Blanker's memory ID
* +----------------+
* | RTL (3 bytes) | RTL Address
* +----------------+
* <--- Stack Pointer
*-------------------------------------------------
Blank
~InitialLoad2 MemID;#pathname;#0;#1 ;load in the blanker
PullWord TheirID
PullLong progstart
PullWord dp
pla ;size of DP/stack buffer
bcc :doit
* error! display an error message...
bra Bye
:doit
lda progstart
sta blanker+1
lda progstart+1
sta blanker+1+1
phb ;save everything in case the blanker does
phd ;something it's not supposed to.
php
lda dp
tcd ;give the blanker a DP
PushLong #null ;pointer to text-edit text.
PushLong MovePtr ;pointer to movement flag
PushWord TheirID ;blanker's memory ID
blanker jsl $FFFFFF ;call the blanker!
plp
pld
plb
Bye lda RTLaddr,s ;move up RTL address
sta T2data1+3,s
lda RTLaddr+1,s
sta T2data1+3+1,s
lda #0
sta T2Result,s
sta T2Result+2,s ;the result (nil for no error)
plb ;restore the bank
tsc ;remove the input parameters.
clc
adc #10
tcs
clc
rtl
null str ''
TheirID da 0
dp da 0
MovePtr adrl 0
* pathname strl '/programming/programming/twilight/old/universe'
pathname strl '*:system:cdevs:twilight:njm.fire'
sav old.l

View File

@ -0,0 +1,18 @@
nol ;turn listing off (NO List)
ovr ;always assemble
* Link the tunnel module.
* filelen geq $133F
asm Tunnel.t2.2
lnk Tunnel.twlt.l
lnk Circles2
* lnk CIRCLES ;link in the compressed circles
typ $BC
sav */system/cdevs/twilight/Hypnotist
cmd auxtype */system/cdevs/twilight/Hypnotist,$4004

View File

@ -0,0 +1,194 @@
_TLStartUp MAC
Tool $201
<<<
_TLShutDown MAC
Tool $301
<<<
~MMStartUp MAC
PHA
Tool $202
<<<
~MMShutDown MAC
PHW ]1
Tool $302
<<<
~NewHandle MAC
P2SL ]1
PxW ]2;]3
PHL ]4
Tool $902
<<<
~DisposeAll MAC
PHW ]1
Tool $1102
<<<
~QDStartUp MAC
PxW ]1;]2;]3;]4
Tool $204
<<<
_QDShutDown MAC
Tool $304
<<<
_SetSolidPenPat MAC
Tool $3704
<<<
~FrameOval MAC
PHL ]1
Tool $5804
<<<
_QUIT MAC
DOS16 $29;]1
<<<
DOS16 MAC
JSL $E100A8
DA ]1
ADRL ]2
<<<
PxW MAC
DO ]0/1
PHW ]1
DO ]0/2
PHW ]2
DO ]0/3
PHW ]3
DO ]0/4
PHW ]4
FIN
FIN
FIN
FIN
<<<
P2SL MAC
PHA
PHA
IF #=]1
PEA ^]1
ELSE
PHW ]1+2
FIN
PHW ]1
<<<
PHL MAC
IF #=]1
PEA ^]1
ELSE
PHW ]1+2
FIN
PHW ]1
<<<
PHW MAC
IF #=]1
PEA ]1
ELSE
IF MX/2
LDA ]1+1
PHA
FIN
LDA ]1
PHA
FIN
<<<
PullLong MAC
DO ]0
PullWord ]1
PullWord ]1+2
ELSE
PullWord
PullWord
FIN
<<<
PullWord MAC
PLA
DO ]0
STA ]1
FIN
IF MX/2
PLA
DO ]0
STA ]1+1
FIN
FIN
<<<
Tool MAC
LDX #]1
JSL $E10000
<<<
~SetHeartBeat MAC
PHL ]1
Tool $1203
<<<
~DelHeartBeat MAC
PHL ]1
Tool $1303
<<<
~SetPenPat MAC
PHL ]1
Tool $3004
<<<
~GetPenPat MAC
PHL ]1
Tool $3104
<<<
~InitPort MAC
PHL ]1
Tool $1904
<<<
~SetPort MAC
PHL ]1
Tool $1B04
<<<
~GetPort MAC
PHS 2
Tool $1C04
<<<
PHS MAC
DO ]0
LUP ]1
PHA
--^
ELSE
PHA
FIN
<<<
~OpenPort MAC
PHL ]1
Tool $1804
<<<
_SetMasterSCB MAC
Tool $1604
<<<
~GetMasterSCB MAC
PHA
Tool $1704
<<<
~SetMasterSCB MAC
PHW ]1
Tool $1604
<<<
~ClosePort MAC
PHL ]1
Tool $1A04
<<<
_SendRequest MAC
Tool $1c01
<<<
PUSHLONG MAC
IF #=]1
PushWord #^]1
ELSE
PushWord ]1+2
FIN
PushWord ]1
<<<
PUSHWORD MAC
IF #=]1
PEA ]1
ELSE
IF MX/2
LDA ]1+1
PHA
FIN
LDA ]1
PHA
FIN
<<<

View File

@ -0,0 +1,366 @@
*------------------------------------------------*
* *
* Hypnotist *
* A Twilight II blanker *
* By Derek Young *
* *
* v1.3 *
*------------------------------------------------*
lst off
rel
xc
xc
mx %00
use Tunnel.macs
dum 0
MovePtr adrl 0 ;for twilight
SCREENAD DS 4 ;Pointer
PACKPTR DS 4 ;Address of packed data
LENGTH DS 4 ;Number of bytes to unpack
UNPACKPTR DS 4 ;Address of Unpacked data
RingIndex DS 2 ;Index to ring buffer
Flags DS 2 ;Index to flags
Line1 da 0
Line2 da 0
dend
dum 1
Bank db 0 ;This is how the stack is set up
rtlAddr adr 0 ;with DP at the top and Result
T2data2 adrl 0 ;occupying the top four bytes
T2data1 adrl 0
T2Message da 0
T2Result adrl 0
T2StackSize adrl 0
dend
* The RingBuffer is external. The loader will set aside
* the 4096 bytes needed at the end of the file...
ext Circles
Speed = 16 ;ticks before color change
stopAfterOne = $8000
sendToAll = %00
sendToName = %01
sendToUserID = %10
*-------------------------------------------------
* start of the blanker...
* this is a really simple blanker - no setup or
* anything else besides "T2Blank".
Start
phb
phk
plb
lda T2Message,s
cmp #2 ;must be BlankT2
bne Bye
lda T2Data1,s
sta MovePtr ;save this in our own DP
lda T2Data1+2,s
sta MovePtr+2
*-------------------------------------------------
* The start of the program...
Blank sep $30
lda #0 ;black border - don't need to save it
stal $C034
rep $30
ldx #$8000-2
lda #0
]loop stal $E12000,x
dex
dex
bpl ]loop
jsr MakeCircles
jsr Randomize
lda #Speed
sta Timer
:cycle
jsr WaitVBL
jsr Cycler
lda [MovePtr]
beq :cycle ;wait for an event
Bye lda RTLaddr,s ;move up RTL address
sta T2data1+3,s
lda RTLaddr+1,s
sta T2data1+3+1,s
lda #0
sta T2Result,s
sta T2Result+2,s ;the result (nil for no error)
plb ;restore the bank
tsc ;remove the input parameters.
clc
adc #10
tcs
clc
rtl
WaitVBL
sep $20
]a ldal $E0C019
bmi ]a
]b ldal $E0C019
bpl ]b
rep $20
rts
*-------------------------------------------------
* Draw the huge ring of circles on the screen
* (Actually just unpack the screen. I hated QuickDraw :)
MakeCircles
jsr UnPackIt
* Half the screen has been unpacked - flip it.
phb
pea $E1E1
plb
plb
lda #$2000+16000-160
sta Line1
lda #$2000+16000
sta Line2
:flip
ldy #160-2
]loop lda (Line1),y
sta (Line2),y
dey
dey
bpl ]loop
lda Line2
clc
adc #160
sta Line2
lda Line1
sec
sbc #160
sta Line1
cmp #$2000-160
bne :flip
plb
ldx #32-2
]loop lda Palette,x
stal $E19E00,x
dex
dex
bpl ]loop
brk $00
rts
*Palette da $000,$111,$222,$333,$444,$555,$666,$777
* da $888,$999,$AAA,$BBB,$CCC,$DDD,$EEE,$FFF
Palette da $000,$777,$841,$72C,$00F,$080,$F70,$D00
da $FA9,$FF0,$0E0,$4DF,$DAF,$78F,$CCC,$FFF
*
* Unpack the circles
*
* I'll use the top-secret LZSS decompression request to
* decompress the circles :) This removes a lot of the code
* for the blanker.
*
* datain structure:
* +00 word eorvalue
* +02 long inputpointer
* +06 long outputpointer
* +10 long outputlength
* +14 eos
*
reqDLZSS = $8007
UnPackIt
brk $00
PushWord #reqDLZSS
PushWord #stopAfterOne+sendToName
PushLong #toString
PushLong #dataIn
PushLong #0 ;data out
_SendRequest
rts
toString str 'DYA~Twilight II'
dataIn da 0 ;there is no eor value
adrl Circles2+4 ;input data (skip over length long)
adrl $E12000 ;output data
adrl $8000 ;length of output (16000)
*-------------------------------------------------
* Color cycler - new version.
* Pushes in random colors.
Cycler
ldal $E19E02 ;save this for a second
sta oldcolor
phb ;Cycle the 15 first colors
pea $E1E1
plb
plb
lda $9E04
sta $9E02
lda $9E06
sta $9E04
lda $9E08
sta $9E06
lda $9E0A
sta $9E08
lda $9E0C
sta $9E0A
lda $9E0E ;move each color down one
sta $9E0C
lda $9E10
sta $9E0E
lda $9E12
sta $9E10
lda $9E14
sta $9E12
lda $9E16
sta $9E14
lda $9E18
sta $9E16
lda $9E1A
sta $9E18
lda $9E1C
sta $9E1A
lda $9E1E
sta $9E1C
plb
:dec dec Timer
bne :notnew
lda #Speed
sta Timer
jsr Random
and #$FFF ;make it a color
stal $E19E1E
rts
:notnew lda oldcolor
stal $E19E1E
rts
Timer da 0
oldcolor da 0
*------------------------------------------------*
* Random returns a random number in A *
* Randomize seeds the generator from the clock *
* *
* Adapted from the Merlin 16+ package *
*------------------------------------------------*
Random clc
ldx INDEXI
ldy INDEXJ
lda ARRAY-2,X
adc ARRAY-2,Y
sta ARRAY-2,X
dex
dex
bne :DY
ldx #17*2 ;Cycle index if at end of
:DY dey ; the array
dey
bne :SETIX
ldy #17*2
:SETIX stx INDEXI
sty INDEXJ
rts
INDEXI da 17*2 ;The relative positions of
INDEXJ da 5*2 ; these indexes is crucial
ARRAY da 1,1,2,3,5,8,13,21,54,75,129,204
da 323,527,850,1377,2227
Seed pha
ora #1 ;At least one must be odd
sta ARRAY
stx ARRAY+2
phx ;Push index regs on stack
phy
ldx #30
]LUP sta ARRAY+2,X
dex
dex
lda 1,S ;Was Y
sta ARRAY+2,X
dex
dex
lda 3,S ;Was X
sta ARRAY+2,X
lda 5,S ;Original A
dex
dex
bne ]LUP
lda #17*2
sta INDEXI ;Init proper indexes
lda #5*2 ; into array
sta INDEXJ
jsr Random ;Warm the generator up.
jsr Random
jsr Random
jsr Random
ply
plx
pla
rts
Randomize
pha
pha
ldx #$2503
jsl $E10000
ply
pla
eor #'DY' ;mix X up a bit (it's not as random)
tax
ldal $E0C02E
bra Seed
Circles2 = *
* The "filelen" constant is defined in the link file. It
* is the length of the Circles file.
sav Tunnel.twlt.l