C64 Software  <  SCA: The C64 Software Collection / SPRITECALC SIMON

  Run
1000              ;
1010              ; SPRITECALC    V2.1
1020              ;
1030              ; FUER SIMON'S BASIC
1040              ;
1050              ORG 32256
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 SPRITEADR    EQU 832
1140 FREE         EQU 704
1150 XADR         EQU 20
1160 YADR         EQU 151
1170 X            EQU FREE
1180 Y            EQU FREE+2
1190 SPRX         EQU FREE+3
1200 SPRY         EQU FREE+5
1210 OFFY         EQU FREE+6
1220              ;
1230              ;
1240 EINSPRUNG    JSR $AEFD
1250              JSR $B7EB
1260              STX YADR
1270              SEI
1280              LDA #53
1290              STA 1
1300              ;
1310 CLSPRITE     LDX #63
1320              LDA #0
1330 CLSPRITE1    STA SPRITEADR,X
1340              DEX
1350              BPL CLSPRITE1
1360              ;
1370 CALC         LDA YADR
1380              STA Y
1390              LDA #0
1400              STA SPRY
1410              LDA #20
1420              STA TMP0
1430 LOOP1        LDA XADR
1440              STA X
1450              LDA XADR+1
1460              STA X+1
1470              LDA #0
1480              STA SPRX
1490              LDX #23
1500 LOOP2        JSR TEST
1510              BEQ CALC1
1520              BCS CALC1
1530              JSR SPRITESET
1540 CALC1        INC X
1550              BNE CALC2
1560              INC X+1
1570 CALC2        INC SPRX
1580              DEX
1590              BPL LOOP2
1600              INC Y
1610              INC SPRY
1620              DEC TMP0
1630              BPL LOOP1
1640              LDA #55
1650              STA 1
1660              CLI
1670              RTS
1680              ;
1690              ;
1700              ;BRAUCHT A,Y,TMP1
1710              ;
1720 SET          LDA #1
1730              DFB $2C
1740 TEST         LDA #0
1750              DFB $2C
1760 RESET        LDA #255
1770              STA FLAG
1780              LDA Y
1790              CMP #200
1800              BCS ERR
1810              LDA X+1
1820              CMP #>320
1830              BCC SET1
1840              BNE ERR
1850              LDA X
1860              CMP #<320
1870              BCC SET1
1880 ERR          SEC
1890              RTS
1900              ;
1910 SET1         LDA Y
1920              LSR
1930              LSR
1940              LSR
1950              ASL ; DURCH 8 MAL 2
1960              TAY
1970              ;
1980              LDA MULTTAB,Y
1990              STA OFFY
2000              LDA MULTTAB+1,Y
2010              STA OFFY+1
2020              LDA Y
2030              AND #7
2040              CLC
2050              ADC OFFY
2060              STA OFFY
2070              ;
2080              CLC
2090              LDA #<BMAP
2100              ADC OFFY
2110              STA TMP1
2120              LDA #>BMAP
2130              ADC OFFY+1
2140              STA TMP1+1
2150              CLC
2160              LDA X
2170              AND #%11111000; BITS 0-2 AUSBLENDEN
2180              ADC TMP1
2190              STA TMP1
2200              LDA X+1
2210              ADC TMP1+1
2220              STA TMP1+1
2230              ;
2240              LDA X
2250              AND #7
2260              EOR #7
2270              TAY
2280              LDA ZWEIHOCH,Y
2290              LDY #0
2300              BIT FLAG
2310              BCS RESETTEN
2320              BNE SETTEN
2330 TESTEN       AND (TMP1),Y
2340              CLC
2350              RTS
2360 SETTEN       ORA (TMP1),Y
2370              STA (TMP1),Y
2380              CLC
2390              RTS
2400 RESETTEN     EOR #255
2410              AND (TMP1),Y
2420              STA (TMP1),Y
2430              CLC
2440              RTS
2450              ;
2460              ;
2470 ZWEIHOCH     DFB 1,2,4,8,16,32,64,128
2480 MULTTAB      DFB 0,00,64,01,128,02,196,03
2490              DFB 0,05,64,06,128,07,196,08
2500              DFB 0,10,64,11,128,12,196,13
2510              DFB 0,15,64,16,128,17,196,18
2520              DFB 0,20,64,21,128,22,196,23
2530              DFB 0,25,64,26,128,27,196,28
2540              DFB 0,30
2550              ;
2560              ;
2570 SPRITESET    LDA #<SPRITEADR
2580              STA TMP1
2590              LDA #>SPRITEADR
2600              STA TMP1+1
2610              CLC
2620              LDA SPRY
2630              ADC SPRY
2640              ADC SPRY ; MAL 3
2650              STA TMP2
2660              LDA SPRX
2670              LSR
2680              LSR
2690              LSR      ; DURCH 8
2700              CLC
2710              ADC TMP2
2720              ADC TMP1
2730              STA TMP1
2740              BCC SPRSET1
2750              INC TMP1+1
2760 SPRSET1      LDA SPRX
2770              AND #7
2780              EOR #7
2790              TAY
2800              LDA ZWEIHOCH,Y
2810              LDY #0
2820              ORA (TMP1),Y
2830              STA (TMP1),Y
2840              RTS
READY.