1000 ;
1010 ; HRGCALC V1.0
1020 ;
1030 ; FUER SIMON'S BASIC
1040 ;
1050 ORG 16384
1060 ;
1070 FLAG EQU 247
1080 TMP0 EQU 248
1090 TMP1 EQU 250
1100 TMP2 EQU 252
1110 TMP3 EQU 254
1120 BMAP EQU $E000
1130 SPRITEPTR EQU BMAP-6152
1140 FREE EQU 704
1150 XADR EQU 20
1160 YADR EQU FREE
1170 X EQU FREE+1
1180 Y EQU FREE+3
1190 SPRX EQU FREE+4
1200 SPRY EQU FREE+6
1210 OFFY EQU FREE+7
1220 SPRITENR EQU FREE+9
1230 ;
1240 ;
1250 EINSPRUNG JSR $AEFD
1260 JSR $B7EB
1270 STX SPRITENR
1280 SEI
1290 LDA #53
1300 STA 1
1310 ;
1320 ;
1330 CALC LDY SPRITENR
1340 TYA
1350 ASL
1360 TAY
1370 LDA 53248,Y ; SPRX
1380 STA XCORD
1390 LDY SPRITENR
1400 LDA ZWEIHOCH,Y
1410 LDY #1
1420 AND 53264 ; MSBS
1430 BNE CALC1
1440 DEY
1450 CALC1 STY XCORD+1
5000 CALC LDA YADR
5010 STA Y
5020 LDA #0
5030 STA SPRY
5040 LDA #20
5050 STA TMP0
5060 LOOP1 LDA XADR
5070 STA X
5080 LDA XADR+1
5090 STA X+1
5100 LDA #0
5110 STA SPRX
5120 LDX #23
5130 LOOP2 JSR TEST
5140 BEQ CALC1
5150 BCS CALC1
5160 JSR HRGSET
5170 CALC1 INC X
5180 BNE CALC2
5190 INC X+1
5200 CALC2 INC SPRX
5210 DEX
5220 BPL LOOP2
5230 INC Y
5240 INC SPRY
5250 DEC TMP0
5260 BPL LOOP1
5270 LDA #55
5280 STA 1
5290 CLI
5300 RTS
5310 ;
5320 ;
5330 ;BRAUCHT A,Y,TMP1
5340 ;
5350 HRGSET LDA #1
5360 DFB $2C
5370 TEST LDA #0
5380 DFB $2C
5390 RESET LDA #255
5400 STA FLAG
5410 LDA Y
5420 CMP #200
5430 BCS ERR
5440 LDA X+1
5450 CMP #>320
5460 BCC SET1
5470 BNE ERR
5480 LDA X
5490 CMP #<320
5500 BCC SET1
5510 ERR SEC
5520 RTS
5530 ;
5540 SET1 LDA Y
5550 LSR
5560 LSR
5570 LSR
5580 ASL ; DURCH 8 MAL 2
5590 TAY
5600 ;
5610 LDA MULTTAB,Y
5620 STA OFFY
5630 LDA MULTTAB+1,Y
5640 STA OFFY+1
5650 LDA Y
5660 AND #7
5670 CLC
5680 ADC OFFY
5690 STA OFFY
5700 ;
5710 CLC
5720 LDA #<BMAP
5730 ADC OFFY
5740 STA TMP1
5750 LDA #>BMAP
5760 ADC OFFY+1
5770 STA TMP1+1
5780 CLC
5790 LDA X
5800 AND #%11111000
5810 ADC TMP1
5820 STA TMP1
5830 LDA X+1
5840 ADC TMP1+1
5850 STA TMP1+1
5860 ;
5870 LDA X
5880 AND #7
5890 EOR #7
5900 TAY
5910 LDA ZWEIHOCH,Y
5920 LDY #0
5930 BIT FLAG
5940 BCS RESETTEN
5950 BNE SETTEN
5960 TESTEN AND (TMP1),Y
5970 CLC
5980 RTS
5990 SETTEN ORA (TMP1),Y
6000 STA (TMP1),Y
6010 CLC
6020 RTS
6030 RESETTEN EOR #255
6040 AND (TMP1),Y
6050 STA (TMP1),Y
6060 CLC
6070 RTS
6080 ;
6090 ;
6100 ZWEIHOCH DFB 1,2,4,8,16,32,64,128
6110 MULTTAB DFB 0,00,64,01,128,02,196,03
6120 DFB 0,05,64,06,128,07,196,08
6130 DFB 0,10,64,11,128,12,196,13
6140 DFB 0,15,64,16,128,17,196,18
6150 DFB 0,20,64,21,128,22,196,23
6160 DFB 0,25,64,26,128,27,196,28
6170 DFB 0,30
6180 ;
6190 ;
6200 SPRITETEST LDY SPRITENR
6210 LDA SPRITEPTR,Y
6220 ASL
6230 ASL
6240 ASL
6250 ASL
6260 ASL
6270 ASL
6280 STA TMP1
6290 LDA SPRITEPTR,Y
6300 LSR
6310 LSR
6320 STA TMP1+1
6330 CLC
6340 LDA SPRY
6350 ADC SPRY
6360 ADC SPRY ; MAL 3
6370 STA TMP2
6380 LDA SPRX
6390 LSR
6400 LSR
6410 LSR ; DURCH 8
6420 CLC
6430 ADC TMP2
6440 ADC TMP1
6450 STA TMP1
6460 BCC SPRTST1
6470 INC TMP1+1
6480 SP RTST1 LDA SPRX
6490 AND #7
6500 EOR #7
6510 TAY
6520 LDA ZWEIHOCH,Y
6530 LDY #0
6540 AND (TMP1),Y
6550 RTS
READY.