antoine-source/picnicparanoia/picnicsource/HFOOD 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

730 lines
17 KiB
Plaintext

0010 .LI OFF
0020 TEMP1 .EQ $F0
0030 TEMP2 .EQ $F1
0040 TEMP3 .EQ $F2
0050 TEMP4 .EQ $FF
0060 SCRPNT1 .EQ $F5
0070 SCRPNT2 .EQ $F7
0080 POINTER1 .EQ $F9
0090 POINTER2 .EQ $FB
0100 POINTER3 .EQ $FD
0110 POINTER4 .EQ $EE
0120 HEIGHT .EQ $FE7
0130 PATINDEX .EQ $FEB
0140 AAMSBYT .EQ $10C0
0150 AALSBYT .EQ $10E0
0160 ANTBYT1 .EQ $1000
0170 ANTBYT2 .EQ $1020
0180 ANTBYT3 .EQ $1040
0190 ANTBYT4 .EQ $1060
0200 ANTXOLD .EQ $110B
0210 ANTYOLD .EQ $110C
0220 ANTXXOLD .EQ $110D
0230 ANTX .EQ $1104
0240 ANTY .EQ $1105
0250 ANTXX .EQ $1106
0260 ANTNUM .EQ $1108
0270 DESTBYT1 .EQ $1080
0280 DESTBYT2 .EQ $10A0
0290 K8 .EQ $FB8
0300 INIT.K8 .EQ $FB9
0310 FOODNUM .EQ $FBB
0320 FOODX .EQ $FBC
0330 FOODY .EQ $FBD
0340 FOODBYT1 .EQ $6920
0350 FOODBYT2 .EQ $6928
0360 FOODBYT3 .EQ $6930
0370 ANTHOLD .EQ $6938
0380 BYTE3 .EQ $FBE
0390 WIDTH .EQ $FBF
0400 FOODHEIGHT .EQ $FC0
0410 SWAT .EQ $FE8
0420 MANDIR .EQ $FE3
0430 GRAB.FOOD .EQ $FB7
0440 BYFOOD .EQ $FB6
0450 MANSTATE .EQ $FE4
0460 MANXX .EQ $FE1
0470 SPIDERBYT4 .EQ $4118
0480 ANTPOSITIONS .EQ $6940
0490 ANTPOS .EQ $FC1
0500 ORIENT .EQ $FC2
0510 ANT.ORIENTATIONS .EQ $6948
0520 ORIENT7 .EQ $FC7
0530 STING.MAN.Z .EQ $600F
0540 ERASE.ANT.Z .EQ $170F
0550 PLOT.ANT3.Z .EQ $1703
0560 VERT.FOOD.Z .EQ $7100
0570 VERT.FOOD2.Z .EQ $7103
0580 VACATE.ANTS.BLOCKS.Z .EQ $4F06
0590 .OR $6950
0600 .TA $1950
0610 JMP FOOD.INITIALIZE
0620 JMP MASTER.FOOD
0630 JMP UPDATE.HORIZ.DESTBYTS2
0640 JMP PLOT.FOOD
0650 JMP CHKBLK
0660 JMP SET.OFF.SCREEN
0670 JMP PLOT.FOOD2
0680 .BS $06
0690 PLOT.FOOD
0700 LDX FOODNUM
0710 PLOT.FOOD2
0720 LDA TABLE100,X
0730 STA POINTER1+1
0740 LDA FOODX
0750 LSR
0760 BCS .1
0770 LDA TABLE101,X
0780 BCC .2
0790 .1 LDA TABLE102,X
0800 .2 STA POINTER1
0810 LDA TABLE103,X
0820 STA FOODHEIGHT
0830 LDA TABLE104,X
0840 STA WIDTH
0850 LDA #$00
0860 STA PATINDEX
0870 LDA FOODY
0880 ASL
0890 ASL
0900 ASL
0910 STA TEMP1
0920 .3 LDA WIDTH
0930 STA TEMP2
0940 LDA FOODX
0950 STA TEMP3
0960 LDY TEMP1
0970 LDA (SCRPNT1),Y
0980 STA POINTER3+1
0990 CLC
1000 ADC #$60
1010 STA POINTER4+1
1020 LDA (SCRPNT2),Y
1030 STA POINTER3
1040 STA POINTER4
1050 .4 LDY PATINDEX
1060 LDA (POINTER1),Y
1070 LDY TEMP3
1080 CPY #$2C
1090 BCS .5
1100 CPY #$04
1110 BCC .5
1120 STA (POINTER3),Y
1130 STA (POINTER4),Y
1140 .5 INC PATINDEX
1150 INC TEMP3
1160 DEC TEMP2
1170 BNE .4
1180 INC TEMP1
1190 DEC FOODHEIGHT
1200 BNE .3
1210 RTS
1220 CHKBLK
1230 LDA AAMSBYT,X
1240 STA POINTER2+1
1250 LDA AALSBYT,X
1260 STA POINTER2
1270 LDA (POINTER2),Y
1280 CMP #$01
1290 BNE .1
1300 LDA FOODNUM
1310 ORA #$10
1320 STA (POINTER2),Y
1330 LDA #$01
1340 JMP STING.MAN.Z
1350 .1 AND #$20
1360 BEQ .2
1370 LDA (POINTER2),Y
1380 AND #$1F
1390 STY TEMP3
1400 TAY
1410 LDA ANTBYT1,Y
1420 AND #$3F
1430 STA ANTX
1440 STA ANTXOLD
1450 LDA ANTBYT3,Y
1460 STA ANTXX
1470 STA ANTXXOLD
1480 LDA ANTBYT2,Y
1490 STA ANTY
1500 STA ANTYOLD
1510 LDA #$00
1520 STA ANTBYT1,Y
1530 JSR ERASE.ANT.Z
1540 JSR VACATE.ANTS.BLOCKS.Z
1550 LDY TEMP3
1560 LDA (POINTER2),Y
1570 AND #$C0
1580 ORA #$10
1590 ORA FOODNUM
1600 STA (POINTER2),Y
1610 RTS
1620 .2 LDA (POINTER2),Y
1630 AND #$08
1640 BEQ .3
1650 LDA (POINTER2),Y
1660 AND #$07
1670 TAX
1680 LDA #$00
1690 STA SPIDERBYT4,X
1700 .3 LDA (POINTER2),Y
1710 AND #$C0
1720 ORA #$10
1730 ORA FOODNUM
1740 STA (POINTER2),Y
1750 RTS
1760 HORIZ.FOOD
1770 LDA BYTE3
1780 BMI .1
1790 RTS
1800 .1 LDX FOODNUM
1810 LDY TABLE122,X
1820 LDA TABLE105,X
1830 STA TEMP1
1840 LDA TABLE107,X
1850 HORIZ.FOOD2
1860 STA TEMP2
1870 LDA TABLE106,X
1880 TAX
1890 LDA #$00
1900 STA TEMP3
1910 .3 LDA DESTBYT1,X
1920 AND #$40
1930 STA ANTHOLD,Y
1940 BEQ .2
1950 INC TEMP3
1960 .2 DEY
1970 DEX
1980 CPX TEMP1
1990 BNE .3
2000 LDY TEMP3
2010 CPY TEMP2
2020 BCS .4
2030 JSR PLOT.VERT.ANTS
2040 LDA BYTE3
2050 AND #$FD
2060 LDX FOODNUM
2070 STA FOODBYT3,X
2080 LSR
2090 BCC .5
2100 RTS
2110 .5 JMP PLOT.FOOD
2120 .4 INC ORIENT
2130 LDA ORIENT
2140 LDX FOODNUM
2150 STA ANT.ORIENTATIONS,X
2160 LDA BYTE3
2170 AND #$80
2180 ORA #$02
2190 STA BYTE3
2200 STA FOODBYT3,X
2210 JSR ERASE.VERT.ANTS
2220 LDX ANTPOS
2230 DEX
2240 BPL .6
2250 LDX #$07
2260 .6 STX ANTPOS
2270 JSR UPDATE.VERT.ANTBYTS
2280 LDY FOODNUM
2290 LDA ANTPOS
2300 STA ANTPOSITIONS,Y
2310 BEQ .7
2320 CMP #$04
2330 BEQ .7
2340 JSR PLOT.VERT.ANTS
2350 JMP PLOT.FOOD
2360 .7 JSR UPDATE.HORIZ.DESTBYTS
2370 LDA FOODX
2380 CLC
2390 ADC TABLE114,X
2400 STA FOODX
2410 STA FOODBYT1,X
2420 CLC
2430 ADC TABLE113,X
2440 STA TEMP4
2450 TAY
2460 LDX FOODY
2470 JSR CHKBLK
2480 LDX FOODY
2490 INX
2500 LDY TEMP4
2510 JSR CHKBLK
2520 LDX FOODY
2530 INX
2540 INX
2550 LDY TEMP4
2560 JSR CHKBLK
2570 LDA FOODNUM
2580 EXT1
2590 CMP #$03
2600 BEQ .18
2610 CMP #$04
2620 BEQ .18
2630 LDX FOODY
2640 INX
2650 INX
2660 INX
2670 LDY TEMP4
2680 JSR CHKBLK
2690 .18 JSR MOVE.VERT.ANTS.BLOCKS
2700 JSR PLOT.FOOD
2710 LDX FOODNUM
2720 LDA FOODX
2730 CLC
2740 ADC TABLE120,X
2750 STA TEMP3
2760 TAY
2770 LSR
2780 BCS .13
2790 LDA #$AA
2800 BNE .14
2810 .13 LDA #$D5
2820 .14 CPY #$05
2830 BCC .17
2840 CPY #$2B
2850 BCS .17
2860 CPY #$0B
2870 BCC .15
2880 CPY #$25
2890 BCC .17
2900 .15 AND #$7F
2910 .17 STA TEMP1
2920 LDA FOODY
2930 ASL
2940 ASL
2950 ASL
2960 STA TEMP2
2970 LDA TABLE103,X
2980 STA HEIGHT
2990 .16 LDY TEMP2
3000 LDA (SCRPNT1),Y
3010 STA POINTER1+1
3020 CLC
3030 ADC #$60
3040 STA POINTER4+1
3050 LDA (SCRPNT2),Y
3060 STA POINTER1
3070 STA POINTER4
3080 LDY TEMP3
3090 LDA TEMP1
3100 STA (POINTER1),Y
3110 STA (POINTER4),Y
3120 INC TEMP2
3130 DEC HEIGHT
3140 BNE .16
3150 JSR PLOT.VERT.ANTS
3160 LDX FOODNUM
3170 LDA TABLE116,X
3180 CMP FOODX
3190 BEQ .19
3200 RTS
3210 .19 LDY #$01
3220 LDX #$2C
3230 LDA #$03
3240 STA WIDTH
3250 LDA #$00
3260 .20 STA $1C10,Y
3270 STA $1C40,Y
3280 STA $1C40,X
3290 STA $1C70,Y
3300 STA $1C70,X
3310 STA $1CA0,Y
3320 STA $1CA0,X
3330 STA $1DC0,Y
3340 STA $1DC0,X
3350 STA $1DF0,Y
3360 STA $1DF0,X
3370 STA $1E20,Y
3380 STA $1E20,X
3390 STA $1E50,X
3400 INY
3410 INX
3420 DEC WIDTH
3430 BNE .20
3440 SET.OFF.SCREEN
3450 LDX FOODNUM
3460 LDY TABLE118,X
3470 STY TEMP3
3480 LDA TABLE117,X
3490 STA TEMP1
3500 LDA #$00
3510 STA FOODBYT3,X
3520 .2 LDX FOODNUM
3530 LDA DESTBYT1,Y
3540 STA TEMP2
3550 LDA TABLE119,X
3560 STA DESTBYT1,Y
3570 LDA TEMP2
3580 AND #$40
3590 BEQ .1
3600 LDX TABLE129,Y
3610 LDA TABLE130,Y
3620 TAY
3630 LDA AAMSBYT,X
3640 STA POINTER1+1
3650 LDA AALSBYT,X
3660 STA POINTER1
3670 LDA (POINTER1),Y
3680 AND #$1F
3690 TAY
3700 LDA ANTBYT4,Y
3710 AND #$7F
3720 STA ANTBYT4,Y
3730 .1 INC TEMP3
3740 LDY TEMP3
3750 CPY TEMP1
3760 BNE .2
3770 RTS
3780 PLOT.VERT.ANTS
3790 LDA #$42
3800 STA POINTER1+1
3810 LDX FOODNUM
3820 LDA TABLE108,X
3830 STA POINTER1
3840 LDA ORIENT
3850 AND #$01
3860 BEQ .8
3870 LDA #$08
3880 CLC
3890 ADC POINTER1
3900 STA POINTER1
3910 .8 LDA TABLE109,X
3920 CLC
3930 ADC ANTPOS
3940 TAX
3950 LDA TABLE111,X
3960 STA ANTXX
3970 LDA TABLE110,X
3980 CLC
3990 ADC FOODX
4000 STA ANTX
4010 LDX FOODNUM
4020 LDA TABLE112,X
4030 STA ANTY
4040 LDY #$00
4050 LDA ANTHOLD,Y
4060 BEQ .3
4070 JSR PLOT.ANT3.Z
4080 .3 LDA ANTY
4090 CLC
4100 ADC #$08
4110 STA ANTY
4120 LDY #$01
4130 LDA ANTHOLD,Y
4140 BEQ .4
4150 JSR PLOT.ANT3.Z
4160 .4 LDA ANTY
4170 CLC
4180 ADC #$08
4190 STA ANTY
4200 LDY #$02
4210 LDA ANTHOLD,Y
4220 BEQ .5
4230 JSR PLOT.ANT3.Z
4240 .5 LDA FOODNUM
4250 BEQ .6
4260 CMP #$07
4270 BEQ .6
4280 .7 RTS
4290 .6 LDA ANTY
4300 CLC
4310 ADC #$08
4320 STA ANTY
4330 LDY #$03
4340 LDA ANTHOLD,Y
4350 BEQ .7
4360 JMP PLOT.ANT3.Z
4370 ERASE.VERT.ANTS
4380 LDX FOODNUM
4390 LDA TABLE109,X
4400 CLC
4410 ADC ANTPOS
4420 TAX
4430 LDA TABLE111,X
4440 STA ANTXXOLD
4450 LDA TABLE110,X
4460 CLC
4470 ADC FOODX
4480 STA ANTXOLD
4490 LDX FOODNUM
4500 LDA TABLE112,X
4510 STA ANTYOLD
4520 LDY #$00
4530 LDA ANTHOLD,Y
4540 BEQ .3
4550 JSR ERASE.ANT.Z
4560 BEQ .10
4570 .3 LDA ANTYOLD
4580 CLC
4590 ADC #$08
4600 STA ANTYOLD
4610 .10 LDY #$01
4620 LDA ANTHOLD,Y
4630 BEQ .4
4640 JSR ERASE.ANT.Z
4650 BEQ .8
4660 .4 LDA ANTYOLD
4670 CLC
4680 ADC #$08
4690 STA ANTYOLD
4700 .8 LDY #$02
4710 LDA ANTHOLD,Y
4720 BEQ .1
4730 JSR ERASE.ANT.Z
4740 BEQ .5
4750 .1 LDA ANTYOLD
4760 CLC
4770 ADC #$08
4780 STA ANTYOLD
4790 .5 LDA FOODNUM
4800 BEQ .6
4810 CMP #$07
4820 BEQ .6
4830 .7 RTS
4840 .6 LDY #$03
4850 LDA ANTHOLD,Y
4860 BEQ .7
4870 JMP ERASE.ANT.Z
4880 MOVE.VERT.ANTS.BLOCKS
4890 LDX FOODNUM
4900 LDA FOODX
4910 CLC
4920 ADC TABLE128,X
4930 STA TEMP4
4940 LDA TABLE122,X
4950 STA TEMP1
4960 CLC
4970 ADC FOODY
4980 STA TEMP2
4990 .3 LDX TEMP1
5000 LDA ANTHOLD,X
5010 BEQ .1
5020 JSR .4
5030 BNE .2
5040 .1 JSR .5
5050 .2 DEC TEMP2
5060 DEC TEMP1
5070 LDA TEMP2
5080 CMP FOODY
5090 BCS .3
5100 RTS
5110 .4 LDY TEMP4
5120 LDX TEMP2
5130 LDA AAMSBYT,X
5140 STA POINTER1+1
5150 LDA AALSBYT,X
5160 STA POINTER1
5170 LDA (POINTER1),Y
5180 AND #$3F
5190 STA TEMP3
5200 LDA (POINTER1),Y
5210 AND #$C0
5220 STA (POINTER1),Y
5230 TYA
5240 CLC
5250 LDX FOODNUM
5260 ADC TABLE114,X
5270 TAY
5280 LDA (POINTER1),Y
5290 AND #$C0
5300 ORA TEMP3
5310 STA (POINTER1),Y
5320 RTS
5330 .5 LDX FOODNUM
5340 LDA TEMP4
5350 CLC
5360 ADC TABLE114,X
5370 TAY
5380 LDX TEMP2
5390 LDA AAMSBYT,X
5400 STA POINTER1+1
5410 LDA AALSBYT,X
5420 STA POINTER1
5430 LDA (POINTER1),Y
5440 AND #$C0
5450 STA (POINTER1),Y
5460 RTS
5470 FOOD.INITIALIZE
5480 LDA #$00
5490 STA FOODNUM
5500 LDA #$0A
5510 STA K8
5520 STA INIT.K8
5530 LDX #$07
5540 .1 LDA TABLE93,X
5550 STA FOODBYT1,X
5560 LDA TABLE94,X
5570 STA FOODBYT2,X
5580 LDA TABLE95,X
5590 STA ANTPOSITIONS,X
5600 LDA #$81
5610 STA FOODBYT3,X
5620 LDA #$00
5630 STA ANT.ORIENTATIONS,X
5640 DEX
5650 BPL .1
5660 RTS
5670 MASTER.FOOD
5680 DEC K8
5690 BEQ .3
5700 RTS
5710 .3 LDA INIT.K8
5720 STA K8
5730 .1 LDX FOODNUM
5740 DEX
5750 BPL .2
5760 LDX #$07
5770 .2 STX FOODNUM
5780 .9 LDA FOODBYT1,X
5790 STA FOODX
5800 LDA FOODBYT2,X
5810 STA FOODY
5820 LDA FOODBYT3,X
5830 STA BYTE3
5840 LDA ANTPOSITIONS,X
5850 STA ANTPOS
5860 LDA ANT.ORIENTATIONS,X
5870 STA ORIENT
5880 LDY #$07
5890 LDA #$00
5900 STA TEMP1
5910 .5 LDA FOODBYT3,Y
5920 AND #$02
5930 BEQ .4
5940 INC TEMP1
5950 .4 DEY
5960 BPL .5
5970 LDY TEMP1
5980 LDA TABLE123,X
5990 BNE .6
6000 CPY #$02
6010 BNE .7
6020 LDA BYTE3
6030 AND #$02
6040 BNE .7
6050 LDY TABLE122,X
6060 LDA TABLE105,X
6070 STA TEMP1
6080 LDA #$05
6090 JMP HORIZ.FOOD2
6100 .7 JMP HORIZ.FOOD
6110 .6 CPY #$02
6120 BNE .8
6130 LDA BYTE3
6140 AND #$02
6150 BNE .8
6160 LDY TABLE122,X
6170 LDA TABLE105,X
6180 STA TEMP1
6190 LDA #$05
6200 JMP VERT.FOOD2.Z
6210 .8 JMP VERT.FOOD.Z
6220 UPDATE.VERT.ANTBYTS
6230 LDX FOODNUM
6240 LDA FOODX
6250 CLC
6260 ADC TABLE120,X
6270 STA TEMP4
6280 LDA TABLE122,X
6290 STA TEMP1
6300 CLC
6310 ADC FOODY
6320 STA TEMP2
6330 .3 LDX TEMP1
6340 LDA ANTHOLD,X
6350 BEQ .1
6360 JSR .2
6370 .1 DEC TEMP2
6380 DEC TEMP1
6390 LDA TEMP2
6400 CMP FOODY
6410 BCS .3
6420 RTS
6430 .2 LDY TEMP4
6440 LDX TEMP2
6450 LDA AAMSBYT,X
6460 STA POINTER1+1
6470 LDA AALSBYT,X
6480 STA POINTER1
6490 LDA (POINTER1),Y
6500 AND #$1F
6510 TAY
6520 LDX FOODNUM
6530 LDA TABLE109,X
6540 CLC
6550 ADC ANTPOS
6560 TAX
6570 LDA TABLE111,X
6580 STA ANTBYT3,Y
6590 LDA ANTBYT1,Y
6600 AND #$C0
6610 STA TEMP3
6620 LDA FOODX
6630 CLC
6640 ADC TABLE124,X
6650 ORA TEMP3
6660 STA ANTBYT1,Y
6670 RTS
6680 UPDATE.HORIZ.DESTBYTS
6690 LDX FOODNUM
6700 LDA TABLE114,X
6710 UPDATE.HORIZ.DESTBYTS2
6720 STA TEMP2
6730 LDA TABLE122,X
6740 STA HEIGHT
6750 LDY TABLE118,X
6760 .6 JSR .5
6770 INY
6780 DEC HEIGHT
6790 BPL .6
6800 RTS
6810 .5 LDA DESTBYT2,Y
6820 EOR #$04
6830 STA DESTBYT2,Y
6840 LDA DESTBYT1,Y
6850 AND #$C0
6860 STA TEMP1
6870 LDA DESTBYT1,Y
6880 CLC
6890 ADC TEMP2
6900 STA DESTBYT1,Y
6910 RTS
6920 .OR $6F00
6930 .TA $1F00
6940 TABLE93 .HS 0C111B210C121B22
6950 TABLE94 .HS 0808080911131311
6960 TABLE95 .HS 0400000004000004
6970 TABLE100 .HS 6666666767686868
6980 TABLE101 .HS 0080C00090205090
6990 TABLE102 .HS 4080C048D82050D0
7000 TABLE103 .HS 2010101818101020
7010 TABLE104 .HS 0204030303030402
7020 TABLE105 .HS FF03070A0D101317
7030 TABLE106 .HS 03070A0D1013171B
7040 TABLE107 .HS 0303020202020303
7050 TABLE108 .HS 2000003020101030
7060 TABLE109 .HS 0000080810101818
7070 TABLE110 .HS 0201010102010101FEFFFFFFFFFFFFFF0302020203020202FEFFFFFFFFFFFFFF
7080 TABLE111 .HS 0001020304040506030302010006050404040506000102030303020100060504
7090 TABLE112 .HS 40111B4888121B88
7100 TABLE113 .HS 0000000200010101
7110 TABLE114 .HS FFFFFF01FF010101
7120 TABLE115 .HS 0C00000C14000015
7130 TABLE116 .HS 0201012C011A1A2C
7140 TABLE117 .HS 04080B0E1114181C
7150 TABLE118 .HS 0004080B0E111418
7160 TABLE119 .HS 0117172F0117172F
7170 TABLE120 .HS 020202FF03FFFFFF
7180 TABLE121 .HS 7008087070E0E070
7190 TABLE122 .HS 0303020202020303
7200 TABLE123 .HS 00FFFF0000FFFF00
7210 TABLE124 .HS 0101010101010101FFFFFFFF00FFFFFF0202020202020202FFFFFFFF00FFFFFF
7220 TABLE125 .HS 0303032B0219192B
7230 TABLE126 .HS 10090A0B0C0D0E0F10090A0B0C0D0E0FF8FFFEFDFCFBFAF9F8FFFEFDFCFBFAF9
7240 TABLE127 .HS 00F8F80000080800
7250 TABLE128 .HS 030303FE04FEFEFE
7260 TABLE129 .HS 08090A0B03030303030303090A0B1112131919191919191911121314
7270 .LI ON
7280 TABLE130 .HS 04040404111213141B1C1D2B2B2B0404041213141B1C1D1E2B2B2B2B
7290 .LI OFF