antoine-source/picnicparanoia/picnicsource/SPIDER C.txt
Antoine Vignau 4d4fb6a665 Let's free the code!!
Some old (WIP) disassemblies and my own source code now available online.
2024-07-23 23:38:22 +02:00

693 lines
15 KiB
Plaintext

0010 .LI OFF
0020 TEMP1 .EQ $F0
0030 TEMP2 .EQ $F1
0040 TEMP3 .EQ $F2
0050 SCRPNT1 .EQ $F5
0060 SCRPNT2 .EQ $F7
0070 POINTER1 .EQ $F9
0080 POINTER2 .EQ $FB
0090 POINTER3 .EQ $FD
0100 POINTER4 .EQ $EE
0110 MANX .EQ $FE0
0120 MANXX .EQ $FE1
0130 MANY .EQ $FE2
0140 MANSTATE .EQ $FE4
0150 NEXTSTATE .EQ $FE6
0160 HEIGHT .EQ $FE7
0170 PATINDEX .EQ $FEB
0180 GRAB.FOOD .EQ $FB7
0190 BYFOOD .EQ $FB6
0200 AAMSBYT .EQ $10C0
0210 AALSBYT .EQ $10E0
0220 ANTBYT1 .EQ $1000
0230 ANTBYT2 .EQ $1020
0240 ANTBYT3 .EQ $1040
0250 ANTXOLD .EQ $110B
0260 ANTYOLD .EQ $110C
0270 ANTXXOLD .EQ $110D
0280 ANTX .EQ $1104
0290 ANTY .EQ $1105
0300 ANTXX .EQ $1106
0310 PARALYZE .EQ $FDD
0320 SPIDERX .EQ $FD0
0330 SPIDERY .EQ $FD1
0340 SPIDERNUM .EQ $FD2
0350 SPIDERBYT1 .EQ $4100
0360 SPIDERBYT2 .EQ $4108
0370 SPIDERBYT3 .EQ $4110
0380 SPIDERBYT4 .EQ $4118
0390 K6 .EQ $FCF
0400 INIT.K6 .EQ $FCE
0410 K5 .EQ $FCD
0420 INIT.K5 .EQ $FCC
0430 RANDOM1.Z .EQ $1706
0440 RANDOM2.Z .EQ $1709
0450 K1.Z .EQ $4F0C
0460 ERASE.ANT.Z .EQ $170F
0470 VACATE.ANTS.BLOCKS.Z .EQ $4F06
0480 .OR $6000
0490 .TA $2000
0500 JMP INITIALIZE.SPIDER
0510 JMP SPIDER.MASTER
0520 JMP PLOT.SPIDER
0530 JMP PLOT.WEB
0540 JMP ERASE.WEB
0550 JMP STING.MAN
0560 .BS $06
0570 ERASE.WEB
0580 STY TEMP1
0590 LDA TEMP3
0600 PHA
0610 TYA
0620 ROR
0630 BCS .1
0640 LDA #$2A
0650 BNE .2
0660 .1 LDA #$55
0670 .2 STA TEMP3
0680 .3 TXA
0690 ASL
0700 ASL
0710 ASL
0720 STA TEMP2
0730 LDA #$08
0740 STA HEIGHT
0750 .4 LDY TEMP2
0760 LDA (SCRPNT1),Y
0770 STA POINTER1+1
0780 CLC
0790 ADC #$60
0800 STA POINTER4+1
0810 LDA (SCRPNT2),Y
0820 STA POINTER1
0830 STA POINTER4
0840 LDY TEMP1
0850 LDA TEMP3
0860 STA (POINTER1),Y
0870 STA (POINTER4),Y
0880 INC TEMP2
0890 DEC HEIGHT
0900 BNE .4
0910 PLA
0920 STA TEMP3
0930 RTS
0940 PLOT.WEB
0950 TXA
0960 PHA
0970 ASL
0980 ASL
0990 ASL
1000 STA TEMP3
1010 TYA
1020 PHA
1030 STA TEMP2
1040 LDA #$08
1050 STA HEIGHT
1060 LDX #$00
1070 .1 LDY TEMP3
1080 LDA (SCRPNT1),Y
1090 STA POINTER1+1
1100 CLC
1110 ADC #$60
1120 STA POINTER4+1
1130 LDA (SCRPNT2),Y
1140 STA POINTER1
1150 STA POINTER4
1160 LDA TEMP2
1170 ROR
1180 BCS .2
1190 LDA TABLE80,X
1200 LDY TEMP2
1210 STA (POINTER1),Y
1220 STA (POINTER4),Y
1230 INX
1240 INC TEMP3
1250 DEC HEIGHT
1260 BNE .1
1270 PLA
1280 TAY
1290 PLA
1300 TAX
1310 RTS
1320 .2 LDA TABLE81,X
1330 LDY TEMP2
1340 STA (POINTER1),Y
1350 STA (POINTER4),Y
1360 INX
1370 INC TEMP3
1380 DEC HEIGHT
1390 BNE .1
1400 PLA
1410 TAY
1420 PLA
1430 TAX
1440 RTS
1450 TABLE80 .HS 6B2A3A3A2E2E2A6B
1460 TABLE81 .HS 7755575775755577
1470 STING.MAN
1480 STA PARALYZE
1490 LDA #$00
1500 STA TEMP3
1510 STA GRAB.FOOD
1520 STA BYFOOD
1530 LDX MANSTATE
1540 JSR K1.Z
1550 LDX MANXX
1560 LDA #$10
1570 STA HEIGHT
1580 LDA MANY
1590 STA TEMP2
1600 LDA MANX
1610 STA TEMP1
1620 .1 LDY TEMP2
1630 LDA (SCRPNT1),Y
1640 STA POINTER1+1
1650 LDA (SCRPNT2),Y
1660 STA POINTER1
1670 LDY TEMP1
1680 CPY #$2C
1690 BCS .11
1700 CPY #$04
1710 BCC .12
1720 LDA TABLE74,X
1730 STA (POINTER1),Y
1740 .12 INY
1750 CPY #$2C
1760 BCS .11
1770 CPY #$04
1780 BCC .13
1790 LDA TABLE75,X
1800 STA (POINTER1),Y
1810 .13 INY
1820 CPY #$2C
1830 BCS .11
1840 CPY #$04
1850 BCC .11
1860 LDA TABLE74,X
1870 STA (POINTER1),Y
1880 INC TEMP2
1890 DEC HEIGHT
1900 BNE .1
1910 .11 LDA MANY
1920 AND #$07
1930 BEQ .2
1940 LDA #$03
1950 BNE .3
1960 .2 LDA #$02
1970 .3 STA TEMP1
1980 LDA MANY
1990 LSR
2000 LSR
2010 LSR
2020 TAX
2030 .4 LDA AAMSBYT,X
2040 STA POINTER1+1
2050 LDA AALSBYT,X
2060 STA POINTER1
2070 LDY MANX
2080 LDA #$00
2090 STA (POINTER1),Y
2100 INY
2110 STA (POINTER1),Y
2120 INY
2130 STA (POINTER1),Y
2140 INX
2150 DEC TEMP1
2160 BNE .4
2170 LDA #$16
2180 STA MANX
2190 LDA #$6C
2200 STA MANY
2210 LDA #$02
2220 STA MANXX
2230 LDA #$01
2240 STA MANSTATE
2250 STA NEXTSTATE
2260 LDX #$0D
2270 JSR .5
2280 LDX #$0E
2290 JSR .5
2300 LDX #$0F
2310 .5 LDY #$16
2320 JSR .10
2330 LDY #$17
2340 JSR .10
2350 LDY #$18
2360 .10 LDA AAMSBYT,X
2370 EXT2
2380 STA POINTER1+1
2390 LDA AALSBYT,X
2400 STA POINTER1
2410 LDA (POINTER1),Y
2420 AND #$3F
2430 STA TEMP1
2440 LDA #$01
2450 STA (POINTER1),Y
2460 LDA TEMP1
2470 CMP #$20
2480 BCS .6
2490 CMP #$08
2500 BCS .8
2510 CMP #$03
2520 BEQ .7
2530 RTS
2540 .6 AND #$1F
2550 STY TEMP1
2560 TAY
2570 STY TEMP2
2580 LDA ANTBYT1,Y
2590 AND #$3F
2600 STA ANTXOLD
2610 STA ANTX
2620 LDA ANTBYT2,Y
2630 STA ANTYOLD
2640 STA ANTY
2650 LDA ANTBYT3,Y
2660 STA ANTXXOLD
2670 STA ANTXX
2680 JSR ERASE.ANT.Z
2690 JSR VACATE.ANTS.BLOCKS.Z
2700 LDA #$00
2710 LDY TEMP2
2720 STA ANTBYT1,Y
2730 LDY TEMP1
2740 LDA #$01
2750 STA (POINTER1),Y
2760 RTS
2770 .7 JMP ERASE.WEB
2780 .8 AND #$07
2790 STA TEMP3
2800 JSR ERASE.SPIDER
2810 LDY TEMP3
2820 LDA #$00
2830 STA SPIDERBYT4,Y
2840 RTS
2850 TABLE74 .HS 2A2A2A2A555555
2860 TABLE75 .HS 555555552A2A2A
2870 GET.BLOCK4
2880 STY TEMP1
2890 LDA SPIDERBYT2,Y
2900 TAX
2910 LDA SPIDERBYT1,Y
2920 TAY
2930 LDA AALSBYT,X
2940 STA POINTER3
2950 LDA AAMSBYT,X
2960 STA POINTER3+1
2970 LDA (POINTER3),Y
2980 LDY TEMP1
2990 AND #$BF
3000 RTS
3010 GET.BLOCK6
3020 LDY SPIDERX
3030 LDX SPIDERY
3040 GET.BLOCK5
3050 LDA AALSBYT,X
3060 STA POINTER3
3070 LDA AAMSBYT,X
3080 STA POINTER3+1
3090 LDA (POINTER3),Y
3100 RTS
3110 SET.BLOCK.WEB
3120 JSR GET.BLOCK6
3130 LDA #$03
3140 STA (POINTER3),Y
3150 RTS
3160 SET.BLOCK.VACANT2
3170 JSR GET.BLOCK6
3180 AND #$40
3190 STA (POINTER3),Y
3200 RTS
3210 SET.BLOCK.SPIDER
3220 JSR GET.BLOCK6
3230 AND #$C0
3240 ORA SPIDERNUM
3250 ORA #$08
3260 STA (POINTER3),Y
3270 RTS
3280 RANDOM3
3290 JSR RANDOM1.Z
3300 CMP #$55
3310 BCC .1
3320 CMP #$AA
3330 BCC .2
3340 LDA #$E1
3350 RTS
3360 .1 LDA #$E2
3370 RTS
3380 .2 LDA #$E3
3390 RTS
3400 CREATE.SPIDER
3410 DEC K6
3420 BEQ .7
3430 RTS
3440 .7 LDA INIT.K6
3450 STA K6
3460 LDY #$08
3470 .2 DEY
3480 BPL .1
3490 RTS
3500 .1 LDA SPIDERBYT4,Y
3510 BNE .2
3520 STY TEMP1
3530 JSR RANDOM1.Z
3540 CMP #$C0
3550 BCS .3
3560 CMP #$80
3570 BCS .4
3580 CMP #$40
3590 BCS .5
3600 LDA #$2B
3610 STA SPIDERBYT1,Y
3620 JSR RANDOM2.Z
3630 AND #$1F
3640 CMP #$1A
3650 BCS .6
3660 CMP #$03
3670 BCC .6
3680 STA SPIDERBYT2,Y
3690 JSR GET.BLOCK4
3700 BNE .6
3710 JSR RANDOM3
3720 CLC
3730 ADC #$04
3740 STA SPIDERBYT3,Y
3750 LDA #$80
3760 STA SPIDERBYT4,Y
3770 RTS
3780 .3 LDA #$04
3790 STA SPIDERBYT1,Y
3800 JSR RANDOM2.Z
3810 AND #$1F
3820 CMP #$1A
3830 BCS .6
3840 CMP #$03
3850 BCC .6
3860 STA SPIDERBYT2,Y
3870 JSR GET.BLOCK4
3880 BNE .6
3890 JSR RANDOM3
3900 STA SPIDERBYT3,Y
3910 LDA #$80
3920 STA SPIDERBYT4,Y
3930 .6 RTS
3940 .4 LDA #$03
3950 STA SPIDERBYT2,Y
3960 JSR RANDOM2.Z
3970 AND #$3F
3980 CMP #$2C
3990 BCS .6
4000 CMP #$04
4010 BCC .6
4020 STA SPIDERBYT1,Y
4030 JSR GET.BLOCK4
4040 BNE .6
4050 JSR RANDOM3
4060 CLC
4070 ADC #$02
4080 STA SPIDERBYT3,Y
4090 LDA #$80
4100 STA SPIDERBYT4,Y
4110 RTS
4120 .5 LDA #$19
4130 STA SPIDERBYT2,Y
4140 JSR RANDOM2.Z
4150 AND #$3F
4160 CMP #$2C
4170 BCS .6
4180 CMP #$04
4190 BCC .6
4200 STA SPIDERBYT1,Y
4210 JSR RANDOM3
4220 CLC
4230 ADC #$06
4240 AND #$F7
4250 STA SPIDERBYT3,Y
4260 LDA #$80
4270 STA SPIDERBYT4,Y
4280 RTS
4290 PLOT.SPIDER
4300 LDA #$41
4310 STA POINTER1+1
4320 LDY SPIDERNUM
4330 LDA SPIDERBYT4,Y
4340 BPL .6
4350 LDA SPIDERBYT3,Y
4360 AND #$40
4370 BEQ .1
4380 LDA SPIDERBYT1,Y
4390 STA SPIDERX
4400 ROR
4410 BCS .2
4420 LDA #$C0
4430 BNE .4
4440 .2 LDA #$B0
4450 BNE .4
4460 .1 LDA SPIDERBYT1,Y
4470 STA SPIDERX
4480 ROR
4490 BCS .3
4500 LDA #$C8
4510 BNE .4
4520 .3 LDA #$B8
4530 .4 STA POINTER1
4540 LDA #$08
4550 STA HEIGHT
4560 LDA #$00
4570 STA PATINDEX
4580 LDA SPIDERBYT2,Y
4590 STA SPIDERY
4600 ASL
4610 ASL
4620 ASL
4630 STA TEMP1
4640 .5 LDY TEMP1
4650 LDA (SCRPNT1),Y
4660 STA POINTER2+1
4670 CLC
4680 ADC #$60
4690 STA POINTER4+1
4700 LDA (SCRPNT2),Y
4710 STA POINTER4
4720 STA POINTER2
4730 LDY SPIDERX
4740 LDA (POINTER2),Y
4750 AND #$80
4760 LDY PATINDEX
4770 ORA (POINTER1),Y
4780 LDY SPIDERX
4790 STA (POINTER2),Y
4800 INC PATINDEX
4810 INC TEMP1
4820 DEC HEIGHT
4830 BNE .5
4840 RTS
4850 .6 LDA SPIDERBYT1,Y
4860 STA SPIDERX
4870 ROR
4880 BCS .7
4890 LDA #$D8
4900 BNE .4
4910 .7 LDA #$D0
4920 BNE .4
4930 SPIDER.MASTER
4940 DEC K5
4950 BEQ .1
4960 .2 RTS
4970 .1 LDA INIT.K5
4980 STA K5
4990 JSR CREATE.SPIDER
5000 LDY #$08
5010 .3 DEY
5020 STY SPIDERNUM
5030 BMI .2
5040 LDA SPIDERBYT4,Y
5050 BEQ .3
5060 JSR MOVE.1.SPIDER
5070 LDY SPIDERNUM
5080 BPL .3
5090 MOVE.1.SPIDER
5100 LDA SPIDERBYT1,Y
5110 STA SPIDERX
5120 LDA SPIDERBYT2,Y
5130 STA SPIDERY
5140 LDA SPIDERBYT4,Y
5150 BMI .1
5160 SEC
5170 SBC #$01
5180 STA SPIDERBYT4,Y
5190 BEQ .2
5200 JMP PLOT.SPIDER
5210 .2 LDX SPIDERY
5220 LDY SPIDERX
5230 JMP ERASE.SPIDER
5240 .1 LDA SPIDERBYT3,Y
5250 AND #$40
5260 BEQ .3
5270 LDA SPIDERBYT3,Y
5280 AND #$BF
5290 STA SPIDERBYT3,Y
5300 JMP PLOT.SPIDER
5310 .3 LDX SPIDERY
5320 LDY SPIDERX
5330 JSR GET.BLOCK5
5340 LDY SPIDERNUM
5350 AND #$40
5360 BEQ .4
5370 LDA SPIDERBYT3,Y
5380 AND #$7F
5390 ORA #$20
5400 STA SPIDERBYT3,Y
5410 BPL .5
5420 .4 LDA SPIDERBYT3,Y
5430 BPL .6
5440 JSR RANDOM1.Z
5450 CMP #$18
5460 BCS .7
5470 LDA SPIDERBYT3,Y
5480 AND #$7F
5490 STA SPIDERBYT3,Y
5500 BPL .7
5510 .6 AND #$20
5520 BEQ .5
5530 LDA SPIDERBYT3,Y
5540 ORA #$80
5550 STA SPIDERBYT3,Y
5560 .7 LDA SPIDERBYT3,Y
5570 AND #$DF
5580 STA SPIDERBYT3,Y
5590 .5 LDX SPIDERY
5600 LDA SPIDERBYT3,Y
5610 BPL .8
5620 LDY SPIDERX
5630 JSR PLOT.WEB
5640 JSR SET.BLOCK.WEB
5650 JMP .9
5660 .8 LDY SPIDERX
5670 JSR GET.BLOCK5
5680 AND #$40
5690 BEQ .14
5700 JSR ERASE.SPIDER
5710 JMP .15
5720 .14 JSR ERASE.WEB
5730 .15 JSR SET.BLOCK.VACANT2
5740 .9 LDY SPIDERNUM
5750 EXT1
5760 LDA SPIDERBYT3,Y
5770 AND #$07
5780 TAX
5790 CLC
5800 LDA TABLE90,X
5810 ADC SPIDERX
5820 CMP #$04
5830 BCC .10
5840 CMP #$2C
5850 BCS .10
5860 TAY
5870 LDA TABLE91,X
5880 CLC
5890 ADC SPIDERY
5900 CMP #$1A
5910 BCS .10
5920 CMP #$03
5930 BCC .10
5940 TAX
5950 JSR GET.BLOCK5
5960 STA TEMP1
5970 AND #$BF
5980 BEQ .11
5990 CMP #$03
6000 BEQ .11
6010 CMP #$01
6020 BEQ .12
6030 JSR RANDOM2.Z
6040 AND #$07
6050 LDY SPIDERNUM
6060 STA TEMP1
6070 LDA SPIDERBYT3,Y
6080 AND #$F8
6090 ORA TEMP1
6100 STA SPIDERBYT3,Y
6110 JSR PLOT.SPIDER
6120 JMP SET.BLOCK.SPIDER
6130 .10 LDY SPIDERNUM
6140 LDA #$00
6150 STA SPIDERBYT4,Y
6160 RTS
6170 .11 TYA
6180 LDY SPIDERNUM
6190 STA SPIDERBYT1,Y
6200 TXA
6210 STA SPIDERBYT2,Y
6220 LDA SPIDERBYT3,Y
6230 ORA #$40
6240 STA SPIDERBYT3,Y
6250 JSR PLOT.SPIDER
6260 JMP SET.BLOCK.SPIDER
6270 .12 TYA
6280 LDY SPIDERNUM
6290 STA SPIDERBYT1,Y
6300 STA SPIDERX
6310 TXA
6320 STA SPIDERBYT2,Y
6330 STA SPIDERY
6340 LDA SPIDERBYT3,Y
6350 ORA #$40
6360 STA SPIDERBYT3,Y
6370 LDA #$30
6380 JSR STING.MAN
6390 JSR GET.BLOCK6
6400 CMP #$01
6410 BEQ .13
6420 JSR PLOT.SPIDER
6430 JMP SET.BLOCK.SPIDER
6440 .13 LDY SPIDERX
6450 LDX SPIDERY
6460 JSR ERASE.SPIDER
6470 LDY SPIDERNUM
6480 LDA #$00
6490 STA SPIDERBYT4,Y
6500 RTS
6510 TABLE90 .HS 0001010100FFFFFF
6520 TABLE91 .HS FFFF0001010100FF
6530 INITIALIZE.SPIDER
6540 LDX #$1F
6550 LDA #$00
6560 .1 STA SPIDERBYT1,X
6570 DEX
6580 BPL .1
6590 LDA #$30
6600 STA K5
6610 STA INIT.K5
6620 LDA #$0C
6630 STA K6
6640 STA INIT.K6
6650 RTS
6660 ERASE.SPIDER
6670 STY TEMP1
6680 TXA
6690 ASL
6700 ASL
6710 ASL
6720 STA TEMP2
6730 LDA #$08
6740 STA HEIGHT
6750 .1 LDY TEMP2
6760 LDA (SCRPNT1),Y
6770 STA POINTER1+1
6780 CLC
6790 ADC #$60
6800 STA POINTER4+1
6810 LDA (SCRPNT2),Y
6820 STA POINTER1
6830 STA POINTER4
6840 LDY TEMP1
6850 LDA (POINTER4),Y
6860 STA (POINTER1),Y
6870 INC TEMP2
6880 DEC HEIGHT
6890 BNE .1
6900 .LI ON
6910 RTS
6920 .LI OFF