home *** CD-ROM | disk | FTP | other *** search
- *------------------------------------------------------
- *
- * *** Super Magic 320 Demo ***
- *
- * This program is written by Lim Thye Chean to
- * demonstrate the capability of Super Magic 320,
- * the library routines to release the full power of
- * 320 x 200 Super Hires.
- *
- *------------------------------------------------------
-
-
- mcopy sm.macros
-
- copy sm.header
-
-
- *------------------------------------------------------
- *
- * Variables
- *
-
- T1 gequ $0
- T2 gequ $2
-
- GX gequ $10
- GY gequ $12
- SX gequ $14
- SY gequ $16
- OldGX gequ $18
- OldGY gequ $1A
- OldSX gequ $1C
- OldSY gequ $1E
- GXDir gequ $20
- GYDir gequ $22
- SXDir gequ $24
- SYDir gequ $26
- LoveX gequ $30
- LoveY gequ $32
- OldLoveX gequ $34
- OldLoveY gequ $36
- LoveSpd gequ $38
- TextClr gequ $40
- TextCDir gequ $42
- MsgCount gequ $46
- ShineCnt gequ $48
- Palette gequ $4A
-
- *------------------------------------------------------
- *
- * Main Program
- *
-
- Main start
- using MainData
- using SMData
-
- *
- * Initializing data
- *
-
- st2 #150,GX Set up 'G', 'S' and heart shapes
- st2 #102,GY
- st2 #160,SX
- st2 #103,SY
- stz LoveX
- st2 #30,LoveY
- stz LoveSpd
-
- st2 #1,(GXDir,GYDir)
- stz SXDir
- stz SYDir
-
- stz TextCDir
-
- startUp
-
- *
- * Setup stars
- *
-
- ldx #78
- ldy #4
- clc
-
- SS1 tya
- sta StarX,x
- adc #8
- sta StarX-2,x
- adc #8
- tay
-
- lda #0
- sta StarClr,x
- sta StarClr-2,x
-
- lda #3
- sta StarMove,x
- lda #5
- sta StarMove-2,x
-
- lda #25
- sta StarTop,x
- inc a
- sta StarTop-2,x
-
- dex
- dex
- dex
- dex
- bpl SS1
-
- *
- * Introduction screen
- *
-
- setColour #0,#7,#0
-
- stz T1
-
- ldx #6
-
- IS1 inc T1
- setColour #1,T1,#0
-
- dex
- bne IS1
- st2 #65,Y
-
- IS2 setPalette #1,Y Draw background
- inc Y
- lda Y
- cmp #200
- bcc IS2
-
- st2 #65,Y
- st2 #$1111,Colour
- st2 #1,T1
-
- IS3 ldx #0
-
- IS4 plotHorLine #0,#319,Y,Colour
-
- inc Y
- inx
- cpx T1
- bcc IS4
-
- lda Colour
- clc
- adc #$1111
- cmp #$7777
- bcc IS5
-
- lda #$1111
- IS5 sta Colour
-
- inc T1
- lda T1
- cmp #16
- bcc IS3
-
- centrePrint #32,#Intro,#Red,pt='no'
-
- ldy #0
-
- clc
-
- ldx #$D
-
- IS6 delay #30000
-
- tya
- adc #$100
- tay
-
- setColour #0,#7
-
- dex
- bne IS6
-
- delay
-
- *
- * Display title
- *
-
- stz T1
-
- ldx #0
- ldy #11
-
- DT1 delay #30000
-
- cpx #$80
- bcs DT2
- stx RGB
- setColour #1,#1,RGB
-
- DT2 cpx #$90
- bcs DT3
- stx RGB
- setColour #1,#2,RGB
-
- DT3 cpx #$A0
- bcs DT4
- stx RGB
- setColour #1,#3,RGB
-
- DT4 cpx #$B0
- bcs DT5
- stx RGB
- setColour #1,#4,RGB
-
- DT5 cpx #$A0
- bcs DT6
- stx RGB
- setColour #1,#5,RGB
-
- DT6 cpx #$90
- bcs DT7
- stx RGB
- setColour #1,#6,RGB
-
- DT7 txa
- clc
- adc #$10
- tax
-
- dey
- beq PlayMs
- brl DT1
-
- *
- * Play Music
- *
-
- PlayMs startMusicTool Start music tool
-
- loadMusic #Song Load song 'ToolBox'
-
- playMusic #True Play song continuously
-
- *
- * Change Palettes
- *
-
- ldx #100
-
- CS1 cycleRight #1,#1,#6
- delay #18000
-
- dex
- bne CS1
-
- st2 #65,Y
-
- CS2 plotHorLine #0,#319,Y,#Black
- delay #500
-
- inc Y
- lda Y
- cmp #200
- bcc CS2
-
- setAllPalette0
-
- delay
-
- centrePrint #120,#Credit1,#Green,pt='no'
-
- delay
- delay
- delay
-
- centrePrint #150,#Credit2,#Blue,pt='no'
-
- ldx #10
-
- CS3 delay
- dex
- bne CS3
-
- clearScreen
-
- st2 #7,Y
-
- CS4 setPalette #1,Y Set the title message to a palette
- inc Y for fade in/out effect
- lda Y
- cmp #17
- bcc CS4
-
- setColour #2,#4,#$33F Set the name to different palette
- setColour #2,#15,#$F00 to produce shading effect
- setPalette #2,#187
-
- setColour #3,#4,#$66F
- setColour #3,#15,#$F20
- setPalette #3,#188
-
- setColour #4,#4,#$88F
- setColour #4,#15,#$F40
- setPalette #4,#189
-
- setColour #5,#4,#$AAF
- setColour #5,#15,#$F60
- setPalette #5,#190
-
- setColour #6,#4,#$88F
- setColour #6,#15,#$F80
- setPalette #6,#191
-
- setColour #7,#4,#$66F
- setColour #7,#15,#$FA0
- setPalette #7,#192
-
- setColour #8,#4,#$33F
- setColour #8,#15,#$FC0
- setPalette #8,#193
-
- *
- * Draw background
- *
-
- setColour #0,#8,#$F44 Change the colour in standard palette
- setColour #0,#9,#$F88 for the love to shine
- setColour #0,#10,#$F44
-
- setColour #0,#1,#$BF Change the colour in standard palette
- setColour #0,#$D,#$999 for the colour of the stars
-
- st2 #10,ShineCnt
-
- plotHorLine #0,#319,#0,#Blue Draw messge board
- plotHorLine #0,#319,#24,#Blue
-
- plotHorLine #0,#319,#1,#LBlue
- plotHorLine #0,#319,#23,#LBlue
-
- plotHorLine #0,#319,#2,#White
- plotHorLine #0,#319,#22,#White
-
- st2 #Blue,Colour
-
- clearArea #182,#199,pt='no' Draw name bar
- plotVerLine #0,#182,#199,#LBlue
- plotVerLine #319,#182,#199,#LBlue
-
- st2 #22,Y1
- st2 #181,Y2
-
- centrePrint #187,#Name,#White,pt='no',ol='yes'
-
- st2 #200,T1
-
- DB1 shadowOff
-
- eraseShape OldLoveX,OldLoveY,#20,#16,LoveBgrd,pt='no'
-
- jsr RotStar
-
- plotShape LoveX,LoveY,#20,#16,Love,LoveMask,LoveBgrd,pt='no'
-
- shadowOn
-
- jsr ShowLove
- jsr ShowStar
-
- lda KeyBrd
- and #$FF
- cmp #155
- bne DS2
- brl Bye
-
- DS2 jsr MoveLove
- jsr MoveStar
- delay #1400
-
- dec T1
- beq PrintMsg
- brl DB1
-
- *
- * Print message
- *
-
- PrintMsg stz MsgCount
-
- st2 #0,KeyStrb
-
- PM1 stz Colour
-
- clearArea #7,#16,pt='no'
-
- lda MsgCount
- bne P1
- inc MsgCount
-
- ldx #50
-
- Wait jsr Animate
- dex
- bne Wait
-
- gradientFill #1,#GYellow
-
- lda #Msg1
- brl Cycle
-
- P1 cmp #1
- bne P2
- inc MsgCount
-
- gradientFill #1,#GGreen
-
- lda #Msg2
- brl Cycle
-
- P2 cmp #2
- bne P3
- inc MsgCount
-
- gradientFill #1,#GRed
-
- lda #Msg3
- brl Cycle
-
- P3 cmp #3
- bne P4
- inc MsgCount
-
- gradientFill #1,#GGreen
-
- lda #Msg4
- brl Cycle
-
- P4 cmp #4
- bne P5
- inc MsgCount
-
- gradientFill #1,#GRed
-
- lda #Msg5
- brl Cycle
-
- P5 cmp #5
- bne P6
- inc MsgCount
-
- ldy #60
- lda #Msg6
- brl Scroll
-
- P6 cmp #6
- bne P7
- inc MsgCount
-
- ldy #24
- lda #Msg7
- brl Scroll
-
- P7 cmp #7
- bne P8
- inc MsgCount
-
- ldy #88
- lda #Msg8
- brl Scroll
-
- P8 cmp #8
- bne P9
- inc MsgCount
-
- ldy #28
- lda #Msg9
- brl Scroll
-
- P9 stz MsgCount
-
- ldy #36
- lda #Msg10
- brl Scroll
-
- *
- * Colour cycle message
- *
-
- Cycle sta Message
-
- ldx #14
-
- Fade cycleRight #1
- jsr Animate
- dex
- bne Fade
-
- centrePrint #9,Message,#White,pt='no'
-
- ldx #14
-
- C1 cycleLeft #1
- jsr Animate
- dex
- bne C1
-
- ldx #111
-
- Wait1 jsr Animate
- dex
- bne Wait1
-
- ldx #14
-
- C2 cycleRight #1
- jsr Animate
- dex
- bne C2
-
- brl PM1
-
- *
- * Scroll text
- *
-
- Scroll sta Message
-
- gradientFill #1,#GCyan
-
- sty T1
-
- ldx #312
-
- S1 jsr Animate
-
- stx X
- st2 #White,Colour
-
- phx
-
- print X,#9,Message,#White,pt='no',yc='no'
-
- plx
-
- jsr Animate
-
- dex
- dex
- cpx T1
- bcc S2
- brl S1
-
- S2 ldx #85
-
- S3 jsr Animate
- dex
- bne S3
-
- ldx #14
-
- S4 cycleRight #1
- jsr Animate
- dex
- bne S4
-
- brl PM1
-
- end
-
- *------------------------------------------------------
- *
- * Animate stars, GS shapes and heart
- *
-
- Animate start
- using MainData
- using SMData
-
- phx
- phy
-
- shadowOff
-
- eraseShape OldLoveX,OldLoveY,#20,#16,LoveBgrd,pt='no'
- eraseShape OldGX,OldGY,#20,#21,GBackgrd,pt='no'
- eraseShape OldSX,OldSY,#20,#21,pt='no'
-
- jsr RotStar
-
- plotShape SX,SY,#20,#21,S,Smask,pt='no'
- plotShape GX,GY,#20,#21,G,GMask,GBackgrd,pt='no'
- plotShape LoveX,LoveY,#20,#16,Love,LoveMask,LoveBgrd,pt='no'
-
- shadowOn
-
- ShowFullShape GX,GY,#20,#21,pt='no'
- ShowFullShape SX,SY,#20,#21,pt='no'
-
- jsr ShowLove
- jsr ShowStar
-
- jsr MoveGS
- jsr MoveLove
- jsr MoveStar
-
- lda KeyBrd
- and #$FF
- cmp #155
- beq Bye
-
- Done ply
- plx
-
- rts
-
- end
-
- *------------------------------------------------------
- *
- * Quit program
- *
-
- Bye start
-
- st2 #0,KeyStrb
-
- stopMusic Stop the song
- shutDownMusicTool Shut down music tool
-
- shutDown Shut down
-
- end
-
- *------------------------------------------------------
- *
- * Rotate stars
- *
-
- RotStar start
- using MainData
-
- ldx #78
-
- RS1 erasePixelFast "StarX,x","OldStarY,x"
- plotPixel "StarX,x","StarY,x","StarClr,x"
-
- dex
- dex
- bpl RS1
-
- rts
-
- end
-
- *
- * Display stars
- *
-
- ShowStar start
- using MainData
-
- ldx #78
-
- SS1 showPixel "StarX,x","OldStarY,x"
- showPixel "StarX,x","StarY,x"
-
- dex
- dex
- bpl SS1
-
- rts
-
- end
-
- *
- * Move stars
- *
-
- MoveStar start
- using MainData
- using SMData
-
- ldx #78
-
- MS1 lda StarY,x
- sta OldStarY,x
- clc
- adc StarMove,x
- cmp #181
- bcc MS4
-
- ldy #2
- stz T2
-
- random Reposition the stars, and randomize
- bmi MS2 the stars movement
-
- iny
- st2 #4,T2
-
- MS2 tya
- sta StarMove,x
-
- ldy T2
- lda ClrTable,y
- tay
-
- random
- bmi MS3
-
- ldy T2
- lda ClrTable+2,y
- tay
-
- MS3 tya
- sta StarClr,x
-
- lda StarTop,x
-
- MS4 sta StarY,x
- dex
- dex
- bpl MS1
-
- rts
-
- end
-
- *------------------------------------------------------
- *
- * Move GS shape
- *
-
- MoveGS start
- using MainData
-
- MoveG st2 GX,OldGX Move 'G'
- st2 GY,OldGY
-
- lda GXDir
- beq MG1
-
- dec GX
- dec GX
- lda GX
- cmp #4
- bcs MG2
- stz GXDir
- bra MG2
-
- MG1 inc GX
- inc GX
- lda GX
- cmp #300
- bcc MG2
- inc GXDir
-
- MG2 lda GYDir
- beq MG3
-
- dec GY
- dec GY
- lda GY
- cmp #27
- bcs MoveS
- stz GYDir
- bra MoveS
-
- MG3 inc GY
- inc GY
- lda GY
- cmp #160
- bcc MoveS
- inc GYDir
-
- MoveS st2 SX,OldSX Move 'S'
- st2 SY,OldSY
-
- lda SXDir
- beq MS1
-
- dec SX
- dec SX
- lda SX
- cmp #4
- bcs MS2
- stz SXDir
- bra MS2
-
- MS1 inc SX
- inc SX
- lda SX
- cmp #300
- bcc MS2
- inc SXDir
-
- MS2 lda SYDir
- beq MS3
-
- dec SY
- lda SY
- cmp #26
- bcs Done
- stz SYDir
- bra Done
-
- MS3 inc SY
- lda SY
- cmp #160
- bcc Done
- inc SYDir
-
- Done rts
-
- end
-
- *------------------------------------------------------
- *
- * Animate heart
- *
-
- *
- * Show heart
- *
-
- ShowLove start
- using MainData
-
- ShowShape OldLoveX,OldLoveY,#20,#16,pt='no'
- ShowShape LoveX,LoveY,#20,#16,pt='no'
-
- dec ShineCnt
- bne Done
- st2 #10,ShineCnt
-
- cycleLeft #0,#7,#10 Glow the heart
-
- jsr CycName Colour cycle the name
-
- Done rts
-
- end
-
- *
- * Move heart
- *
-
- MoveLove start
- using MainData
-
- st2 LoveX,OldLoveX
- st2 LoveY,OldLoveY
-
- inc LoveX
- inc LoveX
- lda LoveX
- cmp #322
- bcc ML1
- stz LoveX
-
- ML1 clc
- lda LoveY
- adc LoveSpd
- sta LoveY
-
- lda LoveY
- cmp #162
- bcc ML2
-
- lda ShineCnt
- lsr a
- bcs Done
-
- sec
- lda #0
- sbc LoveSpd
- sta LoveSpd
- rts
-
- ML2 lda ShineCnt
- lsr a
- bcs Done
-
- inc LoveSpd
-
- Done rts
-
- end
-
- *------------------------------------------------------
- *
- * Colour cycle the name
- *
-
- CycName start
-
- getColour #2,#15
- pha
-
- ldx #3
-
- CN1 stx Palette
- getColour Palette,#15
- dec Palette
- setColour Palette,#15
-
- inx
- cpx #9
- bcc CN1
-
- pla
- sta RGB
- setColour #8,#15,RGB
-
- rts
-
- end
-
-
- *------------------------------------------------------
- *
- * Main program data
- *
-
- MainData data
-
- Song str 'Music/Toolbox'
-
- Intro dc c'Super Magic Demo',h'00'
- Credit1 dc c'Graphics by Lim Thye Chean',h'00'
- Credit2 dc c'Music (ToolBox) by FTA',h'00'
- Msg1 dc c'Lim Thye Chean, the GS Lover',h'00'
- Msg2 dc c'proudly presents...',h'00'
- Msg3 dc c'SUPER MAGIC 3',h'00'
- Msg4 dc c'Release the power of your GS',h'00'
- Msg5 dc c'Apple II Forever',h'00'
- Msg6 dc c'Introducing Super Magic 3 ',h'00'
- Msg7 dc c'The graphics and animation library ',h'00'
- Msg8 dc c'for the rest of us ',h'00'
- Msg9 dc c'If you like this cool little demo ',h'00'
- Msg10 dc c'You can write one yourself now! ',h'00'
-
- Name dc c'LIM THYE CHEAN (1991)',h'00'
-
- G dc h'000FFFFFFFFFFFFFFE00'
- dc h'00444444444444444FE0'
- dc h'044444444444444444E0'
- dc h'044444444444444444F0'
- dc h'044444444444444444F0'
- dc h'0BBBBF00000000BBBBF0'
- dc h'0BBBBF00000000000000'
- dc h'0BBBBF00000000000000'
- dc h'0BBBBF00000000000000'
- dc h'0EEEEF0000FFFFFFFFF0'
- dc h'0EEEEF0000EEEEEEEEF0'
- dc h'0EEEEF0000EEEEEEEEF0'
- dc h'0EEEEE0000EEEEEEEEF0'
- dc h'02222E000022222222F0'
- dc h'02222E000000002222F0'
- dc h'02222E000000002222F0'
- dc h'022222EEEEEEE22222E0'
- dc h'066666666666666666E0'
- dc h'06666666666666666610'
- dc h'00666666666666666600'
- dc h'00066666666666666000'
-
- GMask dc h'FFF000000000000000FF'
- dc h'FF00000000000000000F'
- dc h'F000000000000000000F'
- dc h'F000000000000000000F'
- dc h'F000000000000000000F'
- dc h'F00000FFFFFFFF00000F'
- dc h'F00000FFFFFFFFFFFFFF'
- dc h'F00000FFFFFFFFFFFFFF'
- dc h'F00000FFFFFFFFFFFFFF'
- dc h'F00000FFFF000000000F'
- dc h'F00000FFFF000000000F'
- dc h'F00000FFFF000000000F'
- dc h'F00000FFFF000000000F'
- dc h'F00000FFFF000000000F'
- dc h'F00000FFFFFFFF00000F'
- dc h'F00000FFFFFFFF00000F'
- dc h'F000000000000000000F'
- dc h'F000000000000000000F'
- dc h'F000000000000000000F'
- dc h'FF0000000000000000FF'
- dc h'FFF00000000000000FFF'
-
- GBackGrd ds 210
-
- S dc h'000FFFFFFFFFFFFFFE00'
- dc h'00444444444444444FE0'
- dc h'044444444444444444E0'
- dc h'044444444444444444F0'
- dc h'044444444444444444F0'
- dc h'0BBBBF00000000BBBBF0'
- dc h'0BBBBE00000000000000'
- dc h'0BBBBB10000000000000'
- dc h'0BBBBBBBBBBBBBBBE100'
- dc h'0EEEEEEEEEEEEEEEEF10'
- dc h'0EEEEEEEEEEEEEEEEEF0'
- dc h'01EEEEEEEEEEEEEEEEE0'
- dc h'001EEEEEEEEEEEEEEEF0'
- dc h'000000000000002222F0'
- dc h'0EEEEE000000002222F0'
- dc h'02222E000000002222F0'
- dc h'022222EEEEEEEE2222F0'
- dc h'066666666666666666F0'
- dc h'066666666666666666E0'
- dc h'00666666666666666600'
- dc h'00066666666666666000'
-
- SMask dc h'FFF000000000000000FF'
- dc h'FF00000000000000000F'
- dc h'F000000000000000000F'
- dc h'F000000000000000000F'
- dc h'F000000000000000000F'
- dc h'F00000FFFFFFFF00000F'
- dc h'F00000FFFFFFFFFFFFFF'
- dc h'F000000FFFFFFFFFFFFF'
- dc h'F00000000000000000FF'
- dc h'F000000000000000000F'
- dc h'F000000000000000000F'
- dc h'F000000000000000000F'
- dc h'FF00000000000000000F'
- dc h'FFFFFFFFFFFFFF00000F'
- dc h'F00000FFFFFFFF00000F'
- dc h'F00000FFFFFFFF00000F'
- dc h'F000000000000000000F'
- dc h'F000000000000000000F'
- dc h'F000000000000000000F'
- dc h'FF0000000000000000FF'
- dc h'FFF00000000000000FFF'
-
- Love dc h'00077770000007777000'
- dc h'07FF777700007FF77770'
- dc h'7F7777777777F7777777'
- dc h'77777777777777777777'
- dc h'77777777777777777777'
- dc h'77777777777777777777'
- dc h'77777777777777777777'
- dc h'77777777777777777777'
- dc h'07777777777777777770'
- dc h'07777777777777777770'
- dc h'00777777777777777700'
- dc h'00077777777777777000'
- dc h'00007777777777770000'
- dc h'00000777777777700000'
- dc h'00000007777770000000'
- dc h'00000000777700000000'
-
- LoveMask dc h'FFF0000FFFFFF0000FFF'
- dc h'F0000000FFFF0000000F'
- dc h'00000000000000000000'
- dc h'00000000000000000000'
- dc h'00000000000000000000'
- dc h'00000000000000000000'
- dc h'00000000000000000000'
- dc h'00000000000000000000'
- dc h'F000000000000000000F'
- dc h'F000000000000000000F'
- dc h'FF0000000000000000FF'
- dc h'FFF00000000000000FFF'
- dc h'FFFF000000000000FFFF'
- dc h'FFFFF0000000000FFFFF'
- dc h'FFFFFFF000000FFFFFFF'
- dc h'FFFFFFFF0000FFFFFFFF'
-
- LoveBGrd ds 160
-
- StarX ds 80
- StarY dc h'61002E0059005100980021003B0058003F007B00'
- dc h'320043008F007100620036008D002C0042005A00'
- dc h'28002300510068009900580084003A0073004100'
- dc h'9900390034005600780090001F00230045006700'
- OldStarY dc h'61002E0059005100980021003B0058003F007B00'
- dc h'320043008F007100620036008D002C0042005A00'
- dc h'28002300510068009900580084003A0073004100'
- dc h'9900390034005600780090001F00230045006700'
- StarTop ds 80
- StarMove ds 80
- StarClr ds 80
-
- ClrTable dc h'4444DDDDFFFF1111'
-
- end
-
- append SM.lib
-