antoine-source/picnicparanoia/picnice/ANT@@ E.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

437 lines
9.8 KiB
Plaintext

0010 .LI OFF
0020 ANTBYT1 .EQ $1000
0030 ANTBYT2 .EQ $1020
0040 ANTBYT3 .EQ $1040
0050 ANTBYT4 .EQ $1060
0060 DESTBYT1 .EQ $1080
0070 DESTBYT2 .EQ $10A0
0080 AAMSBYT .EQ $10C0
0090 AALSBYT .EQ $10E0
0100 ANTDIR .EQ $E0
0110 ANTMOV1 .EQ $DF
0120 ANTMOV3 .EQ $DE
0130 ANTDEST .EQ $DD
0140 ANTX .EQ $DC
0150 ANTY .EQ $DB
0160 ANTXX .EQ $DA
0170 ANTYY .EQ $D9
0180 ANTNUM .EQ $D8
0190 ANTCOUNT .EQ $D7
0200 ANTORIENT .EQ $D6
0210 ANTXOLD .EQ $D5
0220 ANTYOLD .EQ $D4
0230 ANTXXOLD .EQ $D3
0240 ANTYYOLD .EQ $D2
0250 TEMP1 .EQ $F0
0260 TEMP2 .EQ $F1
0270 TEMP3 .EQ $F2
0280 TEMP5 .EQ $94
0290 TEMPRND .EQ $8B
0300 RNDBYTE1 .EQ $F3
0310 RNDBYTE2 .EQ $F4
0320 SCRPNT1 .EQ $F5
0330 SCRPNT2 .EQ $F7
0340 POINTER1 .EQ $F9
0350 POINTER2 .EQ $FB
0360 POINTER3 .EQ $FD
0370 POINTER4 .EQ $EE
0380 HEIGHT .EQ $ED
0390 PATINDEX .EQ $EC
0400 K1 .EQ $D1
0410 INIT.K1 .EQ $D0
0420 K2 .EQ $CF
0430 INIT.K2 .EQ $CE
0440 COUNT4ANTS .EQ $CD
0450 ANTMOV4 .EQ $CC
0460 MOVE.MEMORY .EQ $7FD7
0470 MAN.INITIALIZE.Z .EQ $4603
0480 WASP.INITIALIZE.Z .EQ $5803
0490 MOVE.4.ANTS.Z .EQ $10E3
0500 SPIDER.INITIALIZE.Z .EQ $6000
0510 FOOD.INITIALIZE.Z .EQ $6950
0520 .OR $1700
0530 JMP SET.BLOCK.VACANT
0540 JMP PLOT.ANT.4
0550 JMP RANDOM1
0560 JMP RANDOM2
0570 JMP PLOT.ANT.2
0580 JMP ERASE.ANT
0590 JMP PLOT.ANT
0600 JMP GET.BLOCK
0610 JMP SET.BLOCK.ANT
0620 JMP PICK.DEST2
0630 JMP CREATE.ANT
0640 GET.BLOCK
0650 LDY ANTX
0660 LDA ANTY
0670 LSR
0680 LSR
0690 LSR
0700 TAX
0710 LDA AALSBYT,X
0720 STA POINTER3
0730 LDA AAMSBYT,X
0740 STA POINTER3+1
0750 LDA (POINTER3),Y
0760 RTS
0770 SET.BLOCK.VACANT
0780 JSR GET.BLOCK
0790 AND #$C0
0800 STA (POINTER3),Y
0810 RTS
0820 SET.BLOCK.ANT
0830 JSR GET.BLOCK
0840 AND #$C0
0850 ORA #$20
0860 ORA ANTNUM
0870 STA (POINTER3),Y
0880 RTS
0890 PLOT.ANT
0900 LDA ANTDIR
0910 BEQ PLOT.ANT.2
0920 BPL .2
0930 ROL
0940 BMI .3
0950 LDA #$20
0960 BNE PLOT.ANT.2
0970 .2 LDA #$60
0980 BNE PLOT.ANT.2
0990 .3 LDA #$40
1000 PLOT.ANT.2
1010 LDY #$08
1020 STY POINTER1+1
1030 LDY ANTORIENT
1040 BPL PLOT.ANT.3
1050 CLC
1060 ADC #$10
1070 PLOT.ANT.3
1080 STA POINTER1
1090 PLOT.ANT.4
1100 LDX ANTXX
1110 LDA #$08
1120 STA HEIGHT
1130 LDA #$00
1140 STA PATINDEX
1150 .11 LDY ANTY
1160 LDA (SCRPNT1),Y
1170 STA POINTER2+1
1180 LDA (SCRPNT2),Y
1190 STA POINTER2
1200 LDY ANTX
1210 CPY #$2C
1220 BCS .7
1230 CPY #$04
1240 BCC .7
1250 LDA (POINTER2),Y
1260 STA TEMP1
1270 LDY PATINDEX
1280 LDA (POINTER1),Y
1290 STA TEMP2
1300 INY
1310 LDA (POINTER1),Y
1320 LDY TABLE2,X
1330 BEQ .6
1340 .5 SEC
1350 ROL
1360 ASL TEMP2
1370 DEY
1380 BNE .5
1390 .6 ORA #$80
1400 AND TEMP1
1410 STA TEMP1
1420 LDA TEMP2
1430 AND #$7F
1440 ORA TEMP1
1450 LDY ANTX
1460 STA (POINTER2),Y
1470 .7 INY
1480 CPY #$2C
1490 BCS .10
1500 CPY #$04
1510 BCC .10
1520 LDA (POINTER2),Y
1530 STA TEMP1
1540 LDY PATINDEX
1550 LDA (POINTER1),Y
1560 STA TEMP2
1570 INY
1580 LDA (POINTER1),Y
1590 LDY TABLE4,X
1600 .8 SEC
1610 ROR
1620 LSR TEMP2
1630 DEY
1640 BNE .8
1650 AND TEMP1
1660 STA TEMP1
1670 LDA TEMP2
1680 AND #$7F
1690 ORA TEMP1
1700 LDY ANTX
1710 INY
1720 STA (POINTER2),Y
1730 .10 INC ANTY
1740 INC PATINDEX
1750 INC PATINDEX
1760 DEC HEIGHT
1770 BNE .11
1780 LDA ANTY
1790 SEC
1800 SBC #$08
1810 STA ANTY
1820 RTS
1830 ERASE.ANT
1840 LDA #$08
1850 STA HEIGHT
1860 LDX ANTXXOLD
1870 .3 LDY ANTYOLD
1880 LDA (SCRPNT1),Y
1890 STA POINTER3+1
1900 CLC
1910 ADC #$60
1920 STA POINTER4+1
1930 LDA (SCRPNT2),Y
1940 STA POINTER3
1950 STA POINTER4
1960 LDY ANTXOLD
1970 CPY #$2C
1980 BCS .1
1990 CPY #$04
2000 BCC .1
2010 LDA (POINTER3),Y
2020 AND TABLE1,X
2030 STA TEMP5
2040 LDA TABLE1,X
2050 EOR #$FF
2060 AND (POINTER4),Y
2070 ORA TEMP5
2080 STA (POINTER3),Y
2090 .1 INY
2100 CPY #$2C
2110 BCS .2
2120 CPY #$04
2130 BCC .2
2140 LDA (POINTER3),Y
2150 AND TABLE3,X
2160 STA TEMP5
2170 LDA TABLE3,X
2180 EOR #$FF
2190 AND (POINTER4),Y
2200 ORA TEMP5
2210 STA (POINTER3),Y
2220 .2 INC ANTYOLD
2230 DEC HEIGHT
2240 BNE .3
2250 RTS
2260 CREATE.ANT
2270 DEC K2
2280 BEQ .1
2290 .3 RTS
2300 .1 LDA INIT.K2
2310 STA K2
2320 LDY #$20
2330 .2 DEY
2340 BMI .3
2350 LDA ANTBYT1,Y
2360 BNE .2
2370 JSR PICK.DEST
2380 JSR RANDOM2
2390 CMP #$C0
2400 BCS .9
2410 CMP #$80
2420 BCS .10
2430 CMP #$40
2440 BCS .11
2450 LDA #$03
2460 STA ANTBYT3,Y
2470 LDA #$EB
2480 STA ANTBYT1,Y
2490 LDA #$2B
2500 STA TEMP2
2510 BNE .12
2520 .9 LDA #$01
2530 STA ANTBYT3,Y
2540 LDA #$43
2550 STA ANTBYT1,Y
2560 LDA #$04
2570 STA TEMP2
2580 BNE .12
2590 .10 LDA #$D0
2600 STA ANTBYT2,Y
2610 JSR PICKX
2620 STA TEMP2
2630 STA ANTBYT1,Y
2640 ROR
2650 LDA #$00
2660 BCS .15
2670 LDA #$04
2680 .15 STA ANTBYT3,Y
2690 LDA #$1A
2700 BNE .16
2710 .11 LDA #$10
2720 STA ANTBYT2,Y
2730 JSR PICKX
2740 STA TEMP2
2750 ORA #$80
2760 STA ANTBYT1,Y
2770 ROR
2780 LDA #$00
2790 BCS .17
2800 LDA #$04
2810 .17 STA ANTBYT3,Y
2820 LDA #$02
2830 BNE .16
2840 .12 JSR RANDOM2
2850 CMP #$C0
2860 BCS .18
2870 CMP #$20
2880 BCS .13
2890 .18 JSR RANDOM1
2900 CMP #$C0
2910 BCS .12
2920 CMP #$20
2930 BCC .12
2940 LDA #$48
2950 BNE .13
2960 JMP MOVE.MEMORY
2970 .13 AND #$F8
2980 STA ANTBYT2,Y
2990 LSR
3000 LSR
3010 LSR
3020 .16 TAX
3030 LDA AAMSBYT,X
3040 STA POINTER1+1
3050 LDA AALSBYT,X
3060 STA POINTER1
3070 STY TEMP1
3080 LDY TEMP2
3090 LDA (POINTER1),Y
3100 AND #$BF
3110 BEQ .14
3120 LDY TEMP1
3130 LDA #$00
3140 STA ANTBYT1,Y
3150 RTS
3160 .14 LDA TEMP1
3170 ORA #$20
3180 ORA (POINTER1),Y
3190 STA (POINTER1),Y
3200 RTS
3210 PICKX
3220 JSR RANDOM2
3230 AND #$3F
3240 CLC
3250 ADC #$05
3260 CMP #$2B
3270 BCC .1
3280 JSR RANDOM1
3290 AND #$3F
3300 CLC
3310 ADC #$05
3320 CMP #$2B
3330 BCS PICKX
3340 .1 RTS
3350 RANDOM1
3360 STX TEMPRND
3370 LDA #$20
3380 TAX
3390 BIT RNDBYTE1
3400 BVC .1
3410 BEQ .5
3420 INX
3430 .1 BEQ .2
3440 .5 INX
3450 .2 LDA #$08
3460 BIT RNDBYTE1
3470 BEQ .3
3480 INX
3490 .3 LDA #$01
3500 BIT RNDBYTE1
3510 BEQ .4
3520 INX
3530 .4 TXA
3540 ROR
3550 ROR RNDBYTE1
3560 LDX TEMPRND
3570 LDA RNDBYTE1
3580 RTS
3590 PICK.DEST
3600 JSR RANDOM1
3610 AND #$1F
3620 CMP #$1C
3630 BCC .1
3640 JSR RANDOM2
3650 AND #$1F
3660 CMP #$1C
3670 BCS PICK.DEST
3680 .1 TAX
3690 PICK.DEST2
3700 LDA #$01
3710 STA TEMP3
3720 .8 LDA DESTBYT1,X
3730 BMI .7
3740 .20 INX
3750 INX
3760 INX
3770 CPX #$1C
3780 BCC .8
3790 JSR RANDOM1
3800 AND #$03
3810 TAX
3820 BPL .8
3830 .7 AND #$40
3840 BEQ .19
3850 DEC TEMP3
3860 BPL .20
3870 .19 TXA
3880 ORA #$20
3890 STA ANTBYT4,Y
3900 RTS
3910 TABLEDEST1 .HS 8E8E8E8E919293949B9C9DA0A0A08F8F8F9293949B9C9D9EA1A1A1A1
3920 TABLEDEST2 .HS 444C545C505450545054504C545C88909894909490949094889098A0
3930 TABLE1 .HS 80838FBF81879F
3940 TABLE2 .HS 00020406010305
3950 TABLE3 .HS FEF8E080FCF0C0
3960 TABLE4 .HS 07050301060402
3970 TABLE8 .HS 2020202000000000000000B0B0B0A0A0A01010101010101030303030
3980 .LI ON
3990 TABLE9 .HS 01010101000100010001000000000000000100010001000100000000
4000 .LI OFF
4010 .OR $1080
4020 .HS 8E8E8E8E919293949B9C9DA0A0A08F8F8F9293949B9C9D9EA1A1A1A1
4030 .OR $10A0
4040 .HS 444C545C505450545054504C545C88909894909490949094889098A0
4050 .OR $10C0
4060 .HS 1A1A1A1B1B1B1B1B1C1C1C1C1C1D1D1D1D1D1D1E1E1E1E1E1F1F1F1F1F
4070 .OR $10E0
4080 .HS 90C0F0205080B0E0104070A0D000306090C0F0205080B0E0104070A0D0
4090 .OR $5E8A
4100 .TA $1E8A
4110 RANDOM2
4120 STX TEMPRND
4130 LDA #$20
4140 TAX
4150 BIT RNDBYTE2
4160 BVC .1
4170 BEQ .5
4180 INX
4190 .1 BEQ .2
4200 .5 INX
4210 .2 LDA #$08
4220 BIT RNDBYTE2
4230 BEQ .3
4240 INX
4250 .3 LDA #$01
4260 BIT RNDBYTE2
4270 BEQ .4
4280 INX
4290 .4 TXA
4300 ROR
4310 ROR RNDBYTE2
4320 LDX TEMPRND
4330 LDA RNDBYTE2
4340 .LI ON
4350 RTS
4360 .LI OFF